/* tslint:disable */ /* eslint-disable */ /** * Credify external API doc v2 * API documentations for integration version 2. * * The version of the OpenAPI document: 1.0.0-oas3 * Contact: dev@credify.one * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import globalAxios, { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios'; import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { APIErrorV2 } from '../model'; // @ts-ignore import { OIDCUserInfo } from '../model'; // @ts-ignore import { OfferData } from '../model'; // @ts-ignore import { OfferTransactionStatusUpdateRequest } from '../model'; // @ts-ignore import { TokenResponse } from '../model'; /** * ServiceProviderApi - axios parameter creator * @export */ export const ServiceProviderApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * This manages token usage of OIDC. * @summary OIDC token * @param {string} [code] * @param {'authozation_code' | 'password' | 'client_credentials' | 'refresh_token'} [grantType] * @param {string} [password] * @param {string} [redirectUri] * @param {string} [refreshToken] * @param {string} [scope] * @param {string} [username] * @param {string} [clientId] * @param {string} [clientSecret] * @param {*} [options] Override http request option. * @throws {RequiredError} */ generateToken: async (code?: string, grantType?: 'authozation_code' | 'password' | 'client_credentials' | 'refresh_token', password?: string, redirectUri?: string, refreshToken?: string, scope?: string, username?: string, clientId?: string, clientSecret?: string, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/v2/oauth2/token`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) if (code !== undefined) { localVarQueryParameter['code'] = code; } if (grantType !== undefined) { localVarQueryParameter['grant_type'] = grantType; } if (password !== undefined) { localVarQueryParameter['password'] = password; } if (redirectUri !== undefined) { localVarQueryParameter['redirect_uri'] = redirectUri; } if (refreshToken !== undefined) { localVarQueryParameter['refresh_token'] = refreshToken; } if (scope !== undefined) { localVarQueryParameter['scope'] = scope; } if (username !== undefined) { localVarQueryParameter['username'] = username; } if (clientId !== undefined) { localVarQueryParameter['client_id'] = clientId; } if (clientSecret !== undefined) { localVarQueryParameter['client_secret'] = clientSecret; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This fetches a detail data of a specified offer. * @summary Offer detail * @param {string} offerCode Offer Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOfferDetail: async (offerCode: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'offerCode' is not null or undefined assertParamExists('getOfferDetail', 'offerCode', offerCode) const localVarPath = `/v2/integration/service-provider/offers/{offer_code}` .replace(`{${"offer_code"}}`, encodeURIComponent(String(offerCode))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This operation requests to fetch encrypted scope values shared by users with an OIDC client. The OIDC client needs to use an ephemeral private key generated in the OIDC flow to decrypt the values. The response body will contain encrypted custom claim values as well as the standard claims. * @summary Encrypted scope values * @param {*} [options] Override http request option. * @throws {RequiredError} */ getUserInfo: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/v2/integration/service-provider/userinfo`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This operation updates onboarding status of an offer approval. This needs `oidc_client:write_transactions` scope. `code` and `description` are needed only when the status will be `FAILED`. * @summary Offer redemption status * @param {string} id Approval ID * @param {OfferTransactionStatusUpdateRequest} [offerTransactionStatusUpdateRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateOnboardingStatus: async (id: string, offerTransactionStatusUpdateRequest?: OfferTransactionStatusUpdateRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'id' is not null or undefined assertParamExists('updateOnboardingStatus', 'id', id) const localVarPath = `/v2/integration/service-provider/offers/transactions/{id}/status` .replace(`{${"id"}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration) localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; localVarRequestOptions.data = offerTransactionStatusUpdateRequest return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * ServiceProviderApi - functional programming interface * @export */ export const ServiceProviderApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = ServiceProviderApiAxiosParamCreator(configuration) return { /** * This manages token usage of OIDC. * @summary OIDC token * @param {string} [code] * @param {'authozation_code' | 'password' | 'client_credentials' | 'refresh_token'} [grantType] * @param {string} [password] * @param {string} [redirectUri] * @param {string} [refreshToken] * @param {string} [scope] * @param {string} [username] * @param {string} [clientId] * @param {string} [clientSecret] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async generateToken(code?: string, grantType?: 'authozation_code' | 'password' | 'client_credentials' | 'refresh_token', password?: string, redirectUri?: string, refreshToken?: string, scope?: string, username?: string, clientId?: string, clientSecret?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.generateToken(code, grantType, password, redirectUri, refreshToken, scope, username, clientId, clientSecret, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This fetches a detail data of a specified offer. * @summary Offer detail * @param {string} offerCode Offer Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getOfferDetail(offerCode: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getOfferDetail(offerCode, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This operation requests to fetch encrypted scope values shared by users with an OIDC client. The OIDC client needs to use an ephemeral private key generated in the OIDC flow to decrypt the values. The response body will contain encrypted custom claim values as well as the standard claims. * @summary Encrypted scope values * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getUserInfo(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getUserInfo(options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This operation updates onboarding status of an offer approval. This needs `oidc_client:write_transactions` scope. `code` and `description` are needed only when the status will be `FAILED`. * @summary Offer redemption status * @param {string} id Approval ID * @param {OfferTransactionStatusUpdateRequest} [offerTransactionStatusUpdateRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateOnboardingStatus(id: string, offerTransactionStatusUpdateRequest?: OfferTransactionStatusUpdateRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.updateOnboardingStatus(id, offerTransactionStatusUpdateRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * ServiceProviderApi - factory interface * @export */ export const ServiceProviderApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = ServiceProviderApiFp(configuration) return { /** * This manages token usage of OIDC. * @summary OIDC token * @param {string} [code] * @param {'authozation_code' | 'password' | 'client_credentials' | 'refresh_token'} [grantType] * @param {string} [password] * @param {string} [redirectUri] * @param {string} [refreshToken] * @param {string} [scope] * @param {string} [username] * @param {string} [clientId] * @param {string} [clientSecret] * @param {*} [options] Override http request option. * @throws {RequiredError} */ generateToken(code?: string, grantType?: 'authozation_code' | 'password' | 'client_credentials' | 'refresh_token', password?: string, redirectUri?: string, refreshToken?: string, scope?: string, username?: string, clientId?: string, clientSecret?: string, options?: any): AxiosPromise { return localVarFp.generateToken(code, grantType, password, redirectUri, refreshToken, scope, username, clientId, clientSecret, options).then((request) => request(axios, basePath)); }, /** * This fetches a detail data of a specified offer. * @summary Offer detail * @param {string} offerCode Offer Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ getOfferDetail(offerCode: string, options?: any): AxiosPromise { return localVarFp.getOfferDetail(offerCode, options).then((request) => request(axios, basePath)); }, /** * This operation requests to fetch encrypted scope values shared by users with an OIDC client. The OIDC client needs to use an ephemeral private key generated in the OIDC flow to decrypt the values. The response body will contain encrypted custom claim values as well as the standard claims. * @summary Encrypted scope values * @param {*} [options] Override http request option. * @throws {RequiredError} */ getUserInfo(options?: any): AxiosPromise { return localVarFp.getUserInfo(options).then((request) => request(axios, basePath)); }, /** * This operation updates onboarding status of an offer approval. This needs `oidc_client:write_transactions` scope. `code` and `description` are needed only when the status will be `FAILED`. * @summary Offer redemption status * @param {string} id Approval ID * @param {OfferTransactionStatusUpdateRequest} [offerTransactionStatusUpdateRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateOnboardingStatus(id: string, offerTransactionStatusUpdateRequest?: OfferTransactionStatusUpdateRequest, options?: any): AxiosPromise { return localVarFp.updateOnboardingStatus(id, offerTransactionStatusUpdateRequest, options).then((request) => request(axios, basePath)); }, }; }; /** * ServiceProviderApi - interface * @export * @interface ServiceProviderApi */ export interface ServiceProviderApiInterface { /** * This manages token usage of OIDC. * @summary OIDC token * @param {string} [code] * @param {'authozation_code' | 'password' | 'client_credentials' | 'refresh_token'} [grantType] * @param {string} [password] * @param {string} [redirectUri] * @param {string} [refreshToken] * @param {string} [scope] * @param {string} [username] * @param {string} [clientId] * @param {string} [clientSecret] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServiceProviderApiInterface */ generateToken(code?: string, grantType?: 'authozation_code' | 'password' | 'client_credentials' | 'refresh_token', password?: string, redirectUri?: string, refreshToken?: string, scope?: string, username?: string, clientId?: string, clientSecret?: string, options?: AxiosRequestConfig): AxiosPromise; /** * This fetches a detail data of a specified offer. * @summary Offer detail * @param {string} offerCode Offer Code * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServiceProviderApiInterface */ getOfferDetail(offerCode: string, options?: AxiosRequestConfig): AxiosPromise; /** * This operation requests to fetch encrypted scope values shared by users with an OIDC client. The OIDC client needs to use an ephemeral private key generated in the OIDC flow to decrypt the values. The response body will contain encrypted custom claim values as well as the standard claims. * @summary Encrypted scope values * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServiceProviderApiInterface */ getUserInfo(options?: AxiosRequestConfig): AxiosPromise; /** * This operation updates onboarding status of an offer approval. This needs `oidc_client:write_transactions` scope. `code` and `description` are needed only when the status will be `FAILED`. * @summary Offer redemption status * @param {string} id Approval ID * @param {OfferTransactionStatusUpdateRequest} [offerTransactionStatusUpdateRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServiceProviderApiInterface */ updateOnboardingStatus(id: string, offerTransactionStatusUpdateRequest?: OfferTransactionStatusUpdateRequest, options?: AxiosRequestConfig): AxiosPromise; } /** * ServiceProviderApi - object-oriented interface * @export * @class ServiceProviderApi * @extends {BaseAPI} */ export class ServiceProviderApi extends BaseAPI implements ServiceProviderApiInterface { /** * This manages token usage of OIDC. * @summary OIDC token * @param {string} [code] * @param {'authozation_code' | 'password' | 'client_credentials' | 'refresh_token'} [grantType] * @param {string} [password] * @param {string} [redirectUri] * @param {string} [refreshToken] * @param {string} [scope] * @param {string} [username] * @param {string} [clientId] * @param {string} [clientSecret] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServiceProviderApi */ public generateToken(code?: string, grantType?: 'authozation_code' | 'password' | 'client_credentials' | 'refresh_token', password?: string, redirectUri?: string, refreshToken?: string, scope?: string, username?: string, clientId?: string, clientSecret?: string, options?: AxiosRequestConfig) { return ServiceProviderApiFp(this.configuration).generateToken(code, grantType, password, redirectUri, refreshToken, scope, username, clientId, clientSecret, options).then((request) => request(this.axios, this.basePath)); } /** * This fetches a detail data of a specified offer. * @summary Offer detail * @param {string} offerCode Offer Code * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServiceProviderApi */ public getOfferDetail(offerCode: string, options?: AxiosRequestConfig) { return ServiceProviderApiFp(this.configuration).getOfferDetail(offerCode, options).then((request) => request(this.axios, this.basePath)); } /** * This operation requests to fetch encrypted scope values shared by users with an OIDC client. The OIDC client needs to use an ephemeral private key generated in the OIDC flow to decrypt the values. The response body will contain encrypted custom claim values as well as the standard claims. * @summary Encrypted scope values * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServiceProviderApi */ public getUserInfo(options?: AxiosRequestConfig) { return ServiceProviderApiFp(this.configuration).getUserInfo(options).then((request) => request(this.axios, this.basePath)); } /** * This operation updates onboarding status of an offer approval. This needs `oidc_client:write_transactions` scope. `code` and `description` are needed only when the status will be `FAILED`. * @summary Offer redemption status * @param {string} id Approval ID * @param {OfferTransactionStatusUpdateRequest} [offerTransactionStatusUpdateRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ServiceProviderApi */ public updateOnboardingStatus(id: string, offerTransactionStatusUpdateRequest?: OfferTransactionStatusUpdateRequest, options?: AxiosRequestConfig) { return ServiceProviderApiFp(this.configuration).updateOnboardingStatus(id, offerTransactionStatusUpdateRequest, options).then((request) => request(this.axios, this.basePath)); } }