/* tslint:disable */ /* eslint-disable */ /** * Fireblocks API * Fireblocks provides a suite of applications to manage digital asset operations and a complete development platform to build your business on the blockchain. - Visit our website for more information: [Fireblocks Website](https://fireblocks.com) - Visit our developer docs: [Fireblocks DevPortal](https://developers.fireblocks.com) * * The version of the OpenAPI document: 1.6.2 * Contact: developers@fireblocks.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; import { convertToFireblocksResponse } from "../response/fireblocksResponse"; // URLSearchParams not necessarily used // @ts-ignore import { URL, URLSearchParams } from 'url'; // 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'; import { assertParamExistsAndNotEmpty } from '../utils/validation_utils'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base'; // @ts-ignore import { ContactsPagedResponse } from '../models'; // @ts-ignore import { ErrorSchema } from '../models'; /** * ContactsApi - axios parameter creator * @export */ export const ContactsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Returns a paginated list of the workspace\'s address book contacts. Live contacts are returned by default; pass `archived=true` to return only the archived ones. Results are sorted by `name` ascending unless `sortBy`/`order` say otherwise. Because the sort column is the page cursor\'s leading key, a `pageCursor` must be replayed with the same sort it was minted under, or the request is rejected. Endpoint Permissions: any workspace role may read the address book. Writes are role-gated. * @summary List contacts * @param {string} [pageCursor] Cursor indicating the page position. Omit to fetch the first page. * @param {number} [pageSize] Number of results per page * @param {boolean} [includeTotal] Return the total count of matching contacts alongside the page. Counting is opt-in because it costs an extra pass over the filtered set; `total` is omitted from the response unless this is `true`. * @param {string} [name] Filter by a case-insensitive substring of the contact name * @param {Array} [types] Filter by one or more contact types * @param {string} [containerId] Filter by the container holding the contact * @param {boolean} [archived] Return only archived contacts instead of live ones * @param {GetContactsAccessControlEnum} [accessControl] Filter by the access control applied to the contact * @param {Array} [includeTagIds] List of tag IDs to include. Contacts with any of these tags will be included * @param {Array} [excludeTagIds] List of tag IDs to exclude. Contacts with any of these tags will be filtered out * @param {GetContactsSortByEnum} [sortBy] The field to sort by * @param {GetContactsOrderEnum} [order] The sort direction * @param {*} [options] Override http request option. * @throws {RequiredError} */ getContacts: async (pageCursor?: string, pageSize?: number, includeTotal?: boolean, name?: string, types?: Array, containerId?: string, archived?: boolean, accessControl?: GetContactsAccessControlEnum, includeTagIds?: Array, excludeTagIds?: Array, sortBy?: GetContactsSortByEnum, order?: GetContactsOrderEnum, options: RawAxiosRequestConfig = {}): Promise => { const localVarPath = `/contacts`; // 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}; // Stamped onto the request config (not the headers, so it never goes on // the wire) so the response interceptor can name the operation in the // lifecycle warning. Key must match OPERATION_ID_CONFIG_KEY in utils/lifecycleWarning. (localVarRequestOptions as any).fireblocksOperationId = 'getContacts'; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; if (pageCursor !== undefined) { localVarQueryParameter['pageCursor'] = pageCursor; } if (pageSize !== undefined) { localVarQueryParameter['pageSize'] = pageSize; } if (includeTotal !== undefined) { localVarQueryParameter['includeTotal'] = includeTotal; } if (name !== undefined) { localVarQueryParameter['name'] = name; } if (types) { localVarQueryParameter['types'] = types; } if (containerId !== undefined) { localVarQueryParameter['containerId'] = containerId; } if (archived !== undefined) { localVarQueryParameter['archived'] = archived; } if (accessControl !== undefined) { localVarQueryParameter['accessControl'] = accessControl; } if (includeTagIds) { localVarQueryParameter['includeTagIds'] = includeTagIds; } if (excludeTagIds) { localVarQueryParameter['excludeTagIds'] = excludeTagIds; } if (sortBy !== undefined) { localVarQueryParameter['sortBy'] = sortBy; } if (order !== undefined) { localVarQueryParameter['order'] = order; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * ContactsApi - functional programming interface * @export */ export const ContactsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = ContactsApiAxiosParamCreator(configuration) return { /** * Returns a paginated list of the workspace\'s address book contacts. Live contacts are returned by default; pass `archived=true` to return only the archived ones. Results are sorted by `name` ascending unless `sortBy`/`order` say otherwise. Because the sort column is the page cursor\'s leading key, a `pageCursor` must be replayed with the same sort it was minted under, or the request is rejected. Endpoint Permissions: any workspace role may read the address book. Writes are role-gated. * @summary List contacts * @param {string} [pageCursor] Cursor indicating the page position. Omit to fetch the first page. * @param {number} [pageSize] Number of results per page * @param {boolean} [includeTotal] Return the total count of matching contacts alongside the page. Counting is opt-in because it costs an extra pass over the filtered set; `total` is omitted from the response unless this is `true`. * @param {string} [name] Filter by a case-insensitive substring of the contact name * @param {Array} [types] Filter by one or more contact types * @param {string} [containerId] Filter by the container holding the contact * @param {boolean} [archived] Return only archived contacts instead of live ones * @param {GetContactsAccessControlEnum} [accessControl] Filter by the access control applied to the contact * @param {Array} [includeTagIds] List of tag IDs to include. Contacts with any of these tags will be included * @param {Array} [excludeTagIds] List of tag IDs to exclude. Contacts with any of these tags will be filtered out * @param {GetContactsSortByEnum} [sortBy] The field to sort by * @param {GetContactsOrderEnum} [order] The sort direction * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getContacts(pageCursor?: string, pageSize?: number, includeTotal?: boolean, name?: string, types?: Array, containerId?: string, archived?: boolean, accessControl?: GetContactsAccessControlEnum, includeTagIds?: Array, excludeTagIds?: Array, sortBy?: GetContactsSortByEnum, order?: GetContactsOrderEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getContacts(pageCursor, pageSize, includeTotal, name, types, containerId, archived, accessControl, includeTagIds, excludeTagIds, sortBy, order, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ContactsApi.getContacts']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * ContactsApi - factory interface * @export */ export const ContactsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = ContactsApiFp(configuration) return { /** * Returns a paginated list of the workspace\'s address book contacts. Live contacts are returned by default; pass `archived=true` to return only the archived ones. Results are sorted by `name` ascending unless `sortBy`/`order` say otherwise. Because the sort column is the page cursor\'s leading key, a `pageCursor` must be replayed with the same sort it was minted under, or the request is rejected. Endpoint Permissions: any workspace role may read the address book. Writes are role-gated. * @summary List contacts * @param {ContactsApiGetContactsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getContacts(requestParameters: ContactsApiGetContactsRequest = {}, options?: RawAxiosRequestConfig): AxiosPromise { return localVarFp.getContacts(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.includeTotal, requestParameters.name, requestParameters.types, requestParameters.containerId, requestParameters.archived, requestParameters.accessControl, requestParameters.includeTagIds, requestParameters.excludeTagIds, requestParameters.sortBy, requestParameters.order, options).then((request) => request(axios, basePath)); }, }; }; /** * Request parameters for getContacts operation in ContactsApi. * @export * @interface ContactsApiGetContactsRequest */ export interface ContactsApiGetContactsRequest { /** * Cursor indicating the page position. Omit to fetch the first page. * @type {string} * @memberof ContactsApiGetContacts */ readonly pageCursor?: string /** * Number of results per page * @type {number} * @memberof ContactsApiGetContacts */ readonly pageSize?: number /** * Return the total count of matching contacts alongside the page. Counting is opt-in because it costs an extra pass over the filtered set; `total` is omitted from the response unless this is `true`. * @type {boolean} * @memberof ContactsApiGetContacts */ readonly includeTotal?: boolean /** * Filter by a case-insensitive substring of the contact name * @type {string} * @memberof ContactsApiGetContacts */ readonly name?: string /** * Filter by one or more contact types * @type {Array<'COUNTERPARTY' | 'OWN_ACCOUNT'>} * @memberof ContactsApiGetContacts */ readonly types?: Array /** * Filter by the container holding the contact * @type {string} * @memberof ContactsApiGetContacts */ readonly containerId?: string /** * Return only archived contacts instead of live ones * @type {boolean} * @memberof ContactsApiGetContacts */ readonly archived?: boolean /** * Filter by the access control applied to the contact * @type {'WHITELIST' | 'BLACKLIST'} * @memberof ContactsApiGetContacts */ readonly accessControl?: GetContactsAccessControlEnum /** * List of tag IDs to include. Contacts with any of these tags will be included * @type {Array} * @memberof ContactsApiGetContacts */ readonly includeTagIds?: Array /** * List of tag IDs to exclude. Contacts with any of these tags will be filtered out * @type {Array} * @memberof ContactsApiGetContacts */ readonly excludeTagIds?: Array /** * The field to sort by * @type {'name' | 'updatedAt'} * @memberof ContactsApiGetContacts */ readonly sortBy?: GetContactsSortByEnum /** * The sort direction * @type {'ASC' | 'DESC'} * @memberof ContactsApiGetContacts */ readonly order?: GetContactsOrderEnum } /** * ContactsApi - object-oriented interface * @export * @class ContactsApi * @extends {BaseAPI} */ export class ContactsApi extends BaseAPI { /** * Returns a paginated list of the workspace\'s address book contacts. Live contacts are returned by default; pass `archived=true` to return only the archived ones. Results are sorted by `name` ascending unless `sortBy`/`order` say otherwise. Because the sort column is the page cursor\'s leading key, a `pageCursor` must be replayed with the same sort it was minted under, or the request is rejected. Endpoint Permissions: any workspace role may read the address book. Writes are role-gated. * @summary List contacts * @param {ContactsApiGetContactsRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ContactsApi */ public getContacts(requestParameters: ContactsApiGetContactsRequest = {}) { return ContactsApiFp(this.configuration).getContacts(requestParameters.pageCursor, requestParameters.pageSize, requestParameters.includeTotal, requestParameters.name, requestParameters.types, requestParameters.containerId, requestParameters.archived, requestParameters.accessControl, requestParameters.includeTagIds, requestParameters.excludeTagIds, requestParameters.sortBy, requestParameters.order).then((request) => request(this.axios, this.basePath)).then(convertToFireblocksResponse); } } /** * @export */ export const GetContactsTypesEnum = { Counterparty: 'COUNTERPARTY', OwnAccount: 'OWN_ACCOUNT' } as const; export type GetContactsTypesEnum = typeof GetContactsTypesEnum[keyof typeof GetContactsTypesEnum]; /** * @export */ export const GetContactsAccessControlEnum = { Whitelist: 'WHITELIST', Blacklist: 'BLACKLIST' } as const; export type GetContactsAccessControlEnum = typeof GetContactsAccessControlEnum[keyof typeof GetContactsAccessControlEnum]; /** * @export */ export const GetContactsSortByEnum = { Name: 'name', UpdatedAt: 'updatedAt' } as const; export type GetContactsSortByEnum = typeof GetContactsSortByEnum[keyof typeof GetContactsSortByEnum]; /** * @export */ export const GetContactsOrderEnum = { Asc: 'ASC', Desc: 'DESC' } as const; export type GetContactsOrderEnum = typeof GetContactsOrderEnum[keyof typeof GetContactsOrderEnum];