nylas 8.1.1 → 8.2.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.
Files changed (57) hide show
  1. package/lib/cjs/apiClient.js +12 -5
  2. package/lib/cjs/models/domains.js +2 -0
  3. package/lib/cjs/models/index.js +3 -0
  4. package/lib/cjs/models/messages.js +1 -0
  5. package/lib/cjs/models/serviceAccount.js +99 -0
  6. package/lib/cjs/models/workspaces.js +2 -0
  7. package/lib/cjs/nylas.js +4 -0
  8. package/lib/cjs/resources/applications.js +13 -0
  9. package/lib/cjs/resources/attachments.js +26 -4
  10. package/lib/cjs/resources/domains.js +232 -0
  11. package/lib/cjs/resources/messages.js +2 -1
  12. package/lib/cjs/resources/redirectUris.js +2 -2
  13. package/lib/cjs/resources/resource.js +18 -4
  14. package/lib/cjs/resources/threads.js +2 -1
  15. package/lib/cjs/resources/workspaces.js +95 -0
  16. package/lib/cjs/version.js +1 -1
  17. package/lib/esm/apiClient.js +11 -4
  18. package/lib/esm/models/domains.js +1 -0
  19. package/lib/esm/models/index.js +3 -0
  20. package/lib/esm/models/messages.js +1 -0
  21. package/lib/esm/models/serviceAccount.js +93 -0
  22. package/lib/esm/models/workspaces.js +1 -0
  23. package/lib/esm/nylas.js +4 -0
  24. package/lib/esm/resources/applications.js +13 -0
  25. package/lib/esm/resources/attachments.js +26 -4
  26. package/lib/esm/resources/domains.js +228 -0
  27. package/lib/esm/resources/messages.js +2 -1
  28. package/lib/esm/resources/redirectUris.js +2 -2
  29. package/lib/esm/resources/resource.js +18 -4
  30. package/lib/esm/resources/threads.js +2 -1
  31. package/lib/esm/resources/workspaces.js +91 -0
  32. package/lib/esm/version.js +1 -1
  33. package/lib/types/apiClient.d.ts +1 -0
  34. package/lib/types/config.d.ts +6 -0
  35. package/lib/types/models/agentLists.d.ts +5 -0
  36. package/lib/types/models/applicationDetails.d.ts +149 -11
  37. package/lib/types/models/domains.d.ts +177 -0
  38. package/lib/types/models/events.d.ts +5 -0
  39. package/lib/types/models/index.d.ts +3 -0
  40. package/lib/types/models/messages.d.ts +10 -0
  41. package/lib/types/models/policies.d.ts +6 -2
  42. package/lib/types/models/redirectUri.d.ts +15 -4
  43. package/lib/types/models/rules.d.ts +7 -1
  44. package/lib/types/models/serviceAccount.d.ts +46 -0
  45. package/lib/types/models/threads.d.ts +7 -0
  46. package/lib/types/models/workspaces.d.ts +191 -0
  47. package/lib/types/nylas.d.ts +10 -0
  48. package/lib/types/resources/applications.d.ts +14 -1
  49. package/lib/types/resources/attachments.d.ts +17 -4
  50. package/lib/types/resources/domains.d.ts +137 -0
  51. package/lib/types/resources/messages.d.ts +4 -2
  52. package/lib/types/resources/redirectUris.d.ts +2 -2
  53. package/lib/types/resources/resource.d.ts +2 -0
  54. package/lib/types/resources/threads.d.ts +3 -2
  55. package/lib/types/resources/workspaces.d.ts +98 -0
  56. package/lib/types/version.d.ts +1 -1
  57. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Configuration for Nylas Service Account request signing.
3
+ */
4
+ export interface ServiceAccountSignerConfig {
5
+ /**
6
+ * RSA private key in PEM format. Base64-encoded PEM is also accepted.
7
+ */
8
+ privateKeyPem: string | Buffer;
9
+ /**
10
+ * The `private_key_id` from the Nylas Service Account credentials file.
11
+ */
12
+ privateKeyId: string;
13
+ }
14
+ /**
15
+ * Inputs for creating Nylas Service Account signing headers.
16
+ */
17
+ export interface BuildServiceAccountHeadersParams {
18
+ method: string;
19
+ path: string;
20
+ body?: Record<string, unknown>;
21
+ timestamp?: number;
22
+ nonce?: string;
23
+ }
24
+ /**
25
+ * Nylas Service Account signing headers and the canonical JSON body, when the
26
+ * request method signs a payload.
27
+ */
28
+ export interface ServiceAccountSignedRequest {
29
+ headers: Record<string, string>;
30
+ serializedBody?: string;
31
+ }
32
+ export declare function generateNonce(length?: number): string;
33
+ /**
34
+ * Serialize JSON deterministically with sorted object keys and no extra
35
+ * whitespace, matching Nylas Service Account signing requirements.
36
+ */
37
+ export declare function canonicalJson(data: Record<string, unknown>): string;
38
+ /**
39
+ * Generates Nylas Service Account request signing headers.
40
+ */
41
+ export declare class ServiceAccountSigner {
42
+ private readonly privateKey;
43
+ private readonly privateKeyId;
44
+ constructor({ privateKeyPem, privateKeyId }: ServiceAccountSignerConfig);
45
+ buildHeaders({ method, path, body, timestamp, nonce, }: BuildServiceAccountHeadersParams): ServiceAccountSignedRequest;
46
+ }
@@ -151,3 +151,10 @@ export interface ListThreadsQueryParams extends ListQueryParams {
151
151
  */
152
152
  searchQueryNative?: string;
153
153
  }
154
+ export interface FindThreadQueryParams {
155
+ /**
156
+ * Specify fields that you want Nylas to return
157
+ * as a comma-separated list (for example, select=id,updated_at).
158
+ */
159
+ select?: string;
160
+ }
@@ -0,0 +1,191 @@
1
+ /**
2
+ * Interface representing a Nylas workspace.
3
+ *
4
+ * A workspace groups grants in a Nylas application by email domain. Grants can be
5
+ * auto-grouped (by matching email domain) or manually assigned and removed.
6
+ */
7
+ export interface Workspace {
8
+ /**
9
+ * Globally unique identifier for the workspace.
10
+ */
11
+ workspaceId: string;
12
+ /**
13
+ * The ID of the application that owns the workspace.
14
+ * Set server-side from the API key, never from the request body.
15
+ */
16
+ applicationId: string;
17
+ /**
18
+ * Descriptive name for the workspace.
19
+ */
20
+ name: string;
21
+ /**
22
+ * Top-level email domain for the workspace.
23
+ * May be an empty string when created with autoGroup false and no domain.
24
+ */
25
+ domain: string;
26
+ /**
27
+ * When true, new grants whose email domain matches domain are auto-assigned.
28
+ */
29
+ autoGroup: boolean;
30
+ /**
31
+ * When true, this is the application's default workspace.
32
+ */
33
+ default?: boolean;
34
+ /**
35
+ * The ID of the inbox policy attached to the workspace.
36
+ */
37
+ policyId?: string;
38
+ /**
39
+ * The IDs of the inbox rules attached to the workspace.
40
+ */
41
+ ruleIds?: string[];
42
+ /**
43
+ * Unix timestamp (seconds) when the workspace was created.
44
+ */
45
+ createdAt: number;
46
+ /**
47
+ * Unix timestamp (seconds) when the workspace was last updated.
48
+ */
49
+ updatedAt: number;
50
+ }
51
+ /**
52
+ * Interface representing a request to create a workspace.
53
+ */
54
+ export interface CreateWorkspaceRequest {
55
+ /**
56
+ * Descriptive name for the workspace.
57
+ */
58
+ name: string;
59
+ /**
60
+ * Top-level email domain for the workspace.
61
+ * Optional: when omitted along with autoGroup, an empty-domain workspace is created.
62
+ */
63
+ domain?: string;
64
+ /**
65
+ * When true, new grants whose email domain matches domain are auto-assigned.
66
+ * Defaults server-side to true when a domain is provided, false otherwise.
67
+ */
68
+ autoGroup?: boolean;
69
+ /**
70
+ * The ID of the inbox policy to attach to the workspace.
71
+ */
72
+ policyId?: string;
73
+ /**
74
+ * The IDs of the inbox rules to attach to the workspace.
75
+ */
76
+ ruleIds?: string[];
77
+ }
78
+ /**
79
+ * Interface representing a request to update a workspace.
80
+ *
81
+ * Updates are issued as PATCH and address the workspace by its UUID only.
82
+ * At least one field must be provided.
83
+ */
84
+ export interface UpdateWorkspaceRequest {
85
+ /**
86
+ * Descriptive name for the workspace. Omitted fields are preserved.
87
+ */
88
+ name?: string;
89
+ /**
90
+ * Top-level email domain. Changing the domain is rejected by the server;
91
+ * the domain is effectively immutable after creation.
92
+ */
93
+ domain?: string;
94
+ /**
95
+ * When true, new grants whose email domain matches domain are auto-assigned.
96
+ * Cannot be set to true on a workspace with an empty domain.
97
+ */
98
+ autoGroup?: boolean;
99
+ /**
100
+ * The ID of the inbox policy attached to the workspace.
101
+ * A UUID sets the policy, null clears it, and omitting preserves the current value.
102
+ */
103
+ policyId?: string | null;
104
+ /**
105
+ * The IDs of the inbox rules attached to the workspace.
106
+ * An array (including an empty array) overwrites; null or omitting preserves.
107
+ */
108
+ ruleIds?: string[] | null;
109
+ }
110
+ /**
111
+ * Interface representing query parameters for listing workspaces.
112
+ *
113
+ * The list endpoint is not paginated and accepts no query parameters.
114
+ */
115
+ export type ListWorkspacesQueryParams = Record<string, never>;
116
+ /**
117
+ * Interface representing a request to auto-group grants into workspaces.
118
+ *
119
+ * All fields are optional. Auto-grouping runs as a background job.
120
+ */
121
+ export interface AutoGroupWorkspacesRequest {
122
+ /**
123
+ * Only group grants created at or after this Unix timestamp (seconds).
124
+ */
125
+ afterCreatedAt?: number;
126
+ /**
127
+ * When true, includes invalid grants in the grouping pass. Defaults to false.
128
+ */
129
+ invalidAlso?: boolean;
130
+ /**
131
+ * Only group grants whose email domain matches this domain.
132
+ */
133
+ specificDomain?: string;
134
+ }
135
+ /**
136
+ * Interface representing the response from starting an auto-group job.
137
+ */
138
+ export interface AutoGroupWorkspacesResponse {
139
+ /**
140
+ * The ID of the background auto-group job.
141
+ */
142
+ jobId: string;
143
+ /**
144
+ * A human-readable message describing the started job.
145
+ */
146
+ message: string;
147
+ }
148
+ /**
149
+ * Interface representing a request to manually assign or remove grants
150
+ * for a workspace.
151
+ *
152
+ * At least one of assignGrants or removeGrants must contain a grant ID.
153
+ * Each list may contain at most 500 entries.
154
+ */
155
+ export interface ManualAssignWorkspaceRequest {
156
+ /**
157
+ * Grant IDs to assign to the workspace. Maximum 500 entries.
158
+ */
159
+ assignGrants?: string[];
160
+ /**
161
+ * Grant IDs to remove from the workspace. Maximum 500 entries.
162
+ */
163
+ removeGrants?: string[];
164
+ }
165
+ /**
166
+ * Interface representing the response from manually assigning or removing grants.
167
+ */
168
+ export interface ManualAssignWorkspaceResponse {
169
+ /**
170
+ * The ID of the application that owns the workspace.
171
+ */
172
+ applicationId: string;
173
+ /**
174
+ * The ID of the workspace that was updated.
175
+ */
176
+ workspaceId: string;
177
+ /**
178
+ * The domain of the workspace (empty string if none).
179
+ */
180
+ domain: string;
181
+ /**
182
+ * The grant IDs that were actually assigned.
183
+ * Serializes as null (not an empty array) when no assigned grant matched.
184
+ */
185
+ grantsAssigned: string[] | null;
186
+ /**
187
+ * The grant IDs that were actually removed.
188
+ * Serializes as null (not an empty array) when no removed grant matched.
189
+ */
190
+ grantsRemoved: string[] | null;
191
+ }
@@ -16,8 +16,10 @@ import { Contacts } from './resources/contacts.js';
16
16
  import { Attachments } from './resources/attachments.js';
17
17
  import { Scheduler } from './resources/scheduler.js';
18
18
  import { Notetakers } from './resources/notetakers.js';
19
+ import { Domains } from './resources/domains.js';
19
20
  import { Policies } from './resources/policies.js';
20
21
  import { Rules } from './resources/rules.js';
22
+ import { Workspaces } from './resources/workspaces.js';
21
23
  import { AgentLists } from './resources/agentLists.js';
22
24
  /**
23
25
  * The entry point to the Node SDK
@@ -70,6 +72,10 @@ declare class Nylas {
70
72
  * Access the Notetakers API
71
73
  */
72
74
  notetakers: Notetakers;
75
+ /**
76
+ * Access the Manage Domains API
77
+ */
78
+ domains: Domains;
73
79
  /**
74
80
  * Access the Agent Account Policies API
75
81
  */
@@ -78,6 +84,10 @@ declare class Nylas {
78
84
  * Access the Agent Account Rules API
79
85
  */
80
86
  rules: Rules;
87
+ /**
88
+ * Access the Workspaces API
89
+ */
90
+ workspaces: Workspaces;
81
91
  /**
82
92
  * Access the Agent Account Lists API
83
93
  */
@@ -1,9 +1,15 @@
1
1
  import { Resource } from './resource.js';
2
2
  import { RedirectUris } from './redirectUris.js';
3
3
  import APIClient from '../apiClient.js';
4
- import { ApplicationDetails } from '../models/applicationDetails.js';
4
+ import { ApplicationDetails, UpdateApplicationRequest } from '../models/applicationDetails.js';
5
5
  import { NylasResponse } from '../models/response.js';
6
6
  import { Overrides } from '../config.js';
7
+ /**
8
+ * @property requestBody The values to update the application with.
9
+ */
10
+ export interface UpdateApplicationParams {
11
+ requestBody: UpdateApplicationRequest;
12
+ }
7
13
  /**
8
14
  * Nylas Applications API
9
15
  *
@@ -23,4 +29,11 @@ export declare class Applications extends Resource {
23
29
  * @returns The application details
24
30
  */
25
31
  getDetails({ overrides }?: Overrides): Promise<NylasResponse<ApplicationDetails>>;
32
+ /**
33
+ * Update application details.
34
+ *
35
+ * Each supplied nested object is a full replace, not a deep merge.
36
+ * @returns The updated application details
37
+ */
38
+ update({ requestBody, overrides, }: UpdateApplicationParams & Overrides): Promise<NylasResponse<ApplicationDetails>>;
26
39
  }
@@ -52,17 +52,30 @@ export declare class Attachments extends Resource {
52
52
  /**
53
53
  * Download the attachment data
54
54
  *
55
- * This method returns a NodeJS.ReadableStream which can be used to stream the attachment data.
55
+ * This method returns a Web ReadableStream which can be used to stream the attachment data.
56
56
  * This is particularly useful for handling large attachments efficiently, as it avoids loading
57
- * the entire file into memory. The stream can be piped to a file stream or used in any other way
58
- * that Node.js streams are typically used.
57
+ * the entire file into memory. In Node.js, convert it with Readable.fromWeb() when a
58
+ * NodeJS.ReadableStream is required.
59
59
  *
60
60
  * @param identifier Grant ID or email account to query
61
61
  * @param attachmentId The id of the attachment to download.
62
62
  * @param queryParams The query parameters to include in the request
63
- * @returns {NodeJS.ReadableStream} The ReadableStream containing the file data.
63
+ * @returns {ReadableStream<Uint8Array>} The ReadableStream containing the file data.
64
64
  */
65
65
  download({ identifier, attachmentId, queryParams, overrides, }: DownloadAttachmentParams & Overrides): Promise<ReadableStream<Uint8Array>>;
66
+ /**
67
+ * Download the attachment data as a Node.js readable stream.
68
+ *
69
+ * This is a Node.js convenience wrapper around {@link Attachments.download}. Use
70
+ * {@link Attachments.download} directly in Fetch-native runtimes, such as Cloudflare Workers,
71
+ * where Web ReadableStreams are the standard stream primitive.
72
+ *
73
+ * @param identifier Grant ID or email account to query
74
+ * @param attachmentId The id of the attachment to download.
75
+ * @param queryParams The query parameters to include in the request
76
+ * @returns {NodeJS.ReadableStream} The Node.js readable stream containing the file data.
77
+ */
78
+ downloadNodeStream({ identifier, attachmentId, queryParams, overrides, }: DownloadAttachmentParams & Overrides): Promise<NodeJS.ReadableStream>;
66
79
  /**
67
80
  * Download the attachment as a byte array
68
81
  * @param identifier Grant ID or email account to query
@@ -0,0 +1,137 @@
1
+ import { Overrides } from '../config.js';
2
+ import { CreateDomainRequest, Domain, DomainVerificationAttempt, DomainVerificationResult, ListDomainsQueryParams, UpdateDomainRequest } from '../models/domains.js';
3
+ import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
4
+ import { ServiceAccountSigner } from '../models/serviceAccount.js';
5
+ import { AsyncListResponse, Resource } from './resource.js';
6
+ /**
7
+ * @property queryParams The query parameters to include in the request.
8
+ */
9
+ interface ListDomainsParams {
10
+ queryParams?: ListDomainsQueryParams;
11
+ signer?: ServiceAccountSigner;
12
+ }
13
+ /**
14
+ * @property domainId The ID of the domain to retrieve. Accepts either a domain
15
+ * UUID or a domain address (FQDN/email format).
16
+ */
17
+ interface FindDomainParams {
18
+ domainId: string;
19
+ signer?: ServiceAccountSigner;
20
+ }
21
+ /**
22
+ * @property requestBody The values to create the domain with.
23
+ */
24
+ interface CreateDomainParams {
25
+ requestBody: CreateDomainRequest;
26
+ signer?: ServiceAccountSigner;
27
+ }
28
+ /**
29
+ * @property domainId The ID of the domain to update. Accepts either a domain
30
+ * UUID or a domain address (FQDN/email format).
31
+ * @property requestBody The values to update the domain with.
32
+ */
33
+ interface UpdateDomainParams {
34
+ domainId: string;
35
+ requestBody: UpdateDomainRequest;
36
+ signer?: ServiceAccountSigner;
37
+ }
38
+ /**
39
+ * @property domainId The ID of the domain to delete. Accepts either a domain
40
+ * UUID or a domain address (FQDN/email format).
41
+ */
42
+ interface DestroyDomainParams {
43
+ domainId: string;
44
+ signer?: ServiceAccountSigner;
45
+ }
46
+ /**
47
+ * @property domainId The ID of the domain to fetch verification info for.
48
+ * Accepts either a domain UUID or a domain address (FQDN/email format).
49
+ * @property requestBody The verification attempt describing which DNS type to fetch info for.
50
+ */
51
+ interface InfoDomainParams {
52
+ domainId: string;
53
+ requestBody: DomainVerificationAttempt;
54
+ signer?: ServiceAccountSigner;
55
+ }
56
+ /**
57
+ * @property domainId The ID of the domain to verify. Accepts either a domain
58
+ * UUID or a domain address (FQDN/email format).
59
+ * @property requestBody The verification attempt describing which DNS type to verify.
60
+ */
61
+ interface VerifyDomainParams {
62
+ domainId: string;
63
+ requestBody: DomainVerificationAttempt;
64
+ signer?: ServiceAccountSigner;
65
+ }
66
+ /**
67
+ * Nylas Manage Domains API
68
+ *
69
+ * Register email domains and run their DNS verification flow
70
+ * (ownership / MX / SPF / DKIM / feedback) for Transactional Send and Nylas Inbound.
71
+ */
72
+ export declare class Domains extends Resource {
73
+ private static readonly REQUIRED_SERVICE_ACCOUNT_HEADERS;
74
+ private assertServiceAccountSigningHeaders;
75
+ private buildSignedRequest;
76
+ /**
77
+ * Return all domains for the caller's organization.
78
+ *
79
+ * Requires Nylas Service Account request signing headers:
80
+ * X-Nylas-Kid, X-Nylas-Timestamp, X-Nylas-Nonce, and X-Nylas-Signature.
81
+ * @return The list of domains.
82
+ */
83
+ list({ queryParams, signer, overrides, }?: ListDomainsParams & Overrides): AsyncListResponse<NylasListResponse<Domain>>;
84
+ /**
85
+ * Return a domain.
86
+ *
87
+ * Requires Nylas Service Account request signing headers:
88
+ * X-Nylas-Kid, X-Nylas-Timestamp, X-Nylas-Nonce, and X-Nylas-Signature.
89
+ * @return The domain.
90
+ */
91
+ find({ domainId, signer, overrides, }: FindDomainParams & Overrides): Promise<NylasResponse<Domain>>;
92
+ /**
93
+ * Create a domain.
94
+ *
95
+ * Requires Nylas Service Account request signing headers:
96
+ * X-Nylas-Kid, X-Nylas-Timestamp, X-Nylas-Nonce, and X-Nylas-Signature.
97
+ * @return The created domain.
98
+ */
99
+ create({ requestBody, signer, overrides, }: CreateDomainParams & Overrides): Promise<NylasResponse<Domain>>;
100
+ /**
101
+ * Update a domain.
102
+ *
103
+ * Note: the response echoes the sparse cleared input (typically just `name`
104
+ * and `updatedAt`), not a full domain. Re-fetch the domain with `find` if you
105
+ * need the complete record.
106
+ *
107
+ * Requires Nylas Service Account request signing headers:
108
+ * X-Nylas-Kid, X-Nylas-Timestamp, X-Nylas-Nonce, and X-Nylas-Signature.
109
+ * @return The updated domain fields.
110
+ */
111
+ update({ domainId, requestBody, signer, overrides, }: UpdateDomainParams & Overrides): Promise<NylasResponse<Domain>>;
112
+ /**
113
+ * Delete a domain.
114
+ *
115
+ * Requires Nylas Service Account request signing headers:
116
+ * X-Nylas-Kid, X-Nylas-Timestamp, X-Nylas-Nonce, and X-Nylas-Signature.
117
+ * @return The deletion response.
118
+ */
119
+ destroy({ domainId, signer, overrides, }: DestroyDomainParams & Overrides): Promise<NylasBaseResponse>;
120
+ /**
121
+ * Get the DNS record a customer must configure for a given verification type.
122
+ *
123
+ * Requires Nylas Service Account request signing headers:
124
+ * X-Nylas-Kid, X-Nylas-Timestamp, X-Nylas-Nonce, and X-Nylas-Signature.
125
+ * @return The verification result, including the DNS record to configure.
126
+ */
127
+ info({ domainId, requestBody, signer, overrides, }: InfoDomainParams & Overrides): Promise<NylasResponse<DomainVerificationResult>>;
128
+ /**
129
+ * Trigger a DNS verification check for a given verification type.
130
+ *
131
+ * Requires Nylas Service Account request signing headers:
132
+ * X-Nylas-Kid, X-Nylas-Timestamp, X-Nylas-Nonce, and X-Nylas-Signature.
133
+ * @return The verification result, including the current status.
134
+ */
135
+ verify({ domainId, requestBody, signer, overrides, }: VerifyDomainParams & Overrides): Promise<NylasResponse<DomainVerificationResult>>;
136
+ }
137
+ export {};
@@ -2,7 +2,7 @@ import { FormData } from 'formdata-node';
2
2
  import APIClient from '../apiClient.js';
3
3
  import { Overrides } from '../config.js';
4
4
  import { CreateDraftRequest, SendMessageRequest, UpdateDraftRequest } from '../models/drafts.js';
5
- import { CleanMessagesRequest, CleanMessagesResponse, FindMessageQueryParams, ListMessagesQueryParams, Message, ScheduledMessage, ScheduledMessagesList, StopScheduledMessageResponse, UpdateMessageRequest } from '../models/messages.js';
5
+ import { CleanMessagesRequest, CleanMessagesResponse, FindMessageQueryParams, ListMessagesQueryParams, Message, ScheduledMessage, ScheduledMessagesList, SendMessageQueryParams, StopScheduledMessageResponse, UpdateMessageRequest } from '../models/messages.js';
6
6
  import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
7
7
  import { AsyncListResponse, Resource } from './resource.js';
8
8
  import { SmartCompose } from './smartCompose.js';
@@ -50,10 +50,12 @@ export interface DestroyMessageParams {
50
50
  * The parameters for the {@link Messages.send} method
51
51
  * @property identifier The identifier of the grant to act upon
52
52
  * @property requestBody The message to send
53
+ * @property queryParams The query parameters to include in the request
53
54
  */
54
55
  export interface SendMessageParams {
55
56
  identifier: string;
56
57
  requestBody: SendMessageRequest;
58
+ queryParams?: SendMessageQueryParams;
57
59
  }
58
60
  /**
59
61
  * The parameters for the {@link Messages.listScheduledMessages} method
@@ -119,7 +121,7 @@ export declare class Messages extends Resource {
119
121
  * Send an email
120
122
  * @return The sent message
121
123
  */
122
- send({ identifier, requestBody, overrides, }: SendMessageParams & Overrides): Promise<NylasResponse<Message>>;
124
+ send({ identifier, requestBody, queryParams, overrides, }: SendMessageParams & Overrides): Promise<NylasResponse<Message>>;
123
125
  /**
124
126
  * Retrieve your scheduled messages
125
127
  * @return A list of scheduled messages
@@ -56,7 +56,7 @@ export declare class RedirectUris extends Resource {
56
56
  update({ redirectUriId, requestBody, overrides, }: UpdateRedirectUrisParams & Overrides): Promise<NylasResponse<RedirectUri>>;
57
57
  /**
58
58
  * Delete a Redirect URI
59
- * @return The deleted Redirect URI
59
+ * @return The deletion response
60
60
  */
61
- destroy({ redirectUriId, overrides, }: DestroyRedirectUrisParams & Overrides): Promise<NylasResponse<NylasBaseResponse>>;
61
+ destroy({ redirectUriId, overrides, }: DestroyRedirectUrisParams & Overrides): Promise<NylasBaseResponse>;
62
62
  }
@@ -6,6 +6,7 @@ interface ListParams<T> {
6
6
  queryParams?: ListQueryParams;
7
7
  path: string;
8
8
  overrides?: OverridableNylasConfig;
9
+ getOverrides?: () => OverridableNylasConfig | undefined;
9
10
  useGenerator?: boolean;
10
11
  }
11
12
  interface FindParams<T> {
@@ -17,6 +18,7 @@ interface PayloadParams<T> {
17
18
  path: string;
18
19
  queryParams?: Record<string, any>;
19
20
  requestBody: Record<string, any>;
21
+ serializedBody?: string | Buffer;
20
22
  overrides?: OverridableNylasConfig;
21
23
  }
22
24
  interface DestroyParams {
@@ -1,4 +1,4 @@
1
- import { ListThreadsQueryParams, Thread, UpdateThreadRequest } from '../models/threads.js';
1
+ import { FindThreadQueryParams, ListThreadsQueryParams, Thread, UpdateThreadRequest } from '../models/threads.js';
2
2
  import { AsyncListResponse, Resource } from './resource.js';
3
3
  import { Overrides } from '../config.js';
4
4
  import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
@@ -20,6 +20,7 @@ export interface ListThreadsParams {
20
20
  export interface FindThreadParams {
21
21
  identifier: string;
22
22
  threadId: string;
23
+ queryParams?: FindThreadQueryParams;
23
24
  }
24
25
  /**
25
26
  * The parameters for the {@link Threads.update} method
@@ -56,7 +57,7 @@ export declare class Threads extends Resource {
56
57
  * Return a Thread
57
58
  * @return The thread
58
59
  */
59
- find({ identifier, threadId, overrides, }: FindThreadParams & Overrides): Promise<NylasResponse<Thread>>;
60
+ find({ identifier, threadId, overrides, queryParams, }: FindThreadParams & Overrides): Promise<NylasResponse<Thread>>;
60
61
  /**
61
62
  * Update a Thread
62
63
  * @return The updated thread
@@ -0,0 +1,98 @@
1
+ import { Overrides } from '../config.js';
2
+ import { AutoGroupWorkspacesRequest, AutoGroupWorkspacesResponse, CreateWorkspaceRequest, ListWorkspacesQueryParams, ManualAssignWorkspaceRequest, ManualAssignWorkspaceResponse, UpdateWorkspaceRequest, Workspace } from '../models/workspaces.js';
3
+ import { NylasBaseResponse, NylasListResponse, NylasResponse } from '../models/response.js';
4
+ import { AsyncListResponse, Resource } from './resource.js';
5
+ /**
6
+ * @property queryParams The query parameters to include in the request.
7
+ */
8
+ interface ListWorkspacesParams {
9
+ queryParams?: ListWorkspacesQueryParams;
10
+ }
11
+ /**
12
+ * @property workspaceId The ID of the workspace to retrieve. Accepts a UUID or a domain.
13
+ */
14
+ interface FindWorkspaceParams {
15
+ workspaceId: string;
16
+ }
17
+ /**
18
+ * @property requestBody The values to create the workspace with.
19
+ */
20
+ interface CreateWorkspaceParams {
21
+ requestBody: CreateWorkspaceRequest;
22
+ }
23
+ /**
24
+ * @property workspaceId The UUID of the workspace to update. A domain is not accepted here.
25
+ * @property requestBody The values to update the workspace with.
26
+ */
27
+ interface UpdateWorkspaceParams {
28
+ workspaceId: string;
29
+ requestBody: UpdateWorkspaceRequest;
30
+ }
31
+ /**
32
+ * @property workspaceId The ID of the workspace to delete. Accepts a UUID or a domain.
33
+ */
34
+ interface DestroyWorkspaceParams {
35
+ workspaceId: string;
36
+ }
37
+ /**
38
+ * @property requestBody The auto-group filters to apply.
39
+ */
40
+ interface AutoGroupWorkspacesParams {
41
+ requestBody?: AutoGroupWorkspacesRequest;
42
+ }
43
+ /**
44
+ * @property workspaceId The ID of the workspace to update. Accepts a UUID or a domain.
45
+ * @property requestBody The grants to assign and/or remove.
46
+ */
47
+ interface ManualAssignWorkspaceParams {
48
+ workspaceId: string;
49
+ requestBody: ManualAssignWorkspaceRequest;
50
+ }
51
+ /**
52
+ * Nylas Workspaces API
53
+ *
54
+ * Workspaces group grants in a Nylas application by email domain. Grants can be
55
+ * auto-grouped by matching email domain or manually assigned and removed.
56
+ */
57
+ export declare class Workspaces extends Resource {
58
+ /**
59
+ * Return all workspaces for the application.
60
+ *
61
+ * The list endpoint is not paginated and returns every workspace as a flat array.
62
+ * @return The list of workspaces.
63
+ */
64
+ list({ queryParams, overrides, }?: ListWorkspacesParams & Overrides): AsyncListResponse<NylasListResponse<Workspace>>;
65
+ /**
66
+ * Return a workspace.
67
+ * @return The workspace.
68
+ */
69
+ find({ workspaceId, overrides, }: FindWorkspaceParams & Overrides): Promise<NylasResponse<Workspace>>;
70
+ /**
71
+ * Create a workspace.
72
+ * @return The created workspace.
73
+ */
74
+ create({ requestBody, overrides, }: CreateWorkspaceParams & Overrides): Promise<NylasResponse<Workspace>>;
75
+ /**
76
+ * Update a workspace.
77
+ *
78
+ * Issued as PATCH; the workspace must be addressed by its UUID.
79
+ * @return The updated workspace.
80
+ */
81
+ update({ workspaceId, requestBody, overrides, }: UpdateWorkspaceParams & Overrides): Promise<NylasResponse<Workspace>>;
82
+ /**
83
+ * Delete a workspace.
84
+ * @return The deletion response.
85
+ */
86
+ destroy({ workspaceId, overrides, }: DestroyWorkspaceParams & Overrides): Promise<NylasBaseResponse>;
87
+ /**
88
+ * Start a background job that auto-groups grants into workspaces by email domain.
89
+ * @return The auto-group job response.
90
+ */
91
+ autoGroup({ requestBody, overrides, }?: AutoGroupWorkspacesParams & Overrides): Promise<NylasResponse<AutoGroupWorkspacesResponse>>;
92
+ /**
93
+ * Manually assign grants to and/or remove grants from a workspace.
94
+ * @return The assignment response.
95
+ */
96
+ manualAssign({ workspaceId, requestBody, overrides, }: ManualAssignWorkspaceParams & Overrides): Promise<NylasResponse<ManualAssignWorkspaceResponse>>;
97
+ }
98
+ export {};
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "8.1.1";
1
+ export declare const SDK_VERSION = "8.2.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "8.1.1",
3
+ "version": "8.2.0",
4
4
  "description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
5
5
  "main": "lib/cjs/nylas.js",
6
6
  "types": "lib/types/nylas.d.ts",