Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package com.zendesk.sunshine_conversations_client.api;
import com.zendesk.sunshine_conversations_client.ApiException;
import com.zendesk.sunshine_conversations_client.ApiClient;
import com.zendesk.sunshine_conversations_client.Configuration;
import com.zendesk.sunshine_conversations_client.Pair;
import jakarta.ws.rs.core.GenericType;
import com.zendesk.sunshine_conversations_client.model.InlineObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OAuthEndpointsApi {
private ApiClient apiClient;
public OAuthEndpointsApi() {
this(Configuration.getDefaultApiClient());
}
public OAuthEndpointsApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Authorize
* This endpoint begins the OAuth flow. It relies on a browser session for authentication. If the user is not logged in to Sunshine Conversations they will be redirected to the login page. If the user has many apps, they will first be prompted to select the one they wish to integrate with. They will then be presented with an Allow/Deny dialog, describing details of the access your integration is requesting.
* @param clientId Your integration’s unique identifier (required)
* @param responseType For now the only acceptable value is code. (required)
* @param state You may pass in any arbitrary string value here which will be returned to you along with the code via browser redirect. (optional)
* @param redirectUri You may pass in a redirect_uri to determine which URI the response is redirected to. This URI must be contained in the list configured by your integration. If this option is not passed, the first URI present in the list will be used. (optional)
* @throws ApiException if fails to make API call
*/
public void authorize(String clientId, String responseType, String state, String redirectUri) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'clientId' is set
if (clientId == null) {
throw new ApiException(400, "Missing the required parameter 'clientId' when calling authorize");
}
// verify the required parameter 'responseType' is set
if (responseType == null) {
throw new ApiException(400, "Missing the required parameter 'responseType' when calling authorize");
}
// create path and map variables
String localVarPath = "/oauth/authorize".replaceAll("\\{format\\}","json");
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "client_id", clientId));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "response_type", responseType));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "state", state));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "redirect_uri", redirectUri));
final String[] localVarAccepts = {
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { };
apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
}
/**
* Get Token
* This endpoint is used to exchange an authorization code for an access token. It should only be used in server-to-server calls.
* @param inlineObject (required)
* @return a {@code Object}
* @throws ApiException if fails to make API call
*/
public Object getToken(InlineObject inlineObject) throws ApiException {
Object localVarPostBody = inlineObject;
// verify the required parameter 'inlineObject' is set
if (inlineObject == null) {
throw new ApiException(400, "Missing the required parameter 'inlineObject' when calling getToken");
}
// create path and map variables
String localVarPath = "/oauth/token".replaceAll("\\{format\\}","json");
// query params
List localVarQueryParams = new ArrayList();
Map localVarHeaderParams = new HashMap();
Map localVarCookieParams = new HashMap();
Map localVarFormParams = new HashMap();
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[] { };
GenericType