@Test public void testEmpty() { ScRequest request = mSession.readItemsRequest(null, null).build(); assertEquals("http: }
public ScRequest<? extends ScResponse> build() { final String url = mOptions.getFullUrl(); ScRequest request; switch (mRequestMethod) { case Request.Method.GET: request = new ReadItemsRequest(url, mSuccessListener, mErrorListener); break; case Request.Method.POST: final String postUrl = url.contains("?") ? url + "&" + mOptions.getCreateItemParams() : url + "?" + mOptions.getCreateItemParams(); request = new CreateItemRequest(postUrl, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.PUT: request = new EditItemsRequest(url, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.DELETE: request = new DeleteItemsRequest(url, mSuccessListener, mErrorListener); break; default: throw new IllegalArgumentException("Incorrect request method: " + mRequestMethod); } if (!mSession.isAnonymous()) { request.addHeader("X-Scitemwebapi-Username", mSession.createEncodedName()); request.addHeader("X-Scitemwebapi-Password", mSession.createEncodedPassword()); request.addHeader("X-Scitemwebapi-Encrypted", "1"); } if (mSession.shouldCache()) request.setShouldCache(true); LOGD("Created request: " + request); return request; }
RequestBuilder { public ScRequest<? extends ScResponse> build() { final String url = mOptions.getFullUrl(); ScRequest request; switch (mRequestMethod) { case Request.Method.GET: request = new ReadItemsRequest(url, mSuccessListener, mErrorListener); break; case Request.Method.POST: final String postUrl = url.contains("?") ? url + "&" + mOptions.getCreateItemParams() : url + "?" + mOptions.getCreateItemParams(); request = new CreateItemRequest(postUrl, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.PUT: request = new EditItemsRequest(url, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.DELETE: request = new DeleteItemsRequest(url, mSuccessListener, mErrorListener); break; default: throw new IllegalArgumentException("Incorrect request method: " + mRequestMethod); } if (!mSession.isAnonymous()) { request.addHeader("X-Scitemwebapi-Username", mSession.createEncodedName()); request.addHeader("X-Scitemwebapi-Password", mSession.createEncodedPassword()); request.addHeader("X-Scitemwebapi-Encrypted", "1"); } if (mSession.shouldCache()) request.setShouldCache(true); LOGD("Created request: " + request); return request; } }
RequestBuilder { public ScRequest<? extends ScResponse> build() { final String url = mOptions.getFullUrl(); ScRequest request; switch (mRequestMethod) { case Request.Method.GET: request = new ReadItemsRequest(url, mSuccessListener, mErrorListener); break; case Request.Method.POST: final String postUrl = url.contains("?") ? url + "&" + mOptions.getCreateItemParams() : url + "?" + mOptions.getCreateItemParams(); request = new CreateItemRequest(postUrl, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.PUT: request = new EditItemsRequest(url, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.DELETE: request = new DeleteItemsRequest(url, mSuccessListener, mErrorListener); break; default: throw new IllegalArgumentException("Incorrect request method: " + mRequestMethod); } if (!mSession.isAnonymous()) { request.addHeader("X-Scitemwebapi-Username", mSession.createEncodedName()); request.addHeader("X-Scitemwebapi-Password", mSession.createEncodedPassword()); request.addHeader("X-Scitemwebapi-Encrypted", "1"); } if (mSession.shouldCache()) request.setShouldCache(true); LOGD("Created request: " + request); return request; } RequestBuilder(ScApiSession session, int requestMethod); }
RequestBuilder { public ScRequest<? extends ScResponse> build() { final String url = mOptions.getFullUrl(); ScRequest request; switch (mRequestMethod) { case Request.Method.GET: request = new ReadItemsRequest(url, mSuccessListener, mErrorListener); break; case Request.Method.POST: final String postUrl = url.contains("?") ? url + "&" + mOptions.getCreateItemParams() : url + "?" + mOptions.getCreateItemParams(); request = new CreateItemRequest(postUrl, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.PUT: request = new EditItemsRequest(url, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.DELETE: request = new DeleteItemsRequest(url, mSuccessListener, mErrorListener); break; default: throw new IllegalArgumentException("Incorrect request method: " + mRequestMethod); } if (!mSession.isAnonymous()) { request.addHeader("X-Scitemwebapi-Username", mSession.createEncodedName()); request.addHeader("X-Scitemwebapi-Password", mSession.createEncodedPassword()); request.addHeader("X-Scitemwebapi-Encrypted", "1"); } if (mSession.shouldCache()) request.setShouldCache(true); LOGD("Created request: " + request); return request; } RequestBuilder(ScApiSession session, int requestMethod); RequestBuilder apiVersion(int version); RequestBuilder fromSite(String site); RequestBuilder byItemPath(String path); RequestBuilder byItemId(String itemId); RequestBuilder itemVersion(int version); RequestBuilder database(String database); RequestBuilder setLanguage(String language); RequestBuilder setFields(Set<String> fields); RequestBuilder setFields(String... fields); RequestBuilder withPayloadType(PayloadType payloadType); RequestBuilder withScope(RequestScope scope, RequestScope... otherScopes); RequestBuilder bySitecoreQuery(String query); RequestBuilder setPage(int pageNumber, int pageSize); RequestBuilder updateFieldValue(String key, String value); ScRequest<? extends ScResponse> build(); }
RequestBuilder { public ScRequest<? extends ScResponse> build() { final String url = mOptions.getFullUrl(); ScRequest request; switch (mRequestMethod) { case Request.Method.GET: request = new ReadItemsRequest(url, mSuccessListener, mErrorListener); break; case Request.Method.POST: final String postUrl = url.contains("?") ? url + "&" + mOptions.getCreateItemParams() : url + "?" + mOptions.getCreateItemParams(); request = new CreateItemRequest(postUrl, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.PUT: request = new EditItemsRequest(url, mOptions.mFieldValues, mSuccessListener, mErrorListener); break; case Request.Method.DELETE: request = new DeleteItemsRequest(url, mSuccessListener, mErrorListener); break; default: throw new IllegalArgumentException("Incorrect request method: " + mRequestMethod); } if (!mSession.isAnonymous()) { request.addHeader("X-Scitemwebapi-Username", mSession.createEncodedName()); request.addHeader("X-Scitemwebapi-Password", mSession.createEncodedPassword()); request.addHeader("X-Scitemwebapi-Encrypted", "1"); } if (mSession.shouldCache()) request.setShouldCache(true); LOGD("Created request: " + request); return request; } RequestBuilder(ScApiSession session, int requestMethod); RequestBuilder apiVersion(int version); RequestBuilder fromSite(String site); RequestBuilder byItemPath(String path); RequestBuilder byItemId(String itemId); RequestBuilder itemVersion(int version); RequestBuilder database(String database); RequestBuilder setLanguage(String language); RequestBuilder setFields(Set<String> fields); RequestBuilder setFields(String... fields); RequestBuilder withPayloadType(PayloadType payloadType); RequestBuilder withScope(RequestScope scope, RequestScope... otherScopes); RequestBuilder bySitecoreQuery(String query); RequestBuilder setPage(int pageNumber, int pageSize); RequestBuilder updateFieldValue(String key, String value); ScRequest<? extends ScResponse> build();  }