Skip to content

Commit a54404b

Browse files
author
SDKgen-Bot
committed
Operation "page.create" was added
Property "Page.parent" (string) type has changed from "string" to "union" Property "Page.url" was added Property "Page.public_url" was added Type "Database_Id" was added Type "Page_Id" was added
1 parent 246a775 commit a54404b

File tree

5 files changed

+56
-2
lines changed

5 files changed

+56
-2
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":[]}},"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"}}},"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_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":"","type":"string"},"in_trash":{"description":"","type":"boolean"},"properties":{"description":"","type":"object","additionalProperties":{"type":"any"}}}},"Person":{"description":"","type":"object","properties":{"email":{"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":"","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"}}},"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"}}},"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/DatabaseId.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* DatabaseId automatically generated by SDKgen please do not edit this file manually
3+
* {@link https://sdkgen.app}
4+
*/
5+
6+
export interface DatabaseId {
7+
database_id?: string
8+
}

src/Page.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*/
55

66
import {User} from "./User";
7+
import {DatabaseId} from "./DatabaseId";
8+
import {PageId} from "./PageId";
79
export interface Page {
810
object?: string
911
id?: string
@@ -13,7 +15,9 @@ export interface Page {
1315
last_edited_by?: User
1416
cover?: string
1517
icon?: string
16-
parent?: string
18+
parent?: DatabaseId | PageId
1719
in_trash?: boolean
1820
properties?: Record<string, any>
21+
url?: string
22+
public_url?: string
1923
}

src/PageId.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* PageId automatically generated by SDKgen please do not edit this file manually
3+
* {@link https://sdkgen.app}
4+
*/
5+
6+
export interface PageId {
7+
page_id?: string
8+
}

src/PageTag.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,39 @@ export class PageTag extends TagAbstract {
4444
}
4545
}
4646

47+
/**
48+
* @returns {Promise<Page>}
49+
* @throws {ClientException}
50+
*/
51+
public async create(payload: Page): Promise<Page> {
52+
const url = this.parser.url('/v1/pages', {
53+
});
54+
55+
let params: AxiosRequestConfig = {
56+
url: url,
57+
method: 'POST',
58+
params: this.parser.query({
59+
}, [
60+
]),
61+
data: payload
62+
};
63+
64+
try {
65+
const response = await this.httpClient.request<Page>(params);
66+
return response.data;
67+
} catch (error) {
68+
if (error instanceof ClientException) {
69+
throw error;
70+
} 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+
}
75+
} else {
76+
throw new ClientException('An unknown error occurred: ' + String(error));
77+
}
78+
}
79+
}
80+
4781

4882
}

0 commit comments

Comments
 (0)