コード例 #1
0
 public boolean put(Object object, int objectId) {
   String endpoint = getAnnotatedEndpoint(object);
   String requestUri = configuration.getApiBaseUri() + endpoint + "/" + objectId;
   HttpRequestWithBody request = UnirestUtil.put(requestUri, object, headers());
   Put put = new Put(UnirestUtil.getObjectResponse(request));
   apiErrorCollection = put.getApiErrorCollection();
   return put.isValid(request.getHttpMethod());
 }
コード例 #2
0
 public Integer post(Object object) {
   String endpoint = getAnnotatedEndpoint(object);
   String requestUri = configuration.getApiBaseUri() + endpoint;
   HttpRequestWithBody request = UnirestUtil.post(requestUri, object, headers());
   Post post = new Post(UnirestUtil.getObjectResponse(request));
   apiErrorCollection = post.getApiErrorCollection();
   return post.objectId();
 }
コード例 #3
0
 public <T> List<?> getList(Object object) {
   String endpoint = getAnnotatedEndpoint(object);
   String requestUri = configuration.getApiBaseUri() + endpoint;
   GetRequest request = UnirestUtil.get(requestUri, headers());
   Get get = new Get(UnirestUtil.getObjectResponse(request), object);
   List<?> list = get.getAsList();
   apiErrorCollection = get.getApiErrorCollection();
   return list;
 }
コード例 #4
0
 public Object getObject(Object object, int objectId) {
   String endpoint = getAnnotatedEndpoint(object);
   String requestUri = configuration.getApiBaseUri() + endpoint + "/" + objectId;
   GetRequest request = UnirestUtil.get(requestUri, headers());
   Get get = new Get(UnirestUtil.getObjectResponse(request), object);
   object = get.getAsObject();
   apiErrorCollection = get.getApiErrorCollection();
   return object;
 }
コード例 #5
0
 public BaseEndpoint() {
   UnirestUtil.init();
 }