@spritz-finance/api-client 0.4.14 → 0.4.15
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 +20 -0
- package/dist/spritz-api-client.cjs +1 -1
- package/dist/spritz-api-client.d.ts +2 -0
- package/dist/spritz-api-client.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1090,6 +1090,26 @@ Upon receiving a webhook, your server will get a payload with the following stru
|
|
|
1090
1090
|
}
|
|
1091
1091
|
```
|
|
1092
1092
|
|
|
1093
|
+
### Managing webhooks
|
|
1094
|
+
|
|
1095
|
+
#### List all webhooks
|
|
1096
|
+
|
|
1097
|
+
To retrieve all webhooks configured for your integration:
|
|
1098
|
+
|
|
1099
|
+
```typescript
|
|
1100
|
+
const webhooks = await client.webhook.list()
|
|
1101
|
+
// Returns an array of webhook configurations
|
|
1102
|
+
```
|
|
1103
|
+
|
|
1104
|
+
#### Delete a webhook
|
|
1105
|
+
|
|
1106
|
+
To delete a specific webhook by its ID:
|
|
1107
|
+
|
|
1108
|
+
```typescript
|
|
1109
|
+
const deletedWebhook = await client.webhook.delete('webhook-id-here')
|
|
1110
|
+
// Returns the deleted webhook object
|
|
1111
|
+
```
|
|
1112
|
+
|
|
1093
1113
|
### Webhook security and signing
|
|
1094
1114
|
|
|
1095
1115
|
Each webhook request is signed using an HMAC SHA256 signature, based on the exact JSON payload sent in the body. This signature is included in the Signature HTTP header of the request.
|
|
@@ -566,7 +566,7 @@ query UserVirtualDebitCard {
|
|
|
566
566
|
...VirtualDebitCardFragment
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var Av={};function Wb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Av[t]?!1:(Av[t]=!0,!0)})}wt.definitions=wt.definitions.concat(Wb(ci.definitions));function pr(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(u){pr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){pr(u,n)}),e.definitions&&e.definitions.forEach(function(u){pr(u,n)})}var Os={};(function(){wt.definitions.forEach(function(n){if(n.name){var t=new Set;pr(n,t),Os[n.name.value]=t}})})();function Cv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Yb(e,n){var t={kind:e.kind,definitions:[Cv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Os[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Os[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Cv(e,o);s&&t.definitions.push(s)}),t}Yb(wt,"UserVirtualDebitCard");const Xb={[xo.USVirtualDebitCard]:e=>({query:St,variables:void 0,response:"createUSVirtualDebitCard"})},ek=(e,n)=>Xb[e]?.(n)??null;class nk{client;constructor(n){this.client=n}async fetch(){return(await this.client.query({query:wt}))?.virtualDebitCard??null}async create(n,t){const u=ek(n,t);if(!u)throw new Error("Invalid virtual card type");return(await this.client.query({query:u.query,variables:u.variables}))?.[u.response]??null}}class tk{client;constructor(n){this.client=n}async create(n){return this.client.request({method:"post",path:"/users/integrators/webhooks",body:n})}async updateWebhookSecret(n){return this.client.request({method:"post",path:"/users/integrators/webhook-secret",body:{secret:n}})}}class Ps{environment;apiKey;integrationKey;client;user;bankAccount;debitCard;paymentRequest;payment;onrampPayment;virtualCard;bill;institution;webhook;constructor(n,t,u,i){if(t===void 0&&u===void 0)throw new Error("The integrationKey or apiKey variable appears to be missing or empty. Please ensure you provide it, or when initializing the SpritzApiClient, opt for the integratorKey option.");if(this.environment=n,this.apiKey=t,this.integrationKey=u,!i&&th())throw new Error(`It seems you're operating within a browser environment.
|
|
569
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var Av={};function Wb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return Av[t]?!1:(Av[t]=!0,!0)})}wt.definitions=wt.definitions.concat(Wb(ci.definitions));function pr(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(u){pr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){pr(u,n)}),e.definitions&&e.definitions.forEach(function(u){pr(u,n)})}var Os={};(function(){wt.definitions.forEach(function(n){if(n.name){var t=new Set;pr(n,t),Os[n.name.value]=t}})})();function Cv(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Yb(e,n){var t={kind:e.kind,definitions:[Cv(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Os[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Os[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Cv(e,o);s&&t.definitions.push(s)}),t}Yb(wt,"UserVirtualDebitCard");const Xb={[xo.USVirtualDebitCard]:e=>({query:St,variables:void 0,response:"createUSVirtualDebitCard"})},ek=(e,n)=>Xb[e]?.(n)??null;class nk{client;constructor(n){this.client=n}async fetch(){return(await this.client.query({query:wt}))?.virtualDebitCard??null}async create(n,t){const u=ek(n,t);if(!u)throw new Error("Invalid virtual card type");return(await this.client.query({query:u.query,variables:u.variables}))?.[u.response]??null}}class tk{client;constructor(n){this.client=n}async create(n){return this.client.request({method:"post",path:"/users/integrators/webhooks",body:n})}async updateWebhookSecret(n){return this.client.request({method:"post",path:"/users/integrators/webhook-secret",body:{secret:n}})}async list(){return this.client.request({method:"get",path:"/users/integrators/webhooks"})}async delete(n){return this.client.request({method:"delete",path:`/users/integrators/webhooks/${n}`})}}class Ps{environment;apiKey;integrationKey;client;user;bankAccount;debitCard;paymentRequest;payment;onrampPayment;virtualCard;bill;institution;webhook;constructor(n,t,u,i){if(t===void 0&&u===void 0)throw new Error("The integrationKey or apiKey variable appears to be missing or empty. Please ensure you provide it, or when initializing the SpritzApiClient, opt for the integratorKey option.");if(this.environment=n,this.apiKey=t,this.integrationKey=u,!i&&th())throw new Error(`It seems you're operating within a browser environment.
|
|
570
570
|
|
|
571
571
|
By default, this is deactivated due to the potential risk of exposing your confidential integrator credentials.
|
|
572
572
|
If you're aware of these risks and have taken necessary security measures, you can enable the \`dangerouslyAllowBrowser\` option, e.g.,
|
|
@@ -1758,6 +1758,8 @@ declare class WebhookService {
|
|
|
1758
1758
|
updateWebhookSecret(secret: string): Promise<{
|
|
1759
1759
|
success: boolean;
|
|
1760
1760
|
}>;
|
|
1761
|
+
list(): Promise<IntegratorWebhook[]>;
|
|
1762
|
+
delete(webhookId: string): Promise<IntegratorWebhook>;
|
|
1761
1763
|
}
|
|
1762
1764
|
|
|
1763
1765
|
type ClientOptions = {
|
|
@@ -566,7 +566,7 @@ query UserVirtualDebitCard {
|
|
|
566
566
|
...VirtualDebitCardFragment
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
|
-
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var _v={};function Yb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return _v[t]?!1:(_v[t]=!0,!0)})}wt.definitions=wt.definitions.concat(Yb(ci.definitions));function pr(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(u){pr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){pr(u,n)}),e.definitions&&e.definitions.forEach(function(u){pr(u,n)})}var Os={};(function(){wt.definitions.forEach(function(n){if(n.name){var t=new Set;pr(n,t),Os[n.name.value]=t}})})();function Av(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Xb(e,n){var t={kind:e.kind,definitions:[Av(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Os[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Os[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Av(e,o);s&&t.definitions.push(s)}),t}Xb(wt,"UserVirtualDebitCard");const ek={[xo.USVirtualDebitCard]:e=>({query:St,variables:void 0,response:"createUSVirtualDebitCard"})},nk=(e,n)=>ek[e]?.(n)??null;class tk{client;constructor(n){this.client=n}async fetch(){return(await this.client.query({query:wt}))?.virtualDebitCard??null}async create(n,t){const u=nk(n,t);if(!u)throw new Error("Invalid virtual card type");return(await this.client.query({query:u.query,variables:u.variables}))?.[u.response]??null}}class ik{client;constructor(n){this.client=n}async create(n){return this.client.request({method:"post",path:"/users/integrators/webhooks",body:n})}async updateWebhookSecret(n){return this.client.request({method:"post",path:"/users/integrators/webhook-secret",body:{secret:n}})}}class Ps{environment;apiKey;integrationKey;client;user;bankAccount;debitCard;paymentRequest;payment;onrampPayment;virtualCard;bill;institution;webhook;constructor(n,t,u,i){if(t===void 0&&u===void 0)throw new Error("The integrationKey or apiKey variable appears to be missing or empty. Please ensure you provide it, or when initializing the SpritzApiClient, opt for the integratorKey option.");if(this.environment=n,this.apiKey=t,this.integrationKey=u,!i&&ih())throw new Error(`It seems you're operating within a browser environment.
|
|
569
|
+
`,name:"GraphQL request",locationOffset:{line:1,column:1}};var _v={};function Yb(e){return e.filter(function(n){if(n.kind!=="FragmentDefinition")return!0;var t=n.name.value;return _v[t]?!1:(_v[t]=!0,!0)})}wt.definitions=wt.definitions.concat(Yb(ci.definitions));function pr(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(u){pr(u,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(u){pr(u,n)}),e.definitions&&e.definitions.forEach(function(u){pr(u,n)})}var Os={};(function(){wt.definitions.forEach(function(n){if(n.name){var t=new Set;pr(n,t),Os[n.name.value]=t}})})();function Av(e,n){for(var t=0;t<e.definitions.length;t++){var u=e.definitions[t];if(u.name&&u.name.value==n)return u}}function Xb(e,n){var t={kind:e.kind,definitions:[Av(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var u=Os[n]||new Set,i=new Set,r=new Set;for(u.forEach(function(o){r.add(o)});r.size>0;){var a=r;r=new Set,a.forEach(function(o){if(!i.has(o)){i.add(o);var s=Os[o]||new Set;s.forEach(function(c){r.add(c)})}})}return i.forEach(function(o){var s=Av(e,o);s&&t.definitions.push(s)}),t}Xb(wt,"UserVirtualDebitCard");const ek={[xo.USVirtualDebitCard]:e=>({query:St,variables:void 0,response:"createUSVirtualDebitCard"})},nk=(e,n)=>ek[e]?.(n)??null;class tk{client;constructor(n){this.client=n}async fetch(){return(await this.client.query({query:wt}))?.virtualDebitCard??null}async create(n,t){const u=nk(n,t);if(!u)throw new Error("Invalid virtual card type");return(await this.client.query({query:u.query,variables:u.variables}))?.[u.response]??null}}class ik{client;constructor(n){this.client=n}async create(n){return this.client.request({method:"post",path:"/users/integrators/webhooks",body:n})}async updateWebhookSecret(n){return this.client.request({method:"post",path:"/users/integrators/webhook-secret",body:{secret:n}})}async list(){return this.client.request({method:"get",path:"/users/integrators/webhooks"})}async delete(n){return this.client.request({method:"delete",path:`/users/integrators/webhooks/${n}`})}}class Ps{environment;apiKey;integrationKey;client;user;bankAccount;debitCard;paymentRequest;payment;onrampPayment;virtualCard;bill;institution;webhook;constructor(n,t,u,i){if(t===void 0&&u===void 0)throw new Error("The integrationKey or apiKey variable appears to be missing or empty. Please ensure you provide it, or when initializing the SpritzApiClient, opt for the integratorKey option.");if(this.environment=n,this.apiKey=t,this.integrationKey=u,!i&&ih())throw new Error(`It seems you're operating within a browser environment.
|
|
570
570
|
|
|
571
571
|
By default, this is deactivated due to the potential risk of exposing your confidential integrator credentials.
|
|
572
572
|
If you're aware of these risks and have taken necessary security measures, you can enable the \`dangerouslyAllowBrowser\` option, e.g.,
|