UNPKG

@gnosticdev/highlevel-sdk

Version:
40 lines (39 loc) 1.56 kB
import { i as SubAccountScopes, n as AgencyScopes, r as Scopes, t as AccessType } from "./scope-types-pFzsUio-.js"; //#region src/v2/scopes/scopes-builder.d.ts /** * Helper for building app scopes based on the access type. */ declare class ScopesBuilder<T extends AccessType> { /** a Set containing the scopes that have been added so far */ collection: Set<Scopes<T>>; /** All valid scopes for this access type */ private readonly validScopes; /** * @constructor * @param accessType - the type of app access needed. 'Sub-Account' is same as 'Location' and 'Agency' is same as Agency */ constructor(accessType: T); /** add a scope or an array of scopes from the available scopes for this access type */ add(scopes: Scopes<T>[]): this; /** * Get **ALL** available scopes for the given access type * * @returns an array of all scopes available to the given accessType */ getAllValid(): readonly Scopes<T>[]; /** * Returns a string of all scopes added to the builder so far. * * For use in the authorization redirect uri * @returns a string of the scopes joined by a space * @example * ```ts * client.scopes.add(['calendars.write', 'workflows.readonly']) * client.scopes.get() // "businesses.read calendars.write workflows.readonly" * ``` */ asString(): string; } declare function createScopes<T extends AccessType>(accessType: T, scopes: Scopes<T>[]): string; //#endregion export { type AccessType, type AgencyScopes, type Scopes, ScopesBuilder, type SubAccountScopes, createScopes };