diff --git a/CHANGELOG.md b/CHANGELOG.md index 884321c..9658d3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## Unreleased +## [0.0.13] - 2024-11-21 + +### Added + +- Update SDK with latest generated client code. + ## [0.0.12] - 2024-09-30 ### Added diff --git a/Makefile b/Makefile index 672aff0..5a094c3 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,6 @@ test-coverage: mocks: mockery --disable-version-string --name AssetsAPI --keeptree --dir gen/client --output pkg/mocks mockery --disable-version-string --name StakeAPI --keeptree --dir gen/client --output pkg/mocks - mockery --disable-version-string --name ValidatorsAPI --keeptree --dir gen/client --output pkg/mocks mockery --disable-version-string --name Signable --keeptree --dir pkg/coinbase --output pkg/mocks .PHONY: docs diff --git a/examples/ethereum/shared-eth-stake/main.go b/examples/ethereum/shared-eth-stake/main.go index 5a9fb8a..47da13c 100644 --- a/examples/ethereum/shared-eth-stake/main.go +++ b/examples/ethereum/shared-eth-stake/main.go @@ -14,7 +14,7 @@ import ( /* * This example code stakes ETH on the Holesky network via Shared ETH Staking. - * Run the code with 'go run examples/ethereum/stake/main.go ' + * Run the code with 'go run examples/ethereum/shared-eth-stake/main.go ' */ func main() { diff --git a/gen/client/README.md b/gen/client/README.md index ad4088b..a6617ca 100644 --- a/gen/client/README.md +++ b/gen/client/README.md @@ -7,7 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - API version: 0.0.1-alpha - Package version: 1.0.0 -- Generator version: 7.8.0 +- Generator version: 7.9.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation @@ -95,10 +95,20 @@ Class | Method | HTTP request | Description *ContractInvocationsAPI* | [**GetContractInvocation**](docs/ContractInvocationsAPI.md#getcontractinvocation) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations/{contract_invocation_id} | Get a contract invocation by ID. *ContractInvocationsAPI* | [**ListContractInvocations**](docs/ContractInvocationsAPI.md#listcontractinvocations) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/contract_invocations | List contract invocations for an address. *ExternalAddressesAPI* | [**GetExternalAddressBalance**](docs/ExternalAddressesAPI.md#getexternaladdressbalance) | **Get** /v1/networks/{network_id}/addresses/{address_id}/balances/{asset_id} | Get the balance of an asset in an external address -*ExternalAddressesAPI* | [**ListAddressTransactions**](docs/ExternalAddressesAPI.md#listaddresstransactions) | **Get** /v1/networks/{network_id}/addresses/{address_id}/transactions | List transactions for an address. +*ExternalAddressesAPI* | [**GetFaucetTransaction**](docs/ExternalAddressesAPI.md#getfaucettransaction) | **Get** /v1/networks/{network_id}/addresses/{address_id}/faucet/{tx_hash} | Get the status of a faucet transaction *ExternalAddressesAPI* | [**ListExternalAddressBalances**](docs/ExternalAddressesAPI.md#listexternaladdressbalances) | **Get** /v1/networks/{network_id}/addresses/{address_id}/balances | Get the balances of an external address *ExternalAddressesAPI* | [**RequestExternalFaucetFunds**](docs/ExternalAddressesAPI.md#requestexternalfaucetfunds) | **Post** /v1/networks/{network_id}/addresses/{address_id}/faucet | Request faucet funds for external address. +*FundAPI* | [**CreateFundOperation**](docs/FundAPI.md#createfundoperation) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations | Create a new fund operation. +*FundAPI* | [**CreateFundQuote**](docs/FundAPI.md#createfundquote) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations/quote | Create a Fund Operation quote. +*FundAPI* | [**GetFundOperation**](docs/FundAPI.md#getfundoperation) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations/{fund_operation_id} | Get fund operation. +*FundAPI* | [**ListFundOperations**](docs/FundAPI.md#listfundoperations) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations | List fund operations for an address. +*MPCWalletStakeAPI* | [**BroadcastStakingOperation**](docs/MPCWalletStakeAPI.md#broadcaststakingoperation) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}/broadcast | Broadcast a staking operation +*MPCWalletStakeAPI* | [**CreateStakingOperation**](docs/MPCWalletStakeAPI.md#createstakingoperation) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations | Create a new staking operation for an address +*MPCWalletStakeAPI* | [**GetStakingOperation**](docs/MPCWalletStakeAPI.md#getstakingoperation) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id} | Get the latest state of a staking operation *NetworksAPI* | [**GetNetwork**](docs/NetworksAPI.md#getnetwork) | **Get** /v1/networks/{network_id} | Get network by ID +*OnchainIdentityAPI* | [**ResolveIdentityByAddress**](docs/OnchainIdentityAPI.md#resolveidentitybyaddress) | **Get** /v1/networks/{network_id}/addresses/{address_id}/identity | Obtains onchain identity for an address on a specific network +*ReputationAPI* | [**GetAddressReputation**](docs/ReputationAPI.md#getaddressreputation) | **Get** /v1/networks/{network_id}/addresses/{address_id}/reputation | Get the onchain reputation of an external address +*ReputationAPI* | [**GetAddressRisk**](docs/ReputationAPI.md#getaddressrisk) | **Get** /v1/networks/{network_id}/addresses/{address_id}/risk | Get the risk of an address *ServerSignersAPI* | [**CreateServerSigner**](docs/ServerSignersAPI.md#createserversigner) | **Post** /v1/server_signers | Create a new Server-Signer *ServerSignersAPI* | [**GetServerSigner**](docs/ServerSignersAPI.md#getserversigner) | **Get** /v1/server_signers/{server_signer_id} | Get a server signer by ID *ServerSignersAPI* | [**ListServerSignerEvents**](docs/ServerSignersAPI.md#listserversignerevents) | **Get** /v1/server_signers/{server_signer_id}/events | List events for a server signer @@ -109,30 +119,30 @@ Class | Method | HTTP request | Description *SmartContractsAPI* | [**DeploySmartContract**](docs/SmartContractsAPI.md#deploysmartcontract) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id}/deploy | Deploy a smart contract *SmartContractsAPI* | [**GetSmartContract**](docs/SmartContractsAPI.md#getsmartcontract) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts/{smart_contract_id} | Get a specific smart contract deployed by address *SmartContractsAPI* | [**ListSmartContracts**](docs/SmartContractsAPI.md#listsmartcontracts) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/smart_contracts | List smart contracts deployed by address +*SmartContractsAPI* | [**ReadContract**](docs/SmartContractsAPI.md#readcontract) | **Post** /v1/networks/{network_id}/smart_contracts/{contract_address}/read | Read data from a smart contract *StakeAPI* | [**BuildStakingOperation**](docs/StakeAPI.md#buildstakingoperation) | **Post** /v1/stake/build | Build a new staking operation *StakeAPI* | [**FetchHistoricalStakingBalances**](docs/StakeAPI.md#fetchhistoricalstakingbalances) | **Get** /v1/networks/{network_id}/addresses/{address_id}/stake/balances | Fetch historical staking balances *StakeAPI* | [**FetchStakingRewards**](docs/StakeAPI.md#fetchstakingrewards) | **Post** /v1/stake/rewards/search | Fetch staking rewards *StakeAPI* | [**GetExternalStakingOperation**](docs/StakeAPI.md#getexternalstakingoperation) | **Get** /v1/networks/{network_id}/addresses/{address_id}/staking_operations/{staking_operation_id} | Get the latest state of a staking operation *StakeAPI* | [**GetStakingContext**](docs/StakeAPI.md#getstakingcontext) | **Post** /v1/stake/context | Get staking context +*StakeAPI* | [**GetValidator**](docs/StakeAPI.md#getvalidator) | **Get** /v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id} | Get a validator belonging to the CDP project +*StakeAPI* | [**ListValidators**](docs/StakeAPI.md#listvalidators) | **Get** /v1/networks/{network_id}/assets/{asset_id}/validators | List validators belonging to the CDP project *TradesAPI* | [**BroadcastTrade**](docs/TradesAPI.md#broadcasttrade) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id}/broadcast | Broadcast a trade *TradesAPI* | [**CreateTrade**](docs/TradesAPI.md#createtrade) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/trades | Create a new trade for an address *TradesAPI* | [**GetTrade**](docs/TradesAPI.md#gettrade) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/trades/{trade_id} | Get a trade by ID *TradesAPI* | [**ListTrades**](docs/TradesAPI.md#listtrades) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/trades | List trades for an address. +*TransactionHistoryAPI* | [**ListAddressTransactions**](docs/TransactionHistoryAPI.md#listaddresstransactions) | **Get** /v1/networks/{network_id}/addresses/{address_id}/transactions | List transactions for an address. *TransfersAPI* | [**BroadcastTransfer**](docs/TransfersAPI.md#broadcasttransfer) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id}/broadcast | Broadcast a transfer *TransfersAPI* | [**CreateTransfer**](docs/TransfersAPI.md#createtransfer) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/transfers | Create a new transfer for an address *TransfersAPI* | [**GetTransfer**](docs/TransfersAPI.md#gettransfer) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/transfers/{transfer_id} | Get a transfer by ID *TransfersAPI* | [**ListTransfers**](docs/TransfersAPI.md#listtransfers) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/transfers | List transfers for an address. *UsersAPI* | [**GetCurrentUser**](docs/UsersAPI.md#getcurrentuser) | **Get** /v1/users/me | Get current user -*ValidatorsAPI* | [**GetValidator**](docs/ValidatorsAPI.md#getvalidator) | **Get** /v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id} | Get a validator belonging to the CDP project -*ValidatorsAPI* | [**ListValidators**](docs/ValidatorsAPI.md#listvalidators) | **Get** /v1/networks/{network_id}/assets/{asset_id}/validators | List validators belonging to the CDP project -*WalletStakeAPI* | [**BroadcastStakingOperation**](docs/WalletStakeAPI.md#broadcaststakingoperation) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id}/broadcast | Broadcast a staking operation -*WalletStakeAPI* | [**CreateStakingOperation**](docs/WalletStakeAPI.md#createstakingoperation) | **Post** /v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations | Create a new staking operation for an address -*WalletStakeAPI* | [**GetStakingOperation**](docs/WalletStakeAPI.md#getstakingoperation) | **Get** /v1/wallets/{wallet_id}/addresses/{address_id}/staking_operations/{staking_operation_id} | Get the latest state of a staking operation *WalletsAPI* | [**CreateWallet**](docs/WalletsAPI.md#createwallet) | **Post** /v1/wallets | Create a new wallet *WalletsAPI* | [**GetWallet**](docs/WalletsAPI.md#getwallet) | **Get** /v1/wallets/{wallet_id} | Get wallet by ID *WalletsAPI* | [**GetWalletBalance**](docs/WalletsAPI.md#getwalletbalance) | **Get** /v1/wallets/{wallet_id}/balances/{asset_id} | Get the balance of an asset in the wallet *WalletsAPI* | [**ListWalletBalances**](docs/WalletsAPI.md#listwalletbalances) | **Get** /v1/wallets/{wallet_id}/balances | List wallet balances *WalletsAPI* | [**ListWallets**](docs/WalletsAPI.md#listwallets) | **Get** /v1/wallets | List wallets +*WebhooksAPI* | [**CreateWalletWebhook**](docs/WebhooksAPI.md#createwalletwebhook) | **Post** /v1/wallets/{wallet_id}/webhooks | Create a new webhook scoped to a wallet *WebhooksAPI* | [**CreateWebhook**](docs/WebhooksAPI.md#createwebhook) | **Post** /v1/webhooks | Create a new webhook *WebhooksAPI* | [**DeleteWebhook**](docs/WebhooksAPI.md#deletewebhook) | **Delete** /v1/webhooks/{webhook_id} | Delete a webhook *WebhooksAPI* | [**ListWebhooks**](docs/WebhooksAPI.md#listwebhooks) | **Get** /v1/webhooks | List webhooks @@ -145,6 +155,9 @@ Class | Method | HTTP request | Description - [AddressBalanceList](docs/AddressBalanceList.md) - [AddressHistoricalBalanceList](docs/AddressHistoricalBalanceList.md) - [AddressList](docs/AddressList.md) + - [AddressReputation](docs/AddressReputation.md) + - [AddressReputationMetadata](docs/AddressReputationMetadata.md) + - [AddressRisk](docs/AddressRisk.md) - [AddressTransactionList](docs/AddressTransactionList.md) - [Asset](docs/Asset.md) - [Balance](docs/Balance.md) @@ -159,6 +172,8 @@ Class | Method | HTTP request | Description - [ContractInvocationList](docs/ContractInvocationList.md) - [CreateAddressRequest](docs/CreateAddressRequest.md) - [CreateContractInvocationRequest](docs/CreateContractInvocationRequest.md) + - [CreateFundOperationRequest](docs/CreateFundOperationRequest.md) + - [CreateFundQuoteRequest](docs/CreateFundQuoteRequest.md) - [CreatePayloadSignatureRequest](docs/CreatePayloadSignatureRequest.md) - [CreateServerSignerRequest](docs/CreateServerSignerRequest.md) - [CreateSmartContractRequest](docs/CreateSmartContractRequest.md) @@ -167,11 +182,14 @@ Class | Method | HTTP request | Description - [CreateTransferRequest](docs/CreateTransferRequest.md) - [CreateWalletRequest](docs/CreateWalletRequest.md) - [CreateWalletRequestWallet](docs/CreateWalletRequestWallet.md) + - [CreateWalletWebhookRequest](docs/CreateWalletWebhookRequest.md) - [CreateWebhookRequest](docs/CreateWebhookRequest.md) + - [CryptoAmount](docs/CryptoAmount.md) - [DeploySmartContractRequest](docs/DeploySmartContractRequest.md) - [ERC20TransferEvent](docs/ERC20TransferEvent.md) - [ERC721TransferEvent](docs/ERC721TransferEvent.md) - [Error](docs/Error.md) + - [EthereumTokenTransfer](docs/EthereumTokenTransfer.md) - [EthereumTransaction](docs/EthereumTransaction.md) - [EthereumTransactionAccess](docs/EthereumTransactionAccess.md) - [EthereumTransactionAccessList](docs/EthereumTransactionAccessList.md) @@ -182,13 +200,22 @@ Class | Method | HTTP request | Description - [FetchHistoricalStakingBalances200Response](docs/FetchHistoricalStakingBalances200Response.md) - [FetchStakingRewards200Response](docs/FetchStakingRewards200Response.md) - [FetchStakingRewardsRequest](docs/FetchStakingRewardsRequest.md) + - [FiatAmount](docs/FiatAmount.md) + - [FundOperation](docs/FundOperation.md) + - [FundOperationFees](docs/FundOperationFees.md) + - [FundOperationList](docs/FundOperationList.md) + - [FundQuote](docs/FundQuote.md) - [GetStakingContextRequest](docs/GetStakingContextRequest.md) - [HistoricalBalance](docs/HistoricalBalance.md) + - [MultiTokenContractOptions](docs/MultiTokenContractOptions.md) - [NFTContractOptions](docs/NFTContractOptions.md) - [Network](docs/Network.md) - [NetworkIdentifier](docs/NetworkIdentifier.md) + - [OnchainName](docs/OnchainName.md) + - [OnchainNameList](docs/OnchainNameList.md) - [PayloadSignature](docs/PayloadSignature.md) - [PayloadSignatureList](docs/PayloadSignatureList.md) + - [ReadContractRequest](docs/ReadContractRequest.md) - [SeedCreationEvent](docs/SeedCreationEvent.md) - [SeedCreationEventResult](docs/SeedCreationEventResult.md) - [ServerSigner](docs/ServerSigner.md) @@ -203,6 +230,7 @@ Class | Method | HTTP request | Description - [SmartContractList](docs/SmartContractList.md) - [SmartContractOptions](docs/SmartContractOptions.md) - [SmartContractType](docs/SmartContractType.md) + - [SolidityValue](docs/SolidityValue.md) - [SponsoredSend](docs/SponsoredSend.md) - [StakingBalance](docs/StakingBalance.md) - [StakingContext](docs/StakingContext.md) @@ -213,6 +241,7 @@ Class | Method | HTTP request | Description - [StakingRewardFormat](docs/StakingRewardFormat.md) - [StakingRewardUSDValue](docs/StakingRewardUSDValue.md) - [TokenContractOptions](docs/TokenContractOptions.md) + - [TokenTransferType](docs/TokenTransferType.md) - [Trade](docs/Trade.md) - [TradeList](docs/TradeList.md) - [Transaction](docs/Transaction.md) diff --git a/gen/client/api_addresses.go b/gen/client/api_addresses.go index f3e3056..359953d 100644 --- a/gen/client/api_addresses.go +++ b/gen/client/api_addresses.go @@ -159,11 +159,14 @@ type AddressesAPI interface { @param walletId The ID of the wallet the address belongs to. @param addressId The onchain address of the address that is being fetched. @return ApiRequestFaucetFundsRequest + + Deprecated */ RequestFaucetFunds(ctx context.Context, walletId string, addressId string) ApiRequestFaucetFundsRequest // RequestFaucetFundsExecute executes the request // @return FaucetTransaction + // Deprecated RequestFaucetFundsExecute(r ApiRequestFaucetFundsRequest) (*FaucetTransaction, *http.Response, error) } @@ -1183,6 +1186,8 @@ Request faucet funds to be sent to onchain address. @param walletId The ID of the wallet the address belongs to. @param addressId The onchain address of the address that is being fetched. @return ApiRequestFaucetFundsRequest + +Deprecated */ func (a *AddressesAPIService) RequestFaucetFunds(ctx context.Context, walletId string, addressId string) ApiRequestFaucetFundsRequest { return ApiRequestFaucetFundsRequest{ @@ -1195,6 +1200,7 @@ func (a *AddressesAPIService) RequestFaucetFunds(ctx context.Context, walletId s // Execute executes the request // @return FaucetTransaction +// Deprecated func (a *AddressesAPIService) RequestFaucetFundsExecute(r ApiRequestFaucetFundsRequest) (*FaucetTransaction, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost diff --git a/gen/client/api_external_addresses.go b/gen/client/api_external_addresses.go index f692255..9501976 100644 --- a/gen/client/api_external_addresses.go +++ b/gen/client/api_external_addresses.go @@ -40,20 +40,21 @@ type ExternalAddressesAPI interface { GetExternalAddressBalanceExecute(r ApiGetExternalAddressBalanceRequest) (*Balance, *http.Response, error) /* - ListAddressTransactions List transactions for an address. + GetFaucetTransaction Get the status of a faucet transaction - List all transactions that interact with the address. + Get the status of a faucet transaction @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param networkId The ID of the blockchain network - @param addressId The ID of the address to fetch the transactions for. - @return ApiListAddressTransactionsRequest + @param addressId The ID of the address to fetch the faucet transaction for + @param txHash The hash of the faucet transaction + @return ApiGetFaucetTransactionRequest */ - ListAddressTransactions(ctx context.Context, networkId string, addressId string) ApiListAddressTransactionsRequest + GetFaucetTransaction(ctx context.Context, networkId string, addressId string, txHash string) ApiGetFaucetTransactionRequest - // ListAddressTransactionsExecute executes the request - // @return AddressTransactionList - ListAddressTransactionsExecute(r ApiListAddressTransactionsRequest) (*AddressTransactionList, *http.Response, error) + // GetFaucetTransactionExecute executes the request + // @return FaucetTransaction + GetFaucetTransactionExecute(r ApiGetFaucetTransactionRequest) (*FaucetTransaction, *http.Response, error) /* ListExternalAddressBalances Get the balances of an external address @@ -210,79 +211,63 @@ func (a *ExternalAddressesAPIService) GetExternalAddressBalanceExecute(r ApiGetE return localVarReturnValue, localVarHTTPResponse, nil } -type ApiListAddressTransactionsRequest struct { +type ApiGetFaucetTransactionRequest struct { ctx context.Context ApiService ExternalAddressesAPI networkId string addressId string - limit *int32 - page *string -} - -// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. -func (r ApiListAddressTransactionsRequest) Limit(limit int32) ApiListAddressTransactionsRequest { - r.limit = &limit - return r -} - -// 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. -func (r ApiListAddressTransactionsRequest) Page(page string) ApiListAddressTransactionsRequest { - r.page = &page - return r + txHash string } -func (r ApiListAddressTransactionsRequest) Execute() (*AddressTransactionList, *http.Response, error) { - return r.ApiService.ListAddressTransactionsExecute(r) +func (r ApiGetFaucetTransactionRequest) Execute() (*FaucetTransaction, *http.Response, error) { + return r.ApiService.GetFaucetTransactionExecute(r) } /* -ListAddressTransactions List transactions for an address. +GetFaucetTransaction Get the status of a faucet transaction -List all transactions that interact with the address. +Get the status of a faucet transaction @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param networkId The ID of the blockchain network - @param addressId The ID of the address to fetch the transactions for. - @return ApiListAddressTransactionsRequest + @param addressId The ID of the address to fetch the faucet transaction for + @param txHash The hash of the faucet transaction + @return ApiGetFaucetTransactionRequest */ -func (a *ExternalAddressesAPIService) ListAddressTransactions(ctx context.Context, networkId string, addressId string) ApiListAddressTransactionsRequest { - return ApiListAddressTransactionsRequest{ +func (a *ExternalAddressesAPIService) GetFaucetTransaction(ctx context.Context, networkId string, addressId string, txHash string) ApiGetFaucetTransactionRequest { + return ApiGetFaucetTransactionRequest{ ApiService: a, ctx: ctx, networkId: networkId, addressId: addressId, + txHash: txHash, } } // Execute executes the request -// @return AddressTransactionList -func (a *ExternalAddressesAPIService) ListAddressTransactionsExecute(r ApiListAddressTransactionsRequest) (*AddressTransactionList, *http.Response, error) { +// @return FaucetTransaction +func (a *ExternalAddressesAPIService) GetFaucetTransactionExecute(r ApiGetFaucetTransactionRequest) (*FaucetTransaction, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AddressTransactionList + localVarReturnValue *FaucetTransaction ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ExternalAddressesAPIService.ListAddressTransactions") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ExternalAddressesAPIService.GetFaucetTransaction") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/transactions" + localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/faucet/{tx_hash}" localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tx_hash"+"}", url.PathEscape(parameterValueToString(r.txHash, "txHash")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") - } - if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -476,6 +461,7 @@ type ApiRequestExternalFaucetFundsRequest struct { networkId string addressId string assetId *string + skipWait *bool } // The ID of the asset to transfer from the faucet. @@ -484,6 +470,12 @@ func (r ApiRequestExternalFaucetFundsRequest) AssetId(assetId string) ApiRequest return r } +// Whether to skip waiting for the transaction to be mined. This will become the default behavior in the future. +func (r ApiRequestExternalFaucetFundsRequest) SkipWait(skipWait bool) ApiRequestExternalFaucetFundsRequest { + r.skipWait = &skipWait + return r +} + func (r ApiRequestExternalFaucetFundsRequest) Execute() (*FaucetTransaction, *http.Response, error) { return r.ApiService.RequestExternalFaucetFundsExecute(r) } @@ -533,6 +525,9 @@ func (a *ExternalAddressesAPIService) RequestExternalFaucetFundsExecute(r ApiReq if r.assetId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "asset_id", r.assetId, "form", "") } + if r.skipWait != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip_wait", r.skipWait, "form", "") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_fund.go b/gen/client/api_fund.go new file mode 100644 index 0000000..16dda6c --- /dev/null +++ b/gen/client/api_fund.go @@ -0,0 +1,598 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +type FundAPI interface { + + /* + CreateFundOperation Create a new fund operation. + + Create a new fund operation with an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address to be funded. + @return ApiCreateFundOperationRequest + */ + CreateFundOperation(ctx context.Context, walletId string, addressId string) ApiCreateFundOperationRequest + + // CreateFundOperationExecute executes the request + // @return FundOperation + CreateFundOperationExecute(r ApiCreateFundOperationRequest) (*FundOperation, *http.Response, error) + + /* + CreateFundQuote Create a Fund Operation quote. + + Create a new fund operation with an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address to be funded. + @return ApiCreateFundQuoteRequest + */ + CreateFundQuote(ctx context.Context, walletId string, addressId string) ApiCreateFundQuoteRequest + + // CreateFundQuoteExecute executes the request + // @return FundQuote + CreateFundQuoteExecute(r ApiCreateFundQuoteRequest) (*FundQuote, *http.Response, error) + + /* + GetFundOperation Get fund operation. + + Get fund operation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address that created the fund operation. + @param fundOperationId The ID of the fund operation to fetch. + @return ApiGetFundOperationRequest + */ + GetFundOperation(ctx context.Context, walletId string, addressId string, fundOperationId string) ApiGetFundOperationRequest + + // GetFundOperationExecute executes the request + // @return FundOperation + GetFundOperationExecute(r ApiGetFundOperationRequest) (*FundOperation, *http.Response, error) + + /* + ListFundOperations List fund operations for an address. + + List fund operations for an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address to list fund operations for. + @return ApiListFundOperationsRequest + */ + ListFundOperations(ctx context.Context, walletId string, addressId string) ApiListFundOperationsRequest + + // ListFundOperationsExecute executes the request + // @return FundOperationList + ListFundOperationsExecute(r ApiListFundOperationsRequest) (*FundOperationList, *http.Response, error) +} + +// FundAPIService FundAPI service +type FundAPIService service + +type ApiCreateFundOperationRequest struct { + ctx context.Context + ApiService FundAPI + walletId string + addressId string + createFundOperationRequest *CreateFundOperationRequest +} + +func (r ApiCreateFundOperationRequest) CreateFundOperationRequest(createFundOperationRequest CreateFundOperationRequest) ApiCreateFundOperationRequest { + r.createFundOperationRequest = &createFundOperationRequest + return r +} + +func (r ApiCreateFundOperationRequest) Execute() (*FundOperation, *http.Response, error) { + return r.ApiService.CreateFundOperationExecute(r) +} + +/* +CreateFundOperation Create a new fund operation. + +Create a new fund operation with an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address to be funded. + @return ApiCreateFundOperationRequest +*/ +func (a *FundAPIService) CreateFundOperation(ctx context.Context, walletId string, addressId string) ApiCreateFundOperationRequest { + return ApiCreateFundOperationRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return FundOperation +func (a *FundAPIService) CreateFundOperationExecute(r ApiCreateFundOperationRequest) (*FundOperation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FundOperation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FundAPIService.CreateFundOperation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createFundOperationRequest == nil { + return localVarReturnValue, nil, reportError("createFundOperationRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createFundOperationRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateFundQuoteRequest struct { + ctx context.Context + ApiService FundAPI + walletId string + addressId string + createFundQuoteRequest *CreateFundQuoteRequest +} + +func (r ApiCreateFundQuoteRequest) CreateFundQuoteRequest(createFundQuoteRequest CreateFundQuoteRequest) ApiCreateFundQuoteRequest { + r.createFundQuoteRequest = &createFundQuoteRequest + return r +} + +func (r ApiCreateFundQuoteRequest) Execute() (*FundQuote, *http.Response, error) { + return r.ApiService.CreateFundQuoteExecute(r) +} + +/* +CreateFundQuote Create a Fund Operation quote. + +Create a new fund operation with an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address to be funded. + @return ApiCreateFundQuoteRequest +*/ +func (a *FundAPIService) CreateFundQuote(ctx context.Context, walletId string, addressId string) ApiCreateFundQuoteRequest { + return ApiCreateFundQuoteRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return FundQuote +func (a *FundAPIService) CreateFundQuoteExecute(r ApiCreateFundQuoteRequest) (*FundQuote, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FundQuote + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FundAPIService.CreateFundQuote") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations/quote" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createFundQuoteRequest == nil { + return localVarReturnValue, nil, reportError("createFundQuoteRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createFundQuoteRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetFundOperationRequest struct { + ctx context.Context + ApiService FundAPI + walletId string + addressId string + fundOperationId string +} + +func (r ApiGetFundOperationRequest) Execute() (*FundOperation, *http.Response, error) { + return r.ApiService.GetFundOperationExecute(r) +} + +/* +GetFundOperation Get fund operation. + +Get fund operation. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address that created the fund operation. + @param fundOperationId The ID of the fund operation to fetch. + @return ApiGetFundOperationRequest +*/ +func (a *FundAPIService) GetFundOperation(ctx context.Context, walletId string, addressId string, fundOperationId string) ApiGetFundOperationRequest { + return ApiGetFundOperationRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + fundOperationId: fundOperationId, + } +} + +// Execute executes the request +// @return FundOperation +func (a *FundAPIService) GetFundOperationExecute(r ApiGetFundOperationRequest) (*FundOperation, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FundOperation + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FundAPIService.GetFundOperation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations/{fund_operation_id}" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"fund_operation_id"+"}", url.PathEscape(parameterValueToString(r.fundOperationId, "fundOperationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListFundOperationsRequest struct { + ctx context.Context + ApiService FundAPI + walletId string + addressId string + limit *int32 + page *string +} + +// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. +func (r ApiListFundOperationsRequest) Limit(limit int32) ApiListFundOperationsRequest { + r.limit = &limit + return r +} + +// 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. +func (r ApiListFundOperationsRequest) Page(page string) ApiListFundOperationsRequest { + r.page = &page + return r +} + +func (r ApiListFundOperationsRequest) Execute() (*FundOperationList, *http.Response, error) { + return r.ApiService.ListFundOperationsExecute(r) +} + +/* +ListFundOperations List fund operations for an address. + +List fund operations for an address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet the address belongs to. + @param addressId The onchain address of the address to list fund operations for. + @return ApiListFundOperationsRequest +*/ +func (a *FundAPIService) ListFundOperations(ctx context.Context, walletId string, addressId string) ApiListFundOperationsRequest { + return ApiListFundOperationsRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + addressId: addressId, + } +} + +// Execute executes the request +// @return FundOperationList +func (a *FundAPIService) ListFundOperationsExecute(r ApiListFundOperationsRequest) (*FundOperationList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FundOperationList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "FundAPIService.ListFundOperations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/addresses/{address_id}/fund_operations" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/gen/client/api_wallet_stake.go b/gen/client/api_mpc_wallet_stake.go similarity index 92% rename from gen/client/api_wallet_stake.go rename to gen/client/api_mpc_wallet_stake.go index 38ca7da..0cd757b 100644 --- a/gen/client/api_wallet_stake.go +++ b/gen/client/api_mpc_wallet_stake.go @@ -20,7 +20,7 @@ import ( ) -type WalletStakeAPI interface { +type MPCWalletStakeAPI interface { /* BroadcastStakingOperation Broadcast a staking operation @@ -73,12 +73,12 @@ type WalletStakeAPI interface { GetStakingOperationExecute(r ApiGetStakingOperationRequest) (*StakingOperation, *http.Response, error) } -// WalletStakeAPIService WalletStakeAPI service -type WalletStakeAPIService service +// MPCWalletStakeAPIService MPCWalletStakeAPI service +type MPCWalletStakeAPIService service type ApiBroadcastStakingOperationRequest struct { ctx context.Context - ApiService WalletStakeAPI + ApiService MPCWalletStakeAPI walletId string addressId string stakingOperationId string @@ -105,7 +105,7 @@ Broadcast a staking operation. @param stakingOperationId The ID of the staking operation to broadcast. @return ApiBroadcastStakingOperationRequest */ -func (a *WalletStakeAPIService) BroadcastStakingOperation(ctx context.Context, walletId string, addressId string, stakingOperationId string) ApiBroadcastStakingOperationRequest { +func (a *MPCWalletStakeAPIService) BroadcastStakingOperation(ctx context.Context, walletId string, addressId string, stakingOperationId string) ApiBroadcastStakingOperationRequest { return ApiBroadcastStakingOperationRequest{ ApiService: a, ctx: ctx, @@ -117,7 +117,7 @@ func (a *WalletStakeAPIService) BroadcastStakingOperation(ctx context.Context, w // Execute executes the request // @return StakingOperation -func (a *WalletStakeAPIService) BroadcastStakingOperationExecute(r ApiBroadcastStakingOperationRequest) (*StakingOperation, *http.Response, error) { +func (a *MPCWalletStakeAPIService) BroadcastStakingOperationExecute(r ApiBroadcastStakingOperationRequest) (*StakingOperation, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -125,7 +125,7 @@ func (a *WalletStakeAPIService) BroadcastStakingOperationExecute(r ApiBroadcastS localVarReturnValue *StakingOperation ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WalletStakeAPIService.BroadcastStakingOperation") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MPCWalletStakeAPIService.BroadcastStakingOperation") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -208,7 +208,7 @@ func (a *WalletStakeAPIService) BroadcastStakingOperationExecute(r ApiBroadcastS type ApiCreateStakingOperationRequest struct { ctx context.Context - ApiService WalletStakeAPI + ApiService MPCWalletStakeAPI walletId string addressId string createStakingOperationRequest *CreateStakingOperationRequest @@ -233,7 +233,7 @@ Create a new staking operation. @param addressId The ID of the address to create the staking operation for. @return ApiCreateStakingOperationRequest */ -func (a *WalletStakeAPIService) CreateStakingOperation(ctx context.Context, walletId string, addressId string) ApiCreateStakingOperationRequest { +func (a *MPCWalletStakeAPIService) CreateStakingOperation(ctx context.Context, walletId string, addressId string) ApiCreateStakingOperationRequest { return ApiCreateStakingOperationRequest{ ApiService: a, ctx: ctx, @@ -244,7 +244,7 @@ func (a *WalletStakeAPIService) CreateStakingOperation(ctx context.Context, wall // Execute executes the request // @return StakingOperation -func (a *WalletStakeAPIService) CreateStakingOperationExecute(r ApiCreateStakingOperationRequest) (*StakingOperation, *http.Response, error) { +func (a *MPCWalletStakeAPIService) CreateStakingOperationExecute(r ApiCreateStakingOperationRequest) (*StakingOperation, *http.Response, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} @@ -252,7 +252,7 @@ func (a *WalletStakeAPIService) CreateStakingOperationExecute(r ApiCreateStaking localVarReturnValue *StakingOperation ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WalletStakeAPIService.CreateStakingOperation") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MPCWalletStakeAPIService.CreateStakingOperation") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } @@ -334,7 +334,7 @@ func (a *WalletStakeAPIService) CreateStakingOperationExecute(r ApiCreateStaking type ApiGetStakingOperationRequest struct { ctx context.Context - ApiService WalletStakeAPI + ApiService MPCWalletStakeAPI walletId string addressId string stakingOperationId string @@ -355,7 +355,7 @@ Get the latest state of a staking operation. @param stakingOperationId The ID of the staking operation. @return ApiGetStakingOperationRequest */ -func (a *WalletStakeAPIService) GetStakingOperation(ctx context.Context, walletId string, addressId string, stakingOperationId string) ApiGetStakingOperationRequest { +func (a *MPCWalletStakeAPIService) GetStakingOperation(ctx context.Context, walletId string, addressId string, stakingOperationId string) ApiGetStakingOperationRequest { return ApiGetStakingOperationRequest{ ApiService: a, ctx: ctx, @@ -367,7 +367,7 @@ func (a *WalletStakeAPIService) GetStakingOperation(ctx context.Context, walletI // Execute executes the request // @return StakingOperation -func (a *WalletStakeAPIService) GetStakingOperationExecute(r ApiGetStakingOperationRequest) (*StakingOperation, *http.Response, error) { +func (a *MPCWalletStakeAPIService) GetStakingOperationExecute(r ApiGetStakingOperationRequest) (*StakingOperation, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} @@ -375,7 +375,7 @@ func (a *WalletStakeAPIService) GetStakingOperationExecute(r ApiGetStakingOperat localVarReturnValue *StakingOperation ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WalletStakeAPIService.GetStakingOperation") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MPCWalletStakeAPIService.GetStakingOperation") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } diff --git a/gen/client/api_onchain_identity.go b/gen/client/api_onchain_identity.go new file mode 100644 index 0000000..b2de413 --- /dev/null +++ b/gen/client/api_onchain_identity.go @@ -0,0 +1,188 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +type OnchainIdentityAPI interface { + + /* + ResolveIdentityByAddress Obtains onchain identity for an address on a specific network + + Obtains onchain identity for an address on a specific network + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network + @param addressId The ID of the address to fetch the identity for + @return ApiResolveIdentityByAddressRequest + */ + ResolveIdentityByAddress(ctx context.Context, networkId string, addressId string) ApiResolveIdentityByAddressRequest + + // ResolveIdentityByAddressExecute executes the request + // @return OnchainNameList + ResolveIdentityByAddressExecute(r ApiResolveIdentityByAddressRequest) (*OnchainNameList, *http.Response, error) +} + +// OnchainIdentityAPIService OnchainIdentityAPI service +type OnchainIdentityAPIService service + +type ApiResolveIdentityByAddressRequest struct { + ctx context.Context + ApiService OnchainIdentityAPI + networkId string + addressId string + roles *[]string + limit *int32 + page *string +} + +// A filter by role of the names related to this address (managed or owned) +func (r ApiResolveIdentityByAddressRequest) Roles(roles []string) ApiResolveIdentityByAddressRequest { + r.roles = &roles + return r +} + +// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. +func (r ApiResolveIdentityByAddressRequest) Limit(limit int32) ApiResolveIdentityByAddressRequest { + r.limit = &limit + return r +} + +// 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. +func (r ApiResolveIdentityByAddressRequest) Page(page string) ApiResolveIdentityByAddressRequest { + r.page = &page + return r +} + +func (r ApiResolveIdentityByAddressRequest) Execute() (*OnchainNameList, *http.Response, error) { + return r.ApiService.ResolveIdentityByAddressExecute(r) +} + +/* +ResolveIdentityByAddress Obtains onchain identity for an address on a specific network + +Obtains onchain identity for an address on a specific network + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network + @param addressId The ID of the address to fetch the identity for + @return ApiResolveIdentityByAddressRequest +*/ +func (a *OnchainIdentityAPIService) ResolveIdentityByAddress(ctx context.Context, networkId string, addressId string) ApiResolveIdentityByAddressRequest { + return ApiResolveIdentityByAddressRequest{ + ApiService: a, + ctx: ctx, + networkId: networkId, + addressId: addressId, + } +} + +// Execute executes the request +// @return OnchainNameList +func (a *OnchainIdentityAPIService) ResolveIdentityByAddressExecute(r ApiResolveIdentityByAddressRequest) (*OnchainNameList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OnchainNameList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OnchainIdentityAPIService.ResolveIdentityByAddress") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/identity" + localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.roles != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "roles", r.roles, "form", "csv") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/gen/client/api_validators.go b/gen/client/api_reputation.go similarity index 59% rename from gen/client/api_validators.go rename to gen/client/api_reputation.go index 301bf4f..a36f876 100644 --- a/gen/client/api_validators.go +++ b/gen/client/api_reputation.go @@ -20,97 +20,92 @@ import ( ) -type ValidatorsAPI interface { +type ReputationAPI interface { /* - GetValidator Get a validator belonging to the CDP project + GetAddressReputation Get the onchain reputation of an external address - Get a validator belonging to the user for a given network, asset and id. + Get the onchain reputation of an external address @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param networkId The ID of the blockchain network. - @param assetId The symbol of the asset to get the validator for. - @param validatorId The unique id of the validator to fetch details for. - @return ApiGetValidatorRequest + @param addressId The ID of the address to fetch the reputation for. + @return ApiGetAddressReputationRequest */ - GetValidator(ctx context.Context, networkId string, assetId string, validatorId string) ApiGetValidatorRequest + GetAddressReputation(ctx context.Context, networkId string, addressId string) ApiGetAddressReputationRequest - // GetValidatorExecute executes the request - // @return Validator - GetValidatorExecute(r ApiGetValidatorRequest) (*Validator, *http.Response, error) + // GetAddressReputationExecute executes the request + // @return AddressReputation + GetAddressReputationExecute(r ApiGetAddressReputationRequest) (*AddressReputation, *http.Response, error) /* - ListValidators List validators belonging to the CDP project + GetAddressRisk Get the risk of an address - List validators belonging to the user for a given network and asset. + Get the risk of an address @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param networkId The ID of the blockchain network. - @param assetId The symbol of the asset to get the validators for. - @return ApiListValidatorsRequest + @param addressId The ID of the address to fetch the risk for. + @return ApiGetAddressRiskRequest */ - ListValidators(ctx context.Context, networkId string, assetId string) ApiListValidatorsRequest + GetAddressRisk(ctx context.Context, networkId string, addressId string) ApiGetAddressRiskRequest - // ListValidatorsExecute executes the request - // @return ValidatorList - ListValidatorsExecute(r ApiListValidatorsRequest) (*ValidatorList, *http.Response, error) + // GetAddressRiskExecute executes the request + // @return AddressRisk + GetAddressRiskExecute(r ApiGetAddressRiskRequest) (*AddressRisk, *http.Response, error) } -// ValidatorsAPIService ValidatorsAPI service -type ValidatorsAPIService service +// ReputationAPIService ReputationAPI service +type ReputationAPIService service -type ApiGetValidatorRequest struct { +type ApiGetAddressReputationRequest struct { ctx context.Context - ApiService ValidatorsAPI + ApiService ReputationAPI networkId string - assetId string - validatorId string + addressId string } -func (r ApiGetValidatorRequest) Execute() (*Validator, *http.Response, error) { - return r.ApiService.GetValidatorExecute(r) +func (r ApiGetAddressReputationRequest) Execute() (*AddressReputation, *http.Response, error) { + return r.ApiService.GetAddressReputationExecute(r) } /* -GetValidator Get a validator belonging to the CDP project +GetAddressReputation Get the onchain reputation of an external address -Get a validator belonging to the user for a given network, asset and id. +Get the onchain reputation of an external address @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param networkId The ID of the blockchain network. - @param assetId The symbol of the asset to get the validator for. - @param validatorId The unique id of the validator to fetch details for. - @return ApiGetValidatorRequest + @param addressId The ID of the address to fetch the reputation for. + @return ApiGetAddressReputationRequest */ -func (a *ValidatorsAPIService) GetValidator(ctx context.Context, networkId string, assetId string, validatorId string) ApiGetValidatorRequest { - return ApiGetValidatorRequest{ +func (a *ReputationAPIService) GetAddressReputation(ctx context.Context, networkId string, addressId string) ApiGetAddressReputationRequest { + return ApiGetAddressReputationRequest{ ApiService: a, ctx: ctx, networkId: networkId, - assetId: assetId, - validatorId: validatorId, + addressId: addressId, } } // Execute executes the request -// @return Validator -func (a *ValidatorsAPIService) GetValidatorExecute(r ApiGetValidatorRequest) (*Validator, *http.Response, error) { +// @return AddressReputation +func (a *ReputationAPIService) GetAddressReputationExecute(r ApiGetAddressReputationRequest) (*AddressReputation, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Validator + localVarReturnValue *AddressReputation ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ValidatorsAPIService.GetValidator") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReputationAPIService.GetAddressReputation") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id}" + localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/reputation" localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"asset_id"+"}", url.PathEscape(parameterValueToString(r.assetId, "assetId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"validator_id"+"}", url.PathEscape(parameterValueToString(r.validatorId, "validatorId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -178,89 +173,59 @@ func (a *ValidatorsAPIService) GetValidatorExecute(r ApiGetValidatorRequest) (*V return localVarReturnValue, localVarHTTPResponse, nil } -type ApiListValidatorsRequest struct { +type ApiGetAddressRiskRequest struct { ctx context.Context - ApiService ValidatorsAPI + ApiService ReputationAPI networkId string - assetId string - status *ValidatorStatus - limit *int32 - page *string + addressId string } -// A filter to list validators based on a status. -func (r ApiListValidatorsRequest) Status(status ValidatorStatus) ApiListValidatorsRequest { - r.status = &status - return r -} - -// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. -func (r ApiListValidatorsRequest) Limit(limit int32) ApiListValidatorsRequest { - r.limit = &limit - return r -} - -// 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. -func (r ApiListValidatorsRequest) Page(page string) ApiListValidatorsRequest { - r.page = &page - return r -} - -func (r ApiListValidatorsRequest) Execute() (*ValidatorList, *http.Response, error) { - return r.ApiService.ListValidatorsExecute(r) +func (r ApiGetAddressRiskRequest) Execute() (*AddressRisk, *http.Response, error) { + return r.ApiService.GetAddressRiskExecute(r) } /* -ListValidators List validators belonging to the CDP project +GetAddressRisk Get the risk of an address -List validators belonging to the user for a given network and asset. +Get the risk of an address @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param networkId The ID of the blockchain network. - @param assetId The symbol of the asset to get the validators for. - @return ApiListValidatorsRequest + @param addressId The ID of the address to fetch the risk for. + @return ApiGetAddressRiskRequest */ -func (a *ValidatorsAPIService) ListValidators(ctx context.Context, networkId string, assetId string) ApiListValidatorsRequest { - return ApiListValidatorsRequest{ +func (a *ReputationAPIService) GetAddressRisk(ctx context.Context, networkId string, addressId string) ApiGetAddressRiskRequest { + return ApiGetAddressRiskRequest{ ApiService: a, ctx: ctx, networkId: networkId, - assetId: assetId, + addressId: addressId, } } // Execute executes the request -// @return ValidatorList -func (a *ValidatorsAPIService) ListValidatorsExecute(r ApiListValidatorsRequest) (*ValidatorList, *http.Response, error) { +// @return AddressRisk +func (a *ReputationAPIService) GetAddressRiskExecute(r ApiGetAddressRiskRequest) (*AddressRisk, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ValidatorList + localVarReturnValue *AddressRisk ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ValidatorsAPIService.ListValidators") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReputationAPIService.GetAddressRisk") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/v1/networks/{network_id}/assets/{asset_id}/validators" + localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/risk" localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"asset_id"+"}", url.PathEscape(parameterValueToString(r.assetId, "assetId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.status != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "form", "") - } - if r.limit != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") - } - if r.page != nil { - parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") - } // to determine the Content-Type header localVarHTTPContentTypes := []string{} diff --git a/gen/client/api_server_signers.go b/gen/client/api_server_signers.go index c38d2bf..0bf56b0 100644 --- a/gen/client/api_server_signers.go +++ b/gen/client/api_server_signers.go @@ -59,11 +59,14 @@ type ServerSignersAPI interface { @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param serverSignerId The ID of the server signer to fetch events for @return ApiListServerSignerEventsRequest + + Deprecated */ ListServerSignerEvents(ctx context.Context, serverSignerId string) ApiListServerSignerEventsRequest // ListServerSignerEventsExecute executes the request // @return ServerSignerEventList + // Deprecated ListServerSignerEventsExecute(r ApiListServerSignerEventsRequest) (*ServerSignerEventList, *http.Response, error) /* @@ -372,6 +375,8 @@ List events for a server signer @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param serverSignerId The ID of the server signer to fetch events for @return ApiListServerSignerEventsRequest + +Deprecated */ func (a *ServerSignersAPIService) ListServerSignerEvents(ctx context.Context, serverSignerId string) ApiListServerSignerEventsRequest { return ApiListServerSignerEventsRequest{ @@ -383,6 +388,7 @@ func (a *ServerSignersAPIService) ListServerSignerEvents(ctx context.Context, se // Execute executes the request // @return ServerSignerEventList +// Deprecated func (a *ServerSignersAPIService) ListServerSignerEventsExecute(r ApiListServerSignerEventsRequest) (*ServerSignerEventList, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet diff --git a/gen/client/api_smart_contracts.go b/gen/client/api_smart_contracts.go index 03eadbd..5744e4d 100644 --- a/gen/client/api_smart_contracts.go +++ b/gen/client/api_smart_contracts.go @@ -87,6 +87,22 @@ type SmartContractsAPI interface { // ListSmartContractsExecute executes the request // @return SmartContractList ListSmartContractsExecute(r ApiListSmartContractsRequest) (*SmartContractList, *http.Response, error) + + /* + ReadContract Read data from a smart contract + + Perform a read operation on a smart contract without creating a transaction + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId + @param contractAddress + @return ApiReadContractRequest + */ + ReadContract(ctx context.Context, networkId string, contractAddress string) ApiReadContractRequest + + // ReadContractExecute executes the request + // @return SolidityValue + ReadContractExecute(r ApiReadContractRequest) (*SolidityValue, *http.Response, error) } // SmartContractsAPIService SmartContractsAPI service @@ -581,3 +597,129 @@ func (a *SmartContractsAPIService) ListSmartContractsExecute(r ApiListSmartContr return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiReadContractRequest struct { + ctx context.Context + ApiService SmartContractsAPI + networkId string + contractAddress string + readContractRequest *ReadContractRequest +} + +func (r ApiReadContractRequest) ReadContractRequest(readContractRequest ReadContractRequest) ApiReadContractRequest { + r.readContractRequest = &readContractRequest + return r +} + +func (r ApiReadContractRequest) Execute() (*SolidityValue, *http.Response, error) { + return r.ApiService.ReadContractExecute(r) +} + +/* +ReadContract Read data from a smart contract + +Perform a read operation on a smart contract without creating a transaction + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId + @param contractAddress + @return ApiReadContractRequest +*/ +func (a *SmartContractsAPIService) ReadContract(ctx context.Context, networkId string, contractAddress string) ApiReadContractRequest { + return ApiReadContractRequest{ + ApiService: a, + ctx: ctx, + networkId: networkId, + contractAddress: contractAddress, + } +} + +// Execute executes the request +// @return SolidityValue +func (a *SmartContractsAPIService) ReadContractExecute(r ApiReadContractRequest) (*SolidityValue, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *SolidityValue + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SmartContractsAPIService.ReadContract") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/networks/{network_id}/smart_contracts/{contract_address}/read" + localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"contract_address"+"}", url.PathEscape(parameterValueToString(r.contractAddress, "contractAddress")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.readContractRequest == nil { + return localVarReturnValue, nil, reportError("readContractRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.readContractRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/gen/client/api_stake.go b/gen/client/api_stake.go index 3c64df3..bac0855 100644 --- a/gen/client/api_stake.go +++ b/gen/client/api_stake.go @@ -97,6 +97,39 @@ type StakeAPI interface { // GetStakingContextExecute executes the request // @return StakingContext GetStakingContextExecute(r ApiGetStakingContextRequest) (*StakingContext, *http.Response, error) + + /* + GetValidator Get a validator belonging to the CDP project + + Get a validator belonging to the user for a given network, asset and id. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network. + @param assetId The symbol of the asset to get the validator for. + @param validatorId The unique id of the validator to fetch details for. + @return ApiGetValidatorRequest + */ + GetValidator(ctx context.Context, networkId string, assetId string, validatorId string) ApiGetValidatorRequest + + // GetValidatorExecute executes the request + // @return Validator + GetValidatorExecute(r ApiGetValidatorRequest) (*Validator, *http.Response, error) + + /* + ListValidators List validators belonging to the CDP project + + List validators belonging to the user for a given network and asset. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network. + @param assetId The symbol of the asset to get the validators for. + @return ApiListValidatorsRequest + */ + ListValidators(ctx context.Context, networkId string, assetId string) ApiListValidatorsRequest + + // ListValidatorsExecute executes the request + // @return ValidatorList + ListValidatorsExecute(r ApiListValidatorsRequest) (*ValidatorList, *http.Response, error) } // StakeAPIService StakeAPI service @@ -771,3 +804,267 @@ func (a *StakeAPIService) GetStakingContextExecute(r ApiGetStakingContextRequest return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiGetValidatorRequest struct { + ctx context.Context + ApiService StakeAPI + networkId string + assetId string + validatorId string +} + +func (r ApiGetValidatorRequest) Execute() (*Validator, *http.Response, error) { + return r.ApiService.GetValidatorExecute(r) +} + +/* +GetValidator Get a validator belonging to the CDP project + +Get a validator belonging to the user for a given network, asset and id. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network. + @param assetId The symbol of the asset to get the validator for. + @param validatorId The unique id of the validator to fetch details for. + @return ApiGetValidatorRequest +*/ +func (a *StakeAPIService) GetValidator(ctx context.Context, networkId string, assetId string, validatorId string) ApiGetValidatorRequest { + return ApiGetValidatorRequest{ + ApiService: a, + ctx: ctx, + networkId: networkId, + assetId: assetId, + validatorId: validatorId, + } +} + +// Execute executes the request +// @return Validator +func (a *StakeAPIService) GetValidatorExecute(r ApiGetValidatorRequest) (*Validator, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Validator + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StakeAPIService.GetValidator") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/networks/{network_id}/assets/{asset_id}/validators/{validator_id}" + localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"asset_id"+"}", url.PathEscape(parameterValueToString(r.assetId, "assetId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"validator_id"+"}", url.PathEscape(parameterValueToString(r.validatorId, "validatorId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListValidatorsRequest struct { + ctx context.Context + ApiService StakeAPI + networkId string + assetId string + status *ValidatorStatus + limit *int32 + page *string +} + +// A filter to list validators based on a status. +func (r ApiListValidatorsRequest) Status(status ValidatorStatus) ApiListValidatorsRequest { + r.status = &status + return r +} + +// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 50. +func (r ApiListValidatorsRequest) Limit(limit int32) ApiListValidatorsRequest { + r.limit = &limit + return r +} + +// 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. +func (r ApiListValidatorsRequest) Page(page string) ApiListValidatorsRequest { + r.page = &page + return r +} + +func (r ApiListValidatorsRequest) Execute() (*ValidatorList, *http.Response, error) { + return r.ApiService.ListValidatorsExecute(r) +} + +/* +ListValidators List validators belonging to the CDP project + +List validators belonging to the user for a given network and asset. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network. + @param assetId The symbol of the asset to get the validators for. + @return ApiListValidatorsRequest +*/ +func (a *StakeAPIService) ListValidators(ctx context.Context, networkId string, assetId string) ApiListValidatorsRequest { + return ApiListValidatorsRequest{ + ApiService: a, + ctx: ctx, + networkId: networkId, + assetId: assetId, + } +} + +// Execute executes the request +// @return ValidatorList +func (a *StakeAPIService) ListValidatorsExecute(r ApiListValidatorsRequest) (*ValidatorList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ValidatorList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StakeAPIService.ListValidators") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/networks/{network_id}/assets/{asset_id}/validators" + localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"asset_id"+"}", url.PathEscape(parameterValueToString(r.assetId, "assetId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.status != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "form", "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/gen/client/api_transaction_history.go b/gen/client/api_transaction_history.go new file mode 100644 index 0000000..20904df --- /dev/null +++ b/gen/client/api_transaction_history.go @@ -0,0 +1,178 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +type TransactionHistoryAPI interface { + + /* + ListAddressTransactions List transactions for an address. + + List all transactions that interact with the address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network + @param addressId The ID of the address to fetch the transactions for. + @return ApiListAddressTransactionsRequest + */ + ListAddressTransactions(ctx context.Context, networkId string, addressId string) ApiListAddressTransactionsRequest + + // ListAddressTransactionsExecute executes the request + // @return AddressTransactionList + ListAddressTransactionsExecute(r ApiListAddressTransactionsRequest) (*AddressTransactionList, *http.Response, error) +} + +// TransactionHistoryAPIService TransactionHistoryAPI service +type TransactionHistoryAPIService service + +type ApiListAddressTransactionsRequest struct { + ctx context.Context + ApiService TransactionHistoryAPI + networkId string + addressId string + limit *int32 + page *string +} + +// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10. +func (r ApiListAddressTransactionsRequest) Limit(limit int32) ApiListAddressTransactionsRequest { + r.limit = &limit + return r +} + +// 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. +func (r ApiListAddressTransactionsRequest) Page(page string) ApiListAddressTransactionsRequest { + r.page = &page + return r +} + +func (r ApiListAddressTransactionsRequest) Execute() (*AddressTransactionList, *http.Response, error) { + return r.ApiService.ListAddressTransactionsExecute(r) +} + +/* +ListAddressTransactions List transactions for an address. + +List all transactions that interact with the address. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkId The ID of the blockchain network + @param addressId The ID of the address to fetch the transactions for. + @return ApiListAddressTransactionsRequest +*/ +func (a *TransactionHistoryAPIService) ListAddressTransactions(ctx context.Context, networkId string, addressId string) ApiListAddressTransactionsRequest { + return ApiListAddressTransactionsRequest{ + ApiService: a, + ctx: ctx, + networkId: networkId, + addressId: addressId, + } +} + +// Execute executes the request +// @return AddressTransactionList +func (a *TransactionHistoryAPIService) ListAddressTransactionsExecute(r ApiListAddressTransactionsRequest) (*AddressTransactionList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AddressTransactionList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TransactionHistoryAPIService.ListAddressTransactions") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/networks/{network_id}/addresses/{address_id}/transactions" + localVarPath = strings.Replace(localVarPath, "{"+"network_id"+"}", url.PathEscape(parameterValueToString(r.networkId, "networkId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"address_id"+"}", url.PathEscape(parameterValueToString(r.addressId, "addressId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } + if r.page != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "page", r.page, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/gen/client/api_webhooks.go b/gen/client/api_webhooks.go index 258e4b6..7327584 100644 --- a/gen/client/api_webhooks.go +++ b/gen/client/api_webhooks.go @@ -22,6 +22,21 @@ import ( type WebhooksAPI interface { + /* + CreateWalletWebhook Create a new webhook scoped to a wallet + + Create a new webhook scoped to a wallet + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet to create the webhook for. + @return ApiCreateWalletWebhookRequest + */ + CreateWalletWebhook(ctx context.Context, walletId string) ApiCreateWalletWebhookRequest + + // CreateWalletWebhookExecute executes the request + // @return Webhook + CreateWalletWebhookExecute(r ApiCreateWalletWebhookRequest) (*Webhook, *http.Response, error) + /* CreateWebhook Create a new webhook @@ -83,6 +98,125 @@ type WebhooksAPI interface { // WebhooksAPIService WebhooksAPI service type WebhooksAPIService service +type ApiCreateWalletWebhookRequest struct { + ctx context.Context + ApiService WebhooksAPI + walletId string + createWalletWebhookRequest *CreateWalletWebhookRequest +} + +func (r ApiCreateWalletWebhookRequest) CreateWalletWebhookRequest(createWalletWebhookRequest CreateWalletWebhookRequest) ApiCreateWalletWebhookRequest { + r.createWalletWebhookRequest = &createWalletWebhookRequest + return r +} + +func (r ApiCreateWalletWebhookRequest) Execute() (*Webhook, *http.Response, error) { + return r.ApiService.CreateWalletWebhookExecute(r) +} + +/* +CreateWalletWebhook Create a new webhook scoped to a wallet + +Create a new webhook scoped to a wallet + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param walletId The ID of the wallet to create the webhook for. + @return ApiCreateWalletWebhookRequest +*/ +func (a *WebhooksAPIService) CreateWalletWebhook(ctx context.Context, walletId string) ApiCreateWalletWebhookRequest { + return ApiCreateWalletWebhookRequest{ + ApiService: a, + ctx: ctx, + walletId: walletId, + } +} + +// Execute executes the request +// @return Webhook +func (a *WebhooksAPIService) CreateWalletWebhookExecute(r ApiCreateWalletWebhookRequest) (*Webhook, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Webhook + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WebhooksAPIService.CreateWalletWebhook") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/wallets/{wallet_id}/webhooks" + localVarPath = strings.Replace(localVarPath, "{"+"wallet_id"+"}", url.PathEscape(parameterValueToString(r.walletId, "walletId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createWalletWebhookRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + type ApiCreateWebhookRequest struct { ctx context.Context ApiService WebhooksAPI diff --git a/gen/client/client.go b/gen/client/client.go index 33fd923..c13264d 100644 --- a/gen/client/client.go +++ b/gen/client/client.go @@ -61,8 +61,16 @@ type APIClient struct { ExternalAddressesAPI ExternalAddressesAPI + FundAPI FundAPI + + MPCWalletStakeAPI MPCWalletStakeAPI + NetworksAPI NetworksAPI + OnchainIdentityAPI OnchainIdentityAPI + + ReputationAPI ReputationAPI + ServerSignersAPI ServerSignersAPI SmartContractsAPI SmartContractsAPI @@ -71,14 +79,12 @@ type APIClient struct { TradesAPI TradesAPI + TransactionHistoryAPI TransactionHistoryAPI + TransfersAPI TransfersAPI UsersAPI UsersAPI - ValidatorsAPI ValidatorsAPI - - WalletStakeAPI WalletStakeAPI - WalletsAPI WalletsAPI WebhooksAPI WebhooksAPI @@ -106,15 +112,18 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.ContractEventsAPI = (*ContractEventsAPIService)(&c.common) c.ContractInvocationsAPI = (*ContractInvocationsAPIService)(&c.common) c.ExternalAddressesAPI = (*ExternalAddressesAPIService)(&c.common) + c.FundAPI = (*FundAPIService)(&c.common) + c.MPCWalletStakeAPI = (*MPCWalletStakeAPIService)(&c.common) c.NetworksAPI = (*NetworksAPIService)(&c.common) + c.OnchainIdentityAPI = (*OnchainIdentityAPIService)(&c.common) + c.ReputationAPI = (*ReputationAPIService)(&c.common) c.ServerSignersAPI = (*ServerSignersAPIService)(&c.common) c.SmartContractsAPI = (*SmartContractsAPIService)(&c.common) c.StakeAPI = (*StakeAPIService)(&c.common) c.TradesAPI = (*TradesAPIService)(&c.common) + c.TransactionHistoryAPI = (*TransactionHistoryAPIService)(&c.common) c.TransfersAPI = (*TransfersAPIService)(&c.common) c.UsersAPI = (*UsersAPIService)(&c.common) - c.ValidatorsAPI = (*ValidatorsAPIService)(&c.common) - c.WalletStakeAPI = (*WalletStakeAPIService)(&c.common) c.WalletsAPI = (*WalletsAPIService)(&c.common) c.WebhooksAPI = (*WebhooksAPIService)(&c.common) diff --git a/gen/client/model_address_reputation.go b/gen/client/model_address_reputation.go new file mode 100644 index 0000000..3b1c429 --- /dev/null +++ b/gen/client/model_address_reputation.go @@ -0,0 +1,195 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the AddressReputation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddressReputation{} + +// AddressReputation The reputation score with metadata of a blockchain address. +type AddressReputation struct { + // The reputation score of a wallet address which lie between 0 to 100. + ReputationScore *int32 `json:"reputation_score,omitempty"` + Metadata AddressReputationMetadata `json:"metadata"` +} + +type _AddressReputation AddressReputation + +// NewAddressReputation instantiates a new AddressReputation object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddressReputation(metadata AddressReputationMetadata) *AddressReputation { + this := AddressReputation{} + this.Metadata = metadata + return &this +} + +// NewAddressReputationWithDefaults instantiates a new AddressReputation object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddressReputationWithDefaults() *AddressReputation { + this := AddressReputation{} + return &this +} + +// GetReputationScore returns the ReputationScore field value if set, zero value otherwise. +func (o *AddressReputation) GetReputationScore() int32 { + if o == nil || IsNil(o.ReputationScore) { + var ret int32 + return ret + } + return *o.ReputationScore +} + +// GetReputationScoreOk returns a tuple with the ReputationScore field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddressReputation) GetReputationScoreOk() (*int32, bool) { + if o == nil || IsNil(o.ReputationScore) { + return nil, false + } + return o.ReputationScore, true +} + +// HasReputationScore returns a boolean if a field has been set. +func (o *AddressReputation) HasReputationScore() bool { + if o != nil && !IsNil(o.ReputationScore) { + return true + } + + return false +} + +// SetReputationScore gets a reference to the given int32 and assigns it to the ReputationScore field. +func (o *AddressReputation) SetReputationScore(v int32) { + o.ReputationScore = &v +} + +// GetMetadata returns the Metadata field value +func (o *AddressReputation) GetMetadata() AddressReputationMetadata { + if o == nil { + var ret AddressReputationMetadata + return ret + } + + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata field value +// and a boolean to check if the value has been set. +func (o *AddressReputation) GetMetadataOk() (*AddressReputationMetadata, bool) { + if o == nil { + return nil, false + } + return &o.Metadata, true +} + +// SetMetadata sets field value +func (o *AddressReputation) SetMetadata(v AddressReputationMetadata) { + o.Metadata = v +} + +func (o AddressReputation) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddressReputation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ReputationScore) { + toSerialize["reputation_score"] = o.ReputationScore + } + toSerialize["metadata"] = o.Metadata + return toSerialize, nil +} + +func (o *AddressReputation) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "metadata", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAddressReputation := _AddressReputation{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAddressReputation) + + if err != nil { + return err + } + + *o = AddressReputation(varAddressReputation) + + return err +} + +type NullableAddressReputation struct { + value *AddressReputation + isSet bool +} + +func (v NullableAddressReputation) Get() *AddressReputation { + return v.value +} + +func (v *NullableAddressReputation) Set(val *AddressReputation) { + v.value = val + v.isSet = true +} + +func (v NullableAddressReputation) IsSet() bool { + return v.isSet +} + +func (v *NullableAddressReputation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddressReputation(val *AddressReputation) *NullableAddressReputation { + return &NullableAddressReputation{value: val, isSet: true} +} + +func (v NullableAddressReputation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddressReputation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_address_reputation_metadata.go b/gen/client/model_address_reputation_metadata.go new file mode 100644 index 0000000..1a33b4b --- /dev/null +++ b/gen/client/model_address_reputation_metadata.go @@ -0,0 +1,420 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the AddressReputationMetadata type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddressReputationMetadata{} + +// AddressReputationMetadata The metadata for the reputation score of onchain address. +type AddressReputationMetadata struct { + // The total number of transactions performed by the address. + TotalTransactions int32 `json:"total_transactions"` + // The number of unique days the address was active. + UniqueDaysActive int32 `json:"unique_days_active"` + // The longest streak of consecutive active days. + LongestActiveStreak int32 `json:"longest_active_streak"` + // The current streak of consecutive active days. + CurrentActiveStreak int32 `json:"current_active_streak"` + // The total number of days the address has been active. + ActivityPeriodDays int32 `json:"activity_period_days"` + // The number of token swaps performed by the address. + TokenSwapsPerformed int32 `json:"token_swaps_performed"` + // The number of bridge transactions performed by the address. + BridgeTransactionsPerformed int32 `json:"bridge_transactions_performed"` + // The number of lend, borrow, or stake transactions performed by the address. + LendBorrowStakeTransactions int32 `json:"lend_borrow_stake_transactions"` + // The number of interactions with ENS contracts. + EnsContractInteractions int32 `json:"ens_contract_interactions"` + // The number of smart contracts deployed by the address. + SmartContractDeployments int32 `json:"smart_contract_deployments"` +} + +type _AddressReputationMetadata AddressReputationMetadata + +// NewAddressReputationMetadata instantiates a new AddressReputationMetadata object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddressReputationMetadata(totalTransactions int32, uniqueDaysActive int32, longestActiveStreak int32, currentActiveStreak int32, activityPeriodDays int32, tokenSwapsPerformed int32, bridgeTransactionsPerformed int32, lendBorrowStakeTransactions int32, ensContractInteractions int32, smartContractDeployments int32) *AddressReputationMetadata { + this := AddressReputationMetadata{} + this.TotalTransactions = totalTransactions + this.UniqueDaysActive = uniqueDaysActive + this.LongestActiveStreak = longestActiveStreak + this.CurrentActiveStreak = currentActiveStreak + this.ActivityPeriodDays = activityPeriodDays + this.TokenSwapsPerformed = tokenSwapsPerformed + this.BridgeTransactionsPerformed = bridgeTransactionsPerformed + this.LendBorrowStakeTransactions = lendBorrowStakeTransactions + this.EnsContractInteractions = ensContractInteractions + this.SmartContractDeployments = smartContractDeployments + return &this +} + +// NewAddressReputationMetadataWithDefaults instantiates a new AddressReputationMetadata object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddressReputationMetadataWithDefaults() *AddressReputationMetadata { + this := AddressReputationMetadata{} + return &this +} + +// GetTotalTransactions returns the TotalTransactions field value +func (o *AddressReputationMetadata) GetTotalTransactions() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalTransactions +} + +// GetTotalTransactionsOk returns a tuple with the TotalTransactions field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetTotalTransactionsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalTransactions, true +} + +// SetTotalTransactions sets field value +func (o *AddressReputationMetadata) SetTotalTransactions(v int32) { + o.TotalTransactions = v +} + +// GetUniqueDaysActive returns the UniqueDaysActive field value +func (o *AddressReputationMetadata) GetUniqueDaysActive() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.UniqueDaysActive +} + +// GetUniqueDaysActiveOk returns a tuple with the UniqueDaysActive field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetUniqueDaysActiveOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.UniqueDaysActive, true +} + +// SetUniqueDaysActive sets field value +func (o *AddressReputationMetadata) SetUniqueDaysActive(v int32) { + o.UniqueDaysActive = v +} + +// GetLongestActiveStreak returns the LongestActiveStreak field value +func (o *AddressReputationMetadata) GetLongestActiveStreak() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.LongestActiveStreak +} + +// GetLongestActiveStreakOk returns a tuple with the LongestActiveStreak field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetLongestActiveStreakOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.LongestActiveStreak, true +} + +// SetLongestActiveStreak sets field value +func (o *AddressReputationMetadata) SetLongestActiveStreak(v int32) { + o.LongestActiveStreak = v +} + +// GetCurrentActiveStreak returns the CurrentActiveStreak field value +func (o *AddressReputationMetadata) GetCurrentActiveStreak() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.CurrentActiveStreak +} + +// GetCurrentActiveStreakOk returns a tuple with the CurrentActiveStreak field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetCurrentActiveStreakOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.CurrentActiveStreak, true +} + +// SetCurrentActiveStreak sets field value +func (o *AddressReputationMetadata) SetCurrentActiveStreak(v int32) { + o.CurrentActiveStreak = v +} + +// GetActivityPeriodDays returns the ActivityPeriodDays field value +func (o *AddressReputationMetadata) GetActivityPeriodDays() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ActivityPeriodDays +} + +// GetActivityPeriodDaysOk returns a tuple with the ActivityPeriodDays field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetActivityPeriodDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ActivityPeriodDays, true +} + +// SetActivityPeriodDays sets field value +func (o *AddressReputationMetadata) SetActivityPeriodDays(v int32) { + o.ActivityPeriodDays = v +} + +// GetTokenSwapsPerformed returns the TokenSwapsPerformed field value +func (o *AddressReputationMetadata) GetTokenSwapsPerformed() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TokenSwapsPerformed +} + +// GetTokenSwapsPerformedOk returns a tuple with the TokenSwapsPerformed field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetTokenSwapsPerformedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TokenSwapsPerformed, true +} + +// SetTokenSwapsPerformed sets field value +func (o *AddressReputationMetadata) SetTokenSwapsPerformed(v int32) { + o.TokenSwapsPerformed = v +} + +// GetBridgeTransactionsPerformed returns the BridgeTransactionsPerformed field value +func (o *AddressReputationMetadata) GetBridgeTransactionsPerformed() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.BridgeTransactionsPerformed +} + +// GetBridgeTransactionsPerformedOk returns a tuple with the BridgeTransactionsPerformed field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetBridgeTransactionsPerformedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.BridgeTransactionsPerformed, true +} + +// SetBridgeTransactionsPerformed sets field value +func (o *AddressReputationMetadata) SetBridgeTransactionsPerformed(v int32) { + o.BridgeTransactionsPerformed = v +} + +// GetLendBorrowStakeTransactions returns the LendBorrowStakeTransactions field value +func (o *AddressReputationMetadata) GetLendBorrowStakeTransactions() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.LendBorrowStakeTransactions +} + +// GetLendBorrowStakeTransactionsOk returns a tuple with the LendBorrowStakeTransactions field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetLendBorrowStakeTransactionsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.LendBorrowStakeTransactions, true +} + +// SetLendBorrowStakeTransactions sets field value +func (o *AddressReputationMetadata) SetLendBorrowStakeTransactions(v int32) { + o.LendBorrowStakeTransactions = v +} + +// GetEnsContractInteractions returns the EnsContractInteractions field value +func (o *AddressReputationMetadata) GetEnsContractInteractions() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.EnsContractInteractions +} + +// GetEnsContractInteractionsOk returns a tuple with the EnsContractInteractions field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetEnsContractInteractionsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.EnsContractInteractions, true +} + +// SetEnsContractInteractions sets field value +func (o *AddressReputationMetadata) SetEnsContractInteractions(v int32) { + o.EnsContractInteractions = v +} + +// GetSmartContractDeployments returns the SmartContractDeployments field value +func (o *AddressReputationMetadata) GetSmartContractDeployments() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.SmartContractDeployments +} + +// GetSmartContractDeploymentsOk returns a tuple with the SmartContractDeployments field value +// and a boolean to check if the value has been set. +func (o *AddressReputationMetadata) GetSmartContractDeploymentsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.SmartContractDeployments, true +} + +// SetSmartContractDeployments sets field value +func (o *AddressReputationMetadata) SetSmartContractDeployments(v int32) { + o.SmartContractDeployments = v +} + +func (o AddressReputationMetadata) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddressReputationMetadata) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["total_transactions"] = o.TotalTransactions + toSerialize["unique_days_active"] = o.UniqueDaysActive + toSerialize["longest_active_streak"] = o.LongestActiveStreak + toSerialize["current_active_streak"] = o.CurrentActiveStreak + toSerialize["activity_period_days"] = o.ActivityPeriodDays + toSerialize["token_swaps_performed"] = o.TokenSwapsPerformed + toSerialize["bridge_transactions_performed"] = o.BridgeTransactionsPerformed + toSerialize["lend_borrow_stake_transactions"] = o.LendBorrowStakeTransactions + toSerialize["ens_contract_interactions"] = o.EnsContractInteractions + toSerialize["smart_contract_deployments"] = o.SmartContractDeployments + return toSerialize, nil +} + +func (o *AddressReputationMetadata) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "total_transactions", + "unique_days_active", + "longest_active_streak", + "current_active_streak", + "activity_period_days", + "token_swaps_performed", + "bridge_transactions_performed", + "lend_borrow_stake_transactions", + "ens_contract_interactions", + "smart_contract_deployments", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAddressReputationMetadata := _AddressReputationMetadata{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAddressReputationMetadata) + + if err != nil { + return err + } + + *o = AddressReputationMetadata(varAddressReputationMetadata) + + return err +} + +type NullableAddressReputationMetadata struct { + value *AddressReputationMetadata + isSet bool +} + +func (v NullableAddressReputationMetadata) Get() *AddressReputationMetadata { + return v.value +} + +func (v *NullableAddressReputationMetadata) Set(val *AddressReputationMetadata) { + v.value = val + v.isSet = true +} + +func (v NullableAddressReputationMetadata) IsSet() bool { + return v.isSet +} + +func (v *NullableAddressReputationMetadata) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddressReputationMetadata(val *AddressReputationMetadata) *NullableAddressReputationMetadata { + return &NullableAddressReputationMetadata{value: val, isSet: true} +} + +func (v NullableAddressReputationMetadata) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddressReputationMetadata) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_address_risk.go b/gen/client/model_address_risk.go new file mode 100644 index 0000000..12050d0 --- /dev/null +++ b/gen/client/model_address_risk.go @@ -0,0 +1,159 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the AddressRisk type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddressRisk{} + +// AddressRisk The risk score of a blockchain address. +type AddressRisk struct { + // The lower the score is, the higher the risk is. The score lies between -100 to 0. + RiskScore int32 `json:"risk_score"` +} + +type _AddressRisk AddressRisk + +// NewAddressRisk instantiates a new AddressRisk object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewAddressRisk(riskScore int32) *AddressRisk { + this := AddressRisk{} + this.RiskScore = riskScore + return &this +} + +// NewAddressRiskWithDefaults instantiates a new AddressRisk object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewAddressRiskWithDefaults() *AddressRisk { + this := AddressRisk{} + return &this +} + +// GetRiskScore returns the RiskScore field value +func (o *AddressRisk) GetRiskScore() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RiskScore +} + +// GetRiskScoreOk returns a tuple with the RiskScore field value +// and a boolean to check if the value has been set. +func (o *AddressRisk) GetRiskScoreOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RiskScore, true +} + +// SetRiskScore sets field value +func (o *AddressRisk) SetRiskScore(v int32) { + o.RiskScore = v +} + +func (o AddressRisk) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddressRisk) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["risk_score"] = o.RiskScore + return toSerialize, nil +} + +func (o *AddressRisk) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "risk_score", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAddressRisk := _AddressRisk{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAddressRisk) + + if err != nil { + return err + } + + *o = AddressRisk(varAddressRisk) + + return err +} + +type NullableAddressRisk struct { + value *AddressRisk + isSet bool +} + +func (v NullableAddressRisk) Get() *AddressRisk { + return v.value +} + +func (v *NullableAddressRisk) Set(val *AddressRisk) { + v.value = val + v.isSet = true +} + +func (v NullableAddressRisk) IsSet() bool { + return v.isSet +} + +func (v *NullableAddressRisk) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddressRisk(val *AddressRisk) *NullableAddressRisk { + return &NullableAddressRisk{value: val, isSet: true} +} + +func (v NullableAddressRisk) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddressRisk) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_build_staking_operation_request.go b/gen/client/model_build_staking_operation_request.go index 5da1d7e..f5a9da9 100644 --- a/gen/client/model_build_staking_operation_request.go +++ b/gen/client/model_build_staking_operation_request.go @@ -29,6 +29,7 @@ type BuildStakingOperationRequest struct { AddressId string `json:"address_id"` // The type of staking operation Action string `json:"action"` + // Additional options for the staking operation. Options map[string]string `json:"options"` } diff --git a/gen/client/model_create_fund_operation_request.go b/gen/client/model_create_fund_operation_request.go new file mode 100644 index 0000000..90da3c9 --- /dev/null +++ b/gen/client/model_create_fund_operation_request.go @@ -0,0 +1,225 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the CreateFundOperationRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateFundOperationRequest{} + +// CreateFundOperationRequest struct for CreateFundOperationRequest +type CreateFundOperationRequest struct { + // The amount of the asset to fund the address with in atomic units. + Amount string `json:"amount"` + // The ID of the asset to fund the address with. + AssetId string `json:"asset_id"` + // The Optional ID of the fund quote to fund the address with. If omitted we will generate a quote and immediately execute it. + FundQuoteId *string `json:"fund_quote_id,omitempty"` +} + +type _CreateFundOperationRequest CreateFundOperationRequest + +// NewCreateFundOperationRequest instantiates a new CreateFundOperationRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateFundOperationRequest(amount string, assetId string) *CreateFundOperationRequest { + this := CreateFundOperationRequest{} + this.Amount = amount + this.AssetId = assetId + return &this +} + +// NewCreateFundOperationRequestWithDefaults instantiates a new CreateFundOperationRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateFundOperationRequestWithDefaults() *CreateFundOperationRequest { + this := CreateFundOperationRequest{} + return &this +} + +// GetAmount returns the Amount field value +func (o *CreateFundOperationRequest) GetAmount() string { + if o == nil { + var ret string + return ret + } + + return o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value +// and a boolean to check if the value has been set. +func (o *CreateFundOperationRequest) GetAmountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Amount, true +} + +// SetAmount sets field value +func (o *CreateFundOperationRequest) SetAmount(v string) { + o.Amount = v +} + +// GetAssetId returns the AssetId field value +func (o *CreateFundOperationRequest) GetAssetId() string { + if o == nil { + var ret string + return ret + } + + return o.AssetId +} + +// GetAssetIdOk returns a tuple with the AssetId field value +// and a boolean to check if the value has been set. +func (o *CreateFundOperationRequest) GetAssetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AssetId, true +} + +// SetAssetId sets field value +func (o *CreateFundOperationRequest) SetAssetId(v string) { + o.AssetId = v +} + +// GetFundQuoteId returns the FundQuoteId field value if set, zero value otherwise. +func (o *CreateFundOperationRequest) GetFundQuoteId() string { + if o == nil || IsNil(o.FundQuoteId) { + var ret string + return ret + } + return *o.FundQuoteId +} + +// GetFundQuoteIdOk returns a tuple with the FundQuoteId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateFundOperationRequest) GetFundQuoteIdOk() (*string, bool) { + if o == nil || IsNil(o.FundQuoteId) { + return nil, false + } + return o.FundQuoteId, true +} + +// HasFundQuoteId returns a boolean if a field has been set. +func (o *CreateFundOperationRequest) HasFundQuoteId() bool { + if o != nil && !IsNil(o.FundQuoteId) { + return true + } + + return false +} + +// SetFundQuoteId gets a reference to the given string and assigns it to the FundQuoteId field. +func (o *CreateFundOperationRequest) SetFundQuoteId(v string) { + o.FundQuoteId = &v +} + +func (o CreateFundOperationRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateFundOperationRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["amount"] = o.Amount + toSerialize["asset_id"] = o.AssetId + if !IsNil(o.FundQuoteId) { + toSerialize["fund_quote_id"] = o.FundQuoteId + } + return toSerialize, nil +} + +func (o *CreateFundOperationRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "amount", + "asset_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateFundOperationRequest := _CreateFundOperationRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateFundOperationRequest) + + if err != nil { + return err + } + + *o = CreateFundOperationRequest(varCreateFundOperationRequest) + + return err +} + +type NullableCreateFundOperationRequest struct { + value *CreateFundOperationRequest + isSet bool +} + +func (v NullableCreateFundOperationRequest) Get() *CreateFundOperationRequest { + return v.value +} + +func (v *NullableCreateFundOperationRequest) Set(val *CreateFundOperationRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateFundOperationRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateFundOperationRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateFundOperationRequest(val *CreateFundOperationRequest) *NullableCreateFundOperationRequest { + return &NullableCreateFundOperationRequest{value: val, isSet: true} +} + +func (v NullableCreateFundOperationRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateFundOperationRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_create_fund_quote_request.go b/gen/client/model_create_fund_quote_request.go new file mode 100644 index 0000000..df85520 --- /dev/null +++ b/gen/client/model_create_fund_quote_request.go @@ -0,0 +1,188 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the CreateFundQuoteRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateFundQuoteRequest{} + +// CreateFundQuoteRequest struct for CreateFundQuoteRequest +type CreateFundQuoteRequest struct { + // The amount of the asset to fund the address with in atomic units. + Amount string `json:"amount"` + // The ID of the asset to fund the address with. + AssetId string `json:"asset_id"` +} + +type _CreateFundQuoteRequest CreateFundQuoteRequest + +// NewCreateFundQuoteRequest instantiates a new CreateFundQuoteRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateFundQuoteRequest(amount string, assetId string) *CreateFundQuoteRequest { + this := CreateFundQuoteRequest{} + this.Amount = amount + this.AssetId = assetId + return &this +} + +// NewCreateFundQuoteRequestWithDefaults instantiates a new CreateFundQuoteRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateFundQuoteRequestWithDefaults() *CreateFundQuoteRequest { + this := CreateFundQuoteRequest{} + return &this +} + +// GetAmount returns the Amount field value +func (o *CreateFundQuoteRequest) GetAmount() string { + if o == nil { + var ret string + return ret + } + + return o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value +// and a boolean to check if the value has been set. +func (o *CreateFundQuoteRequest) GetAmountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Amount, true +} + +// SetAmount sets field value +func (o *CreateFundQuoteRequest) SetAmount(v string) { + o.Amount = v +} + +// GetAssetId returns the AssetId field value +func (o *CreateFundQuoteRequest) GetAssetId() string { + if o == nil { + var ret string + return ret + } + + return o.AssetId +} + +// GetAssetIdOk returns a tuple with the AssetId field value +// and a boolean to check if the value has been set. +func (o *CreateFundQuoteRequest) GetAssetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AssetId, true +} + +// SetAssetId sets field value +func (o *CreateFundQuoteRequest) SetAssetId(v string) { + o.AssetId = v +} + +func (o CreateFundQuoteRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateFundQuoteRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["amount"] = o.Amount + toSerialize["asset_id"] = o.AssetId + return toSerialize, nil +} + +func (o *CreateFundQuoteRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "amount", + "asset_id", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateFundQuoteRequest := _CreateFundQuoteRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateFundQuoteRequest) + + if err != nil { + return err + } + + *o = CreateFundQuoteRequest(varCreateFundQuoteRequest) + + return err +} + +type NullableCreateFundQuoteRequest struct { + value *CreateFundQuoteRequest + isSet bool +} + +func (v NullableCreateFundQuoteRequest) Get() *CreateFundQuoteRequest { + return v.value +} + +func (v *NullableCreateFundQuoteRequest) Set(val *CreateFundQuoteRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateFundQuoteRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateFundQuoteRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateFundQuoteRequest(val *CreateFundQuoteRequest) *NullableCreateFundQuoteRequest { + return &NullableCreateFundQuoteRequest{value: val, isSet: true} +} + +func (v NullableCreateFundQuoteRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateFundQuoteRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_create_staking_operation_request.go b/gen/client/model_create_staking_operation_request.go index 4bed474..2efb3ab 100644 --- a/gen/client/model_create_staking_operation_request.go +++ b/gen/client/model_create_staking_operation_request.go @@ -27,6 +27,7 @@ type CreateStakingOperationRequest struct { AssetId string `json:"asset_id"` // The type of staking operation. Action string `json:"action"` + // Additional options for the staking operation. Options map[string]string `json:"options"` } diff --git a/gen/client/model_create_wallet_webhook_request.go b/gen/client/model_create_wallet_webhook_request.go new file mode 100644 index 0000000..ddc9e44 --- /dev/null +++ b/gen/client/model_create_wallet_webhook_request.go @@ -0,0 +1,196 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the CreateWalletWebhookRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateWalletWebhookRequest{} + +// CreateWalletWebhookRequest struct for CreateWalletWebhookRequest +type CreateWalletWebhookRequest struct { + // The URL to which the notifications will be sent. + NotificationUri string `json:"notification_uri"` + // The custom header to be used for x-webhook-signature header on callbacks, so developers can verify the requests are coming from Coinbase. + SignatureHeader *string `json:"signature_header,omitempty"` +} + +type _CreateWalletWebhookRequest CreateWalletWebhookRequest + +// NewCreateWalletWebhookRequest instantiates a new CreateWalletWebhookRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCreateWalletWebhookRequest(notificationUri string) *CreateWalletWebhookRequest { + this := CreateWalletWebhookRequest{} + this.NotificationUri = notificationUri + return &this +} + +// NewCreateWalletWebhookRequestWithDefaults instantiates a new CreateWalletWebhookRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCreateWalletWebhookRequestWithDefaults() *CreateWalletWebhookRequest { + this := CreateWalletWebhookRequest{} + return &this +} + +// GetNotificationUri returns the NotificationUri field value +func (o *CreateWalletWebhookRequest) GetNotificationUri() string { + if o == nil { + var ret string + return ret + } + + return o.NotificationUri +} + +// GetNotificationUriOk returns a tuple with the NotificationUri field value +// and a boolean to check if the value has been set. +func (o *CreateWalletWebhookRequest) GetNotificationUriOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NotificationUri, true +} + +// SetNotificationUri sets field value +func (o *CreateWalletWebhookRequest) SetNotificationUri(v string) { + o.NotificationUri = v +} + +// GetSignatureHeader returns the SignatureHeader field value if set, zero value otherwise. +func (o *CreateWalletWebhookRequest) GetSignatureHeader() string { + if o == nil || IsNil(o.SignatureHeader) { + var ret string + return ret + } + return *o.SignatureHeader +} + +// GetSignatureHeaderOk returns a tuple with the SignatureHeader field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateWalletWebhookRequest) GetSignatureHeaderOk() (*string, bool) { + if o == nil || IsNil(o.SignatureHeader) { + return nil, false + } + return o.SignatureHeader, true +} + +// HasSignatureHeader returns a boolean if a field has been set. +func (o *CreateWalletWebhookRequest) HasSignatureHeader() bool { + if o != nil && !IsNil(o.SignatureHeader) { + return true + } + + return false +} + +// SetSignatureHeader gets a reference to the given string and assigns it to the SignatureHeader field. +func (o *CreateWalletWebhookRequest) SetSignatureHeader(v string) { + o.SignatureHeader = &v +} + +func (o CreateWalletWebhookRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateWalletWebhookRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["notification_uri"] = o.NotificationUri + if !IsNil(o.SignatureHeader) { + toSerialize["signature_header"] = o.SignatureHeader + } + return toSerialize, nil +} + +func (o *CreateWalletWebhookRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "notification_uri", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateWalletWebhookRequest := _CreateWalletWebhookRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateWalletWebhookRequest) + + if err != nil { + return err + } + + *o = CreateWalletWebhookRequest(varCreateWalletWebhookRequest) + + return err +} + +type NullableCreateWalletWebhookRequest struct { + value *CreateWalletWebhookRequest + isSet bool +} + +func (v NullableCreateWalletWebhookRequest) Get() *CreateWalletWebhookRequest { + return v.value +} + +func (v *NullableCreateWalletWebhookRequest) Set(val *CreateWalletWebhookRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateWalletWebhookRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateWalletWebhookRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateWalletWebhookRequest(val *CreateWalletWebhookRequest) *NullableCreateWalletWebhookRequest { + return &NullableCreateWalletWebhookRequest{value: val, isSet: true} +} + +func (v NullableCreateWalletWebhookRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateWalletWebhookRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_crypto_amount.go b/gen/client/model_crypto_amount.go new file mode 100644 index 0000000..b6f27df --- /dev/null +++ b/gen/client/model_crypto_amount.go @@ -0,0 +1,187 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the CryptoAmount type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CryptoAmount{} + +// CryptoAmount An amount in cryptocurrency +type CryptoAmount struct { + // The amount of the crypto in atomic units + Amount string `json:"amount"` + Asset Asset `json:"asset"` +} + +type _CryptoAmount CryptoAmount + +// NewCryptoAmount instantiates a new CryptoAmount object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCryptoAmount(amount string, asset Asset) *CryptoAmount { + this := CryptoAmount{} + this.Amount = amount + this.Asset = asset + return &this +} + +// NewCryptoAmountWithDefaults instantiates a new CryptoAmount object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCryptoAmountWithDefaults() *CryptoAmount { + this := CryptoAmount{} + return &this +} + +// GetAmount returns the Amount field value +func (o *CryptoAmount) GetAmount() string { + if o == nil { + var ret string + return ret + } + + return o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value +// and a boolean to check if the value has been set. +func (o *CryptoAmount) GetAmountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Amount, true +} + +// SetAmount sets field value +func (o *CryptoAmount) SetAmount(v string) { + o.Amount = v +} + +// GetAsset returns the Asset field value +func (o *CryptoAmount) GetAsset() Asset { + if o == nil { + var ret Asset + return ret + } + + return o.Asset +} + +// GetAssetOk returns a tuple with the Asset field value +// and a boolean to check if the value has been set. +func (o *CryptoAmount) GetAssetOk() (*Asset, bool) { + if o == nil { + return nil, false + } + return &o.Asset, true +} + +// SetAsset sets field value +func (o *CryptoAmount) SetAsset(v Asset) { + o.Asset = v +} + +func (o CryptoAmount) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CryptoAmount) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["amount"] = o.Amount + toSerialize["asset"] = o.Asset + return toSerialize, nil +} + +func (o *CryptoAmount) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "amount", + "asset", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCryptoAmount := _CryptoAmount{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCryptoAmount) + + if err != nil { + return err + } + + *o = CryptoAmount(varCryptoAmount) + + return err +} + +type NullableCryptoAmount struct { + value *CryptoAmount + isSet bool +} + +func (v NullableCryptoAmount) Get() *CryptoAmount { + return v.value +} + +func (v *NullableCryptoAmount) Set(val *CryptoAmount) { + v.value = val + v.isSet = true +} + +func (v NullableCryptoAmount) IsSet() bool { + return v.isSet +} + +func (v *NullableCryptoAmount) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCryptoAmount(val *CryptoAmount) *NullableCryptoAmount { + return &NullableCryptoAmount{value: val, isSet: true} +} + +func (v NullableCryptoAmount) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCryptoAmount) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_ethereum_token_transfer.go b/gen/client/model_ethereum_token_transfer.go new file mode 100644 index 0000000..ff1fb4d --- /dev/null +++ b/gen/client/model_ethereum_token_transfer.go @@ -0,0 +1,344 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the EthereumTokenTransfer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EthereumTokenTransfer{} + +// EthereumTokenTransfer struct for EthereumTokenTransfer +type EthereumTokenTransfer struct { + ContractAddress string `json:"contract_address"` + FromAddress string `json:"from_address"` + ToAddress string `json:"to_address"` + // The value of the transaction in atomic units of the token being transfer for ERC20 or ERC1155 contracts. + Value *string `json:"value,omitempty"` + // The ID of ERC721 or ERC1155 token being transferred. + TokenId *string `json:"token_id,omitempty"` + LogIndex int32 `json:"log_index"` + TokenTransferType TokenTransferType `json:"token_transfer_type"` +} + +type _EthereumTokenTransfer EthereumTokenTransfer + +// NewEthereumTokenTransfer instantiates a new EthereumTokenTransfer object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewEthereumTokenTransfer(contractAddress string, fromAddress string, toAddress string, logIndex int32, tokenTransferType TokenTransferType) *EthereumTokenTransfer { + this := EthereumTokenTransfer{} + this.ContractAddress = contractAddress + this.FromAddress = fromAddress + this.ToAddress = toAddress + this.LogIndex = logIndex + this.TokenTransferType = tokenTransferType + return &this +} + +// NewEthereumTokenTransferWithDefaults instantiates a new EthereumTokenTransfer object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewEthereumTokenTransferWithDefaults() *EthereumTokenTransfer { + this := EthereumTokenTransfer{} + return &this +} + +// GetContractAddress returns the ContractAddress field value +func (o *EthereumTokenTransfer) GetContractAddress() string { + if o == nil { + var ret string + return ret + } + + return o.ContractAddress +} + +// GetContractAddressOk returns a tuple with the ContractAddress field value +// and a boolean to check if the value has been set. +func (o *EthereumTokenTransfer) GetContractAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ContractAddress, true +} + +// SetContractAddress sets field value +func (o *EthereumTokenTransfer) SetContractAddress(v string) { + o.ContractAddress = v +} + +// GetFromAddress returns the FromAddress field value +func (o *EthereumTokenTransfer) GetFromAddress() string { + if o == nil { + var ret string + return ret + } + + return o.FromAddress +} + +// GetFromAddressOk returns a tuple with the FromAddress field value +// and a boolean to check if the value has been set. +func (o *EthereumTokenTransfer) GetFromAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FromAddress, true +} + +// SetFromAddress sets field value +func (o *EthereumTokenTransfer) SetFromAddress(v string) { + o.FromAddress = v +} + +// GetToAddress returns the ToAddress field value +func (o *EthereumTokenTransfer) GetToAddress() string { + if o == nil { + var ret string + return ret + } + + return o.ToAddress +} + +// GetToAddressOk returns a tuple with the ToAddress field value +// and a boolean to check if the value has been set. +func (o *EthereumTokenTransfer) GetToAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ToAddress, true +} + +// SetToAddress sets field value +func (o *EthereumTokenTransfer) SetToAddress(v string) { + o.ToAddress = v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *EthereumTokenTransfer) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTokenTransfer) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *EthereumTokenTransfer) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *EthereumTokenTransfer) SetValue(v string) { + o.Value = &v +} + +// GetTokenId returns the TokenId field value if set, zero value otherwise. +func (o *EthereumTokenTransfer) GetTokenId() string { + if o == nil || IsNil(o.TokenId) { + var ret string + return ret + } + return *o.TokenId +} + +// GetTokenIdOk returns a tuple with the TokenId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTokenTransfer) GetTokenIdOk() (*string, bool) { + if o == nil || IsNil(o.TokenId) { + return nil, false + } + return o.TokenId, true +} + +// HasTokenId returns a boolean if a field has been set. +func (o *EthereumTokenTransfer) HasTokenId() bool { + if o != nil && !IsNil(o.TokenId) { + return true + } + + return false +} + +// SetTokenId gets a reference to the given string and assigns it to the TokenId field. +func (o *EthereumTokenTransfer) SetTokenId(v string) { + o.TokenId = &v +} + +// GetLogIndex returns the LogIndex field value +func (o *EthereumTokenTransfer) GetLogIndex() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.LogIndex +} + +// GetLogIndexOk returns a tuple with the LogIndex field value +// and a boolean to check if the value has been set. +func (o *EthereumTokenTransfer) GetLogIndexOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.LogIndex, true +} + +// SetLogIndex sets field value +func (o *EthereumTokenTransfer) SetLogIndex(v int32) { + o.LogIndex = v +} + +// GetTokenTransferType returns the TokenTransferType field value +func (o *EthereumTokenTransfer) GetTokenTransferType() TokenTransferType { + if o == nil { + var ret TokenTransferType + return ret + } + + return o.TokenTransferType +} + +// GetTokenTransferTypeOk returns a tuple with the TokenTransferType field value +// and a boolean to check if the value has been set. +func (o *EthereumTokenTransfer) GetTokenTransferTypeOk() (*TokenTransferType, bool) { + if o == nil { + return nil, false + } + return &o.TokenTransferType, true +} + +// SetTokenTransferType sets field value +func (o *EthereumTokenTransfer) SetTokenTransferType(v TokenTransferType) { + o.TokenTransferType = v +} + +func (o EthereumTokenTransfer) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EthereumTokenTransfer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["contract_address"] = o.ContractAddress + toSerialize["from_address"] = o.FromAddress + toSerialize["to_address"] = o.ToAddress + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + if !IsNil(o.TokenId) { + toSerialize["token_id"] = o.TokenId + } + toSerialize["log_index"] = o.LogIndex + toSerialize["token_transfer_type"] = o.TokenTransferType + return toSerialize, nil +} + +func (o *EthereumTokenTransfer) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "contract_address", + "from_address", + "to_address", + "log_index", + "token_transfer_type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varEthereumTokenTransfer := _EthereumTokenTransfer{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varEthereumTokenTransfer) + + if err != nil { + return err + } + + *o = EthereumTokenTransfer(varEthereumTokenTransfer) + + return err +} + +type NullableEthereumTokenTransfer struct { + value *EthereumTokenTransfer + isSet bool +} + +func (v NullableEthereumTokenTransfer) Get() *EthereumTokenTransfer { + return v.value +} + +func (v *NullableEthereumTokenTransfer) Set(val *EthereumTokenTransfer) { + v.value = val + v.isSet = true +} + +func (v NullableEthereumTokenTransfer) IsSet() bool { + return v.isSet +} + +func (v *NullableEthereumTokenTransfer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEthereumTokenTransfer(val *EthereumTokenTransfer) *NullableEthereumTokenTransfer { + return &NullableEthereumTokenTransfer{value: val, isSet: true} +} + +func (v NullableEthereumTokenTransfer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEthereumTokenTransfer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_ethereum_transaction.go b/gen/client/model_ethereum_transaction.go index 0d97585..6deb2d0 100644 --- a/gen/client/model_ethereum_transaction.go +++ b/gen/client/model_ethereum_transaction.go @@ -49,6 +49,7 @@ type EthereumTransaction struct { // The confirmed priority fee per gas as defined in EIP-1559. https://eips.ethereum.org/EIPS/eip-1559 for more details. PriorityFeePerGas *int32 `json:"priority_fee_per_gas,omitempty"` TransactionAccessList *EthereumTransactionAccessList `json:"transaction_access_list,omitempty"` + TokenTransfers []EthereumTokenTransfer `json:"token_transfers,omitempty"` FlattenedTraces []EthereumTransactionFlattenedTrace `json:"flattened_traces,omitempty"` // The timestamp of the block in which the event was emitted BlockTimestamp *time.Time `json:"block_timestamp,omitempty"` @@ -509,6 +510,38 @@ func (o *EthereumTransaction) SetTransactionAccessList(v EthereumTransactionAcce o.TransactionAccessList = &v } +// GetTokenTransfers returns the TokenTransfers field value if set, zero value otherwise. +func (o *EthereumTransaction) GetTokenTransfers() []EthereumTokenTransfer { + if o == nil || IsNil(o.TokenTransfers) { + var ret []EthereumTokenTransfer + return ret + } + return o.TokenTransfers +} + +// GetTokenTransfersOk returns a tuple with the TokenTransfers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *EthereumTransaction) GetTokenTransfersOk() ([]EthereumTokenTransfer, bool) { + if o == nil || IsNil(o.TokenTransfers) { + return nil, false + } + return o.TokenTransfers, true +} + +// HasTokenTransfers returns a boolean if a field has been set. +func (o *EthereumTransaction) HasTokenTransfers() bool { + if o != nil && !IsNil(o.TokenTransfers) { + return true + } + + return false +} + +// SetTokenTransfers gets a reference to the given []EthereumTokenTransfer and assigns it to the TokenTransfers field. +func (o *EthereumTransaction) SetTokenTransfers(v []EthereumTokenTransfer) { + o.TokenTransfers = v +} + // GetFlattenedTraces returns the FlattenedTraces field value if set, zero value otherwise. func (o *EthereumTransaction) GetFlattenedTraces() []EthereumTransactionFlattenedTrace { if o == nil || IsNil(o.FlattenedTraces) { @@ -653,6 +686,9 @@ func (o EthereumTransaction) ToMap() (map[string]interface{}, error) { if !IsNil(o.TransactionAccessList) { toSerialize["transaction_access_list"] = o.TransactionAccessList } + if !IsNil(o.TokenTransfers) { + toSerialize["token_transfers"] = o.TokenTransfers + } if !IsNil(o.FlattenedTraces) { toSerialize["flattened_traces"] = o.FlattenedTraces } diff --git a/gen/client/model_faucet_transaction.go b/gen/client/model_faucet_transaction.go index e4c37b5..4625966 100644 --- a/gen/client/model_faucet_transaction.go +++ b/gen/client/model_faucet_transaction.go @@ -25,6 +25,7 @@ type FaucetTransaction struct { TransactionHash string `json:"transaction_hash"` // Link to the transaction on the blockchain explorer. TransactionLink string `json:"transaction_link"` + Transaction Transaction `json:"transaction"` } type _FaucetTransaction FaucetTransaction @@ -33,10 +34,11 @@ type _FaucetTransaction FaucetTransaction // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewFaucetTransaction(transactionHash string, transactionLink string) *FaucetTransaction { +func NewFaucetTransaction(transactionHash string, transactionLink string, transaction Transaction) *FaucetTransaction { this := FaucetTransaction{} this.TransactionHash = transactionHash this.TransactionLink = transactionLink + this.Transaction = transaction return &this } @@ -96,6 +98,30 @@ func (o *FaucetTransaction) SetTransactionLink(v string) { o.TransactionLink = v } +// GetTransaction returns the Transaction field value +func (o *FaucetTransaction) GetTransaction() Transaction { + if o == nil { + var ret Transaction + return ret + } + + return o.Transaction +} + +// GetTransactionOk returns a tuple with the Transaction field value +// and a boolean to check if the value has been set. +func (o *FaucetTransaction) GetTransactionOk() (*Transaction, bool) { + if o == nil { + return nil, false + } + return &o.Transaction, true +} + +// SetTransaction sets field value +func (o *FaucetTransaction) SetTransaction(v Transaction) { + o.Transaction = v +} + func (o FaucetTransaction) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { @@ -108,6 +134,7 @@ func (o FaucetTransaction) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["transaction_hash"] = o.TransactionHash toSerialize["transaction_link"] = o.TransactionLink + toSerialize["transaction"] = o.Transaction return toSerialize, nil } @@ -118,6 +145,7 @@ func (o *FaucetTransaction) UnmarshalJSON(data []byte) (err error) { requiredProperties := []string{ "transaction_hash", "transaction_link", + "transaction", } allProperties := make(map[string]interface{}) diff --git a/gen/client/model_fiat_amount.go b/gen/client/model_fiat_amount.go new file mode 100644 index 0000000..1660ab4 --- /dev/null +++ b/gen/client/model_fiat_amount.go @@ -0,0 +1,188 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the FiatAmount type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FiatAmount{} + +// FiatAmount An amount in fiat currency +type FiatAmount struct { + // The amount of the fiat in whole units. + Amount string `json:"amount"` + // The currency of the fiat + Currency string `json:"currency"` +} + +type _FiatAmount FiatAmount + +// NewFiatAmount instantiates a new FiatAmount object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFiatAmount(amount string, currency string) *FiatAmount { + this := FiatAmount{} + this.Amount = amount + this.Currency = currency + return &this +} + +// NewFiatAmountWithDefaults instantiates a new FiatAmount object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFiatAmountWithDefaults() *FiatAmount { + this := FiatAmount{} + return &this +} + +// GetAmount returns the Amount field value +func (o *FiatAmount) GetAmount() string { + if o == nil { + var ret string + return ret + } + + return o.Amount +} + +// GetAmountOk returns a tuple with the Amount field value +// and a boolean to check if the value has been set. +func (o *FiatAmount) GetAmountOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Amount, true +} + +// SetAmount sets field value +func (o *FiatAmount) SetAmount(v string) { + o.Amount = v +} + +// GetCurrency returns the Currency field value +func (o *FiatAmount) GetCurrency() string { + if o == nil { + var ret string + return ret + } + + return o.Currency +} + +// GetCurrencyOk returns a tuple with the Currency field value +// and a boolean to check if the value has been set. +func (o *FiatAmount) GetCurrencyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Currency, true +} + +// SetCurrency sets field value +func (o *FiatAmount) SetCurrency(v string) { + o.Currency = v +} + +func (o FiatAmount) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FiatAmount) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["amount"] = o.Amount + toSerialize["currency"] = o.Currency + return toSerialize, nil +} + +func (o *FiatAmount) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "amount", + "currency", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFiatAmount := _FiatAmount{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varFiatAmount) + + if err != nil { + return err + } + + *o = FiatAmount(varFiatAmount) + + return err +} + +type NullableFiatAmount struct { + value *FiatAmount + isSet bool +} + +func (v NullableFiatAmount) Get() *FiatAmount { + return v.value +} + +func (v *NullableFiatAmount) Set(val *FiatAmount) { + v.value = val + v.isSet = true +} + +func (v NullableFiatAmount) IsSet() bool { + return v.isSet +} + +func (v *NullableFiatAmount) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFiatAmount(val *FiatAmount) *NullableFiatAmount { + return &NullableFiatAmount{value: val, isSet: true} +} + +func (v NullableFiatAmount) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFiatAmount) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_fund_operation.go b/gen/client/model_fund_operation.go new file mode 100644 index 0000000..5f12bd4 --- /dev/null +++ b/gen/client/model_fund_operation.go @@ -0,0 +1,359 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the FundOperation type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FundOperation{} + +// FundOperation An operation to fund a wallet with crypto +type FundOperation struct { + // The ID of the fund operation + FundOperationId string `json:"fund_operation_id"` + // The ID of the blockchain network + NetworkId string `json:"network_id"` + // The ID of the wallet that will receive the crypto + WalletId string `json:"wallet_id"` + // The ID of the address that will receive the crypto + AddressId string `json:"address_id"` + CryptoAmount CryptoAmount `json:"crypto_amount"` + FiatAmount FiatAmount `json:"fiat_amount"` + Fees FundOperationFees `json:"fees"` + // The status of the fund operation + Status string `json:"status"` +} + +type _FundOperation FundOperation + +// NewFundOperation instantiates a new FundOperation object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFundOperation(fundOperationId string, networkId string, walletId string, addressId string, cryptoAmount CryptoAmount, fiatAmount FiatAmount, fees FundOperationFees, status string) *FundOperation { + this := FundOperation{} + this.FundOperationId = fundOperationId + this.NetworkId = networkId + this.WalletId = walletId + this.AddressId = addressId + this.CryptoAmount = cryptoAmount + this.FiatAmount = fiatAmount + this.Fees = fees + this.Status = status + return &this +} + +// NewFundOperationWithDefaults instantiates a new FundOperation object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFundOperationWithDefaults() *FundOperation { + this := FundOperation{} + return &this +} + +// GetFundOperationId returns the FundOperationId field value +func (o *FundOperation) GetFundOperationId() string { + if o == nil { + var ret string + return ret + } + + return o.FundOperationId +} + +// GetFundOperationIdOk returns a tuple with the FundOperationId field value +// and a boolean to check if the value has been set. +func (o *FundOperation) GetFundOperationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FundOperationId, true +} + +// SetFundOperationId sets field value +func (o *FundOperation) SetFundOperationId(v string) { + o.FundOperationId = v +} + +// GetNetworkId returns the NetworkId field value +func (o *FundOperation) GetNetworkId() string { + if o == nil { + var ret string + return ret + } + + return o.NetworkId +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value +// and a boolean to check if the value has been set. +func (o *FundOperation) GetNetworkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetworkId, true +} + +// SetNetworkId sets field value +func (o *FundOperation) SetNetworkId(v string) { + o.NetworkId = v +} + +// GetWalletId returns the WalletId field value +func (o *FundOperation) GetWalletId() string { + if o == nil { + var ret string + return ret + } + + return o.WalletId +} + +// GetWalletIdOk returns a tuple with the WalletId field value +// and a boolean to check if the value has been set. +func (o *FundOperation) GetWalletIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.WalletId, true +} + +// SetWalletId sets field value +func (o *FundOperation) SetWalletId(v string) { + o.WalletId = v +} + +// GetAddressId returns the AddressId field value +func (o *FundOperation) GetAddressId() string { + if o == nil { + var ret string + return ret + } + + return o.AddressId +} + +// GetAddressIdOk returns a tuple with the AddressId field value +// and a boolean to check if the value has been set. +func (o *FundOperation) GetAddressIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AddressId, true +} + +// SetAddressId sets field value +func (o *FundOperation) SetAddressId(v string) { + o.AddressId = v +} + +// GetCryptoAmount returns the CryptoAmount field value +func (o *FundOperation) GetCryptoAmount() CryptoAmount { + if o == nil { + var ret CryptoAmount + return ret + } + + return o.CryptoAmount +} + +// GetCryptoAmountOk returns a tuple with the CryptoAmount field value +// and a boolean to check if the value has been set. +func (o *FundOperation) GetCryptoAmountOk() (*CryptoAmount, bool) { + if o == nil { + return nil, false + } + return &o.CryptoAmount, true +} + +// SetCryptoAmount sets field value +func (o *FundOperation) SetCryptoAmount(v CryptoAmount) { + o.CryptoAmount = v +} + +// GetFiatAmount returns the FiatAmount field value +func (o *FundOperation) GetFiatAmount() FiatAmount { + if o == nil { + var ret FiatAmount + return ret + } + + return o.FiatAmount +} + +// GetFiatAmountOk returns a tuple with the FiatAmount field value +// and a boolean to check if the value has been set. +func (o *FundOperation) GetFiatAmountOk() (*FiatAmount, bool) { + if o == nil { + return nil, false + } + return &o.FiatAmount, true +} + +// SetFiatAmount sets field value +func (o *FundOperation) SetFiatAmount(v FiatAmount) { + o.FiatAmount = v +} + +// GetFees returns the Fees field value +func (o *FundOperation) GetFees() FundOperationFees { + if o == nil { + var ret FundOperationFees + return ret + } + + return o.Fees +} + +// GetFeesOk returns a tuple with the Fees field value +// and a boolean to check if the value has been set. +func (o *FundOperation) GetFeesOk() (*FundOperationFees, bool) { + if o == nil { + return nil, false + } + return &o.Fees, true +} + +// SetFees sets field value +func (o *FundOperation) SetFees(v FundOperationFees) { + o.Fees = v +} + +// GetStatus returns the Status field value +func (o *FundOperation) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *FundOperation) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *FundOperation) SetStatus(v string) { + o.Status = v +} + +func (o FundOperation) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FundOperation) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["fund_operation_id"] = o.FundOperationId + toSerialize["network_id"] = o.NetworkId + toSerialize["wallet_id"] = o.WalletId + toSerialize["address_id"] = o.AddressId + toSerialize["crypto_amount"] = o.CryptoAmount + toSerialize["fiat_amount"] = o.FiatAmount + toSerialize["fees"] = o.Fees + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *FundOperation) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "fund_operation_id", + "network_id", + "wallet_id", + "address_id", + "crypto_amount", + "fiat_amount", + "fees", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFundOperation := _FundOperation{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varFundOperation) + + if err != nil { + return err + } + + *o = FundOperation(varFundOperation) + + return err +} + +type NullableFundOperation struct { + value *FundOperation + isSet bool +} + +func (v NullableFundOperation) Get() *FundOperation { + return v.value +} + +func (v *NullableFundOperation) Set(val *FundOperation) { + v.value = val + v.isSet = true +} + +func (v NullableFundOperation) IsSet() bool { + return v.isSet +} + +func (v *NullableFundOperation) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFundOperation(val *FundOperation) *NullableFundOperation { + return &NullableFundOperation{value: val, isSet: true} +} + +func (v NullableFundOperation) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFundOperation) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_fund_operation_fees.go b/gen/client/model_fund_operation_fees.go new file mode 100644 index 0000000..a37d307 --- /dev/null +++ b/gen/client/model_fund_operation_fees.go @@ -0,0 +1,186 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the FundOperationFees type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FundOperationFees{} + +// FundOperationFees The fees for a fund operation. +type FundOperationFees struct { + BuyFee FiatAmount `json:"buy_fee"` + TransferFee CryptoAmount `json:"transfer_fee"` +} + +type _FundOperationFees FundOperationFees + +// NewFundOperationFees instantiates a new FundOperationFees object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFundOperationFees(buyFee FiatAmount, transferFee CryptoAmount) *FundOperationFees { + this := FundOperationFees{} + this.BuyFee = buyFee + this.TransferFee = transferFee + return &this +} + +// NewFundOperationFeesWithDefaults instantiates a new FundOperationFees object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFundOperationFeesWithDefaults() *FundOperationFees { + this := FundOperationFees{} + return &this +} + +// GetBuyFee returns the BuyFee field value +func (o *FundOperationFees) GetBuyFee() FiatAmount { + if o == nil { + var ret FiatAmount + return ret + } + + return o.BuyFee +} + +// GetBuyFeeOk returns a tuple with the BuyFee field value +// and a boolean to check if the value has been set. +func (o *FundOperationFees) GetBuyFeeOk() (*FiatAmount, bool) { + if o == nil { + return nil, false + } + return &o.BuyFee, true +} + +// SetBuyFee sets field value +func (o *FundOperationFees) SetBuyFee(v FiatAmount) { + o.BuyFee = v +} + +// GetTransferFee returns the TransferFee field value +func (o *FundOperationFees) GetTransferFee() CryptoAmount { + if o == nil { + var ret CryptoAmount + return ret + } + + return o.TransferFee +} + +// GetTransferFeeOk returns a tuple with the TransferFee field value +// and a boolean to check if the value has been set. +func (o *FundOperationFees) GetTransferFeeOk() (*CryptoAmount, bool) { + if o == nil { + return nil, false + } + return &o.TransferFee, true +} + +// SetTransferFee sets field value +func (o *FundOperationFees) SetTransferFee(v CryptoAmount) { + o.TransferFee = v +} + +func (o FundOperationFees) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FundOperationFees) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["buy_fee"] = o.BuyFee + toSerialize["transfer_fee"] = o.TransferFee + return toSerialize, nil +} + +func (o *FundOperationFees) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "buy_fee", + "transfer_fee", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFundOperationFees := _FundOperationFees{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varFundOperationFees) + + if err != nil { + return err + } + + *o = FundOperationFees(varFundOperationFees) + + return err +} + +type NullableFundOperationFees struct { + value *FundOperationFees + isSet bool +} + +func (v NullableFundOperationFees) Get() *FundOperationFees { + return v.value +} + +func (v *NullableFundOperationFees) Set(val *FundOperationFees) { + v.value = val + v.isSet = true +} + +func (v NullableFundOperationFees) IsSet() bool { + return v.isSet +} + +func (v *NullableFundOperationFees) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFundOperationFees(val *FundOperationFees) *NullableFundOperationFees { + return &NullableFundOperationFees{value: val, isSet: true} +} + +func (v NullableFundOperationFees) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFundOperationFees) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_fund_operation_list.go b/gen/client/model_fund_operation_list.go new file mode 100644 index 0000000..1506854 --- /dev/null +++ b/gen/client/model_fund_operation_list.go @@ -0,0 +1,245 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the FundOperationList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FundOperationList{} + +// FundOperationList Paginated list of fund operations +type FundOperationList struct { + Data []FundOperation `json:"data"` + // True if this list has another page of items after this one that can be fetched. + HasMore bool `json:"has_more"` + // The page token to be used to fetch the next page. + NextPage string `json:"next_page"` + // The total number of fund operations + TotalCount int32 `json:"total_count"` +} + +type _FundOperationList FundOperationList + +// NewFundOperationList instantiates a new FundOperationList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFundOperationList(data []FundOperation, hasMore bool, nextPage string, totalCount int32) *FundOperationList { + this := FundOperationList{} + this.Data = data + this.HasMore = hasMore + this.NextPage = nextPage + this.TotalCount = totalCount + return &this +} + +// NewFundOperationListWithDefaults instantiates a new FundOperationList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFundOperationListWithDefaults() *FundOperationList { + this := FundOperationList{} + return &this +} + +// GetData returns the Data field value +func (o *FundOperationList) GetData() []FundOperation { + if o == nil { + var ret []FundOperation + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *FundOperationList) GetDataOk() ([]FundOperation, bool) { + if o == nil { + return nil, false + } + return o.Data, true +} + +// SetData sets field value +func (o *FundOperationList) SetData(v []FundOperation) { + o.Data = v +} + +// GetHasMore returns the HasMore field value +func (o *FundOperationList) GetHasMore() bool { + if o == nil { + var ret bool + return ret + } + + return o.HasMore +} + +// GetHasMoreOk returns a tuple with the HasMore field value +// and a boolean to check if the value has been set. +func (o *FundOperationList) GetHasMoreOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.HasMore, true +} + +// SetHasMore sets field value +func (o *FundOperationList) SetHasMore(v bool) { + o.HasMore = v +} + +// GetNextPage returns the NextPage field value +func (o *FundOperationList) GetNextPage() string { + if o == nil { + var ret string + return ret + } + + return o.NextPage +} + +// GetNextPageOk returns a tuple with the NextPage field value +// and a boolean to check if the value has been set. +func (o *FundOperationList) GetNextPageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPage, true +} + +// SetNextPage sets field value +func (o *FundOperationList) SetNextPage(v string) { + o.NextPage = v +} + +// GetTotalCount returns the TotalCount field value +func (o *FundOperationList) GetTotalCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value +// and a boolean to check if the value has been set. +func (o *FundOperationList) GetTotalCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalCount, true +} + +// SetTotalCount sets field value +func (o *FundOperationList) SetTotalCount(v int32) { + o.TotalCount = v +} + +func (o FundOperationList) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FundOperationList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + toSerialize["has_more"] = o.HasMore + toSerialize["next_page"] = o.NextPage + toSerialize["total_count"] = o.TotalCount + return toSerialize, nil +} + +func (o *FundOperationList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "data", + "has_more", + "next_page", + "total_count", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFundOperationList := _FundOperationList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varFundOperationList) + + if err != nil { + return err + } + + *o = FundOperationList(varFundOperationList) + + return err +} + +type NullableFundOperationList struct { + value *FundOperationList + isSet bool +} + +func (v NullableFundOperationList) Get() *FundOperationList { + return v.value +} + +func (v *NullableFundOperationList) Set(val *FundOperationList) { + v.value = val + v.isSet = true +} + +func (v NullableFundOperationList) IsSet() bool { + return v.isSet +} + +func (v *NullableFundOperationList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFundOperationList(val *FundOperationList) *NullableFundOperationList { + return &NullableFundOperationList{value: val, isSet: true} +} + +func (v NullableFundOperationList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFundOperationList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_fund_quote.go b/gen/client/model_fund_quote.go new file mode 100644 index 0000000..388ea8a --- /dev/null +++ b/gen/client/model_fund_quote.go @@ -0,0 +1,360 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" + "bytes" + "fmt" +) + +// checks if the FundQuote type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FundQuote{} + +// FundQuote A quote for a fund operation +type FundQuote struct { + // The ID of the fund quote + FundQuoteId string `json:"fund_quote_id"` + // The ID of the blockchain network + NetworkId string `json:"network_id"` + // The ID of the wallet that will receive the crypto + WalletId string `json:"wallet_id"` + // The ID of the address that will receive the crypto + AddressId string `json:"address_id"` + CryptoAmount CryptoAmount `json:"crypto_amount"` + FiatAmount FiatAmount `json:"fiat_amount"` + // The time at which the quote expires + ExpiresAt time.Time `json:"expires_at"` + Fees FundOperationFees `json:"fees"` +} + +type _FundQuote FundQuote + +// NewFundQuote instantiates a new FundQuote object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewFundQuote(fundQuoteId string, networkId string, walletId string, addressId string, cryptoAmount CryptoAmount, fiatAmount FiatAmount, expiresAt time.Time, fees FundOperationFees) *FundQuote { + this := FundQuote{} + this.FundQuoteId = fundQuoteId + this.NetworkId = networkId + this.WalletId = walletId + this.AddressId = addressId + this.CryptoAmount = cryptoAmount + this.FiatAmount = fiatAmount + this.ExpiresAt = expiresAt + this.Fees = fees + return &this +} + +// NewFundQuoteWithDefaults instantiates a new FundQuote object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewFundQuoteWithDefaults() *FundQuote { + this := FundQuote{} + return &this +} + +// GetFundQuoteId returns the FundQuoteId field value +func (o *FundQuote) GetFundQuoteId() string { + if o == nil { + var ret string + return ret + } + + return o.FundQuoteId +} + +// GetFundQuoteIdOk returns a tuple with the FundQuoteId field value +// and a boolean to check if the value has been set. +func (o *FundQuote) GetFundQuoteIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.FundQuoteId, true +} + +// SetFundQuoteId sets field value +func (o *FundQuote) SetFundQuoteId(v string) { + o.FundQuoteId = v +} + +// GetNetworkId returns the NetworkId field value +func (o *FundQuote) GetNetworkId() string { + if o == nil { + var ret string + return ret + } + + return o.NetworkId +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value +// and a boolean to check if the value has been set. +func (o *FundQuote) GetNetworkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetworkId, true +} + +// SetNetworkId sets field value +func (o *FundQuote) SetNetworkId(v string) { + o.NetworkId = v +} + +// GetWalletId returns the WalletId field value +func (o *FundQuote) GetWalletId() string { + if o == nil { + var ret string + return ret + } + + return o.WalletId +} + +// GetWalletIdOk returns a tuple with the WalletId field value +// and a boolean to check if the value has been set. +func (o *FundQuote) GetWalletIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.WalletId, true +} + +// SetWalletId sets field value +func (o *FundQuote) SetWalletId(v string) { + o.WalletId = v +} + +// GetAddressId returns the AddressId field value +func (o *FundQuote) GetAddressId() string { + if o == nil { + var ret string + return ret + } + + return o.AddressId +} + +// GetAddressIdOk returns a tuple with the AddressId field value +// and a boolean to check if the value has been set. +func (o *FundQuote) GetAddressIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.AddressId, true +} + +// SetAddressId sets field value +func (o *FundQuote) SetAddressId(v string) { + o.AddressId = v +} + +// GetCryptoAmount returns the CryptoAmount field value +func (o *FundQuote) GetCryptoAmount() CryptoAmount { + if o == nil { + var ret CryptoAmount + return ret + } + + return o.CryptoAmount +} + +// GetCryptoAmountOk returns a tuple with the CryptoAmount field value +// and a boolean to check if the value has been set. +func (o *FundQuote) GetCryptoAmountOk() (*CryptoAmount, bool) { + if o == nil { + return nil, false + } + return &o.CryptoAmount, true +} + +// SetCryptoAmount sets field value +func (o *FundQuote) SetCryptoAmount(v CryptoAmount) { + o.CryptoAmount = v +} + +// GetFiatAmount returns the FiatAmount field value +func (o *FundQuote) GetFiatAmount() FiatAmount { + if o == nil { + var ret FiatAmount + return ret + } + + return o.FiatAmount +} + +// GetFiatAmountOk returns a tuple with the FiatAmount field value +// and a boolean to check if the value has been set. +func (o *FundQuote) GetFiatAmountOk() (*FiatAmount, bool) { + if o == nil { + return nil, false + } + return &o.FiatAmount, true +} + +// SetFiatAmount sets field value +func (o *FundQuote) SetFiatAmount(v FiatAmount) { + o.FiatAmount = v +} + +// GetExpiresAt returns the ExpiresAt field value +func (o *FundQuote) GetExpiresAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.ExpiresAt +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value +// and a boolean to check if the value has been set. +func (o *FundQuote) GetExpiresAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ExpiresAt, true +} + +// SetExpiresAt sets field value +func (o *FundQuote) SetExpiresAt(v time.Time) { + o.ExpiresAt = v +} + +// GetFees returns the Fees field value +func (o *FundQuote) GetFees() FundOperationFees { + if o == nil { + var ret FundOperationFees + return ret + } + + return o.Fees +} + +// GetFeesOk returns a tuple with the Fees field value +// and a boolean to check if the value has been set. +func (o *FundQuote) GetFeesOk() (*FundOperationFees, bool) { + if o == nil { + return nil, false + } + return &o.Fees, true +} + +// SetFees sets field value +func (o *FundQuote) SetFees(v FundOperationFees) { + o.Fees = v +} + +func (o FundQuote) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FundQuote) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["fund_quote_id"] = o.FundQuoteId + toSerialize["network_id"] = o.NetworkId + toSerialize["wallet_id"] = o.WalletId + toSerialize["address_id"] = o.AddressId + toSerialize["crypto_amount"] = o.CryptoAmount + toSerialize["fiat_amount"] = o.FiatAmount + toSerialize["expires_at"] = o.ExpiresAt + toSerialize["fees"] = o.Fees + return toSerialize, nil +} + +func (o *FundQuote) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "fund_quote_id", + "network_id", + "wallet_id", + "address_id", + "crypto_amount", + "fiat_amount", + "expires_at", + "fees", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varFundQuote := _FundQuote{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varFundQuote) + + if err != nil { + return err + } + + *o = FundQuote(varFundQuote) + + return err +} + +type NullableFundQuote struct { + value *FundQuote + isSet bool +} + +func (v NullableFundQuote) Get() *FundQuote { + return v.value +} + +func (v *NullableFundQuote) Set(val *FundQuote) { + v.value = val + v.isSet = true +} + +func (v NullableFundQuote) IsSet() bool { + return v.isSet +} + +func (v *NullableFundQuote) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFundQuote(val *FundQuote) *NullableFundQuote { + return &NullableFundQuote{value: val, isSet: true} +} + +func (v NullableFundQuote) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFundQuote) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_get_staking_context_request.go b/gen/client/model_get_staking_context_request.go index 6ab6b7d..f3684a5 100644 --- a/gen/client/model_get_staking_context_request.go +++ b/gen/client/model_get_staking_context_request.go @@ -27,6 +27,7 @@ type GetStakingContextRequest struct { AssetId string `json:"asset_id"` // The onchain address for which the staking context is being fetched AddressId string `json:"address_id"` + // Additional options for getting the staking context. This typically includes network specific fields. Options map[string]string `json:"options"` } diff --git a/gen/client/model_multi_token_contract_options.go b/gen/client/model_multi_token_contract_options.go new file mode 100644 index 0000000..93882f3 --- /dev/null +++ b/gen/client/model_multi_token_contract_options.go @@ -0,0 +1,159 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the MultiTokenContractOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MultiTokenContractOptions{} + +// MultiTokenContractOptions Options for multi-token contract creation +type MultiTokenContractOptions struct { + // The URI for all token metadata + Uri string `json:"uri"` +} + +type _MultiTokenContractOptions MultiTokenContractOptions + +// NewMultiTokenContractOptions instantiates a new MultiTokenContractOptions object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewMultiTokenContractOptions(uri string) *MultiTokenContractOptions { + this := MultiTokenContractOptions{} + this.Uri = uri + return &this +} + +// NewMultiTokenContractOptionsWithDefaults instantiates a new MultiTokenContractOptions object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewMultiTokenContractOptionsWithDefaults() *MultiTokenContractOptions { + this := MultiTokenContractOptions{} + return &this +} + +// GetUri returns the Uri field value +func (o *MultiTokenContractOptions) GetUri() string { + if o == nil { + var ret string + return ret + } + + return o.Uri +} + +// GetUriOk returns a tuple with the Uri field value +// and a boolean to check if the value has been set. +func (o *MultiTokenContractOptions) GetUriOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Uri, true +} + +// SetUri sets field value +func (o *MultiTokenContractOptions) SetUri(v string) { + o.Uri = v +} + +func (o MultiTokenContractOptions) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MultiTokenContractOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["uri"] = o.Uri + return toSerialize, nil +} + +func (o *MultiTokenContractOptions) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "uri", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varMultiTokenContractOptions := _MultiTokenContractOptions{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varMultiTokenContractOptions) + + if err != nil { + return err + } + + *o = MultiTokenContractOptions(varMultiTokenContractOptions) + + return err +} + +type NullableMultiTokenContractOptions struct { + value *MultiTokenContractOptions + isSet bool +} + +func (v NullableMultiTokenContractOptions) Get() *MultiTokenContractOptions { + return v.value +} + +func (v *NullableMultiTokenContractOptions) Set(val *MultiTokenContractOptions) { + v.value = val + v.isSet = true +} + +func (v NullableMultiTokenContractOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableMultiTokenContractOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMultiTokenContractOptions(val *MultiTokenContractOptions) *NullableMultiTokenContractOptions { + return &NullableMultiTokenContractOptions{value: val, isSet: true} +} + +func (v NullableMultiTokenContractOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMultiTokenContractOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_nft_contract_options.go b/gen/client/model_nft_contract_options.go index 0a605c8..fbef8a5 100644 --- a/gen/client/model_nft_contract_options.go +++ b/gen/client/model_nft_contract_options.go @@ -25,6 +25,8 @@ type NFTContractOptions struct { Name string `json:"name"` // The symbol of the NFT Symbol string `json:"symbol"` + // The base URI for the NFT metadata + BaseUri string `json:"base_uri"` } type _NFTContractOptions NFTContractOptions @@ -33,10 +35,11 @@ type _NFTContractOptions NFTContractOptions // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewNFTContractOptions(name string, symbol string) *NFTContractOptions { +func NewNFTContractOptions(name string, symbol string, baseUri string) *NFTContractOptions { this := NFTContractOptions{} this.Name = name this.Symbol = symbol + this.BaseUri = baseUri return &this } @@ -96,6 +99,30 @@ func (o *NFTContractOptions) SetSymbol(v string) { o.Symbol = v } +// GetBaseUri returns the BaseUri field value +func (o *NFTContractOptions) GetBaseUri() string { + if o == nil { + var ret string + return ret + } + + return o.BaseUri +} + +// GetBaseUriOk returns a tuple with the BaseUri field value +// and a boolean to check if the value has been set. +func (o *NFTContractOptions) GetBaseUriOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BaseUri, true +} + +// SetBaseUri sets field value +func (o *NFTContractOptions) SetBaseUri(v string) { + o.BaseUri = v +} + func (o NFTContractOptions) MarshalJSON() ([]byte, error) { toSerialize,err := o.ToMap() if err != nil { @@ -108,6 +135,7 @@ func (o NFTContractOptions) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} toSerialize["name"] = o.Name toSerialize["symbol"] = o.Symbol + toSerialize["base_uri"] = o.BaseUri return toSerialize, nil } @@ -118,6 +146,7 @@ func (o *NFTContractOptions) UnmarshalJSON(data []byte) (err error) { requiredProperties := []string{ "name", "symbol", + "base_uri", } allProperties := make(map[string]interface{}) diff --git a/gen/client/model_onchain_name.go b/gen/client/model_onchain_name.go new file mode 100644 index 0000000..b272f7b --- /dev/null +++ b/gen/client/model_onchain_name.go @@ -0,0 +1,445 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "time" + "bytes" + "fmt" +) + +// checks if the OnchainName type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OnchainName{} + +// OnchainName A representation of an onchain stored name from name systems i.e. ENS or Basenames +type OnchainName struct { + // The ID for the NFT related to this name + TokenId string `json:"token_id"` + // The onchain address of the owner of the name + OwnerAddress string `json:"owner_address"` + // The onchain address of the manager of the name + ManagerAddress string `json:"manager_address"` + // The primary onchain address of the name + PrimaryAddress *string `json:"primary_address,omitempty"` + // The readable format for the name in complete form + Domain string `json:"domain"` + // The visual representation attached to this name + Avatar *string `json:"avatar,omitempty"` + // The ID of the blockchain network + NetworkId string `json:"network_id"` + // The expiration date for this name's ownership + ExpiresAt time.Time `json:"expires_at"` + // The metadata attached to this name + TextRecords *map[string]string `json:"text_records,omitempty"` + // Whether this name is the primary name for the owner (This is when the ETH coin address for this name is equal to the primary_address. More info here https://docs.ens.domains/ensip/19) + IsPrimary bool `json:"is_primary"` +} + +type _OnchainName OnchainName + +// NewOnchainName instantiates a new OnchainName object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOnchainName(tokenId string, ownerAddress string, managerAddress string, domain string, networkId string, expiresAt time.Time, isPrimary bool) *OnchainName { + this := OnchainName{} + this.TokenId = tokenId + this.OwnerAddress = ownerAddress + this.ManagerAddress = managerAddress + this.Domain = domain + this.NetworkId = networkId + this.ExpiresAt = expiresAt + this.IsPrimary = isPrimary + return &this +} + +// NewOnchainNameWithDefaults instantiates a new OnchainName object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOnchainNameWithDefaults() *OnchainName { + this := OnchainName{} + return &this +} + +// GetTokenId returns the TokenId field value +func (o *OnchainName) GetTokenId() string { + if o == nil { + var ret string + return ret + } + + return o.TokenId +} + +// GetTokenIdOk returns a tuple with the TokenId field value +// and a boolean to check if the value has been set. +func (o *OnchainName) GetTokenIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TokenId, true +} + +// SetTokenId sets field value +func (o *OnchainName) SetTokenId(v string) { + o.TokenId = v +} + +// GetOwnerAddress returns the OwnerAddress field value +func (o *OnchainName) GetOwnerAddress() string { + if o == nil { + var ret string + return ret + } + + return o.OwnerAddress +} + +// GetOwnerAddressOk returns a tuple with the OwnerAddress field value +// and a boolean to check if the value has been set. +func (o *OnchainName) GetOwnerAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OwnerAddress, true +} + +// SetOwnerAddress sets field value +func (o *OnchainName) SetOwnerAddress(v string) { + o.OwnerAddress = v +} + +// GetManagerAddress returns the ManagerAddress field value +func (o *OnchainName) GetManagerAddress() string { + if o == nil { + var ret string + return ret + } + + return o.ManagerAddress +} + +// GetManagerAddressOk returns a tuple with the ManagerAddress field value +// and a boolean to check if the value has been set. +func (o *OnchainName) GetManagerAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ManagerAddress, true +} + +// SetManagerAddress sets field value +func (o *OnchainName) SetManagerAddress(v string) { + o.ManagerAddress = v +} + +// GetPrimaryAddress returns the PrimaryAddress field value if set, zero value otherwise. +func (o *OnchainName) GetPrimaryAddress() string { + if o == nil || IsNil(o.PrimaryAddress) { + var ret string + return ret + } + return *o.PrimaryAddress +} + +// GetPrimaryAddressOk returns a tuple with the PrimaryAddress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OnchainName) GetPrimaryAddressOk() (*string, bool) { + if o == nil || IsNil(o.PrimaryAddress) { + return nil, false + } + return o.PrimaryAddress, true +} + +// HasPrimaryAddress returns a boolean if a field has been set. +func (o *OnchainName) HasPrimaryAddress() bool { + if o != nil && !IsNil(o.PrimaryAddress) { + return true + } + + return false +} + +// SetPrimaryAddress gets a reference to the given string and assigns it to the PrimaryAddress field. +func (o *OnchainName) SetPrimaryAddress(v string) { + o.PrimaryAddress = &v +} + +// GetDomain returns the Domain field value +func (o *OnchainName) GetDomain() string { + if o == nil { + var ret string + return ret + } + + return o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value +// and a boolean to check if the value has been set. +func (o *OnchainName) GetDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Domain, true +} + +// SetDomain sets field value +func (o *OnchainName) SetDomain(v string) { + o.Domain = v +} + +// GetAvatar returns the Avatar field value if set, zero value otherwise. +func (o *OnchainName) GetAvatar() string { + if o == nil || IsNil(o.Avatar) { + var ret string + return ret + } + return *o.Avatar +} + +// GetAvatarOk returns a tuple with the Avatar field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OnchainName) GetAvatarOk() (*string, bool) { + if o == nil || IsNil(o.Avatar) { + return nil, false + } + return o.Avatar, true +} + +// HasAvatar returns a boolean if a field has been set. +func (o *OnchainName) HasAvatar() bool { + if o != nil && !IsNil(o.Avatar) { + return true + } + + return false +} + +// SetAvatar gets a reference to the given string and assigns it to the Avatar field. +func (o *OnchainName) SetAvatar(v string) { + o.Avatar = &v +} + +// GetNetworkId returns the NetworkId field value +func (o *OnchainName) GetNetworkId() string { + if o == nil { + var ret string + return ret + } + + return o.NetworkId +} + +// GetNetworkIdOk returns a tuple with the NetworkId field value +// and a boolean to check if the value has been set. +func (o *OnchainName) GetNetworkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NetworkId, true +} + +// SetNetworkId sets field value +func (o *OnchainName) SetNetworkId(v string) { + o.NetworkId = v +} + +// GetExpiresAt returns the ExpiresAt field value +func (o *OnchainName) GetExpiresAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.ExpiresAt +} + +// GetExpiresAtOk returns a tuple with the ExpiresAt field value +// and a boolean to check if the value has been set. +func (o *OnchainName) GetExpiresAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.ExpiresAt, true +} + +// SetExpiresAt sets field value +func (o *OnchainName) SetExpiresAt(v time.Time) { + o.ExpiresAt = v +} + +// GetTextRecords returns the TextRecords field value if set, zero value otherwise. +func (o *OnchainName) GetTextRecords() map[string]string { + if o == nil || IsNil(o.TextRecords) { + var ret map[string]string + return ret + } + return *o.TextRecords +} + +// GetTextRecordsOk returns a tuple with the TextRecords field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OnchainName) GetTextRecordsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.TextRecords) { + return nil, false + } + return o.TextRecords, true +} + +// HasTextRecords returns a boolean if a field has been set. +func (o *OnchainName) HasTextRecords() bool { + if o != nil && !IsNil(o.TextRecords) { + return true + } + + return false +} + +// SetTextRecords gets a reference to the given map[string]string and assigns it to the TextRecords field. +func (o *OnchainName) SetTextRecords(v map[string]string) { + o.TextRecords = &v +} + +// GetIsPrimary returns the IsPrimary field value +func (o *OnchainName) GetIsPrimary() bool { + if o == nil { + var ret bool + return ret + } + + return o.IsPrimary +} + +// GetIsPrimaryOk returns a tuple with the IsPrimary field value +// and a boolean to check if the value has been set. +func (o *OnchainName) GetIsPrimaryOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.IsPrimary, true +} + +// SetIsPrimary sets field value +func (o *OnchainName) SetIsPrimary(v bool) { + o.IsPrimary = v +} + +func (o OnchainName) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OnchainName) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["token_id"] = o.TokenId + toSerialize["owner_address"] = o.OwnerAddress + toSerialize["manager_address"] = o.ManagerAddress + if !IsNil(o.PrimaryAddress) { + toSerialize["primary_address"] = o.PrimaryAddress + } + toSerialize["domain"] = o.Domain + if !IsNil(o.Avatar) { + toSerialize["avatar"] = o.Avatar + } + toSerialize["network_id"] = o.NetworkId + toSerialize["expires_at"] = o.ExpiresAt + if !IsNil(o.TextRecords) { + toSerialize["text_records"] = o.TextRecords + } + toSerialize["is_primary"] = o.IsPrimary + return toSerialize, nil +} + +func (o *OnchainName) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "token_id", + "owner_address", + "manager_address", + "domain", + "network_id", + "expires_at", + "is_primary", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varOnchainName := _OnchainName{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varOnchainName) + + if err != nil { + return err + } + + *o = OnchainName(varOnchainName) + + return err +} + +type NullableOnchainName struct { + value *OnchainName + isSet bool +} + +func (v NullableOnchainName) Get() *OnchainName { + return v.value +} + +func (v *NullableOnchainName) Set(val *OnchainName) { + v.value = val + v.isSet = true +} + +func (v NullableOnchainName) IsSet() bool { + return v.isSet +} + +func (v *NullableOnchainName) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOnchainName(val *OnchainName) *NullableOnchainName { + return &NullableOnchainName{value: val, isSet: true} +} + +func (v NullableOnchainName) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOnchainName) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_onchain_name_list.go b/gen/client/model_onchain_name_list.go new file mode 100644 index 0000000..00d90a6 --- /dev/null +++ b/gen/client/model_onchain_name_list.go @@ -0,0 +1,262 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the OnchainNameList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OnchainNameList{} + +// OnchainNameList A list of onchain events with pagination information +type OnchainNameList struct { + // A list of onchain name objects + Data []OnchainName `json:"data"` + // True if this list has another page of items after this one that can be fetched. + HasMore *bool `json:"has_more,omitempty"` + // The page token to be used to fetch the next page. + NextPage string `json:"next_page"` + // The total number of payload signatures for the address. + TotalCount *int32 `json:"total_count,omitempty"` +} + +type _OnchainNameList OnchainNameList + +// NewOnchainNameList instantiates a new OnchainNameList object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewOnchainNameList(data []OnchainName, nextPage string) *OnchainNameList { + this := OnchainNameList{} + this.Data = data + this.NextPage = nextPage + return &this +} + +// NewOnchainNameListWithDefaults instantiates a new OnchainNameList object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewOnchainNameListWithDefaults() *OnchainNameList { + this := OnchainNameList{} + return &this +} + +// GetData returns the Data field value +func (o *OnchainNameList) GetData() []OnchainName { + if o == nil { + var ret []OnchainName + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *OnchainNameList) GetDataOk() ([]OnchainName, bool) { + if o == nil { + return nil, false + } + return o.Data, true +} + +// SetData sets field value +func (o *OnchainNameList) SetData(v []OnchainName) { + o.Data = v +} + +// GetHasMore returns the HasMore field value if set, zero value otherwise. +func (o *OnchainNameList) GetHasMore() bool { + if o == nil || IsNil(o.HasMore) { + var ret bool + return ret + } + return *o.HasMore +} + +// GetHasMoreOk returns a tuple with the HasMore field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OnchainNameList) GetHasMoreOk() (*bool, bool) { + if o == nil || IsNil(o.HasMore) { + return nil, false + } + return o.HasMore, true +} + +// HasHasMore returns a boolean if a field has been set. +func (o *OnchainNameList) HasHasMore() bool { + if o != nil && !IsNil(o.HasMore) { + return true + } + + return false +} + +// SetHasMore gets a reference to the given bool and assigns it to the HasMore field. +func (o *OnchainNameList) SetHasMore(v bool) { + o.HasMore = &v +} + +// GetNextPage returns the NextPage field value +func (o *OnchainNameList) GetNextPage() string { + if o == nil { + var ret string + return ret + } + + return o.NextPage +} + +// GetNextPageOk returns a tuple with the NextPage field value +// and a boolean to check if the value has been set. +func (o *OnchainNameList) GetNextPageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NextPage, true +} + +// SetNextPage sets field value +func (o *OnchainNameList) SetNextPage(v string) { + o.NextPage = v +} + +// GetTotalCount returns the TotalCount field value if set, zero value otherwise. +func (o *OnchainNameList) GetTotalCount() int32 { + if o == nil || IsNil(o.TotalCount) { + var ret int32 + return ret + } + return *o.TotalCount +} + +// GetTotalCountOk returns a tuple with the TotalCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *OnchainNameList) GetTotalCountOk() (*int32, bool) { + if o == nil || IsNil(o.TotalCount) { + return nil, false + } + return o.TotalCount, true +} + +// HasTotalCount returns a boolean if a field has been set. +func (o *OnchainNameList) HasTotalCount() bool { + if o != nil && !IsNil(o.TotalCount) { + return true + } + + return false +} + +// SetTotalCount gets a reference to the given int32 and assigns it to the TotalCount field. +func (o *OnchainNameList) SetTotalCount(v int32) { + o.TotalCount = &v +} + +func (o OnchainNameList) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OnchainNameList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + if !IsNil(o.HasMore) { + toSerialize["has_more"] = o.HasMore + } + toSerialize["next_page"] = o.NextPage + if !IsNil(o.TotalCount) { + toSerialize["total_count"] = o.TotalCount + } + return toSerialize, nil +} + +func (o *OnchainNameList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "data", + "next_page", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varOnchainNameList := _OnchainNameList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varOnchainNameList) + + if err != nil { + return err + } + + *o = OnchainNameList(varOnchainNameList) + + return err +} + +type NullableOnchainNameList struct { + value *OnchainNameList + isSet bool +} + +func (v NullableOnchainNameList) Get() *OnchainNameList { + return v.value +} + +func (v *NullableOnchainNameList) Set(val *OnchainNameList) { + v.value = val + v.isSet = true +} + +func (v NullableOnchainNameList) IsSet() bool { + return v.isSet +} + +func (v *NullableOnchainNameList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOnchainNameList(val *OnchainNameList) *NullableOnchainNameList { + return &NullableOnchainNameList{value: val, isSet: true} +} + +func (v NullableOnchainNameList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOnchainNameList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_read_contract_request.go b/gen/client/model_read_contract_request.go new file mode 100644 index 0000000..eed4863 --- /dev/null +++ b/gen/client/model_read_contract_request.go @@ -0,0 +1,225 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the ReadContractRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReadContractRequest{} + +// ReadContractRequest struct for ReadContractRequest +type ReadContractRequest struct { + // The name of the contract method to call + Method string `json:"method"` + // The JSON-encoded arguments to pass to the contract method. The keys should be the argument names and the values should be the argument values. + Args string `json:"args"` + // The JSON-encoded ABI of the contract method (optional, will use cached ABI if not provided) + Abi *string `json:"abi,omitempty"` +} + +type _ReadContractRequest ReadContractRequest + +// NewReadContractRequest instantiates a new ReadContractRequest object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewReadContractRequest(method string, args string) *ReadContractRequest { + this := ReadContractRequest{} + this.Method = method + this.Args = args + return &this +} + +// NewReadContractRequestWithDefaults instantiates a new ReadContractRequest object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewReadContractRequestWithDefaults() *ReadContractRequest { + this := ReadContractRequest{} + return &this +} + +// GetMethod returns the Method field value +func (o *ReadContractRequest) GetMethod() string { + if o == nil { + var ret string + return ret + } + + return o.Method +} + +// GetMethodOk returns a tuple with the Method field value +// and a boolean to check if the value has been set. +func (o *ReadContractRequest) GetMethodOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Method, true +} + +// SetMethod sets field value +func (o *ReadContractRequest) SetMethod(v string) { + o.Method = v +} + +// GetArgs returns the Args field value +func (o *ReadContractRequest) GetArgs() string { + if o == nil { + var ret string + return ret + } + + return o.Args +} + +// GetArgsOk returns a tuple with the Args field value +// and a boolean to check if the value has been set. +func (o *ReadContractRequest) GetArgsOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Args, true +} + +// SetArgs sets field value +func (o *ReadContractRequest) SetArgs(v string) { + o.Args = v +} + +// GetAbi returns the Abi field value if set, zero value otherwise. +func (o *ReadContractRequest) GetAbi() string { + if o == nil || IsNil(o.Abi) { + var ret string + return ret + } + return *o.Abi +} + +// GetAbiOk returns a tuple with the Abi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReadContractRequest) GetAbiOk() (*string, bool) { + if o == nil || IsNil(o.Abi) { + return nil, false + } + return o.Abi, true +} + +// HasAbi returns a boolean if a field has been set. +func (o *ReadContractRequest) HasAbi() bool { + if o != nil && !IsNil(o.Abi) { + return true + } + + return false +} + +// SetAbi gets a reference to the given string and assigns it to the Abi field. +func (o *ReadContractRequest) SetAbi(v string) { + o.Abi = &v +} + +func (o ReadContractRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReadContractRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["method"] = o.Method + toSerialize["args"] = o.Args + if !IsNil(o.Abi) { + toSerialize["abi"] = o.Abi + } + return toSerialize, nil +} + +func (o *ReadContractRequest) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "method", + "args", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varReadContractRequest := _ReadContractRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varReadContractRequest) + + if err != nil { + return err + } + + *o = ReadContractRequest(varReadContractRequest) + + return err +} + +type NullableReadContractRequest struct { + value *ReadContractRequest + isSet bool +} + +func (v NullableReadContractRequest) Get() *ReadContractRequest { + return v.value +} + +func (v *NullableReadContractRequest) Set(val *ReadContractRequest) { + v.value = val + v.isSet = true +} + +func (v NullableReadContractRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableReadContractRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReadContractRequest(val *ReadContractRequest) *NullableReadContractRequest { + return &NullableReadContractRequest{value: val, isSet: true} +} + +func (v NullableReadContractRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReadContractRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_smart_contract_options.go b/gen/client/model_smart_contract_options.go index 83bd860..d6b22f0 100644 --- a/gen/client/model_smart_contract_options.go +++ b/gen/client/model_smart_contract_options.go @@ -18,10 +18,18 @@ import ( // SmartContractOptions - Options for smart contract creation type SmartContractOptions struct { + MultiTokenContractOptions *MultiTokenContractOptions NFTContractOptions *NFTContractOptions TokenContractOptions *TokenContractOptions } +// MultiTokenContractOptionsAsSmartContractOptions is a convenience function that returns MultiTokenContractOptions wrapped in SmartContractOptions +func MultiTokenContractOptionsAsSmartContractOptions(v *MultiTokenContractOptions) SmartContractOptions { + return SmartContractOptions{ + MultiTokenContractOptions: v, + } +} + // NFTContractOptionsAsSmartContractOptions is a convenience function that returns NFTContractOptions wrapped in SmartContractOptions func NFTContractOptionsAsSmartContractOptions(v *NFTContractOptions) SmartContractOptions { return SmartContractOptions{ @@ -41,6 +49,23 @@ func TokenContractOptionsAsSmartContractOptions(v *TokenContractOptions) SmartCo func (dst *SmartContractOptions) UnmarshalJSON(data []byte) error { var err error match := 0 + // try to unmarshal data into MultiTokenContractOptions + err = newStrictDecoder(data).Decode(&dst.MultiTokenContractOptions) + if err == nil { + jsonMultiTokenContractOptions, _ := json.Marshal(dst.MultiTokenContractOptions) + if string(jsonMultiTokenContractOptions) == "{}" { // empty struct + dst.MultiTokenContractOptions = nil + } else { + if err = validator.Validate(dst.MultiTokenContractOptions); err != nil { + dst.MultiTokenContractOptions = nil + } else { + match++ + } + } + } else { + dst.MultiTokenContractOptions = nil + } + // try to unmarshal data into NFTContractOptions err = newStrictDecoder(data).Decode(&dst.NFTContractOptions) if err == nil { @@ -77,6 +102,7 @@ func (dst *SmartContractOptions) UnmarshalJSON(data []byte) error { if match > 1 { // more than 1 match // reset to nil + dst.MultiTokenContractOptions = nil dst.NFTContractOptions = nil dst.TokenContractOptions = nil @@ -90,6 +116,10 @@ func (dst *SmartContractOptions) UnmarshalJSON(data []byte) error { // Marshal data from the first non-nil pointers in the struct to JSON func (src SmartContractOptions) MarshalJSON() ([]byte, error) { + if src.MultiTokenContractOptions != nil { + return json.Marshal(&src.MultiTokenContractOptions) + } + if src.NFTContractOptions != nil { return json.Marshal(&src.NFTContractOptions) } @@ -106,6 +136,10 @@ func (obj *SmartContractOptions) GetActualInstance() (interface{}) { if obj == nil { return nil } + if obj.MultiTokenContractOptions != nil { + return obj.MultiTokenContractOptions + } + if obj.NFTContractOptions != nil { return obj.NFTContractOptions } diff --git a/gen/client/model_smart_contract_type.go b/gen/client/model_smart_contract_type.go index c4c8bed..d2211ac 100644 --- a/gen/client/model_smart_contract_type.go +++ b/gen/client/model_smart_contract_type.go @@ -15,19 +15,21 @@ import ( "fmt" ) -// SmartContractType The type of the smart contract +// SmartContractType The type of the smart contract. type SmartContractType string // List of SmartContractType const ( SMARTCONTRACTTYPE_ERC20 SmartContractType = "erc20" SMARTCONTRACTTYPE_ERC721 SmartContractType = "erc721" + SMARTCONTRACTTYPE_ERC1155 SmartContractType = "erc1155" ) // All allowed values of SmartContractType enum var AllowedSmartContractTypeEnumValues = []SmartContractType{ "erc20", "erc721", + "erc1155", } func (v *SmartContractType) UnmarshalJSON(src []byte) error { diff --git a/gen/client/model_solidity_value.go b/gen/client/model_solidity_value.go new file mode 100644 index 0000000..c2e9269 --- /dev/null +++ b/gen/client/model_solidity_value.go @@ -0,0 +1,269 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "bytes" + "fmt" +) + +// checks if the SolidityValue type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &SolidityValue{} + +// SolidityValue struct for SolidityValue +type SolidityValue struct { + Type string `json:"type"` + // The field name for tuple types. Not used for other types. + Name *string `json:"name,omitempty"` + // The value as a string for simple types. Not used for complex types (array, tuple). + Value *string `json:"value,omitempty"` + // For array and tuple types, the components of the value + Values []SolidityValue `json:"values,omitempty"` +} + +type _SolidityValue SolidityValue + +// NewSolidityValue instantiates a new SolidityValue object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewSolidityValue(type_ string) *SolidityValue { + this := SolidityValue{} + this.Type = type_ + return &this +} + +// NewSolidityValueWithDefaults instantiates a new SolidityValue object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewSolidityValueWithDefaults() *SolidityValue { + this := SolidityValue{} + return &this +} + +// GetType returns the Type field value +func (o *SolidityValue) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *SolidityValue) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *SolidityValue) SetType(v string) { + o.Type = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *SolidityValue) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SolidityValue) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *SolidityValue) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *SolidityValue) SetName(v string) { + o.Name = &v +} + +// GetValue returns the Value field value if set, zero value otherwise. +func (o *SolidityValue) GetValue() string { + if o == nil || IsNil(o.Value) { + var ret string + return ret + } + return *o.Value +} + +// GetValueOk returns a tuple with the Value field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SolidityValue) GetValueOk() (*string, bool) { + if o == nil || IsNil(o.Value) { + return nil, false + } + return o.Value, true +} + +// HasValue returns a boolean if a field has been set. +func (o *SolidityValue) HasValue() bool { + if o != nil && !IsNil(o.Value) { + return true + } + + return false +} + +// SetValue gets a reference to the given string and assigns it to the Value field. +func (o *SolidityValue) SetValue(v string) { + o.Value = &v +} + +// GetValues returns the Values field value if set, zero value otherwise. +func (o *SolidityValue) GetValues() []SolidityValue { + if o == nil || IsNil(o.Values) { + var ret []SolidityValue + return ret + } + return o.Values +} + +// GetValuesOk returns a tuple with the Values field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *SolidityValue) GetValuesOk() ([]SolidityValue, bool) { + if o == nil || IsNil(o.Values) { + return nil, false + } + return o.Values, true +} + +// HasValues returns a boolean if a field has been set. +func (o *SolidityValue) HasValues() bool { + if o != nil && !IsNil(o.Values) { + return true + } + + return false +} + +// SetValues gets a reference to the given []SolidityValue and assigns it to the Values field. +func (o *SolidityValue) SetValues(v []SolidityValue) { + o.Values = v +} + +func (o SolidityValue) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o SolidityValue) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["type"] = o.Type + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Value) { + toSerialize["value"] = o.Value + } + if !IsNil(o.Values) { + toSerialize["values"] = o.Values + } + return toSerialize, nil +} + +func (o *SolidityValue) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "type", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err; + } + + for _, requiredProperty := range(requiredProperties) { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varSolidityValue := _SolidityValue{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varSolidityValue) + + if err != nil { + return err + } + + *o = SolidityValue(varSolidityValue) + + return err +} + +type NullableSolidityValue struct { + value *SolidityValue + isSet bool +} + +func (v NullableSolidityValue) Get() *SolidityValue { + return v.value +} + +func (v *NullableSolidityValue) Set(val *SolidityValue) { + v.value = val + v.isSet = true +} + +func (v NullableSolidityValue) IsSet() bool { + return v.isSet +} + +func (v *NullableSolidityValue) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableSolidityValue(val *SolidityValue) *NullableSolidityValue { + return &NullableSolidityValue{value: val, isSet: true} +} + +func (v NullableSolidityValue) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableSolidityValue) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/gen/client/model_token_transfer_type.go b/gen/client/model_token_transfer_type.go new file mode 100644 index 0000000..73c7681 --- /dev/null +++ b/gen/client/model_token_transfer_type.go @@ -0,0 +1,115 @@ +/* +Coinbase Platform API + +This is the OpenAPI 3.0 specification for the Coinbase Platform APIs, used in conjunction with the Coinbase Platform SDKs. + +API version: 0.0.1-alpha +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" + "fmt" +) + +// TokenTransferType The type of the token transfer. +type TokenTransferType string + +// List of TokenTransferType +const ( + TOKENTRANSFERTYPE_ERC20 TokenTransferType = "erc20" + TOKENTRANSFERTYPE_ERC721 TokenTransferType = "erc721" + TOKENTRANSFERTYPE_ERC1155 TokenTransferType = "erc1155" + TOKENTRANSFERTYPE_UNKNOWN TokenTransferType = "unknown" +) + +// All allowed values of TokenTransferType enum +var AllowedTokenTransferTypeEnumValues = []TokenTransferType{ + "erc20", + "erc721", + "erc1155", + "unknown", +} + +func (v *TokenTransferType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := TokenTransferType(value) + for _, existing := range AllowedTokenTransferTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid TokenTransferType", value) +} + +// NewTokenTransferTypeFromValue returns a pointer to a valid TokenTransferType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewTokenTransferTypeFromValue(v string) (*TokenTransferType, error) { + ev := TokenTransferType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for TokenTransferType: valid values are %v", v, AllowedTokenTransferTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v TokenTransferType) IsValid() bool { + for _, existing := range AllowedTokenTransferTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TokenTransferType value +func (v TokenTransferType) Ptr() *TokenTransferType { + return &v +} + +type NullableTokenTransferType struct { + value *TokenTransferType + isSet bool +} + +func (v NullableTokenTransferType) Get() *TokenTransferType { + return v.value +} + +func (v *NullableTokenTransferType) Set(val *TokenTransferType) { + v.value = val + v.isSet = true +} + +func (v NullableTokenTransferType) IsSet() bool { + return v.isSet +} + +func (v *NullableTokenTransferType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTokenTransferType(val *TokenTransferType) *NullableTokenTransferType { + return &NullableTokenTransferType{value: val, isSet: true} +} + +func (v NullableTokenTransferType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTokenTransferType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + diff --git a/gen/client/model_update_webhook_request.go b/gen/client/model_update_webhook_request.go index 85c98de..6ddfa06 100644 --- a/gen/client/model_update_webhook_request.go +++ b/gen/client/model_update_webhook_request.go @@ -12,8 +12,6 @@ package client import ( "encoding/json" - "bytes" - "fmt" ) // checks if the UpdateWebhookRequest type satisfies the MappedNullable interface at compile time @@ -25,18 +23,15 @@ type UpdateWebhookRequest struct { // Webhook will monitor all events that matches any one of the event filters. EventFilters []WebhookEventFilter `json:"event_filters,omitempty"` // The Webhook uri that updates to - NotificationUri string `json:"notification_uri"` + NotificationUri *string `json:"notification_uri,omitempty"` } -type _UpdateWebhookRequest UpdateWebhookRequest - // NewUpdateWebhookRequest instantiates a new UpdateWebhookRequest object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewUpdateWebhookRequest(notificationUri string) *UpdateWebhookRequest { +func NewUpdateWebhookRequest() *UpdateWebhookRequest { this := UpdateWebhookRequest{} - this.NotificationUri = notificationUri return &this } @@ -112,28 +107,36 @@ func (o *UpdateWebhookRequest) SetEventFilters(v []WebhookEventFilter) { o.EventFilters = v } -// GetNotificationUri returns the NotificationUri field value +// GetNotificationUri returns the NotificationUri field value if set, zero value otherwise. func (o *UpdateWebhookRequest) GetNotificationUri() string { - if o == nil { + if o == nil || IsNil(o.NotificationUri) { var ret string return ret } - - return o.NotificationUri + return *o.NotificationUri } -// GetNotificationUriOk returns a tuple with the NotificationUri field value +// GetNotificationUriOk returns a tuple with the NotificationUri field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *UpdateWebhookRequest) GetNotificationUriOk() (*string, bool) { - if o == nil { + if o == nil || IsNil(o.NotificationUri) { return nil, false } - return &o.NotificationUri, true + return o.NotificationUri, true } -// SetNotificationUri sets field value +// HasNotificationUri returns a boolean if a field has been set. +func (o *UpdateWebhookRequest) HasNotificationUri() bool { + if o != nil && !IsNil(o.NotificationUri) { + return true + } + + return false +} + +// SetNotificationUri gets a reference to the given string and assigns it to the NotificationUri field. func (o *UpdateWebhookRequest) SetNotificationUri(v string) { - o.NotificationUri = v + o.NotificationUri = &v } func (o UpdateWebhookRequest) MarshalJSON() ([]byte, error) { @@ -152,45 +155,10 @@ func (o UpdateWebhookRequest) ToMap() (map[string]interface{}, error) { if !IsNil(o.EventFilters) { toSerialize["event_filters"] = o.EventFilters } - toSerialize["notification_uri"] = o.NotificationUri - return toSerialize, nil -} - -func (o *UpdateWebhookRequest) UnmarshalJSON(data []byte) (err error) { - // This validates that all required properties are included in the JSON object - // by unmarshalling the object into a generic map with string keys and checking - // that every required field exists as a key in the generic map. - requiredProperties := []string{ - "notification_uri", - } - - allProperties := make(map[string]interface{}) - - err = json.Unmarshal(data, &allProperties) - - if err != nil { - return err; - } - - for _, requiredProperty := range(requiredProperties) { - if _, exists := allProperties[requiredProperty]; !exists { - return fmt.Errorf("no value given for required property %v", requiredProperty) - } + if !IsNil(o.NotificationUri) { + toSerialize["notification_uri"] = o.NotificationUri } - - varUpdateWebhookRequest := _UpdateWebhookRequest{} - - decoder := json.NewDecoder(bytes.NewReader(data)) - decoder.DisallowUnknownFields() - err = decoder.Decode(&varUpdateWebhookRequest) - - if err != nil { - return err - } - - *o = UpdateWebhookRequest(varUpdateWebhookRequest) - - return err + return toSerialize, nil } type NullableUpdateWebhookRequest struct { diff --git a/pkg/auth/transport.go b/pkg/auth/transport.go index 344edff..f2513fe 100644 --- a/pkg/auth/transport.go +++ b/pkg/auth/transport.go @@ -36,7 +36,7 @@ func (t *transport) RoundTrip(req *http.Request) (*http.Response, error) { "Correlation-Context", fmt.Sprintf( "%s,%s", - fmt.Sprintf("%s=%s", "sdk_version", "0.0.12"), + fmt.Sprintf("%s=%s", "sdk_version", "0.0.13"), fmt.Sprintf("%s=%s", "sdk_language", "go"), ), ) diff --git a/pkg/coinbase/validator.go b/pkg/coinbase/validator.go index 1ade769..cc5df98 100644 --- a/pkg/coinbase/validator.go +++ b/pkg/coinbase/validator.go @@ -108,7 +108,7 @@ func (c *Client) ListValidators( assetId string, o ...ListValidatorsOption, ) ([]Validator, error) { - listValidatorReq := c.client.ValidatorsAPI.ListValidators(ctx, normalizeNetwork(networkId), assetId) + listValidatorReq := c.client.StakeAPI.ListValidators(ctx, normalizeNetwork(networkId), assetId) for _, f := range o { if f == nil { @@ -132,7 +132,7 @@ func (c *Client) ListValidators( } func (c *Client) GetValidator(ctx context.Context, networkId string, assetId string, validatorId string) (Validator, error) { - validator, httpResp, err := c.client.ValidatorsAPI.GetValidator( + validator, httpResp, err := c.client.StakeAPI.GetValidator( ctx, normalizeNetwork(networkId), assetId, diff --git a/pkg/coinbase/validators_test.go b/pkg/coinbase/validators_test.go index ba91228..998c340 100644 --- a/pkg/coinbase/validators_test.go +++ b/pkg/coinbase/validators_test.go @@ -15,8 +15,8 @@ import ( type ValidatorSuite struct { suite.Suite - mockValidatorsAPI *mocks.ValidatorsAPI - client *Client + mockStakeAPI *mocks.StakeAPI + client *Client } func TestValidatorTestSuite(t *testing.T) { @@ -24,14 +24,14 @@ func TestValidatorTestSuite(t *testing.T) { } func (s *ValidatorSuite) SetupTest() { - s.mockValidatorsAPI = mocks.NewValidatorsAPI(s.T()) + s.mockStakeAPI = mocks.NewStakeAPI(s.T()) s.client = &Client{client: &api.APIClient{ - ValidatorsAPI: s.mockValidatorsAPI, + StakeAPI: s.mockStakeAPI, }} } func (s *ValidatorSuite) TearDownTest() { - s.mockValidatorsAPI.AssertExpectations(s.T()) + s.mockStakeAPI.AssertExpectations(s.T()) } func (s *ValidatorSuite) TestListValidators_Success() { @@ -134,41 +134,41 @@ func (s *ValidatorSuite) TestGetValidator_Failure() { func (s *ValidatorSuite) mockSuccessfulListValidators(ctx context.Context, networkId string, assetId string, mockValidators *api.ValidatorList) { s.T().Helper() - s.mockValidatorsAPI.On("ListValidators", ctx, networkId, assetId).Return(api.ApiListValidatorsRequest{ - ApiService: s.mockValidatorsAPI, + s.mockStakeAPI.On("ListValidators", ctx, networkId, assetId).Return(api.ApiListValidatorsRequest{ + ApiService: s.mockStakeAPI, }, nil, nil).Once() - s.mockValidatorsAPI.On("ListValidatorsExecute", mock.Anything).Return(mockValidators, nil, nil).Once() + s.mockStakeAPI.On("ListValidatorsExecute", mock.Anything).Return(mockValidators, nil, nil).Once() } func (s *ValidatorSuite) mockFailedListValidators(ctx context.Context, networkId string, assetId string, err error) { s.T().Helper() - s.mockValidatorsAPI.On("ListValidators", ctx, networkId, assetId).Return(api.ApiListValidatorsRequest{ - ApiService: s.mockValidatorsAPI, + s.mockStakeAPI.On("ListValidators", ctx, networkId, assetId).Return(api.ApiListValidatorsRequest{ + ApiService: s.mockStakeAPI, }, nil, nil).Once() - s.mockValidatorsAPI.On("ListValidatorsExecute", mock.Anything).Return(nil, internalFailureHttpResponse(), err).Once() + s.mockStakeAPI.On("ListValidatorsExecute", mock.Anything).Return(nil, internalFailureHttpResponse(), err).Once() } func (s *ValidatorSuite) mockSuccessfulGetValidator(ctx context.Context, networkId string, assetId string, validatorId string, validator *api.Validator) { s.T().Helper() - s.mockValidatorsAPI.On("GetValidator", ctx, networkId, assetId, validatorId).Return(api.ApiGetValidatorRequest{ - ApiService: s.mockValidatorsAPI, + s.mockStakeAPI.On("GetValidator", ctx, networkId, assetId, validatorId).Return(api.ApiGetValidatorRequest{ + ApiService: s.mockStakeAPI, }, nil, nil) - s.mockValidatorsAPI.On("GetValidatorExecute", mock.Anything).Return(validator, nil, nil) + s.mockStakeAPI.On("GetValidatorExecute", mock.Anything).Return(validator, nil, nil) } func (s *ValidatorSuite) mockFailedGetValidator(ctx context.Context, networkId string, assetId string, validatorId string, err error) { s.T().Helper() - s.mockValidatorsAPI.On("GetValidator", ctx, networkId, assetId, validatorId).Return(api.ApiGetValidatorRequest{ - ApiService: s.mockValidatorsAPI, + s.mockStakeAPI.On("GetValidator", ctx, networkId, assetId, validatorId).Return(api.ApiGetValidatorRequest{ + ApiService: s.mockStakeAPI, }, nil, nil) - s.mockValidatorsAPI.On("GetValidatorExecute", mock.Anything).Return(nil, internalFailureHttpResponse(), err) + s.mockStakeAPI.On("GetValidatorExecute", mock.Anything).Return(nil, internalFailureHttpResponse(), err) } func internalFailureHttpResponse() *http.Response { diff --git a/pkg/mocks/AssetsAPI.go b/pkg/mocks/AssetsAPI.go index 4a184bf..66a144d 100644 --- a/pkg/mocks/AssetsAPI.go +++ b/pkg/mocks/AssetsAPI.go @@ -21,6 +21,10 @@ type AssetsAPI struct { func (_m *AssetsAPI) GetAsset(ctx context.Context, networkId string, assetId string) client.ApiGetAssetRequest { ret := _m.Called(ctx, networkId, assetId) + if len(ret) == 0 { + panic("no return value specified for GetAsset") + } + var r0 client.ApiGetAssetRequest if rf, ok := ret.Get(0).(func(context.Context, string, string) client.ApiGetAssetRequest); ok { r0 = rf(ctx, networkId, assetId) @@ -35,6 +39,10 @@ func (_m *AssetsAPI) GetAsset(ctx context.Context, networkId string, assetId str func (_m *AssetsAPI) GetAssetExecute(r client.ApiGetAssetRequest) (*client.Asset, *http.Response, error) { ret := _m.Called(r) + if len(ret) == 0 { + panic("no return value specified for GetAssetExecute") + } + var r0 *client.Asset var r1 *http.Response var r2 error diff --git a/pkg/mocks/Signable.go b/pkg/mocks/Signable.go index adddbca..e6d0077 100644 --- a/pkg/mocks/Signable.go +++ b/pkg/mocks/Signable.go @@ -17,6 +17,10 @@ type Signable struct { func (_m *Signable) IsSigned() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for IsSigned") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -31,6 +35,10 @@ func (_m *Signable) IsSigned() bool { func (_m *Signable) Raw() interface{} { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Raw") + } + var r0 interface{} if rf, ok := ret.Get(0).(func() interface{}); ok { r0 = rf() @@ -47,6 +55,10 @@ func (_m *Signable) Raw() interface{} { func (_m *Signable) Sign(_a0 crypto.Signer) (string, error) { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Sign") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func(crypto.Signer) (string, error)); ok { diff --git a/pkg/mocks/StakeAPI.go b/pkg/mocks/StakeAPI.go index 56883dd..35a31fa 100644 --- a/pkg/mocks/StakeAPI.go +++ b/pkg/mocks/StakeAPI.go @@ -21,6 +21,10 @@ type StakeAPI struct { func (_m *StakeAPI) BuildStakingOperation(ctx context.Context) client.ApiBuildStakingOperationRequest { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for BuildStakingOperation") + } + var r0 client.ApiBuildStakingOperationRequest if rf, ok := ret.Get(0).(func(context.Context) client.ApiBuildStakingOperationRequest); ok { r0 = rf(ctx) @@ -35,6 +39,10 @@ func (_m *StakeAPI) BuildStakingOperation(ctx context.Context) client.ApiBuildSt func (_m *StakeAPI) BuildStakingOperationExecute(r client.ApiBuildStakingOperationRequest) (*client.StakingOperation, *http.Response, error) { ret := _m.Called(r) + if len(ret) == 0 { + panic("no return value specified for BuildStakingOperationExecute") + } + var r0 *client.StakingOperation var r1 *http.Response var r2 error @@ -70,6 +78,10 @@ func (_m *StakeAPI) BuildStakingOperationExecute(r client.ApiBuildStakingOperati func (_m *StakeAPI) FetchHistoricalStakingBalances(ctx context.Context, networkId string, addressId string) client.ApiFetchHistoricalStakingBalancesRequest { ret := _m.Called(ctx, networkId, addressId) + if len(ret) == 0 { + panic("no return value specified for FetchHistoricalStakingBalances") + } + var r0 client.ApiFetchHistoricalStakingBalancesRequest if rf, ok := ret.Get(0).(func(context.Context, string, string) client.ApiFetchHistoricalStakingBalancesRequest); ok { r0 = rf(ctx, networkId, addressId) @@ -84,6 +96,10 @@ func (_m *StakeAPI) FetchHistoricalStakingBalances(ctx context.Context, networkI func (_m *StakeAPI) FetchHistoricalStakingBalancesExecute(r client.ApiFetchHistoricalStakingBalancesRequest) (*client.FetchHistoricalStakingBalances200Response, *http.Response, error) { ret := _m.Called(r) + if len(ret) == 0 { + panic("no return value specified for FetchHistoricalStakingBalancesExecute") + } + var r0 *client.FetchHistoricalStakingBalances200Response var r1 *http.Response var r2 error @@ -119,6 +135,10 @@ func (_m *StakeAPI) FetchHistoricalStakingBalancesExecute(r client.ApiFetchHisto func (_m *StakeAPI) FetchStakingRewards(ctx context.Context) client.ApiFetchStakingRewardsRequest { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for FetchStakingRewards") + } + var r0 client.ApiFetchStakingRewardsRequest if rf, ok := ret.Get(0).(func(context.Context) client.ApiFetchStakingRewardsRequest); ok { r0 = rf(ctx) @@ -133,6 +153,10 @@ func (_m *StakeAPI) FetchStakingRewards(ctx context.Context) client.ApiFetchStak func (_m *StakeAPI) FetchStakingRewardsExecute(r client.ApiFetchStakingRewardsRequest) (*client.FetchStakingRewards200Response, *http.Response, error) { ret := _m.Called(r) + if len(ret) == 0 { + panic("no return value specified for FetchStakingRewardsExecute") + } + var r0 *client.FetchStakingRewards200Response var r1 *http.Response var r2 error @@ -168,6 +192,10 @@ func (_m *StakeAPI) FetchStakingRewardsExecute(r client.ApiFetchStakingRewardsRe func (_m *StakeAPI) GetExternalStakingOperation(ctx context.Context, networkId string, addressId string, stakingOperationId string) client.ApiGetExternalStakingOperationRequest { ret := _m.Called(ctx, networkId, addressId, stakingOperationId) + if len(ret) == 0 { + panic("no return value specified for GetExternalStakingOperation") + } + var r0 client.ApiGetExternalStakingOperationRequest if rf, ok := ret.Get(0).(func(context.Context, string, string, string) client.ApiGetExternalStakingOperationRequest); ok { r0 = rf(ctx, networkId, addressId, stakingOperationId) @@ -182,6 +210,10 @@ func (_m *StakeAPI) GetExternalStakingOperation(ctx context.Context, networkId s func (_m *StakeAPI) GetExternalStakingOperationExecute(r client.ApiGetExternalStakingOperationRequest) (*client.StakingOperation, *http.Response, error) { ret := _m.Called(r) + if len(ret) == 0 { + panic("no return value specified for GetExternalStakingOperationExecute") + } + var r0 *client.StakingOperation var r1 *http.Response var r2 error @@ -217,6 +249,10 @@ func (_m *StakeAPI) GetExternalStakingOperationExecute(r client.ApiGetExternalSt func (_m *StakeAPI) GetStakingContext(ctx context.Context) client.ApiGetStakingContextRequest { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetStakingContext") + } + var r0 client.ApiGetStakingContextRequest if rf, ok := ret.Get(0).(func(context.Context) client.ApiGetStakingContextRequest); ok { r0 = rf(ctx) @@ -231,6 +267,10 @@ func (_m *StakeAPI) GetStakingContext(ctx context.Context) client.ApiGetStakingC func (_m *StakeAPI) GetStakingContextExecute(r client.ApiGetStakingContextRequest) (*client.StakingContext, *http.Response, error) { ret := _m.Called(r) + if len(ret) == 0 { + panic("no return value specified for GetStakingContextExecute") + } + var r0 *client.StakingContext var r1 *http.Response var r2 error @@ -262,6 +302,120 @@ func (_m *StakeAPI) GetStakingContextExecute(r client.ApiGetStakingContextReques return r0, r1, r2 } +// GetValidator provides a mock function with given fields: ctx, networkId, assetId, validatorId +func (_m *StakeAPI) GetValidator(ctx context.Context, networkId string, assetId string, validatorId string) client.ApiGetValidatorRequest { + ret := _m.Called(ctx, networkId, assetId, validatorId) + + if len(ret) == 0 { + panic("no return value specified for GetValidator") + } + + var r0 client.ApiGetValidatorRequest + if rf, ok := ret.Get(0).(func(context.Context, string, string, string) client.ApiGetValidatorRequest); ok { + r0 = rf(ctx, networkId, assetId, validatorId) + } else { + r0 = ret.Get(0).(client.ApiGetValidatorRequest) + } + + return r0 +} + +// GetValidatorExecute provides a mock function with given fields: r +func (_m *StakeAPI) GetValidatorExecute(r client.ApiGetValidatorRequest) (*client.Validator, *http.Response, error) { + ret := _m.Called(r) + + if len(ret) == 0 { + panic("no return value specified for GetValidatorExecute") + } + + var r0 *client.Validator + var r1 *http.Response + var r2 error + if rf, ok := ret.Get(0).(func(client.ApiGetValidatorRequest) (*client.Validator, *http.Response, error)); ok { + return rf(r) + } + if rf, ok := ret.Get(0).(func(client.ApiGetValidatorRequest) *client.Validator); ok { + r0 = rf(r) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*client.Validator) + } + } + + if rf, ok := ret.Get(1).(func(client.ApiGetValidatorRequest) *http.Response); ok { + r1 = rf(r) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*http.Response) + } + } + + if rf, ok := ret.Get(2).(func(client.ApiGetValidatorRequest) error); ok { + r2 = rf(r) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// ListValidators provides a mock function with given fields: ctx, networkId, assetId +func (_m *StakeAPI) ListValidators(ctx context.Context, networkId string, assetId string) client.ApiListValidatorsRequest { + ret := _m.Called(ctx, networkId, assetId) + + if len(ret) == 0 { + panic("no return value specified for ListValidators") + } + + var r0 client.ApiListValidatorsRequest + if rf, ok := ret.Get(0).(func(context.Context, string, string) client.ApiListValidatorsRequest); ok { + r0 = rf(ctx, networkId, assetId) + } else { + r0 = ret.Get(0).(client.ApiListValidatorsRequest) + } + + return r0 +} + +// ListValidatorsExecute provides a mock function with given fields: r +func (_m *StakeAPI) ListValidatorsExecute(r client.ApiListValidatorsRequest) (*client.ValidatorList, *http.Response, error) { + ret := _m.Called(r) + + if len(ret) == 0 { + panic("no return value specified for ListValidatorsExecute") + } + + var r0 *client.ValidatorList + var r1 *http.Response + var r2 error + if rf, ok := ret.Get(0).(func(client.ApiListValidatorsRequest) (*client.ValidatorList, *http.Response, error)); ok { + return rf(r) + } + if rf, ok := ret.Get(0).(func(client.ApiListValidatorsRequest) *client.ValidatorList); ok { + r0 = rf(r) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*client.ValidatorList) + } + } + + if rf, ok := ret.Get(1).(func(client.ApiListValidatorsRequest) *http.Response); ok { + r1 = rf(r) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*http.Response) + } + } + + if rf, ok := ret.Get(2).(func(client.ApiListValidatorsRequest) error); ok { + r2 = rf(r) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + // NewStakeAPI creates a new instance of StakeAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. // The first argument is typically a *testing.T value. func NewStakeAPI(t interface { diff --git a/pkg/mocks/ValidatorsAPI.go b/pkg/mocks/ValidatorsAPI.go deleted file mode 100644 index a6c408c..0000000 --- a/pkg/mocks/ValidatorsAPI.go +++ /dev/null @@ -1,130 +0,0 @@ -// Code generated by mockery. DO NOT EDIT. - -package mocks - -import ( - context "context" - - client "github.com/coinbase/coinbase-sdk-go/gen/client" - - http "net/http" - - mock "github.com/stretchr/testify/mock" -) - -// ValidatorsAPI is an autogenerated mock type for the ValidatorsAPI type -type ValidatorsAPI struct { - mock.Mock -} - -// GetValidator provides a mock function with given fields: ctx, networkId, assetId, validatorId -func (_m *ValidatorsAPI) GetValidator(ctx context.Context, networkId string, assetId string, validatorId string) client.ApiGetValidatorRequest { - ret := _m.Called(ctx, networkId, assetId, validatorId) - - var r0 client.ApiGetValidatorRequest - if rf, ok := ret.Get(0).(func(context.Context, string, string, string) client.ApiGetValidatorRequest); ok { - r0 = rf(ctx, networkId, assetId, validatorId) - } else { - r0 = ret.Get(0).(client.ApiGetValidatorRequest) - } - - return r0 -} - -// GetValidatorExecute provides a mock function with given fields: r -func (_m *ValidatorsAPI) GetValidatorExecute(r client.ApiGetValidatorRequest) (*client.Validator, *http.Response, error) { - ret := _m.Called(r) - - var r0 *client.Validator - var r1 *http.Response - var r2 error - if rf, ok := ret.Get(0).(func(client.ApiGetValidatorRequest) (*client.Validator, *http.Response, error)); ok { - return rf(r) - } - if rf, ok := ret.Get(0).(func(client.ApiGetValidatorRequest) *client.Validator); ok { - r0 = rf(r) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*client.Validator) - } - } - - if rf, ok := ret.Get(1).(func(client.ApiGetValidatorRequest) *http.Response); ok { - r1 = rf(r) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*http.Response) - } - } - - if rf, ok := ret.Get(2).(func(client.ApiGetValidatorRequest) error); ok { - r2 = rf(r) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// ListValidators provides a mock function with given fields: ctx, networkId, assetId -func (_m *ValidatorsAPI) ListValidators(ctx context.Context, networkId string, assetId string) client.ApiListValidatorsRequest { - ret := _m.Called(ctx, networkId, assetId) - - var r0 client.ApiListValidatorsRequest - if rf, ok := ret.Get(0).(func(context.Context, string, string) client.ApiListValidatorsRequest); ok { - r0 = rf(ctx, networkId, assetId) - } else { - r0 = ret.Get(0).(client.ApiListValidatorsRequest) - } - - return r0 -} - -// ListValidatorsExecute provides a mock function with given fields: r -func (_m *ValidatorsAPI) ListValidatorsExecute(r client.ApiListValidatorsRequest) (*client.ValidatorList, *http.Response, error) { - ret := _m.Called(r) - - var r0 *client.ValidatorList - var r1 *http.Response - var r2 error - if rf, ok := ret.Get(0).(func(client.ApiListValidatorsRequest) (*client.ValidatorList, *http.Response, error)); ok { - return rf(r) - } - if rf, ok := ret.Get(0).(func(client.ApiListValidatorsRequest) *client.ValidatorList); ok { - r0 = rf(r) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*client.ValidatorList) - } - } - - if rf, ok := ret.Get(1).(func(client.ApiListValidatorsRequest) *http.Response); ok { - r1 = rf(r) - } else { - if ret.Get(1) != nil { - r1 = ret.Get(1).(*http.Response) - } - } - - if rf, ok := ret.Get(2).(func(client.ApiListValidatorsRequest) error); ok { - r2 = rf(r) - } else { - r2 = ret.Error(2) - } - - return r0, r1, r2 -} - -// NewValidatorsAPI creates a new instance of ValidatorsAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewValidatorsAPI(t interface { - mock.TestingT - Cleanup(func()) -}) *ValidatorsAPI { - mock := &ValidatorsAPI{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -}