nylas 7.9.0 → 7.10.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 (55) hide show
  1. package/lib/cjs/apiClient.js +23 -2
  2. package/lib/cjs/resources/applications.js +2 -1
  3. package/lib/cjs/resources/attachments.js +4 -3
  4. package/lib/cjs/resources/auth.js +9 -12
  5. package/lib/cjs/resources/bookings.js +14 -5
  6. package/lib/cjs/resources/calendars.js +19 -7
  7. package/lib/cjs/resources/configurations.js +19 -5
  8. package/lib/cjs/resources/connectors.js +6 -5
  9. package/lib/cjs/resources/contacts.js +18 -6
  10. package/lib/cjs/resources/credentials.js +15 -5
  11. package/lib/cjs/resources/drafts.js +21 -6
  12. package/lib/cjs/resources/events.js +22 -9
  13. package/lib/cjs/resources/folders.js +15 -5
  14. package/lib/cjs/resources/grants.js +5 -4
  15. package/lib/cjs/resources/messages.js +24 -9
  16. package/lib/cjs/resources/notetakers.js +32 -14
  17. package/lib/cjs/resources/redirectUris.js +12 -5
  18. package/lib/cjs/resources/resource.js +1 -1
  19. package/lib/cjs/resources/sessions.js +5 -2
  20. package/lib/cjs/resources/smartCompose.js +5 -2
  21. package/lib/cjs/resources/threads.js +14 -4
  22. package/lib/cjs/resources/webhooks.js +10 -7
  23. package/lib/cjs/utils.js +32 -3
  24. package/lib/cjs/version.js +1 -1
  25. package/lib/esm/apiClient.js +23 -2
  26. package/lib/esm/resources/applications.js +2 -1
  27. package/lib/esm/resources/attachments.js +4 -3
  28. package/lib/esm/resources/auth.js +9 -12
  29. package/lib/esm/resources/bookings.js +14 -5
  30. package/lib/esm/resources/calendars.js +19 -7
  31. package/lib/esm/resources/configurations.js +19 -5
  32. package/lib/esm/resources/connectors.js +6 -5
  33. package/lib/esm/resources/contacts.js +18 -6
  34. package/lib/esm/resources/credentials.js +15 -5
  35. package/lib/esm/resources/drafts.js +21 -6
  36. package/lib/esm/resources/events.js +22 -9
  37. package/lib/esm/resources/folders.js +15 -5
  38. package/lib/esm/resources/grants.js +5 -4
  39. package/lib/esm/resources/messages.js +25 -10
  40. package/lib/esm/resources/notetakers.js +32 -14
  41. package/lib/esm/resources/redirectUris.js +12 -5
  42. package/lib/esm/resources/resource.js +1 -1
  43. package/lib/esm/resources/sessions.js +5 -2
  44. package/lib/esm/resources/smartCompose.js +5 -2
  45. package/lib/esm/resources/threads.js +14 -4
  46. package/lib/esm/resources/webhooks.js +10 -7
  47. package/lib/esm/utils.js +29 -2
  48. package/lib/esm/version.js +1 -1
  49. package/lib/types/config.d.ts +9 -1
  50. package/lib/types/models/auth.d.ts +1 -1
  51. package/lib/types/models/events.d.ts +1 -1
  52. package/lib/types/models/freeBusy.d.ts +5 -0
  53. package/lib/types/utils.d.ts +15 -0
  54. package/lib/types/version.d.ts +1 -1
  55. package/package.json +7 -6
@@ -75,7 +75,21 @@ class APIClient {
75
75
  async sendRequest(options) {
76
76
  const req = this.newRequest(options);
77
77
  const controller = new AbortController();
78
- const timeoutDuration = options.overrides?.timeout || this.timeout;
78
+ // Handle timeout
79
+ let timeoutDuration;
80
+ if (options.overrides?.timeout) {
81
+ // Determine if the override timeout is likely in milliseconds (≥ 1000)
82
+ if (options.overrides.timeout >= 1000) {
83
+ timeoutDuration = options.overrides.timeout; // Keep as milliseconds for backward compatibility
84
+ }
85
+ else {
86
+ // Treat as seconds and convert to milliseconds
87
+ timeoutDuration = options.overrides.timeout * 1000;
88
+ }
89
+ }
90
+ else {
91
+ timeoutDuration = this.timeout; // Already in milliseconds from constructor
92
+ }
79
93
  const timeout = setTimeout(() => {
80
94
  controller.abort();
81
95
  }, timeoutDuration);
@@ -117,7 +131,14 @@ class APIClient {
117
131
  }
118
132
  catch (error) {
119
133
  if (error instanceof Error && error.name === 'AbortError') {
120
- throw new error_js_1.NylasSdkTimeoutError(req.url, this.timeout);
134
+ // Calculate the timeout in seconds for the error message
135
+ // If we determined it was milliseconds (≥ 1000), convert to seconds for the error
136
+ const timeoutInSeconds = options.overrides?.timeout
137
+ ? options.overrides.timeout >= 1000
138
+ ? options.overrides.timeout / 1000 // Convert ms to s for error message
139
+ : options.overrides.timeout // Already in seconds
140
+ : this.timeout / 1000; // Convert ms to s
141
+ throw new error_js_1.NylasSdkTimeoutError(req.url, timeoutInSeconds);
121
142
  }
122
143
  clearTimeout(timeout);
123
144
  throw error;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Applications = void 0;
4
4
  const resource_js_1 = require("./resource.js");
5
5
  const redirectUris_js_1 = require("./redirectUris.js");
6
+ const utils_js_1 = require("../utils.js");
6
7
  /**
7
8
  * Nylas Applications API
8
9
  *
@@ -22,7 +23,7 @@ class Applications extends resource_js_1.Resource {
22
23
  */
23
24
  getDetails({ overrides } = {}) {
24
25
  return super._find({
25
- path: `/v3/applications`,
26
+ path: (0, utils_js_1.makePathParams)('/v3/applications', {}),
26
27
  overrides,
27
28
  });
28
29
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Attachments = void 0;
4
+ const utils_js_1 = require("../utils.js");
4
5
  const resource_js_1 = require("./resource.js");
5
6
  /**
6
7
  * Nylas Attachments API
@@ -14,7 +15,7 @@ class Attachments extends resource_js_1.Resource {
14
15
  */
15
16
  find({ identifier, attachmentId, queryParams, overrides, }) {
16
17
  return super._find({
17
- path: `/v3/grants/${identifier}/attachments/${attachmentId}`,
18
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/attachments/{attachmentId}', { identifier, attachmentId }),
18
19
  queryParams,
19
20
  overrides,
20
21
  });
@@ -34,7 +35,7 @@ class Attachments extends resource_js_1.Resource {
34
35
  */
35
36
  download({ identifier, attachmentId, queryParams, overrides, }) {
36
37
  return this._getStream({
37
- path: `/v3/grants/${identifier}/attachments/${attachmentId}/download`,
38
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/attachments/{attachmentId}/download', { identifier, attachmentId }),
38
39
  queryParams,
39
40
  overrides,
40
41
  });
@@ -48,7 +49,7 @@ class Attachments extends resource_js_1.Resource {
48
49
  */
49
50
  downloadBytes({ identifier, attachmentId, queryParams, overrides, }) {
50
51
  return super._getRaw({
51
- path: `/v3/grants/${identifier}/attachments/${attachmentId}/download`,
52
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/attachments/{attachmentId}/download', { identifier, attachmentId }),
52
53
  queryParams,
53
54
  overrides,
54
55
  });
@@ -4,6 +4,7 @@ exports.Auth = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  const crypto_1 = require("crypto");
6
6
  const resource_js_1 = require("./resource.js");
7
+ const utils_js_1 = require("../utils.js");
7
8
  /**
8
9
  * A collection of authentication related API endpoints
9
10
  *
@@ -30,7 +31,7 @@ class Auth extends resource_js_1.Resource {
30
31
  }
31
32
  return this.apiClient.request({
32
33
  method: 'POST',
33
- path: `/v3/connect/token`,
34
+ path: (0, utils_js_1.makePathParams)('/v3/connect/token', {}),
34
35
  body: {
35
36
  ...request,
36
37
  grantType: 'authorization_code',
@@ -48,7 +49,7 @@ class Auth extends resource_js_1.Resource {
48
49
  }
49
50
  return this.apiClient.request({
50
51
  method: 'POST',
51
- path: `/v3/connect/token`,
52
+ path: (0, utils_js_1.makePathParams)('/v3/connect/token', {}),
52
53
  body: {
53
54
  ...request,
54
55
  grantType: 'refresh_token',
@@ -90,7 +91,7 @@ class Auth extends resource_js_1.Resource {
90
91
  customAuthentication({ requestBody, overrides, }) {
91
92
  return this.apiClient.request({
92
93
  method: 'POST',
93
- path: `/v3/connect/custom`,
94
+ path: (0, utils_js_1.makePathParams)('/v3/connect/custom', {}),
94
95
  body: requestBody,
95
96
  overrides,
96
97
  });
@@ -103,7 +104,7 @@ class Auth extends resource_js_1.Resource {
103
104
  async revoke(token) {
104
105
  await this.apiClient.request({
105
106
  method: 'POST',
106
- path: `/v3/connect/revoke`,
107
+ path: (0, utils_js_1.makePathParams)('/v3/connect/revoke', {}),
107
108
  queryParams: {
108
109
  token,
109
110
  },
@@ -118,7 +119,7 @@ class Auth extends resource_js_1.Resource {
118
119
  async detectProvider(params) {
119
120
  return this.apiClient.request({
120
121
  method: 'POST',
121
- path: `/v3/providers/detect`,
122
+ path: (0, utils_js_1.makePathParams)('/v3/providers/detect', {}),
122
123
  queryParams: params,
123
124
  });
124
125
  }
@@ -165,17 +166,13 @@ class Auth extends resource_js_1.Resource {
165
166
  return url;
166
167
  }
167
168
  hashPKCESecret(secret) {
168
- const hash = (0, crypto_1.createHash)('sha256')
169
- .update(secret)
170
- .digest('hex');
171
- return Buffer.from(hash)
172
- .toString('base64')
173
- .replace(/=+$/, '');
169
+ const hash = (0, crypto_1.createHash)('sha256').update(secret).digest('hex');
170
+ return Buffer.from(hash).toString('base64').replace(/=+$/, '');
174
171
  }
175
172
  getTokenInfo(params) {
176
173
  return this.apiClient.request({
177
174
  method: 'GET',
178
- path: `/v3/connect/tokeninfo`,
175
+ path: (0, utils_js_1.makePathParams)('/v3/connect/tokeninfo', {}),
179
176
  queryParams: params,
180
177
  });
181
178
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Bookings = void 0;
4
+ const utils_js_1 = require("../utils.js");
4
5
  const resource_js_1 = require("./resource.js");
5
6
  class Bookings extends resource_js_1.Resource {
6
7
  /**
@@ -9,7 +10,9 @@ class Bookings extends resource_js_1.Resource {
9
10
  */
10
11
  find({ bookingId, queryParams, overrides, }) {
11
12
  return super._find({
12
- path: `/v3/scheduling/bookings/${bookingId}`,
13
+ path: (0, utils_js_1.makePathParams)('/v3/scheduling/bookings/{bookingId}', {
14
+ bookingId,
15
+ }),
13
16
  queryParams,
14
17
  overrides,
15
18
  });
@@ -20,7 +23,7 @@ class Bookings extends resource_js_1.Resource {
20
23
  */
21
24
  create({ requestBody, queryParams, overrides, }) {
22
25
  return super._create({
23
- path: `/v3/scheduling/bookings`,
26
+ path: (0, utils_js_1.makePathParams)('/v3/scheduling/bookings', {}),
24
27
  requestBody,
25
28
  queryParams,
26
29
  overrides,
@@ -32,7 +35,9 @@ class Bookings extends resource_js_1.Resource {
32
35
  */
33
36
  confirm({ bookingId, requestBody, queryParams, overrides, }) {
34
37
  return super._update({
35
- path: `/v3/scheduling/bookings/${bookingId}`,
38
+ path: (0, utils_js_1.makePathParams)('/v3/scheduling/bookings/{bookingId}', {
39
+ bookingId,
40
+ }),
36
41
  requestBody,
37
42
  queryParams,
38
43
  overrides,
@@ -44,7 +49,9 @@ class Bookings extends resource_js_1.Resource {
44
49
  */
45
50
  reschedule({ bookingId, requestBody, queryParams, overrides, }) {
46
51
  return super._updatePatch({
47
- path: `/v3/scheduling/bookings/${bookingId}`,
52
+ path: (0, utils_js_1.makePathParams)('/v3/scheduling/bookings/{bookingId}', {
53
+ bookingId,
54
+ }),
48
55
  requestBody,
49
56
  queryParams,
50
57
  overrides,
@@ -56,7 +63,9 @@ class Bookings extends resource_js_1.Resource {
56
63
  */
57
64
  destroy({ bookingId, requestBody, queryParams, overrides, }) {
58
65
  return super._destroy({
59
- path: `/v3/scheduling/bookings/${bookingId}`,
66
+ path: (0, utils_js_1.makePathParams)('/v3/scheduling/bookings/{bookingId}', {
67
+ bookingId,
68
+ }),
60
69
  requestBody,
61
70
  queryParams,
62
71
  overrides,
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Calendars = void 0;
4
4
  const resource_js_1 = require("./resource.js");
5
+ const utils_js_1 = require("../utils.js");
5
6
  /**
6
7
  * Nylas Calendar API
7
8
  *
@@ -17,7 +18,7 @@ class Calendars extends resource_js_1.Resource {
17
18
  return super._list({
18
19
  queryParams,
19
20
  overrides,
20
- path: `/v3/grants/${identifier}/calendars`,
21
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/calendars', { identifier }),
21
22
  });
22
23
  }
23
24
  /**
@@ -26,7 +27,10 @@ class Calendars extends resource_js_1.Resource {
26
27
  */
27
28
  find({ identifier, calendarId, overrides, }) {
28
29
  return super._find({
29
- path: `/v3/grants/${identifier}/calendars/${calendarId}`,
30
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/calendars/{calendarId}', {
31
+ identifier,
32
+ calendarId,
33
+ }),
30
34
  overrides,
31
35
  });
32
36
  }
@@ -36,7 +40,7 @@ class Calendars extends resource_js_1.Resource {
36
40
  */
37
41
  create({ identifier, requestBody, overrides, }) {
38
42
  return super._create({
39
- path: `/v3/grants/${identifier}/calendars`,
43
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/calendars', { identifier }),
40
44
  requestBody,
41
45
  overrides,
42
46
  });
@@ -47,7 +51,10 @@ class Calendars extends resource_js_1.Resource {
47
51
  */
48
52
  update({ calendarId, identifier, requestBody, overrides, }) {
49
53
  return super._update({
50
- path: `/v3/grants/${identifier}/calendars/${calendarId}`,
54
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/calendars/{calendarId}', {
55
+ identifier,
56
+ calendarId,
57
+ }),
51
58
  requestBody,
52
59
  overrides,
53
60
  });
@@ -58,7 +65,10 @@ class Calendars extends resource_js_1.Resource {
58
65
  */
59
66
  destroy({ identifier, calendarId, overrides, }) {
60
67
  return super._destroy({
61
- path: `/v3/grants/${identifier}/calendars/${calendarId}`,
68
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/calendars/{calendarId}', {
69
+ identifier,
70
+ calendarId,
71
+ }),
62
72
  overrides,
63
73
  });
64
74
  }
@@ -69,7 +79,7 @@ class Calendars extends resource_js_1.Resource {
69
79
  getAvailability({ requestBody, overrides, }) {
70
80
  return this.apiClient.request({
71
81
  method: 'POST',
72
- path: `/v3/calendars/availability`,
82
+ path: (0, utils_js_1.makePathParams)('/v3/calendars/availability', {}),
73
83
  body: requestBody,
74
84
  overrides,
75
85
  });
@@ -81,7 +91,9 @@ class Calendars extends resource_js_1.Resource {
81
91
  getFreeBusy({ identifier, requestBody, overrides, }) {
82
92
  return this.apiClient.request({
83
93
  method: 'POST',
84
- path: `/v3/grants/${identifier}/calendars/free-busy`,
94
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/calendars/free-busy', {
95
+ identifier,
96
+ }),
85
97
  body: requestBody,
86
98
  overrides,
87
99
  });
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Configurations = void 0;
4
4
  const resource_js_1 = require("./resource.js");
5
+ const utils_js_1 = require("../utils.js");
5
6
  class Configurations extends resource_js_1.Resource {
6
7
  /**
7
8
  * Return all Configurations
@@ -10,7 +11,9 @@ class Configurations extends resource_js_1.Resource {
10
11
  list({ identifier, overrides, }) {
11
12
  return super._list({
12
13
  overrides,
13
- path: `/v3/grants/${identifier}/scheduling/configurations`,
14
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/scheduling/configurations', {
15
+ identifier,
16
+ }),
14
17
  });
15
18
  }
16
19
  /**
@@ -19,7 +22,10 @@ class Configurations extends resource_js_1.Resource {
19
22
  */
20
23
  find({ identifier, configurationId, overrides, }) {
21
24
  return super._find({
22
- path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
25
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/scheduling/configurations/{configurationId}', {
26
+ identifier,
27
+ configurationId,
28
+ }),
23
29
  overrides,
24
30
  });
25
31
  }
@@ -29,7 +35,9 @@ class Configurations extends resource_js_1.Resource {
29
35
  */
30
36
  create({ identifier, requestBody, overrides, }) {
31
37
  return super._create({
32
- path: `/v3/grants/${identifier}/scheduling/configurations`,
38
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/scheduling/configurations', {
39
+ identifier,
40
+ }),
33
41
  requestBody,
34
42
  overrides,
35
43
  });
@@ -40,7 +48,10 @@ class Configurations extends resource_js_1.Resource {
40
48
  */
41
49
  update({ configurationId, identifier, requestBody, overrides, }) {
42
50
  return super._update({
43
- path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
51
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/scheduling/configurations/{configurationId}', {
52
+ identifier,
53
+ configurationId,
54
+ }),
44
55
  requestBody,
45
56
  overrides,
46
57
  });
@@ -51,7 +62,10 @@ class Configurations extends resource_js_1.Resource {
51
62
  */
52
63
  destroy({ identifier, configurationId, overrides, }) {
53
64
  return super._destroy({
54
- path: `/v3/grants/${identifier}/scheduling/configurations/${configurationId}`,
65
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/scheduling/configurations/{configurationId}', {
66
+ identifier,
67
+ configurationId,
68
+ }),
55
69
  overrides,
56
70
  });
57
71
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Connectors = void 0;
4
4
  const resource_js_1 = require("./resource.js");
5
5
  const credentials_js_1 = require("./credentials.js");
6
+ const utils_js_1 = require("../utils.js");
6
7
  class Connectors extends resource_js_1.Resource {
7
8
  /**
8
9
  * @param apiClient client The configured Nylas API client
@@ -19,7 +20,7 @@ class Connectors extends resource_js_1.Resource {
19
20
  return super._list({
20
21
  queryParams,
21
22
  overrides,
22
- path: `/v3/connectors`,
23
+ path: (0, utils_js_1.makePathParams)('/v3/connectors', {}),
23
24
  });
24
25
  }
25
26
  /**
@@ -28,7 +29,7 @@ class Connectors extends resource_js_1.Resource {
28
29
  */
29
30
  find({ provider, overrides, }) {
30
31
  return super._find({
31
- path: `/v3/connectors/${provider}`,
32
+ path: (0, utils_js_1.makePathParams)('/v3/connectors/{provider}', { provider }),
32
33
  overrides,
33
34
  });
34
35
  }
@@ -38,7 +39,7 @@ class Connectors extends resource_js_1.Resource {
38
39
  */
39
40
  create({ requestBody, overrides, }) {
40
41
  return super._create({
41
- path: `/v3/connectors`,
42
+ path: (0, utils_js_1.makePathParams)('/v3/connectors', {}),
42
43
  requestBody,
43
44
  overrides,
44
45
  });
@@ -49,7 +50,7 @@ class Connectors extends resource_js_1.Resource {
49
50
  */
50
51
  update({ provider, requestBody, overrides, }) {
51
52
  return super._update({
52
- path: `/v3/connectors/${provider}`,
53
+ path: (0, utils_js_1.makePathParams)('/v3/connectors/{provider}', { provider }),
53
54
  requestBody,
54
55
  overrides,
55
56
  });
@@ -60,7 +61,7 @@ class Connectors extends resource_js_1.Resource {
60
61
  */
61
62
  destroy({ provider, overrides, }) {
62
63
  return super._destroy({
63
- path: `/v3/connectors/${provider}`,
64
+ path: (0, utils_js_1.makePathParams)('/v3/connectors/{provider}', { provider }),
64
65
  overrides,
65
66
  });
66
67
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Contacts = void 0;
4
4
  const resource_js_1 = require("./resource.js");
5
+ const utils_js_1 = require("../utils.js");
5
6
  /**
6
7
  * Nylas Contacts API
7
8
  *
@@ -15,7 +16,7 @@ class Contacts extends resource_js_1.Resource {
15
16
  list({ identifier, queryParams, overrides, }) {
16
17
  return super._list({
17
18
  queryParams,
18
- path: `/v3/grants/${identifier}/contacts`,
19
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts', { identifier }),
19
20
  overrides,
20
21
  });
21
22
  }
@@ -25,7 +26,10 @@ class Contacts extends resource_js_1.Resource {
25
26
  */
26
27
  find({ identifier, contactId, queryParams, overrides, }) {
27
28
  return super._find({
28
- path: `/v3/grants/${identifier}/contacts/${contactId}`,
29
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts/{contactId}', {
30
+ identifier,
31
+ contactId,
32
+ }),
29
33
  queryParams,
30
34
  overrides,
31
35
  });
@@ -36,7 +40,7 @@ class Contacts extends resource_js_1.Resource {
36
40
  */
37
41
  create({ identifier, requestBody, overrides, }) {
38
42
  return super._create({
39
- path: `/v3/grants/${identifier}/contacts`,
43
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts', { identifier }),
40
44
  requestBody,
41
45
  overrides,
42
46
  });
@@ -47,7 +51,10 @@ class Contacts extends resource_js_1.Resource {
47
51
  */
48
52
  update({ identifier, contactId, requestBody, overrides, }) {
49
53
  return super._update({
50
- path: `/v3/grants/${identifier}/contacts/${contactId}`,
54
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts/{contactId}', {
55
+ identifier,
56
+ contactId,
57
+ }),
51
58
  requestBody,
52
59
  overrides,
53
60
  });
@@ -58,7 +65,10 @@ class Contacts extends resource_js_1.Resource {
58
65
  */
59
66
  destroy({ identifier, contactId, overrides, }) {
60
67
  return super._destroy({
61
- path: `/v3/grants/${identifier}/contacts/${contactId}`,
68
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts/{contactId}', {
69
+ identifier,
70
+ contactId,
71
+ }),
62
72
  overrides,
63
73
  });
64
74
  }
@@ -68,7 +78,9 @@ class Contacts extends resource_js_1.Resource {
68
78
  */
69
79
  groups({ identifier, overrides, }) {
70
80
  return super._list({
71
- path: `/v3/grants/${identifier}/contacts/groups`,
81
+ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/contacts/groups', {
82
+ identifier,
83
+ }),
72
84
  overrides,
73
85
  });
74
86
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Credentials = void 0;
4
4
  const resource_js_1 = require("./resource.js");
5
+ const utils_js_1 = require("../utils.js");
5
6
  class Credentials extends resource_js_1.Resource {
6
7
  /**
7
8
  * Return all credentials
@@ -11,7 +12,7 @@ class Credentials extends resource_js_1.Resource {
11
12
  return super._list({
12
13
  queryParams,
13
14
  overrides,
14
- path: `/v3/connectors/${provider}/creds`,
15
+ path: (0, utils_js_1.makePathParams)('/v3/connectors/{provider}/creds', { provider }),
15
16
  });
16
17
  }
17
18
  /**
@@ -20,7 +21,10 @@ class Credentials extends resource_js_1.Resource {
20
21
  */
21
22
  find({ provider, credentialsId, overrides, }) {
22
23
  return super._find({
23
- path: `/v3/connectors/${provider}/creds/${credentialsId}`,
24
+ path: (0, utils_js_1.makePathParams)('/v3/connectors/{provider}/creds/{credentialsId}', {
25
+ provider,
26
+ credentialsId,
27
+ }),
24
28
  overrides,
25
29
  });
26
30
  }
@@ -30,7 +34,7 @@ class Credentials extends resource_js_1.Resource {
30
34
  */
31
35
  create({ provider, requestBody, overrides, }) {
32
36
  return super._create({
33
- path: `/v3/connectors/${provider}/creds`,
37
+ path: (0, utils_js_1.makePathParams)('/v3/connectors/{provider}/creds', { provider }),
34
38
  requestBody,
35
39
  overrides,
36
40
  });
@@ -41,7 +45,10 @@ class Credentials extends resource_js_1.Resource {
41
45
  */
42
46
  update({ provider, credentialsId, requestBody, overrides, }) {
43
47
  return super._update({
44
- path: `/v3/connectors/${provider}/creds/${credentialsId}`,
48
+ path: (0, utils_js_1.makePathParams)('/v3/connectors/{provider}/creds/{credentialsId}', {
49
+ provider,
50
+ credentialsId,
51
+ }),
45
52
  requestBody,
46
53
  overrides,
47
54
  });
@@ -52,7 +59,10 @@ class Credentials extends resource_js_1.Resource {
52
59
  */
53
60
  destroy({ provider, credentialsId, overrides, }) {
54
61
  return super._destroy({
55
- path: `/v3/connectors/${provider}/creds/${credentialsId}`,
62
+ path: (0, utils_js_1.makePathParams)('/v3/connectors/{provider}/creds/{credentialsId}', {
63
+ provider,
64
+ credentialsId,
65
+ }),
56
66
  overrides,
57
67
  });
58
68
  }
@@ -4,6 +4,7 @@ exports.Drafts = void 0;
4
4
  const messages_js_1 = require("./messages.js");
5
5
  const resource_js_1 = require("./resource.js");
6
6
  const utils_js_1 = require("../utils.js");
7
+ const utils_js_2 = require("../utils.js");
7
8
  /**
8
9
  * Nylas Drafts API
9
10
  *
@@ -18,7 +19,7 @@ class Drafts extends resource_js_1.Resource {
18
19
  return super._list({
19
20
  queryParams,
20
21
  overrides,
21
- path: `/v3/grants/${identifier}/drafts`,
22
+ path: (0, utils_js_2.makePathParams)('/v3/grants/{identifier}/drafts', { identifier }),
22
23
  });
23
24
  }
24
25
  /**
@@ -27,7 +28,10 @@ class Drafts extends resource_js_1.Resource {
27
28
  */
28
29
  find({ identifier, draftId, overrides, }) {
29
30
  return super._find({
30
- path: `/v3/grants/${identifier}/drafts/${draftId}`,
31
+ path: (0, utils_js_2.makePathParams)('/v3/grants/{identifier}/drafts/{draftId}', {
32
+ identifier,
33
+ draftId,
34
+ }),
31
35
  overrides,
32
36
  });
33
37
  }
@@ -36,7 +40,9 @@ class Drafts extends resource_js_1.Resource {
36
40
  * @return The draft
37
41
  */
38
42
  async create({ identifier, requestBody, overrides, }) {
39
- const path = `/v3/grants/${identifier}/drafts`;
43
+ const path = (0, utils_js_2.makePathParams)('/v3/grants/{identifier}/drafts', {
44
+ identifier,
45
+ });
40
46
  // Use form data only if the attachment size is greater than 3mb
41
47
  const attachmentSize = requestBody.attachments?.reduce((total, attachment) => {
42
48
  return total + (attachment.size || 0);
@@ -68,7 +74,10 @@ class Drafts extends resource_js_1.Resource {
68
74
  * @return The updated draft
69
75
  */
70
76
  async update({ identifier, draftId, requestBody, overrides, }) {
71
- const path = `/v3/grants/${identifier}/drafts/${draftId}`;
77
+ const path = (0, utils_js_2.makePathParams)('/v3/grants/{identifier}/drafts/{draftId}', {
78
+ identifier,
79
+ draftId,
80
+ });
72
81
  // Use form data only if the attachment size is greater than 3mb
73
82
  const attachmentSize = requestBody.attachments?.reduce((total, attachment) => {
74
83
  return total + (attachment.size || 0);
@@ -101,7 +110,10 @@ class Drafts extends resource_js_1.Resource {
101
110
  */
102
111
  destroy({ identifier, draftId, overrides, }) {
103
112
  return super._destroy({
104
- path: `/v3/grants/${identifier}/drafts/${draftId}`,
113
+ path: (0, utils_js_2.makePathParams)('/v3/grants/{identifier}/drafts/{draftId}', {
114
+ identifier,
115
+ draftId,
116
+ }),
105
117
  overrides,
106
118
  });
107
119
  }
@@ -111,7 +123,10 @@ class Drafts extends resource_js_1.Resource {
111
123
  */
112
124
  send({ identifier, draftId, overrides, }) {
113
125
  return super._create({
114
- path: `/v3/grants/${identifier}/drafts/${draftId}`,
126
+ path: (0, utils_js_2.makePathParams)('/v3/grants/{identifier}/drafts/{draftId}', {
127
+ identifier,
128
+ draftId,
129
+ }),
115
130
  requestBody: {},
116
131
  overrides,
117
132
  });