@spritz-finance/api-client 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,6 +26,7 @@ A Typescript library for interacting with the Spritz Finance API
26
26
  - [Usage](#usage)
27
27
  - [Creating a user](#creating-a-user-1)
28
28
  - [Setting the User API Key](#setting-the-user-api-key)
29
+ - [Reauthorizing a user](#reauthorizing-a-user)
29
30
  - [Basic User Data](#basic-user-data)
30
31
  - [User Verification](#user-verification)
31
32
  - [Overview](#overview)
@@ -137,6 +138,19 @@ client.setApiKey(user.apiKey)
137
138
 
138
139
  Now you're ready to issue requests on behalf of the user.
139
140
 
141
+ ## Reauthorizing a user
142
+
143
+ There is a scenrio where you may need to get access to a users API key again. This can happen if you are trying to sign in a user that already has a Spritz account, or if you have lost access to their API key. In this case, you can reauthorize the user by providing their email. The process is that we will send the user an OTP code to their email, and then the user must pass that code on to you to confirm that they are allowing you to interact with their account on their behalf.
144
+
145
+ ```typescript
146
+ const { success } = await client.user.requestApiKey('bilbo@shiremail.net')
147
+
148
+ const { apiKey, userId, email } = await client.user.authorizeApiKeyWithOTP({
149
+ email: 'bilbo@shiremail.net',
150
+ otp: '123456',
151
+ })
152
+ ```
153
+
140
154
  ## Basic User Data
141
155
 
142
156
  Use this to fetch the user's basic data
@@ -155,6 +155,7 @@ interface AccountPayments_paymentsForAccount {
155
155
  feeAmount: number | null;
156
156
  createdAt: any;
157
157
  deliveryMethod: PaymentDeliveryMethod | null;
158
+ paymentRequestId: string | null;
158
159
  }
159
160
  interface AccountPayments {
160
161
  paymentsForAccount: AccountPayments_paymentsForAccount[];
@@ -421,6 +422,7 @@ interface PaymentFragment {
421
422
  feeAmount: number | null;
422
423
  createdAt: any;
423
424
  deliveryMethod: PaymentDeliveryMethod | null;
425
+ paymentRequestId: string | null;
424
426
  }
425
427
 
426
428
  interface PaymentRequestFragment {
@@ -447,6 +449,7 @@ interface PaymentRequestPayment_paymentForPaymentRequest {
447
449
  feeAmount: number | null;
448
450
  createdAt: any;
449
451
  deliveryMethod: PaymentDeliveryMethod | null;
452
+ paymentRequestId: string | null;
450
453
  }
451
454
  interface PaymentRequestPayment {
452
455
  paymentForPaymentRequest: PaymentRequestPayment_paymentForPaymentRequest | null;
@@ -1172,14 +1175,28 @@ interface CreateUserResponse {
1172
1175
  email: string;
1173
1176
  apiKey: string;
1174
1177
  }
1178
+ interface RequestApiKeyResponse {
1179
+ success: boolean;
1180
+ }
1175
1181
  interface CreateUserParams {
1176
1182
  email: string;
1177
1183
  }
1184
+ interface AuthorizeApiKeyResponse {
1185
+ apiKey: string;
1186
+ userId: any;
1187
+ email: string;
1188
+ }
1189
+ interface AuthorizeApiKeyParams {
1190
+ otp: any;
1191
+ email: string;
1192
+ }
1178
1193
  declare class UserService {
1179
1194
  private client;
1180
1195
  constructor(client: SpritzClient);
1181
1196
  createUser(args: CreateUserParams): Promise<CreateUserResponse>;
1182
1197
  create(args: CreateUserParams): Promise<CreateUserResponse>;
1198
+ requestApiKey(email: string): Promise<RequestApiKeyResponse>;
1199
+ authorizeApiKeyWithOTP(args: AuthorizeApiKeyParams): Promise<AuthorizeApiKeyResponse>;
1183
1200
  getCurrentUser(): Promise<CurrentUser_me>;
1184
1201
  getUserVerification(): Promise<UserVerification_verification | null>;
1185
1202
  }
@@ -238,7 +238,7 @@ query SearchUSBillInstitutions($searchTerm: String!, $billType: BillType) {
238
238
  ...PayableAccountInstitutionFragment
239
239
  }
240
240
  }
241
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};var Zi={};function Uo(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Zi[t]?!1:(Zi[t]=!0,!0)})}Ae.definitions=Ae.definitions.concat(Uo(Je.definitions));function On(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){On(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){On(i,n)}),e.definitions&&e.definitions.forEach(function(i){On(i,n)})}var Nt={};(function(){Ae.definitions.forEach(function(n){if(n.name){var t=new Set;On(n,t),Nt[n.name.value]=t}})})();function ea(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function Vo(e,n){var t={kind:e.kind,definitions:[ea(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Nt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Nt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=ea(e,o);s&&t.definitions.push(s)}),t}Vo(Ae,"SearchUSBillInstitutions");class qo{client;constructor(n){this.client=n}async popularUSBillInstitutions(n){return(await this.client.query({query:Fe,variables:{billType:n??null}}))?.popularUSBillInstitutions??[]}async searchUSBillInstitutions(n,t){return(await this.client.query({query:Ae,variables:{searchTerm:n,billType:t??null}}))?.searchUSBillInstitutions??[]}}var Ye={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PaymentFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Payment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"accountId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"feeAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"deliveryMethod"},arguments:[],directives:[]}]}}],loc:{start:0,end:141}};Ye.loc.source={body:`fragment PaymentFragment on Payment {
241
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};var Zi={};function Uo(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Zi[t]?!1:(Zi[t]=!0,!0)})}Ae.definitions=Ae.definitions.concat(Uo(Je.definitions));function On(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){On(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){On(i,n)}),e.definitions&&e.definitions.forEach(function(i){On(i,n)})}var Nt={};(function(){Ae.definitions.forEach(function(n){if(n.name){var t=new Set;On(n,t),Nt[n.name.value]=t}})})();function ea(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function Vo(e,n){var t={kind:e.kind,definitions:[ea(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Nt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Nt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=ea(e,o);s&&t.definitions.push(s)}),t}Vo(Ae,"SearchUSBillInstitutions");class qo{client;constructor(n){this.client=n}async popularUSBillInstitutions(n){return(await this.client.query({query:Fe,variables:{billType:n??null}}))?.popularUSBillInstitutions??[]}async searchUSBillInstitutions(n,t){return(await this.client.query({query:Ae,variables:{searchTerm:n,billType:t??null}}))?.searchUSBillInstitutions??[]}}var Ye={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PaymentFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Payment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"accountId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"feeAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"deliveryMethod"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"paymentRequestId"},arguments:[],directives:[]}]}}],loc:{start:0,end:162}};Ye.loc.source={body:`fragment PaymentFragment on Payment {
242
242
  id
243
243
  userId
244
244
  status
@@ -247,6 +247,7 @@ query SearchUSBillInstitutions($searchTerm: String!, $billType: BillType) {
247
247
  feeAmount
248
248
  createdAt
249
249
  deliveryMethod
250
+ paymentRequestId
250
251
  }
251
252
  `,name:"GraphQL request",locationOffset:{line:1,column:1}};function Rn(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){Rn(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){Rn(i,n)}),e.definitions&&e.definitions.forEach(function(i){Rn(i,n)})}var Tt={};(function(){Ye.definitions.forEach(function(n){if(n.name){var t=new Set;Rn(n,t),Tt[n.name.value]=t}})})();function na(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function Co(e,n){var t={kind:e.kind,definitions:[na(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Tt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Tt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=na(e,o);s&&t.definitions.push(s)}),t}Co(Ye,"PaymentFragment");var Oe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"PaymentRequestPayment"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"paymentRequestId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"paymentForPaymentRequest"},arguments:[{kind:"Argument",name:{kind:"Name",value:"paymentRequestId"},value:{kind:"Variable",name:{kind:"Name",value:"paymentRequestId"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"PaymentFragment"},directives:[]}]}}]}}],loc:{start:0,end:198}};Oe.loc.source={body:`#import "./paymentFragment.graphql"
252
253
 
@@ -339,7 +340,7 @@ query CurrentUser {
339
340
  }
340
341
  }
341
342
  }
342
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};function jn(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){jn(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){jn(i,n)}),e.definitions&&e.definitions.forEach(function(i){jn(i,n)})}var Lt={};(function(){Mn.definitions.forEach(function(n){if(n.name){var t=new Set;jn(n,t),Lt[n.name.value]=t}})})();function pa(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function ls(e,n){var t={kind:e.kind,definitions:[pa(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Lt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Lt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=pa(e,o);s&&t.definitions.push(s)}),t}ls(Mn,"UserVerification");class ds{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async getCurrentUser(){return(await this.client.query({query:_e}))?.me??null}async getUserVerification(){return(await this.client.query({query:Mn}))?.verification??null}}var Ke={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:408}};Ke.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
343
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};function jn(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){jn(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){jn(i,n)}),e.definitions&&e.definitions.forEach(function(i){jn(i,n)})}var Lt={};(function(){Mn.definitions.forEach(function(n){if(n.name){var t=new Set;jn(n,t),Lt[n.name.value]=t}})})();function pa(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function ls(e,n){var t={kind:e.kind,definitions:[pa(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Lt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Lt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=pa(e,o);s&&t.definitions.push(s)}),t}ls(Mn,"UserVerification");class ds{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/integration/user/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/integration/user/validate-otp",body:n})}async getCurrentUser(){return(await this.client.query({query:_e}))?.me??null}async getUserVerification(){return(await this.client.query({query:Mn}))?.verification??null}}var Ke={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:408}};Ke.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
343
344
  id
344
345
  name
345
346
  userId
@@ -238,7 +238,7 @@ query SearchUSBillInstitutions($searchTerm: String!, $billType: BillType) {
238
238
  ...PayableAccountInstitutionFragment
239
239
  }
240
240
  }
241
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};var Zi={};function Uo(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Zi[t]?!1:(Zi[t]=!0,!0)})}Ae.definitions=Ae.definitions.concat(Uo(Je.definitions));function On(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){On(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){On(i,n)}),e.definitions&&e.definitions.forEach(function(i){On(i,n)})}var Nt={};(function(){Ae.definitions.forEach(function(n){if(n.name){var t=new Set;On(n,t),Nt[n.name.value]=t}})})();function ea(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function Vo(e,n){var t={kind:e.kind,definitions:[ea(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Nt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Nt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=ea(e,o);s&&t.definitions.push(s)}),t}Vo(Ae,"SearchUSBillInstitutions");class qo{client;constructor(n){this.client=n}async popularUSBillInstitutions(n){return(await this.client.query({query:Fe,variables:{billType:n??null}}))?.popularUSBillInstitutions??[]}async searchUSBillInstitutions(n,t){return(await this.client.query({query:Ae,variables:{searchTerm:n,billType:t??null}}))?.searchUSBillInstitutions??[]}}var Ye={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PaymentFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Payment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"accountId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"feeAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"deliveryMethod"},arguments:[],directives:[]}]}}],loc:{start:0,end:141}};Ye.loc.source={body:`fragment PaymentFragment on Payment {
241
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};var Zi={};function Uo(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Zi[t]?!1:(Zi[t]=!0,!0)})}Ae.definitions=Ae.definitions.concat(Uo(Je.definitions));function On(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){On(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){On(i,n)}),e.definitions&&e.definitions.forEach(function(i){On(i,n)})}var Nt={};(function(){Ae.definitions.forEach(function(n){if(n.name){var t=new Set;On(n,t),Nt[n.name.value]=t}})})();function ea(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function Vo(e,n){var t={kind:e.kind,definitions:[ea(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Nt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Nt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=ea(e,o);s&&t.definitions.push(s)}),t}Vo(Ae,"SearchUSBillInstitutions");class qo{client;constructor(n){this.client=n}async popularUSBillInstitutions(n){return(await this.client.query({query:Fe,variables:{billType:n??null}}))?.popularUSBillInstitutions??[]}async searchUSBillInstitutions(n,t){return(await this.client.query({query:Ae,variables:{searchTerm:n,billType:t??null}}))?.searchUSBillInstitutions??[]}}var Ye={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PaymentFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Payment"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"accountId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"amount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"feeAmount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"deliveryMethod"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"paymentRequestId"},arguments:[],directives:[]}]}}],loc:{start:0,end:162}};Ye.loc.source={body:`fragment PaymentFragment on Payment {
242
242
  id
243
243
  userId
244
244
  status
@@ -247,6 +247,7 @@ query SearchUSBillInstitutions($searchTerm: String!, $billType: BillType) {
247
247
  feeAmount
248
248
  createdAt
249
249
  deliveryMethod
250
+ paymentRequestId
250
251
  }
251
252
  `,name:"GraphQL request",locationOffset:{line:1,column:1}};function Rn(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){Rn(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){Rn(i,n)}),e.definitions&&e.definitions.forEach(function(i){Rn(i,n)})}var Tt={};(function(){Ye.definitions.forEach(function(n){if(n.name){var t=new Set;Rn(n,t),Tt[n.name.value]=t}})})();function na(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function Co(e,n){var t={kind:e.kind,definitions:[na(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Tt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Tt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=na(e,o);s&&t.definitions.push(s)}),t}Co(Ye,"PaymentFragment");var Oe={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"PaymentRequestPayment"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"paymentRequestId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"paymentForPaymentRequest"},arguments:[{kind:"Argument",name:{kind:"Name",value:"paymentRequestId"},value:{kind:"Variable",name:{kind:"Name",value:"paymentRequestId"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"PaymentFragment"},directives:[]}]}}]}}],loc:{start:0,end:198}};Oe.loc.source={body:`#import "./paymentFragment.graphql"
252
253
 
@@ -339,7 +340,7 @@ query CurrentUser {
339
340
  }
340
341
  }
341
342
  }
342
- `,name:"GraphQL request",locationOffset:{line:1,column:1}};function jn(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){jn(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){jn(i,n)}),e.definitions&&e.definitions.forEach(function(i){jn(i,n)})}var Lt={};(function(){Mn.definitions.forEach(function(n){if(n.name){var t=new Set;jn(n,t),Lt[n.name.value]=t}})})();function pa(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function ls(e,n){var t={kind:e.kind,definitions:[pa(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Lt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Lt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=pa(e,o);s&&t.definitions.push(s)}),t}ls(Mn,"UserVerification");class ds{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async getCurrentUser(){return(await this.client.query({query:_e}))?.me??null}async getUserVerification(){return(await this.client.query({query:Mn}))?.verification??null}}var Ke={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:408}};Ke.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
343
+ `,name:"GraphQL request",locationOffset:{line:1,column:1}};function jn(e,n){if(e.kind==="FragmentSpread")n.add(e.name.value);else if(e.kind==="VariableDefinition"){var t=e.type;t.kind==="NamedType"&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(i){jn(i,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(i){jn(i,n)}),e.definitions&&e.definitions.forEach(function(i){jn(i,n)})}var Lt={};(function(){Mn.definitions.forEach(function(n){if(n.name){var t=new Set;jn(n,t),Lt[n.name.value]=t}})})();function pa(e,n){for(var t=0;t<e.definitions.length;t++){var i=e.definitions[t];if(i.name&&i.name.value==n)return i}}function ls(e,n){var t={kind:e.kind,definitions:[pa(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var i=Lt[n]||new Set,a=new Set,r=new Set;for(i.forEach(function(o){r.add(o)});r.size>0;){var u=r;r=new Set,u.forEach(function(o){if(!a.has(o)){a.add(o);var s=Lt[o]||new Set;s.forEach(function(c){r.add(c)})}})}return a.forEach(function(o){var s=pa(e,o);s&&t.definitions.push(s)}),t}ls(Mn,"UserVerification");class ds{client;constructor(n){this.client=n}async createUser(n){return this.client.request({method:"post",path:"/users/integration",body:n})}async create(n){return this.createUser(n)}async requestApiKey(n){return this.client.request({method:"post",path:"/users/integration/user/request-key",body:{email:n}})}async authorizeApiKeyWithOTP(n){return this.client.request({method:"post",path:"/users/integration/user/validate-otp",body:n})}async getCurrentUser(){return(await this.client.query({query:_e}))?.me??null}async getUserVerification(){return(await this.client.query({query:Mn}))?.verification??null}}var Ke={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"VirtualDebitCardFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"VirtualCard"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"country"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currency"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"mask"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"balance"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"renderSecret"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"virtualCardType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"billingInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"holder"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"phone"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"email"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"address"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"street"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"street2"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"city"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subdivision"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"postalCode"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"countryCode"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:408}};Ke.loc.source={body:`fragment VirtualDebitCardFragment on VirtualCard {
343
344
  id
344
345
  name
345
346
  userId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spritz-finance/api-client",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Typescript library for interacting with the Spritz Finance API",
5
5
  "main": "dist/spritz-api-client.js",
6
6
  "module": "dist/spritz-api-client.mjs",