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

com.okta.sdk.resource.api.UserLinkedObjectApi 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: 21.0.0
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.ResponseLinks;

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 UserLinkedObjectApi {

    private ApiClient apiClient;

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

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

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Assign a Linked Object value for primary Assigns the first User as the `associated` and the second User
     * as the `primary` for the specified relationship. If the first User is already associated with a
     * different `primary` for this relationship, the previous link is removed. A Linked Object relationship
     * can specify only one primary User for an associated User.
     *
     * @param userIdOrLogin
     *            If for the `self` link, the ID of the User for whom you want to get the primary User ID. If
     *            for the `associated` relation, the User ID or login value of the User assigned the
     *            associated relationship. This can be `me` to represent the current session User. (required)
     * @param primaryRelationshipName
     *            Name of the `primary` relationship being assigned (required)
     * @param primaryUserId
     *            User ID to be assigned to the `primary` relationship for the `associated` user
     *            (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void assignLinkedObjectValueForPrimary(String userIdOrLogin, String primaryRelationshipName,
            String primaryUserId) throws ApiException {
        this.assignLinkedObjectValueForPrimary(userIdOrLogin, primaryRelationshipName, primaryUserId,
                Collections.emptyMap());
    }

    /**
     * Assign a Linked Object value for primary Assigns the first User as the `associated` and the second User
     * as the `primary` for the specified relationship. If the first User is already associated with a
     * different `primary` for this relationship, the previous link is removed. A Linked Object relationship
     * can specify only one primary User for an associated User.
     *
     * @param userIdOrLogin
     *            If for the `self` link, the ID of the User for whom you want to get the primary User ID. If
     *            for the `associated` relation, the User ID or login value of the User assigned the
     *            associated relationship. This can be `me` to represent the current session User. (required)
     * @param primaryRelationshipName
     *            Name of the `primary` relationship being assigned (required)
     * @param primaryUserId
     *            User ID to be assigned to the `primary` relationship for the `associated` user
     *            (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void assignLinkedObjectValueForPrimary(String userIdOrLogin, String primaryRelationshipName,
            String primaryUserId, Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

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

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

        // create path and map variables
        String localVarPath = "/api/v1/users/{userIdOrLogin}/linkedObjects/{primaryRelationshipName}/{primaryUserId}"
                .replaceAll("\\{" + "userIdOrLogin" + "\\}", apiClient.escapeString(userIdOrLogin.toString()))
                .replaceAll("\\{" + "primaryRelationshipName" + "\\}",
                        apiClient.escapeString(primaryRelationshipName.toString()))
                .replaceAll("\\{" + "primaryUserId" + "\\}", apiClient.escapeString(primaryUserId.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[] { "oauth2" };

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

    /**
     * Delete a Linked Object value Deletes any existing relationship between the `associated` and
     * `primary` user. For the `associated` User, this is specified by the ID. The
     * `primary` name specifies the relationship. The operation is successful if the relationship is deleted
     * or if the specified User isn't in the `associated` relationship for any instance of the specified
     * `primary` and thus, no relationship is found.
     *
     * @param userIdOrLogin
     *            If for the `self` link, the ID of the User for whom you want to get the primary User ID. If
     *            for the `associated` relation, the User ID or login value of the User assigned the
     *            associated relationship. This can be `me` to represent the current session User. (required)
     * @param relationshipName
     *            Name of the `primary` or `associated` relationship being queried (required)
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteLinkedObjectForUser(String userIdOrLogin, String relationshipName) throws ApiException {
        this.deleteLinkedObjectForUser(userIdOrLogin, relationshipName, Collections.emptyMap());
    }

    /**
     * Delete a Linked Object value Deletes any existing relationship between the `associated` and
     * `primary` user. For the `associated` User, this is specified by the ID. The
     * `primary` name specifies the relationship. The operation is successful if the relationship is deleted
     * or if the specified User isn't in the `associated` relationship for any instance of the specified
     * `primary` and thus, no relationship is found.
     *
     * @param userIdOrLogin
     *            If for the `self` link, the ID of the User for whom you want to get the primary User ID. If
     *            for the `associated` relation, the User ID or login value of the User assigned the
     *            associated relationship. This can be `me` to represent the current session User. (required)
     * @param relationshipName
     *            Name of the `primary` or `associated` relationship being queried (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public void deleteLinkedObjectForUser(String userIdOrLogin, String relationshipName,
            Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

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

        // create path and map variables
        String localVarPath = "/api/v1/users/{userIdOrLogin}/linkedObjects/{relationshipName}"
                .replaceAll("\\{" + "userIdOrLogin" + "\\}", apiClient.escapeString(userIdOrLogin.toString()))
                .replaceAll("\\{" + "relationshipName" + "\\}", apiClient.escapeString(relationshipName.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);
    }

    /**
     * List the primary or all of the associated Linked Object values Lists either the `self` link for the
     * primary User or all associated Users in the relationship specified by `relationshipName`. If the
     * specified User isn't associated in any relationship, an empty array is returned. Use `me` instead
     * of `id` to specify the current session User.
     *
     * @param userIdOrLogin
     *            If for the `self` link, the ID of the User for whom you want to get the primary User ID. If
     *            for the `associated` relation, the User ID or login value of the User assigned the
     *            associated relationship. This can be `me` to represent the current session User. (required)
     * @param relationshipName
     *            Name of the `primary` or `associated` relationship being queried (required)
     *
     * @return List<ResponseLinks>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listLinkedObjectsForUser(String userIdOrLogin, String relationshipName)
            throws ApiException {
        return this.listLinkedObjectsForUser(userIdOrLogin, relationshipName, Collections.emptyMap());
    }

    /**
     * List the primary or all of the associated Linked Object values Lists either the `self` link for the
     * primary User or all associated Users in the relationship specified by `relationshipName`. If the
     * specified User isn't associated in any relationship, an empty array is returned. Use `me` instead
     * of `id` to specify the current session User.
     *
     * @param userIdOrLogin
     *            If for the `self` link, the ID of the User for whom you want to get the primary User ID. If
     *            for the `associated` relation, the User ID or login value of the User assigned the
     *            associated relationship. This can be `me` to represent the current session User. (required)
     * @param relationshipName
     *            Name of the `primary` or `associated` relationship being queried (required)
     * @param additionalHeaders
     *            additionalHeaders for this call
     *
     * @return List<ResponseLinks>
     *
     * @throws ApiException
     *             if fails to make API call
     */
    public List listLinkedObjectsForUser(String userIdOrLogin, String relationshipName,
            Map additionalHeaders) throws ApiException {
        Object localVarPostBody = null;

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

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

        // create path and map variables
        String localVarPath = "/api/v1/users/{userIdOrLogin}/linkedObjects/{relationshipName}"
                .replaceAll("\\{" + "userIdOrLogin" + "\\}", apiClient.escapeString(userIdOrLogin.toString()))
                .replaceAll("\\{" + "relationshipName" + "\\}", apiClient.escapeString(relationshipName.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);
    }

    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