File tree Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Expand file tree Collapse file tree 4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @team-plain/typescript-sdk ' : minor
3+ ---
4+
5+ Add support for getCustomerByExternalId
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import {
2323 CreateThreadEventDocument ,
2424 CreateWebhookTargetDocument ,
2525 CustomerByEmailDocument ,
26+ CustomerByExternalIdDocument ,
2627 CustomerByIdDocument ,
2728 type CustomerCardConfigPartsFragment ,
2829 CustomerCustomerGroupsDocument ,
@@ -221,6 +222,25 @@ export class PlainClient {
221222 } ) ;
222223 }
223224
225+ /**
226+ * If the customer is not found this will return null.
227+ */
228+ async getCustomerByExternalId (
229+ variables : VariablesOf < typeof CustomerByExternalIdDocument >
230+ ) : SDKResult < CustomerPartsFragment | null > {
231+ const res = await request ( this . #ctx, {
232+ query : CustomerByExternalIdDocument ,
233+ variables,
234+ } ) ;
235+
236+ return unwrapData ( res , ( q ) => {
237+ if ( ! q . customerByExternalId ) {
238+ return null ;
239+ }
240+ return q . customerByExternalId ;
241+ } ) ;
242+ }
243+
224244 /**
225245 * If the customer is not found this will return null.
226246 */
Original file line number Diff line number Diff line change 1+ query customerByExternalId ($externalId : ID ! ) {
2+ customerByExternalId (externalId : $externalId ) {
3+ ... CustomerParts
4+ }
5+ }
You can’t perform that action at this time.
0 commit comments