coinbase-sdk 0.0.4 → 0.0.6
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.
- checksums.yaml +4 -4
- data/lib/coinbase/address.rb +79 -42
- data/lib/coinbase/authenticator.rb +1 -1
- data/lib/coinbase/balance.rb +3 -5
- data/lib/coinbase/balance_map.rb +4 -4
- data/lib/coinbase/client/api/server_signers_api.rb +419 -0
- data/lib/coinbase/client/api/trades_api.rb +342 -0
- data/lib/coinbase/client/models/broadcast_trade_request.rb +222 -0
- data/lib/coinbase/client/models/create_address_request.rb +0 -14
- data/lib/coinbase/client/models/create_server_signer_request.rb +239 -0
- data/lib/coinbase/client/models/create_trade_request.rb +256 -0
- data/lib/coinbase/client/models/create_wallet_request.rb +1 -1
- data/lib/coinbase/client/models/create_wallet_request_wallet.rb +233 -0
- data/lib/coinbase/client/models/seed_creation_event.rb +240 -0
- data/lib/coinbase/client/models/seed_creation_event_result.rb +274 -0
- data/lib/coinbase/client/models/server_signer.rb +235 -0
- data/lib/coinbase/client/models/server_signer_event.rb +239 -0
- data/lib/coinbase/client/models/server_signer_event_event.rb +105 -0
- data/lib/coinbase/client/models/server_signer_event_list.rb +275 -0
- data/lib/coinbase/client/models/signature_creation_event.rb +363 -0
- data/lib/coinbase/client/models/signature_creation_event_result.rb +329 -0
- data/lib/coinbase/client/models/trade.rb +356 -0
- data/lib/coinbase/client/models/trade_list.rb +275 -0
- data/lib/coinbase/client/models/transaction.rb +294 -0
- data/lib/coinbase/client/models/transaction_type.rb +39 -0
- data/lib/coinbase/client/models/wallet.rb +55 -4
- data/lib/coinbase/client.rb +18 -0
- data/lib/coinbase/middleware.rb +4 -1
- data/lib/coinbase/transfer.rb +21 -21
- data/lib/coinbase/user.rb +43 -104
- data/lib/coinbase/wallet.rb +312 -58
- data/lib/coinbase.rb +16 -4
- metadata +48 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee1676ef79c89fd46c217eacbffecf507bed15a7362b8550d3110df96d45cd47
|
4
|
+
data.tar.gz: 21627d8b1bd0aefd94f33e5638eb514d8984aea244fb353c21e6fc17e899bf8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b4ea7efb7b44a82b7b508ae8145ac7df6f467c55a17b27c10fe66aed6a72a7d4408d24ff1253b9ab9cbd6eca19d46def359d094673a066eb6479656ed47d30a
|
7
|
+
data.tar.gz: 79557441fda3a63c564976f8568cb0ab5b724063dd793fc5ad32085e2eb533355720d1084cace42d3b7a92e3bdf3748434389c0f1f8a7989c402b7191054be2f
|
data/lib/coinbase/address.rb
CHANGED
@@ -15,7 +15,7 @@ module Coinbase
|
|
15
15
|
# Returns a new Address object. Do not use this method directly. Instead, use Wallet#create_address, or use
|
16
16
|
# the Wallet's default_address.
|
17
17
|
# @param model [Coinbase::Client::Address] The underlying Address object
|
18
|
-
# @param key [Eth::Key] The key backing the Address
|
18
|
+
# @param key [Eth::Key] The key backing the Address. Can be nil.
|
19
19
|
def initialize(model, key)
|
20
20
|
@model = model
|
21
21
|
@key = key
|
@@ -39,6 +39,14 @@ module Coinbase
|
|
39
39
|
@model.address_id
|
40
40
|
end
|
41
41
|
|
42
|
+
# Sets the private key backing the Address. This key is used to sign transactions.
|
43
|
+
# @param key [Eth::Key] The key backing the Address
|
44
|
+
def key=(key)
|
45
|
+
raise 'Private key is already set' unless @key.nil?
|
46
|
+
|
47
|
+
@key = key
|
48
|
+
end
|
49
|
+
|
42
50
|
# Returns the balances of the Address.
|
43
51
|
# @return [BalanceMap] The balances of the Address, keyed by asset ID. Ether balances are denominated
|
44
52
|
# in ETH.
|
@@ -63,57 +71,32 @@ module Coinbase
|
|
63
71
|
Coinbase::Balance.from_model_and_asset_id(response, asset_id).amount
|
64
72
|
end
|
65
73
|
|
66
|
-
# Transfers the given amount of the given Asset to the
|
74
|
+
# Transfers the given amount of the given Asset to the specified address or wallet.
|
75
|
+
# Only same-network Transfers are supported.
|
67
76
|
# @param amount [Integer, Float, BigDecimal] The amount of the Asset to send.
|
68
77
|
# @param asset_id [Symbol] The ID of the Asset to send. For Ether, :eth, :gwei, and :wei are supported.
|
69
78
|
# @param destination [Wallet | Address | String] The destination of the transfer. If a Wallet, sends to the Wallet's
|
70
79
|
# default address. If a String, interprets it as the address ID.
|
71
80
|
# @return [String] The hash of the Transfer transaction.
|
72
81
|
def transfer(amount, asset_id, destination)
|
73
|
-
|
74
|
-
|
75
|
-
if destination.is_a?(Wallet)
|
76
|
-
raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id
|
77
|
-
|
78
|
-
destination = destination.default_address.id
|
79
|
-
elsif destination.is_a?(Address)
|
80
|
-
raise ArgumentError, 'Transfer must be on the same Network' if destination.network_id != network_id
|
81
|
-
|
82
|
-
destination = destination.id
|
83
|
-
end
|
84
|
-
|
85
|
-
current_balance = balance(asset_id)
|
86
|
-
if current_balance < amount
|
87
|
-
raise ArgumentError, "Insufficient funds: #{amount} requested, but only #{current_balance} available"
|
88
|
-
end
|
89
|
-
|
90
|
-
create_transfer_request = {
|
91
|
-
amount: Coinbase::Asset.to_atomic_amount(amount, asset_id).to_i.to_s,
|
92
|
-
network_id: network_id,
|
93
|
-
asset_id: Coinbase::Asset.primary_denomination(asset_id).to_s,
|
94
|
-
destination: destination
|
95
|
-
}
|
82
|
+
destination_address, destination_network = destination_address_and_network(destination)
|
96
83
|
|
97
|
-
|
98
|
-
transfers_api.create_transfer(wallet_id, id, create_transfer_request)
|
99
|
-
end
|
100
|
-
|
101
|
-
transfer = Coinbase::Transfer.new(transfer_model)
|
84
|
+
validate_can_transfer!(amount, asset_id, destination_network)
|
102
85
|
|
103
|
-
|
104
|
-
transaction.sign(@key)
|
86
|
+
transfer = create_transfer(amount, asset_id, destination_address)
|
105
87
|
|
106
|
-
|
88
|
+
# If a server signer is managing keys, it will sign and broadcast the underlying transfer transaction out of band.
|
89
|
+
return transfer if Coinbase.use_server_signer?
|
107
90
|
|
108
|
-
|
109
|
-
signed_payload: signed_payload
|
110
|
-
}
|
91
|
+
signed_payload = sign_transfer(transfer)
|
111
92
|
|
112
|
-
|
113
|
-
|
114
|
-
end
|
93
|
+
broadcast_transfer(transfer, signed_payload)
|
94
|
+
end
|
115
95
|
|
116
|
-
|
96
|
+
# Returns whether the Address has a private key backing it to sign transactions.
|
97
|
+
# @return [Boolean] Whether the Address has a private key backing it to sign transactions.
|
98
|
+
def can_sign?
|
99
|
+
!@key.nil?
|
117
100
|
end
|
118
101
|
|
119
102
|
# Returns a String representation of the Address.
|
@@ -142,6 +125,8 @@ module Coinbase
|
|
142
125
|
# Exports the Address's private key to a hex string.
|
143
126
|
# @return [String] The Address's private key as a hex String
|
144
127
|
def export
|
128
|
+
raise 'Cannot export key without private key loaded' if @key.nil?
|
129
|
+
|
145
130
|
@key.private_hex
|
146
131
|
end
|
147
132
|
|
@@ -152,12 +137,13 @@ module Coinbase
|
|
152
137
|
page = nil
|
153
138
|
|
154
139
|
loop do
|
155
|
-
puts "fetch transfers page: #{page}"
|
156
140
|
response = Coinbase.call_api do
|
157
141
|
transfers_api.list_transfers(wallet_id, id, { limit: 100, page: page })
|
158
142
|
end
|
159
143
|
|
160
|
-
|
144
|
+
break if response.data.empty?
|
145
|
+
|
146
|
+
transfers.concat(response.data.map { |transfer| Coinbase::Transfer.new(transfer) })
|
161
147
|
|
162
148
|
break unless response.has_more
|
163
149
|
|
@@ -176,5 +162,56 @@ module Coinbase
|
|
176
162
|
def transfers_api
|
177
163
|
@transfers_api ||= Coinbase::Client::TransfersApi.new(Coinbase.configuration.api_client)
|
178
164
|
end
|
165
|
+
|
166
|
+
def destination_address_and_network(destination)
|
167
|
+
return [destination.default_address.id, destination.network_id] if destination.is_a?(Wallet)
|
168
|
+
return [destination.id, destination.network_id] if destination.is_a?(Address)
|
169
|
+
|
170
|
+
[destination, network_id]
|
171
|
+
end
|
172
|
+
|
173
|
+
def validate_can_transfer!(amount, asset_id, destination_network_id)
|
174
|
+
raise 'Cannot transfer from address without private key loaded' unless can_sign? || Coinbase.use_server_signer?
|
175
|
+
|
176
|
+
raise ArgumentError, "Unsupported asset: #{asset_id}" unless Coinbase::Asset.supported?(asset_id)
|
177
|
+
|
178
|
+
raise ArgumentError, 'Transfer must be on the same Network' unless destination_network_id == network_id
|
179
|
+
|
180
|
+
current_balance = balance(asset_id)
|
181
|
+
|
182
|
+
return unless current_balance < amount
|
183
|
+
|
184
|
+
raise ArgumentError, "Insufficient funds: #{amount} requested, but only #{current_balance} available"
|
185
|
+
end
|
186
|
+
|
187
|
+
def create_transfer(amount, asset_id, destination)
|
188
|
+
create_transfer_request = {
|
189
|
+
amount: Coinbase::Asset.to_atomic_amount(amount, asset_id).to_i.to_s,
|
190
|
+
network_id: network_id,
|
191
|
+
asset_id: Coinbase::Asset.primary_denomination(asset_id).to_s,
|
192
|
+
destination: destination
|
193
|
+
}
|
194
|
+
|
195
|
+
transfer_model = Coinbase.call_api do
|
196
|
+
transfers_api.create_transfer(wallet_id, id, create_transfer_request)
|
197
|
+
end
|
198
|
+
|
199
|
+
Coinbase::Transfer.new(transfer_model)
|
200
|
+
end
|
201
|
+
|
202
|
+
def sign_transfer(transfer)
|
203
|
+
transaction = transfer.transaction
|
204
|
+
transaction.sign(@key)
|
205
|
+
|
206
|
+
transaction.hex
|
207
|
+
end
|
208
|
+
|
209
|
+
def broadcast_transfer(transfer, signed_payload)
|
210
|
+
transfer_model = Coinbase.call_api do
|
211
|
+
transfers_api.broadcast_transfer(wallet_id, id, transfer.id, { signed_payload: signed_payload })
|
212
|
+
end
|
213
|
+
|
214
|
+
Coinbase::Transfer.new(transfer_model)
|
215
|
+
end
|
179
216
|
end
|
180
217
|
end
|
data/lib/coinbase/balance.rb
CHANGED
@@ -25,12 +25,10 @@ module Coinbase
|
|
25
25
|
)
|
26
26
|
end
|
27
27
|
|
28
|
-
# Returns a new
|
29
|
-
#
|
30
|
-
# @param
|
28
|
+
# Returns a new Balance object. Do not use this method. Instead, use Balance.from_model or
|
29
|
+
# Balance.from_model_and_asset_id.
|
30
|
+
# @param amount [BigDecimal] The amount of the Asset
|
31
31
|
# @param asset_id [Symbol] The Asset ID
|
32
|
-
# @param display_name [String] The Asset's display name
|
33
|
-
# @param address_id [String] (Optional) The Asset's address ID, if one exists
|
34
32
|
def initialize(amount:, asset_id:)
|
35
33
|
@amount = amount
|
36
34
|
@asset_id = asset_id
|
data/lib/coinbase/balance_map.rb
CHANGED
@@ -27,21 +27,21 @@ module Coinbase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
# Returns a string representation of the balance map.
|
30
|
-
# @return [String] The string representation of the balance
|
30
|
+
# @return [String] The string representation of the balance map
|
31
31
|
def to_s
|
32
32
|
to_string
|
33
33
|
end
|
34
34
|
|
35
35
|
# Returns a string representation of the balance map.
|
36
|
-
# @return [String] The string representation of the balance
|
36
|
+
# @return [String] The string representation of the balance map
|
37
37
|
def inspect
|
38
38
|
to_string
|
39
39
|
end
|
40
40
|
|
41
41
|
private
|
42
42
|
|
43
|
-
# Returns a string representation of the balance.
|
44
|
-
# @return [String] The string representation of the balance
|
43
|
+
# Returns a string representation of the balance map.
|
44
|
+
# @return [String] The string representation of the balance map
|
45
45
|
def to_string
|
46
46
|
result = {}
|
47
47
|
|
@@ -0,0 +1,419 @@
|
|
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 ServerSignersApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
# Create a new Server-Signer
|
23
|
+
# Create a new Server-Signer
|
24
|
+
# @param [Hash] opts the optional parameters
|
25
|
+
# @option opts [CreateServerSignerRequest] :create_server_signer_request
|
26
|
+
# @return [ServerSigner]
|
27
|
+
def create_server_signer(opts = {})
|
28
|
+
data, _status_code, _headers = create_server_signer_with_http_info(opts)
|
29
|
+
data
|
30
|
+
end
|
31
|
+
|
32
|
+
# Create a new Server-Signer
|
33
|
+
# Create a new Server-Signer
|
34
|
+
# @param [Hash] opts the optional parameters
|
35
|
+
# @option opts [CreateServerSignerRequest] :create_server_signer_request
|
36
|
+
# @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers
|
37
|
+
def create_server_signer_with_http_info(opts = {})
|
38
|
+
if @api_client.config.debugging
|
39
|
+
@api_client.config.logger.debug 'Calling API: ServerSignersApi.create_server_signer ...'
|
40
|
+
end
|
41
|
+
# resource path
|
42
|
+
local_var_path = '/v1/server_signers'
|
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_server_signer_request'])
|
62
|
+
|
63
|
+
# return_type
|
64
|
+
return_type = opts[:debug_return_type] || 'ServerSigner'
|
65
|
+
|
66
|
+
# auth_names
|
67
|
+
auth_names = opts[:debug_auth_names] || []
|
68
|
+
|
69
|
+
new_options = opts.merge(
|
70
|
+
:operation => :"ServerSignersApi.create_server_signer",
|
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: ServerSignersApi#create_server_signer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
82
|
+
end
|
83
|
+
return data, status_code, headers
|
84
|
+
end
|
85
|
+
|
86
|
+
# Get a server signer by ID
|
87
|
+
# Get a server signer by ID
|
88
|
+
# @param server_signer_id [String] The ID of the server signer to fetch
|
89
|
+
# @param [Hash] opts the optional parameters
|
90
|
+
# @return [ServerSigner]
|
91
|
+
def get_server_signer(server_signer_id, opts = {})
|
92
|
+
data, _status_code, _headers = get_server_signer_with_http_info(server_signer_id, opts)
|
93
|
+
data
|
94
|
+
end
|
95
|
+
|
96
|
+
# Get a server signer by ID
|
97
|
+
# Get a server signer by ID
|
98
|
+
# @param server_signer_id [String] The ID of the server signer to fetch
|
99
|
+
# @param [Hash] opts the optional parameters
|
100
|
+
# @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers
|
101
|
+
def get_server_signer_with_http_info(server_signer_id, opts = {})
|
102
|
+
if @api_client.config.debugging
|
103
|
+
@api_client.config.logger.debug 'Calling API: ServerSignersApi.get_server_signer ...'
|
104
|
+
end
|
105
|
+
# verify the required parameter 'server_signer_id' is set
|
106
|
+
if @api_client.config.client_side_validation && server_signer_id.nil?
|
107
|
+
fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.get_server_signer"
|
108
|
+
end
|
109
|
+
# resource path
|
110
|
+
local_var_path = '/v1/server_signers/{server_signer_id}'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_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] || 'ServerSigner'
|
128
|
+
|
129
|
+
# auth_names
|
130
|
+
auth_names = opts[:debug_auth_names] || []
|
131
|
+
|
132
|
+
new_options = opts.merge(
|
133
|
+
:operation => :"ServerSignersApi.get_server_signer",
|
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: ServerSignersApi#get_server_signer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
145
|
+
end
|
146
|
+
return data, status_code, headers
|
147
|
+
end
|
148
|
+
|
149
|
+
# List events for a server signer
|
150
|
+
# List events for a server signer
|
151
|
+
# @param server_signer_id [String] The ID of the server signer to fetch events for
|
152
|
+
# @param [Hash] opts the optional parameters
|
153
|
+
# @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.
|
154
|
+
# @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
155
|
+
# @return [ServerSignerEventList]
|
156
|
+
def list_server_signer_events(server_signer_id, opts = {})
|
157
|
+
data, _status_code, _headers = list_server_signer_events_with_http_info(server_signer_id, opts)
|
158
|
+
data
|
159
|
+
end
|
160
|
+
|
161
|
+
# List events for a server signer
|
162
|
+
# List events for a server signer
|
163
|
+
# @param server_signer_id [String] The ID of the server signer to fetch events for
|
164
|
+
# @param [Hash] opts the optional parameters
|
165
|
+
# @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.
|
166
|
+
# @option opts [String] :page A cursor for pagination across multiple pages of results. Don't include this parameter on the first call. Use the next_page value returned in a previous response to request subsequent results.
|
167
|
+
# @return [Array<(ServerSignerEventList, Integer, Hash)>] ServerSignerEventList data, response status code and response headers
|
168
|
+
def list_server_signer_events_with_http_info(server_signer_id, opts = {})
|
169
|
+
if @api_client.config.debugging
|
170
|
+
@api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signer_events ...'
|
171
|
+
end
|
172
|
+
# verify the required parameter 'server_signer_id' is set
|
173
|
+
if @api_client.config.client_side_validation && server_signer_id.nil?
|
174
|
+
fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.list_server_signer_events"
|
175
|
+
end
|
176
|
+
if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'].to_s.length > 5000
|
177
|
+
fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ServerSignersApi.list_server_signer_events, the character length must be smaller than or equal to 5000.'
|
178
|
+
end
|
179
|
+
|
180
|
+
# resource path
|
181
|
+
local_var_path = '/v1/server_signers/{server_signer_id}/events'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s))
|
182
|
+
|
183
|
+
# query parameters
|
184
|
+
query_params = opts[:query_params] || {}
|
185
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
186
|
+
query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
|
187
|
+
|
188
|
+
# header parameters
|
189
|
+
header_params = opts[:header_params] || {}
|
190
|
+
# HTTP header 'Accept' (if needed)
|
191
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
192
|
+
|
193
|
+
# form parameters
|
194
|
+
form_params = opts[:form_params] || {}
|
195
|
+
|
196
|
+
# http body (model)
|
197
|
+
post_body = opts[:debug_body]
|
198
|
+
|
199
|
+
# return_type
|
200
|
+
return_type = opts[:debug_return_type] || 'ServerSignerEventList'
|
201
|
+
|
202
|
+
# auth_names
|
203
|
+
auth_names = opts[:debug_auth_names] || []
|
204
|
+
|
205
|
+
new_options = opts.merge(
|
206
|
+
:operation => :"ServerSignersApi.list_server_signer_events",
|
207
|
+
:header_params => header_params,
|
208
|
+
:query_params => query_params,
|
209
|
+
:form_params => form_params,
|
210
|
+
:body => post_body,
|
211
|
+
:auth_names => auth_names,
|
212
|
+
:return_type => return_type
|
213
|
+
)
|
214
|
+
|
215
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
216
|
+
if @api_client.config.debugging
|
217
|
+
@api_client.config.logger.debug "API called: ServerSignersApi#list_server_signer_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
218
|
+
end
|
219
|
+
return data, status_code, headers
|
220
|
+
end
|
221
|
+
|
222
|
+
# List server signers for the current project
|
223
|
+
# List server signers for the current project
|
224
|
+
# @param [Hash] opts the optional parameters
|
225
|
+
# @return [ServerSigner]
|
226
|
+
def list_server_signers(opts = {})
|
227
|
+
data, _status_code, _headers = list_server_signers_with_http_info(opts)
|
228
|
+
data
|
229
|
+
end
|
230
|
+
|
231
|
+
# List server signers for the current project
|
232
|
+
# List server signers for the current project
|
233
|
+
# @param [Hash] opts the optional parameters
|
234
|
+
# @return [Array<(ServerSigner, Integer, Hash)>] ServerSigner data, response status code and response headers
|
235
|
+
def list_server_signers_with_http_info(opts = {})
|
236
|
+
if @api_client.config.debugging
|
237
|
+
@api_client.config.logger.debug 'Calling API: ServerSignersApi.list_server_signers ...'
|
238
|
+
end
|
239
|
+
# resource path
|
240
|
+
local_var_path = '/v1/server_signers'
|
241
|
+
|
242
|
+
# query parameters
|
243
|
+
query_params = opts[:query_params] || {}
|
244
|
+
|
245
|
+
# header parameters
|
246
|
+
header_params = opts[:header_params] || {}
|
247
|
+
# HTTP header 'Accept' (if needed)
|
248
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
249
|
+
|
250
|
+
# form parameters
|
251
|
+
form_params = opts[:form_params] || {}
|
252
|
+
|
253
|
+
# http body (model)
|
254
|
+
post_body = opts[:debug_body]
|
255
|
+
|
256
|
+
# return_type
|
257
|
+
return_type = opts[:debug_return_type] || 'ServerSigner'
|
258
|
+
|
259
|
+
# auth_names
|
260
|
+
auth_names = opts[:debug_auth_names] || []
|
261
|
+
|
262
|
+
new_options = opts.merge(
|
263
|
+
:operation => :"ServerSignersApi.list_server_signers",
|
264
|
+
:header_params => header_params,
|
265
|
+
:query_params => query_params,
|
266
|
+
:form_params => form_params,
|
267
|
+
:body => post_body,
|
268
|
+
:auth_names => auth_names,
|
269
|
+
:return_type => return_type
|
270
|
+
)
|
271
|
+
|
272
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
273
|
+
if @api_client.config.debugging
|
274
|
+
@api_client.config.logger.debug "API called: ServerSignersApi#list_server_signers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
275
|
+
end
|
276
|
+
return data, status_code, headers
|
277
|
+
end
|
278
|
+
|
279
|
+
# Submit the result of a server signer event
|
280
|
+
# Submit the result of a server signer event
|
281
|
+
# @param server_signer_id [String] The ID of the server signer to submit the event result for
|
282
|
+
# @param [Hash] opts the optional parameters
|
283
|
+
# @option opts [SeedCreationEventResult] :seed_creation_event_result
|
284
|
+
# @return [SeedCreationEventResult]
|
285
|
+
def submit_server_signer_seed_event_result(server_signer_id, opts = {})
|
286
|
+
data, _status_code, _headers = submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts)
|
287
|
+
data
|
288
|
+
end
|
289
|
+
|
290
|
+
# Submit the result of a server signer event
|
291
|
+
# Submit the result of a server signer event
|
292
|
+
# @param server_signer_id [String] The ID of the server signer to submit the event result for
|
293
|
+
# @param [Hash] opts the optional parameters
|
294
|
+
# @option opts [SeedCreationEventResult] :seed_creation_event_result
|
295
|
+
# @return [Array<(SeedCreationEventResult, Integer, Hash)>] SeedCreationEventResult data, response status code and response headers
|
296
|
+
def submit_server_signer_seed_event_result_with_http_info(server_signer_id, opts = {})
|
297
|
+
if @api_client.config.debugging
|
298
|
+
@api_client.config.logger.debug 'Calling API: ServerSignersApi.submit_server_signer_seed_event_result ...'
|
299
|
+
end
|
300
|
+
# verify the required parameter 'server_signer_id' is set
|
301
|
+
if @api_client.config.client_side_validation && server_signer_id.nil?
|
302
|
+
fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.submit_server_signer_seed_event_result"
|
303
|
+
end
|
304
|
+
# resource path
|
305
|
+
local_var_path = '/v1/server_signers/{server_signer_id}/seed_event_result'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s))
|
306
|
+
|
307
|
+
# query parameters
|
308
|
+
query_params = opts[:query_params] || {}
|
309
|
+
|
310
|
+
# header parameters
|
311
|
+
header_params = opts[:header_params] || {}
|
312
|
+
# HTTP header 'Accept' (if needed)
|
313
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
314
|
+
# HTTP header 'Content-Type'
|
315
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
316
|
+
if !content_type.nil?
|
317
|
+
header_params['Content-Type'] = content_type
|
318
|
+
end
|
319
|
+
|
320
|
+
# form parameters
|
321
|
+
form_params = opts[:form_params] || {}
|
322
|
+
|
323
|
+
# http body (model)
|
324
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'seed_creation_event_result'])
|
325
|
+
|
326
|
+
# return_type
|
327
|
+
return_type = opts[:debug_return_type] || 'SeedCreationEventResult'
|
328
|
+
|
329
|
+
# auth_names
|
330
|
+
auth_names = opts[:debug_auth_names] || []
|
331
|
+
|
332
|
+
new_options = opts.merge(
|
333
|
+
:operation => :"ServerSignersApi.submit_server_signer_seed_event_result",
|
334
|
+
:header_params => header_params,
|
335
|
+
:query_params => query_params,
|
336
|
+
:form_params => form_params,
|
337
|
+
:body => post_body,
|
338
|
+
:auth_names => auth_names,
|
339
|
+
:return_type => return_type
|
340
|
+
)
|
341
|
+
|
342
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
343
|
+
if @api_client.config.debugging
|
344
|
+
@api_client.config.logger.debug "API called: ServerSignersApi#submit_server_signer_seed_event_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
345
|
+
end
|
346
|
+
return data, status_code, headers
|
347
|
+
end
|
348
|
+
|
349
|
+
# Submit the result of a server signer event
|
350
|
+
# Submit the result of a server signer event
|
351
|
+
# @param server_signer_id [String] The ID of the server signer to submit the event result for
|
352
|
+
# @param [Hash] opts the optional parameters
|
353
|
+
# @option opts [SignatureCreationEventResult] :signature_creation_event_result
|
354
|
+
# @return [SignatureCreationEventResult]
|
355
|
+
def submit_server_signer_signature_event_result(server_signer_id, opts = {})
|
356
|
+
data, _status_code, _headers = submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts)
|
357
|
+
data
|
358
|
+
end
|
359
|
+
|
360
|
+
# Submit the result of a server signer event
|
361
|
+
# Submit the result of a server signer event
|
362
|
+
# @param server_signer_id [String] The ID of the server signer to submit the event result for
|
363
|
+
# @param [Hash] opts the optional parameters
|
364
|
+
# @option opts [SignatureCreationEventResult] :signature_creation_event_result
|
365
|
+
# @return [Array<(SignatureCreationEventResult, Integer, Hash)>] SignatureCreationEventResult data, response status code and response headers
|
366
|
+
def submit_server_signer_signature_event_result_with_http_info(server_signer_id, opts = {})
|
367
|
+
if @api_client.config.debugging
|
368
|
+
@api_client.config.logger.debug 'Calling API: ServerSignersApi.submit_server_signer_signature_event_result ...'
|
369
|
+
end
|
370
|
+
# verify the required parameter 'server_signer_id' is set
|
371
|
+
if @api_client.config.client_side_validation && server_signer_id.nil?
|
372
|
+
fail ArgumentError, "Missing the required parameter 'server_signer_id' when calling ServerSignersApi.submit_server_signer_signature_event_result"
|
373
|
+
end
|
374
|
+
# resource path
|
375
|
+
local_var_path = '/v1/server_signers/{server_signer_id}/signature_event_result'.sub('{' + 'server_signer_id' + '}', CGI.escape(server_signer_id.to_s))
|
376
|
+
|
377
|
+
# query parameters
|
378
|
+
query_params = opts[:query_params] || {}
|
379
|
+
|
380
|
+
# header parameters
|
381
|
+
header_params = opts[:header_params] || {}
|
382
|
+
# HTTP header 'Accept' (if needed)
|
383
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
384
|
+
# HTTP header 'Content-Type'
|
385
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
386
|
+
if !content_type.nil?
|
387
|
+
header_params['Content-Type'] = content_type
|
388
|
+
end
|
389
|
+
|
390
|
+
# form parameters
|
391
|
+
form_params = opts[:form_params] || {}
|
392
|
+
|
393
|
+
# http body (model)
|
394
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'signature_creation_event_result'])
|
395
|
+
|
396
|
+
# return_type
|
397
|
+
return_type = opts[:debug_return_type] || 'SignatureCreationEventResult'
|
398
|
+
|
399
|
+
# auth_names
|
400
|
+
auth_names = opts[:debug_auth_names] || []
|
401
|
+
|
402
|
+
new_options = opts.merge(
|
403
|
+
:operation => :"ServerSignersApi.submit_server_signer_signature_event_result",
|
404
|
+
:header_params => header_params,
|
405
|
+
:query_params => query_params,
|
406
|
+
:form_params => form_params,
|
407
|
+
:body => post_body,
|
408
|
+
:auth_names => auth_names,
|
409
|
+
:return_type => return_type
|
410
|
+
)
|
411
|
+
|
412
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
413
|
+
if @api_client.config.debugging
|
414
|
+
@api_client.config.logger.debug "API called: ServerSignersApi#submit_server_signer_signature_event_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
415
|
+
end
|
416
|
+
return data, status_code, headers
|
417
|
+
end
|
418
|
+
end
|
419
|
+
end
|