/* tslint:disable */ /* eslint-disable */ /** * Geins Management API * Geins Management API is a RESTful api that powers your applications and helps you manage your Geins services. Geins provides an easy-to-use and scalable solution for managing all aspects of an online store, from product listings and customer information to order processing and payment transactions. :::tip Tip With this API, you can build custom applications and integrate with third-party systems, feeds, dashboards and other bussiness logic apps. ::: ## Getting started Once you have created an account, you can start using the Management API by creating an `API User`. You can create as many API users as you need. Each `API user` is connected to a specific account so you can keep track of operations and manage keys. You can find all your API credentials in `Geins Merchant Center`. ### Fast track Use one of our [SDKs](https://docs.geins.io/docs/sdk/introduction) to get started quickly. The SDKs are available for the most popular programming languages and frameworks. Or, if you prefer to just take it for a test run: [![Run in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/25895885-aaf6598f-1a7c-4949-85d7-ba846c42d553?action=collection%2Ffork&collection-url=entityId%3D25895885-aaf6598f-1a7c-4949-85d7-ba846c42d553%26entityType%3Dcollection%26workspaceId%3Da2a179ce-158e-46b0-8d06-e9640f45112c) ### Authentication Two authentication methods are required: - `Basic Auth` - `API Key` All API credentials can be found in `Geins Merchant Center`. #### Basic Auth A Basic auth `Authorization` header needs to be included in every request. The value should be `Basic ` where `` is the Base64 encoding of your `API username` and `API password` joined by a single colon `:`. See [Wikipedia](https://en.wikipedia.org/wiki/Basic_access_authentication) for more information on Basic auth. #### API Key An `X-ApiKey` header needs to be included in every request. This header should contain the value of your `API key`. #### Example ```bash curl -X GET \"https://mgmtapi.geins.io/API/Market/List\" \\ -H \"Authorization: Basic [USER-CREDENTIALS-BASE64-ENCODED]\" \\ -H \"X-ApiKey: [API-KEY]\" ``` * * The version of the OpenAPI document: v1.10.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { BaseEnvelope, EnvelopeListUserModelsReadBalanceTransaction, EnvelopeListUserModelsReadBalanceType, EnvelopeUserModelsReadBalance, EnvelopeUserModelsReadUserProfile, PagedEnvelopeListUserModelsReadUserProfile, UserModelsUserProfileQuery, UserModelsWriteBalanceTransaction, UserModelsWriteUserProfile, } from '../models'; import { BaseEnvelopeFromJSON, BaseEnvelopeToJSON, EnvelopeListUserModelsReadBalanceTransactionFromJSON, EnvelopeListUserModelsReadBalanceTransactionToJSON, EnvelopeListUserModelsReadBalanceTypeFromJSON, EnvelopeListUserModelsReadBalanceTypeToJSON, EnvelopeUserModelsReadBalanceFromJSON, EnvelopeUserModelsReadBalanceToJSON, EnvelopeUserModelsReadUserProfileFromJSON, EnvelopeUserModelsReadUserProfileToJSON, PagedEnvelopeListUserModelsReadUserProfileFromJSON, PagedEnvelopeListUserModelsReadUserProfileToJSON, UserModelsUserProfileQueryFromJSON, UserModelsUserProfileQueryToJSON, UserModelsWriteBalanceTransactionFromJSON, UserModelsWriteBalanceTransactionToJSON, UserModelsWriteUserProfileFromJSON, UserModelsWriteUserProfileToJSON, } from '../models'; export interface AddUserBalanceRequest { userId: number; balanceTransaction: UserModelsWriteBalanceTransaction; } export interface CreateUserProfileRequest { userProfile: UserModelsWriteUserProfile; } export interface DeleteUserProfileEmailRequest { email: string; } export interface DeleteUserProfileIdRequest { userId: number; } export interface GetUserBalanceRequest { userId: number; currency: string; } export interface GetUserBalanceTransactionsRequest { userId: number; currency: string; } export interface GetUserProfileEmailRequest { email: string; } export interface GetUserProfileIdRequest { userId: number; } export interface QueryUserProfilesRequest { page: number; query: UserModelsUserProfileQuery; } export interface UpdateUserProfileRequest { userId: number; user: UserModelsWriteUserProfile; } /** * */ export class UserApi extends runtime.BaseAPI { /** * Adds a balance transaction to a specific user. * Add user balance */ async addUserBalanceRaw(requestParameters: AddUserBalanceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling addUserBalance.'); } if (requestParameters.balanceTransaction === null || requestParameters.balanceTransaction === undefined) { throw new runtime.RequiredError('balanceTransaction','Required parameter requestParameters.balanceTransaction was null or undefined when calling addUserBalance.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/{userId}/Balance`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), method: 'POST', headers: headerParameters, query: queryParameters, body: UserModelsWriteBalanceTransactionToJSON(requestParameters.balanceTransaction), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BaseEnvelopeFromJSON(jsonValue)); } /** * Adds a balance transaction to a specific user. * Add user balance */ async addUserBalance(requestParameters: AddUserBalanceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addUserBalanceRaw(requestParameters, initOverrides); return await response.value(); } /** * Create user profile */ async createUserProfileRaw(requestParameters: CreateUserProfileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userProfile === null || requestParameters.userProfile === undefined) { throw new runtime.RequiredError('userProfile','Required parameter requestParameters.userProfile was null or undefined when calling createUserProfile.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User`, method: 'POST', headers: headerParameters, query: queryParameters, body: UserModelsWriteUserProfileToJSON(requestParameters.userProfile), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvelopeUserModelsReadUserProfileFromJSON(jsonValue)); } /** * Create user profile */ async createUserProfile(requestParameters: CreateUserProfileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createUserProfileRaw(requestParameters, initOverrides); return await response.value(); } /** * Delete user profile (email) */ async deleteUserProfileEmailRaw(requestParameters: DeleteUserProfileEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.email === null || requestParameters.email === undefined) { throw new runtime.RequiredError('email','Required parameter requestParameters.email was null or undefined when calling deleteUserProfileEmail.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/{email}`.replace(`{${"email"}}`, encodeURIComponent(String(requestParameters.email))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BaseEnvelopeFromJSON(jsonValue)); } /** * Delete user profile (email) */ async deleteUserProfileEmail(requestParameters: DeleteUserProfileEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteUserProfileEmailRaw(requestParameters, initOverrides); return await response.value(); } /** * Delete user profile (id) */ async deleteUserProfileIdRaw(requestParameters: DeleteUserProfileIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling deleteUserProfileId.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BaseEnvelopeFromJSON(jsonValue)); } /** * Delete user profile (id) */ async deleteUserProfileId(requestParameters: DeleteUserProfileIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.deleteUserProfileIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Gets the balance for a specific user. * Get user balance */ async getUserBalanceRaw(requestParameters: GetUserBalanceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getUserBalance.'); } if (requestParameters.currency === null || requestParameters.currency === undefined) { throw new runtime.RequiredError('currency','Required parameter requestParameters.currency was null or undefined when calling getUserBalance.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/{userId}/Balance/{currency}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))).replace(`{${"currency"}}`, encodeURIComponent(String(requestParameters.currency))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvelopeUserModelsReadBalanceFromJSON(jsonValue)); } /** * Gets the balance for a specific user. * Get user balance */ async getUserBalance(requestParameters: GetUserBalanceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getUserBalanceRaw(requestParameters, initOverrides); return await response.value(); } /** * Gets all balance transactions for a specific user. * Get user balance transactions */ async getUserBalanceTransactionsRaw(requestParameters: GetUserBalanceTransactionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getUserBalanceTransactions.'); } if (requestParameters.currency === null || requestParameters.currency === undefined) { throw new runtime.RequiredError('currency','Required parameter requestParameters.currency was null or undefined when calling getUserBalanceTransactions.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/{userId}/BalanceTransaction/List/{currency}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))).replace(`{${"currency"}}`, encodeURIComponent(String(requestParameters.currency))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvelopeListUserModelsReadBalanceTransactionFromJSON(jsonValue)); } /** * Gets all balance transactions for a specific user. * Get user balance transactions */ async getUserBalanceTransactions(requestParameters: GetUserBalanceTransactionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getUserBalanceTransactionsRaw(requestParameters, initOverrides); return await response.value(); } /** * Gets all available balance types. * Get user balance types */ async getUserBalanceTypesRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/BalanceType/List`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvelopeListUserModelsReadBalanceTypeFromJSON(jsonValue)); } /** * Gets all available balance types. * Get user balance types */ async getUserBalanceTypes(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getUserBalanceTypesRaw(initOverrides); return await response.value(); } /** * Gets a specific user profile via email. * Get user profile (email) */ async getUserProfileEmailRaw(requestParameters: GetUserProfileEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.email === null || requestParameters.email === undefined) { throw new runtime.RequiredError('email','Required parameter requestParameters.email was null or undefined when calling getUserProfileEmail.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/{email}`.replace(`{${"email"}}`, encodeURIComponent(String(requestParameters.email))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvelopeUserModelsReadUserProfileFromJSON(jsonValue)); } /** * Gets a specific user profile via email. * Get user profile (email) */ async getUserProfileEmail(requestParameters: GetUserProfileEmailRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getUserProfileEmailRaw(requestParameters, initOverrides); return await response.value(); } /** * Gets a specific user profile via user id. * Get user profile (id) */ async getUserProfileIdRaw(requestParameters: GetUserProfileIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling getUserProfileId.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => EnvelopeUserModelsReadUserProfileFromJSON(jsonValue)); } /** * Gets a specific user profile via user id. * Get user profile (id) */ async getUserProfileId(requestParameters: GetUserProfileIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getUserProfileIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Queries user profiles and stores the result in a batch. Results are fetched from this batch one page at a time via subsequent requests. BatchId is mandatory when fetching any page other than the first page. If no BatchId is provided for the first page, a new batch is created and the id for that batch can be found in the response. * Query user profiles */ async queryUserProfilesRaw(requestParameters: QueryUserProfilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.page === null || requestParameters.page === undefined) { throw new runtime.RequiredError('page','Required parameter requestParameters.page was null or undefined when calling queryUserProfiles.'); } if (requestParameters.query === null || requestParameters.query === undefined) { throw new runtime.RequiredError('query','Required parameter requestParameters.query was null or undefined when calling queryUserProfiles.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/Query/{page}`.replace(`{${"page"}}`, encodeURIComponent(String(requestParameters.page))), method: 'POST', headers: headerParameters, query: queryParameters, body: UserModelsUserProfileQueryToJSON(requestParameters.query), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PagedEnvelopeListUserModelsReadUserProfileFromJSON(jsonValue)); } /** * Queries user profiles and stores the result in a batch. Results are fetched from this batch one page at a time via subsequent requests. BatchId is mandatory when fetching any page other than the first page. If no BatchId is provided for the first page, a new batch is created and the id for that batch can be found in the response. * Query user profiles */ async queryUserProfiles(requestParameters: QueryUserProfilesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.queryUserProfilesRaw(requestParameters, initOverrides); return await response.value(); } /** * Updates a user profile. Any fields not specified in the request or with null value will be left unchanged. * Update user profile */ async updateUserProfileRaw(requestParameters: UpdateUserProfileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling updateUserProfile.'); } if (requestParameters.user === null || requestParameters.user === undefined) { throw new runtime.RequiredError('user','Required parameter requestParameters.user was null or undefined when calling updateUserProfile.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["X-ApiKey"] = this.configuration.apiKey("X-ApiKey"); // apiKey authentication } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } const response = await this.request({ path: `/API/User/{userId}`.replace(`{${"userId"}}`, encodeURIComponent(String(requestParameters.userId))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: UserModelsWriteUserProfileToJSON(requestParameters.user), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => BaseEnvelopeFromJSON(jsonValue)); } /** * Updates a user profile. Any fields not specified in the request or with null value will be left unchanged. * Update user profile */ async updateUserProfile(requestParameters: UpdateUserProfileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateUserProfileRaw(requestParameters, initOverrides); return await response.value(); } }