1 | import { EventEmitter } from './event';
|
2 | export default class Bearer {
|
3 | readonly clientId: string | undefined;
|
4 | static readonly authorizedListener: EventEmitter;
|
5 | secured?: boolean;
|
6 | config: TBearerOptions;
|
7 | private registeredIntegrations;
|
8 | private observer?;
|
9 | private debounceRefresh;
|
10 | constructor(clientId: string | undefined, options?: Partial<TBearerOptions>);
|
11 | /**
|
12 | * `connect` lets you easily retrieve `auth-id` for an integration using OAuth authentication. Before using it, you'll need to generate a `setup-id` with the setup component of your integration
|
13 | * @argument {string} integration the identifier of the Integration you want to connect to ex: 12345-attach-github-pull-request
|
14 | * @argument {string} setupId Setup's identifier you received earlier, a Bearer reference containing all required information about auth mechanism
|
15 | * @argument {Object} options Optional parameters like authId if you already have one
|
16 | */
|
17 | connect: (integration: string, setupId?: string | undefined, { authId }?: {
|
18 | authId?: string | undefined;
|
19 | }) => Promise<{
|
20 | integration: string;
|
21 | authId: string;
|
22 | }>;
|
23 | private _jsonRequest;
|
24 | invoke: <DataPayload = any>(integrationId: string, functionName: string, { query, ...params }?: {
|
25 | [key: string]: any;
|
26 | query?: Record<string, string> | undefined;
|
27 | }) => Promise<TFetchBearerData<DataPayload>>;
|
28 | |
29 |
|
30 |
|
31 | loadMissingIntegrations: () => void;
|
32 | |
33 |
|
34 |
|
35 | registeredIntegration: (tagName: string) => boolean;
|
36 | |
37 |
|
38 |
|
39 | private initialIntegrationLoading;
|
40 | |
41 |
|
42 |
|
43 | private registerDomObserver;
|
44 | private observerCallback;
|
45 | |
46 |
|
47 |
|
48 | private disconnectObserver;
|
49 | |
50 |
|
51 |
|
52 | private sendTags;
|
53 | }
|
54 | export declare type TBearerOptions = {
|
55 | secured?: boolean;
|
56 | domObserver: boolean;
|
57 | integrationHost: string;
|
58 | refreshDebounceDelay: number;
|
59 | };
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 | export declare function findElements(elements: HTMLCollection | NodeListOf<Element>, filter?: RegExp): string[];
|
66 | export declare type TFetchBearerData<T = any> = {
|
67 | data: T;
|
68 | referenceId?: string;
|
69 | };
|