File tree Expand file tree Collapse file tree 4 files changed +63
-25
lines changed Expand file tree Collapse file tree 4 files changed +63
-25
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @team-plain/typescript-sdk ' : patch
3+ ---
4+
5+ Adds the ability to get a thread by its external id
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ import {
4242 ReplyToThreadDocument ,
4343 SendNewEmailDocument ,
4444 SnoozeThreadDocument ,
45+ ThreadByExternalIdDocument ,
4546 ThreadDocument ,
4647 type ThreadEventPartsFragment ,
4748 type ThreadPartsFragment ,
@@ -445,6 +446,21 @@ export class PlainClient {
445446 return unwrapData ( res , ( q ) => q . thread ) ;
446447 }
447448
449+ /**
450+ * Get a single thread by external id. A thread's external id is unique per customer,
451+ * hence why the customer id is also required.
452+ */
453+ async getThreadByExternalId (
454+ variables : VariablesOf < typeof ThreadByExternalIdDocument >
455+ ) : SDKResult < ThreadPartsFragment | null > {
456+ const res = await request ( this . #ctx, {
457+ query : ThreadByExternalIdDocument ,
458+ variables,
459+ } ) ;
460+
461+ return unwrapData ( res , ( q ) => q . threadByExternalId ) ;
462+ }
463+
448464 /**
449465 * Create a thread (e.g. when a contact form is submitted)
450466 */
Original file line number Diff line number Diff line change 1+ query threadByExternalId ($customerId : ID ! , $externalId : ID ! ) {
2+ threadByExternalId (customerId : $customerId , externalId : $externalId ) {
3+ ... ThreadParts
4+ }
5+ }
You can’t perform that action at this time.
0 commit comments