File tree Expand file tree Collapse file tree 4 files changed +128
-63
lines changed Expand file tree Collapse file tree 4 files changed +128
-63
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @team-plain/typescript-sdk ' : minor
3+ ---
4+
5+ Add ability to fetch a user by id (` userById() ` )
Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ import {
8989 UpsertTenantDocument ,
9090 UpsertThreadFieldDocument ,
9191 UserByEmailDocument ,
92+ UserByIdDocument ,
9293 type UserPartsFragment ,
9394 WebhookTargetDocument ,
9495 type WebhookTargetPartsFragment ,
@@ -170,7 +171,7 @@ export class PlainClient {
170171 }
171172
172173 /**
173- * Get a paginated list of customers.
174+ * Get a a user by email
174175 */
175176 async getUserByEmail (
176177 variables : VariablesOf < typeof UserByEmailDocument >
@@ -183,6 +184,20 @@ export class PlainClient {
183184 return unwrapData ( res , ( q ) => q . userByEmail || null ) ;
184185 }
185186
187+ /**
188+ * Get a user by id
189+ */
190+ async getUserById (
191+ variables : VariablesOf < typeof UserByIdDocument >
192+ ) : SDKResult < UserPartsFragment | null > {
193+ const res = await request ( this . #ctx, {
194+ query : UserByIdDocument ,
195+ variables,
196+ } ) ;
197+
198+ return unwrapData ( res , ( q ) => q . userById || null ) ;
199+ }
200+
186201 /**
187202 * Get a paginated list of customers.
188203 */
Original file line number Diff line number Diff line change 1+ query userById ($id : ID ! ) {
2+ userById : user (userId : $id ) {
3+ ... UserParts
4+ }
5+ }
You can’t perform that action at this time.
0 commit comments