/** * 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 { User } from "../resources/user/client/Client.js"; import { Invoice } from "../resources/invoice/client/Client.js"; export declare namespace EntityGroup { 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 EntityGroup { protected readonly _options: EntityGroup.Options; protected _counterparty: Counterparty | undefined; protected _user: User | undefined; protected _invoice: Invoice | undefined; constructor(_options: EntityGroup.Options); get counterparty(): Counterparty; get user(): User; get invoice(): Invoice; /** * Get all entity groups. If using a JWT, will return all groups the entity is part of. If using an API key, will return all groups for the organization. * * @param {Mercoa.entityGroup.EntityGroupFindRequest} request * @param {EntityGroup.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.entityGroup.getAll() */ getAll(request?: Mercoa.entityGroup.EntityGroupFindRequest, requestOptions?: EntityGroup.RequestOptions): core.HttpResponsePromise; private __getAll; /** * Create an entity group * * @param {Mercoa.EntityGroupCreateRequest} request * @param {EntityGroup.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.entityGroup.create({ * foreignId: "your-group-id", * name: "AcmeConglomerate", * emailToName: "acmegroup", * entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"] * }) * * @example * await client.entityGroup.create({ * foreignId: "your-group-id", * name: "Coastal Corporation", * emailToName: "coastalcorp", * entityIds: ["ent_e8c2af94-61cd-4036-a765-80341209167b", "ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b", "ent_3dbb4ede-2d1d-49be-a996-a5dfad3641be"] * }) */ create(request: Mercoa.EntityGroupCreateRequest, requestOptions?: EntityGroup.RequestOptions): core.HttpResponsePromise; private __create; /** * Get an entity group * * @param {Mercoa.EntityGroupId} entityGroupId - Entity Group ID or Entity Group ForeignID * @param {Mercoa.entityGroup.EntityGroupGetRequest} request * @param {EntityGroup.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.entityGroup.get("entg_a3582b70-fd04-4888-9185-a640ae9048be") */ get(entityGroupId: Mercoa.EntityGroupId, request?: Mercoa.entityGroup.EntityGroupGetRequest, requestOptions?: EntityGroup.RequestOptions): core.HttpResponsePromise; private __get; /** * Update an entity group * * @param {Mercoa.EntityGroupId} entityGroupId - Entity Group ID or Entity Group ForeignID * @param {Mercoa.EntityGroupUpdateRequest} request * @param {EntityGroup.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.entityGroup.update("entg_a3582b70-fd04-4888-9185-a640ae9048be", { * foreignId: "your-group-id", * name: "AcmeConglomerate", * emailToName: "acmegroup" * }) */ update(entityGroupId: Mercoa.EntityGroupId, request: Mercoa.EntityGroupUpdateRequest, requestOptions?: EntityGroup.RequestOptions): core.HttpResponsePromise; private __update; /** * Delete an entity group * * @param {Mercoa.EntityGroupId} entityGroupId - Entity Group ID or Entity Group ForeignID * @param {EntityGroup.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.entityGroup.delete("entityGroupId") */ delete(entityGroupId: Mercoa.EntityGroupId, requestOptions?: EntityGroup.RequestOptions): core.HttpResponsePromise; private __delete; /** * Generate a JWT token for an entity group with the given options. This token can be used to authenticate to any entity in the entity group in the Mercoa API and iFrame. * * We recommend using [this endpoint](/api-reference/entity-group/user/get-token). This will enable features such as approvals and comments. * * @param {Mercoa.EntityGroupId} entityGroupId - Entity Group ID or Entity Group ForeignID * @param {Mercoa.TokenGenerationOptions} request * @param {EntityGroup.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.entityGroup.getToken("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * expiresIn: "1h" * }) * * @example * await client.entityGroup.getToken("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * expiresIn: "1h", * sessionId: "session_123" * }) */ getToken(entityGroupId: Mercoa.EntityGroupId, request: Mercoa.TokenGenerationOptions, requestOptions?: EntityGroup.RequestOptions): core.HttpResponsePromise; private __getToken; /** * Add entities to an entity group * * @param {Mercoa.EntityGroupId} entityGroupId - Entity Group ID or Entity Group ForeignID * @param {Mercoa.EntityGroupAddEntitiesRequest} request * @param {EntityGroup.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.entityGroup.addEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"] * }) * * @example * await client.entityGroup.addEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"], * copyUsersFrom: true * }) * * @example * await client.entityGroup.addEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"], * copyUsersFrom: false * }) * * @example * await client.entityGroup.addEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"], * copyUsersFrom: "ent_1176dd0c-12e1-41c7-85a5-ae9b4746e64b" * }) */ addEntities(entityGroupId: Mercoa.EntityGroupId, request: Mercoa.EntityGroupAddEntitiesRequest, requestOptions?: EntityGroup.RequestOptions): core.HttpResponsePromise; private __addEntities; /** * Remove entities from an entity group * * @param {Mercoa.EntityGroupId} entityGroupId - Entity Group ID or Entity Group ForeignID * @param {Mercoa.EntityGroupRemoveEntitiesRequest} request * @param {EntityGroup.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.entityGroup.removeEntities("entg_a0f6ea94-0761-4a5e-a416-3c453cb7eced", { * entityIds: ["ent_8545a84e-a45f-41bf-bdf1-33b42a55812c", "ent_21661ac1-a2a8-4465-a6c0-64474ba8181d"] * }) */ removeEntities(entityGroupId: Mercoa.EntityGroupId, request: Mercoa.EntityGroupRemoveEntitiesRequest, requestOptions?: EntityGroup.RequestOptions): core.HttpResponsePromise; private __removeEntities; protected _getAuthorizationHeader(): Promise; }