All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.okta.sdk.resource.api.AuthorizationServerScopesApi Maven / Gradle / Ivy

Go to download

The Okta Java SDK API .jar provides a Java API that your code can use to make calls to the Okta API. This .jar is the only compile-time dependency within the Okta SDK project that your code should depend on. Implementations of this API (implementation .jars) should be runtime dependencies only.

There is a newer version: 23.0.1
Show newest version
/*
 * Okta Admin Management
 * Allows customers to easily access the Okta Management APIs
 *
 * The version of the OpenAPI document: 2024.08.3
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

package com.okta.sdk.resource.api;

import com.fasterxml.jackson.core.type.TypeReference;

import com.okta.sdk.resource.client.ApiException;
import com.okta.sdk.resource.client.ApiClient;
import com.okta.sdk.resource.client.Configuration;
import com.okta.sdk.resource.model.*;
import com.okta.sdk.resource.client.Pair;

import com.okta.sdk.resource.model.Error;
import com.okta.sdk.resource.model.OAuth2Scope;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;

import org.openapitools.jackson.nullable.JsonNullableModule;

@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-11-15T08:48:47.130589-06:00[America/Chicago]", comments = "Generator version: 7.8.0")
public class AuthorizationServerScopesApi {

    private ApiClient apiClient;

    public AuthorizationServerScopesApi() {
        this(Configuration.getDefaultApiClient());
    }

    public AuthorizationServerScopesApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

    public void setApiClient(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    /**
     * Create a Custom Token Scope Creates a custom token scope
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param oAuth2Scope
     *            (required)
     *
     * @return OAuth2Scope
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public OAuth2Scope createOAuth2Scope(String authServerId, OAuth2Scope oAuth2Scope) throws ApiException {
        return this.createOAuth2Scope(authServerId, oAuth2Scope, Collections.emptyMap());
    }

    /**
     * Create a Custom Token Scope Creates a custom token scope
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param oAuth2Scope
     *            (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return OAuth2Scope
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public OAuth2Scope createOAuth2Scope(String authServerId, OAuth2Scope oAuth2Scope,
            Map additionalHeaders) throws ApiException {
        Object localVarPostBody = oAuth2Scope;

        // verify the required parameter 'authServerId' is set
        if (authServerId == null) {
            throw new ApiException(400, "Missing the required parameter 'authServerId' when calling createOAuth2Scope");
        }

        // verify the required parameter 'oAuth2Scope' is set
        if (oAuth2Scope == null) {
            throw new ApiException(400, "Missing the required parameter 'oAuth2Scope' when calling createOAuth2Scope");
        }

        // create path and map variables
        String localVarPath = "/api/v1/authorizationServers/{authServerId}/scopes"
                .replaceAll("\\{" + "authServerId" + "\\}", apiClient.escapeString(authServerId.toString()));

        StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
        String localVarQueryParameterBaseName;
        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        localVarHeaderParams.putAll(additionalHeaders);

        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[] { "apiToken", "oauth2" };

        TypeReference localVarReturnType = new TypeReference() {
        };
        return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    /**
     * Delete a Custom Token Scope Deletes a custom token scope
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param scopeId
     *            `id` of Scope (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteOAuth2Scope(String authServerId, String scopeId) throws ApiException {
        this.deleteOAuth2Scope(authServerId, scopeId, Collections.emptyMap());
    }

    /**
     * Delete a Custom Token Scope Deletes a custom token scope
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param scopeId
     *            `id` of Scope (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteOAuth2Scope(String authServerId, String scopeId, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'authServerId' is set
        if (authServerId == null) {
            throw new ApiException(400, "Missing the required parameter 'authServerId' when calling deleteOAuth2Scope");
        }

        // verify the required parameter 'scopeId' is set
        if (scopeId == null) {
            throw new ApiException(400, "Missing the required parameter 'scopeId' when calling deleteOAuth2Scope");
        }

        // create path and map variables
        String localVarPath = "/api/v1/authorizationServers/{authServerId}/scopes/{scopeId}"
                .replaceAll("\\{" + "authServerId" + "\\}", apiClient.escapeString(authServerId.toString()))
                .replaceAll("\\{" + "scopeId" + "\\}", apiClient.escapeString(scopeId.toString()));

        StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
        String localVarQueryParameterBaseName;
        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        localVarHeaderParams.putAll(additionalHeaders);

        final String[] localVarAccepts = { "application/json" };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "apiToken", "oauth2" };

        apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
    }

    /**
     * Retrieve a Custom Token Scope Retrieves a custom token scope
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param scopeId
     *            `id` of Scope (required)
     *
     * @return OAuth2Scope
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public OAuth2Scope getOAuth2Scope(String authServerId, String scopeId) throws ApiException {
        return this.getOAuth2Scope(authServerId, scopeId, Collections.emptyMap());
    }

    /**
     * Retrieve a Custom Token Scope Retrieves a custom token scope
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param scopeId
     *            `id` of Scope (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return OAuth2Scope
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public OAuth2Scope getOAuth2Scope(String authServerId, String scopeId, Map additionalHeaders)
            throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'authServerId' is set
        if (authServerId == null) {
            throw new ApiException(400, "Missing the required parameter 'authServerId' when calling getOAuth2Scope");
        }

        // verify the required parameter 'scopeId' is set
        if (scopeId == null) {
            throw new ApiException(400, "Missing the required parameter 'scopeId' when calling getOAuth2Scope");
        }

        // create path and map variables
        String localVarPath = "/api/v1/authorizationServers/{authServerId}/scopes/{scopeId}"
                .replaceAll("\\{" + "authServerId" + "\\}", apiClient.escapeString(authServerId.toString()))
                .replaceAll("\\{" + "scopeId" + "\\}", apiClient.escapeString(scopeId.toString()));

        StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
        String localVarQueryParameterBaseName;
        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        localVarHeaderParams.putAll(additionalHeaders);

        final String[] localVarAccepts = { "application/json" };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "apiToken", "oauth2" };

        TypeReference localVarReturnType = new TypeReference() {
        };
        return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    /**
     * List all Custom Token Scopes Lists all custom token scopes
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param q
     *            Searches the `name` of Custom Token Scopes for matching values (optional)
     * @param filter
     *            Filter expression for Custom Token Scopes (optional)
     * @param after
     *            Specifies the pagination cursor for the next page of scopes. Treat the after cursor as an opaque value
     *            and obtain it through the next link relationship. See
     *            [Pagination](https://developer.okta.com/docs/api/#pagination). (optional)
     * @param limit
     *            Specifies the number of objects to return per page. If there are multiple pages of results, the Link
     *            header contains a `next` link that you need to use as an opaque value (follow it, don't
     *            parse it). See [Pagination](https://developer.okta.com/docs/api/#pagination). (optional)
     *
     * @return List<OAuth2Scope>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listOAuth2Scopes(String authServerId, String q, String filter, String after, Integer limit)
            throws ApiException {
        return this.listOAuth2Scopes(authServerId, q, filter, after, limit, Collections.emptyMap());
    }

    /**
     * List all Custom Token Scopes Lists all custom token scopes
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param q
     *            Searches the `name` of Custom Token Scopes for matching values (optional)
     * @param filter
     *            Filter expression for Custom Token Scopes (optional)
     * @param after
     *            Specifies the pagination cursor for the next page of scopes. Treat the after cursor as an opaque value
     *            and obtain it through the next link relationship. See
     *            [Pagination](https://developer.okta.com/docs/api/#pagination). (optional)
     * @param limit
     *            Specifies the number of objects to return per page. If there are multiple pages of results, the Link
     *            header contains a `next` link that you need to use as an opaque value (follow it, don't
     *            parse it). See [Pagination](https://developer.okta.com/docs/api/#pagination). (optional)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return List<OAuth2Scope>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listOAuth2Scopes(String authServerId, String q, String filter, String after, Integer limit,
            Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

        // verify the required parameter 'authServerId' is set
        if (authServerId == null) {
            throw new ApiException(400, "Missing the required parameter 'authServerId' when calling listOAuth2Scopes");
        }

        // create path and map variables
        String localVarPath = "/api/v1/authorizationServers/{authServerId}/scopes"
                .replaceAll("\\{" + "authServerId" + "\\}", apiClient.escapeString(authServerId.toString()));

        StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
        String localVarQueryParameterBaseName;
        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        localVarQueryParams.addAll(apiClient.parameterToPair("q", q));
        localVarQueryParams.addAll(apiClient.parameterToPair("filter", filter));
        localVarQueryParams.addAll(apiClient.parameterToPair("after", after));
        localVarQueryParams.addAll(apiClient.parameterToPair("limit", limit));

        localVarHeaderParams.putAll(additionalHeaders);

        final String[] localVarAccepts = { "application/json" };
        final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

        final String[] localVarContentTypes = {

        };
        final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

        String[] localVarAuthNames = new String[] { "apiToken", "oauth2" };

        TypeReference> localVarReturnType = new TypeReference>() {
        };
        return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    /**
     * Replace a Custom Token Scope Replaces a custom token scope
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param scopeId
     *            `id` of Scope (required)
     * @param oAuth2Scope
     *            (required)
     *
     * @return OAuth2Scope
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public OAuth2Scope replaceOAuth2Scope(String authServerId, String scopeId, OAuth2Scope oAuth2Scope)
            throws ApiException {
        return this.replaceOAuth2Scope(authServerId, scopeId, oAuth2Scope, Collections.emptyMap());
    }

    /**
     * Replace a Custom Token Scope Replaces a custom token scope
     *
     * @param authServerId
     *            `id` of the Authorization Server (required)
     * @param scopeId
     *            `id` of Scope (required)
     * @param oAuth2Scope
     *            (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return OAuth2Scope
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public OAuth2Scope replaceOAuth2Scope(String authServerId, String scopeId, OAuth2Scope oAuth2Scope,
            Map additionalHeaders) throws ApiException {
        Object localVarPostBody = oAuth2Scope;

        // verify the required parameter 'authServerId' is set
        if (authServerId == null) {
            throw new ApiException(400,
                    "Missing the required parameter 'authServerId' when calling replaceOAuth2Scope");
        }

        // verify the required parameter 'scopeId' is set
        if (scopeId == null) {
            throw new ApiException(400, "Missing the required parameter 'scopeId' when calling replaceOAuth2Scope");
        }

        // verify the required parameter 'oAuth2Scope' is set
        if (oAuth2Scope == null) {
            throw new ApiException(400, "Missing the required parameter 'oAuth2Scope' when calling replaceOAuth2Scope");
        }

        // create path and map variables
        String localVarPath = "/api/v1/authorizationServers/{authServerId}/scopes/{scopeId}"
                .replaceAll("\\{" + "authServerId" + "\\}", apiClient.escapeString(authServerId.toString()))
                .replaceAll("\\{" + "scopeId" + "\\}", apiClient.escapeString(scopeId.toString()));

        StringJoiner localVarQueryStringJoiner = new StringJoiner("&");
        String localVarQueryParameterBaseName;
        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        localVarHeaderParams.putAll(additionalHeaders);

        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[] { "apiToken", "oauth2" };

        TypeReference localVarReturnType = new TypeReference() {
        };
        return apiClient.invokeAPI(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams,
                localVarQueryStringJoiner.toString(), localVarPostBody, localVarHeaderParams, localVarCookieParams,
                localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    }

    protected static ObjectMapper getObjectMapper() {
        ObjectMapper objectMapper = new ObjectMapper();
        objectMapper.registerModule(new JavaTimeModule());
        objectMapper.registerModule(new JsonNullableModule());
        objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true);
        return objectMapper;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy