Skip to content

Commit d38056d

Browse files
axshaniilyamerman
andauthored
update list params (#357)
* update list params * lint --------- Co-authored-by: Ilya Merman <[email protected]>
1 parent db79c70 commit d38056d

File tree

13 files changed

+64
-48
lines changed

13 files changed

+64
-48
lines changed

resources/application.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Application, BeneficialOwner, BeneficialOwnerDTO, ApplicationDocument, CreateApplicationRequest, DownloadDocumentRequest, PatchApplicationRequest, UploadDocumentRequest, VerifyDocumentRequest, CancelApplicationRequest, PatchBusinessApplicationBeneficialOwner } from "../types/application"
2-
import { UnitResponse, Include, UnitConfig, BaseListParams } from "../types/common"
1+
import { Application, BeneficialOwner, BeneficialOwnerDTO, ApplicationDocument, CreateApplicationRequest, DownloadDocumentRequest, PatchApplicationRequest, UploadDocumentRequest, VerifyDocumentRequest, CancelApplicationRequest, PatchBusinessApplicationBeneficialOwner, ApplicationStatus } from "../types/application"
2+
import { UnitResponse, Include, UnitConfig, BaseListParams, Tags, Sort } from "../types/common"
33
import { BaseResource } from "./baseResource"
44

55
export class Applications extends BaseResource {
@@ -121,16 +121,16 @@ export interface ApplicationListParams extends BaseListParams {
121121
* Optional. Filter Applications by Tags.
122122
* default: empty
123123
*/
124-
tags?: object
124+
tags?: Tags
125125

126126
/**
127127
* Optional. sort=createdAt for ascending order or sort=-createdAt (leading minus sign) for descending order.
128128
* default: sort=-createdAt
129129
*/
130-
sort?: string
130+
sort?: Sort
131131

132132
/**
133-
* Optional. Filter Account by its status (Open, Frozen, or Closed). Usage example: filter[status][0]=Closed
133+
* Optional. Filter applications by [Application Status](https://docs.unit.co/applications#application-statuses). Usage example: filter[status][0]=Pending&filter[status][1]=Approved
134134
*/
135-
status?: string[]
135+
status?: ApplicationStatus[]
136136
}

resources/applicationForm.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BaseResource } from "./baseResource"
2-
import { BaseListParams, Include, UnitConfig, UnitResponse } from "../types/common"
2+
import { BaseListParams, Include, Sort, Tags, UnitConfig, UnitResponse } from "../types/common"
33
import { CreateApplicationFormRequest, CreateApplicationFormResponse, ApplicationForm } from "../types/applicationForm"
44
import { Application } from "../types"
55

@@ -32,11 +32,11 @@ export interface ApplicationFormsListParams extends BaseListParams {
3232
* Optional. Filter Applications by [Tags](https://developers.unit.co/#tags).
3333
* default: empty
3434
*/
35-
tags?: object
35+
tags?: Tags
3636

3737
/**
3838
* Optional. sort=period for ascending order. Provide sort=-period (leading minus sign) for descending order.
3939
* default: sort=-period
4040
*/
41-
sort?: string
41+
sort?: Sort
4242
}

resources/authorization.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Authorization, AuthorizationStatus } from "../types/authorization"
2-
import { BaseListParams, Meta, UnitConfig, UnitResponse } from "../types/common"
2+
import { BaseListParams, Meta, Sort, UnitConfig, UnitResponse } from "../types/common"
33
import { BaseResource } from "./baseResource"
44

55
export class Authorizations extends BaseResource {
@@ -88,7 +88,7 @@ export interface AuthorizationQueryParams extends BaseListParams {
8888
/**
8989
* Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order.
9090
*/
91-
sort?: string
91+
sort?: Sort
9292

9393
/**
9494
* Optional. Filter result by their 4-digit ISO 18245 merchant category code (MCC).

resources/cards.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
2-
Card, CardLimits, CreateDebitCardRequest, EnableCardToCardPaymentRequest, EnableCardToCardPaymentResponse, MobileWalletPayload, MobileWalletPayloadRequest, PinStatus, ReplaceCardRequest, UpdateCardRequest, CreateCardRquest} from "../types/cards"
3-
import { BaseListParams, Include, UnitConfig, UnitResponse } from "../types/common"
2+
Card, CardLimits, CreateDebitCardRequest, EnableCardToCardPaymentRequest, EnableCardToCardPaymentResponse, MobileWalletPayload, MobileWalletPayloadRequest, PinStatus, ReplaceCardRequest, UpdateCardRequest, CreateCardRquest, CardStatus} from "../types/cards"
3+
import { BaseListParams, Include, Sort, Tags, UnitConfig, UnitResponse } from "../types/common"
44
import { Customer } from "../types/customer"
55
import { Account } from "../types/account"
66
import { BaseResource } from "./baseResource"
@@ -131,17 +131,17 @@ export interface CardListParams extends BaseListParams {
131131
/**
132132
* Optional. Filter customers by status (Active, Archived). Usage example: *filter[status][0]=Active
133133
*/
134-
status?: string[]
134+
status?: CardStatus[]
135135

136136
/**
137137
* Optional. Filter Applications by Tags.
138138
* default: empty
139139
*/
140-
tags?: object
140+
tags?: Tags
141141

142142
/**
143143
* Optional. sort=createdAt for ascending order or sort=-createdAt (leading minus sign) for descending order.
144144
* default: sort=-createdAt
145145
*/
146-
sort?: string
146+
sort?: Sort
147147
}

resources/checkDeposit.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Account, Customer, Transaction } from "../types"
1+
import { Account, CheckDepositStatus, Customer, Sort, Tags, Transaction } from "../types"
22
import { CheckDeposit, CreateCheckDepositRequest, PatchCheckDepositRequest, UploadCheckDepositRequest } from "../types"
33
import { UnitResponse, Include, UnitConfig, BaseListParams } from "../types"
44
import { BaseResource } from "./baseResource"
@@ -79,17 +79,17 @@ export interface CheckDepositListParams extends BaseListParams {
7979
* Optional. Filter Applications by [Tags](https://developers.unit.co/#tags).
8080
* default: empty
8181
*/
82-
tags?: object
82+
tags?: Tags
8383

8484
/**
8585
* Optional. Filter results by [Check Deposit Status](https://developers.unit.co/check-deposits#check-deposit-status).
8686
*/
87-
status?: string[]
87+
status?: CheckDepositStatus[]
8888

8989
/**
9090
* Optional. Leave empty or provide sort=createdAt for ascending order. Provide sort=-createdAt (leading minus sign) for descending order.
9191
*/
92-
sort?: string
92+
sort?: Sort
9393

9494
/**
9595
* Optional. Related resource available to include: customer. See [Getting Related Resources](https://developers.unit.co/#intro-getting-related-resources).

resources/customer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { UnitResponse, UnitConfig, Meta, BaseListParams } from "../types/common"
2-
import { Customer, PatchCustomerRequest, ArchiveCustomerRequest, AddAuthorizedUsersRequest, RemoveAuthorizedUsersRequest } from "../types/customer"
1+
import { UnitResponse, UnitConfig, Meta, BaseListParams, Tags, Sort } from "../types/common"
2+
import { Customer, PatchCustomerRequest, ArchiveCustomerRequest, AddAuthorizedUsersRequest, RemoveAuthorizedUsersRequest, CustomerStatus } from "../types/customer"
33
import { BaseResource } from "./baseResource"
44

55
export class Customers extends BaseResource {
@@ -65,16 +65,16 @@ export interface CustomersListParams extends BaseListParams {
6565
* Optional. Filter customers by Tags.
6666
* default: empty
6767
*/
68-
tags?: object
68+
tags?: Tags
6969

7070
/**
7171
* Optional. Filter customers by status (Active, Archived). Usage example: *filter[status][0]=Active
7272
*/
73-
status?: string[]
73+
status?: CustomerStatus[]
7474

7575
/**
7676
* Optional. sort=createdAt for ascending order or sort=-createdAt (leading minus sign) for descending order.
7777
* default: sort=-createdAt
7878
*/
79-
sort?: string
79+
sort?: Sort
8080
}

resources/payments.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Account } from "../types/account"
2-
import { BaseListParams, Include, Meta, UnitConfig, UnitResponse } from "../types/common"
2+
import { BaseListParams, Include, Meta, Sort, Tags, UnitConfig, UnitResponse } from "../types/common"
33
import { Customer } from "../types/customer"
4-
import { BulkPayments, CreatePaymentRequest, PatchPaymentRequest, Payment } from "../types/payments"
4+
import { BulkPayments, CreatePaymentRequest, PatchPaymentRequest, Payment, PaymentStatus } from "../types/payments"
55
import { Transaction } from "../types/transactions"
66
import { BaseResource } from "./baseResource"
77

@@ -45,6 +45,7 @@ export class Payments extends BaseResource {
4545
...(params?.since && { "filter[since]": params.since }),
4646
...(params?.until && { "filter[until]": params.until }),
4747
...(params?.counterpartyAccountId && { "filter[counterpartyAccountId]": params.counterpartyAccountId }),
48+
...(params?.recurringPaymentId && { "filter[recurringPaymentId]": params.recurringPaymentId }),
4849
...(params?.fromAmount && { "filter[fromAmount]": params.fromAmount }),
4950
...(params?.toAmount && { "filter[toAmount]": params.toAmount }),
5051
"sort": params?.sort ? params.sort : "-createdAt",
@@ -65,6 +66,11 @@ export class Payments extends BaseResource {
6566
params.direction.forEach((d, idx) => {
6667
parameters[`filter[direction][${idx}]`] = d
6768
})
69+
70+
if (params?.feature)
71+
params.feature.forEach((d, idx) => {
72+
parameters[`filter[feature][${idx}]`] = d
73+
})
6874

6975
return this.httpGet<UnitResponse<Payment[]> & Include<Account[] | Customer[] | Transaction[]> & Meta>("", { params: parameters })
7076
}
@@ -87,12 +93,12 @@ export interface PaymentListParams extends BaseListParams {
8793
* Optional. Filter Applications by Tags.
8894
* default: empty
8995
*/
90-
tags?: object
96+
tags?: Tags
9197

9298
/**
9399
* Optional. Filter Payments by [ACH Status](https://developers.unit.co/payments/#ach-status).
94100
*/
95-
status?: string[]
101+
status?: PaymentStatus[]
96102

97103
/**
98104
* Optional. Filter Payments by Payment type. such as (ACHPayment, BookPayment, WirePayment or BillPayment).
@@ -133,11 +139,21 @@ export interface PaymentListParams extends BaseListParams {
133139
* Optional. Leave empty or provide sort = createdAt for ascending order.Provide sort = -createdAt(leading minus sign) for descending order.
134140
* default: sort=-createdAt
135141
*/
136-
sort?: string
142+
sort?: Sort
137143

138144
/**
139145
* Optional. A comma-separated list of related resources to include in the response.
140146
* Related resources include: customer, account. [See Getting Related Resources](https://developers.unit.co/#intro-getting-related-resources)
141147
*/
142148
include?: string
149+
150+
/**
151+
* Optional. Filters the results by the specified recurring payment id.
152+
*/
153+
recurringPaymentId?: string
154+
155+
/**
156+
* Optional. Filter Payments by Payment feature (SameDay, RecurringPayment). Usage example: filter[feature][0]=SameDay
157+
*/
158+
feature?: string[]
143159
}

resources/receivedPayments.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Account } from "../types/account"
2-
import {BaseListParams, Include, Meta, UnitConfig, UnitResponse} from "../types/common"
2+
import {BaseListParams, Include, Meta, Sort, Tags, UnitConfig, UnitResponse} from "../types/common"
33
import { Customer } from "../types/customer"
44
import { AchReceivedPayment, PatchPaymentRequest, ReceivedPaymentStatus } from "../types/payments"
55
import { Transaction } from "../types/transactions"
@@ -66,7 +66,7 @@ export interface ReceivedPaymentListParams extends BaseListParams {
6666
* Optional. Filter Applications by Tags.
6767
* default: empty
6868
*/
69-
tags?: object
69+
tags?: Tags
7070

7171
/**
7272
* Optional. Filter Received Payments by ReceivedPayment Status. Usage example: filter[status][0]=Pending&filter[status][1]=Advanced. cant be stated with includeCompleted.
@@ -82,7 +82,7 @@ export interface ReceivedPaymentListParams extends BaseListParams {
8282
* Optional. Leave empty or provide sort = createdAt for ascending order.Provide sort = -createdAt(leading minus sign) for descending order.
8383
* default: sort=-createdAt
8484
*/
85-
sort?: string
85+
sort?: Sort
8686

8787
/**
8888
* Optional. A comma-separated list of related resources to include in the response.

resources/recurringPayments.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BaseResource } from "./baseResource"
2-
import { BaseListParams, Meta, UnitConfig, UnitResponse } from "../types/common"
3-
import { CreateRecurringPaymentRequest, RecurringPayment } from "../types/recurringPayment"
2+
import { BaseListParams, Meta, Sort, Tags, UnitConfig, UnitResponse } from "../types/common"
3+
import { CreateRecurringPaymentRequest, RecurringPayment, RecurringPaymentStatus } from "../types/recurringPayment"
44

55
export class RecurringPayments extends BaseResource {
66
constructor(token: string, basePath: string, config?: UnitConfig) {
@@ -84,12 +84,12 @@ export interface RecurringPaymentListParams extends BaseListParams {
8484
* Optional. Filter Applications by Tags.
8585
* default: empty
8686
*/
87-
tags?: object
87+
tags?: Tags
8888

8989
/**
9090
* Optional. Filter recurring payments by status (Active, Completed or Disabled). Usage example: *filter[status][0]=Active
9191
*/
92-
status?: string[]
92+
status?: RecurringPaymentStatus[]
9393

9494
/**
9595
* Optional. Filter recurring payments by Recurring Payment type. such as (RecurringCreditAchPayment, RecurringCreditBookPayment). Usage example: filter[type][0]=RecurringCreditAchPayment&filter[type][1]=RecurringCreditBookPayment
@@ -124,5 +124,5 @@ export interface RecurringPaymentListParams extends BaseListParams {
124124
* Optional. Leave empty or provide sort = createdAt for ascending order.Provide sort = -createdAt(leading minus sign) for descending order.
125125
* default: sort=-createdAt
126126
*/
127-
sort?: string
127+
sort?: Sort
128128
}

resources/statements.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { BaseListParams, Statement, UnitConfig, UnitResponse } from "../types"
1+
import { BaseListParams, Sort, Statement, UnitConfig, UnitResponse } from "../types"
22
import { BaseResource } from "./baseResource"
33
import {responseEncoding, ResponseType} from "axios"
44

@@ -60,7 +60,7 @@ export interface StatementsListParams extends BaseListParams {
6060
* Optional. sort=period for ascending order. Provide sort=-period (leading minus sign) for descending order.
6161
* default: sort=-period
6262
*/
63-
sort?: string
63+
sort?: Sort
6464

6565
/**
6666
* Optional. Filters the results for a specific month. e.g. 2021-01

0 commit comments

Comments
 (0)