coinbase-sdk 0.0.1 → 0.0.2

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.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coinbase/address.rb +88 -49
  3. data/lib/coinbase/asset.rb +2 -1
  4. data/lib/coinbase/authenticator.rb +52 -0
  5. data/lib/coinbase/balance_map.rb +1 -1
  6. data/lib/coinbase/client/api/addresses_api.rb +385 -0
  7. data/lib/coinbase/client/api/transfers_api.rb +256 -0
  8. data/lib/coinbase/client/api/users_api.rb +79 -0
  9. data/lib/coinbase/client/api/wallets_api.rb +348 -0
  10. data/lib/coinbase/client/api_client.rb +431 -0
  11. data/lib/coinbase/client/api_error.rb +58 -0
  12. data/lib/coinbase/client/configuration.rb +375 -0
  13. data/lib/coinbase/client/models/address.rb +273 -0
  14. data/lib/coinbase/client/models/address_balance_list.rb +275 -0
  15. data/lib/coinbase/client/models/address_list.rb +275 -0
  16. data/lib/coinbase/client/models/asset.rb +260 -0
  17. data/lib/coinbase/client/models/balance.rb +239 -0
  18. data/lib/coinbase/client/models/create_address_request.rb +239 -0
  19. data/lib/coinbase/client/models/create_transfer_request.rb +273 -0
  20. data/lib/coinbase/client/models/create_wallet_request.rb +221 -0
  21. data/lib/coinbase/client/models/error.rb +278 -0
  22. data/lib/coinbase/client/models/transfer.rb +393 -0
  23. data/lib/coinbase/client/models/transfer_list.rb +275 -0
  24. data/lib/coinbase/client/models/user.rb +231 -0
  25. data/lib/coinbase/client/models/wallet.rb +241 -0
  26. data/lib/coinbase/client/models/wallet_list.rb +275 -0
  27. data/lib/coinbase/client/version.rb +15 -0
  28. data/lib/coinbase/client.rb +57 -0
  29. data/lib/coinbase/constants.rb +5 -1
  30. data/lib/coinbase/middleware.rb +21 -0
  31. data/lib/coinbase/network.rb +2 -2
  32. data/lib/coinbase/transfer.rb +69 -54
  33. data/lib/coinbase/user.rb +64 -0
  34. data/lib/coinbase/wallet.rb +146 -54
  35. data/lib/coinbase.rb +73 -9
  36. metadata +74 -6
@@ -0,0 +1,256 @@
1
+ =begin
2
+ #Coinbase Platform API
3
+
4
+ #This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
5
+
6
+ The version of the OpenAPI document: 0.0.1-alpha
7
+ Contact: yuga.cohler@coinbase.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Coinbase::Client
16
+ class TransfersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a new transfer for an address
23
+ # Create a new transfer
24
+ # @param wallet_id [String] The ID of the wallet the source address belongs to
25
+ # @param address_id [String] The ID of the address to transfer from
26
+ # @param create_transfer_request [CreateTransferRequest]
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [Transfer]
29
+ def create_transfer(wallet_id, address_id, create_transfer_request, opts = {})
30
+ data, _status_code, _headers = create_transfer_with_http_info(wallet_id, address_id, create_transfer_request, opts)
31
+ data
32
+ end
33
+
34
+ # Create a new transfer for an address
35
+ # Create a new transfer
36
+ # @param wallet_id [String] The ID of the wallet the source address belongs to
37
+ # @param address_id [String] The ID of the address to transfer from
38
+ # @param create_transfer_request [CreateTransferRequest]
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(Transfer, Integer, Hash)>] Transfer data, response status code and response headers
41
+ def create_transfer_with_http_info(wallet_id, address_id, create_transfer_request, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: TransfersApi.create_transfer ...'
44
+ end
45
+ # verify the required parameter 'wallet_id' is set
46
+ if @api_client.config.client_side_validation && wallet_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling TransfersApi.create_transfer"
48
+ end
49
+ # verify the required parameter 'address_id' is set
50
+ if @api_client.config.client_side_validation && address_id.nil?
51
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling TransfersApi.create_transfer"
52
+ end
53
+ # verify the required parameter 'create_transfer_request' is set
54
+ if @api_client.config.client_side_validation && create_transfer_request.nil?
55
+ fail ArgumentError, "Missing the required parameter 'create_transfer_request' when calling TransfersApi.create_transfer"
56
+ end
57
+ # resource path
58
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/transfers'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
59
+
60
+ # query parameters
61
+ query_params = opts[:query_params] || {}
62
+
63
+ # header parameters
64
+ header_params = opts[:header_params] || {}
65
+ # HTTP header 'Accept' (if needed)
66
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
67
+ # HTTP header 'Content-Type'
68
+ content_type = @api_client.select_header_content_type(['application/json'])
69
+ if !content_type.nil?
70
+ header_params['Content-Type'] = content_type
71
+ end
72
+
73
+ # form parameters
74
+ form_params = opts[:form_params] || {}
75
+
76
+ # http body (model)
77
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_transfer_request)
78
+
79
+ # return_type
80
+ return_type = opts[:debug_return_type] || 'Transfer'
81
+
82
+ # auth_names
83
+ auth_names = opts[:debug_auth_names] || []
84
+
85
+ new_options = opts.merge(
86
+ :operation => :"TransfersApi.create_transfer",
87
+ :header_params => header_params,
88
+ :query_params => query_params,
89
+ :form_params => form_params,
90
+ :body => post_body,
91
+ :auth_names => auth_names,
92
+ :return_type => return_type
93
+ )
94
+
95
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
96
+ if @api_client.config.debugging
97
+ @api_client.config.logger.debug "API called: TransfersApi#create_transfer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ end
99
+ return data, status_code, headers
100
+ end
101
+
102
+ # Get a transfer by ID
103
+ # Get a transfer by ID
104
+ # @param wallet_id [String] The ID of the wallet the address belongs to
105
+ # @param address_id [String] The ID of the address the transfer belongs to
106
+ # @param transfer_id [String] The ID of the transfer to fetch
107
+ # @param [Hash] opts the optional parameters
108
+ # @return [Transfer]
109
+ def get_transfer(wallet_id, address_id, transfer_id, opts = {})
110
+ data, _status_code, _headers = get_transfer_with_http_info(wallet_id, address_id, transfer_id, opts)
111
+ data
112
+ end
113
+
114
+ # Get a transfer by ID
115
+ # Get a transfer by ID
116
+ # @param wallet_id [String] The ID of the wallet the address belongs to
117
+ # @param address_id [String] The ID of the address the transfer belongs to
118
+ # @param transfer_id [String] The ID of the transfer to fetch
119
+ # @param [Hash] opts the optional parameters
120
+ # @return [Array<(Transfer, Integer, Hash)>] Transfer data, response status code and response headers
121
+ def get_transfer_with_http_info(wallet_id, address_id, transfer_id, opts = {})
122
+ if @api_client.config.debugging
123
+ @api_client.config.logger.debug 'Calling API: TransfersApi.get_transfer ...'
124
+ end
125
+ # verify the required parameter 'wallet_id' is set
126
+ if @api_client.config.client_side_validation && wallet_id.nil?
127
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling TransfersApi.get_transfer"
128
+ end
129
+ # verify the required parameter 'address_id' is set
130
+ if @api_client.config.client_side_validation && address_id.nil?
131
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling TransfersApi.get_transfer"
132
+ end
133
+ # verify the required parameter 'transfer_id' is set
134
+ if @api_client.config.client_side_validation && transfer_id.nil?
135
+ fail ArgumentError, "Missing the required parameter 'transfer_id' when calling TransfersApi.get_transfer"
136
+ end
137
+ # resource path
138
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s)).sub('{' + 'transfer_id' + '}', CGI.escape(transfer_id.to_s))
139
+
140
+ # query parameters
141
+ query_params = opts[:query_params] || {}
142
+
143
+ # header parameters
144
+ header_params = opts[:header_params] || {}
145
+ # HTTP header 'Accept' (if needed)
146
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
147
+
148
+ # form parameters
149
+ form_params = opts[:form_params] || {}
150
+
151
+ # http body (model)
152
+ post_body = opts[:debug_body]
153
+
154
+ # return_type
155
+ return_type = opts[:debug_return_type] || 'Transfer'
156
+
157
+ # auth_names
158
+ auth_names = opts[:debug_auth_names] || []
159
+
160
+ new_options = opts.merge(
161
+ :operation => :"TransfersApi.get_transfer",
162
+ :header_params => header_params,
163
+ :query_params => query_params,
164
+ :form_params => form_params,
165
+ :body => post_body,
166
+ :auth_names => auth_names,
167
+ :return_type => return_type
168
+ )
169
+
170
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
171
+ if @api_client.config.debugging
172
+ @api_client.config.logger.debug "API called: TransfersApi#get_transfer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
173
+ end
174
+ return data, status_code, headers
175
+ end
176
+
177
+ # List transfers for an address.
178
+ # List transfers for an address.
179
+ # @param wallet_id [String] The ID of the wallet the address belongs to
180
+ # @param address_id [String] The ID of the address to list transfers for
181
+ # @param [Hash] opts the optional parameters
182
+ # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
183
+ # @option opts [String] :page A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
184
+ # @return [TransferList]
185
+ def list_transfers(wallet_id, address_id, opts = {})
186
+ data, _status_code, _headers = list_transfers_with_http_info(wallet_id, address_id, opts)
187
+ data
188
+ end
189
+
190
+ # List transfers for an address.
191
+ # List transfers for an address.
192
+ # @param wallet_id [String] The ID of the wallet the address belongs to
193
+ # @param address_id [String] The ID of the address to list transfers for
194
+ # @param [Hash] opts the optional parameters
195
+ # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
196
+ # @option opts [String] :page A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
197
+ # @return [Array<(TransferList, Integer, Hash)>] TransferList data, response status code and response headers
198
+ def list_transfers_with_http_info(wallet_id, address_id, opts = {})
199
+ if @api_client.config.debugging
200
+ @api_client.config.logger.debug 'Calling API: TransfersApi.list_transfers ...'
201
+ end
202
+ # verify the required parameter 'wallet_id' is set
203
+ if @api_client.config.client_side_validation && wallet_id.nil?
204
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling TransfersApi.list_transfers"
205
+ end
206
+ # verify the required parameter 'address_id' is set
207
+ if @api_client.config.client_side_validation && address_id.nil?
208
+ fail ArgumentError, "Missing the required parameter 'address_id' when calling TransfersApi.list_transfers"
209
+ end
210
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
211
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling TransfersApi.list_transfers, the character length must be smaller than or equal to 5000.'
212
+ end
213
+
214
+ # resource path
215
+ local_var_path = '/v1/wallets/{wallet_id}/addresses/{address_id}/transfers'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'address_id' + '}', CGI.escape(address_id.to_s))
216
+
217
+ # query parameters
218
+ query_params = opts[:query_params] || {}
219
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
220
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
221
+
222
+ # header parameters
223
+ header_params = opts[:header_params] || {}
224
+ # HTTP header 'Accept' (if needed)
225
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
226
+
227
+ # form parameters
228
+ form_params = opts[:form_params] || {}
229
+
230
+ # http body (model)
231
+ post_body = opts[:debug_body]
232
+
233
+ # return_type
234
+ return_type = opts[:debug_return_type] || 'TransferList'
235
+
236
+ # auth_names
237
+ auth_names = opts[:debug_auth_names] || []
238
+
239
+ new_options = opts.merge(
240
+ :operation => :"TransfersApi.list_transfers",
241
+ :header_params => header_params,
242
+ :query_params => query_params,
243
+ :form_params => form_params,
244
+ :body => post_body,
245
+ :auth_names => auth_names,
246
+ :return_type => return_type
247
+ )
248
+
249
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
250
+ if @api_client.config.debugging
251
+ @api_client.config.logger.debug "API called: TransfersApi#list_transfers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
252
+ end
253
+ return data, status_code, headers
254
+ end
255
+ end
256
+ end
@@ -0,0 +1,79 @@
1
+ =begin
2
+ #Coinbase Platform API
3
+
4
+ #This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
5
+
6
+ The version of the OpenAPI document: 0.0.1-alpha
7
+ Contact: yuga.cohler@coinbase.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Coinbase::Client
16
+ class UsersApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Get current user
23
+ # Get current user
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [User]
26
+ def get_current_user(opts = {})
27
+ data, _status_code, _headers = get_current_user_with_http_info(opts)
28
+ data
29
+ end
30
+
31
+ # Get current user
32
+ # Get current user
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(User, Integer, Hash)>] User data, response status code and response headers
35
+ def get_current_user_with_http_info(opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: UsersApi.get_current_user ...'
38
+ end
39
+ # resource path
40
+ local_var_path = '/v1/users/me'
41
+
42
+ # query parameters
43
+ query_params = opts[:query_params] || {}
44
+
45
+ # header parameters
46
+ header_params = opts[:header_params] || {}
47
+ # HTTP header 'Accept' (if needed)
48
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
49
+
50
+ # form parameters
51
+ form_params = opts[:form_params] || {}
52
+
53
+ # http body (model)
54
+ post_body = opts[:debug_body]
55
+
56
+ # return_type
57
+ return_type = opts[:debug_return_type] || 'User'
58
+
59
+ # auth_names
60
+ auth_names = opts[:debug_auth_names] || []
61
+
62
+ new_options = opts.merge(
63
+ :operation => :"UsersApi.get_current_user",
64
+ :header_params => header_params,
65
+ :query_params => query_params,
66
+ :form_params => form_params,
67
+ :body => post_body,
68
+ :auth_names => auth_names,
69
+ :return_type => return_type
70
+ )
71
+
72
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
73
+ if @api_client.config.debugging
74
+ @api_client.config.logger.debug "API called: UsersApi#get_current_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
75
+ end
76
+ return data, status_code, headers
77
+ end
78
+ end
79
+ end
@@ -0,0 +1,348 @@
1
+ =begin
2
+ #Coinbase Platform API
3
+
4
+ #This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs.
5
+
6
+ The version of the OpenAPI document: 0.0.1-alpha
7
+ Contact: yuga.cohler@coinbase.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.5.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Coinbase::Client
16
+ class WalletsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create a new wallet
23
+ # Create a new wallet scoped to the user.
24
+ # @param [Hash] opts the optional parameters
25
+ # @option opts [CreateWalletRequest] :create_wallet_request
26
+ # @return [Wallet]
27
+ def create_wallet(opts = {})
28
+ data, _status_code, _headers = create_wallet_with_http_info(opts)
29
+ data
30
+ end
31
+
32
+ # Create a new wallet
33
+ # Create a new wallet scoped to the user.
34
+ # @param [Hash] opts the optional parameters
35
+ # @option opts [CreateWalletRequest] :create_wallet_request
36
+ # @return [Array<(Wallet, Integer, Hash)>] Wallet data, response status code and response headers
37
+ def create_wallet_with_http_info(opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: WalletsApi.create_wallet ...'
40
+ end
41
+ # resource path
42
+ local_var_path = '/v1/wallets'
43
+
44
+ # query parameters
45
+ query_params = opts[:query_params] || {}
46
+
47
+ # header parameters
48
+ header_params = opts[:header_params] || {}
49
+ # HTTP header 'Accept' (if needed)
50
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
51
+ # HTTP header 'Content-Type'
52
+ content_type = @api_client.select_header_content_type(['application/json'])
53
+ if !content_type.nil?
54
+ header_params['Content-Type'] = content_type
55
+ end
56
+
57
+ # form parameters
58
+ form_params = opts[:form_params] || {}
59
+
60
+ # http body (model)
61
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'create_wallet_request'])
62
+
63
+ # return_type
64
+ return_type = opts[:debug_return_type] || 'Wallet'
65
+
66
+ # auth_names
67
+ auth_names = opts[:debug_auth_names] || []
68
+
69
+ new_options = opts.merge(
70
+ :operation => :"WalletsApi.create_wallet",
71
+ :header_params => header_params,
72
+ :query_params => query_params,
73
+ :form_params => form_params,
74
+ :body => post_body,
75
+ :auth_names => auth_names,
76
+ :return_type => return_type
77
+ )
78
+
79
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
80
+ if @api_client.config.debugging
81
+ @api_client.config.logger.debug "API called: WalletsApi#create_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
+ end
83
+ return data, status_code, headers
84
+ end
85
+
86
+ # Get wallet by ID
87
+ # Get wallet
88
+ # @param wallet_id [String] The ID of the wallet to fetch
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [Wallet]
91
+ def get_wallet(wallet_id, opts = {})
92
+ data, _status_code, _headers = get_wallet_with_http_info(wallet_id, opts)
93
+ data
94
+ end
95
+
96
+ # Get wallet by ID
97
+ # Get wallet
98
+ # @param wallet_id [String] The ID of the wallet to fetch
99
+ # @param [Hash] opts the optional parameters
100
+ # @return [Array<(Wallet, Integer, Hash)>] Wallet data, response status code and response headers
101
+ def get_wallet_with_http_info(wallet_id, opts = {})
102
+ if @api_client.config.debugging
103
+ @api_client.config.logger.debug 'Calling API: WalletsApi.get_wallet ...'
104
+ end
105
+ # verify the required parameter 'wallet_id' is set
106
+ if @api_client.config.client_side_validation && wallet_id.nil?
107
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletsApi.get_wallet"
108
+ end
109
+ # resource path
110
+ local_var_path = '/v1/wallets/{wallet_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s))
111
+
112
+ # query parameters
113
+ query_params = opts[:query_params] || {}
114
+
115
+ # header parameters
116
+ header_params = opts[:header_params] || {}
117
+ # HTTP header 'Accept' (if needed)
118
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
119
+
120
+ # form parameters
121
+ form_params = opts[:form_params] || {}
122
+
123
+ # http body (model)
124
+ post_body = opts[:debug_body]
125
+
126
+ # return_type
127
+ return_type = opts[:debug_return_type] || 'Wallet'
128
+
129
+ # auth_names
130
+ auth_names = opts[:debug_auth_names] || []
131
+
132
+ new_options = opts.merge(
133
+ :operation => :"WalletsApi.get_wallet",
134
+ :header_params => header_params,
135
+ :query_params => query_params,
136
+ :form_params => form_params,
137
+ :body => post_body,
138
+ :auth_names => auth_names,
139
+ :return_type => return_type
140
+ )
141
+
142
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
143
+ if @api_client.config.debugging
144
+ @api_client.config.logger.debug "API called: WalletsApi#get_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
145
+ end
146
+ return data, status_code, headers
147
+ end
148
+
149
+ # Get the balance of an asset in the wallet
150
+ # Get the aggregated balance of an asset across all of the addresses in the wallet.
151
+ # @param wallet_id [String] The ID of the wallet to fetch the balance for
152
+ # @param asset_id [String] The symbol of the asset to fetch the balance for
153
+ # @param [Hash] opts the optional parameters
154
+ # @return [Balance]
155
+ def get_wallet_balance(wallet_id, asset_id, opts = {})
156
+ data, _status_code, _headers = get_wallet_balance_with_http_info(wallet_id, asset_id, opts)
157
+ data
158
+ end
159
+
160
+ # Get the balance of an asset in the wallet
161
+ # Get the aggregated balance of an asset across all of the addresses in the wallet.
162
+ # @param wallet_id [String] The ID of the wallet to fetch the balance for
163
+ # @param asset_id [String] The symbol of the asset to fetch the balance for
164
+ # @param [Hash] opts the optional parameters
165
+ # @return [Array<(Balance, Integer, Hash)>] Balance data, response status code and response headers
166
+ def get_wallet_balance_with_http_info(wallet_id, asset_id, opts = {})
167
+ if @api_client.config.debugging
168
+ @api_client.config.logger.debug 'Calling API: WalletsApi.get_wallet_balance ...'
169
+ end
170
+ # verify the required parameter 'wallet_id' is set
171
+ if @api_client.config.client_side_validation && wallet_id.nil?
172
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletsApi.get_wallet_balance"
173
+ end
174
+ # verify the required parameter 'asset_id' is set
175
+ if @api_client.config.client_side_validation && asset_id.nil?
176
+ fail ArgumentError, "Missing the required parameter 'asset_id' when calling WalletsApi.get_wallet_balance"
177
+ end
178
+ # resource path
179
+ local_var_path = '/v1/wallets/{wallet_id}/balances/{asset_id}'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s)).sub('{' + 'asset_id' + '}', CGI.escape(asset_id.to_s))
180
+
181
+ # query parameters
182
+ query_params = opts[:query_params] || {}
183
+
184
+ # header parameters
185
+ header_params = opts[:header_params] || {}
186
+ # HTTP header 'Accept' (if needed)
187
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
188
+
189
+ # form parameters
190
+ form_params = opts[:form_params] || {}
191
+
192
+ # http body (model)
193
+ post_body = opts[:debug_body]
194
+
195
+ # return_type
196
+ return_type = opts[:debug_return_type] || 'Balance'
197
+
198
+ # auth_names
199
+ auth_names = opts[:debug_auth_names] || []
200
+
201
+ new_options = opts.merge(
202
+ :operation => :"WalletsApi.get_wallet_balance",
203
+ :header_params => header_params,
204
+ :query_params => query_params,
205
+ :form_params => form_params,
206
+ :body => post_body,
207
+ :auth_names => auth_names,
208
+ :return_type => return_type
209
+ )
210
+
211
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
212
+ if @api_client.config.debugging
213
+ @api_client.config.logger.debug "API called: WalletsApi#get_wallet_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
214
+ end
215
+ return data, status_code, headers
216
+ end
217
+
218
+ # List wallet balances
219
+ # List the balances of all of the addresses in the wallet aggregated by asset.
220
+ # @param wallet_id [String] The ID of the wallet to fetch the balances for
221
+ # @param [Hash] opts the optional parameters
222
+ # @return [AddressBalanceList]
223
+ def list_wallet_balances(wallet_id, opts = {})
224
+ data, _status_code, _headers = list_wallet_balances_with_http_info(wallet_id, opts)
225
+ data
226
+ end
227
+
228
+ # List wallet balances
229
+ # List the balances of all of the addresses in the wallet aggregated by asset.
230
+ # @param wallet_id [String] The ID of the wallet to fetch the balances for
231
+ # @param [Hash] opts the optional parameters
232
+ # @return [Array<(AddressBalanceList, Integer, Hash)>] AddressBalanceList data, response status code and response headers
233
+ def list_wallet_balances_with_http_info(wallet_id, opts = {})
234
+ if @api_client.config.debugging
235
+ @api_client.config.logger.debug 'Calling API: WalletsApi.list_wallet_balances ...'
236
+ end
237
+ # verify the required parameter 'wallet_id' is set
238
+ if @api_client.config.client_side_validation && wallet_id.nil?
239
+ fail ArgumentError, "Missing the required parameter 'wallet_id' when calling WalletsApi.list_wallet_balances"
240
+ end
241
+ # resource path
242
+ local_var_path = '/v1/wallets/{wallet_id}/balances'.sub('{' + 'wallet_id' + '}', CGI.escape(wallet_id.to_s))
243
+
244
+ # query parameters
245
+ query_params = opts[:query_params] || {}
246
+
247
+ # header parameters
248
+ header_params = opts[:header_params] || {}
249
+ # HTTP header 'Accept' (if needed)
250
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
251
+
252
+ # form parameters
253
+ form_params = opts[:form_params] || {}
254
+
255
+ # http body (model)
256
+ post_body = opts[:debug_body]
257
+
258
+ # return_type
259
+ return_type = opts[:debug_return_type] || 'AddressBalanceList'
260
+
261
+ # auth_names
262
+ auth_names = opts[:debug_auth_names] || []
263
+
264
+ new_options = opts.merge(
265
+ :operation => :"WalletsApi.list_wallet_balances",
266
+ :header_params => header_params,
267
+ :query_params => query_params,
268
+ :form_params => form_params,
269
+ :body => post_body,
270
+ :auth_names => auth_names,
271
+ :return_type => return_type
272
+ )
273
+
274
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
275
+ if @api_client.config.debugging
276
+ @api_client.config.logger.debug "API called: WalletsApi#list_wallet_balances\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
277
+ end
278
+ return data, status_code, headers
279
+ end
280
+
281
+ # List wallets
282
+ # List wallets belonging to the user.
283
+ # @param [Hash] opts the optional parameters
284
+ # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
285
+ # @option opts [String] :page A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
286
+ # @return [WalletList]
287
+ def list_wallets(opts = {})
288
+ data, _status_code, _headers = list_wallets_with_http_info(opts)
289
+ data
290
+ end
291
+
292
+ # List wallets
293
+ # List wallets belonging to the user.
294
+ # @param [Hash] opts the optional parameters
295
+ # @option opts [Integer] :limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
296
+ # @option opts [String] :page A cursor for pagination across multiple pages of results. Don&#39;t include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
297
+ # @return [Array<(WalletList, Integer, Hash)>] WalletList data, response status code and response headers
298
+ def list_wallets_with_http_info(opts = {})
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug 'Calling API: WalletsApi.list_wallets ...'
301
+ end
302
+ if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
303
+ fail ArgumentError, 'invalid value for "opts[:"page"]" when calling WalletsApi.list_wallets, the character length must be smaller than or equal to 5000.'
304
+ end
305
+
306
+ # resource path
307
+ local_var_path = '/v1/wallets'
308
+
309
+ # query parameters
310
+ query_params = opts[:query_params] || {}
311
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
312
+ query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
313
+
314
+ # header parameters
315
+ header_params = opts[:header_params] || {}
316
+ # HTTP header 'Accept' (if needed)
317
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
318
+
319
+ # form parameters
320
+ form_params = opts[:form_params] || {}
321
+
322
+ # http body (model)
323
+ post_body = opts[:debug_body]
324
+
325
+ # return_type
326
+ return_type = opts[:debug_return_type] || 'WalletList'
327
+
328
+ # auth_names
329
+ auth_names = opts[:debug_auth_names] || []
330
+
331
+ new_options = opts.merge(
332
+ :operation => :"WalletsApi.list_wallets",
333
+ :header_params => header_params,
334
+ :query_params => query_params,
335
+ :form_params => form_params,
336
+ :body => post_body,
337
+ :auth_names => auth_names,
338
+ :return_type => return_type
339
+ )
340
+
341
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
342
+ if @api_client.config.debugging
343
+ @api_client.config.logger.debug "API called: WalletsApi#list_wallets\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
344
+ end
345
+ return data, status_code, headers
346
+ end
347
+ end
348
+ end