UNPKG

@gnosticdev/highlevel-sdk

Version:
47 lines (44 loc) 1.65 kB
import { A as AccessType, S as ScopeLiterals, H as HighLevelScopes } from './type-utils-BG2wp-D1.cjs'; /** * Helper for building app scopes based on the access type. */ declare class ScopesBuilder<T extends AccessType> { #private; /** a Set containing the scopes that have been added so far */ protected collection: Set<ScopeLiterals<T> | (string & {})>; /** * @constructor * @param accessType - the type of app access needed. 'Sub-Account' is same as 'Location' and 'Agency' is same as Agency */ constructor(config: { accessType: T; }); /** add a scope or an array of scopes from the available scopes for this access type */ add(scopes: HighLevelScopes<T>): this; /** * Get **ALL** available scopes for the given access type * * @returns an array of all scopes available to the given accessType */ all(): ScopeLiterals<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('businesses.read') * client.scopes.add(['calendars.write', 'workflows.readonly']) * client.scopes.get() // "businesses.read calendars.write workflows.readonly" * ``` */ get(): string; /** * Check if the builder has a scope or an array of scopes * @param scopes - a single scope or an array of scopes * @returns true if the builder has the scope or scopes, false otherwise */ has(scopes: HighLevelScopes<T>): boolean; } export { ScopesBuilder };