javax.ws.rs.core.GenericType Java Examples

The following examples show how to use javax.ws.rs.core.GenericType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EngineAPIResourcesTest.java    From clouditor with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example #2
Source File: NamedResource.java    From usergrid with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: RabbitMQHealthCheck.java    From judgels with GNU General Public License v2.0 6 votes vote down vote up
@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"));
    }
}
 
Example #4
Source File: EventsApi.java    From choerodon-starters with Apache License 2.0 6 votes vote down vote up
/**
 * 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>>() {
    }));
}
 
Example #5
Source File: CommitsApi.java    From gitlab4j-api with MIT License 6 votes vote down vote up
/**
 * 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>>() {}));
}
 
Example #6
Source File: EngineAPIResourcesTest.java    From clouditor with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #7
Source File: PaymentsApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * 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. - &#x60;ASC&#x60; - oldest to newest - &#x60;DESC&#x60; - 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 &#x60;Payment&#x60;. (optional)
 * @param last4 The last 4 digits of &#x60;Payment&#x60; card. (optional)
 * @param cardBrand The brand of &#x60;Payment&#x60; card. For example, &#x60;VISA&#x60; (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();
    }
 
Example #8
Source File: CatalogApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * 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 &#x60;true&#x60;, the response will include additional objects that are related to the requested object, as follows:  If the &#x60;object&#x60; field of the response contains a CatalogItem, its associated CatalogCategory, CatalogTax objects, CatalogImages and CatalogModifierLists will be returned in the &#x60;related_objects&#x60; field of the response. If the &#x60;object&#x60; field of the response contains a CatalogItemVariation, its parent CatalogItem will be returned in the &#x60;related_objects&#x60; field of the response.  Default value: &#x60;false&#x60; (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);
}
 
Example #9
Source File: WeatherEndpointTest.java    From training with MIT License 5 votes vote down vote up
@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());
}
 
Example #10
Source File: ReactorInvokerImpl.java    From cxf with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example #11
Source File: ComponentServerProxyTest.java    From component-runtime with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #12
Source File: PaymentsApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * 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. - &#x60;ASC&#x60; - oldest to newest - &#x60;DESC&#x60; - 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 &#x60;Payment&#x60;. (optional)
 * @param last4 The last 4 digits of &#x60;Payment&#x60; card. (optional)
 * @param cardBrand The brand of &#x60;Payment&#x60; card. For example, &#x60;VISA&#x60; (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);
}
 
Example #13
Source File: CatalogApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * 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.  &#x60;BatchDeleteCatalogObjects&#x60; 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();
    }
 
Example #14
Source File: FileSharesApi.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Return a FileShare with share information and file.
 * 
 * @param id The file id (required)
 * @return ApiResponse&lt;FileShare&gt;
 * @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);
    }
 
Example #15
Source File: SystemAuthConfigApi.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get Active Directory configuration
 * ### Functional Description:   Retrieve the configuration of an Active Directory.  ### Precondition: Right _\&quot;read global config\&quot;_ required.   Role _Config Manager_ of the Provider Customer.  ### Effects: None.  ### &amp;#9432; Further Information: None.
 *
 * @param adId          Active Directory ID (required)
 * @param xSdsAuthToken Authentication token (optional)
 * @return ApiResponse&lt;ActiveDirectoryConfig&gt;
 * @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);
  }
 
Example #16
Source File: PaymentsApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * CancelPayment
 * Cancels (voids) a payment. If you set &#x60;autocomplete&#x60; to false when creating a payment,  you can cancel the payment using this endpoint. For more information, see  [Delayed Payments](/payments-api/take-payments#delayed-payments).
 * @param paymentId &#x60;payment_id&#x60; identifying the payment to be canceled. (required)
 * @return CompleteResponse<CancelPaymentResponse>
 * @throws ApiException if fails to make API call
 */
public CompleteResponse<CancelPaymentResponse>cancelPaymentWithHttpInfo(String paymentId) throws ApiException {
  Object localVarPostBody = null;
  
  // verify the required parameter 'paymentId' is set
  if (paymentId == null) {
    throw new ApiException(400, "Missing the required parameter 'paymentId' when calling cancelPayment");
  }
  
  // create path and map variables
  String localVarPath = "/v2/payments/{payment_id}/cancel"
    .replaceAll("\\{" + "payment_id" + "\\}", apiClient.escapeString(paymentId.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");

  
  
  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<CancelPaymentResponse> localVarReturnType = new GenericType<CancelPaymentResponse>() {};
  return (CompleteResponse<CancelPaymentResponse>)apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
 
Example #17
Source File: StoreApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Place an order for a pet
 * 
 * @param order order placed for purchasing the pet (required)
 * @return ApiResponse&lt;Order&gt;
 * @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);
}
 
Example #18
Source File: CatalogApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * 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.  &#x60;BatchDeleteCatalogObjects&#x60; 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);
}
 
Example #19
Source File: EventlogApi.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
/**
     * Get node assigned users with permissions
     * ### &amp;#128640; Since version 4.3.0  ### Functional Description:   Retrieve a list of all nodes of type &#x60;room&#x60;, and the room assignment users with permissions.  ### Precondition: Right _\&quot;read audit log\&quot;_ required.  ### Effects: None.  ### &amp;#9432; Further Information: None.  ### Filtering ### &amp;#9888; All filter fields are connected via logical conjunction (**AND**) ### &amp;#9888; Except for **&#x60;userName&#x60;**, **&#x60;userFirstName&#x60;** and  **&#x60;userLastName&#x60;** - these are connected via logical disjunction (**OR**) Filter string syntax: &#x60;FIELD_NAME:OPERATOR:VALUE[:VALUE...]&#x60;    Example: &gt; &#x60;userName:cn:searchString_1|userFirstName:cn:searchString_2|nodeId:eq:2&#x60;   Filter by user login containing &#x60;searchString_1&#x60; **OR** first name containing &#x60;searchString_2&#x60; **AND** node ID equals &#x60;2&#x60;.  | &#x60;FIELD_NAME&#x60; | Filter Description | &#x60;OPERATOR&#x60; | Operator Description | &#x60;VALUE&#x60; | | :--- | :--- | :--- | :--- | :--- | | **&#x60;nodeId&#x60;** | Node ID filter | &#x60;eq&#x60; | Node ID equals value. | &#x60;positive Integer&#x60; | | **&#x60;nodeName&#x60;** | Node name filter | &#x60;cn, eq&#x60; | Node name contains / equals value. | &#x60;search String&#x60; | | **&#x60;nodeParentId&#x60;** | Node parent ID filter | &#x60;eq&#x60; | Parent ID equals value. | &#x60;positive Integer&#x60;&lt;br&gt;Parent ID &#x60;0&#x60; is the root node. | | **&#x60;userId&#x60;** | User ID filter | &#x60;eq&#x60; | User ID equals value. | &#x60;positive Integer&#x60; | | **&#x60;userName&#x60;** | Username (login) filter | &#x60;cn, eq&#x60; | Username contains / equals value. | &#x60;search String&#x60; | | **&#x60;userFirstName&#x60;** | User first name filter | &#x60;cn, eq&#x60; | User first name contains / equals value. | &#x60;search String&#x60; | | **&#x60;userLastName&#x60;** | User last name filter | &#x60;cn, eq&#x60; | User last name contains / equals value. | &#x60;search String&#x60; | | **&#x60;permissionsManage&#x60;** | Filter the users that do (not) have &#x60;manage&#x60; permissions in this room | &#x60;eq&#x60; |  | &#x60;true or false&#x60; | | **&#x60;nodeIsEncrypted&#x60;** | Encrypted node filter | &#x60;eq&#x60; |  | &#x60;true or false&#x60; | | **&#x60;nodeHasActivitiesLog&#x60;** | Activities log filter | &#x60;eq&#x60; |  | &#x60;true or false&#x60; | | **&#x60;nodeHasRecycleBin&#x60;** | (**&#x60;DEPRECATED&#x60;**)&lt;br&gt;Recycle bin filter&lt;br&gt;**Filter has no effect!** | &#x60;eq&#x60; |  | &#x60;true or false&#x60; |  ### Sorting Sort string syntax: &#x60;FIELD_NAME:ORDER&#x60;   &#x60;ORDER&#x60; can be &#x60;asc&#x60; or &#x60;desc&#x60;.   Multiple sort fields are supported.   Example: &gt; &#x60;nodeName:asc&#x60;   Sort by &#x60;nodeName&#x60; ascending.  | &#x60;FIELD_NAME&#x60; | Description | | :--- | :--- | | **&#x60;nodeId&#x60;** | Node ID | | **&#x60;nodeName&#x60;** | Node name | | **&#x60;nodeParentId&#x60;** | Node parent ID | | **&#x60;nodeSize&#x60;** | Node size | | **&#x60;nodeQuota&#x60;** | Node quota |
     *
     * @param xSdsAuthToken  Authentication token (optional)
     * @param xSdsDateFormat Date time format (cf. [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) &amp; [leettime.de](http://leettime.de/)) (optional)
     * @param filter         Filter string (optional)
     * @param limit          Range limit. Maximum 500.   For more results please use paging (&#x60;offset&#x60; + &#x60;limit&#x60;). (optional)
     * @param offset         Range offset (optional)
     * @param sort           Sort string (optional)
     * @return ApiResponse&lt;List&lt;AuditNodeResponse&gt;&gt;
     * @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);
    }
 
Example #20
Source File: TransactionsApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * ListRefunds
 * Lists refunds for one of a business&#39;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&#39;s Point of Sale applications.  Refunds with a &#x60;status&#x60; of &#x60;PENDING&#x60; are not currently included in this endpoint&#39;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 (&#x60;ASC&#x60; for oldest first, &#x60;DESC&#x60; for newest first).  Default value: &#x60;DESC&#x60; (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);
}
 
Example #21
Source File: UploadApi.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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 \&quot;X-Lock-Id\&quot; to send lock id if needed
 * 
 * @param shareid The shareId (required)
 * @return ApiResponse&lt;ch.cyberduck.core.storegate.io.swagger.client.model.FileMetadata&gt;
 * @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);
    }
 
Example #22
Source File: StoreApi.java    From openapi-generator with Apache License 2.0 5 votes vote down vote up
/**
 * Find purchase order by ID
 * For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 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);
    }
 
Example #23
Source File: WeatherEndpointTest.java    From training with MIT License 5 votes vote down vote up
@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());
}
 
Example #24
Source File: CatalogResourceTest.java    From brooklyn-server with Apache License 2.0 5 votes vote down vote up
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();
    }
}
 
Example #25
Source File: UserResourceTest.java    From jersey-jwt with MIT License 5 votes vote down vote up
@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));
}
 
Example #26
Source File: LocationsApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * RetrieveLocation
 * Retrieves details of a location.
 * @param locationId The ID of the location to retrieve. (required)
 * @return CompleteResponse<RetrieveLocationResponse>
 * @throws ApiException if fails to make API call
 */
public CompleteResponse<RetrieveLocationResponse>retrieveLocationWithHttpInfo(String locationId) 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 retrieveLocation");
  }
  
  // create path and map variables
  String localVarPath = "/v2/locations/{location_id}"
    .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");

  
  
  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<RetrieveLocationResponse> localVarReturnType = new GenericType<RetrieveLocationResponse>() {};
  return (CompleteResponse<RetrieveLocationResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
 
Example #27
Source File: UserSelfITCase.java    From syncope with Apache License 2.0 5 votes vote down vote up
@Test
public void createAndApprove() {
    assumeTrue(FlowableDetector.isFlowableEnabledForUserWorkflow(syncopeService));

    // 1. self-create user with membership: goes 'createApproval' with resources and membership but no propagation
    UserCR userCR = UserITCase.getUniqueSample("[email protected]");
    userCR.getMemberships().add(
            new MembershipTO.Builder("29f96485-729e-4d31-88a1-6fc60e4677f3").build());
    userCR.getResources().add(RESOURCE_NAME_TESTDB);

    SyncopeClient anonClient = clientFactory.create();
    UserTO userTO = anonClient.getService(UserSelfService.class).
            create(userCR).
            readEntity(new GenericType<ProvisioningResult<UserTO>>() {
            }).getEntity();
    assertNotNull(userTO);
    assertEquals("createApproval", userTO.getStatus());
    assertFalse(userTO.getMemberships().isEmpty());
    assertFalse(userTO.getResources().isEmpty());

    try {
        resourceService.readConnObject(RESOURCE_NAME_TESTDB, AnyTypeKind.USER.name(), userTO.getKey());
        fail("This should not happen");
    } catch (SyncopeClientException e) {
        assertEquals(ClientExceptionType.NotFound, e.getType());
    }

    // 2. now approve and verify that propagation has happened
    UserRequestForm form = userRequestService.getForms(
            new UserRequestFormQuery.Builder().user(userTO.getKey()).build()).getResult().get(0);
    form = userRequestService.claimForm(form.getTaskId());
    form.getProperty("approveCreate").get().setValue(Boolean.TRUE.toString());
    userTO = userRequestService.submitForm(form);
    assertNotNull(userTO);
    assertEquals("active", userTO.getStatus());
    assertNotNull(resourceService.readConnObject(RESOURCE_NAME_TESTDB, AnyTypeKind.USER.name(), userTO.getKey()));
}
 
Example #28
Source File: LaborApi.java    From connect-java-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * ListWorkweekConfigs
 * Returns a list of &#x60;WorkweekConfig&#x60; instances for a business.
 * @param limit Maximum number of Workweek Configs to return per page. (optional)
 * @param cursor Pointer to the next page of Workweek Config results to fetch. (optional)
 * @return CompleteResponse<ListWorkweekConfigsResponse>
 * @throws ApiException if fails to make API call
 */
public CompleteResponse<ListWorkweekConfigsResponse>listWorkweekConfigsWithHttpInfo(Integer limit, String cursor) throws ApiException {
  Object localVarPostBody = null;
  
  // create path and map variables
  String localVarPath = "/v2/labor/workweek-configs";

  // 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("", "limit", limit));
  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<ListWorkweekConfigsResponse> localVarReturnType = new GenericType<ListWorkweekConfigsResponse>() {};
  return (CompleteResponse<ListWorkweekConfigsResponse>)apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
}
 
Example #29
Source File: SystemAuthConfigApi.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get RADIUS configuration
 * ### Functional Description:   Retrieve a RADIUS configuration.  ### Precondition: Right _\&quot;read global config\&quot;_ required.   Role _Config Manager_ of the Provider Customer.  ### Effects: None.  ### &amp;#9432; Further Information: None.
 *
 * @param xSdsAuthToken Authentication token (optional)
 * @return ApiResponse&lt;RadiusConfig&gt;
 * @throws ApiException if fails to make API call
 */
public ApiResponse<RadiusConfig> getRadiusConfigWithHttpInfo(String xSdsAuthToken) throws ApiException {
    Object localVarPostBody = null;

    // create path and map variables
    String localVarPath = "/v4/system/config/auth/radius";

    // 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<RadiusConfig> localVarReturnType = new GenericType<RadiusConfig>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
  }
 
Example #30
Source File: DownloadApi.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Get one time download id for zipped images (media)
 * 
 * @param request The download request (required)
 * @return ApiResponse&lt;String&gt;
 * @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);
    }