下面列出了怎么用javax.ws.rs.core.GenericType的API类实例代码及写法,或者点击链接到github查看源代码。
@Test
void testGetAssets() {
var service = engine.getService(AssetService.class);
var asset = new Asset("ASSET_TYPE", "some-id", "some-name", new AssetProperties());
service.update(asset);
var assets =
target("assets")
.path(ASSET_TYPE)
.request()
.header(
AuthenticationFilter.HEADER_AUTHORIZATION,
AuthenticationFilter.createAuthorization(this.token))
.get(new GenericType<Set<Asset>>() {});
assertNotNull(assets);
assertFalse(assets.isEmpty());
}
@Test
void testRules() throws IOException {
var service = engine.getService(RuleService.class);
service.load(FileSystemManager.getInstance().getPathForResource("rules/test"));
var rules =
target("rules")
.request()
.header(
AuthenticationFilter.HEADER_AUTHORIZATION,
AuthenticationFilter.createAuthorization(this.token))
.get(new GenericType<Map<String, Set<Rule>>>() {});
assertNotNull(rules);
var rule = rules.get("Asset").toArray()[0];
assertNotNull(rule);
}
@Override
protected Result check() throws Exception {
String url = "http://" + config.getHost() + ":" + config.getManagementPort() + "/api/healthchecks/node";
String creds = config.getUsername() + ":" + config.getPassword();
String authHeader = "Basic " + Base64.getEncoder().encodeToString(creds.getBytes());
Client client = new JerseyClientBuilder().build();
Map<String, String> result = client
.target(url)
.request(APPLICATION_JSON)
.header(AUTHORIZATION, authHeader)
.get()
.readEntity(new GenericType<HashMap<String, String>>() {});
if (result.get("status").equals("ok")) {
return Result.healthy();
} else {
return Result.unhealthy(result.get("reason"));
}
}
/**
* Get a list of events for the specified user and in the specified page range.
* <p>
* GET /users/:userId/events
*
* @param userId the user ID to get the events for, required
* @param action include only events of a particular action type, optional
* @param targetType include only events of a particular target type, optional
* @param before include only events created before a particular date, optional
* @param after include only events created after a particular date, optional
* @param sortOrder sort events in ASC or DESC order by created_at. Default is DESC, optional
* @param page the page to get
* @param perPage the number of projects per page
* @return a list of events for the specified user and matching the supplied parameters
* @throws GitLabApiException if any exception occurs
*/
public List<Event> getUserEvents(Integer userId, ActionType action, TargetType targetType,
Date before, Date after, SortOrder sortOrder, int page, int perPage) throws GitLabApiException {
if (userId == null) {
throw new RuntimeException("user ID cannot be null");
}
GitLabApiForm formData = new GitLabApiForm()
.withParam("action", action)
.withParam("target_type", targetType)
.withParam("before", before)
.withParam("after", after)
.withParam("sort", sortOrder)
.withParam(PAGE_PARAM, page)
.withParam(PER_PAGE_PARAM, perPage);
Response response = get(Response.Status.OK, formData.asMap(), "users", userId, "events");
return (response.readEntity(new GenericType<List<Event>>() {
}));
}
public <T> T post(boolean useToken, Token tokenToUse , Class<T> type, Map entity,
final QueryParameters queryParameters, boolean useBasicAuthentication) {
WebTarget resource = getTarget( useToken,tokenToUse );
resource = addParametersToResource(resource, queryParameters);
GenericType<T> gt = new GenericType<>((Class) type);
if (useBasicAuthentication) {
HttpAuthenticationFeature feature = HttpAuthenticationFeature.basicBuilder()
.credentials("superuser", "superpassword").build();
return resource.register(feature).request()
.accept(MediaType.APPLICATION_JSON)
.post(javax.ws.rs.client.Entity.json(entity), gt);
}
return resource.request()
.accept(MediaType.APPLICATION_JSON)
.post(javax.ws.rs.client.Entity.json(entity), gt);
}
/**
* Get a list of repository commit statuses that meet the provided filter.
*
* <pre><code>GitLab Endpoint: GET /projects/:id/repository/commits/:sha/statuses</code></pre>
*
* @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
* @param sha the commit SHA
* @param filter the commit statuses file, contains ref, stage, name, all
* @param page the page to get
* @param perPage the number of commits statuses per page
* @return a List containing the commit statuses for the specified project and sha that meet the provided filter
* @throws GitLabApiException GitLabApiException if any exception occurs during execution
*/
public List<CommitStatus> getCommitStatuses(Object projectIdOrPath, String sha,
CommitStatusFilter filter, int page, int perPage) throws GitLabApiException {
if (projectIdOrPath == null) {
throw new RuntimeException("projectIdOrPath cannot be null");
}
if (sha == null || sha.trim().isEmpty()) {
throw new RuntimeException("sha cannot be null");
}
MultivaluedMap<String, String> queryParams = (filter != null ?
filter.getQueryParams(page, perPage).asMap() : getPageQueryParams(page, perPage));
Response response = get(Response.Status.OK, queryParams,
"projects", this.getProjectIdOrPath(projectIdOrPath), "repository", "commits", sha, "statuses");
return (response.readEntity(new GenericType<List<CommitStatus>>() {}));
}
/**
* Get one time download id for zipped images (media)
*
* @param request The download request (required)
* @return ApiResponse<String>
* @throws ApiException if fails to make API call
*/
public ApiResponse<String> downloadGetDownloadMediaToken_0WithHttpInfo(DownloadRequest request) throws ApiException {
Object localVarPostBody = request;
// verify the required parameter 'request' is set
if (request == null) {
throw new ApiException(400, "Missing the required parameter 'request' when calling downloadGetDownloadMediaToken_0");
}
// create path and map variables
String localVarPath = "/v4/download/media";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json", "text/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json", "text/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<String> localVarReturnType = new GenericType<String>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
public static GenericType createGenericType(String type) {
if (StringUtils.isEmpty(type)) {
throw new IllegalArgumentException("Type cannot be empty!");
}
switch (type) {
case TrpP2PaLA.TYPE:
return new GenericType<List<TrpP2PaLA>>(){};
default:
throw new IllegalArgumentException("Invalid type: "+type);
}
}
public ProvisioningResult<GroupTO> update(final String etag, final GroupUR updateReq) {
ProvisioningResult<GroupTO> result;
synchronized (this) {
result = getService(etag, GroupService.class).update(updateReq).
readEntity(new GenericType<ProvisioningResult<GroupTO>>() {
});
resetClient(getAnyServiceClass());
}
return result;
}
/**
* ListPayments
* Retrieves a list of payments taken by the account making the request. Max results per page: 100
* @param beginTime Timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive. Default: The current time minus one year. (optional)
* @param endTime Timestamp for the end of the requested reporting period, in RFC 3339 format. Default: The current time. (optional)
* @param sortOrder The order in which results are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest (default). (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional)
* @param locationId ID of location associated with payment (optional)
* @param total The exact amount in the total_money for a `Payment`. (optional)
* @param last4 The last 4 digits of `Payment` card. (optional)
* @param cardBrand The brand of `Payment` card. For example, `VISA` (optional)
* @return ListPaymentsResponse
* @throws ApiException if fails to make API call
*/
public ListPaymentsResponse listPayments(String beginTime, String endTime, String sortOrder, String cursor, String locationId, Long total, String last4, String cardBrand) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/payments";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "total", total));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "last_4", last4));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "card_brand", cardBrand));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListPaymentsResponse> localVarReturnType = new GenericType<ListPaymentsResponse>() {};
CompleteResponse<ListPaymentsResponse> completeResponse = (CompleteResponse<ListPaymentsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
@Test
public void testGetSessionDataByDataInfoId() throws Exception {
Map<String, List<Publisher>> publisherMap = sessionChannel
.getWebTarget()
.path("digest/pub/data/query")
.queryParam("dataInfoId",
DataInfo.toDataInfoId(dataId, DEFAULT_INSTANCE_ID, DEFAULT_GROUP))
.request(APPLICATION_JSON).get(new GenericType<Map<String, List<Publisher>>>() {
});
assertEquals(1, publisherMap.size());
assertEquals(1, publisherMap.get("PUB").size());
assertEquals(dataId, publisherMap.get("PUB").get(0).getDataId());
assertEquals(value, bytes2Object(publisherMap.get("PUB").get(0).getDataList().get(0)
.getBytes()));
Map<String, List<Subscriber>> subscriberMap = sessionChannel
.getWebTarget()
.path("digest/sub/data/query")
.queryParam("dataInfoId",
DataInfo.toDataInfoId(dataId, DEFAULT_INSTANCE_ID, DEFAULT_GROUP))
.request(APPLICATION_JSON).get(new GenericType<Map<String, List<Subscriber>>>() {
});
assertEquals(1, subscriberMap.size());
assertEquals(1, subscriberMap.get("SUB").size());
assertEquals(dataId, subscriberMap.get("SUB").get(0).getDataId());
Map map = sessionChannel
.getWebTarget()
.path("digest/all/data/query")
.queryParam("dataInfoId",
DataInfo.toDataInfoId(dataId, DEFAULT_INSTANCE_ID, DEFAULT_GROUP))
.request(APPLICATION_JSON).get(Map.class);
assertEquals(2, map.size());
assertEquals(1, ((List) map.get("SUB")).size());
assertEquals(1, ((List) map.get("PUB")).size());
assertEquals(dataId, ((Map) ((List) map.get("SUB")).get(0)).get("dataId"));
assertEquals(dataId, ((Map) ((List) map.get("PUB")).get(0)).get("dataId"));
assertEquals(value, bytes2Object(publisherMap.get("PUB").get(0).getDataList().get(0)
.getBytes()));
}
/**
* RetrieveCatalogObject
* Returns a single [CatalogItem](#type-catalogitem) as a [CatalogObject](#type-catalogobject) based on the provided ID. The returned object includes all of the relevant [CatalogItem](#type-catalogitem) information including: [CatalogItemVariation](#type-catalogitemvariation) children, references to its [CatalogModifierList](#type-catalogmodifierlist) objects, and the ids of any [CatalogTax](#type-catalogtax) objects that apply to it.
* @param objectId The object ID of any type of catalog objects to be retrieved. (required)
* @param includeRelatedObjects If `true`, the response will include additional objects that are related to the requested object, as follows: If the `object` field of the response contains a CatalogItem, its associated CatalogCategory, CatalogTax objects, CatalogImages and CatalogModifierLists will be returned in the `related_objects` field of the response. If the `object` field of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in the `related_objects` field of the response. Default value: `false` (optional)
* @return CompleteResponse<RetrieveCatalogObjectResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<RetrieveCatalogObjectResponse>retrieveCatalogObjectWithHttpInfo(String objectId, Boolean includeRelatedObjects) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'objectId' is set
if (objectId == null) {
throw new ApiException(400, "Missing the required parameter 'objectId' when calling retrieveCatalogObject");
}
// create path and map variables
String localVarPath = "/v2/catalog/object/{object_id}"
.replaceAll("\\{" + "object_id" + "\\}", apiClient.escapeString(objectId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include_related_objects", includeRelatedObjects));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<RetrieveCatalogObjectResponse> localVarReturnType = new GenericType<RetrieveCatalogObjectResponse>() {};
return (CompleteResponse<RetrieveCatalogObjectResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
@Test
void action() { // the mock returns its input to allow is to test input is deciphered
final Map<String, String> decrypted = base()
.path("api/v1/action/execute")
.queryParam("family", "testf")
.queryParam("type", "testt")
.queryParam("action", "testa")
.queryParam("lang", "testl")
.request(APPLICATION_JSON_TYPE)
.header("x-talend-tenant-id", "test-tenant")
.post(entity(new HashMap<String, String>() {
{
put("configuration.username", "simple");
put("configuration.password", "vault:v1:hcccVPODe9oZpcr/sKam8GUrbacji8VkuDRGfuDt7bg7VA==");
}
}, APPLICATION_JSON_TYPE), new GenericType<Map<String, String>>() {
});
assertEquals(new HashMap<String, String>() {
{
// original value (not ciphered)
put("configuration.username", "simple");
// deciphered value
put("configuration.password", "test");
// action input config
put("family", "testf");
put("type", "testt");
put("action", "testa");
put("lang", "testl");
}
}, decrypted);
}
/**
* Create OpenID Connect IDP configuration
* ### Functional Description: Create new OpenID Connect IDP configuration. ### Precondition: Right _\"change global config\"_ required. Role _Config Manager_ of the Provider Customer. ### Effects: New OpenID Connect IDP configuration is created. ### &#9432; Further Information: See [http://openid.net/developers/specs](http://openid.net/developers/specs) for further information.
*
* @param body body (required)
* @param xSdsAuthToken Authentication token (optional)
* @return ApiResponse<OpenIdIdpConfig>
* @throws ApiException if fails to make API call
*/
public ApiResponse<OpenIdIdpConfig> createOpenIdIdpConfigWithHttpInfo(CreateOpenIdIdpConfigRequest body, String xSdsAuthToken) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if(body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling createOpenIdIdpConfig");
}
// create path and map variables
String localVarPath = "/v4/system/config/auth/openid/idps";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if(xSdsAuthToken != null) {
localVarHeaderParams.put("X-Sds-Auth-Token", apiClient.parameterToString(xSdsAuthToken));
}
final String[] localVarAccepts = {
"application/json;charset=UTF-8"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json;charset=UTF-8"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{"DRACOON-OAuth"};
GenericType<OpenIdIdpConfig> localVarReturnType = new GenericType<OpenIdIdpConfig>() {
};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
@Test
@SuppressWarnings("unchecked")
public void testGetAllModules() {
Response response = target("/v1/definitions").request().get();
Map<String, Object> definitions = response.readEntity(new GenericType<Map<String, Object>>() {});
//check the pipeline definition
Assert.assertTrue(definitions.containsKey(StageLibraryResource.PIPELINE));
List<Object> pipelineDefinition = (List<Object>)definitions.get(StageLibraryResource.PIPELINE);
Assert.assertNotNull(pipelineDefinition);
Assert.assertTrue(pipelineDefinition.size() == 1);
//check the stages
Assert.assertTrue(definitions.containsKey(StageLibraryResource.STAGES));
List<Object> stages = (List<Object>)definitions.get(StageLibraryResource.STAGES);
Assert.assertNotNull(stages);
Assert.assertEquals(2, stages.size());
//check the rules El metadata
Assert.assertTrue(definitions.containsKey(StageLibraryResource.RULES_EL_METADATA));
Map<String, Map> rulesElMetadata = (Map<String, Map>)definitions.get(StageLibraryResource.RULES_EL_METADATA);
Assert.assertNotNull(rulesElMetadata);
Assert.assertTrue(rulesElMetadata.containsKey(RuleELRegistry.GENERAL));
Assert.assertTrue(rulesElMetadata.containsKey(RuleELRegistry.DRIFT));
Assert.assertTrue(rulesElMetadata.get(RuleELRegistry.GENERAL).containsKey(StageLibraryResource.EL_FUNCTION_DEFS));
Assert.assertTrue(rulesElMetadata.get(RuleELRegistry.GENERAL).containsKey(StageLibraryResource.EL_CONSTANT_DEFS));
Assert.assertTrue(rulesElMetadata.get(RuleELRegistry.DRIFT).containsKey(StageLibraryResource.EL_FUNCTION_DEFS));
Assert.assertTrue(rulesElMetadata.get(RuleELRegistry.DRIFT).containsKey(StageLibraryResource.EL_CONSTANT_DEFS));
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet (required)
* @return ApiResponse<Order>
* @throws ApiException if fails to make API call
* @http.response.details
<table summary="Response Details" border="1">
<tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
<tr><td> 200 </td><td> successful operation </td><td> - </td></tr>
<tr><td> 400 </td><td> Invalid Order </td><td> - </td></tr>
</table>
*/
public ApiResponse<Order> placeOrderWithHttpInfo(Order order) throws ApiException {
Object localVarPostBody = order;
// verify the required parameter 'order' is set
if (order == null) {
throw new ApiException(400, "Missing the required parameter 'order' when calling placeOrder");
}
// create path and map variables
String localVarPath = "/store/order";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/xml", "application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
return apiClient.invokeAPI("StoreApi.placeOrder", localVarPath, "POST", localVarQueryParams, localVarPostBody,
localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType,
localVarAuthNames, localVarReturnType, false);
}
@Test
public void getAllAirportIataCodes() {
Response response = collect.path("/airports").request().get();
List<String> airportCodes = response.readEntity(new GenericType<List<String>>(){});
assertThat(airportCodes, hasItem("BOS"));
assertEquals(5, airportCodes.size());
}
private <R> Iterable<R> toIterable(Future<Response> futureResponse, Class<R> type) {
try {
Response response = futureResponse.get();
GenericType<List<R>> rGenericType = new GenericType<>(new WrappedType<R>(type));
return response.readEntity(rGenericType);
} catch (InterruptedException | ExecutionException e) {
throw new CompletionException(e);
}
}
/**
* ListPayments
* Retrieves a list of payments taken by the account making the request. Max results per page: 100
* @param beginTime Timestamp for the beginning of the reporting period, in RFC 3339 format. Inclusive. Default: The current time minus one year. (optional)
* @param endTime Timestamp for the end of the requested reporting period, in RFC 3339 format. Default: The current time. (optional)
* @param sortOrder The order in which results are listed. - `ASC` - oldest to newest - `DESC` - newest to oldest (default). (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for the original query. See [Pagination](https://developer.squareup.com/docs/basics/api101/pagination) for more information. (optional)
* @param locationId ID of location associated with payment (optional)
* @param total The exact amount in the total_money for a `Payment`. (optional)
* @param last4 The last 4 digits of `Payment` card. (optional)
* @param cardBrand The brand of `Payment` card. For example, `VISA` (optional)
* @return CompleteResponse<ListPaymentsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListPaymentsResponse>listPaymentsWithHttpInfo(String beginTime, String endTime, String sortOrder, String cursor, String locationId, Long total, String last4, String cardBrand) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v2/payments";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "location_id", locationId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "total", total));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "last_4", last4));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "card_brand", cardBrand));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListPaymentsResponse> localVarReturnType = new GenericType<ListPaymentsResponse>() {};
return (CompleteResponse<ListPaymentsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* BatchDeleteCatalogObjects
* Deletes a set of [CatalogItem](#type-catalogitem)s based on the provided list of target IDs and returns a set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children. `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted IDs can be deleted. The response will only include IDs that were actually deleted.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return BatchDeleteCatalogObjectsResponse
* @throws ApiException if fails to make API call
*/
public BatchDeleteCatalogObjectsResponse batchDeleteCatalogObjects(BatchDeleteCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchDeleteCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/batch-delete";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchDeleteCatalogObjectsResponse> localVarReturnType = new GenericType<BatchDeleteCatalogObjectsResponse>() {};
CompleteResponse<BatchDeleteCatalogObjectsResponse> completeResponse = (CompleteResponse<BatchDeleteCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
return completeResponse.getData();
}
/**
* Return a FileShare with share information and file.
*
* @param id The file id (required)
* @return ApiResponse<FileShare>
* @throws ApiException if fails to make API call
*/
public ApiResponse<FileShare> fileSharesGetByFileIdWithHttpInfo(String id) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new ApiException(400, "Missing the required parameter 'id' when calling fileSharesGetByFileId");
}
// create path and map variables
String localVarPath = "/v4/fileshares/fileid/{id}"
.replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json", "text/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<FileShare> localVarReturnType = new GenericType<FileShare>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get Active Directory configuration
* ### Functional Description: Retrieve the configuration of an Active Directory. ### Precondition: Right _\"read global config\"_ required. Role _Config Manager_ of the Provider Customer. ### Effects: None. ### &#9432; Further Information: None.
*
* @param adId Active Directory ID (required)
* @param xSdsAuthToken Authentication token (optional)
* @return ApiResponse<ActiveDirectoryConfig>
* @throws ApiException if fails to make API call
*/
public ApiResponse<ActiveDirectoryConfig> getAuthAdSettingWithHttpInfo(Integer adId, String xSdsAuthToken) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'adId' is set
if(adId == null) {
throw new ApiException(400, "Missing the required parameter 'adId' when calling getAuthAdSetting");
}
// create path and map variables
String localVarPath = "/v4/system/config/auth/ads/{ad_id}"
.replaceAll("\\{" + "ad_id" + "\\}", apiClient.escapeString(adId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
if(xSdsAuthToken != null) {
localVarHeaderParams.put("X-Sds-Auth-Token", apiClient.parameterToString(xSdsAuthToken));
}
final String[] localVarAccepts = {
"application/json;charset=UTF-8"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[]{"DRACOON-OAuth"};
GenericType<ActiveDirectoryConfig> localVarReturnType = new GenericType<ActiveDirectoryConfig>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* BatchDeleteCatalogObjects
* Deletes a set of [CatalogItem](#type-catalogitem)s based on the provided list of target IDs and returns a set of successfully deleted IDs in the response. Deletion is a cascading event such that all children of the targeted object are also deleted. For example, deleting a CatalogItem will also delete all of its [CatalogItemVariation](#type-catalogitemvariation) children. `BatchDeleteCatalogObjects` succeeds even if only a portion of the targeted IDs can be deleted. The response will only include IDs that were actually deleted.
* @param body An object containing the fields to POST for the request. See the corresponding object definition for field details. (required)
* @return CompleteResponse<BatchDeleteCatalogObjectsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<BatchDeleteCatalogObjectsResponse>batchDeleteCatalogObjectsWithHttpInfo(BatchDeleteCatalogObjectsRequest body) throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(400, "Missing the required parameter 'body' when calling batchDeleteCatalogObjects");
}
// create path and map variables
String localVarPath = "/v2/catalog/batch-delete";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<BatchDeleteCatalogObjectsResponse> localVarReturnType = new GenericType<BatchDeleteCatalogObjectsResponse>() {};
return (CompleteResponse<BatchDeleteCatalogObjectsResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Get node assigned users with permissions
* ### &#128640; Since version 4.3.0 ### Functional Description: Retrieve a list of all nodes of type `room`, and the room assignment users with permissions. ### Precondition: Right _\"read audit log\"_ required. ### Effects: None. ### &#9432; Further Information: None. ### Filtering ### &#9888; All filter fields are connected via logical conjunction (**AND**) ### &#9888; Except for **`userName`**, **`userFirstName`** and **`userLastName`** - these are connected via logical disjunction (**OR**) Filter string syntax: `FIELD_NAME:OPERATOR:VALUE[:VALUE...]` Example: > `userName:cn:searchString_1|userFirstName:cn:searchString_2|nodeId:eq:2` Filter by user login containing `searchString_1` **OR** first name containing `searchString_2` **AND** node ID equals `2`. | `FIELD_NAME` | Filter Description | `OPERATOR` | Operator Description | `VALUE` | | :--- | :--- | :--- | :--- | :--- | | **`nodeId`** | Node ID filter | `eq` | Node ID equals value. | `positive Integer` | | **`nodeName`** | Node name filter | `cn, eq` | Node name contains / equals value. | `search String` | | **`nodeParentId`** | Node parent ID filter | `eq` | Parent ID equals value. | `positive Integer`<br>Parent ID `0` is the root node. | | **`userId`** | User ID filter | `eq` | User ID equals value. | `positive Integer` | | **`userName`** | Username (login) filter | `cn, eq` | Username contains / equals value. | `search String` | | **`userFirstName`** | User first name filter | `cn, eq` | User first name contains / equals value. | `search String` | | **`userLastName`** | User last name filter | `cn, eq` | User last name contains / equals value. | `search String` | | **`permissionsManage`** | Filter the users that do (not) have `manage` permissions in this room | `eq` | | `true or false` | | **`nodeIsEncrypted`** | Encrypted node filter | `eq` | | `true or false` | | **`nodeHasActivitiesLog`** | Activities log filter | `eq` | | `true or false` | | **`nodeHasRecycleBin`** | (**`DEPRECATED`**)<br>Recycle bin filter<br>**Filter has no effect!** | `eq` | | `true or false` | ### Sorting Sort string syntax: `FIELD_NAME:ORDER` `ORDER` can be `asc` or `desc`. Multiple sort fields are supported. Example: > `nodeName:asc` Sort by `nodeName` ascending. | `FIELD_NAME` | Description | | :--- | :--- | | **`nodeId`** | Node ID | | **`nodeName`** | Node name | | **`nodeParentId`** | Node parent ID | | **`nodeSize`** | Node size | | **`nodeQuota`** | Node quota |
*
* @param xSdsAuthToken Authentication token (optional)
* @param xSdsDateFormat Date time format (cf. [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) & [leettime.de](http://leettime.de/)) (optional)
* @param filter Filter string (optional)
* @param limit Range limit. Maximum 500. For more results please use paging (`offset` + `limit`). (optional)
* @param offset Range offset (optional)
* @param sort Sort string (optional)
* @return ApiResponse<List<AuditNodeResponse>>
* @throws ApiException if fails to make API call
*/
public ApiResponse<List<AuditNodeResponse>> getAuditNodeUserDataWithHttpInfo(String xSdsAuthToken, String xSdsDateFormat, String filter, Integer limit, Integer offset, String sort) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/v4/eventlog/audits/nodes";
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "filter", filter));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "offset", offset));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort", sort));
if (xSdsAuthToken != null)
localVarHeaderParams.put("X-Sds-Auth-Token", apiClient.parameterToString(xSdsAuthToken));
if (xSdsDateFormat != null)
localVarHeaderParams.put("X-Sds-Date-Format", apiClient.parameterToString(xSdsDateFormat));
final String[] localVarAccepts = {
"application/json;charset=UTF-8"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "DRACOON-OAuth" };
GenericType<List<AuditNodeResponse>> localVarReturnType = new GenericType<List<AuditNodeResponse>>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* ListRefunds
* Lists refunds for one of a business's locations. Deprecated - recommend using [SearchOrders](#endpoint-orders-searchorders) In addition to full or partial tender refunds processed through Square APIs, refunds may result from itemized returns or exchanges through Square's Point of Sale applications. Refunds with a `status` of `PENDING` are not currently included in this endpoint's response. Max results per [page](#paginatingresults): 50
* @param locationId The ID of the location to list refunds for. (required)
* @param beginTime The beginning of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time minus one year. (optional)
* @param endTime The end of the requested reporting period, in RFC 3339 format. See [Date ranges](#dateranges) for details on date inclusivity/exclusivity. Default value: The current time. (optional)
* @param sortOrder The order in which results are listed in the response (`ASC` for oldest first, `DESC` for newest first). Default value: `DESC` (optional)
* @param cursor A pagination cursor returned by a previous call to this endpoint. Provide this to retrieve the next set of results for your original query. See [Paginating results](#paginatingresults) for more information. (optional)
* @return CompleteResponse<ListRefundsResponse>
* @throws ApiException if fails to make API call
*/
public CompleteResponse<ListRefundsResponse>listRefundsWithHttpInfo(String locationId, String beginTime, String endTime, String sortOrder, String cursor) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'locationId' is set
if (locationId == null) {
throw new ApiException(400, "Missing the required parameter 'locationId' when calling listRefunds");
}
// create path and map variables
String localVarPath = "/v2/locations/{location_id}/refunds"
.replaceAll("\\{" + "location_id" + "\\}", apiClient.escapeString(locationId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarHeaderParams.put("Square-Version", "2019-11-20");
localVarQueryParams.addAll(apiClient.parameterToPairs("", "begin_time", beginTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "end_time", endTime));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "sort_order", sortOrder));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "cursor", cursor));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
"application/json"
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ListRefundsResponse> localVarReturnType = new GenericType<ListRefundsResponse>() {};
return (CompleteResponse<ListRefundsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Upload a file to a share using a multipart request containing first a metadata (see reponse) part and a then the filedata part. Use header \"X-Lock-Id\" to send lock id if needed
*
* @param shareid The shareId (required)
* @return ApiResponse<ch.cyberduck.core.storegate.io.swagger.client.model.FileMetadata>
* @throws ApiException if fails to make API call
*/
public ApiResponse<ch.cyberduck.core.storegate.io.swagger.client.model.FileMetadata> uploadPostMultipartShareWithHttpInfo(String shareid) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'shareid' is set
if (shareid == null) {
throw new ApiException(400, "Missing the required parameter 'shareid' when calling uploadPostMultipartShare");
}
// create path and map variables
String localVarPath = "/v4/upload/shares/{shareid}"
.replaceAll("\\{" + "shareid" + "\\}", apiClient.escapeString(shareid.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json", "text/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2" };
GenericType<ch.cyberduck.core.storegate.io.swagger.client.model.FileMetadata> localVarReturnType = new GenericType<ch.cyberduck.core.storegate.io.swagger.client.model.FileMetadata>() {};
return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched (required)
* @return a {@code Order}
* @throws ApiException if fails to make API call
*/
public Order getOrderById(Long orderId) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
throw new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById");
}
// create path and map variables
String localVarPath = "/store/order/{order_id}".replaceAll("\\{format\\}","json")
.replaceAll("\\{" + "order_id" + "\\}", apiClient.escapeString(orderId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/xml", "application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
GenericType<Order> localVarReturnType = new GenericType<Order>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
@Test
public void setAndGetDataPoint() {
Response response = query.path("/weather/BOS/0").request().get();
assertNull(response.readEntity(new GenericType<List<Weather>>(){})
.get(0).getWind());
collect.path("/weather/BOS/wind").request()
.post(Entity.entity(windDataPoint, "application/json"));
response = query.path("/weather/BOS/0").request().get();
List<Weather> fromServer = response.readEntity(new GenericType<List<Weather>>(){});
assertEquals(windDataPoint, fromServer.get(0).getWind());
}
protected void runSetDeprecated(DeprecateStyle style) {
String symbolicName = "my.catalog.item.id.for.deprecation";
String serviceType = "org.apache.brooklyn.entity.stock.BasicApplication";
addTestCatalogItem(symbolicName, "template", TEST_VERSION, serviceType);
addTestCatalogItem(symbolicName, "template", "2.0", serviceType);
try {
List<CatalogEntitySummary> applications = client().path("/catalog/applications")
.query("fragment", symbolicName).query("allVersions", "true").get(new GenericType<List<CatalogEntitySummary>>() {});
assertEquals(applications.size(), 2);
CatalogItemSummary summary0 = applications.get(0);
CatalogItemSummary summary1 = applications.get(1);
// Deprecate: that app should be excluded
deprecateCatalogItem(style, summary0.getSymbolicName(), summary0.getVersion(), true);
List<CatalogEntitySummary> applicationsAfterDeprecation = client().path("/catalog/applications")
.query("fragment", "basicapp").query("allVersions", "true").get(new GenericType<List<CatalogEntitySummary>>() {});
assertEquals(applicationsAfterDeprecation.size(), 1);
assertTrue(applicationsAfterDeprecation.contains(summary1));
// Un-deprecate: that app should be included again
deprecateCatalogItem(style, summary0.getSymbolicName(), summary0.getVersion(), false);
List<CatalogEntitySummary> applicationsAfterUnDeprecation = client().path("/catalog/applications")
.query("fragment", "basicapp").query("allVersions", "true").get(new GenericType<List<CatalogEntitySummary>>() {});
assertEquals(applications, applicationsAfterUnDeprecation);
} finally {
client().path("/catalog/entities/"+symbolicName+"/"+TEST_VERSION)
.delete();
client().path("/catalog/entities/"+symbolicName+"/"+"2.0")
.delete();
}
}
@Test
public void getUsersAsAdmin() {
String authorizationHeader = composeAuthorizationHeader(getTokenForAdmin());
Response response = client.target(uri).path("api").path("users").request()
.header(HttpHeaders.AUTHORIZATION, authorizationHeader).get();
assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
List<QueryUserResult> queryDetailsList = response.readEntity(new GenericType<List<QueryUserResult>>() {});
assertNotNull(queryDetailsList);
assertThat(queryDetailsList, hasSize(3));
}