@internxt/sdk 1.15.14 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/index.js +180 -262
- package/dist/auth/types.js +2 -22
- package/dist/drive/backups/index.js +34 -32
- package/dist/drive/payments/index.js +96 -149
- package/dist/drive/payments/object-storage.js +34 -36
- package/dist/drive/referrals/index.js +19 -17
- package/dist/drive/share/index.js +168 -235
- package/dist/drive/storage/index.js +213 -302
- package/dist/drive/trash/index.js +40 -84
- package/dist/drive/users/index.js +95 -140
- package/dist/mail/index.d.ts +124 -2
- package/dist/mail/index.js +170 -16
- package/dist/mail/types.d.ts +50 -0
- package/dist/mail/types.js +6 -0
- package/dist/meet/index.js +31 -99
- package/dist/misc/location/index.js +10 -50
- package/dist/network/download.js +38 -107
- package/dist/network/errors/codes.js +8 -24
- package/dist/network/errors/context.js +9 -26
- package/dist/network/errors/download.js +6 -24
- package/dist/network/errors/upload.js +21 -48
- package/dist/network/index.js +120 -277
- package/dist/network/types.js +3 -4
- package/dist/network/upload.js +63 -133
- package/dist/payments/checkout.js +57 -69
- package/dist/send/send.js +17 -27
- package/dist/shared/headers/index.js +56 -42
- package/dist/shared/http/client.js +95 -207
- package/dist/shared/http/retryWithBackoff.js +36 -110
- package/dist/shared/types/errors.js +37 -51
- package/dist/workspaces/index.js +224 -264
- package/package.json +14 -15
- package/dist/mail/api.d.ts +0 -126
- package/dist/mail/api.js +0 -288
- package/dist/mail/crypto.d.ts +0 -66
- package/dist/mail/crypto.js +0 -156
- package/dist/mail/mail.d.ts +0 -162
- package/dist/mail/mail.js +0 -382
package/dist/mail/index.d.ts
CHANGED
|
@@ -1,2 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ApiSecurity, ApiUrl, AppDetails } from '../shared';
|
|
2
|
+
import { MailboxResponse, EmailListResponse, EmailResponse, EmailCreatedResponse, SendEmailRequest, DraftEmailRequest, UpdateEmailRequest, ListEmailsQuery, EmailDomainsResponse, SetupMailAccountPayload, SearchFiltersQuery, MailAccountKeysResponse, EncryptedKeystore, KeystoreType, RecipientWithPublicKey, HybridEncryptedEmail, EmailPublicParameters, PwdProtectedEmail } from './types';
|
|
3
|
+
export declare class MailApi {
|
|
4
|
+
private readonly client;
|
|
5
|
+
private readonly appDetails;
|
|
6
|
+
private readonly apiSecurity;
|
|
7
|
+
static client(apiUrl: ApiUrl, appDetails: AppDetails, apiSecurity: ApiSecurity): MailApi;
|
|
8
|
+
private constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Uploads encrypted keystore to the server
|
|
11
|
+
*
|
|
12
|
+
* @param keystore - The encrypted keystore
|
|
13
|
+
* @returns Server response
|
|
14
|
+
*/
|
|
15
|
+
uploadKeystore(keystore: EncryptedKeystore): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Requests encrypted keystore from the server
|
|
18
|
+
*
|
|
19
|
+
* @param userEmail - The email of the user
|
|
20
|
+
* @param keystoreType - The type of the keystore
|
|
21
|
+
* @returns The encrypted keystore
|
|
22
|
+
*/
|
|
23
|
+
downloadKeystore(userEmail: string, keystoreType: KeystoreType): Promise<EncryptedKeystore>;
|
|
24
|
+
/**
|
|
25
|
+
* Requests users with corresponding public keys from the server
|
|
26
|
+
*
|
|
27
|
+
* @param emails - The emails of the users
|
|
28
|
+
* @returns Users with corresponding public keys
|
|
29
|
+
*/
|
|
30
|
+
getUsersWithPublicKeys(emails: string[]): Promise<RecipientWithPublicKey[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Sends the encrypted emails to the server
|
|
33
|
+
*
|
|
34
|
+
* @param emails - The encrypted emails
|
|
35
|
+
* @param params - The public parameters of the email
|
|
36
|
+
* @returns Server response
|
|
37
|
+
*/
|
|
38
|
+
sendE2EEmails(emails: HybridEncryptedEmail[], params: EmailPublicParameters): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Sends the password-protected email to the server
|
|
41
|
+
*
|
|
42
|
+
* @param email - The password-protected email
|
|
43
|
+
* @param params - The public parameters of the email
|
|
44
|
+
* @returns Server response
|
|
45
|
+
*/
|
|
46
|
+
sendE2EPasswordProtectedEmail(email: PwdProtectedEmail, params: EmailPublicParameters): Promise<void>;
|
|
47
|
+
search(filters: SearchFiltersQuery): Promise<EmailListResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the mailboxes of the user
|
|
50
|
+
*
|
|
51
|
+
* @returns The mailboxes of the user - `MailboxResponse[]`
|
|
52
|
+
*/
|
|
53
|
+
getMailboxes(): Promise<MailboxResponse[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Lists emails of the user
|
|
56
|
+
*
|
|
57
|
+
* @param query - The query to filter emails (e.g. mailbox, limit, etc.)
|
|
58
|
+
* @returns The list of emails - `EmailListResponse`
|
|
59
|
+
*/
|
|
60
|
+
listEmails(query?: ListEmailsQuery): Promise<EmailListResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Gets the email with the corresponding id
|
|
63
|
+
*
|
|
64
|
+
* @param id - The id of the email
|
|
65
|
+
* @returns The email with the corresponding id - `EmailResponse`
|
|
66
|
+
*/
|
|
67
|
+
getEmail(id: string): Promise<EmailResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Deletes the email with the corresponding id
|
|
70
|
+
*
|
|
71
|
+
* @param id - The id of the email to delete
|
|
72
|
+
* @returns A promise that resolves when the email is deleted
|
|
73
|
+
*/
|
|
74
|
+
deleteEmail(id: string): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Updates the email with the corresponding id
|
|
77
|
+
*
|
|
78
|
+
* @param id - The id of the email to update
|
|
79
|
+
* @param body - The new body of the email
|
|
80
|
+
* @returns A promise that resolves when the email is updated
|
|
81
|
+
*/
|
|
82
|
+
updateEmail(id: string, body: UpdateEmailRequest): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Sends an email to the specified recipients
|
|
85
|
+
*
|
|
86
|
+
* @param body - The body of the email to send
|
|
87
|
+
* @returns The created email
|
|
88
|
+
*/
|
|
89
|
+
sendEmail(body: SendEmailRequest): Promise<EmailCreatedResponse>;
|
|
90
|
+
/**
|
|
91
|
+
* Saves a draft email
|
|
92
|
+
*
|
|
93
|
+
* @param body - The body of the draft email to save
|
|
94
|
+
* @returns The created email - `EmailCreatedResponse`
|
|
95
|
+
*/
|
|
96
|
+
saveDraft(body: DraftEmailRequest): Promise<EmailCreatedResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* Returns the list of active domains for the email gateway
|
|
99
|
+
*
|
|
100
|
+
* @returns The list of active domains - `ActiveDomainsResponse`
|
|
101
|
+
*/
|
|
102
|
+
getActiveDomains(): Promise<EmailDomainsResponse>;
|
|
103
|
+
/**
|
|
104
|
+
* Sets up a mail account for the user
|
|
105
|
+
*
|
|
106
|
+
* @param payload - Set of details for mail account setup
|
|
107
|
+
* @returns A promise that resolves with the created mail account address
|
|
108
|
+
*/
|
|
109
|
+
setupMailAccount(payload: SetupMailAccountPayload): Promise<{
|
|
110
|
+
address: string;
|
|
111
|
+
}>;
|
|
112
|
+
/**
|
|
113
|
+
* Gets the mail account keys for the given address
|
|
114
|
+
*
|
|
115
|
+
* @param address - The mail address whose keys should be retrieved
|
|
116
|
+
* @returns The public, encrypted private and recovery keys plus the salt
|
|
117
|
+
*/
|
|
118
|
+
getMailAccountKeys(address: string): Promise<MailAccountKeysResponse>;
|
|
119
|
+
/**
|
|
120
|
+
* Returns the needed headers for the module requests
|
|
121
|
+
* @private
|
|
122
|
+
*/
|
|
123
|
+
private headers;
|
|
124
|
+
}
|
package/dist/mail/index.js
CHANGED
|
@@ -1,18 +1,172 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
exports.MailApi = void 0;
|
|
4
|
+
const headers_1 = require("../shared/headers");
|
|
5
|
+
const client_1 = require("../shared/http/client");
|
|
6
|
+
class MailApi {
|
|
7
|
+
client;
|
|
8
|
+
appDetails;
|
|
9
|
+
apiSecurity;
|
|
10
|
+
static client(apiUrl, appDetails, apiSecurity) {
|
|
11
|
+
return new MailApi(apiUrl, appDetails, apiSecurity);
|
|
12
|
+
}
|
|
13
|
+
constructor(apiUrl, appDetails, apiSecurity) {
|
|
14
|
+
this.client = client_1.HttpClient.create(apiUrl, apiSecurity.unauthorizedCallback);
|
|
15
|
+
this.appDetails = appDetails;
|
|
16
|
+
this.apiSecurity = apiSecurity;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Uploads encrypted keystore to the server
|
|
20
|
+
*
|
|
21
|
+
* @param keystore - The encrypted keystore
|
|
22
|
+
* @returns Server response
|
|
23
|
+
*/
|
|
24
|
+
uploadKeystore(keystore) {
|
|
25
|
+
return this.client.post('/keystore', { encryptedKeystore: keystore }, this.headers());
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Requests encrypted keystore from the server
|
|
29
|
+
*
|
|
30
|
+
* @param userEmail - The email of the user
|
|
31
|
+
* @param keystoreType - The type of the keystore
|
|
32
|
+
* @returns The encrypted keystore
|
|
33
|
+
*/
|
|
34
|
+
downloadKeystore(userEmail, keystoreType) {
|
|
35
|
+
return this.client.getWithParams('/user/keystore', { userEmail, keystoreType }, this.headers());
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Requests users with corresponding public keys from the server
|
|
39
|
+
*
|
|
40
|
+
* @param emails - The emails of the users
|
|
41
|
+
* @returns Users with corresponding public keys
|
|
42
|
+
*/
|
|
43
|
+
getUsersWithPublicKeys(emails) {
|
|
44
|
+
return this.client.post('/users/public-keys', { emails }, this.headers());
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Sends the encrypted emails to the server
|
|
48
|
+
*
|
|
49
|
+
* @param emails - The encrypted emails
|
|
50
|
+
* @param params - The public parameters of the email
|
|
51
|
+
* @returns Server response
|
|
52
|
+
*/
|
|
53
|
+
sendE2EEmails(emails, params) {
|
|
54
|
+
return this.client.post('/emails', { emails, params }, this.headers());
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Sends the password-protected email to the server
|
|
58
|
+
*
|
|
59
|
+
* @param email - The password-protected email
|
|
60
|
+
* @param params - The public parameters of the email
|
|
61
|
+
* @returns Server response
|
|
62
|
+
*/
|
|
63
|
+
sendE2EPasswordProtectedEmail(email, params) {
|
|
64
|
+
return this.client.post('/emails', { email, params }, this.headers());
|
|
65
|
+
}
|
|
66
|
+
search(filters) {
|
|
67
|
+
return this.client.post('/email/search', filters, this.headers());
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Gets the mailboxes of the user
|
|
71
|
+
*
|
|
72
|
+
* @returns The mailboxes of the user - `MailboxResponse[]`
|
|
73
|
+
*/
|
|
74
|
+
getMailboxes() {
|
|
75
|
+
return this.client.get('/email/mailboxes', this.headers());
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Lists emails of the user
|
|
79
|
+
*
|
|
80
|
+
* @param query - The query to filter emails (e.g. mailbox, limit, etc.)
|
|
81
|
+
* @returns The list of emails - `EmailListResponse`
|
|
82
|
+
*/
|
|
83
|
+
listEmails(query) {
|
|
84
|
+
return this.client.getWithParams('/email', query ?? {}, this.headers());
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Gets the email with the corresponding id
|
|
88
|
+
*
|
|
89
|
+
* @param id - The id of the email
|
|
90
|
+
* @returns The email with the corresponding id - `EmailResponse`
|
|
91
|
+
*/
|
|
92
|
+
getEmail(id) {
|
|
93
|
+
return this.client.get(`/email/${id}`, this.headers());
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Deletes the email with the corresponding id
|
|
97
|
+
*
|
|
98
|
+
* @param id - The id of the email to delete
|
|
99
|
+
* @returns A promise that resolves when the email is deleted
|
|
100
|
+
*/
|
|
101
|
+
deleteEmail(id) {
|
|
102
|
+
return this.client.delete(`/email/${id}`, this.headers());
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Updates the email with the corresponding id
|
|
106
|
+
*
|
|
107
|
+
* @param id - The id of the email to update
|
|
108
|
+
* @param body - The new body of the email
|
|
109
|
+
* @returns A promise that resolves when the email is updated
|
|
110
|
+
*/
|
|
111
|
+
updateEmail(id, body) {
|
|
112
|
+
return this.client.patch(`/email/${id}`, body, this.headers());
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Sends an email to the specified recipients
|
|
116
|
+
*
|
|
117
|
+
* @param body - The body of the email to send
|
|
118
|
+
* @returns The created email
|
|
119
|
+
*/
|
|
120
|
+
sendEmail(body) {
|
|
121
|
+
return this.client.post('/email/send', body, this.headers());
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Saves a draft email
|
|
125
|
+
*
|
|
126
|
+
* @param body - The body of the draft email to save
|
|
127
|
+
* @returns The created email - `EmailCreatedResponse`
|
|
128
|
+
*/
|
|
129
|
+
saveDraft(body) {
|
|
130
|
+
return this.client.post('/email/drafts', body, this.headers());
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Returns the list of active domains for the email gateway
|
|
134
|
+
*
|
|
135
|
+
* @returns The list of active domains - `ActiveDomainsResponse`
|
|
136
|
+
*/
|
|
137
|
+
getActiveDomains() {
|
|
138
|
+
return this.client.get('/email/domains', this.headers());
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Sets up a mail account for the user
|
|
142
|
+
*
|
|
143
|
+
* @param payload - Set of details for mail account setup
|
|
144
|
+
* @returns A promise that resolves with the created mail account address
|
|
145
|
+
*/
|
|
146
|
+
setupMailAccount(payload) {
|
|
147
|
+
return this.client.post('/users/me/mail-account', payload, this.headers());
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Gets the mail account keys for the given address
|
|
151
|
+
*
|
|
152
|
+
* @param address - The mail address whose keys should be retrieved
|
|
153
|
+
* @returns The public, encrypted private and recovery keys plus the salt
|
|
154
|
+
*/
|
|
155
|
+
getMailAccountKeys(address) {
|
|
156
|
+
return this.client.getWithParams('/users/me/mail-account/keys', { address }, this.headers());
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Returns the needed headers for the module requests
|
|
160
|
+
* @private
|
|
161
|
+
*/
|
|
162
|
+
headers() {
|
|
163
|
+
return (0, headers_1.headersWithToken)({
|
|
164
|
+
clientName: this.appDetails.clientName,
|
|
165
|
+
clientVersion: this.appDetails.clientVersion,
|
|
166
|
+
token: this.apiSecurity.token,
|
|
167
|
+
desktopToken: this.appDetails.desktopHeader,
|
|
168
|
+
customHeaders: this.appDetails.customHeaders,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
exports.MailApi = MailApi;
|
package/dist/mail/types.d.ts
CHANGED
|
@@ -28,3 +28,53 @@ export type MailAccountKeysResponse = {
|
|
|
28
28
|
encryptionPrivateKey: string;
|
|
29
29
|
recoveryPrivateKey: string;
|
|
30
30
|
};
|
|
31
|
+
export type EncryptedKeystore = {
|
|
32
|
+
userEmail: string;
|
|
33
|
+
type: KeystoreType;
|
|
34
|
+
publicKey: string;
|
|
35
|
+
privateKeyEncrypted: string;
|
|
36
|
+
};
|
|
37
|
+
export declare enum KeystoreType {
|
|
38
|
+
ENCRYPTION = "Encryption",
|
|
39
|
+
RECOVERY = "Recovery"
|
|
40
|
+
}
|
|
41
|
+
export type HybridEncryptedEmail = {
|
|
42
|
+
encryptedKey: HybridEncKey;
|
|
43
|
+
encEmailBody: EmailBodyEncrypted;
|
|
44
|
+
};
|
|
45
|
+
type HybridEncKey = {
|
|
46
|
+
hybridCiphertext: string;
|
|
47
|
+
encryptedKey: string;
|
|
48
|
+
encryptedForEmail: string;
|
|
49
|
+
};
|
|
50
|
+
type EmailBodyEncrypted = {
|
|
51
|
+
encText: string;
|
|
52
|
+
encSubject: string;
|
|
53
|
+
encAttachments?: string[];
|
|
54
|
+
};
|
|
55
|
+
export type PwdProtectedEmail = {
|
|
56
|
+
encryptedKey: PwdProtectedKey;
|
|
57
|
+
encEmailBody: EmailBodyEncrypted;
|
|
58
|
+
};
|
|
59
|
+
type PwdProtectedKey = {
|
|
60
|
+
encryptedKey: string;
|
|
61
|
+
salt: string;
|
|
62
|
+
};
|
|
63
|
+
export type RecipientWithPublicKey = {
|
|
64
|
+
email: string;
|
|
65
|
+
publicKey: string;
|
|
66
|
+
};
|
|
67
|
+
export type EmailPublicParameters = {
|
|
68
|
+
createdAt: string;
|
|
69
|
+
sender: User;
|
|
70
|
+
recipients: User[];
|
|
71
|
+
ccs?: User[];
|
|
72
|
+
bccs?: User[];
|
|
73
|
+
replyToEmailID?: string;
|
|
74
|
+
labels?: string[];
|
|
75
|
+
};
|
|
76
|
+
type User = {
|
|
77
|
+
email: string;
|
|
78
|
+
name: string;
|
|
79
|
+
};
|
|
80
|
+
export {};
|
package/dist/mail/types.js
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KeystoreType = void 0;
|
|
4
|
+
var KeystoreType;
|
|
5
|
+
(function (KeystoreType) {
|
|
6
|
+
KeystoreType["ENCRYPTION"] = "Encryption";
|
|
7
|
+
KeystoreType["RECOVERY"] = "Recovery";
|
|
8
|
+
})(KeystoreType || (exports.KeystoreType = KeystoreType = {}));
|
package/dist/meet/index.js
CHANGED
|
@@ -1,104 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.Meet = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
4
|
+
const headers_1 = require("../shared/headers");
|
|
5
|
+
const client_1 = require("../shared/http/client");
|
|
6
|
+
class Meet {
|
|
7
|
+
client;
|
|
8
|
+
appDetails;
|
|
9
|
+
apiSecurity;
|
|
10
|
+
constructor(apiUrl, appDetails, apiSecurity) {
|
|
11
|
+
this.client = client_1.HttpClient.create(apiUrl, apiSecurity?.unauthorizedCallback, apiSecurity?.retryOptions);
|
|
56
12
|
this.appDetails = appDetails;
|
|
57
13
|
this.apiSecurity = apiSecurity;
|
|
58
14
|
}
|
|
59
|
-
|
|
15
|
+
static client(apiUrl, appDetails, apiSecurity) {
|
|
60
16
|
return new Meet(apiUrl, appDetails, apiSecurity);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Meet.prototype.leaveCall = function (callId, payload) {
|
|
80
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
-
var headers;
|
|
82
|
-
var _a;
|
|
83
|
-
return __generator(this, function (_b) {
|
|
84
|
-
headers = ((_a = this.apiSecurity) === null || _a === void 0 ? void 0 : _a.token) ? this.headersWithToken() : this.basicHeaders();
|
|
85
|
-
return [2 /*return*/, this.client.postWithKeepAlive("call/".concat(callId, "/users/leave"), payload ? __assign({}, payload) : {}, headers)];
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
Meet.prototype.getCurrentUsersInCall = function (callId) {
|
|
90
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
-
var headers;
|
|
92
|
-
var _a;
|
|
93
|
-
return __generator(this, function (_b) {
|
|
94
|
-
headers = ((_a = this.apiSecurity) === null || _a === void 0 ? void 0 : _a.token) ? this.headersWithToken() : this.basicHeaders();
|
|
95
|
-
return [2 /*return*/, this.client.get("call/".concat(callId, "/users"), headers)];
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
Meet.prototype.headersWithToken = function () {
|
|
100
|
-
var _a;
|
|
101
|
-
if (!((_a = this.apiSecurity) === null || _a === void 0 ? void 0 : _a.token)) {
|
|
17
|
+
}
|
|
18
|
+
async createCall() {
|
|
19
|
+
return this.client.post('call', {}, this.headersWithToken());
|
|
20
|
+
}
|
|
21
|
+
async joinCall(callId, payload) {
|
|
22
|
+
const headers = this.apiSecurity?.token ? this.headersWithToken() : this.basicHeaders();
|
|
23
|
+
return this.client.post(`call/${callId}/users/join`, { ...payload }, headers);
|
|
24
|
+
}
|
|
25
|
+
async leaveCall(callId, payload) {
|
|
26
|
+
const headers = this.apiSecurity?.token ? this.headersWithToken() : this.basicHeaders();
|
|
27
|
+
return this.client.postWithKeepAlive(`call/${callId}/users/leave`, payload ? { ...payload } : {}, headers);
|
|
28
|
+
}
|
|
29
|
+
async getCurrentUsersInCall(callId) {
|
|
30
|
+
const headers = this.apiSecurity?.token ? this.headersWithToken() : this.basicHeaders();
|
|
31
|
+
return this.client.get(`call/${callId}/users`, headers);
|
|
32
|
+
}
|
|
33
|
+
headersWithToken() {
|
|
34
|
+
if (!this.apiSecurity?.token) {
|
|
102
35
|
throw new Error('Token is required for Meet operations');
|
|
103
36
|
}
|
|
104
37
|
return (0, headers_1.headersWithToken)({
|
|
@@ -109,15 +42,14 @@ var Meet = /** @class */ (function () {
|
|
|
109
42
|
desktopToken: this.appDetails.desktopHeader,
|
|
110
43
|
customHeaders: this.appDetails.customHeaders,
|
|
111
44
|
});
|
|
112
|
-
}
|
|
113
|
-
|
|
45
|
+
}
|
|
46
|
+
basicHeaders() {
|
|
114
47
|
return (0, headers_1.basicHeaders)({
|
|
115
48
|
clientName: this.appDetails.clientName,
|
|
116
49
|
clientVersion: this.appDetails.clientVersion,
|
|
117
50
|
desktopToken: this.appDetails.desktopHeader,
|
|
118
51
|
customHeaders: this.appDetails.customHeaders,
|
|
119
52
|
});
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
}());
|
|
53
|
+
}
|
|
54
|
+
}
|
|
123
55
|
exports.Meet = Meet;
|
|
@@ -1,57 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
3
|
exports.Location = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
4
|
+
const client_1 = require("../../shared/http/client");
|
|
5
|
+
class Location {
|
|
6
|
+
client;
|
|
7
|
+
constructor(apiUrl) {
|
|
43
8
|
this.client = client_1.HttpClient.create(apiUrl);
|
|
44
9
|
}
|
|
45
|
-
|
|
10
|
+
static client(apiUrl) {
|
|
46
11
|
return new Location(apiUrl);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
return Location;
|
|
56
|
-
}());
|
|
12
|
+
}
|
|
13
|
+
async getUserLocation() {
|
|
14
|
+
return this.client.get('/', {});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
57
17
|
exports.Location = Location;
|