UNPKG

@gnosticdev/highlevel-sdk

Version:
621 lines (618 loc) 17.9 kB
declare const ScopesSchema: { 'blogs/author': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'blogs/category': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'blogs/check-slug': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'blogs/list': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'blogs/post': { write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'blogs/post-update': { write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'blogs/posts': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; businesses: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; calendars: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'calendars/events': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'calendars/groups': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'calendars/resources': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; campaigns: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; contacts: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; conversations: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'conversations/livechat': { write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'conversations/message': { readonly: ({ accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; } | { accessType: readonly [""]; methodAndEndpoint: string; webhookEvents: string; })[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; courses: { write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'emails/builder': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'emails/schedule': { readonly: { accessType: readonly ["Sub-Account", "Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; forms: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'funnels/funnel': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'funnels/page': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'funnels/pagecount': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'funnels/redirect': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; invoices: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'invoices/schedule': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'invoices/template': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; links: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; locations: { readonly: ({ accessType: readonly ["Sub-Account", "Agency"]; methodAndEndpoint: string; webhookEvents: string; } | { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; })[]; write: { accessType: readonly ["Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'locations/customFields': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'locations/customValues': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'locations/tags': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'locations/tasks': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'locations/templates': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; medias: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; oauth: { readonly: { accessType: readonly ["Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'objects/record': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'objects/schema': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; opportunities: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'payments/integration': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'payments/orders': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'payments/subscriptions': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'payments/transactions': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; products: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'products/prices': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'saas/company': { write: { accessType: readonly ["Sub-Account", "Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'saas/location': { readonly: { accessType: readonly ["Sub-Account", "Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: ({ accessType: readonly ["Agency"]; methodAndEndpoint: string; webhookEvents: string; } | { accessType: readonly ["Sub-Account", "Agency"]; methodAndEndpoint: string; webhookEvents: string; })[]; }; snapshots: { readonly: { accessType: readonly ["Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'socialplanner/account': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'socialplanner/category': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'socialplanner/csv': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'socialplanner/oauth': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'socialplanner/post': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; 'socialplanner/tag': { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; surveys: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; users: { readonly: { accessType: readonly ["Sub-Account", "Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; write: { accessType: readonly ["Sub-Account", "Agency"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; workflows: { readonly: { accessType: readonly ["Sub-Account"]; methodAndEndpoint: string; webhookEvents: string; }[]; }; }; type AccessType = 'Sub-Account' | 'Agency'; type Scopes = typeof ScopesSchema; /** * An endpoint with permission levels for a given access type. */ type Endpoint<TAccessType extends AccessType> = { methodAndEndpoint: string; webhookEvents: string; accessType: readonly TAccessType[]; }; /** * A permission level for a scope name. Pass in a scope name to get the available permissions. * @example * ```ts * type T = Permission<'businesses'> * ``` */ type Permission<TScopes extends keyof Scopes> = keyof Scopes[TScopes] & string; /** * A scope with permission level for a given access type. * @example `businesses.readonly`, `locations.write` */ type ScopeLiterals<TAccessType extends AccessType> = { [K in FilteredScopeNames<TAccessType>]: `${K}.${Permission<K>}`; }[FilteredScopeNames<TAccessType>]; type HighLevelScopes<T extends AccessType> = ScopeLiterals<T> | ScopeLiterals<T>[] | (string & {}); /** * The access type available for a given scope name and permission level. */ type ScopeAccess<TScopes extends keyof Scopes, TPermission extends Permission<TScopes>> = TPermission extends keyof Scopes[TScopes] ? Scopes[TScopes][TPermission] extends Endpoint<infer TAccess>[] ? TAccess : never : never; /** * A scope name for a given access type. * @example `businesses`, `locations` */ type FilteredScopeNames<T extends AccessType> = { [K in keyof Scopes]: ScopeAccess<K, Permission<K>> extends infer TAccess ? TAccess extends T ? K : TAccess extends readonly T[] ? K : never : never; }[keyof Scopes]; export type { AccessType as A, HighLevelScopes as H, ScopeLiterals as S };