@dugjason/front-node 0.1.0-alpha.1
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/LICENSE.md +21 -0
- package/README.md +323 -0
- package/dist/client.d.ts +48 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +218 -0
- package/dist/client.js.map +1 -0
- package/dist/front.d.ts +29 -0
- package/dist/front.d.ts.map +1 -0
- package/dist/front.js +44 -0
- package/dist/front.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/oauth.d.ts +28 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +82 -0
- package/dist/oauth.js.map +1 -0
- package/dist/resources/accounts.d.ts +39 -0
- package/dist/resources/accounts.d.ts.map +1 -0
- package/dist/resources/accounts.js +57 -0
- package/dist/resources/accounts.js.map +1 -0
- package/dist/resources/conversations.d.ts +41 -0
- package/dist/resources/conversations.d.ts.map +1 -0
- package/dist/resources/conversations.js +55 -0
- package/dist/resources/conversations.js.map +1 -0
- package/dist/resources/teammates.d.ts +29 -0
- package/dist/resources/teammates.d.ts.map +1 -0
- package/dist/resources/teammates.js +37 -0
- package/dist/resources/teammates.js.map +1 -0
- package/dist/types.d.ts +147 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
package/dist/front.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FrontClient } from "./client";
|
|
2
|
+
import { Accounts } from "./resources/accounts";
|
|
3
|
+
import { Conversations } from "./resources/conversations";
|
|
4
|
+
import { Teammates } from "./resources/teammates";
|
|
5
|
+
export class Front {
|
|
6
|
+
client;
|
|
7
|
+
teammates;
|
|
8
|
+
conversations;
|
|
9
|
+
accounts;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.client = new FrontClient(config);
|
|
12
|
+
// Initialize resource classes
|
|
13
|
+
this.teammates = new Teammates(this.client);
|
|
14
|
+
this.conversations = new Conversations(this.client);
|
|
15
|
+
this.accounts = new Accounts(this.client);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get the underlying HTTP client for advanced usage
|
|
19
|
+
*/
|
|
20
|
+
getClient() {
|
|
21
|
+
return this.client;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Check if the SDK is using OAuth authentication
|
|
25
|
+
*/
|
|
26
|
+
isUsingOAuth() {
|
|
27
|
+
return this.client.isUsingOAuth();
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the OAuth token manager (if using OAuth)
|
|
31
|
+
*/
|
|
32
|
+
getOAuthManager() {
|
|
33
|
+
return this.client.getOAuthManager();
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Update OAuth configuration (useful for updating tokens)
|
|
37
|
+
*/
|
|
38
|
+
updateOAuthConfig(updates) {
|
|
39
|
+
if (!updates)
|
|
40
|
+
return;
|
|
41
|
+
this.client.updateOAuthConfig(updates);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=front.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front.js","sourceRoot":"","sources":["../src/front.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAGjD,MAAM,OAAO,KAAK;IACR,MAAM,CAAa;IAEX,SAAS,CAAW;IACpB,aAAa,CAAe;IAC5B,QAAQ,CAAU;IAElC,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAA;QAErC,8BAA8B;QAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC3C,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QACnD,IAAI,CAAC,QAAQ,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC3C,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,eAAe;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAA;IACtC,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,OAAsC;QACtD,IAAI,CAAC,OAAO;YAAE,OAAM;QACpB,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAA;IACxC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { FrontClient } from "./client";
|
|
2
|
+
export { Front, Front as default } from "./front";
|
|
3
|
+
export { OAuthTokenManager } from "./oauth";
|
|
4
|
+
export { Accounts } from "./resources/accounts";
|
|
5
|
+
export { Conversations } from "./resources/conversations";
|
|
6
|
+
export { Teammates } from "./resources/teammates";
|
|
7
|
+
export type { Account, AccountContactsParams, Conversation, CreateAccountData, FrontConfig, FrontError, ListResponse, OAuthConfig, OAuthTokens, PaginationParams, RequestOptions, Teammate, UpdateAccountData, UpdateTeammateData, } from "./types";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,YAAY,EACV,OAAO,EACP,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,SAAS,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Main SDK class
|
|
2
|
+
// Client and configuration types
|
|
3
|
+
export { FrontClient } from "./client";
|
|
4
|
+
export { Front, Front as default } from "./front";
|
|
5
|
+
export { OAuthTokenManager } from "./oauth";
|
|
6
|
+
export { Accounts } from "./resources/accounts";
|
|
7
|
+
export { Conversations } from "./resources/conversations";
|
|
8
|
+
// Resource classes
|
|
9
|
+
export { Teammates } from "./resources/teammates";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iBAAiB;AAEjB,iCAAiC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA"}
|
package/dist/oauth.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { OAuthConfig } from "./types";
|
|
2
|
+
export declare class OAuthTokenManager {
|
|
3
|
+
private config;
|
|
4
|
+
private isRefreshing;
|
|
5
|
+
private refreshPromise;
|
|
6
|
+
constructor(config: OAuthConfig);
|
|
7
|
+
/**
|
|
8
|
+
* Get the current access token
|
|
9
|
+
*/
|
|
10
|
+
getAccessToken(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Refresh the access token using the refresh token
|
|
13
|
+
*/
|
|
14
|
+
refreshToken(): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Perform the actual token refresh
|
|
17
|
+
*/
|
|
18
|
+
private performTokenRefresh;
|
|
19
|
+
/**
|
|
20
|
+
* Update the OAuth configuration (useful when tokens are refreshed externally)
|
|
21
|
+
*/
|
|
22
|
+
updateConfig(updates: Partial<OAuthConfig>): void;
|
|
23
|
+
/**
|
|
24
|
+
* Get the current OAuth configuration
|
|
25
|
+
*/
|
|
26
|
+
getConfig(): Readonly<OAuthConfig>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=oauth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAO1C,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,cAAc,CAA6B;gBAEvC,MAAM,EAAE,WAAW;IAI/B;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,MAAM,CAAC;IAoBrC;;OAEG;YACW,mBAAmB;IA2CjC;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAIjD;;OAEG;IACH,SAAS,IAAI,QAAQ,CAAC,WAAW,CAAC;CAGnC"}
|
package/dist/oauth.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export class OAuthTokenManager {
|
|
2
|
+
config;
|
|
3
|
+
isRefreshing = false;
|
|
4
|
+
refreshPromise = null;
|
|
5
|
+
constructor(config) {
|
|
6
|
+
this.config = { ...config };
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get the current access token
|
|
10
|
+
*/
|
|
11
|
+
getAccessToken() {
|
|
12
|
+
return this.config.accessToken;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Refresh the access token using the refresh token
|
|
16
|
+
*/
|
|
17
|
+
async refreshToken() {
|
|
18
|
+
// If already refreshing, wait for the existing refresh to complete
|
|
19
|
+
if (this.isRefreshing && this.refreshPromise) {
|
|
20
|
+
await this.refreshPromise;
|
|
21
|
+
return this.config.accessToken;
|
|
22
|
+
}
|
|
23
|
+
// Start the refresh process
|
|
24
|
+
this.isRefreshing = true;
|
|
25
|
+
this.refreshPromise = this.performTokenRefresh();
|
|
26
|
+
try {
|
|
27
|
+
await this.refreshPromise;
|
|
28
|
+
return this.config.accessToken;
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
this.isRefreshing = false;
|
|
32
|
+
this.refreshPromise = null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Perform the actual token refresh
|
|
37
|
+
*/
|
|
38
|
+
async performTokenRefresh() {
|
|
39
|
+
const oauthUrl = "https://app.frontapp.com/oauth/token";
|
|
40
|
+
// Create Basic Auth header
|
|
41
|
+
const credentials = btoa(`${this.config.clientId}:${this.config.clientSecret}`);
|
|
42
|
+
const response = await fetch(oauthUrl, {
|
|
43
|
+
method: "POST",
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: `Basic ${credentials}`,
|
|
46
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
47
|
+
},
|
|
48
|
+
body: new URLSearchParams({
|
|
49
|
+
grant_type: "refresh_token",
|
|
50
|
+
refresh_token: this.config.refreshToken,
|
|
51
|
+
}),
|
|
52
|
+
});
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
const errorText = await response.text();
|
|
55
|
+
throw new Error(`Failed to refresh OAuth token: ${response.status} ${errorText}`);
|
|
56
|
+
}
|
|
57
|
+
const apiResponse = (await response.json());
|
|
58
|
+
// Update the stored tokens
|
|
59
|
+
this.config.accessToken = apiResponse.access_token;
|
|
60
|
+
this.config.refreshToken = apiResponse.refresh_token;
|
|
61
|
+
// Call the callback if provided
|
|
62
|
+
if (this.config.onTokenRefresh) {
|
|
63
|
+
await this.config.onTokenRefresh({
|
|
64
|
+
access_token: this.config.accessToken,
|
|
65
|
+
refresh_token: this.config.refreshToken,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Update the OAuth configuration (useful when tokens are refreshed externally)
|
|
71
|
+
*/
|
|
72
|
+
updateConfig(updates) {
|
|
73
|
+
this.config = { ...this.config, ...updates };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Get the current OAuth configuration
|
|
77
|
+
*/
|
|
78
|
+
getConfig() {
|
|
79
|
+
return { ...this.config };
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=oauth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth.js","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAa;IACnB,YAAY,GAAG,KAAK,CAAA;IACpB,cAAc,GAAyB,IAAI,CAAA;IAEnD,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,MAAM,EAAE,CAAA;IAC7B,CAAC;IAED;;O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SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YACvC,MAAM,IAAI,KAAK,CACb,kCAAkC,QAAQ,CAAC,MAAM,IAAI,SAAS,EAAE,CACjE,CAAA;QACH,CAAC;QAED,MAAM,WAAW,GACf,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAuB,CAAA;QAE/C,2BAA2B;QAC3B,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,YAAY,CAAA;QAClD,IAAI,CAAC,MAAM,CAAC,YAAY,GAAG,WAAW,CAAC,aAAa,CAAA;QAEpD,gCAAgC;QAChC,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC;YAC/B,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;gBAC/B,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW;gBACrC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,YAAY;aACxC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,OAA6B;QACxC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,EAAE,CAAA;IAC9C,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAA;IAC3B,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { FrontClient } from "../client";
|
|
2
|
+
import type { Account, AccountContactsParams, CreateAccountData, ListResponse, PaginationParams, UpdateAccountData } from "../types";
|
|
3
|
+
export declare class Accounts {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: FrontClient);
|
|
6
|
+
/**
|
|
7
|
+
* List all accounts
|
|
8
|
+
*/
|
|
9
|
+
list(params?: PaginationParams): Promise<ListResponse<Account>>;
|
|
10
|
+
/**
|
|
11
|
+
* Create a new account
|
|
12
|
+
*/
|
|
13
|
+
create(data: CreateAccountData): Promise<Account>;
|
|
14
|
+
/**
|
|
15
|
+
* Fetch a specific account by ID
|
|
16
|
+
*/
|
|
17
|
+
fetch(accountId: string): Promise<Account>;
|
|
18
|
+
/**
|
|
19
|
+
* Update an account
|
|
20
|
+
*/
|
|
21
|
+
update(accountId: string, data: UpdateAccountData): Promise<Account>;
|
|
22
|
+
/**
|
|
23
|
+
* Delete an account
|
|
24
|
+
*/
|
|
25
|
+
delete(accountId: string): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* List contacts associated with an account
|
|
28
|
+
*/
|
|
29
|
+
getContacts(accountId: string, params?: AccountContactsParams): Promise<unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Add a contact to an account
|
|
32
|
+
*/
|
|
33
|
+
addContact(accountId: string, contactIds: string[]): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Remove a contact from an account
|
|
36
|
+
*/
|
|
37
|
+
removeContact(accountId: string, contactId: string): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/resources/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,KAAK,EACV,OAAO,EACP,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,UAAU,CAAA;AAEjB,qBAAa,QAAQ;IACP,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEvC;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IAIrE;;OAEG;IACG,MAAM,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAIvD;;OAEG;IACG,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIhD;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAI1E;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,qBAAqB;IAInE;;OAEG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxE;;OAEG;IACG,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKzE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export class Accounts {
|
|
2
|
+
client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* List all accounts
|
|
8
|
+
*/
|
|
9
|
+
async list(params) {
|
|
10
|
+
return this.client.get("/accounts", params);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Create a new account
|
|
14
|
+
*/
|
|
15
|
+
async create(data) {
|
|
16
|
+
return this.client.post("/accounts", data);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Fetch a specific account by ID
|
|
20
|
+
*/
|
|
21
|
+
async fetch(accountId) {
|
|
22
|
+
return this.client.get(`/accounts/${accountId}`);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Update an account
|
|
26
|
+
*/
|
|
27
|
+
async update(accountId, data) {
|
|
28
|
+
return this.client.patch(`/accounts/${accountId}`, data);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Delete an account
|
|
32
|
+
*/
|
|
33
|
+
async delete(accountId) {
|
|
34
|
+
return this.client.delete(`/accounts/${accountId}`);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* List contacts associated with an account
|
|
38
|
+
*/
|
|
39
|
+
async getContacts(accountId, params) {
|
|
40
|
+
return this.client.get(`/accounts/${accountId}/contacts`, params);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Add a contact to an account
|
|
44
|
+
*/
|
|
45
|
+
async addContact(accountId, contactIds) {
|
|
46
|
+
return this.client.post(`/accounts/${accountId}/contacts`, {
|
|
47
|
+
contact_ids: contactIds,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Remove a contact from an account
|
|
52
|
+
*/
|
|
53
|
+
async removeContact(accountId, contactId) {
|
|
54
|
+
return this.client.delete(`/accounts/${accountId}/contacts/${contactId}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/resources/accounts.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,QAAQ;IACC;IAApB,YAAoB,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAAyB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAwB,WAAW,EAAE,MAAM,CAAC,CAAA;IACpE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,IAAuB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAU,WAAW,EAAE,IAAI,CAAC,CAAA;IACrD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,SAAiB;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAU,aAAa,SAAS,EAAE,CAAC,CAAA;IAC3D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,IAAuB;QACrD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAU,aAAa,SAAS,EAAE,EAAE,IAAI,CAAC,CAAA;IACnE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,SAAiB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAO,aAAa,SAAS,EAAE,CAAC,CAAA;IAC3D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,MAA8B;QACjE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,SAAS,WAAW,EAAE,MAAM,CAAC,CAAA;IACnE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,SAAiB,EAAE,UAAoB;QACtD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAO,aAAa,SAAS,WAAW,EAAE;YAC/D,WAAW,EAAE,UAAU;SACxB,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB,EAAE,SAAiB;QACtD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CACvB,aAAa,SAAS,aAAa,SAAS,EAAE,CAC/C,CAAA;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { FrontClient } from "../client";
|
|
2
|
+
import type { Conversation, ListResponse, PaginationParams } from "../types";
|
|
3
|
+
export declare class Conversations {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: FrontClient);
|
|
6
|
+
/**
|
|
7
|
+
* List conversations
|
|
8
|
+
*/
|
|
9
|
+
list(params?: PaginationParams & {
|
|
10
|
+
q?: string;
|
|
11
|
+
}): Promise<ListResponse<Conversation>>;
|
|
12
|
+
/**
|
|
13
|
+
* Fetch a specific conversation by ID
|
|
14
|
+
*/
|
|
15
|
+
fetch(conversationId: string): Promise<Conversation>;
|
|
16
|
+
/**
|
|
17
|
+
* Update a conversation
|
|
18
|
+
*/
|
|
19
|
+
update(conversationId: string, data: Partial<Pick<Conversation, "assignee" | "status" | "tags">>): Promise<Conversation>;
|
|
20
|
+
/**
|
|
21
|
+
* Get conversation messages
|
|
22
|
+
*/
|
|
23
|
+
getMessages(conversationId: string, params?: PaginationParams): Promise<unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* Get conversation events
|
|
26
|
+
*/
|
|
27
|
+
getEvents(conversationId: string, params?: PaginationParams): Promise<unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Get conversation comments
|
|
30
|
+
*/
|
|
31
|
+
getComments(conversationId: string, params?: PaginationParams): Promise<unknown>;
|
|
32
|
+
/**
|
|
33
|
+
* Get conversation followers
|
|
34
|
+
*/
|
|
35
|
+
getFollowers(conversationId: string): Promise<unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* Get conversation inboxes
|
|
38
|
+
*/
|
|
39
|
+
getInboxes(conversationId: string): Promise<unknown>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/resources/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE5E,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEvC;;OAEG;IACG,IAAI,CACR,MAAM,CAAC,EAAE,gBAAgB,GAAG;QAAE,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GACzC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAItC;;OAEG;IACG,KAAK,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAI1D;;OAEG;IACG,MAAM,CACV,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAC,GAChE,OAAO,CAAC,YAAY,CAAC;IAOxB;;OAEG;IACG,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB;IAInE;;OAEG;IACG,SAAS,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB;IAIjE;;OAEG;IACG,WAAW,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB;IAInE;;OAEG;IACG,YAAY,CAAC,cAAc,EAAE,MAAM;IAIzC;;OAEG;IACG,UAAU,CAAC,cAAc,EAAE,MAAM;CAGxC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export class Conversations {
|
|
2
|
+
client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* List conversations
|
|
8
|
+
*/
|
|
9
|
+
async list(params) {
|
|
10
|
+
return this.client.get("/conversations", params);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Fetch a specific conversation by ID
|
|
14
|
+
*/
|
|
15
|
+
async fetch(conversationId) {
|
|
16
|
+
return this.client.get(`/conversations/${conversationId}`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Update a conversation
|
|
20
|
+
*/
|
|
21
|
+
async update(conversationId, data) {
|
|
22
|
+
return this.client.patch(`/conversations/${conversationId}`, data);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get conversation messages
|
|
26
|
+
*/
|
|
27
|
+
async getMessages(conversationId, params) {
|
|
28
|
+
return this.client.get(`/conversations/${conversationId}/messages`, params);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get conversation events
|
|
32
|
+
*/
|
|
33
|
+
async getEvents(conversationId, params) {
|
|
34
|
+
return this.client.get(`/conversations/${conversationId}/events`, params);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get conversation comments
|
|
38
|
+
*/
|
|
39
|
+
async getComments(conversationId, params) {
|
|
40
|
+
return this.client.get(`/conversations/${conversationId}/comments`, params);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get conversation followers
|
|
44
|
+
*/
|
|
45
|
+
async getFollowers(conversationId) {
|
|
46
|
+
return this.client.get(`/conversations/${conversationId}/followers`);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get conversation inboxes
|
|
50
|
+
*/
|
|
51
|
+
async getInboxes(conversationId) {
|
|
52
|
+
return this.client.get(`/conversations/${conversationId}/inboxes`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/resources/conversations.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAa;IACJ;IAApB,YAAoB,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,IAAI,CACR,MAA0C;QAE1C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAA6B,gBAAgB,EAAE,MAAM,CAAC,CAAA;IAC9E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,cAAsB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,kBAAkB,cAAc,EAAE,CAAC,CAAA;IAC1E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,cAAsB,EACtB,IAAiE;QAEjE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,kBAAkB,cAAc,EAAE,EAClC,IAAI,CACL,CAAA;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,cAAsB,EAAE,MAAyB;QACjE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,cAAc,WAAW,EAAE,MAAM,CAAC,CAAA;IAC7E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,cAAsB,EAAE,MAAyB;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,cAAc,SAAS,EAAE,MAAM,CAAC,CAAA;IAC3E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,cAAsB,EAAE,MAAyB;QACjE,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,cAAc,WAAW,EAAE,MAAM,CAAC,CAAA;IAC7E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,cAAsB;QACvC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,cAAc,YAAY,CAAC,CAAA;IACtE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,cAAsB;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,cAAc,UAAU,CAAC,CAAA;IACpE,CAAC;CACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FrontClient } from "../client";
|
|
2
|
+
import type { ListResponse, PaginationParams, Teammate, UpdateTeammateData } from "../types";
|
|
3
|
+
export declare class Teammates {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: FrontClient);
|
|
6
|
+
/**
|
|
7
|
+
* List all teammates
|
|
8
|
+
*/
|
|
9
|
+
list(params?: PaginationParams): Promise<ListResponse<Teammate>>;
|
|
10
|
+
/**
|
|
11
|
+
* Fetch a specific teammate by ID
|
|
12
|
+
*/
|
|
13
|
+
fetch(teammateId: string): Promise<Teammate>;
|
|
14
|
+
/**
|
|
15
|
+
* Update a teammate
|
|
16
|
+
*/
|
|
17
|
+
update(teammateId: string, data: UpdateTeammateData): Promise<Teammate>;
|
|
18
|
+
/**
|
|
19
|
+
* Get teammate's inboxes
|
|
20
|
+
*/
|
|
21
|
+
getInboxes(teammateId: string, params?: PaginationParams): Promise<unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Get teammate's conversations
|
|
24
|
+
*/
|
|
25
|
+
getConversations(teammateId: string, params?: PaginationParams & {
|
|
26
|
+
q?: string;
|
|
27
|
+
}): Promise<unknown>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=teammates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teammates.d.ts","sourceRoot":"","sources":["../../src/resources/teammates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,kBAAkB,EACnB,MAAM,UAAU,CAAA;AAEjB,qBAAa,SAAS;IACR,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,WAAW;IAEvC;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAItE;;OAEG;IACG,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIlD;;OAEG;IACG,MAAM,CACV,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,QAAQ,CAAC;IAIpB;;OAEG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,gBAAgB;IAI9D;;OAEG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,gBAAgB,GAAG;QAAE,CAAC,CAAC,EAAE,MAAM,CAAA;KAAE;CAI7C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class Teammates {
|
|
2
|
+
client;
|
|
3
|
+
constructor(client) {
|
|
4
|
+
this.client = client;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* List all teammates
|
|
8
|
+
*/
|
|
9
|
+
async list(params) {
|
|
10
|
+
return this.client.get("/teammates", params);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Fetch a specific teammate by ID
|
|
14
|
+
*/
|
|
15
|
+
async fetch(teammateId) {
|
|
16
|
+
return this.client.get(`/teammates/${teammateId}`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Update a teammate
|
|
20
|
+
*/
|
|
21
|
+
async update(teammateId, data) {
|
|
22
|
+
return this.client.patch(`/teammates/${teammateId}`, data);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get teammate's inboxes
|
|
26
|
+
*/
|
|
27
|
+
async getInboxes(teammateId, params) {
|
|
28
|
+
return this.client.get(`/teammates/${teammateId}/inboxes`, params);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get teammate's conversations
|
|
32
|
+
*/
|
|
33
|
+
async getConversations(teammateId, params) {
|
|
34
|
+
return this.client.get(`/teammates/${teammateId}/conversations`, params);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=teammates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teammates.js","sourceRoot":"","sources":["../../src/resources/teammates.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,SAAS;IACA;IAApB,YAAoB,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IAE3C;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAAyB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAyB,YAAY,EAAE,MAAM,CAAC,CAAA;IACtE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,UAAkB;QAC5B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAW,cAAc,UAAU,EAAE,CAAC,CAAA;IAC9D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,UAAkB,EAClB,IAAwB;QAExB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAW,cAAc,UAAU,EAAE,EAAE,IAAI,CAAC,CAAA;IACtE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,UAAkB,EAAE,MAAyB;QAC5D,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,UAAU,UAAU,EAAE,MAAM,CAAC,CAAA;IACpE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CACpB,UAAkB,EAClB,MAA0C;QAE1C,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,cAAc,UAAU,gBAAgB,EAAE,MAAM,CAAC,CAAA;IAC1E,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export type FrontConfig = {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
oauth?: never;
|
|
5
|
+
} | {
|
|
6
|
+
apiKey?: never;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
oauth: OAuthConfig;
|
|
9
|
+
};
|
|
10
|
+
export interface OAuthConfig {
|
|
11
|
+
clientId: string;
|
|
12
|
+
clientSecret: string;
|
|
13
|
+
accessToken: string;
|
|
14
|
+
refreshToken: string;
|
|
15
|
+
onTokenRefresh?: (tokens: OAuthTokens) => void | Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface OAuthTokens {
|
|
18
|
+
access_token: string;
|
|
19
|
+
refresh_token: string;
|
|
20
|
+
}
|
|
21
|
+
export interface RequestOptions {
|
|
22
|
+
method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
23
|
+
path: string;
|
|
24
|
+
body?: unknown;
|
|
25
|
+
params?: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export interface FrontError {
|
|
28
|
+
message: string;
|
|
29
|
+
status?: number;
|
|
30
|
+
code?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PaginationParams extends Record<string, unknown> {
|
|
33
|
+
limit?: number;
|
|
34
|
+
page_token?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ListResponse<T> {
|
|
37
|
+
_results: T[];
|
|
38
|
+
_pagination?: {
|
|
39
|
+
next?: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface Teammate {
|
|
43
|
+
_links: {
|
|
44
|
+
self: string;
|
|
45
|
+
related: {
|
|
46
|
+
inboxes: string;
|
|
47
|
+
conversations: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
id: string;
|
|
51
|
+
email: string;
|
|
52
|
+
username: string;
|
|
53
|
+
first_name: string;
|
|
54
|
+
last_name: string;
|
|
55
|
+
is_admin: boolean;
|
|
56
|
+
is_available: boolean;
|
|
57
|
+
is_blocked: boolean;
|
|
58
|
+
custom_fields?: Record<string, unknown>;
|
|
59
|
+
}
|
|
60
|
+
export interface UpdateTeammateData {
|
|
61
|
+
first_name?: string;
|
|
62
|
+
last_name?: string;
|
|
63
|
+
is_available?: boolean;
|
|
64
|
+
custom_fields?: Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
export interface Conversation {
|
|
67
|
+
_links: {
|
|
68
|
+
self: string;
|
|
69
|
+
related: {
|
|
70
|
+
events: string;
|
|
71
|
+
followers: string;
|
|
72
|
+
messages: string;
|
|
73
|
+
comments: string;
|
|
74
|
+
inboxes: string;
|
|
75
|
+
last_message: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
id: string;
|
|
79
|
+
subject: string;
|
|
80
|
+
status: string;
|
|
81
|
+
status_id: string;
|
|
82
|
+
status_category: string;
|
|
83
|
+
ticket_ids?: string[];
|
|
84
|
+
assignee?: Teammate;
|
|
85
|
+
recipient: {
|
|
86
|
+
_links: {
|
|
87
|
+
related: {
|
|
88
|
+
contact: string;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
handle: string;
|
|
92
|
+
role: string;
|
|
93
|
+
};
|
|
94
|
+
tags: Array<{
|
|
95
|
+
_links: {
|
|
96
|
+
self: string;
|
|
97
|
+
related: {
|
|
98
|
+
conversations: string;
|
|
99
|
+
owner: string;
|
|
100
|
+
children: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
id: string;
|
|
104
|
+
name: string;
|
|
105
|
+
highlight: string;
|
|
106
|
+
is_private: boolean;
|
|
107
|
+
created_at: number;
|
|
108
|
+
updated_at: number;
|
|
109
|
+
}>;
|
|
110
|
+
created_at: number;
|
|
111
|
+
is_private: boolean;
|
|
112
|
+
}
|
|
113
|
+
export interface Account {
|
|
114
|
+
_links: {
|
|
115
|
+
self: string;
|
|
116
|
+
related: {
|
|
117
|
+
contacts: string;
|
|
118
|
+
conversations: string;
|
|
119
|
+
owner: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
id: string;
|
|
123
|
+
name: string;
|
|
124
|
+
description?: string;
|
|
125
|
+
domains: string[];
|
|
126
|
+
external_id?: string;
|
|
127
|
+
custom_fields?: Record<string, unknown>;
|
|
128
|
+
created_at: number;
|
|
129
|
+
updated_at: number;
|
|
130
|
+
}
|
|
131
|
+
export interface CreateAccountData {
|
|
132
|
+
name: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
domains?: string[];
|
|
135
|
+
external_id?: string;
|
|
136
|
+
custom_fields?: Record<string, unknown>;
|
|
137
|
+
}
|
|
138
|
+
export interface UpdateAccountData {
|
|
139
|
+
name?: string;
|
|
140
|
+
description?: string;
|
|
141
|
+
domains?: string[];
|
|
142
|
+
custom_fields?: Record<string, unknown>;
|
|
143
|
+
}
|
|
144
|
+
export interface AccountContactsParams extends PaginationParams {
|
|
145
|
+
q?: string;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.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