Skip to content

Commit ebe2722

Browse files
author
SDKgen-Bot
committed
Operation "user.get.description" has changed from "" to "Retrieves a User using the ID specified."
Operation "database.get.description" has changed from "" to "Retrieves a database object — information that describes the structure and columns of a database — for a provided database ID. The response adheres to any limits to an integration’s capabilities." Operation "page.get.description" has changed from "" to "Retrieves a Page object using the ID specified." Operation "page.create.description" has changed from "" to "Creates a new page that is a child of an existing page or database."
1 parent 66cf075 commit ebe2722

File tree

5 files changed

+41
-21
lines changed

5 files changed

+41
-21
lines changed

sdkgen.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"sdkfabric/notion":{"baseUrl":"https://api.notion.com","security":{"type":"httpBearer"},"operations":{"user.getAll":{"path":"/v1/users","method":"GET","return":{"code":200,"schema":{"$ref":"User_Collection"}},"arguments":{"Notion-Version":{"in":"header","schema":{"type":"string"}},"start_cursor":{"in":"query","schema":{"type":"string"}},"page_size":{"in":"query","schema":{"type":"integer"}}},"throws":[],"description":"Returns a paginated list of Users for the workspace. The response may contain fewer than page_size of results.","stability":1,"security":[],"authorization":true,"tags":[]},"user.get":{"path":"/v1/users/:user_id","method":"GET","return":{"code":200,"schema":{"$ref":"User"}},"arguments":{"Notion-Version":{"in":"header","schema":{"type":"string"}},"user_id":{"in":"path","schema":{"type":"string"}}},"throws":[],"description":"","stability":1,"security":[],"authorization":true,"tags":[]},"database.get":{"path":"/v1/databases/:database_id","method":"GET","return":{"code":200,"schema":{"$ref":"Database"}},"arguments":{"Notion-Version":{"in":"header","schema":{"type":"string"}},"database_id":{"in":"path","schema":{"type":"string"}}},"throws":[],"description":"","stability":1,"security":[],"authorization":true,"tags":[]},"page.get":{"path":"/v1/pages/:page_id","method":"GET","return":{"code":200,"schema":{"$ref":"Page"}},"arguments":{"page_id":{"in":"path","schema":{"type":"string"}}},"throws":[],"description":"","stability":1,"security":[],"authorization":true,"tags":[]},"page.create":{"path":"/v1/pages","method":"POST","return":{"code":200,"schema":{"$ref":"Page"}},"arguments":{"payload":{"in":"body","schema":{"$ref":"Page"}}},"throws":[],"description":"","stability":1,"security":[],"authorization":true,"tags":[]}},"definitions":{"Block":{"description":"","type":"object","properties":{"object":{"description":"","type":"string"},"id":{"description":"","type":"string"},"parent":{"description":"","$ref":"Page"},"created_time":{"description":"","format":"date-time","type":"string"},"last_edited_time":{"description":"","format":"date-time","type":"string"},"created_by":{"description":"","$ref":"User"},"last_edited_by":{"description":"","$ref":"User"},"has_children":{"description":"","type":"boolean"},"in_trash":{"description":"","type":"boolean"},"type":{"description":"","type":"string"}}},"Comment":{"description":"","type":"object","properties":{"parent":{"description":"","$ref":"Page_Id"},"discussion_id":{"description":"","type":"string"},"rich_text":{"description":"","$ref":"Rich_Text"}}},"Database":{"description":"","type":"object","properties":{"object":{"description":"","type":"string"},"id":{"description":"","type":"string"},"created_time":{"description":"","format":"date-time","type":"string"},"last_edited_time":{"description":"","format":"date-time","type":"string"},"icon":{"description":"","$ref":"Database_Icon"},"cover":{"description":"","$ref":"Database_Cover"},"url":{"description":"","type":"string"},"title":{"description":"","type":"array","items":{"$ref":"Database_Title"}},"description":{"description":"","type":"array","items":{"$ref":"Database_Title"}}}},"Database_Annotations":{"description":"","type":"object","properties":{"bold":{"description":"","type":"boolean"},"italic":{"description":"","type":"boolean"},"strikethrough":{"description":"","type":"boolean"},"underline":{"description":"","type":"boolean"},"code":{"description":"","type":"boolean"},"color":{"description":"","type":"string"}}},"Database_Cover":{"description":"","type":"object","properties":{"type":{"description":"","type":"string"},"external":{"description":"","type":"any"}}},"Database_Icon":{"description":"","type":"object","properties":{"type":{"description":"","type":"string"},"emoji":{"description":"","type":"string"}}},"Database_Id":{"description":"","type":"object","properties":{"database_id":{"description":"","type":"string"}}},"Database_Text":{"description":"","type":"object","properties":{"content":{"description":"","type":"string"},"link":{"description":"","type":"string"}}},"Database_Title":{"description":"","type":"object","properties":{"type":{"description":"","type":"string"},"text":{"description":"","type":"string"},"annotations":{"description":"","$ref":"Database_Annotations"},"plain_text":{"description":"","type":"string"},"href":{"description":"","type":"string"}}},"Page":{"description":"","type":"object","properties":{"object":{"description":"","type":"string"},"id":{"description":"","type":"string"},"created_time":{"description":"","format":"date-time","type":"string"},"last_edited_time":{"description":"","format":"date-time","type":"string"},"created_by":{"description":"","$ref":"User"},"last_edited_by":{"description":"","$ref":"User"},"cover":{"description":"","type":"string"},"icon":{"description":"","type":"string"},"parent":{"description":"","oneOf":[{"$ref":"Database_Id"},{"$ref":"Page_Id"}]},"in_trash":{"description":"","type":"boolean"},"properties":{"description":"","type":"object","additionalProperties":{"type":"any"}},"url":{"description":"","type":"string"},"public_url":{"description":"","type":"string"}}},"Page_Id":{"description":"","type":"object","properties":{"page_id":{"description":"","type":"string"}}},"Person":{"description":"","type":"object","properties":{"email":{"description":"","type":"string"}}},"Rich_Text":{"description":"","type":"object","properties":{"type":{"description":"","type":"string"},"annotations":{"description":"","$ref":"Rich_Text_Annotation"},"plain_text":{"description":"","type":"string"},"href":{"description":"","type":"string"}}},"Rich_Text_Annotation":{"description":"","type":"object","properties":{"bold":{"description":"","type":"boolean"},"italic":{"description":"","type":"boolean"},"strikethrough":{"description":"","type":"boolean"},"underline":{"description":"","type":"boolean"},"code":{"description":"","type":"boolean"},"color":{"description":"","type":"string"}}},"User":{"description":"","type":"object","properties":{"object":{"description":"","type":"string"},"id":{"description":"","type":"string"},"type":{"description":"","type":"string"},"person":{"description":"","$ref":"Person"},"name":{"description":"","type":"string"},"avatar_url":{"description":"","type":"string"}}},"User_Collection":{"description":"","type":"object","properties":{"results":{"description":"","type":"array","items":{"$ref":"User"}},"next_cursor":{"description":"","type":"string"},"has_more":{"description":"","type":"boolean"}}}}}}
1+
{"sdkfabric/notion":{"baseUrl":"https://api.notion.com","security":{"type":"httpBearer"},"operations":{"user.getAll":{"path":"/v1/users","method":"GET","return":{"code":200,"schema":{"$ref":"User_Collection"}},"arguments":{"Notion-Version":{"in":"header","schema":{"type":"string"}},"start_cursor":{"in":"query","schema":{"type":"string"}},"page_size":{"in":"query","schema":{"type":"integer"}}},"throws":[],"description":"Returns a paginated list of Users for the workspace. The response may contain fewer than page_size of results.","stability":1,"security":[],"authorization":true,"tags":[]},"user.get":{"path":"/v1/users/:user_id","method":"GET","return":{"code":200,"schema":{"$ref":"User"}},"arguments":{"Notion-Version":{"in":"header","schema":{"type":"string"}},"user_id":{"in":"path","schema":{"type":"string"}}},"throws":[],"description":"Retrieves a User using the ID specified.","stability":1,"security":[],"authorization":true,"tags":[]},"database.get":{"path":"/v1/databases/:database_id","method":"GET","return":{"code":200,"schema":{"$ref":"Database"}},"arguments":{"Notion-Version":{"in":"header","schema":{"type":"string"}},"database_id":{"in":"path","schema":{"type":"string"}}},"throws":[],"description":"Retrieves a database object \u2014 information that describes the structure and columns of a database \u2014 for a provided database ID. The response adheres to any limits to an integration\u2019s capabilities.","stability":1,"security":[],"authorization":true,"tags":[]},"page.get":{"path":"/v1/pages/:page_id","method":"GET","return":{"code":200,"schema":{"$ref":"Page"}},"arguments":{"page_id":{"in":"path","schema":{"type":"string"}}},"throws":[],"description":"Retrieves a Page object using the ID specified.","stability":1,"security":[],"authorization":true,"tags":[]},"page.create":{"path":"/v1/pages","method":"POST","return":{"code":200,"schema":{"$ref":"Page"}},"arguments":{"payload":{"in":"body","schema":{"$ref":"Page"}}},"throws":[],"description":"Creates a new page that is a child of an existing page or database.","stability":1,"security":[],"authorization":true,"tags":[]}},"definitions":{"Block":{"description":"","type":"object","properties":{"object":{"description":"","type":"string"},"id":{"description":"","type":"string"},"parent":{"description":"","$ref":"Page"},"created_time":{"description":"","format":"date-time","type":"string"},"last_edited_time":{"description":"","format":"date-time","type":"string"},"created_by":{"description":"","$ref":"User"},"last_edited_by":{"description":"","$ref":"User"},"has_children":{"description":"","type":"boolean"},"in_trash":{"description":"","type":"boolean"},"type":{"description":"","type":"string"}}},"Comment":{"description":"","type":"object","properties":{"parent":{"description":"","$ref":"Page_Id"},"discussion_id":{"description":"","type":"string"},"rich_text":{"description":"","$ref":"Rich_Text"}}},"Database":{"description":"","type":"object","properties":{"object":{"description":"","type":"string"},"id":{"description":"","type":"string"},"created_time":{"description":"","format":"date-time","type":"string"},"last_edited_time":{"description":"","format":"date-time","type":"string"},"icon":{"description":"","$ref":"Database_Icon"},"cover":{"description":"","$ref":"Database_Cover"},"url":{"description":"","type":"string"},"title":{"description":"","type":"array","items":{"$ref":"Database_Title"}},"description":{"description":"","type":"array","items":{"$ref":"Database_Title"}}}},"Database_Annotations":{"description":"","type":"object","properties":{"bold":{"description":"","type":"boolean"},"italic":{"description":"","type":"boolean"},"strikethrough":{"description":"","type":"boolean"},"underline":{"description":"","type":"boolean"},"code":{"description":"","type":"boolean"},"color":{"description":"","type":"string"}}},"Database_Cover":{"description":"","type":"object","properties":{"type":{"description":"","type":"string"},"external":{"description":"","type":"any"}}},"Database_Icon":{"description":"","type":"object","properties":{"type":{"description":"","type":"string"},"emoji":{"description":"","type":"string"}}},"Database_Id":{"description":"","type":"object","properties":{"database_id":{"description":"","type":"string"}}},"Database_Text":{"description":"","type":"object","properties":{"content":{"description":"","type":"string"},"link":{"description":"","type":"string"}}},"Database_Title":{"description":"","type":"object","properties":{"type":{"description":"","type":"string"},"text":{"description":"","type":"string"},"annotations":{"description":"","$ref":"Database_Annotations"},"plain_text":{"description":"","type":"string"},"href":{"description":"","type":"string"}}},"Page":{"description":"","type":"object","properties":{"object":{"description":"","type":"string"},"id":{"description":"","type":"string"},"created_time":{"description":"","format":"date-time","type":"string"},"last_edited_time":{"description":"","format":"date-time","type":"string"},"created_by":{"description":"","$ref":"User"},"last_edited_by":{"description":"","$ref":"User"},"cover":{"description":"","type":"string"},"icon":{"description":"","type":"string"},"parent":{"description":"","oneOf":[{"$ref":"Database_Id"},{"$ref":"Page_Id"}]},"in_trash":{"description":"","type":"boolean"},"properties":{"description":"","type":"object","additionalProperties":{"type":"any"}},"url":{"description":"","type":"string"},"public_url":{"description":"","type":"string"}}},"Page_Id":{"description":"","type":"object","properties":{"page_id":{"description":"","type":"string"}}},"Person":{"description":"","type":"object","properties":{"email":{"description":"","type":"string"}}},"Rich_Text":{"description":"","type":"object","properties":{"type":{"description":"","type":"string"},"annotations":{"description":"","$ref":"Rich_Text_Annotation"},"plain_text":{"description":"","type":"string"},"href":{"description":"","type":"string"}}},"Rich_Text_Annotation":{"description":"","type":"object","properties":{"bold":{"description":"","type":"boolean"},"italic":{"description":"","type":"boolean"},"strikethrough":{"description":"","type":"boolean"},"underline":{"description":"","type":"boolean"},"code":{"description":"","type":"boolean"},"color":{"description":"","type":"string"}}},"User":{"description":"","type":"object","properties":{"object":{"description":"","type":"string"},"id":{"description":"","type":"string"},"type":{"description":"","type":"string"},"person":{"description":"","$ref":"Person"},"name":{"description":"","type":"string"},"avatar_url":{"description":"","type":"string"}}},"User_Collection":{"description":"","type":"object","properties":{"results":{"description":"","type":"array","items":{"$ref":"User"}},"next_cursor":{"description":"","type":"string"},"has_more":{"description":"","type":"boolean"}}}}}}

src/Client.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import axios, {AxiosRequestConfig} from "axios";
77
import {ClientAbstract, CredentialsInterface, TokenStoreInterface} from "sdkgen-client"
88
import {HttpBearer} from "sdkgen-client"
9+
import {Anonymous} from "sdkgen-client"
910
import {ClientException, UnknownStatusCodeException} from "sdkgen-client";
1011

1112
import {UserTag} from "./UserTag";
@@ -43,4 +44,9 @@ export class Client extends ClientAbstract {
4344
{
4445
return new Client('https://api.notion.com', new HttpBearer(token));
4546
}
47+
48+
public static buildAnonymous(): Client
49+
{
50+
return new Client('https://api.notion.com', new Anonymous());
51+
}
4652
}

src/DatabaseTag.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {Database} from "./Database";
1111

1212
export class DatabaseTag extends TagAbstract {
1313
/**
14+
* Retrieves a database object — information that describes the structure and columns of a database — for a provided database ID. The response adheres to any limits to an integration’s capabilities.
15+
*
1416
* @returns {Promise<Database>}
1517
* @throws {ClientException}
1618
*/
@@ -22,6 +24,8 @@ export class DatabaseTag extends TagAbstract {
2224
let params: AxiosRequestConfig = {
2325
url: url,
2426
method: 'GET',
27+
headers: {
28+
},
2529
params: this.parser.query({
2630
}, [
2731
]),
@@ -34,10 +38,9 @@ export class DatabaseTag extends TagAbstract {
3438
if (error instanceof ClientException) {
3539
throw error;
3640
} else if (axios.isAxiosError(error) && error.response) {
37-
switch (error.response.status) {
38-
default:
39-
throw new UnknownStatusCodeException('The server returned an unknown status code');
40-
}
41+
const statusCode = error.response.status;
42+
43+
throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode);
4144
} else {
4245
throw new ClientException('An unknown error occurred: ' + String(error));
4346
}

src/PageTag.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {Page} from "./Page";
1111

1212
export class PageTag extends TagAbstract {
1313
/**
14+
* Retrieves a Page object using the ID specified.
15+
*
1416
* @returns {Promise<Page>}
1517
* @throws {ClientException}
1618
*/
@@ -22,6 +24,8 @@ export class PageTag extends TagAbstract {
2224
let params: AxiosRequestConfig = {
2325
url: url,
2426
method: 'GET',
27+
headers: {
28+
},
2529
params: this.parser.query({
2630
}, [
2731
]),
@@ -34,17 +38,18 @@ export class PageTag extends TagAbstract {
3438
if (error instanceof ClientException) {
3539
throw error;
3640
} else if (axios.isAxiosError(error) && error.response) {
37-
switch (error.response.status) {
38-
default:
39-
throw new UnknownStatusCodeException('The server returned an unknown status code');
40-
}
41+
const statusCode = error.response.status;
42+
43+
throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode);
4144
} else {
4245
throw new ClientException('An unknown error occurred: ' + String(error));
4346
}
4447
}
4548
}
4649

4750
/**
51+
* Creates a new page that is a child of an existing page or database.
52+
*
4853
* @returns {Promise<Page>}
4954
* @throws {ClientException}
5055
*/
@@ -55,6 +60,9 @@ export class PageTag extends TagAbstract {
5560
let params: AxiosRequestConfig = {
5661
url: url,
5762
method: 'POST',
63+
headers: {
64+
'Content-Type': 'application/json',
65+
},
5866
params: this.parser.query({
5967
}, [
6068
]),
@@ -68,10 +76,9 @@ export class PageTag extends TagAbstract {
6876
if (error instanceof ClientException) {
6977
throw error;
7078
} else if (axios.isAxiosError(error) && error.response) {
71-
switch (error.response.status) {
72-
default:
73-
throw new UnknownStatusCodeException('The server returned an unknown status code');
74-
}
79+
const statusCode = error.response.status;
80+
81+
throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode);
7582
} else {
7683
throw new ClientException('An unknown error occurred: ' + String(error));
7784
}

src/UserTag.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export class UserTag extends TagAbstract {
2424
let params: AxiosRequestConfig = {
2525
url: url,
2626
method: 'GET',
27+
headers: {
28+
},
2729
params: this.parser.query({
2830
'start_cursor': startCursor,
2931
'page_size': pageSize,
@@ -38,17 +40,18 @@ export class UserTag extends TagAbstract {
3840
if (error instanceof ClientException) {
3941
throw error;
4042
} else if (axios.isAxiosError(error) && error.response) {
41-
switch (error.response.status) {
42-
default:
43-
throw new UnknownStatusCodeException('The server returned an unknown status code');
44-
}
43+
const statusCode = error.response.status;
44+
45+
throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode);
4546
} else {
4647
throw new ClientException('An unknown error occurred: ' + String(error));
4748
}
4849
}
4950
}
5051

5152
/**
53+
* Retrieves a User using the ID specified.
54+
*
5255
* @returns {Promise<User>}
5356
* @throws {ClientException}
5457
*/
@@ -60,6 +63,8 @@ export class UserTag extends TagAbstract {
6063
let params: AxiosRequestConfig = {
6164
url: url,
6265
method: 'GET',
66+
headers: {
67+
},
6368
params: this.parser.query({
6469
}, [
6570
]),
@@ -72,10 +77,9 @@ export class UserTag extends TagAbstract {
7277
if (error instanceof ClientException) {
7378
throw error;
7479
} else if (axios.isAxiosError(error) && error.response) {
75-
switch (error.response.status) {
76-
default:
77-
throw new UnknownStatusCodeException('The server returned an unknown status code');
78-
}
80+
const statusCode = error.response.status;
81+
82+
throw new UnknownStatusCodeException('The server returned an unknown status code: ' + statusCode);
7983
} else {
8084
throw new ClientException('An unknown error occurred: ' + String(error));
8185
}

0 commit comments

Comments
 (0)