/** * This file was auto-generated by Fern from our API Definition. */ import * as environments from "../../../../environments.js"; import * as core from "../../../../core/index.js"; import * as Mercoa from "../../../index.js"; import { Counterparty } from "../resources/counterparty/client/Client.js"; import { EmailLog } from "../resources/emailLog/client/Client.js"; import { PaymentMethod } from "../resources/paymentMethod/client/Client.js"; import { User } from "../resources/user/client/Client.js"; import { ApprovalPolicy } from "../resources/approvalPolicy/client/Client.js"; import { Bnpl } from "../resources/bnpl/client/Client.js"; import { Bulk } from "../resources/bulk/client/Client.js"; import { Customization } from "../resources/customization/client/Client.js"; import { Document } from "../resources/document/client/Client.js"; import { EmailTemplate } from "../resources/emailTemplate/client/Client.js"; import { ExternalAccountingSystem } from "../resources/externalAccountingSystem/client/Client.js"; import { Invoice } from "../resources/invoice/client/Client.js"; import { Metadata } from "../resources/metadata/client/Client.js"; import { NotificationPolicy } from "../resources/notificationPolicy/client/Client.js"; import { Representative } from "../resources/representative/client/Client.js"; export declare namespace Entity { interface Options { environment?: core.Supplier; /** Specify a custom URL to connect the client to. */ baseUrl?: core.Supplier; token: core.Supplier; /** Override the X-API-Version header */ xApiVersion?: "2024-08-01"; /** Additional headers to include in requests. */ headers?: Record | undefined>; } interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Additional query string parameters to include in the request. */ queryParams?: Record; /** Additional headers to include in the request. */ headers?: Record | undefined>; /** Override the X-API-Version header */ xApiVersion?: "2024-08-01"; } } export declare class Entity { protected readonly _options: Entity.Options; protected _counterparty: Counterparty | undefined; protected _emailLog: EmailLog | undefined; protected _paymentMethod: PaymentMethod | undefined; protected _user: User | undefined; protected _approvalPolicy: ApprovalPolicy | undefined; protected _bnpl: Bnpl | undefined; protected _bulk: Bulk | undefined; protected _customization: Customization | undefined; protected _document: Document | undefined; protected _emailTemplate: EmailTemplate | undefined; protected _externalAccountingSystem: ExternalAccountingSystem | undefined; protected _invoice: Invoice | undefined; protected _metadata: Metadata | undefined; protected _notificationPolicy: NotificationPolicy | undefined; protected _representative: Representative | undefined; constructor(_options: Entity.Options); get counterparty(): Counterparty; get emailLog(): EmailLog; get paymentMethod(): PaymentMethod; get user(): User; get approvalPolicy(): ApprovalPolicy; get bnpl(): Bnpl; get bulk(): Bulk; get customization(): Customization; get document(): Document; get emailTemplate(): EmailTemplate; get externalAccountingSystem(): ExternalAccountingSystem; get invoice(): Invoice; get metadata(): Metadata; get notificationPolicy(): NotificationPolicy; get representative(): Representative; /** * Search all entities with the given filters. If no filters are provided, all entities will be returned. * * @param {Mercoa.entity.FindEntities} request * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.find({ * isCustomer: true, * foreignId: "MY-DB-ID-12345", * paymentMethods: true * }) */ find(request?: Mercoa.entity.FindEntities, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __find; /** * @param {Mercoa.EntityRequest} request * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.create({ * isCustomer: true, * isPayor: true, * isPayee: false, * accountType: "business", * foreignId: "MY-DB-ID-12345", * profile: { * business: { * email: "customer@acme.com", * legalBusinessName: "Acme Inc.", * website: "http://www.acme.com", * businessType: "llc", * phone: { * countryCode: "1", * number: "4155551234" * }, * address: { * addressLine1: "123 Main St", * addressLine2: "Unit 1", * city: "San Francisco", * stateOrProvince: "CA", * postalCode: "94105", * country: "US" * }, * taxId: { * ein: { * number: "12-3456789" * } * } * } * } * }) * * @example * await client.entity.create({ * isCustomer: false, * isPayor: false, * isPayee: true, * accountType: "business", * foreignId: "MY-DB-ID-90909", * profile: { * business: { * email: "vendor@bigboxstore.com", * legalBusinessName: "Big Box Store", * website: "http://www.bigboxstore.com", * businessType: "publicCorporation" * } * } * }) */ create(request: Mercoa.EntityRequest, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __create; /** * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Mercoa.entity.EntityGetRequest} request * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.get("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced") */ get(entityId: Mercoa.EntityId, request?: Mercoa.entity.EntityGetRequest, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __get; /** * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Mercoa.EntityUpdateRequest} request * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.update("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * isCustomer: true, * isPayor: true, * isPayee: false, * accountType: "business", * foreignId: "MY-DB-ID-12345", * profile: { * business: { * email: "customer@acme.com", * legalBusinessName: "Acme Inc.", * website: "http://www.acme.com", * businessType: "llc", * phone: { * countryCode: "1", * number: "4155551234" * }, * address: { * addressLine1: "123 Main St", * addressLine2: "Unit 1", * city: "San Francisco", * stateOrProvince: "CA", * postalCode: "94105", * country: "US" * }, * taxId: { * ein: { * number: "12-3456789" * } * } * } * } * }) */ update(entityId: Mercoa.EntityId, request: Mercoa.EntityUpdateRequest, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __update; /** * Will archive the entity. This action cannot be undone, and the entity will no longer be available for use. The foreignId on the entity will be cleared as well. * * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.delete("entityId") */ delete(entityId: Mercoa.EntityId, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __delete; /** * This endpoint is used to indicate acceptance of Mercoa's terms of service for an entity. Send a request to this endpoint only after the entity has accepted the Mercoa ToS. Entities must accept Mercoa ToS before they can be send or pay invoices using Mercoa's payment rails. * * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.acceptTermsOfService("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced") */ acceptTermsOfService(entityId: Mercoa.EntityId, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __acceptTermsOfService; /** * This endpoint is used to initiate KYB for an entity. * Send a request to this endpoint only after the entity has accepted the Mercoa ToS, * all representatives have been added, and all required fields have been filled out. * * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.initiateKyb("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced") */ initiateKyb(entityId: Mercoa.EntityId, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __initiateKyb; /** * Generate a JWT token for an entity with the given options. This token can be used to authenticate the entity in the Mercoa API and iFrame. * * We recommend using [this endpoint](/api-reference/entity/user/get-token). This will enable features such as approvals and comments. * * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Mercoa.TokenGenerationOptions} request * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.getToken("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * expiresIn: "1h" * }) * * @example * await client.entity.getToken("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * expiresIn: "1h", * sessionId: "session_123" * }) */ getToken(entityId: Mercoa.EntityId, request: Mercoa.TokenGenerationOptions, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __getToken; /** * Generate an onboarding link for the entity. * * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Mercoa.entity.GenerateOnboardingLink} request * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.getOnboardingLink("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * type: "PAYOR", * expiresIn: "1h" * }) */ getOnboardingLink(entityId: Mercoa.EntityId, request: Mercoa.entity.GenerateOnboardingLink, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __getOnboardingLink; /** * Send an email with a onboarding link to the entity. The email will be sent to the email address associated with the entity. * * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Mercoa.entity.SendOnboardingLink} request * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.sendOnboardingLink("entityId", { * type: "PAYEE" * }) */ sendOnboardingLink(entityId: Mercoa.EntityId, request: Mercoa.entity.SendOnboardingLink, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __sendOnboardingLink; /** * Get all events for an entity * * @param {Mercoa.EntityId} entityId - Entity ID or Entity ForeignID * @param {Mercoa.entity.EntityEntityGetEventsRequest} request * @param {Entity.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Mercoa.BadRequest} * @throws {@link Mercoa.Unauthorized} * @throws {@link Mercoa.Forbidden} * @throws {@link Mercoa.NotFound} * @throws {@link Mercoa.Conflict} * @throws {@link Mercoa.InternalServerError} * @throws {@link Mercoa.Unimplemented} * * @example * await client.entity.events("ent_a0f6ea94-0761-4a5e-a416-3c453cb7eced") */ events(entityId: Mercoa.EntityId, request?: Mercoa.entity.EntityEntityGetEventsRequest, requestOptions?: Entity.RequestOptions): core.HttpResponsePromise; private __events; protected _getAuthorizationHeader(): Promise; }