File tree 4 files changed +58
-0
lines changed
examples/rest-api-client-demo/src
4 files changed +58
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,17 @@ export class Space {
83
83
}
84
84
}
85
85
86
+ public async addThread ( ) {
87
+ const name = "Added Thread Name" ;
88
+ try {
89
+ console . log (
90
+ await this . client . space . addThread ( { space : SPACE_ID , name } ) ,
91
+ ) ;
92
+ } catch ( error ) {
93
+ console . log ( error ) ;
94
+ }
95
+ }
96
+
86
97
public async updateThread ( ) {
87
98
const body = "<b>This is an updated thread body</b>" ;
88
99
const name = "Updated Thread Name" ;
Original file line number Diff line number Diff line change 5
5
- [ updateSpaceBody] ( #updateSpaceBody )
6
6
- [ getSpaceMembers] ( #getSpaceMembers )
7
7
- [ updateSpaceMembers] ( #updateSpaceMembers )
8
+ - [ addThread] ( #addThread )
8
9
- [ updateThread] ( #updateThread )
9
10
- [ addThreadComment] ( #addThreadComment )
10
11
- [ addGuests] ( #addGuests )
@@ -175,6 +176,26 @@ An empty object.
175
176
176
177
- https://kintone.dev/en/docs/kintone/rest-api/spaces/update-space-members/
177
178
179
+ ### addThread
180
+
181
+ Adds a Thread of a Space.<br />
182
+ The Enable multiple threads option must be enabled in the space settings.
183
+
184
+ #### Parameters
185
+
186
+ | Name | Type | Required | Description |
187
+ | ---- | :--------------: | :------: | -------------------------------------------------------------------- |
188
+ | space | Number or String | Yes | The space ID. |
189
+ | name | String | Yes | The new name of the Thread.<br />Must be between 1 - 128 characters. |
190
+
191
+ #### Returns
192
+
193
+ An empty object.
194
+
195
+ #### Reference
196
+
197
+ - https://kintone.dev/en/docs/kintone/rest-api/spaces/add-thread/
198
+
178
199
### updateThread
179
200
180
201
Updates a Thread of a Space.
Original file line number Diff line number Diff line change @@ -52,6 +52,13 @@ export class SpaceClient extends BaseClient {
52
52
return this . client . put ( path , params ) ;
53
53
}
54
54
55
+ public addThread ( params : { space : SpaceID ; name : string } ) : Promise < { id : string } > {
56
+ const path = this . buildPathWithGuestSpaceId ( {
57
+ endpointName : "space/thread" ,
58
+ } ) ;
59
+ return this . client . post ( path , params ) ;
60
+ }
61
+
55
62
public updateThread ( params : {
56
63
id : ThreadID ;
57
64
name ?: string ;
Original file line number Diff line number Diff line change @@ -136,6 +136,25 @@ describe("SpaceClient", () => {
136
136
} ) ;
137
137
} ) ;
138
138
139
+ describe ( "addThread" , ( ) => {
140
+ const params = {
141
+ space : SPACE_ID ,
142
+ name : "Added Thread Name" ,
143
+ } ;
144
+ beforeEach ( async ( ) => {
145
+ await spaceClient . addThread ( params ) ;
146
+ } ) ;
147
+ it ( "should pass the path to the http client" , ( ) => {
148
+ expect ( mockClient . getLogs ( ) [ 0 ] . path ) . toBe ( "/k/v1/space/thread.json" ) ;
149
+ } ) ;
150
+ it ( "should send a POST request" , ( ) => {
151
+ expect ( mockClient . getLogs ( ) [ 0 ] . method ) . toBe ( "post" ) ;
152
+ } ) ;
153
+ it ( "should pass id, name to the http client" , ( ) => {
154
+ expect ( mockClient . getLogs ( ) [ 0 ] . params ) . toEqual ( params ) ;
155
+ } ) ;
156
+ } ) ;
157
+
139
158
describe ( "updateThread" , ( ) => {
140
159
const params = {
141
160
id : THREAD_ID ,
You can’t perform that action at this time.
0 commit comments