New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

notion-client

Package Overview
Dependencies
Maintainers
1
Versions
146
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notion-client - npm Package Compare versions

Comparing version 4.0.0 to 4.2.0

20

build/cjs/notion-api.d.ts

@@ -0,1 +1,2 @@

import { OptionsOfJSONResponseBody } from 'got';
import * as notion from 'notion-types';

@@ -19,9 +20,10 @@ import * as types from './types';

});
getPage(pageId: string, { concurrency, fetchCollections, signFileUrls }?: {
getPage(pageId: string, { concurrency, fetchCollections, signFileUrls, gotOptions }?: {
concurrency?: number;
fetchCollections?: boolean;
signFileUrls?: boolean;
gotOptions?: OptionsOfJSONResponseBody;
}): Promise<notion.ExtendedRecordMap>;
getPageRaw(pageId: string): Promise<notion.PageChunk>;
getCollectionData(collectionId: string, collectionViewId: string, { type, query, groups, limit, searchQuery, userTimeZone, userLocale, loadContentCover }?: {
getPageRaw(pageId: string, gotOptions?: OptionsOfJSONResponseBody): Promise<notion.PageChunk>;
getCollectionData(collectionId: string, collectionViewId: string, { type, query, groups, limit, searchQuery, userTimeZone, userLocale, loadContentCover, gotOptions }?: {
type?: notion.CollectionViewType;

@@ -35,11 +37,13 @@ query?: any;

loadContentCover?: boolean;
gotOptions?: OptionsOfJSONResponseBody;
}): Promise<notion.CollectionInstance>;
getUsers(userIds: string[]): Promise<notion.RecordValues<notion.User>>;
getBlocks(blockIds: string[]): Promise<notion.PageChunk>;
getSignedFileUrls(urls: types.SignedUrlRequest[]): Promise<types.SignedUrlResponse>;
search(params: notion.SearchParams): Promise<notion.SearchResults>;
fetch<T>({ endpoint, body }: {
getUsers(userIds: string[], gotOptions?: OptionsOfJSONResponseBody): Promise<notion.RecordValues<notion.User>>;
getBlocks(blockIds: string[], gotOptions?: OptionsOfJSONResponseBody): Promise<notion.PageChunk>;
getSignedFileUrls(urls: types.SignedUrlRequest[], gotOptions?: OptionsOfJSONResponseBody): Promise<types.SignedUrlResponse>;
search(params: notion.SearchParams, gotOptions?: OptionsOfJSONResponseBody): Promise<notion.SearchResults>;
fetch<T>({ endpoint, body, gotOptions }: {
endpoint: string;
body: object;
gotOptions?: OptionsOfJSONResponseBody;
}): Promise<T>;
}

65

build/cjs/notion-api.js

@@ -54,4 +54,6 @@ "use strict";

exports.NotionAPI = void 0;
var node_fetch_1 = __importDefault(require("node-fetch"));
// import fetch from 'node-fetch'
var got_1 = __importDefault(require("got"));
var p_map_1 = __importDefault(require("p-map"));
// import pRetry from 'p-retry'
var notion_utils_1 = require("notion-utils");

@@ -72,3 +74,3 @@ /**

var _b, _c, _d;
var _e = _a === void 0 ? {} : _a, _f = _e.concurrency, concurrency = _f === void 0 ? 3 : _f, _g = _e.fetchCollections, fetchCollections = _g === void 0 ? true : _g, _h = _e.signFileUrls, signFileUrls = _h === void 0 ? true : _h;
var _e = _a === void 0 ? {} : _a, _f = _e.concurrency, concurrency = _f === void 0 ? 3 : _f, _g = _e.fetchCollections, fetchCollections = _g === void 0 ? true : _g, _h = _e.signFileUrls, signFileUrls = _h === void 0 ? true : _h, gotOptions = _e.gotOptions;
return __awaiter(this, void 0, void 0, function () {

@@ -79,3 +81,3 @@ var page, recordMap, pendingBlockIds, newBlocks, contentBlockIds, allCollectionInstances, allFileInstances, signedUrls, i, file, signedUrl, err_1;

switch (_j.label) {
case 0: return [4 /*yield*/, this.getPageRaw(pageId)];
case 0: return [4 /*yield*/, this.getPageRaw(pageId, gotOptions)];
case 1:

@@ -102,3 +104,3 @@ page = _j.sent();

}
return [4 /*yield*/, this.getBlocks(pendingBlockIds).then(function (res) { return res.recordMap.block; })];
return [4 /*yield*/, this.getBlocks(pendingBlockIds, gotOptions).then(function (res) { return res.recordMap.block; })];
case 3:

@@ -141,3 +143,4 @@ newBlocks = _j.sent();

query: (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query2) || (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query),
groups: ((_c = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _c === void 0 ? void 0 : _c.board_groups2) || ((_d = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _d === void 0 ? void 0 : _d.board_groups)
groups: ((_c = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _c === void 0 ? void 0 : _c.board_groups2) || ((_d = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _d === void 0 ? void 0 : _d.board_groups),
gotOptions: gotOptions
})

@@ -203,3 +206,3 @@ // await fs.writeFile(

_j.trys.push([7, 9, , 10]);
return [4 /*yield*/, this.getSignedFileUrls(allFileInstances)];
return [4 /*yield*/, this.getSignedFileUrls(allFileInstances, gotOptions)];
case 8:

@@ -224,3 +227,3 @@ signedUrls = (_j.sent()).signedUrls;

};
NotionAPI.prototype.getPageRaw = function (pageId) {
NotionAPI.prototype.getPageRaw = function (pageId, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -241,3 +244,4 @@ var parsedPageId;

verticalColumns: false
}
},
gotOptions: gotOptions
})];

@@ -248,3 +252,3 @@ });

NotionAPI.prototype.getCollectionData = function (collectionId, collectionViewId, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.type, type = _c === void 0 ? 'table' : _c, _d = _b.query, query = _d === void 0 ? { aggregations: [{ property: 'title', aggregator: 'count' }] } : _d, _e = _b.groups, groups = _e === void 0 ? undefined : _e, _f = _b.limit, limit = _f === void 0 ? 999999 : _f, _g = _b.searchQuery, searchQuery = _g === void 0 ? '' : _g, _h = _b.userTimeZone, userTimeZone = _h === void 0 ? this._userTimeZone : _h, _j = _b.userLocale, userLocale = _j === void 0 ? this._userLocale : _j, _k = _b.loadContentCover, loadContentCover = _k === void 0 ? true : _k;
var _b = _a === void 0 ? {} : _a, _c = _b.type, type = _c === void 0 ? 'table' : _c, _d = _b.query, query = _d === void 0 ? { aggregations: [{ property: 'title', aggregator: 'count' }] } : _d, _e = _b.groups, groups = _e === void 0 ? undefined : _e, _f = _b.limit, limit = _f === void 0 ? 999999 : _f, _g = _b.searchQuery, searchQuery = _g === void 0 ? '' : _g, _h = _b.userTimeZone, userTimeZone = _h === void 0 ? this._userTimeZone : _h, _j = _b.userLocale, userLocale = _j === void 0 ? this._userLocale : _j, _k = _b.loadContentCover, loadContentCover = _k === void 0 ? true : _k, gotOptions = _b.gotOptions;
return __awaiter(this, void 0, void 0, function () {

@@ -281,3 +285,4 @@ var loader;

loader: loader
}
},
gotOptions: gotOptions
})];

@@ -287,3 +292,3 @@ });

};
NotionAPI.prototype.getUsers = function (userIds) {
NotionAPI.prototype.getUsers = function (userIds, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -295,3 +300,4 @@ return __generator(this, function (_a) {

requests: userIds.map(function (id) { return ({ id: id, table: 'notion_user' }); })
}
},
gotOptions: gotOptions
})];

@@ -301,3 +307,3 @@ });

};
NotionAPI.prototype.getBlocks = function (blockIds) {
NotionAPI.prototype.getBlocks = function (blockIds, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -314,3 +320,4 @@ return __generator(this, function (_a) {

}
}
},
gotOptions: gotOptions
})];

@@ -320,3 +327,3 @@ });

};
NotionAPI.prototype.getSignedFileUrls = function (urls) {
NotionAPI.prototype.getSignedFileUrls = function (urls, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -328,3 +335,4 @@ return __generator(this, function (_a) {

urls: urls
}
},
gotOptions: gotOptions
})];

@@ -334,3 +342,3 @@ });

};
NotionAPI.prototype.search = function (params) {
NotionAPI.prototype.search = function (params, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -348,3 +356,4 @@ return __generator(this, function (_a) {

filters: __assign({ isDeletedOnly: false, excludeTemplates: true, isNavigableOnly: true, requireEditPermissions: false, ancestors: [], createdBy: [], editedBy: [], lastEditedTime: {}, createdTime: {} }, params.filters)
}
},
gotOptions: gotOptions
})];

@@ -355,9 +364,7 @@ });

NotionAPI.prototype.fetch = function (_a) {
var endpoint = _a.endpoint, body = _a.body;
var endpoint = _a.endpoint, body = _a.body, gotOptions = _a.gotOptions;
return __awaiter(this, void 0, void 0, function () {
var headers, url;
return __generator(this, function (_b) {
headers = {
'Content-Type': 'application/json'
};
headers = __assign(__assign({}, gotOptions === null || gotOptions === void 0 ? void 0 : gotOptions.headers), { 'Content-Type': 'application/json' });
if (this._authToken) {

@@ -370,7 +377,11 @@ headers.cookie = "token_v2=" + this._authToken;

url = this._apiBaseUrl + "/" + endpoint;
return [2 /*return*/, node_fetch_1["default"](url, {
method: 'post',
body: JSON.stringify(body),
headers: headers
}).then(function (res) { return res.json(); })];
return [2 /*return*/, got_1["default"]
.post(url, __assign(__assign({}, gotOptions), { json: body, headers: headers }))
.json()
// return fetch(url, {
// method: 'post',
// body: JSON.stringify(body),
// headers
// }).then((res) => res.json())
];
});

@@ -377,0 +388,0 @@ });

@@ -0,1 +1,2 @@

import { OptionsOfJSONResponseBody } from 'got';
import * as notion from 'notion-types';

@@ -19,9 +20,10 @@ import * as types from './types';

});
getPage(pageId: string, { concurrency, fetchCollections, signFileUrls }?: {
getPage(pageId: string, { concurrency, fetchCollections, signFileUrls, gotOptions }?: {
concurrency?: number;
fetchCollections?: boolean;
signFileUrls?: boolean;
gotOptions?: OptionsOfJSONResponseBody;
}): Promise<notion.ExtendedRecordMap>;
getPageRaw(pageId: string): Promise<notion.PageChunk>;
getCollectionData(collectionId: string, collectionViewId: string, { type, query, groups, limit, searchQuery, userTimeZone, userLocale, loadContentCover }?: {
getPageRaw(pageId: string, gotOptions?: OptionsOfJSONResponseBody): Promise<notion.PageChunk>;
getCollectionData(collectionId: string, collectionViewId: string, { type, query, groups, limit, searchQuery, userTimeZone, userLocale, loadContentCover, gotOptions }?: {
type?: notion.CollectionViewType;

@@ -35,11 +37,13 @@ query?: any;

loadContentCover?: boolean;
gotOptions?: OptionsOfJSONResponseBody;
}): Promise<notion.CollectionInstance>;
getUsers(userIds: string[]): Promise<notion.RecordValues<notion.User>>;
getBlocks(blockIds: string[]): Promise<notion.PageChunk>;
getSignedFileUrls(urls: types.SignedUrlRequest[]): Promise<types.SignedUrlResponse>;
search(params: notion.SearchParams): Promise<notion.SearchResults>;
fetch<T>({ endpoint, body }: {
getUsers(userIds: string[], gotOptions?: OptionsOfJSONResponseBody): Promise<notion.RecordValues<notion.User>>;
getBlocks(blockIds: string[], gotOptions?: OptionsOfJSONResponseBody): Promise<notion.PageChunk>;
getSignedFileUrls(urls: types.SignedUrlRequest[], gotOptions?: OptionsOfJSONResponseBody): Promise<types.SignedUrlResponse>;
search(params: notion.SearchParams, gotOptions?: OptionsOfJSONResponseBody): Promise<notion.SearchResults>;
fetch<T>({ endpoint, body, gotOptions }: {
endpoint: string;
body: object;
gotOptions?: OptionsOfJSONResponseBody;
}): Promise<T>;
}

@@ -48,4 +48,6 @@ var __assign = (this && this.__assign) || function () {

};
import fetch from 'node-fetch';
// import fetch from 'node-fetch'
import got from 'got';
import pMap from 'p-map';
// import pRetry from 'p-retry'
import { parsePageId, getPageContentBlockIds, uuidToId } from 'notion-utils';

@@ -66,3 +68,3 @@ /**

var _b, _c, _d;
var _e = _a === void 0 ? {} : _a, _f = _e.concurrency, concurrency = _f === void 0 ? 3 : _f, _g = _e.fetchCollections, fetchCollections = _g === void 0 ? true : _g, _h = _e.signFileUrls, signFileUrls = _h === void 0 ? true : _h;
var _e = _a === void 0 ? {} : _a, _f = _e.concurrency, concurrency = _f === void 0 ? 3 : _f, _g = _e.fetchCollections, fetchCollections = _g === void 0 ? true : _g, _h = _e.signFileUrls, signFileUrls = _h === void 0 ? true : _h, gotOptions = _e.gotOptions;
return __awaiter(this, void 0, void 0, function () {

@@ -73,3 +75,3 @@ var page, recordMap, pendingBlockIds, newBlocks, contentBlockIds, allCollectionInstances, allFileInstances, signedUrls, i, file, signedUrl, err_1;

switch (_j.label) {
case 0: return [4 /*yield*/, this.getPageRaw(pageId)];
case 0: return [4 /*yield*/, this.getPageRaw(pageId, gotOptions)];
case 1:

@@ -96,3 +98,3 @@ page = _j.sent();

}
return [4 /*yield*/, this.getBlocks(pendingBlockIds).then(function (res) { return res.recordMap.block; })];
return [4 /*yield*/, this.getBlocks(pendingBlockIds, gotOptions).then(function (res) { return res.recordMap.block; })];
case 3:

@@ -135,3 +137,4 @@ newBlocks = _j.sent();

query: (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query2) || (collectionView === null || collectionView === void 0 ? void 0 : collectionView.query),
groups: ((_c = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _c === void 0 ? void 0 : _c.board_groups2) || ((_d = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _d === void 0 ? void 0 : _d.board_groups)
groups: ((_c = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _c === void 0 ? void 0 : _c.board_groups2) || ((_d = collectionView === null || collectionView === void 0 ? void 0 : collectionView.format) === null || _d === void 0 ? void 0 : _d.board_groups),
gotOptions: gotOptions
})

@@ -197,3 +200,3 @@ // await fs.writeFile(

_j.trys.push([7, 9, , 10]);
return [4 /*yield*/, this.getSignedFileUrls(allFileInstances)];
return [4 /*yield*/, this.getSignedFileUrls(allFileInstances, gotOptions)];
case 8:

@@ -218,3 +221,3 @@ signedUrls = (_j.sent()).signedUrls;

};
NotionAPI.prototype.getPageRaw = function (pageId) {
NotionAPI.prototype.getPageRaw = function (pageId, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -235,3 +238,4 @@ var parsedPageId;

verticalColumns: false
}
},
gotOptions: gotOptions
})];

@@ -242,3 +246,3 @@ });

NotionAPI.prototype.getCollectionData = function (collectionId, collectionViewId, _a) {
var _b = _a === void 0 ? {} : _a, _c = _b.type, type = _c === void 0 ? 'table' : _c, _d = _b.query, query = _d === void 0 ? { aggregations: [{ property: 'title', aggregator: 'count' }] } : _d, _e = _b.groups, groups = _e === void 0 ? undefined : _e, _f = _b.limit, limit = _f === void 0 ? 999999 : _f, _g = _b.searchQuery, searchQuery = _g === void 0 ? '' : _g, _h = _b.userTimeZone, userTimeZone = _h === void 0 ? this._userTimeZone : _h, _j = _b.userLocale, userLocale = _j === void 0 ? this._userLocale : _j, _k = _b.loadContentCover, loadContentCover = _k === void 0 ? true : _k;
var _b = _a === void 0 ? {} : _a, _c = _b.type, type = _c === void 0 ? 'table' : _c, _d = _b.query, query = _d === void 0 ? { aggregations: [{ property: 'title', aggregator: 'count' }] } : _d, _e = _b.groups, groups = _e === void 0 ? undefined : _e, _f = _b.limit, limit = _f === void 0 ? 999999 : _f, _g = _b.searchQuery, searchQuery = _g === void 0 ? '' : _g, _h = _b.userTimeZone, userTimeZone = _h === void 0 ? this._userTimeZone : _h, _j = _b.userLocale, userLocale = _j === void 0 ? this._userLocale : _j, _k = _b.loadContentCover, loadContentCover = _k === void 0 ? true : _k, gotOptions = _b.gotOptions;
return __awaiter(this, void 0, void 0, function () {

@@ -275,3 +279,4 @@ var loader;

loader: loader
}
},
gotOptions: gotOptions
})];

@@ -281,3 +286,3 @@ });

};
NotionAPI.prototype.getUsers = function (userIds) {
NotionAPI.prototype.getUsers = function (userIds, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -289,3 +294,4 @@ return __generator(this, function (_a) {

requests: userIds.map(function (id) { return ({ id: id, table: 'notion_user' }); })
}
},
gotOptions: gotOptions
})];

@@ -295,3 +301,3 @@ });

};
NotionAPI.prototype.getBlocks = function (blockIds) {
NotionAPI.prototype.getBlocks = function (blockIds, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -308,3 +314,4 @@ return __generator(this, function (_a) {

}
}
},
gotOptions: gotOptions
})];

@@ -314,3 +321,3 @@ });

};
NotionAPI.prototype.getSignedFileUrls = function (urls) {
NotionAPI.prototype.getSignedFileUrls = function (urls, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -322,3 +329,4 @@ return __generator(this, function (_a) {

urls: urls
}
},
gotOptions: gotOptions
})];

@@ -328,3 +336,3 @@ });

};
NotionAPI.prototype.search = function (params) {
NotionAPI.prototype.search = function (params, gotOptions) {
return __awaiter(this, void 0, void 0, function () {

@@ -342,3 +350,4 @@ return __generator(this, function (_a) {

filters: __assign({ isDeletedOnly: false, excludeTemplates: true, isNavigableOnly: true, requireEditPermissions: false, ancestors: [], createdBy: [], editedBy: [], lastEditedTime: {}, createdTime: {} }, params.filters)
}
},
gotOptions: gotOptions
})];

@@ -349,9 +358,7 @@ });

NotionAPI.prototype.fetch = function (_a) {
var endpoint = _a.endpoint, body = _a.body;
var endpoint = _a.endpoint, body = _a.body, gotOptions = _a.gotOptions;
return __awaiter(this, void 0, void 0, function () {
var headers, url;
return __generator(this, function (_b) {
headers = {
'Content-Type': 'application/json'
};
headers = __assign(__assign({}, gotOptions === null || gotOptions === void 0 ? void 0 : gotOptions.headers), { 'Content-Type': 'application/json' });
if (this._authToken) {

@@ -364,7 +371,11 @@ headers.cookie = "token_v2=" + this._authToken;

url = this._apiBaseUrl + "/" + endpoint;
return [2 /*return*/, fetch(url, {
method: 'post',
body: JSON.stringify(body),
headers: headers
}).then(function (res) { return res.json(); })];
return [2 /*return*/, got
.post(url, __assign(__assign({}, gotOptions), { json: body, headers: headers }))
.json()
// return fetch(url, {
// method: 'post',
// body: JSON.stringify(body),
// headers
// }).then((res) => res.json())
];
});

@@ -371,0 +382,0 @@ });

{
"name": "notion-client",
"version": "4.0.0",
"version": "4.2.0",
"description": "Robust TypeScript client for the unofficial Notion API.",

@@ -18,5 +18,5 @@ "repository": "NotionX/react-notion-x",

"dependencies": {
"node-fetch": "^2.6.1",
"got": "^11.8.1",
"notion-types": "^4.0.0",
"notion-utils": "^4.0.0",
"notion-utils": "^4.2.0",
"p-map": "^4.0.0"

@@ -28,3 +28,3 @@ },

},
"gitHead": "84d59d5ffd98d8a363916f9d3fd12794450cb6ea"
"gitHead": "af37c43765cce2fca1827ce154e169af047c04cc"
}

@@ -1,3 +0,5 @@

import fetch from 'node-fetch'
// import fetch from 'node-fetch'
import got, { OptionsOfJSONResponseBody } from 'got'
import pMap from 'p-map'
// import pRetry from 'p-retry'

@@ -44,3 +46,4 @@ import { parsePageId, getPageContentBlockIds, uuidToId } from 'notion-utils'

fetchCollections = true,
signFileUrls = true
signFileUrls = true,
gotOptions
}: {

@@ -50,5 +53,6 @@ concurrency?: number

signFileUrls?: boolean
gotOptions?: OptionsOfJSONResponseBody
} = {}
): Promise<notion.ExtendedRecordMap> {
const page = await this.getPageRaw(pageId)
const page = await this.getPageRaw(pageId, gotOptions)
const recordMap = page?.recordMap as notion.ExtendedRecordMap

@@ -80,3 +84,3 @@

const newBlocks = await this.getBlocks(pendingBlockIds).then(
const newBlocks = await this.getBlocks(pendingBlockIds, gotOptions).then(
(res) => res.recordMap.block

@@ -130,3 +134,4 @@ )

collectionView?.format?.board_groups2 ||
collectionView?.format?.board_groups
collectionView?.format?.board_groups,
gotOptions
}

@@ -208,3 +213,6 @@ )

try {
const { signedUrls } = await this.getSignedFileUrls(allFileInstances)
const { signedUrls } = await this.getSignedFileUrls(
allFileInstances,
gotOptions
)

@@ -228,3 +236,6 @@ if (signedUrls.length === allFileInstances.length) {

public async getPageRaw(pageId: string) {
public async getPageRaw(
pageId: string,
gotOptions?: OptionsOfJSONResponseBody
) {
const parsedPageId = parsePageId(pageId)

@@ -244,3 +255,4 @@

verticalColumns: false
}
},
gotOptions
})

@@ -260,3 +272,4 @@ }

userLocale = this._userLocale,
loadContentCover = true
loadContentCover = true,
gotOptions
}: {

@@ -271,2 +284,3 @@ type?: notion.CollectionViewType

loadContentCover?: boolean
gotOptions?: OptionsOfJSONResponseBody
} = {}

@@ -306,7 +320,11 @@ ) {

loader
}
},
gotOptions
})
}
public async getUsers(userIds: string[]) {
public async getUsers(
userIds: string[],
gotOptions?: OptionsOfJSONResponseBody
) {
return this.fetch<notion.RecordValues<notion.User>>({

@@ -316,7 +334,11 @@ endpoint: 'getRecordValues',

requests: userIds.map((id) => ({ id, table: 'notion_user' }))
}
},
gotOptions
})
}
public async getBlocks(blockIds: string[]) {
public async getBlocks(
blockIds: string[],
gotOptions?: OptionsOfJSONResponseBody
) {
return this.fetch<notion.PageChunk>({

@@ -334,7 +356,11 @@ endpoint: 'syncRecordValues',

}
}
},
gotOptions
})
}
public async getSignedFileUrls(urls: types.SignedUrlRequest[]) {
public async getSignedFileUrls(
urls: types.SignedUrlRequest[],
gotOptions?: OptionsOfJSONResponseBody
) {
return this.fetch<types.SignedUrlResponse>({

@@ -344,7 +370,11 @@ endpoint: 'getSignedFileUrls',

urls
}
},
gotOptions
})
}
public async search(params: notion.SearchParams) {
public async search(
params: notion.SearchParams,
gotOptions?: OptionsOfJSONResponseBody
) {
return this.fetch<notion.SearchResults>({

@@ -371,3 +401,4 @@ endpoint: 'search',

}
}
},
gotOptions
})

@@ -378,8 +409,11 @@ }

endpoint,
body
body,
gotOptions
}: {
endpoint: string
body: object
gotOptions?: OptionsOfJSONResponseBody
}): Promise<T> {
const headers: any = {
...gotOptions?.headers,
'Content-Type': 'application/json'

@@ -398,8 +432,16 @@ }

return fetch(url, {
method: 'post',
body: JSON.stringify(body),
headers
}).then((res) => res.json())
return got
.post(url, {
...gotOptions,
json: body,
headers
})
.json()
// return fetch(url, {
// method: 'post',
// body: JSON.stringify(body),
// headers
// }).then((res) => res.json())
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc