/
transactions_client.go
465 lines (421 loc) · 21.8 KB
/
transactions_client.go
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
// Code generated by go-swagger; DO NOT EDIT.
package transactions
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"fmt"
"github.com/go-openapi/runtime"
strfmt "github.com/go-openapi/strfmt"
)
// New creates a new transactions API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
return &Client{transport: transport, formats: formats}
}
/*
Client for transactions API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
/*
CreateOrRunTransactionCategorizationRules creates or run transaction categorization rule
The Create or Run Transaction Categorization Rule endpoint is used to: <br>Create transaction categorization rules for both system and user-defined categories.<br>Run all the transaction categorization rules to categorize transactions by calling the endpoint with action=run as the query parameter. <br>The input body parameters to create transaction categorization rules follow:<br> categoryId - This field is mandatory and numeric<br> priority - This field is optional and numeric. Priority decides the order in which the rule gets applied on transactions.<br> ruleClause - This field is mandatory and should contain at least one rule<br> field - The value can be description or amount<br> If the field value is description then,<br> 1. operation - value can be stringEquals or stringContains<br> 2. value - value should be min of 3 and max of 50 characters<br> If the field value is amount then, <br> 1. operation - value can be numberEquals, numberLessThan, numberLessThanEquals, numberGreaterThan or numberGreaterThanEquals<br> 2. value - min value 0 and a max value of 99999999999.99 is allowed<br>The HTTP response code is 201 (Created Successfully).
*/
func (a *Client) CreateOrRunTransactionCategorizationRules(params *CreateOrRunTransactionCategorizationRulesParams) (*CreateOrRunTransactionCategorizationRulesCreated, *CreateOrRunTransactionCategorizationRulesNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateOrRunTransactionCategorizationRulesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "createOrRunTransactionCategorizationRules",
Method: "POST",
PathPattern: "/transactions/categories/rules",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &CreateOrRunTransactionCategorizationRulesReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, nil, err
}
switch value := result.(type) {
case *CreateOrRunTransactionCategorizationRulesCreated:
return value, nil, nil
case *CreateOrRunTransactionCategorizationRulesNoContent:
return nil, value, nil
}
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for transactions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
CreateTransactionCategory creates category
The create transaction categories service is used to create user-defined categories for a system-defined category.<br>The parentCategoryId is the system-defined category id.This can be retrieved using get transaction categories service.<br>The categoryName can accept minimum of 1, maximum of 50 alphanumeric or special characters.<br>The HTTP response code is 201 (Created successfully).<br>
*/
func (a *Client) CreateTransactionCategory(params *CreateTransactionCategoryParams) (*CreateTransactionCategoryCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateTransactionCategoryParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "createTransactionCategory",
Method: "POST",
PathPattern: "/transactions/categories",
ProducesMediaTypes: []string{"application/json;charset=UTF-8"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &CreateTransactionCategoryReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*CreateTransactionCategoryCreated)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for createTransactionCategory: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteTransactionCategorizationRule deletes transaction categorization rule
The delete transaction categorization rule service is used to delete the given user-defined transaction categorization rule for both system-defined category as well as user-defined category.<br>This will delete all the corresponding rule clauses associated with the rule.<br>The HTTP response code is 204 (Success without content).<br>
*/
func (a *Client) DeleteTransactionCategorizationRule(params *DeleteTransactionCategorizationRuleParams) (*DeleteTransactionCategorizationRuleNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteTransactionCategorizationRuleParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "deleteTransactionCategorizationRule",
Method: "DELETE",
PathPattern: "/transactions/categories/rules/{ruleId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{""},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteTransactionCategorizationRuleReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*DeleteTransactionCategorizationRuleNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteTransactionCategorizationRule: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteTransactionCategory deletes category
The delete transaction categories service is used to delete the given user-defined category.<br>The HTTP response code is 204 (Success without content).<br>
*/
func (a *Client) DeleteTransactionCategory(params *DeleteTransactionCategoryParams) (*DeleteTransactionCategoryNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteTransactionCategoryParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "deleteTransactionCategory",
Method: "DELETE",
PathPattern: "/transactions/categories/{categoryId}",
ProducesMediaTypes: []string{"application/json;charset=UTF-8"},
ConsumesMediaTypes: []string{""},
Schemes: []string{"http"},
Params: params,
Reader: &DeleteTransactionCategoryReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*DeleteTransactionCategoryNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for deleteTransactionCategory: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetTransactionCategories gets transaction category list
The categories service returns the list of available transaction categories.<br>High level category is returned in the response only if it is opted by the customer.<br>When invoked by passing the cobrand session, this service returns the supported transaction categories at the cobrand level. <br>When invoked by passing the cobrand session and the user session, this service returns the transaction categories <br>along with user-defined categories.<br>Double quotes in the user-defined category name will be prefixed by backslashes (\) in the response, <br>e.g. Toys "R" Us.Source and id are the primary attributes of the category entity.
*/
func (a *Client) GetTransactionCategories(params *GetTransactionCategoriesParams) (*GetTransactionCategoriesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetTransactionCategoriesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getTransactionCategories",
Method: "GET",
PathPattern: "/transactions/categories",
ProducesMediaTypes: []string{"application/json;charset=UTF-8"},
ConsumesMediaTypes: []string{""},
Schemes: []string{"http"},
Params: params,
Reader: &GetTransactionCategoriesReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetTransactionCategoriesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getTransactionCategories: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetTransactionCategorizationRules gets transaction categorization rules
The get transaction categorization rule service is used to get all the categorization rules.<br>
*/
func (a *Client) GetTransactionCategorizationRules(params *GetTransactionCategorizationRulesParams) (*GetTransactionCategorizationRulesOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetTransactionCategorizationRulesParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getTransactionCategorizationRules",
Method: "GET",
PathPattern: "/transactions/categories/txnRules",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{""},
Schemes: []string{"http"},
Params: params,
Reader: &GetTransactionCategorizationRulesReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetTransactionCategorizationRulesOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getTransactionCategorizationRules: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetTransactions gets transactions
The Transaction service is used to get a list of transactions for a user.<br>By default, this service returns the last 30 days of transactions from today's date.<br>The search is performed on these attributes: original, consumer, and simple descriptions.<br>Values for categoryId parameter can be fetched from get transaction category list service.<br>The categoryId is used to filter transactions based on system-defined category as well as user-defined category.<br>User-defined categoryIds should be provided in the filter with the prefix "U". E.g. U10002 <br>The skip and top parameters are useful for paginating transactions (i.e., to fetch small transaction <br>payloads for performance reasons)<br>Double quotes in the merchant name will be prefixed by backslashes (\) in the response, <br>e.g. Toys "R" Us.<br><b>Note</b> <br><a href="https://developer.yodlee.com/Yodlee_API/Transaction_Data_Enrichment">TDE</a> is made available for bank and card accounts and for the US market only.The address field in the response is available only when the TDE key is turned on.<br>
*/
func (a *Client) GetTransactions(params *GetTransactionsParams) (*GetTransactionsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetTransactionsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getTransactions",
Method: "GET",
PathPattern: "/transactions",
ProducesMediaTypes: []string{"application/json;charset=UTF-8"},
ConsumesMediaTypes: []string{""},
Schemes: []string{"http"},
Params: params,
Reader: &GetTransactionsReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetTransactionsOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getTransactions: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetTransactionsCount gets transactions count
The count service provides the total number of transactions for a specific user depending on the input parameters passed.<br>If you are implementing pagination for transactions, call this endpoint before calling GET /transactions to know the number of transactions that are returned for the input parameters passed.<br>The functionality of the input parameters remains the same as that of the GET /transactions endpoint.<br>
*/
func (a *Client) GetTransactionsCount(params *GetTransactionsCountParams) (*GetTransactionsCountOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetTransactionsCountParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getTransactionsCount",
Method: "GET",
PathPattern: "/transactions/count",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{""},
Schemes: []string{"http"},
Params: params,
Reader: &GetTransactionsCountReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetTransactionsCountOK)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for getTransactionsCount: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
RunTransactionCategorizationRule runs transaction categorization rule
The run transaction categorization rule service is used to run a rule on <br>transactions, to categorize the transactions.<br>The HTTP response code is 204 (Success with no content).<br>
*/
func (a *Client) RunTransactionCategorizationRule(params *RunTransactionCategorizationRuleParams) (*RunTransactionCategorizationRuleNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewRunTransactionCategorizationRuleParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "runTransactionCategorizationRule",
Method: "POST",
PathPattern: "/transactions/categories/rules/{ruleId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &RunTransactionCategorizationRuleReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*RunTransactionCategorizationRuleNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for runTransactionCategorizationRule: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
UpdateTransaction updates transaction
The update transaction service is used to update the category,consumer description, memo for a transaction.<br>The HTTP response code is 204 (Success without content).<br>
*/
func (a *Client) UpdateTransaction(params *UpdateTransactionParams) (*UpdateTransactionNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateTransactionParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "updateTransaction",
Method: "PUT",
PathPattern: "/transactions/{transactionId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &UpdateTransactionReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*UpdateTransactionNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for updateTransaction: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
UpdateTransactionCategorizationRule updates transaction categorization rule
The update transaction categorization rule service is used to update a categorization rule for both system-defined category as well as user-defined category.<br>ruleParam JSON input should be as explained in the create transaction categorization rule service.<br>The HTTP response code is 204 (Success without content).<br>
*/
func (a *Client) UpdateTransactionCategorizationRule(params *UpdateTransactionCategorizationRuleParams) (*UpdateTransactionCategorizationRuleNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateTransactionCategorizationRuleParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "updateTransactionCategorizationRule",
Method: "PUT",
PathPattern: "/transactions/categories/rules/{ruleId}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &UpdateTransactionCategorizationRuleReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*UpdateTransactionCategorizationRuleNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for updateTransactionCategorizationRule: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
UpdateTransactionCategory updates category
The update transaction categories service is used to update the transaction category name<br>for a high level category, a system-defined category and a user-defined category.<br>The renamed category can be set back to the original name by passing an empty string for categoryName.<br>The categoryName can accept minimum of 1, maximum of 50 alphanumeric or special characters.<br>The HTTP response code is 204 (Success without content).<br>
*/
func (a *Client) UpdateTransactionCategory(params *UpdateTransactionCategoryParams) (*UpdateTransactionCategoryNoContent, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateTransactionCategoryParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "updateTransactionCategory",
Method: "PUT",
PathPattern: "/transactions/categories",
ProducesMediaTypes: []string{"application/json;charset=UTF-8"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http"},
Params: params,
Reader: &UpdateTransactionCategoryReader{formats: a.formats},
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*UpdateTransactionCategoryNoContent)
if ok {
return success, nil
}
// unexpected success response
// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
msg := fmt.Sprintf("unexpected success response for updateTransactionCategory: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
a.transport = transport
}