-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLithicClientImpl.kt
More file actions
602 lines (438 loc) · 24.5 KB
/
Copy pathLithicClientImpl.kt
File metadata and controls
602 lines (438 loc) · 24.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
// File generated from our OpenAPI spec by Stainless.
package com.lithic.api.client
import com.lithic.api.core.ClientOptions
import com.lithic.api.core.RequestOptions
import com.lithic.api.core.getPackageVersion
import com.lithic.api.core.handlers.errorBodyHandler
import com.lithic.api.core.handlers.errorHandler
import com.lithic.api.core.handlers.jsonHandler
import com.lithic.api.core.http.HttpMethod
import com.lithic.api.core.http.HttpRequest
import com.lithic.api.core.http.HttpResponse
import com.lithic.api.core.http.HttpResponse.Handler
import com.lithic.api.core.http.HttpResponseFor
import com.lithic.api.core.http.parseable
import com.lithic.api.core.prepare
import com.lithic.api.models.ApiStatus
import com.lithic.api.models.ClientApiStatusParams
import com.lithic.api.services.blocking.AccountActivityService
import com.lithic.api.services.blocking.AccountActivityServiceImpl
import com.lithic.api.services.blocking.AccountHolderService
import com.lithic.api.services.blocking.AccountHolderServiceImpl
import com.lithic.api.services.blocking.AccountService
import com.lithic.api.services.blocking.AccountServiceImpl
import com.lithic.api.services.blocking.AuthRuleService
import com.lithic.api.services.blocking.AuthRuleServiceImpl
import com.lithic.api.services.blocking.AuthStreamEnrollmentService
import com.lithic.api.services.blocking.AuthStreamEnrollmentServiceImpl
import com.lithic.api.services.blocking.BalanceService
import com.lithic.api.services.blocking.BalanceServiceImpl
import com.lithic.api.services.blocking.BlockchainRecipientService
import com.lithic.api.services.blocking.BlockchainRecipientServiceImpl
import com.lithic.api.services.blocking.BookTransferService
import com.lithic.api.services.blocking.BookTransferServiceImpl
import com.lithic.api.services.blocking.CardAuthorizationService
import com.lithic.api.services.blocking.CardAuthorizationServiceImpl
import com.lithic.api.services.blocking.CardBulkOrderService
import com.lithic.api.services.blocking.CardBulkOrderServiceImpl
import com.lithic.api.services.blocking.CardProgramService
import com.lithic.api.services.blocking.CardProgramServiceImpl
import com.lithic.api.services.blocking.CardService
import com.lithic.api.services.blocking.CardServiceImpl
import com.lithic.api.services.blocking.CreditProductService
import com.lithic.api.services.blocking.CreditProductServiceImpl
import com.lithic.api.services.blocking.DigitalCardArtService
import com.lithic.api.services.blocking.DigitalCardArtServiceImpl
import com.lithic.api.services.blocking.DisputeService
import com.lithic.api.services.blocking.DisputeServiceImpl
import com.lithic.api.services.blocking.DisputesV2Service
import com.lithic.api.services.blocking.DisputesV2ServiceImpl
import com.lithic.api.services.blocking.EventService
import com.lithic.api.services.blocking.EventServiceImpl
import com.lithic.api.services.blocking.ExternalBankAccountService
import com.lithic.api.services.blocking.ExternalBankAccountServiceImpl
import com.lithic.api.services.blocking.ExternalPaymentService
import com.lithic.api.services.blocking.ExternalPaymentServiceImpl
import com.lithic.api.services.blocking.FinancialAccountService
import com.lithic.api.services.blocking.FinancialAccountServiceImpl
import com.lithic.api.services.blocking.FraudService
import com.lithic.api.services.blocking.FraudServiceImpl
import com.lithic.api.services.blocking.FundingEventService
import com.lithic.api.services.blocking.FundingEventServiceImpl
import com.lithic.api.services.blocking.HoldService
import com.lithic.api.services.blocking.HoldServiceImpl
import com.lithic.api.services.blocking.InternalTransactionService
import com.lithic.api.services.blocking.InternalTransactionServiceImpl
import com.lithic.api.services.blocking.ManagementOperationService
import com.lithic.api.services.blocking.ManagementOperationServiceImpl
import com.lithic.api.services.blocking.NetworkProgramService
import com.lithic.api.services.blocking.NetworkProgramServiceImpl
import com.lithic.api.services.blocking.PaymentService
import com.lithic.api.services.blocking.PaymentServiceImpl
import com.lithic.api.services.blocking.ReportService
import com.lithic.api.services.blocking.ReportServiceImpl
import com.lithic.api.services.blocking.ResponderEndpointService
import com.lithic.api.services.blocking.ResponderEndpointServiceImpl
import com.lithic.api.services.blocking.ThreeDSService
import com.lithic.api.services.blocking.ThreeDSServiceImpl
import com.lithic.api.services.blocking.TokenizationDecisioningService
import com.lithic.api.services.blocking.TokenizationDecisioningServiceImpl
import com.lithic.api.services.blocking.TokenizationService
import com.lithic.api.services.blocking.TokenizationServiceImpl
import com.lithic.api.services.blocking.TransactionMonitoringService
import com.lithic.api.services.blocking.TransactionMonitoringServiceImpl
import com.lithic.api.services.blocking.TransactionService
import com.lithic.api.services.blocking.TransactionServiceImpl
import com.lithic.api.services.blocking.TransferLimitService
import com.lithic.api.services.blocking.TransferLimitServiceImpl
import com.lithic.api.services.blocking.TransferService
import com.lithic.api.services.blocking.TransferServiceImpl
import com.lithic.api.services.blocking.WebhookService
import com.lithic.api.services.blocking.WebhookServiceImpl
import java.util.function.Consumer
class LithicClientImpl(private val clientOptions: ClientOptions) : LithicClient {
private val clientOptionsWithUserAgent =
if (clientOptions.headers.names().contains("User-Agent")) clientOptions
else
clientOptions
.toBuilder()
.putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}")
.build()
// Pass the original clientOptions so that this client sets its own User-Agent.
private val async: LithicClientAsync by lazy { LithicClientAsyncImpl(clientOptions) }
private val withRawResponse: LithicClient.WithRawResponse by lazy {
WithRawResponseImpl(clientOptions)
}
private val accounts: AccountService by lazy { AccountServiceImpl(clientOptionsWithUserAgent) }
private val accountHolders: AccountHolderService by lazy {
AccountHolderServiceImpl(clientOptionsWithUserAgent)
}
private val authRules: AuthRuleService by lazy {
AuthRuleServiceImpl(clientOptionsWithUserAgent)
}
private val transactionMonitoring: TransactionMonitoringService by lazy {
TransactionMonitoringServiceImpl(clientOptionsWithUserAgent)
}
private val authStreamEnrollment: AuthStreamEnrollmentService by lazy {
AuthStreamEnrollmentServiceImpl(clientOptionsWithUserAgent)
}
private val tokenizationDecisioning: TokenizationDecisioningService by lazy {
TokenizationDecisioningServiceImpl(clientOptionsWithUserAgent)
}
private val tokenizations: TokenizationService by lazy {
TokenizationServiceImpl(clientOptionsWithUserAgent)
}
private val cards: CardService by lazy { CardServiceImpl(clientOptionsWithUserAgent) }
private val cardAuthorizations: CardAuthorizationService by lazy {
CardAuthorizationServiceImpl(clientOptionsWithUserAgent)
}
private val cardBulkOrders: CardBulkOrderService by lazy {
CardBulkOrderServiceImpl(clientOptionsWithUserAgent)
}
private val balances: BalanceService by lazy { BalanceServiceImpl(clientOptionsWithUserAgent) }
private val disputes: DisputeService by lazy { DisputeServiceImpl(clientOptionsWithUserAgent) }
private val disputesV2: DisputesV2Service by lazy {
DisputesV2ServiceImpl(clientOptionsWithUserAgent)
}
private val events: EventService by lazy { EventServiceImpl(clientOptionsWithUserAgent) }
private val transfers: TransferService by lazy {
TransferServiceImpl(clientOptionsWithUserAgent)
}
private val financialAccounts: FinancialAccountService by lazy {
FinancialAccountServiceImpl(clientOptionsWithUserAgent)
}
private val transactions: TransactionService by lazy {
TransactionServiceImpl(clientOptionsWithUserAgent)
}
private val responderEndpoints: ResponderEndpointService by lazy {
ResponderEndpointServiceImpl(clientOptionsWithUserAgent)
}
private val externalBankAccounts: ExternalBankAccountService by lazy {
ExternalBankAccountServiceImpl(clientOptionsWithUserAgent)
}
private val blockchainRecipients: BlockchainRecipientService by lazy {
BlockchainRecipientServiceImpl(clientOptionsWithUserAgent)
}
private val payments: PaymentService by lazy { PaymentServiceImpl(clientOptionsWithUserAgent) }
private val threeDS: ThreeDSService by lazy { ThreeDSServiceImpl(clientOptionsWithUserAgent) }
private val reports: ReportService by lazy { ReportServiceImpl(clientOptionsWithUserAgent) }
private val cardPrograms: CardProgramService by lazy {
CardProgramServiceImpl(clientOptionsWithUserAgent)
}
private val digitalCardArt: DigitalCardArtService by lazy {
DigitalCardArtServiceImpl(clientOptionsWithUserAgent)
}
private val bookTransfers: BookTransferService by lazy {
BookTransferServiceImpl(clientOptionsWithUserAgent)
}
private val creditProducts: CreditProductService by lazy {
CreditProductServiceImpl(clientOptionsWithUserAgent)
}
private val externalPayments: ExternalPaymentService by lazy {
ExternalPaymentServiceImpl(clientOptionsWithUserAgent)
}
private val managementOperations: ManagementOperationService by lazy {
ManagementOperationServiceImpl(clientOptionsWithUserAgent)
}
private val internalTransaction: InternalTransactionService by lazy {
InternalTransactionServiceImpl(clientOptionsWithUserAgent)
}
private val fundingEvents: FundingEventService by lazy {
FundingEventServiceImpl(clientOptionsWithUserAgent)
}
private val fraud: FraudService by lazy { FraudServiceImpl(clientOptionsWithUserAgent) }
private val networkPrograms: NetworkProgramService by lazy {
NetworkProgramServiceImpl(clientOptionsWithUserAgent)
}
private val holds: HoldService by lazy { HoldServiceImpl(clientOptionsWithUserAgent) }
private val accountActivity: AccountActivityService by lazy {
AccountActivityServiceImpl(clientOptionsWithUserAgent)
}
private val transferLimits: TransferLimitService by lazy {
TransferLimitServiceImpl(clientOptionsWithUserAgent)
}
private val webhooks: WebhookService by lazy { WebhookServiceImpl(clientOptionsWithUserAgent) }
override fun async(): LithicClientAsync = async
override fun withRawResponse(): LithicClient.WithRawResponse = withRawResponse
override fun withOptions(modifier: Consumer<ClientOptions.Builder>): LithicClient =
LithicClientImpl(clientOptions.toBuilder().apply(modifier::accept).build())
override fun accounts(): AccountService = accounts
override fun accountHolders(): AccountHolderService = accountHolders
override fun authRules(): AuthRuleService = authRules
override fun transactionMonitoring(): TransactionMonitoringService = transactionMonitoring
override fun authStreamEnrollment(): AuthStreamEnrollmentService = authStreamEnrollment
override fun tokenizationDecisioning(): TokenizationDecisioningService = tokenizationDecisioning
override fun tokenizations(): TokenizationService = tokenizations
override fun cards(): CardService = cards
override fun cardAuthorizations(): CardAuthorizationService = cardAuthorizations
override fun cardBulkOrders(): CardBulkOrderService = cardBulkOrders
override fun balances(): BalanceService = balances
override fun disputes(): DisputeService = disputes
override fun disputesV2(): DisputesV2Service = disputesV2
override fun events(): EventService = events
override fun transfers(): TransferService = transfers
override fun financialAccounts(): FinancialAccountService = financialAccounts
override fun transactions(): TransactionService = transactions
override fun responderEndpoints(): ResponderEndpointService = responderEndpoints
override fun externalBankAccounts(): ExternalBankAccountService = externalBankAccounts
override fun blockchainRecipients(): BlockchainRecipientService = blockchainRecipients
override fun payments(): PaymentService = payments
override fun threeDS(): ThreeDSService = threeDS
override fun reports(): ReportService = reports
override fun cardPrograms(): CardProgramService = cardPrograms
override fun digitalCardArt(): DigitalCardArtService = digitalCardArt
override fun bookTransfers(): BookTransferService = bookTransfers
override fun creditProducts(): CreditProductService = creditProducts
override fun externalPayments(): ExternalPaymentService = externalPayments
override fun managementOperations(): ManagementOperationService = managementOperations
override fun internalTransaction(): InternalTransactionService = internalTransaction
override fun fundingEvents(): FundingEventService = fundingEvents
override fun fraud(): FraudService = fraud
override fun networkPrograms(): NetworkProgramService = networkPrograms
override fun holds(): HoldService = holds
override fun accountActivity(): AccountActivityService = accountActivity
override fun transferLimits(): TransferLimitService = transferLimits
override fun webhooks(): WebhookService = webhooks
override fun apiStatus(
params: ClientApiStatusParams,
requestOptions: RequestOptions,
): ApiStatus =
// get /v1/status
withRawResponse().apiStatus(params, requestOptions).parse()
override fun close() = clientOptions.close()
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
LithicClient.WithRawResponse {
private val errorHandler: Handler<HttpResponse> =
errorHandler(errorBodyHandler(clientOptions.jsonMapper))
private val accounts: AccountService.WithRawResponse by lazy {
AccountServiceImpl.WithRawResponseImpl(clientOptions)
}
private val accountHolders: AccountHolderService.WithRawResponse by lazy {
AccountHolderServiceImpl.WithRawResponseImpl(clientOptions)
}
private val authRules: AuthRuleService.WithRawResponse by lazy {
AuthRuleServiceImpl.WithRawResponseImpl(clientOptions)
}
private val transactionMonitoring: TransactionMonitoringService.WithRawResponse by lazy {
TransactionMonitoringServiceImpl.WithRawResponseImpl(clientOptions)
}
private val authStreamEnrollment: AuthStreamEnrollmentService.WithRawResponse by lazy {
AuthStreamEnrollmentServiceImpl.WithRawResponseImpl(clientOptions)
}
private val tokenizationDecisioning:
TokenizationDecisioningService.WithRawResponse by lazy {
TokenizationDecisioningServiceImpl.WithRawResponseImpl(clientOptions)
}
private val tokenizations: TokenizationService.WithRawResponse by lazy {
TokenizationServiceImpl.WithRawResponseImpl(clientOptions)
}
private val cards: CardService.WithRawResponse by lazy {
CardServiceImpl.WithRawResponseImpl(clientOptions)
}
private val cardAuthorizations: CardAuthorizationService.WithRawResponse by lazy {
CardAuthorizationServiceImpl.WithRawResponseImpl(clientOptions)
}
private val cardBulkOrders: CardBulkOrderService.WithRawResponse by lazy {
CardBulkOrderServiceImpl.WithRawResponseImpl(clientOptions)
}
private val balances: BalanceService.WithRawResponse by lazy {
BalanceServiceImpl.WithRawResponseImpl(clientOptions)
}
private val disputes: DisputeService.WithRawResponse by lazy {
DisputeServiceImpl.WithRawResponseImpl(clientOptions)
}
private val disputesV2: DisputesV2Service.WithRawResponse by lazy {
DisputesV2ServiceImpl.WithRawResponseImpl(clientOptions)
}
private val events: EventService.WithRawResponse by lazy {
EventServiceImpl.WithRawResponseImpl(clientOptions)
}
private val transfers: TransferService.WithRawResponse by lazy {
TransferServiceImpl.WithRawResponseImpl(clientOptions)
}
private val financialAccounts: FinancialAccountService.WithRawResponse by lazy {
FinancialAccountServiceImpl.WithRawResponseImpl(clientOptions)
}
private val transactions: TransactionService.WithRawResponse by lazy {
TransactionServiceImpl.WithRawResponseImpl(clientOptions)
}
private val responderEndpoints: ResponderEndpointService.WithRawResponse by lazy {
ResponderEndpointServiceImpl.WithRawResponseImpl(clientOptions)
}
private val externalBankAccounts: ExternalBankAccountService.WithRawResponse by lazy {
ExternalBankAccountServiceImpl.WithRawResponseImpl(clientOptions)
}
private val blockchainRecipients: BlockchainRecipientService.WithRawResponse by lazy {
BlockchainRecipientServiceImpl.WithRawResponseImpl(clientOptions)
}
private val payments: PaymentService.WithRawResponse by lazy {
PaymentServiceImpl.WithRawResponseImpl(clientOptions)
}
private val threeDS: ThreeDSService.WithRawResponse by lazy {
ThreeDSServiceImpl.WithRawResponseImpl(clientOptions)
}
private val reports: ReportService.WithRawResponse by lazy {
ReportServiceImpl.WithRawResponseImpl(clientOptions)
}
private val cardPrograms: CardProgramService.WithRawResponse by lazy {
CardProgramServiceImpl.WithRawResponseImpl(clientOptions)
}
private val digitalCardArt: DigitalCardArtService.WithRawResponse by lazy {
DigitalCardArtServiceImpl.WithRawResponseImpl(clientOptions)
}
private val bookTransfers: BookTransferService.WithRawResponse by lazy {
BookTransferServiceImpl.WithRawResponseImpl(clientOptions)
}
private val creditProducts: CreditProductService.WithRawResponse by lazy {
CreditProductServiceImpl.WithRawResponseImpl(clientOptions)
}
private val externalPayments: ExternalPaymentService.WithRawResponse by lazy {
ExternalPaymentServiceImpl.WithRawResponseImpl(clientOptions)
}
private val managementOperations: ManagementOperationService.WithRawResponse by lazy {
ManagementOperationServiceImpl.WithRawResponseImpl(clientOptions)
}
private val internalTransaction: InternalTransactionService.WithRawResponse by lazy {
InternalTransactionServiceImpl.WithRawResponseImpl(clientOptions)
}
private val fundingEvents: FundingEventService.WithRawResponse by lazy {
FundingEventServiceImpl.WithRawResponseImpl(clientOptions)
}
private val fraud: FraudService.WithRawResponse by lazy {
FraudServiceImpl.WithRawResponseImpl(clientOptions)
}
private val networkPrograms: NetworkProgramService.WithRawResponse by lazy {
NetworkProgramServiceImpl.WithRawResponseImpl(clientOptions)
}
private val holds: HoldService.WithRawResponse by lazy {
HoldServiceImpl.WithRawResponseImpl(clientOptions)
}
private val accountActivity: AccountActivityService.WithRawResponse by lazy {
AccountActivityServiceImpl.WithRawResponseImpl(clientOptions)
}
private val transferLimits: TransferLimitService.WithRawResponse by lazy {
TransferLimitServiceImpl.WithRawResponseImpl(clientOptions)
}
private val webhooks: WebhookService.WithRawResponse by lazy {
WebhookServiceImpl.WithRawResponseImpl(clientOptions)
}
override fun withOptions(
modifier: Consumer<ClientOptions.Builder>
): LithicClient.WithRawResponse =
LithicClientImpl.WithRawResponseImpl(
clientOptions.toBuilder().apply(modifier::accept).build()
)
override fun accounts(): AccountService.WithRawResponse = accounts
override fun accountHolders(): AccountHolderService.WithRawResponse = accountHolders
override fun authRules(): AuthRuleService.WithRawResponse = authRules
override fun transactionMonitoring(): TransactionMonitoringService.WithRawResponse =
transactionMonitoring
override fun authStreamEnrollment(): AuthStreamEnrollmentService.WithRawResponse =
authStreamEnrollment
override fun tokenizationDecisioning(): TokenizationDecisioningService.WithRawResponse =
tokenizationDecisioning
override fun tokenizations(): TokenizationService.WithRawResponse = tokenizations
override fun cards(): CardService.WithRawResponse = cards
override fun cardAuthorizations(): CardAuthorizationService.WithRawResponse =
cardAuthorizations
override fun cardBulkOrders(): CardBulkOrderService.WithRawResponse = cardBulkOrders
override fun balances(): BalanceService.WithRawResponse = balances
override fun disputes(): DisputeService.WithRawResponse = disputes
override fun disputesV2(): DisputesV2Service.WithRawResponse = disputesV2
override fun events(): EventService.WithRawResponse = events
override fun transfers(): TransferService.WithRawResponse = transfers
override fun financialAccounts(): FinancialAccountService.WithRawResponse =
financialAccounts
override fun transactions(): TransactionService.WithRawResponse = transactions
override fun responderEndpoints(): ResponderEndpointService.WithRawResponse =
responderEndpoints
override fun externalBankAccounts(): ExternalBankAccountService.WithRawResponse =
externalBankAccounts
override fun blockchainRecipients(): BlockchainRecipientService.WithRawResponse =
blockchainRecipients
override fun payments(): PaymentService.WithRawResponse = payments
override fun threeDS(): ThreeDSService.WithRawResponse = threeDS
override fun reports(): ReportService.WithRawResponse = reports
override fun cardPrograms(): CardProgramService.WithRawResponse = cardPrograms
override fun digitalCardArt(): DigitalCardArtService.WithRawResponse = digitalCardArt
override fun bookTransfers(): BookTransferService.WithRawResponse = bookTransfers
override fun creditProducts(): CreditProductService.WithRawResponse = creditProducts
override fun externalPayments(): ExternalPaymentService.WithRawResponse = externalPayments
override fun managementOperations(): ManagementOperationService.WithRawResponse =
managementOperations
override fun internalTransaction(): InternalTransactionService.WithRawResponse =
internalTransaction
override fun fundingEvents(): FundingEventService.WithRawResponse = fundingEvents
override fun fraud(): FraudService.WithRawResponse = fraud
override fun networkPrograms(): NetworkProgramService.WithRawResponse = networkPrograms
override fun holds(): HoldService.WithRawResponse = holds
override fun accountActivity(): AccountActivityService.WithRawResponse = accountActivity
override fun transferLimits(): TransferLimitService.WithRawResponse = transferLimits
override fun webhooks(): WebhookService.WithRawResponse = webhooks
private val apiStatusHandler: Handler<ApiStatus> =
jsonHandler<ApiStatus>(clientOptions.jsonMapper)
override fun apiStatus(
params: ClientApiStatusParams,
requestOptions: RequestOptions,
): HttpResponseFor<ApiStatus> {
val request =
HttpRequest.builder()
.method(HttpMethod.GET)
.baseUrl(clientOptions.baseUrl())
.addPathSegments("v1", "status")
.build()
.prepare(clientOptions, params)
val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions))
val response = clientOptions.httpClient.execute(request, requestOptions)
return errorHandler.handle(response).parseable {
response
.use { apiStatusHandler.handle(it) }
.also {
if (requestOptions.responseValidation!!) {
it.validate()
}
}
}
}
}
}