Skip to content

Commit c775728

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 c255df5 commit c775728

File tree

9 files changed

+59
-38
lines changed

9 files changed

+59
-38
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/SdkFabric.Notion/Block.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ public class Block
1414
[JsonPropertyName("parent")]
1515
public Page? Parent { get; set; }
1616
[JsonPropertyName("created_time")]
17-
public DateTime? CreatedTime { get; set; }
17+
public System.DateTime? CreatedTime { get; set; }
1818
[JsonPropertyName("last_edited_time")]
19-
public DateTime? LastEditedTime { get; set; }
19+
public System.DateTime? LastEditedTime { get; set; }
2020
[JsonPropertyName("created_by")]
2121
public User? CreatedBy { get; set; }
2222
[JsonPropertyName("last_edited_by")]

src/SdkFabric.Notion/Client.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,9 @@ public static Client Build(string token)
5050
{
5151
return new Client("https://api.notion.com", new HttpBearer(token));
5252
}
53+
54+
public static Client BuildAnonymous()
55+
{
56+
return new Client("https://api.notion.com", new Anonymous());
57+
}
5358
}

src/SdkFabric.Notion/Database.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ public class Database
1212
[JsonPropertyName("id")]
1313
public string? Id { get; set; }
1414
[JsonPropertyName("created_time")]
15-
public DateTime? CreatedTime { get; set; }
15+
public System.DateTime? CreatedTime { get; set; }
1616
[JsonPropertyName("last_edited_time")]
17-
public DateTime? LastEditedTime { get; set; }
17+
public System.DateTime? LastEditedTime { get; set; }
1818
[JsonPropertyName("icon")]
1919
public DatabaseIcon? Icon { get; set; }
2020
[JsonPropertyName("cover")]
2121
public DatabaseCover? Cover { get; set; }
2222
[JsonPropertyName("url")]
2323
public string? Url { get; set; }
2424
[JsonPropertyName("title")]
25-
public List<DatabaseTitle>? Title { get; set; }
25+
public System.Collections.Generic.List<DatabaseTitle>? Title { get; set; }
2626
[JsonPropertyName("description")]
27-
public List<DatabaseTitle>? Description { get; set; }
27+
public System.Collections.Generic.List<DatabaseTitle>? Description { get; set; }
2828
}

src/SdkFabric.Notion/DatabaseTag.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public DatabaseTag(RestClient httpClient, Parser parser): base(httpClient, parse
1919
}
2020

2121

22+
/**
23+
* 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.
24+
*/
2225
public async Task<Database> Get(string databaseId)
2326
{
2427
Dictionary<string, object> pathParams = new();
@@ -31,17 +34,18 @@ public async Task<Database> Get(string databaseId)
3134
RestRequest request = new(this.Parser.Url("/v1/databases/:database_id", pathParams), Method.Get);
3235
this.Parser.Query(request, queryParams, queryStructNames);
3336

37+
3438
RestResponse response = await this.HttpClient.ExecuteAsync(request);
3539

3640
if (response.IsSuccessful)
3741
{
38-
return this.Parser.Parse<Database>(response.Content);
42+
var data = this.Parser.Parse<Database>(response.Content);
43+
44+
return data;
3945
}
4046

41-
throw (int) response.StatusCode switch
42-
{
43-
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
44-
};
47+
var statusCode = (int) response.StatusCode;
48+
throw new UnknownStatusCodeException("The server returned an unknown status code: " + statusCode);
4549
}
4650

4751

src/SdkFabric.Notion/Page.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ public class Page
1313
[JsonPropertyName("id")]
1414
public string? Id { get; set; }
1515
[JsonPropertyName("created_time")]
16-
public DateTime? CreatedTime { get; set; }
16+
public System.DateTime? CreatedTime { get; set; }
1717
[JsonPropertyName("last_edited_time")]
18-
public DateTime? LastEditedTime { get; set; }
18+
public System.DateTime? LastEditedTime { get; set; }
1919
[JsonPropertyName("created_by")]
2020
public User? CreatedBy { get; set; }
2121
[JsonPropertyName("last_edited_by")]
@@ -29,7 +29,7 @@ public class Page
2929
[JsonPropertyName("in_trash")]
3030
public bool? InTrash { get; set; }
3131
[JsonPropertyName("properties")]
32-
public Dictionary<string, object>? Properties { get; set; }
32+
public System.Collections.Generic.Dictionary<string, object>? Properties { get; set; }
3333
[JsonPropertyName("url")]
3434
public string? Url { get; set; }
3535
[JsonPropertyName("public_url")]

src/SdkFabric.Notion/PageTag.cs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ public PageTag(RestClient httpClient, Parser parser): base(httpClient, parser)
1919
}
2020

2121

22+
/**
23+
* Retrieves a Page object using the ID specified.
24+
*/
2225
public async Task<Page> Get(string pageId)
2326
{
2427
Dictionary<string, object> pathParams = new();
@@ -31,19 +34,22 @@ public async Task<Page> Get(string pageId)
3134
RestRequest request = new(this.Parser.Url("/v1/pages/:page_id", pathParams), Method.Get);
3235
this.Parser.Query(request, queryParams, queryStructNames);
3336

37+
3438
RestResponse response = await this.HttpClient.ExecuteAsync(request);
3539

3640
if (response.IsSuccessful)
3741
{
38-
return this.Parser.Parse<Page>(response.Content);
42+
var data = this.Parser.Parse<Page>(response.Content);
43+
44+
return data;
3945
}
4046

41-
throw (int) response.StatusCode switch
42-
{
43-
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
44-
};
47+
var statusCode = (int) response.StatusCode;
48+
throw new UnknownStatusCodeException("The server returned an unknown status code: " + statusCode);
4549
}
46-
50+
/**
51+
* Creates a new page that is a child of an existing page or database.
52+
*/
4753
public async Task<Page> Create(Page payload)
4854
{
4955
Dictionary<string, object> pathParams = new();
@@ -56,17 +62,19 @@ public async Task<Page> Create(Page payload)
5662
this.Parser.Query(request, queryParams, queryStructNames);
5763
request.AddJsonBody(JsonSerializer.Serialize(payload));
5864

65+
request.AddOrUpdateHeader("Content-Type", "application/json");
66+
5967
RestResponse response = await this.HttpClient.ExecuteAsync(request);
6068

6169
if (response.IsSuccessful)
6270
{
63-
return this.Parser.Parse<Page>(response.Content);
71+
var data = this.Parser.Parse<Page>(response.Content);
72+
73+
return data;
6474
}
6575

66-
throw (int) response.StatusCode switch
67-
{
68-
_ => throw new UnknownStatusCodeException("The server returned an unknown status code"),
69-
};
76+
var statusCode = (int) response.StatusCode;
77+
throw new UnknownStatusCodeException("The server returned an unknown status code: " + statusCode);
7078
}
7179

7280

src/SdkFabric.Notion/UserCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace SdkFabric.Notion;
88
public class UserCollection
99
{
1010
[JsonPropertyName("results")]
11-
public List<User>? Results { get; set; }
11+
public System.Collections.Generic.List<User>? Results { get; set; }
1212
[JsonPropertyName("next_cursor")]
1313
public string? NextCursor { get; set; }
1414
[JsonPropertyName("has_more")]

0 commit comments

Comments
 (0)