@spritz-finance/api-client 0.2.3 → 0.2.5
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 +14 -0
- package/dist/spritz-api-client.d.ts +38 -1
- package/dist/spritz-api-client.js +55 -47
- package/dist/spritz-api-client.mjs +55 -47
- package/package.json +1 -1
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[];
|
|
@@ -411,6 +412,25 @@ interface PayableAccountInstitutionFragment {
|
|
|
411
412
|
logo: string | null;
|
|
412
413
|
}
|
|
413
414
|
|
|
415
|
+
interface Payment_payment {
|
|
416
|
+
__typename: 'Payment';
|
|
417
|
+
id: string;
|
|
418
|
+
userId: any;
|
|
419
|
+
status: PaymentStatus;
|
|
420
|
+
accountId: any;
|
|
421
|
+
amount: number | null;
|
|
422
|
+
feeAmount: number | null;
|
|
423
|
+
createdAt: any;
|
|
424
|
+
deliveryMethod: PaymentDeliveryMethod | null;
|
|
425
|
+
paymentRequestId: string | null;
|
|
426
|
+
}
|
|
427
|
+
interface Payment {
|
|
428
|
+
payment: Payment_payment | null;
|
|
429
|
+
}
|
|
430
|
+
interface PaymentVariables {
|
|
431
|
+
paymentId: string;
|
|
432
|
+
}
|
|
433
|
+
|
|
414
434
|
interface PaymentFragment {
|
|
415
435
|
__typename: 'Payment';
|
|
416
436
|
id: string;
|
|
@@ -421,6 +441,7 @@ interface PaymentFragment {
|
|
|
421
441
|
feeAmount: number | null;
|
|
422
442
|
createdAt: any;
|
|
423
443
|
deliveryMethod: PaymentDeliveryMethod | null;
|
|
444
|
+
paymentRequestId: string | null;
|
|
424
445
|
}
|
|
425
446
|
|
|
426
447
|
interface PaymentRequestFragment {
|
|
@@ -447,6 +468,7 @@ interface PaymentRequestPayment_paymentForPaymentRequest {
|
|
|
447
468
|
feeAmount: number | null;
|
|
448
469
|
createdAt: any;
|
|
449
470
|
deliveryMethod: PaymentDeliveryMethod | null;
|
|
471
|
+
paymentRequestId: string | null;
|
|
450
472
|
}
|
|
451
473
|
interface PaymentRequestPayment {
|
|
452
474
|
paymentForPaymentRequest: PaymentRequestPayment_paymentForPaymentRequest | null;
|
|
@@ -1120,6 +1142,7 @@ declare class PaymentService {
|
|
|
1120
1142
|
private client;
|
|
1121
1143
|
constructor(client: SpritzClient);
|
|
1122
1144
|
listForAccount(accountId: string): Promise<AccountPayments_paymentsForAccount[]>;
|
|
1145
|
+
fetchById(paymentId: string): Promise<Payment_payment | null>;
|
|
1123
1146
|
getForPaymentRequest(paymentRequestId: string): Promise<PaymentRequestPayment_paymentForPaymentRequest | null>;
|
|
1124
1147
|
}
|
|
1125
1148
|
|
|
@@ -1172,14 +1195,28 @@ interface CreateUserResponse {
|
|
|
1172
1195
|
email: string;
|
|
1173
1196
|
apiKey: string;
|
|
1174
1197
|
}
|
|
1198
|
+
interface RequestApiKeyResponse {
|
|
1199
|
+
success: boolean;
|
|
1200
|
+
}
|
|
1175
1201
|
interface CreateUserParams {
|
|
1176
1202
|
email: string;
|
|
1177
1203
|
}
|
|
1204
|
+
interface AuthorizeApiKeyResponse {
|
|
1205
|
+
apiKey: string;
|
|
1206
|
+
userId: any;
|
|
1207
|
+
email: string;
|
|
1208
|
+
}
|
|
1209
|
+
interface AuthorizeApiKeyParams {
|
|
1210
|
+
otp: any;
|
|
1211
|
+
email: string;
|
|
1212
|
+
}
|
|
1178
1213
|
declare class UserService {
|
|
1179
1214
|
private client;
|
|
1180
1215
|
constructor(client: SpritzClient);
|
|
1181
1216
|
createUser(args: CreateUserParams): Promise<CreateUserResponse>;
|
|
1182
1217
|
create(args: CreateUserParams): Promise<CreateUserResponse>;
|
|
1218
|
+
requestApiKey(email: string): Promise<RequestApiKeyResponse>;
|
|
1219
|
+
authorizeApiKeyWithOTP(args: AuthorizeApiKeyParams): Promise<AuthorizeApiKeyResponse>;
|
|
1183
1220
|
getCurrentUser(): Promise<CurrentUser_me>;
|
|
1184
1221
|
getUserVerification(): Promise<UserVerification_verification | null>;
|
|
1185
1222
|
}
|
|
@@ -1299,4 +1336,4 @@ declare class SpritzApiClient {
|
|
|
1299
1336
|
setApiKey(_apiKey: string): this;
|
|
1300
1337
|
}
|
|
1301
1338
|
|
|
1302
|
-
export { AccountPayments, AccountPaymentsVariables, AccountPayments_paymentsForAccount, BankAccountFragment, BankAccountFragment_bankAccountDetails, BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails, BankAccountFragment_bankAccountDetails_USBankAccountDetails, BankAccountFragment_institution, BankAccountInput, BankAccountSubType, BankAccountType, BillFragment, BillFragment_billAccountDetails, BillFragment_dataSync, BillFragment_institution, BillType, CreateDirectPaymentInput, CreatePaymentRequestInput, CurrentUser, CurrentUser_me, Environment, GetSpritzPayParams, GetSpritzPayParamsVariables, GetSpritzPayParams_spritzPayParams, PayableAccountFragment, PayableAccountFragment_BankAccount, PayableAccountFragment_BankAccount_bankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_CanadianBankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_USBankAccountDetails, PayableAccountFragment_BankAccount_dataSync, PayableAccountFragment_BankAccount_institution, PayableAccountFragment_Bill, PayableAccountFragment_Bill_billAccountDetails, PayableAccountFragment_Bill_dataSync, PayableAccountFragment_Bill_institution, PayableAccountFragment_VirtualCard, PayableAccountFragment_VirtualCard_billingInfo, PayableAccountFragment_VirtualCard_billingInfo_address, PayableAccountFragment_VirtualCard_dataSync, PayableAccountFragment_VirtualCard_institution, PayableAccountInstitutionFragment, PayableAccountType, PaymentFragment, PaymentNetwork, PaymentRequestFragment, PaymentRequestPayment, PaymentRequestPaymentVariables, PaymentRequestPayment_paymentForPaymentRequest, DirectPaymentStatus as PaymentRequestStatus, PaymentStatus, PopularBillInstitutions, PopularBillInstitutionsVariables, PopularBillInstitutions_popularUSBillInstitutions, SearchUSBillInstitutions, SearchUSBillInstitutionsVariables, SearchUSBillInstitutions_searchUSBillInstitutions, SpritzApiClient, TokenBalanceFragment, TransactionPrice, TransactionPriceVariables, UserBankAccounts, UserBankAccounts_bankAccounts, UserBankAccounts_bankAccounts_bankAccountDetails, UserBankAccounts_bankAccounts_bankAccountDetails_CanadianBankAccountDetails, UserBankAccounts_bankAccounts_bankAccountDetails_USBankAccountDetails, UserBankAccounts_bankAccounts_institution, UserBills, UserBills_bills, UserBills_bills_billAccountDetails, UserBills_bills_dataSync, UserBills_bills_institution, UserFragment, UserPayableAccounts, UserPayableAccounts_payableAccounts, UserPayableAccounts_payableAccounts_BankAccount, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_CanadianBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_USBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_dataSync, UserPayableAccounts_payableAccounts_BankAccount_institution, UserPayableAccounts_payableAccounts_Bill, UserPayableAccounts_payableAccounts_Bill_billAccountDetails, UserPayableAccounts_payableAccounts_Bill_dataSync, UserPayableAccounts_payableAccounts_Bill_institution, UserPayableAccounts_payableAccounts_VirtualCard, UserPayableAccounts_payableAccounts_VirtualCard_billingInfo, UserPayableAccounts_payableAccounts_VirtualCard_billingInfo_address, UserPayableAccounts_payableAccounts_VirtualCard_dataSync, UserPayableAccounts_payableAccounts_VirtualCard_institution, UserVerification, UserVerification_verification, UserVerification_verification_identity, UserVerification_verification_identity_user, UserVirtualDebitCard, UserVirtualDebitCard_virtualDebitCard, UserVirtualDebitCard_virtualDebitCard_billingInfo, UserVirtualDebitCard_virtualDebitCard_billingInfo_address, VirtualCardType, VirtualDebitCardFragment, VirtualDebitCardFragment_billingInfo, VirtualDebitCardFragment_billingInfo_address, WalletTokenBalances, WalletTokenBalancesVariables, WalletTokenBalances_tokenBalances };
|
|
1339
|
+
export { AccountPayments, AccountPaymentsVariables, AccountPayments_paymentsForAccount, BankAccountFragment, BankAccountFragment_bankAccountDetails, BankAccountFragment_bankAccountDetails_CanadianBankAccountDetails, BankAccountFragment_bankAccountDetails_USBankAccountDetails, BankAccountFragment_institution, BankAccountInput, BankAccountSubType, BankAccountType, BillFragment, BillFragment_billAccountDetails, BillFragment_dataSync, BillFragment_institution, BillType, CreateDirectPaymentInput, CreatePaymentRequestInput, CurrentUser, CurrentUser_me, Environment, GetSpritzPayParams, GetSpritzPayParamsVariables, GetSpritzPayParams_spritzPayParams, PayableAccountFragment, PayableAccountFragment_BankAccount, PayableAccountFragment_BankAccount_bankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_CanadianBankAccountDetails, PayableAccountFragment_BankAccount_bankAccountDetails_USBankAccountDetails, PayableAccountFragment_BankAccount_dataSync, PayableAccountFragment_BankAccount_institution, PayableAccountFragment_Bill, PayableAccountFragment_Bill_billAccountDetails, PayableAccountFragment_Bill_dataSync, PayableAccountFragment_Bill_institution, PayableAccountFragment_VirtualCard, PayableAccountFragment_VirtualCard_billingInfo, PayableAccountFragment_VirtualCard_billingInfo_address, PayableAccountFragment_VirtualCard_dataSync, PayableAccountFragment_VirtualCard_institution, PayableAccountInstitutionFragment, PayableAccountType, Payment, PaymentFragment, PaymentNetwork, PaymentRequestFragment, PaymentRequestPayment, PaymentRequestPaymentVariables, PaymentRequestPayment_paymentForPaymentRequest, DirectPaymentStatus as PaymentRequestStatus, PaymentStatus, PaymentVariables, Payment_payment, PopularBillInstitutions, PopularBillInstitutionsVariables, PopularBillInstitutions_popularUSBillInstitutions, SearchUSBillInstitutions, SearchUSBillInstitutionsVariables, SearchUSBillInstitutions_searchUSBillInstitutions, SpritzApiClient, TokenBalanceFragment, TransactionPrice, TransactionPriceVariables, UserBankAccounts, UserBankAccounts_bankAccounts, UserBankAccounts_bankAccounts_bankAccountDetails, UserBankAccounts_bankAccounts_bankAccountDetails_CanadianBankAccountDetails, UserBankAccounts_bankAccounts_bankAccountDetails_USBankAccountDetails, UserBankAccounts_bankAccounts_institution, UserBills, UserBills_bills, UserBills_bills_billAccountDetails, UserBills_bills_dataSync, UserBills_bills_institution, UserFragment, UserPayableAccounts, UserPayableAccounts_payableAccounts, UserPayableAccounts_payableAccounts_BankAccount, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_CanadianBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_bankAccountDetails_USBankAccountDetails, UserPayableAccounts_payableAccounts_BankAccount_dataSync, UserPayableAccounts_payableAccounts_BankAccount_institution, UserPayableAccounts_payableAccounts_Bill, UserPayableAccounts_payableAccounts_Bill_billAccountDetails, UserPayableAccounts_payableAccounts_Bill_dataSync, UserPayableAccounts_payableAccounts_Bill_institution, UserPayableAccounts_payableAccounts_VirtualCard, UserPayableAccounts_payableAccounts_VirtualCard_billingInfo, UserPayableAccounts_payableAccounts_VirtualCard_billingInfo_address, UserPayableAccounts_payableAccounts_VirtualCard_dataSync, UserPayableAccounts_payableAccounts_VirtualCard_institution, UserVerification, UserVerification_verification, UserVerification_verification_identity, UserVerification_verification_identity_user, UserVirtualDebitCard, UserVirtualDebitCard_virtualDebitCard, UserVirtualDebitCard_virtualDebitCard_billingInfo, UserVirtualDebitCard_virtualDebitCard_billingInfo_address, VirtualCardType, VirtualDebitCardFragment, VirtualDebitCardFragment_billingInfo, VirtualDebitCardFragment_billingInfo_address, WalletTokenBalances, WalletTokenBalancesVariables, WalletTokenBalances_tokenBalances };
|