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

com.konfigthis.client.api.AuthenticationApiGenerated Maven / Gradle / Ivy

Go to download

Connect brokerage accounts to your app for live positions and trading This library was generated by https://konfigthis.com

There is a newer version: 5.0.55
Show newest version
/*
 * SnapTrade
 * Connect brokerage accounts to your app for live positions and trading
 *
 * The version of the OpenAPI document: 1.0.0
 * Contact: [email protected]
 *
 * NOTE: This class is auto generated by Konfig (https://konfigthis.com).
 * Do not edit the class manually.
 */


package com.konfigthis.client.api;

import com.konfigthis.client.ApiCallback;
import com.konfigthis.client.ApiClient;
import com.konfigthis.client.ApiException;
import com.konfigthis.client.ApiResponse;
import com.konfigthis.client.Configuration;
import com.konfigthis.client.Pair;
import com.konfigthis.client.ProgressRequestBody;
import com.konfigthis.client.ProgressResponseBody;

import com.google.gson.reflect.TypeToken;

import java.io.IOException;


import com.konfigthis.client.model.DeleteUserResponse;
import com.konfigthis.client.model.SnapTradeLoginUserRequestBody;
import com.konfigthis.client.model.SnapTradeRegisterUserRequestBody;
import com.konfigthis.client.model.UserIDandSecret;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.GenericType;

public class AuthenticationApiGenerated {
    private ApiClient localVarApiClient;
    private int localHostIndex;
    private String localCustomBaseUrl;

    public AuthenticationApiGenerated() throws IllegalArgumentException {
        this(Configuration.getDefaultApiClient());
    }

    public AuthenticationApiGenerated(ApiClient apiClient) throws IllegalArgumentException {
        this.localVarApiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return localVarApiClient;
    }

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

    public int getHostIndex() {
        return localHostIndex;
    }

    public void setHostIndex(int hostIndex) {
        this.localHostIndex = hostIndex;
    }

    public String getCustomBaseUrl() {
        return localCustomBaseUrl;
    }

    public void setCustomBaseUrl(String customBaseUrl) {
        this.localCustomBaseUrl = customBaseUrl;
    }

    private okhttp3.Call deleteSnapTradeUserCall(String userId, final ApiCallback _callback) throws ApiException {
        String basePath = null;
        // Operation Servers
        String[] localBasePaths = new String[] {  };

        // Determine Base Path to Use
        if (localCustomBaseUrl != null){
            basePath = localCustomBaseUrl;
        } else if ( localBasePaths.length > 0 ) {
            basePath = localBasePaths[localHostIndex];
        } else {
            basePath = null;
        }

        Object localVarPostBody = null;

        // create path and map variables
        String localVarPath = "/snapTrade/deleteUser";

        List localVarQueryParams = new ArrayList();
        List localVarCollectionQueryParams = new ArrayList();
        Map localVarHeaderParams = new HashMap();
        Map localVarCookieParams = new HashMap();
        Map localVarFormParams = new HashMap();

        if (userId != null) {
            localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId));
        }

        final String[] localVarAccepts = {
            "application/json"
        };
        final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
        if (localVarAccept != null) {
            localVarHeaderParams.put("Accept", localVarAccept);
        }

        final String[] localVarContentTypes = {
        };
        final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
        if (localVarContentType != null) {
            localVarHeaderParams.put("Content-Type", localVarContentType);
        }

        String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" };
        return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
    }

    @SuppressWarnings("rawtypes")
    private okhttp3.Call deleteSnapTradeUserValidateBeforeCall(String userId, final ApiCallback _callback) throws ApiException {
        // verify the required parameter 'userId' is set
        if (userId == null) {
            throw new ApiException("Missing the required parameter 'userId' when calling deleteSnapTradeUser(Async)");
        }

        return deleteSnapTradeUserCall(userId, _callback);

    }


    private ApiResponse deleteSnapTradeUserWithHttpInfo(String userId) throws ApiException {
        okhttp3.Call localVarCall = deleteSnapTradeUserValidateBeforeCall(userId, null);
        Type localVarReturnType = new TypeToken(){}.getType();
        return localVarApiClient.execute(localVarCall, localVarReturnType);
    }

    private okhttp3.Call deleteSnapTradeUserAsync(String userId, final ApiCallback _callback) throws ApiException {

        okhttp3.Call localVarCall = deleteSnapTradeUserValidateBeforeCall(userId, _callback);
        Type localVarReturnType = new TypeToken(){}.getType();
        localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
        return localVarCall;
    }

    public abstract class DeleteSnapTradeUserRequestBuilderGenerated {
        final String userId;

        public DeleteSnapTradeUserRequestBuilderGenerated(String userId) {
            this.userId = userId;
        }

        /**
         * Build call for deleteSnapTradeUser
         * @param _callback ApiCallback API callback
         * @return Call to execute
         * @throws ApiException If fail to serialize the request body object
         * @http.response.details
         
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { return deleteSnapTradeUserCall(userId, _callback); } /** * Execute deleteSnapTradeUser request * @return DeleteUserResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public DeleteUserResponse execute() throws ApiException { ApiResponse localVarResp = deleteSnapTradeUserWithHttpInfo(userId); return localVarResp.getResponseBody(); } /** * Execute deleteSnapTradeUser request with HTTP info returned * @return ApiResponse<DeleteUserResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { return deleteSnapTradeUserWithHttpInfo(userId); } /** * Execute deleteSnapTradeUser request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { return deleteSnapTradeUserAsync(userId, _callback); } } /** * Delete user * Deletes a registered user and all associated data. This action is irreversible. This API is asynchronous and will return a 200 status code if the request is accepted. The user and all associated data will be queued for deletion. Once deleted, a `USER_DELETED` webhook will be sent. * @param userId (required) * @return DeleteSnapTradeUserRequestBuilder * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public AuthenticationApi.DeleteSnapTradeUserRequestBuilder deleteSnapTradeUser(String userId) throws IllegalArgumentException { if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); return ((AuthenticationApi) this).new DeleteSnapTradeUserRequestBuilder(userId); } private okhttp3.Call listSnapTradeUsersCall(final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = null; // create path and map variables String localVarPath = "/snapTrade/listUsers"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call listSnapTradeUsersValidateBeforeCall(final ApiCallback _callback) throws ApiException { return listSnapTradeUsersCall(_callback); } private ApiResponse> listSnapTradeUsersWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = listSnapTradeUsersValidateBeforeCall(null); Type localVarReturnType = new TypeToken>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call listSnapTradeUsersAsync(final ApiCallback> _callback) throws ApiException { okhttp3.Call localVarCall = listSnapTradeUsersValidateBeforeCall(_callback); Type localVarReturnType = new TypeToken>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class ListSnapTradeUsersRequestBuilderGenerated { public ListSnapTradeUsersRequestBuilderGenerated() { } /** * Build call for listSnapTradeUsers * @param _callback ApiCallback API callback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { return listSnapTradeUsersCall(_callback); } /** * Execute listSnapTradeUsers request * @return List<String> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public List execute() throws ApiException { ApiResponse> localVarResp = listSnapTradeUsersWithHttpInfo(); return localVarResp.getResponseBody(); } /** * Execute listSnapTradeUsers request with HTTP info returned * @return ApiResponse<List<String>> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public ApiResponse> executeWithHttpInfo() throws ApiException { return listSnapTradeUsersWithHttpInfo(); } /** * Execute listSnapTradeUsers request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { return listSnapTradeUsersAsync(_callback); } } /** * List all users * Returns a list of all registered user IDs. Please note that the response is not currently paginated. * @return ListSnapTradeUsersRequestBuilder * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public AuthenticationApi.ListSnapTradeUsersRequestBuilder listSnapTradeUsers() throws IllegalArgumentException { return ((AuthenticationApi) this).new ListSnapTradeUsersRequestBuilder(); } private okhttp3.Call loginSnapTradeUserCall(String userId, String userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = snapTradeLoginUserRequestBody; // create path and map variables String localVarPath = "/snapTrade/login"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); if (userId != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userId", userId)); } if (userSecret != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("userSecret", userSecret)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call loginSnapTradeUserValidateBeforeCall(String userId, String userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody, final ApiCallback _callback) throws ApiException { // verify the required parameter 'userId' is set if (userId == null) { throw new ApiException("Missing the required parameter 'userId' when calling loginSnapTradeUser(Async)"); } // verify the required parameter 'userSecret' is set if (userSecret == null) { throw new ApiException("Missing the required parameter 'userSecret' when calling loginSnapTradeUser(Async)"); } return loginSnapTradeUserCall(userId, userSecret, snapTradeLoginUserRequestBody, _callback); } private ApiResponse loginSnapTradeUserWithHttpInfo(String userId, String userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody) throws ApiException { okhttp3.Call localVarCall = loginSnapTradeUserValidateBeforeCall(userId, userSecret, snapTradeLoginUserRequestBody, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call loginSnapTradeUserAsync(String userId, String userSecret, SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = loginSnapTradeUserValidateBeforeCall(userId, userSecret, snapTradeLoginUserRequestBody, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class LoginSnapTradeUserRequestBuilderGenerated { final String userId; final String userSecret; String broker; Boolean immediateRedirect; String customRedirect; String reconnect; String connectionType; String connectionPortalVersion; public LoginSnapTradeUserRequestBuilderGenerated(String userId, String userSecret) { this.userId = userId; this.userSecret = userSecret; } /** * Set broker * @param broker Slug of the brokerage to connect the user to. See [the integrations page](https://snaptrade.notion.site/66793431ad0b416489eaabaf248d0afb?v=3cfea70ef4254afc89704e47275a7a9a&pvs=4) for a list of supported brokerages and their slugs. (optional) * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder */ public AuthenticationApi.LoginSnapTradeUserRequestBuilder broker(String broker) { this.broker = broker; return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; } /** * Set immediateRedirect * @param immediateRedirect When set to `true`, user will be redirected back to the partner's site instead of the connection portal. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information. (optional) * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder */ public AuthenticationApi.LoginSnapTradeUserRequestBuilder immediateRedirect(Boolean immediateRedirect) { this.immediateRedirect = immediateRedirect; return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; } /** * Set customRedirect * @param customRedirect URL to redirect the user to after the user connects their brokerage account. This parameter is ignored if the connection portal is loaded inside an iframe. See the [guide on ways to integrate the connection portal](/docs/implement-connection-portal) for more information. (optional) * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder */ public AuthenticationApi.LoginSnapTradeUserRequestBuilder customRedirect(String customRedirect) { this.customRedirect = customRedirect; return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; } /** * Set reconnect * @param reconnect The UUID of the brokerage connection to be reconnected. This parameter should be left empty unless you are reconnecting a disabled connection. See the [guide on fixing broken connections](/docs/fix-broken-connections) for more information. (optional) * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder */ public AuthenticationApi.LoginSnapTradeUserRequestBuilder reconnect(String reconnect) { this.reconnect = reconnect; return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; } /** * Set connectionType * @param connectionType Sets whether the connection should be read-only or trade-enabled. Defaults to read-only if not specified. (optional, default to read) * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder */ public AuthenticationApi.LoginSnapTradeUserRequestBuilder connectionType(String connectionType) { this.connectionType = connectionType; return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; } /** * Set connectionPortalVersion * @param connectionPortalVersion Sets the connection portal version to render. Currently only v4 is supported and is the default. All other versions are deprecated and will automatically be set to v4. (optional, default to v4) * @return AuthenticationApi.LoginSnapTradeUserRequestBuilder */ public AuthenticationApi.LoginSnapTradeUserRequestBuilder connectionPortalVersion(String connectionPortalVersion) { this.connectionPortalVersion = connectionPortalVersion; return (AuthenticationApi.LoginSnapTradeUserRequestBuilder) this; } /** * Build call for loginSnapTradeUser * @param _callback ApiCallback API callback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = buildBodyParams(); return loginSnapTradeUserCall(userId, userSecret, snapTradeLoginUserRequestBody, _callback); } private SnapTradeLoginUserRequestBody buildBodyParams() { SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = new SnapTradeLoginUserRequestBody(); snapTradeLoginUserRequestBody.broker(this.broker); snapTradeLoginUserRequestBody.immediateRedirect(this.immediateRedirect); snapTradeLoginUserRequestBody.customRedirect(this.customRedirect); snapTradeLoginUserRequestBody.reconnect(this.reconnect); if (this.connectionType != null) snapTradeLoginUserRequestBody.connectionType(SnapTradeLoginUserRequestBody.ConnectionTypeEnum.fromValue(this.connectionType)); if (this.connectionPortalVersion != null) snapTradeLoginUserRequestBody.connectionPortalVersion(SnapTradeLoginUserRequestBody.ConnectionPortalVersionEnum.fromValue(this.connectionPortalVersion)); return snapTradeLoginUserRequestBody; } /** * Execute loginSnapTradeUser request * @return Object * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public Object execute() throws ApiException { SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = buildBodyParams(); ApiResponse localVarResp = loginSnapTradeUserWithHttpInfo(userId, userSecret, snapTradeLoginUserRequestBody); return localVarResp.getResponseBody(); } /** * Execute loginSnapTradeUser request with HTTP info returned * @return ApiResponse<Object> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = buildBodyParams(); return loginSnapTradeUserWithHttpInfo(userId, userSecret, snapTradeLoginUserRequestBody); } /** * Execute loginSnapTradeUser request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { SnapTradeLoginUserRequestBody snapTradeLoginUserRequestBody = buildBodyParams(); return loginSnapTradeUserAsync(userId, userSecret, snapTradeLoginUserRequestBody, _callback); } } /** * Generate Connection Portal URL * Authenticates a SnapTrade user and returns the Connection Portal URL used for connecting brokerage accounts. Please check [this guide](/docs/implement-connection-portal) for how to integrate the Connection Portal into your app. Please note that the returned URL expires in 5 minutes. * @param userId (required) * @param userSecret (required) * @return LoginSnapTradeUserRequestBuilder * @http.response.details
Status Code Description Response Headers
200 OK -
500 Unexpected Error -
*/ public AuthenticationApi.LoginSnapTradeUserRequestBuilder loginSnapTradeUser(String userId, String userSecret) throws IllegalArgumentException { if (userId == null) throw new IllegalArgumentException("\"userId\" is required but got null"); if (userSecret == null) throw new IllegalArgumentException("\"userSecret\" is required but got null"); return ((AuthenticationApi) this).new LoginSnapTradeUserRequestBuilder(userId, userSecret); } private okhttp3.Call registerSnapTradeUserCall(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = snapTradeRegisterUserRequestBody; // create path and map variables String localVarPath = "/snapTrade/registerUser"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call registerSnapTradeUserValidateBeforeCall(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, final ApiCallback _callback) throws ApiException { // verify the required parameter 'snapTradeRegisterUserRequestBody' is set if (snapTradeRegisterUserRequestBody == null) { throw new ApiException("Missing the required parameter 'snapTradeRegisterUserRequestBody' when calling registerSnapTradeUser(Async)"); } return registerSnapTradeUserCall(snapTradeRegisterUserRequestBody, _callback); } private ApiResponse registerSnapTradeUserWithHttpInfo(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody) throws ApiException { okhttp3.Call localVarCall = registerSnapTradeUserValidateBeforeCall(snapTradeRegisterUserRequestBody, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call registerSnapTradeUserAsync(SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = registerSnapTradeUserValidateBeforeCall(snapTradeRegisterUserRequestBody, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class RegisterSnapTradeUserRequestBuilderGenerated { String userId; public RegisterSnapTradeUserRequestBuilderGenerated() { } /** * Set userId * @param userId SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. (optional) * @return AuthenticationApi.RegisterSnapTradeUserRequestBuilder */ public AuthenticationApi.RegisterSnapTradeUserRequestBuilder userId(String userId) { this.userId = userId; return (AuthenticationApi.RegisterSnapTradeUserRequestBuilder) this; } /** * Build call for registerSnapTradeUser * @param _callback ApiCallback API callback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = buildBodyParams(); return registerSnapTradeUserCall(snapTradeRegisterUserRequestBody, _callback); } private SnapTradeRegisterUserRequestBody buildBodyParams() { SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = new SnapTradeRegisterUserRequestBody(); snapTradeRegisterUserRequestBody.userId(this.userId); return snapTradeRegisterUserRequestBody; } /** * Execute registerSnapTradeUser request * @return UserIDandSecret * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public UserIDandSecret execute() throws ApiException { SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = buildBodyParams(); ApiResponse localVarResp = registerSnapTradeUserWithHttpInfo(snapTradeRegisterUserRequestBody); return localVarResp.getResponseBody(); } /** * Execute registerSnapTradeUser request with HTTP info returned * @return ApiResponse<UserIDandSecret> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = buildBodyParams(); return registerSnapTradeUserWithHttpInfo(snapTradeRegisterUserRequestBody); } /** * Execute registerSnapTradeUser request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { SnapTradeRegisterUserRequestBody snapTradeRegisterUserRequestBody = buildBodyParams(); return registerSnapTradeUserAsync(snapTradeRegisterUserRequestBody, _callback); } } /** * Register user * Registers a new SnapTrade user under your Client ID. A user secret will be automatically generated for you and must be properly stored in your system. Most SnapTrade operations require a user ID and user secret to be passed in as parameters. * @param snapTradeRegisterUserRequestBody (required) * @return RegisterSnapTradeUserRequestBuilder * @http.response.details
Status Code Description Response Headers
200 OK -
*/ public AuthenticationApi.RegisterSnapTradeUserRequestBuilder registerSnapTradeUser() throws IllegalArgumentException { return ((AuthenticationApi) this).new RegisterSnapTradeUserRequestBuilder(); } private okhttp3.Call resetSnapTradeUserSecretCall(UserIDandSecret userIDandSecret, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] { }; // Determine Base Path to Use if (localCustomBaseUrl != null){ basePath = localCustomBaseUrl; } else if ( localBasePaths.length > 0 ) { basePath = localBasePaths[localHostIndex]; } else { basePath = null; } Object localVarPostBody = userIDandSecret; // create path and map variables String localVarPath = "/snapTrade/resetUserSecret"; List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); Map localVarCookieParams = new HashMap(); Map localVarFormParams = new HashMap(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); if (localVarContentType != null) { localVarHeaderParams.put("Content-Type", localVarContentType); } String[] localVarAuthNames = new String[] { "PartnerClientId", "PartnerSignature", "PartnerTimestamp" }; return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call resetSnapTradeUserSecretValidateBeforeCall(UserIDandSecret userIDandSecret, final ApiCallback _callback) throws ApiException { // verify the required parameter 'userIDandSecret' is set if (userIDandSecret == null) { throw new ApiException("Missing the required parameter 'userIDandSecret' when calling resetSnapTradeUserSecret(Async)"); } return resetSnapTradeUserSecretCall(userIDandSecret, _callback); } private ApiResponse resetSnapTradeUserSecretWithHttpInfo(UserIDandSecret userIDandSecret) throws ApiException { okhttp3.Call localVarCall = resetSnapTradeUserSecretValidateBeforeCall(userIDandSecret, null); Type localVarReturnType = new TypeToken(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } private okhttp3.Call resetSnapTradeUserSecretAsync(UserIDandSecret userIDandSecret, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = resetSnapTradeUserSecretValidateBeforeCall(userIDandSecret, _callback); Type localVarReturnType = new TypeToken(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } public abstract class ResetSnapTradeUserSecretRequestBuilderGenerated { String userId; String userSecret; public ResetSnapTradeUserSecretRequestBuilderGenerated() { } /** * Set userId * @param userId SnapTrade User ID. This is chosen by the API partner and can be any string that is a) unique to the user, and b) immutable for the user. It is recommended to NOT use email addresses for this property because they are usually not immutable. (optional) * @return AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder */ public AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder userId(String userId) { this.userId = userId; return (AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder) this; } /** * Set userSecret * @param userSecret SnapTrade User Secret. This is a randomly generated string and should be stored securely. If compromised, please rotate it via the [rotate user secret endpoint](/reference/Authentication/Authentication_resetSnapTradeUserSecret). (optional) * @return AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder */ public AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder userSecret(String userSecret) { this.userSecret = userSecret; return (AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder) this; } /** * Build call for resetSnapTradeUserSecret * @param _callback ApiCallback API callback * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details
Status Code Description Response Headers
200 New user secret is generated -
*/ public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { UserIDandSecret userIDandSecret = buildBodyParams(); return resetSnapTradeUserSecretCall(userIDandSecret, _callback); } private UserIDandSecret buildBodyParams() { UserIDandSecret userIDandSecret = new UserIDandSecret(); userIDandSecret.userId(this.userId); userIDandSecret.userSecret(this.userSecret); return userIDandSecret; } /** * Execute resetSnapTradeUserSecret request * @return UserIDandSecret * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 New user secret is generated -
*/ public UserIDandSecret execute() throws ApiException { UserIDandSecret userIDandSecret = buildBodyParams(); ApiResponse localVarResp = resetSnapTradeUserSecretWithHttpInfo(userIDandSecret); return localVarResp.getResponseBody(); } /** * Execute resetSnapTradeUserSecret request with HTTP info returned * @return ApiResponse<UserIDandSecret> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details
Status Code Description Response Headers
200 New user secret is generated -
*/ public ApiResponse executeWithHttpInfo() throws ApiException { UserIDandSecret userIDandSecret = buildBodyParams(); return resetSnapTradeUserSecretWithHttpInfo(userIDandSecret); } /** * Execute resetSnapTradeUserSecret request (asynchronously) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details
Status Code Description Response Headers
200 New user secret is generated -
*/ public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { UserIDandSecret userIDandSecret = buildBodyParams(); return resetSnapTradeUserSecretAsync(userIDandSecret, _callback); } } /** * Rotate user secret * Rotates the secret for a SnapTrade user. You might use this if `userSecret` is compromised. Please note that if you call this endpoint and fail to save the new secret, you'll no longer be able to access any data for this user, and your only option will be to delete and recreate the user, then ask them to reconnect. * @param userIDandSecret (required) * @return ResetSnapTradeUserSecretRequestBuilder * @http.response.details
Status Code Description Response Headers
200 New user secret is generated -
*/ public AuthenticationApi.ResetSnapTradeUserSecretRequestBuilder resetSnapTradeUserSecret() throws IllegalArgumentException { return ((AuthenticationApi) this).new ResetSnapTradeUserSecretRequestBuilder(); } }