@twin.org/api-tenant-processor
Version:
API Tenant Processor for converting and api key to a tenant id.
57 lines (56 loc) • 1.9 kB
TypeScript
import type { ITenant } from "./models/ITenant.js";
import type { ITenantAdminComponent } from "./models/ITenantAdminComponent.js";
import type { ITenantAdminServiceConstructorOptions } from "./models/ITenantAdminServiceConstructorOptions.js";
/**
* Service for performing email messaging operations to a connector.
*/
export declare class TenantAdminService implements ITenantAdminComponent {
/**
* Runtime name for the class.
*/
static readonly CLASS_NAME: string;
/**
* Create a new instance of TenantAdminService.
* @param options The options for the connector.
*/
constructor(options?: ITenantAdminServiceConstructorOptions);
/**
* Returns the class name of the component.
* @returns The class name of the component.
*/
className(): string;
/**
* Get a tenant by its id.
* @param tenantId The id of the tenant.
* @returns The tenant or undefined if not found.
*/
get(tenantId: string): Promise<ITenant | undefined>;
/**
* Get a tenant by its api key.
* @param apiKey The api key of the tenant.
* @returns The tenant or undefined if not found.
*/
getByApiKey(apiKey: string): Promise<ITenant | undefined>;
/**
* Set a tenant.
* @param tenant The tenant to store.
* @returns Nothing.
*/
set(tenant: ITenant): Promise<void>;
/**
* Remove a tenant by its id.
* @param tenantId The id of the tenant.
* @returns Nothing.
*/
remove(tenantId: string): Promise<void>;
/**
* Query tenants with pagination.
* @param cursor The cursor to start from.
* @param limit The maximum number of tenants to return.
* @returns The tenants and the next cursor if more tenants are available.
*/
query(cursor?: string, limit?: number): Promise<{
tenants: ITenant[];
cursor?: string;
}>;
}