nylas 7.4.0 → 7.5.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/lib/cjs/apiClient.js +17 -4
- package/lib/cjs/models/availability.js +1 -0
- package/lib/cjs/resources/folders.js +2 -1
- package/lib/cjs/version.js +1 -1
- package/lib/esm/apiClient.js +17 -4
- package/lib/esm/models/availability.js +1 -0
- package/lib/esm/resources/folders.js +2 -1
- package/lib/esm/version.js +1 -1
- package/lib/types/models/availability.d.ts +2 -1
- package/lib/types/models/events.d.ts +9 -0
- package/lib/types/models/folders.d.ts +10 -0
- package/lib/types/resources/folders.d.ts +4 -2
- package/lib/types/version.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/apiClient.js
CHANGED
|
@@ -4,6 +4,7 @@ const node_fetch_1 = require("node-fetch");
|
|
|
4
4
|
const error_js_1 = require("./models/error.js");
|
|
5
5
|
const utils_js_1 = require("./utils.js");
|
|
6
6
|
const version_js_1 = require("./version.js");
|
|
7
|
+
const change_case_1 = require("change-case");
|
|
7
8
|
/**
|
|
8
9
|
* The API client for communicating with the Nylas API
|
|
9
10
|
* @ignore Not for public use
|
|
@@ -21,8 +22,8 @@ class APIClient {
|
|
|
21
22
|
}
|
|
22
23
|
setQueryStrings(url, queryParams) {
|
|
23
24
|
if (queryParams) {
|
|
24
|
-
const
|
|
25
|
-
|
|
25
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
26
|
+
const snakeCaseKey = (0, change_case_1.snakeCase)(key);
|
|
26
27
|
if (key == 'metadataPair') {
|
|
27
28
|
// The API understands a metadata_pair filter in the form of:
|
|
28
29
|
// <key>:<value>
|
|
@@ -32,8 +33,18 @@ class APIClient {
|
|
|
32
33
|
}
|
|
33
34
|
url.searchParams.set('metadata_pair', metadataPair.join(','));
|
|
34
35
|
}
|
|
36
|
+
else if (Array.isArray(value)) {
|
|
37
|
+
for (const item of value) {
|
|
38
|
+
url.searchParams.append(snakeCaseKey, item);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else if (typeof value === 'object') {
|
|
42
|
+
for (const item in value) {
|
|
43
|
+
url.searchParams.append(snakeCaseKey, `${item}:${value[item]}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
35
46
|
else {
|
|
36
|
-
url.searchParams.set(
|
|
47
|
+
url.searchParams.set(snakeCaseKey, value);
|
|
37
48
|
}
|
|
38
49
|
}
|
|
39
50
|
}
|
|
@@ -57,7 +68,6 @@ class APIClient {
|
|
|
57
68
|
const controller = new AbortController();
|
|
58
69
|
const timeout = setTimeout(() => {
|
|
59
70
|
controller.abort();
|
|
60
|
-
throw new error_js_1.NylasSdkTimeoutError(req.url, this.timeout);
|
|
61
71
|
}, this.timeout);
|
|
62
72
|
try {
|
|
63
73
|
const response = await (0, node_fetch_1.default)(req, { signal: controller.signal });
|
|
@@ -89,6 +99,9 @@ class APIClient {
|
|
|
89
99
|
return response;
|
|
90
100
|
}
|
|
91
101
|
catch (error) {
|
|
102
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
103
|
+
throw new error_js_1.NylasSdkTimeoutError(req.url, this.timeout);
|
|
104
|
+
}
|
|
92
105
|
clearTimeout(timeout);
|
|
93
106
|
throw error;
|
|
94
107
|
}
|
|
@@ -8,4 +8,5 @@ var AvailabilityMethod;
|
|
|
8
8
|
(function (AvailabilityMethod) {
|
|
9
9
|
AvailabilityMethod["MaxFairness"] = "max-fairness";
|
|
10
10
|
AvailabilityMethod["MaxAvailability"] = "max-availability";
|
|
11
|
+
AvailabilityMethod["Collective"] = "collective";
|
|
11
12
|
})(AvailabilityMethod = exports.AvailabilityMethod || (exports.AvailabilityMethod = {}));
|
|
@@ -20,9 +20,10 @@ class Folders extends resource_js_1.Resource {
|
|
|
20
20
|
* Return all Folders
|
|
21
21
|
* @return A list of folders
|
|
22
22
|
*/
|
|
23
|
-
list({ identifier, overrides, }) {
|
|
23
|
+
list({ identifier, queryParams, overrides, }) {
|
|
24
24
|
return super._list({
|
|
25
25
|
overrides,
|
|
26
|
+
queryParams,
|
|
26
27
|
path: `/v3/grants/${identifier}/folders`,
|
|
27
28
|
});
|
|
28
29
|
}
|
package/lib/cjs/version.js
CHANGED
package/lib/esm/apiClient.js
CHANGED
|
@@ -2,6 +2,7 @@ import fetch, { Request } from 'node-fetch';
|
|
|
2
2
|
import { NylasApiError, NylasOAuthError, NylasSdkTimeoutError, } from './models/error.js';
|
|
3
3
|
import { objKeysToCamelCase, objKeysToSnakeCase } from './utils.js';
|
|
4
4
|
import { SDK_VERSION } from './version.js';
|
|
5
|
+
import { snakeCase } from 'change-case';
|
|
5
6
|
/**
|
|
6
7
|
* The API client for communicating with the Nylas API
|
|
7
8
|
* @ignore Not for public use
|
|
@@ -19,8 +20,8 @@ export default class APIClient {
|
|
|
19
20
|
}
|
|
20
21
|
setQueryStrings(url, queryParams) {
|
|
21
22
|
if (queryParams) {
|
|
22
|
-
const
|
|
23
|
-
|
|
23
|
+
for (const [key, value] of Object.entries(queryParams)) {
|
|
24
|
+
const snakeCaseKey = snakeCase(key);
|
|
24
25
|
if (key == 'metadataPair') {
|
|
25
26
|
// The API understands a metadata_pair filter in the form of:
|
|
26
27
|
// <key>:<value>
|
|
@@ -30,8 +31,18 @@ export default class APIClient {
|
|
|
30
31
|
}
|
|
31
32
|
url.searchParams.set('metadata_pair', metadataPair.join(','));
|
|
32
33
|
}
|
|
34
|
+
else if (Array.isArray(value)) {
|
|
35
|
+
for (const item of value) {
|
|
36
|
+
url.searchParams.append(snakeCaseKey, item);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else if (typeof value === 'object') {
|
|
40
|
+
for (const item in value) {
|
|
41
|
+
url.searchParams.append(snakeCaseKey, `${item}:${value[item]}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
33
44
|
else {
|
|
34
|
-
url.searchParams.set(
|
|
45
|
+
url.searchParams.set(snakeCaseKey, value);
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
48
|
}
|
|
@@ -55,7 +66,6 @@ export default class APIClient {
|
|
|
55
66
|
const controller = new AbortController();
|
|
56
67
|
const timeout = setTimeout(() => {
|
|
57
68
|
controller.abort();
|
|
58
|
-
throw new NylasSdkTimeoutError(req.url, this.timeout);
|
|
59
69
|
}, this.timeout);
|
|
60
70
|
try {
|
|
61
71
|
const response = await fetch(req, { signal: controller.signal });
|
|
@@ -87,6 +97,9 @@ export default class APIClient {
|
|
|
87
97
|
return response;
|
|
88
98
|
}
|
|
89
99
|
catch (error) {
|
|
100
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
101
|
+
throw new NylasSdkTimeoutError(req.url, this.timeout);
|
|
102
|
+
}
|
|
90
103
|
clearTimeout(timeout);
|
|
91
104
|
throw error;
|
|
92
105
|
}
|
|
@@ -5,4 +5,5 @@ export var AvailabilityMethod;
|
|
|
5
5
|
(function (AvailabilityMethod) {
|
|
6
6
|
AvailabilityMethod["MaxFairness"] = "max-fairness";
|
|
7
7
|
AvailabilityMethod["MaxAvailability"] = "max-availability";
|
|
8
|
+
AvailabilityMethod["Collective"] = "collective";
|
|
8
9
|
})(AvailabilityMethod || (AvailabilityMethod = {}));
|
|
@@ -17,9 +17,10 @@ export class Folders extends Resource {
|
|
|
17
17
|
* Return all Folders
|
|
18
18
|
* @return A list of folders
|
|
19
19
|
*/
|
|
20
|
-
list({ identifier, overrides, }) {
|
|
20
|
+
list({ identifier, queryParams, overrides, }) {
|
|
21
21
|
return super._list({
|
|
22
22
|
overrides,
|
|
23
|
+
queryParams,
|
|
23
24
|
path: `/v3/grants/${identifier}/folders`,
|
|
24
25
|
});
|
|
25
26
|
}
|
package/lib/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is generated by scripts/exportVersion.js
|
|
2
|
-
export const SDK_VERSION = '7.
|
|
2
|
+
export const SDK_VERSION = '7.5.1';
|
|
@@ -268,6 +268,11 @@ export interface ListEventQueryParams extends ListQueryParams {
|
|
|
268
268
|
* This value should be taken from the {@link NylasListResponse.nextCursor} response field.
|
|
269
269
|
*/
|
|
270
270
|
pageToken?: string;
|
|
271
|
+
/**
|
|
272
|
+
* (Google only) Filter events by event type.
|
|
273
|
+
* You can pass the query parameter multiple times to select or exclude multiple event types.
|
|
274
|
+
*/
|
|
275
|
+
eventType?: EventType[];
|
|
271
276
|
}
|
|
272
277
|
/**
|
|
273
278
|
* Interface representing of the query parameters for creating an event.
|
|
@@ -551,4 +556,8 @@ export interface EmailName {
|
|
|
551
556
|
*/
|
|
552
557
|
name?: string;
|
|
553
558
|
}
|
|
559
|
+
/**
|
|
560
|
+
* Type representing the event type to filter by.
|
|
561
|
+
*/
|
|
562
|
+
export type EventType = 'default' | 'outOfOffice' | 'focusTime' | 'workingLocation';
|
|
554
563
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ListQueryParams } from './listQueryParams.js';
|
|
1
2
|
/**
|
|
2
3
|
* Interface of a folder object from Nylas.
|
|
3
4
|
*/
|
|
@@ -75,4 +76,13 @@ export interface CreateFolderRequest {
|
|
|
75
76
|
*/
|
|
76
77
|
backgroundColor?: string;
|
|
77
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Interface representing the query parameters for listing folders.
|
|
81
|
+
*/
|
|
82
|
+
export interface ListFolderQueryParams extends ListQueryParams {
|
|
83
|
+
/**
|
|
84
|
+
* (Microsoft and EWS only.) Use the ID of a folder to find all child folders it contains.
|
|
85
|
+
*/
|
|
86
|
+
parentId?: string;
|
|
87
|
+
}
|
|
78
88
|
export type UpdateFolderRequest = Partial<CreateFolderRequest>;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { Overrides } from '../config.js';
|
|
2
|
-
import { Folder, CreateFolderRequest, UpdateFolderRequest } from '../models/folders.js';
|
|
2
|
+
import { Folder, CreateFolderRequest, UpdateFolderRequest, ListFolderQueryParams } from '../models/folders.js';
|
|
3
3
|
import { NylasBaseResponse, NylasResponse, NylasListResponse } from '../models/response.js';
|
|
4
4
|
import { Resource, AsyncListResponse } from './resource.js';
|
|
5
5
|
/**
|
|
6
6
|
* The parameters for the {@link Folders.list} method
|
|
7
7
|
* @property identifier The identifier of the grant to act upon
|
|
8
|
+
* @property queryParams The query parameters to include in the request
|
|
8
9
|
*/
|
|
9
10
|
interface ListFoldersParams {
|
|
10
11
|
identifier: string;
|
|
12
|
+
queryParams?: ListFolderQueryParams;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* The parameters for the {@link Folders.find} method
|
|
@@ -65,7 +67,7 @@ export declare class Folders extends Resource {
|
|
|
65
67
|
* Return all Folders
|
|
66
68
|
* @return A list of folders
|
|
67
69
|
*/
|
|
68
|
-
list({ identifier, overrides, }: ListFoldersParams & Overrides): AsyncListResponse<NylasListResponse<Folder>>;
|
|
70
|
+
list({ identifier, queryParams, overrides, }: ListFoldersParams & Overrides): AsyncListResponse<NylasListResponse<Folder>>;
|
|
69
71
|
/**
|
|
70
72
|
* Return a Folder
|
|
71
73
|
* @return The folder
|
package/lib/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "7.
|
|
1
|
+
export declare const SDK_VERSION = "7.5.1";
|