-
-
Save einaralex/09df81174941c42b520642319547915e to your computer and use it in GitHub Desktop.
Oapi-codegen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package monerium provides primitives to interact with the openapi HTTP API. | |
// | |
// Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT. | |
package monerium | |
import ( | |
"bytes" | |
"compress/gzip" | |
"context" | |
"encoding/base64" | |
"encoding/json" | |
"fmt" | |
"io" | |
"net/http" | |
"net/url" | |
"path" | |
"strings" | |
"time" | |
"github.com/deepmap/oapi-codegen/pkg/runtime" | |
openapi_types "github.com/deepmap/oapi-codegen/pkg/types" | |
"github.com/getkin/kin-openapi/openapi3" | |
"github.com/labstack/echo/v4" | |
) | |
// Defines values for ChainMultiSig0. | |
const ( | |
Gnosis ChainMultiSig0 = "gnosis" | |
) | |
// Defines values for ChainMultiSig1. | |
const ( | |
Polygon ChainMultiSig1 = "polygon" | |
) | |
// Defines values for ChainMultiSig2. | |
const ( | |
Ethereum ChainMultiSig2 = "ethereum" | |
) | |
// Defines values for Currency. | |
const ( | |
Eur Currency = "eur" | |
Gbp Currency = "gbp" | |
Isk Currency = "isk" | |
Usd Currency = "usd" | |
) | |
// Defines values for NetworkMultiSig1. | |
const ( | |
Mainnet NetworkMultiSig1 = "mainnet" | |
) | |
// Defines values for NewOrderKind. | |
const ( | |
NewOrderKindRedeem NewOrderKind = "redeem" | |
) | |
// Defines values for OrderFeesProvider. | |
const ( | |
Satchel OrderFeesProvider = "satchel" | |
) | |
// Defines values for OrderKind. | |
const ( | |
OrderKindIssue OrderKind = "issue" | |
OrderKindRedeem OrderKind = "redeem" | |
) | |
// Defines values for OrderMetaState. | |
const ( | |
OrderMetaStatePending OrderMetaState = "pending" | |
OrderMetaStatePlaced OrderMetaState = "placed" | |
OrderMetaStateProcessed OrderMetaState = "processed" | |
OrderMetaStateRejected OrderMetaState = "rejected" | |
) | |
// Defines values for ProfileKycOutcome. | |
const ( | |
ProfileKycOutcomeApproved ProfileKycOutcome = "approved" | |
ProfileKycOutcomeRejected ProfileKycOutcome = "rejected" | |
ProfileKycOutcomeUnknown ProfileKycOutcome = "unknown" | |
) | |
// Defines values for ProfileKycState. | |
const ( | |
ProfileKycStateAbsent ProfileKycState = "absent" | |
ProfileKycStateConfirmed ProfileKycState = "confirmed" | |
ProfileKycStatePending ProfileKycState = "pending" | |
ProfileKycStateSubmitted ProfileKycState = "submitted" | |
) | |
// Defines values for ProfileSummaryPerms. | |
const ( | |
Read ProfileSummaryPerms = "read" | |
Write ProfileSummaryPerms = "write" | |
) | |
// Defines values for ProfileSummaryType. | |
const ( | |
Corporate ProfileSummaryType = "corporate" | |
Personal ProfileSummaryType = "personal" | |
) | |
// Defines values for SignatureMultiSig. | |
const ( | |
N0x SignatureMultiSig = "0x" | |
) | |
// Defines values for UserContextAuthMethod. | |
const ( | |
Apikey UserContextAuthMethod = "apikey" | |
Bearer UserContextAuthMethod = "bearer" | |
Jwt UserContextAuthMethod = "jwt" | |
Password UserContextAuthMethod = "password" | |
Resource UserContextAuthMethod = "resource" | |
) | |
// Defines values for UserContextRoles. | |
const ( | |
Admin UserContextRoles = "admin" | |
) | |
// Defines values for AuthParamsCodeChallengeMethod. | |
const ( | |
Plain AuthParamsCodeChallengeMethod = "plain" | |
S256 AuthParamsCodeChallengeMethod = "S256" | |
) | |
// Defines values for AuthTokenParamsGrantType. | |
const ( | |
AuthorizationCode AuthTokenParamsGrantType = "authorization_code" | |
ClientCredentials AuthTokenParamsGrantType = "client_credentials" | |
RefreshToken AuthTokenParamsGrantType = "refresh_token" | |
) | |
// Defines values for OrdersParamsState. | |
const ( | |
OrdersParamsStatePending OrdersParamsState = "pending" | |
OrdersParamsStatePlaced OrdersParamsState = "placed" | |
OrdersParamsStateProcessed OrdersParamsState = "processed" | |
OrdersParamsStateRejected OrdersParamsState = "rejected" | |
) | |
// Defines values for OrdersNotificationsParamsState. | |
const ( | |
OrdersNotificationsParamsStatePending OrdersNotificationsParamsState = "pending" | |
OrdersNotificationsParamsStatePlaced OrdersNotificationsParamsState = "placed" | |
OrdersNotificationsParamsStateProcessed OrdersNotificationsParamsState = "processed" | |
OrdersNotificationsParamsStateRejected OrdersNotificationsParamsState = "rejected" | |
) | |
// Defines values for ProfileOrdersParamsState. | |
const ( | |
ProfileOrdersParamsStatePending ProfileOrdersParamsState = "pending" | |
ProfileOrdersParamsStatePlaced ProfileOrdersParamsState = "placed" | |
ProfileOrdersParamsStateProcessed ProfileOrdersParamsState = "processed" | |
ProfileOrdersParamsStateRejected ProfileOrdersParamsState = "rejected" | |
) | |
// Defines values for ProfileOrdersNotificationsParamsState. | |
const ( | |
Pending ProfileOrdersNotificationsParamsState = "pending" | |
Placed ProfileOrdersNotificationsParamsState = "placed" | |
Processed ProfileOrdersNotificationsParamsState = "processed" | |
Rejected ProfileOrdersNotificationsParamsState = "rejected" | |
) | |
// AccessToken defines model for AccessToken. | |
type AccessToken struct { | |
AccessToken string `json:"access_token"` | |
ExpiresIn int `json:"expires_in"` | |
RefreshToken string `json:"refresh_token"` | |
TokenType string `json:"token_type"` | |
} | |
// Account defines model for Account. | |
type Account struct { | |
// AccountNumber **Only present if `standard=scan`.**</br> Bank account number at the institution and branch specified in the sort code | |
AccountNumber *string `json:"accountNumber,omitempty"` | |
// Address The blockchain address. | |
Address *Address `json:"address,omitempty"` | |
// Chain <span class="enumtitle">Enum:</span> <span class="enum">"gnosis"</span> <span class="enum">"polygon"</span> <span class="enum">"ethereum"</span></br> | |
// Name of the blockchain | |
Chain *Chain `json:"chain,omitempty"` | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
Currency *Currency `json:"currency,omitempty"` | |
// Iban **Only present if `standard=iban`.** </br> International Bank Account Number. | |
Iban *string `json:"iban,omitempty"` | |
// Id Unique identifier of the account. | |
Id *string `json:"id,omitempty"` | |
// Network <span class="enumtitle">Enum:</span> <span class="enum">"chiado"</span> <span class="enum">"goerli"</span> <span class="enum">"mumbai"</span> <span class="enum">"mainnet"</span></br> | |
// The blockchain network of the address. | |
Network *Network `json:"network,omitempty"` | |
// SortCode **Only present if `standard=scan`.** </br> The sort code is used by the British banking industry to route money transfers between banks domestically. The code identifies both the bank and the branch where the account is held. | |
SortCode *string `json:"sortCode,omitempty"` | |
// Standard Payment system standard for the bank payments. </br></br> **iban:** International Bank Account Number.</br> **scan:** Sort Code Account Number. used in the British banking industry to route money transfers between banks domestically. | |
Standard *interface{} `json:"standard,omitempty"` | |
// State State of the payment account.<br>The state will move from `requested` to `approved` when the account is provisioned. The `pending` state indicates that an account is being provisioned but it can't be done instantly. | |
State *interface{} `json:"state,omitempty"` | |
} | |
// AccountBalances defines model for AccountBalances. | |
type AccountBalances = []struct { | |
// Address The blockchain address. | |
Address *Address `json:"address,omitempty"` | |
// Balances The amount owned of currency | |
Balances *[]struct { | |
// Amount The amount of currency. | |
Amount *string `json:"amount,omitempty"` | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
Currency *Currency `json:"currency,omitempty"` | |
} `json:"balances,omitempty"` | |
// Chain <span class="enumtitle">Enum:</span> <span class="enum">"gnosis"</span> <span class="enum">"polygon"</span> <span class="enum">"ethereum"</span></br> | |
// Name of the blockchain | |
Chain *Chain `json:"chain,omitempty"` | |
// Id Unique identifier of the account. | |
Id *string `json:"id,omitempty"` | |
// Network <span class="enumtitle">Enum:</span> <span class="enum">"chiado"</span> <span class="enum">"goerli"</span> <span class="enum">"mumbai"</span> <span class="enum">"mainnet"</span></br> | |
// The blockchain network of the address. | |
Network *Network `json:"network,omitempty"` | |
} | |
// AccountId The Monerium account UUID. | |
type AccountId = string | |
// Address The blockchain address. | |
type Address = string | |
// Chain <span class="enumtitle">Enum:</span> <span class="enum">"gnosis"</span> <span class="enum">"polygon"</span> <span class="enum">"ethereum"</span></br> | |
// Name of the blockchain | |
type Chain = string | |
// ChainMultiSig defines model for ChainMultiSig. | |
type ChainMultiSig struct { | |
union json.RawMessage | |
} | |
// ChainMultiSig0 Gnosis Chain | |
type ChainMultiSig0 string | |
// ChainMultiSig1 Polygon PoS | |
type ChainMultiSig1 string | |
// ChainMultiSig2 Ethereum | |
type ChainMultiSig2 string | |
// Counterpart Information regarding the receiving party. | |
type Counterpart struct { | |
// Details Counterpart owner details. </br></br><strong>If the country code is not supplied, then the country prefix in the counterpart IBAN is used as default.</strong> | |
Details Counterpart_Details `json:"details"` | |
// Identifier Counterpart account information. | |
Identifier Counterpart_Identifier `json:"identifier"` | |
} | |
// CounterpartDetails0 Only one naming method is required. Either companyName or firstName and lastName | |
type CounterpartDetails0 struct { | |
// FirstName Used along lastName for outgoing payment when the recipient is an individual | |
FirstName string `json:"firstName"` | |
// LastName Used along firstName for outgoing payment when the recipient is an individual | |
LastName string `json:"lastName"` | |
} | |
// CounterpartDetails1 Only one naming method is required. Either companyName or firstName and lastName | |
type CounterpartDetails1 struct { | |
// CompanyName Used for outgoing payments when the recipient is a company | |
CompanyName string `json:"companyName"` | |
} | |
// Counterpart_Details Counterpart owner details. </br></br><strong>If the country code is not supplied, then the country prefix in the counterpart IBAN is used as default.</strong> | |
type Counterpart_Details struct { | |
Country *interface{} `json:"country,omitempty"` | |
union json.RawMessage | |
} | |
// CounterpartIdentifier0 defines model for . | |
type CounterpartIdentifier0 struct { | |
// Iban Valid IBAN. the IBAN may contain spaces. | |
Iban IBAN `json:"iban"` | |
// Standard Payment identifier used to route payments. | |
Standard CounterpartIdentifierStandard `json:"standard"` | |
} | |
// CounterpartIdentifier1 defines model for . | |
type CounterpartIdentifier1 struct { | |
// AccountNumber Valid bank account number at the institution and branch specified in the sort code. | |
AccountNumber ScanAccountNumber `json:"accountNumber"` | |
// SortCode SortCode. The code identifies both the bank and the branch where the account is held. | |
SortCode ScanSortCode `json:"sortCode"` | |
// Standard Payment identifier used to route payments. | |
Standard CounterpartIdentifierStandard `json:"standard"` | |
} | |
// Counterpart_Identifier Counterpart account information. | |
type Counterpart_Identifier struct { | |
union json.RawMessage | |
} | |
// CountryCode Two-letter country code [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | |
type CountryCode = string | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
type Currency string | |
// Error defines model for Error. | |
type Error struct { | |
Code int32 `json:"code"` | |
Message string `json:"message"` | |
Status string `json:"status"` | |
} | |
// IBAN Valid IBAN. the IBAN may contain spaces. | |
type IBAN = string | |
// Network <span class="enumtitle">Enum:</span> <span class="enum">"chiado"</span> <span class="enum">"goerli"</span> <span class="enum">"mumbai"</span> <span class="enum">"mainnet"</span></br> | |
// The blockchain network of the address. | |
type Network = string | |
// NetworkMultiSig defines model for NetworkMultiSig. | |
type NetworkMultiSig struct { | |
union json.RawMessage | |
} | |
// NetworkMultiSig0 Sandbox networks, Gnosis Chiado, Polygon Mumbai and Ethereum | |
// Goerli | |
type NetworkMultiSig0 = string | |
// NetworkMultiSig1 Production networks | |
type NetworkMultiSig1 string | |
// NewOrder defines model for NewOrder. | |
type NewOrder struct { | |
// Amount The quantity of money sent. Must be non-negative. | |
Amount string `json:"amount"` | |
// Counterpart Information regarding the receiving party. | |
Counterpart Counterpart `json:"counterpart"` | |
// Kind Identifier specifying the nature of the order. </br></br> Redeem order is when tokens are burned on blockchain and sent to bank. | |
Kind NewOrderKind `json:"kind"` | |
// Memo UTF-8 Payment reference / memo. Can be used as filter parameters when querying | |
// orders. | |
Memo *Reference `json:"memo,omitempty"` | |
// Message The message is composed as such: | |
// | |
// <strong><code>Send | |
// \<CURRENCY\> \<AMOUNT\> to \<IBAN\> at \<TIMESTAMP\></code></strong> </br></br> | |
// Note that the timestamp should be formatted as RFC3339 (2022-07-12T12:02:49.101452Z) | |
// and be accurate to the minute. | |
Message string `json:"message"` | |
// Signature The signature result of the `message` using the `address` corresponding private key. | |
Signature Signature `json:"signature"` | |
// SupportingDocumentId File UUID, Required for redeem orders with amount greater or equal to €15,000. See [adding supporting document for more details](/api-docs#operation/supporting-document). | |
SupportingDocumentId *string `json:"supportingDocumentId,omitempty"` | |
union json.RawMessage | |
} | |
// NewOrderKind Identifier specifying the nature of the order. </br></br> Redeem order is when tokens are burned on blockchain and sent to bank. | |
type NewOrderKind string | |
// NewOrder0 defines model for . | |
type NewOrder0 struct { | |
AccountId interface{} `json:"accountId"` | |
} | |
// NewOrder1 defines model for . | |
type NewOrder1 struct { | |
Address interface{} `json:"address"` | |
Chain NewOrder_Chain `json:"chain"` | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
Currency Currency `json:"currency"` | |
} | |
// NewOrder2 defines model for . | |
type NewOrder2 struct { | |
Address interface{} `json:"address"` | |
Chain ChainMultiSig `json:"chain"` | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
Currency Currency `json:"currency"` | |
Network NetworkMultiSig `json:"network"` | |
// Signature The signature result of the `message` using the `address` | |
// corresponding private key. </br></br> When connecting a multi-signature address, | |
// your application has to trigger the signature process before. | |
// | |
// The `signature` should be set as <span class="enum">"0x"</span>, and the `chain` and the `network` the smart contract address belongs to should be defined. | |
// The EMI then verifies if the contract owner has signed the `message`. | |
Signature *SignatureMultiSig `json:"signature,omitempty"` | |
} | |
// Order defines model for Order. | |
type Order struct { | |
AccountId *string `json:"accountId,omitempty"` | |
Address *string `json:"address,omitempty"` | |
// Amount The quantity of money sent. Must be non-negative. | |
Amount *string `json:"amount,omitempty"` | |
// Counterpart Information regarding the receiving party. | |
Counterpart *Counterpart `json:"counterpart,omitempty"` | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
Currency *Currency `json:"currency,omitempty"` | |
// Fees Fee breakdown. Currently Monerium takes care of all fees so this will always return an empty array. | |
Fees *[]struct { | |
Amount *string `json:"amount,omitempty"` | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
Currency *Currency `json:"currency,omitempty"` | |
// Provider Which payment provider the fee is going to | |
Provider *OrderFeesProvider `json:"provider,omitempty"` | |
} `json:"fees,omitempty"` | |
// Id The ID of the order | |
Id *string `json:"id,omitempty"` | |
// Kind Identifier specifying the nature of the order. Issue === mint, Redeem === burn. | |
Kind *OrderKind `json:"kind,omitempty"` | |
// Memo UTF-8 Payment reference / memo. Can be used as filter parameters when querying | |
// orders. | |
Memo *Reference `json:"memo,omitempty"` | |
Meta *struct { | |
// ApprovedAt When was the order approved | |
ApprovedAt *time.Time `json:"approvedAt,omitempty"` | |
// PlacedAt When was the order placed | |
PlacedAt *time.Time `json:"placedAt,omitempty"` | |
// PlacedBy Unique identifier of the emitter. When the emitter is Monerium the unique Identifier is equal to ‘00000000-0000-0000-0000-000000000000’ | |
PlacedBy *string `json:"placedBy,omitempty"` | |
// ProcessedAt When was the order processed | |
ProcessedAt *time.Time `json:"processedAt,omitempty"` | |
// ReceivedAmount How much has Monerium received, for redeem orders: when Monerium receives an on-chain payment in EURe, for issue orders: when Monerium receives a SEPA payment in EUR | |
ReceivedAmount *string `json:"receivedAmount,omitempty"` | |
// RejectedAt Timestamp written when the order was rejected. Only visible when the order has been rejected. | |
RejectedAt *time.Time `json:"rejectedAt,omitempty"` | |
// SentAmount How much has Monerium sent, for redeem orders: when Monerium has received an on-chain payment in EURe, burned it and sent the SEPA transfer. For issue orders: when Monerium has received the SEPA payment in EUR, minted it on-chain and sent the payment | |
SentAmount *string `json:"sentAmount,omitempty"` | |
// State The state of the order | |
State *OrderMetaState `json:"state,omitempty"` | |
} `json:"meta,omitempty"` | |
// Profile Unique identifier of the profile involved in the order. | |
Profile *string `json:"profile,omitempty"` | |
// RejectedReason Message stating why the order was rejected. Only visible when the order has been rejected. | |
RejectedReason *string `json:"rejectedReason,omitempty"` | |
// SupportingDocumentId The UUID of an File ID. | |
SupportingDocumentId *string `json:"supportingDocumentId,omitempty"` | |
// TotalFee Total amount of fees. | |
TotalFee *string `json:"totalFee,omitempty"` | |
} | |
// OrderFeesProvider Which payment provider the fee is going to | |
type OrderFeesProvider string | |
// OrderKind Identifier specifying the nature of the order. Issue === mint, Redeem === burn. | |
type OrderKind string | |
// OrderMetaState The state of the order | |
type OrderMetaState string | |
// Profile defines model for Profile. | |
type Profile struct { | |
Accounts *[]Account `json:"accounts,omitempty"` | |
// Id Unique identifier of the profile. The Profile ID is the main identifier used to represent ownership of other API resources | |
Id *string `json:"id,omitempty"` | |
// Kyc Information about how the state of the profile’s user kyc (Know Your Customer). | |
Kyc *struct { | |
// Outcome The verdict of the KYC from Monerium. Possible values:</br> **approved:** Valid customer</br> **rejected:** The applicant did not meet the KYC requirements.</br> **unknown:** The outcome has not been reached. | |
Outcome *ProfileKycOutcome `json:"outcome,omitempty"` | |
// State The state of the customer onboarding. Possible values:</br> **absent:** There is no KYC version available. </br>**submitted:** The user has submitted KYC data but it has not been processed. </br> **pending:** The admin has started processing the KYC application. </br> **confirmed:** An admin has decided on the outcome of a KYC application. | |
State *ProfileKycState `json:"state,omitempty"` | |
} `json:"kyc,omitempty"` | |
// Name The Profile name. This can be a corporate or an individual. | |
Name *string `json:"name,omitempty"` | |
} | |
// ProfileKycOutcome The verdict of the KYC from Monerium. Possible values:</br> **approved:** Valid customer</br> **rejected:** The applicant did not meet the KYC requirements.</br> **unknown:** The outcome has not been reached. | |
type ProfileKycOutcome string | |
// ProfileKycState The state of the customer onboarding. Possible values:</br> **absent:** There is no KYC version available. </br>**submitted:** The user has submitted KYC data but it has not been processed. </br> **pending:** The admin has started processing the KYC application. </br> **confirmed:** An admin has decided on the outcome of a KYC application. | |
type ProfileKycState string | |
// ProfileSummary defines model for ProfileSummary. | |
type ProfileSummary struct { | |
// Id Unique identifier of the profile. The Profile ID is the main identifier used to represent ownership of other API resources. | |
Id *string `json:"id,omitempty"` | |
// Name The Profile name. This can be a corporate or an individual. | |
Name *string `json:"name,omitempty"` | |
// Perms List containing the different identifiers specifying the permission the user has on the profile. | |
Perms *[]ProfileSummaryPerms `json:"perms,omitempty"` | |
// Type String identifier specifying the type of the profile. | |
Type *ProfileSummaryType `json:"type,omitempty"` | |
} | |
// ProfileSummaryPerms defines model for ProfileSummary.Perms. | |
type ProfileSummaryPerms string | |
// ProfileSummaryType String identifier specifying the type of the profile. | |
type ProfileSummaryType string | |
// Profiles defines model for Profiles. | |
type Profiles = []ProfileSummary | |
// Reference UTF-8 Payment reference / memo. Can be used as filter parameters when querying | |
// orders. | |
type Reference = string | |
// ScanAccountNumber Valid bank account number at the institution and branch specified in the sort code. | |
type ScanAccountNumber = string | |
// ScanSortCode SortCode. The code identifies both the bank and the branch where the account is held. | |
type ScanSortCode = string | |
// Signature The signature result of the `message` using the `address` corresponding private key. | |
type Signature = string | |
// SignatureMultiSig The signature result of the `message` using the `address` | |
// corresponding private key. </br></br> When connecting a multi-signature address, | |
// your application has to trigger the signature process before. | |
// | |
// The `signature` should be set as <span class="enum">"0x"</span>, and the `chain` and the `network` the smart contract address belongs to should be defined. | |
// The EMI then verifies if the contract owner has signed the `message`. | |
type SignatureMultiSig string | |
// Tokens defines model for Tokens. | |
type Tokens = []struct { | |
// Address The address of the asset | |
Address *string `json:"address,omitempty"` | |
// Chain <span class="enumtitle">Enum:</span> <span class="enum">"gnosis"</span> <span class="enum">"polygon"</span> <span class="enum">"ethereum"</span></br> | |
// Name of the blockchain | |
Chain *Chain `json:"chain,omitempty"` | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
Currency *Currency `json:"currency,omitempty"` | |
// Decimals Number of decimals accessible to the asset. | |
Decimals *string `json:"decimals,omitempty"` | |
// Network <span class="enumtitle">Enum:</span> <span class="enum">"chiado"</span> <span class="enum">"goerli"</span> <span class="enum">"mumbai"</span> <span class="enum">"mainnet"</span></br> | |
// The blockchain network of the address. | |
Network *Network `json:"network,omitempty"` | |
// Symbol The abbreviated name the cryptocurrency's coin. | |
Symbol *interface{} `json:"symbol,omitempty"` | |
// Ticker Short combination of letters representing the asset. | |
Ticker *interface{} `json:"ticker,omitempty"` | |
} | |
// UserContext defines model for UserContext. | |
type UserContext struct { | |
// Auth Informations about how the user was authenticated. | |
Auth *struct { | |
// Method The authentication method. | |
Method *UserContextAuthMethod `json:"method,omitempty"` | |
// Subject Identifier used during the authentication. The identifier used changes with the authentication method. When authenticated as a partner, the partnerID will be used. When using oauth, the client_id will be used. | |
Subject *string `json:"subject,omitempty"` | |
// Verified Boolean set to true after email address confirmation. | |
Verified *bool `json:"verified,omitempty"` | |
} `json:"auth,omitempty"` | |
// DefaultProfile Unique identifier of the default profile. The default profile allows the API consumer to use the simpler API endpoints omitting the profile ID from the structure. | |
DefaultProfile *string `json:"defaultProfile,omitempty"` | |
// Email An email address associated with the account. | |
Email *string `json:"email,omitempty"` | |
// Name The user name or alias. You can treat this as metadata. | |
Name *string `json:"name,omitempty"` | |
// Profiles List containing information about every profiles accessible to the User. | |
Profiles *[]ProfileSummary `json:"profiles,omitempty"` | |
// Roles List of Role | |
Roles *[]UserContextRoles `json:"roles,omitempty"` | |
// UserId Unique identifier of the User. | |
UserId *string `json:"userId,omitempty"` | |
} | |
// UserContextAuthMethod The authentication method. | |
type UserContextAuthMethod string | |
// UserContextRoles defines model for UserContext.Roles. | |
type UserContextRoles string | |
// AuthParams defines parameters for Auth. | |
type AuthParams struct { | |
// ClientId The Authentication Code Flow client ID received when registering an application with Monerium. | |
ClientId string `form:"client_id" json:"client_id"` | |
// CodeChallenge Generated challenge from the `code_verifier.` | |
CodeChallenge string `form:"code_challenge" json:"code_challenge"` | |
// CodeChallengeMethod Method used to generate the challenge (e.g., S256). | |
// | |
// The PKCE spec defines two methods, S256 and plain, the latter is discouraged. | |
CodeChallengeMethod *AuthParamsCodeChallengeMethod `form:"code_challenge_method,omitempty" json:"code_challenge_method,omitempty"` | |
// ResponseType The kind of credential that will be returned (`code` or `token`). Only `code` is supported. | |
ResponseType *string `form:"response_type,omitempty" json:"response_type,omitempty"` | |
// State **Recommended.** The state parameter will be included when redirecting back to your application. | |
// It can be used to store request-specific data and/or prevent [CSRF attacks](https://auth0.com/docs/secure/attack-protection/state-parameters). | |
State *string `form:"state,omitempty" json:"state,omitempty"` | |
// RedirectUri The URL to which will redirect the browser after authorization has been granted by the user. | |
// | |
// The Authorization Code will be available in the `code` URL parameter. | |
// | |
// If present, must match one of the registered redirect URLs exactly. | |
// Not required if only one redirect URL is registered. | |
// Only URLs with the HTTPS-scheme are supported with the exception of http://localhost. | |
RedirectUri *string `form:"redirect_uri,omitempty" json:"redirect_uri,omitempty"` | |
// Scope What capabilities to request. | |
Scope *string `form:"scope,omitempty" json:"scope,omitempty"` | |
Address *Address `form:"address,omitempty" json:"address,omitempty"` | |
// Signature The signature from signing the following message with the private key of the address. | |
// | |
// `I hereby declare that I am the address owner.`. | |
Signature *string `form:"signature,omitempty" json:"signature,omitempty"` | |
Network *Network `form:"network,omitempty" json:"network,omitempty"` | |
Chain *Chain `form:"chain,omitempty" json:"chain,omitempty"` | |
} | |
// AuthParamsCodeChallengeMethod defines parameters for Auth. | |
type AuthParamsCodeChallengeMethod string | |
// AuthTokenFormdataBody defines parameters for AuthToken. | |
type AuthTokenFormdataBody struct { | |
union json.RawMessage | |
} | |
// AuthTokenParams defines parameters for AuthToken. | |
type AuthTokenParams struct { | |
// GrantType Type of grant type, either authorization code for authentication flow, client credentials or refresh token | |
GrantType AuthTokenParamsGrantType `form:"grant_type" json:"grant_type"` | |
// ClientId The id of the partner/client application that is communicating to our API. | |
ClientId string `form:"client_id" json:"client_id"` | |
// ClientSecret **Required if** `grant_type=client_credentials`. </br> What capabilities to request. | |
ClientSecret *string `form:"client_secret,omitempty" json:"client_secret,omitempty"` | |
// Code **Required if** `grant_type=authorization_code`. </br> The authorization code that was acquired from partner flow. | |
Code *string `form:"code,omitempty" json:"code,omitempty"` | |
// CodeVerifier **Required if** `code=authorization_code`. </br> The randomized string that was used to create the `code_challenge` when a customer/user enters the partner authorization flow. | |
CodeVerifier *string `form:"code_verifier,omitempty" json:"code_verifier,omitempty"` | |
// RedirectUri **Required if** `code=authorization_code`. </br> The same redirect_uri that was used to acquire the `authorization_code`. | |
RedirectUri *string `form:"redirect_uri,omitempty" json:"redirect_uri,omitempty"` | |
// RefreshToken **Required if** `grant_type=refresh_token`. </br> What capabilities to request. | |
RefreshToken *string `form:"refresh_token,omitempty" json:"refresh_token,omitempty"` | |
// Scope What capabilities to request. | |
Scope *string `form:"scope,omitempty" json:"scope,omitempty"` | |
} | |
// AuthTokenParamsGrantType defines parameters for AuthToken. | |
type AuthTokenParamsGrantType string | |
// AuthTokenFormdataBody0 defines parameters for AuthToken. | |
type AuthTokenFormdataBody0 struct { | |
ClientId string `json:"client_id"` | |
Code string `json:"code"` | |
CodeVerifier string `json:"code_verifier"` | |
GrantType AuthTokenFormdataBodyGrantType `json:"grant_type"` | |
RedirectUri string `json:"redirect_uri"` | |
Scope *string `json:"scope,omitempty"` | |
} | |
// AuthTokenFormdataBody1 defines parameters for AuthToken. | |
type AuthTokenFormdataBody1 struct { | |
ClientId string `json:"client_id"` | |
GrantType AuthTokenFormdataBodyGrantType `json:"grant_type"` | |
RefreshToken string `json:"refresh_token"` | |
Scope *string `json:"scope,omitempty"` | |
} | |
// AuthTokenFormdataBody2 defines parameters for AuthToken. | |
type AuthTokenFormdataBody2 struct { | |
ClientId string `json:"client_id"` | |
ClientSecret string `json:"client_secret"` | |
GrantType AuthTokenFormdataBodyGrantType `json:"grant_type"` | |
Scope *string `json:"scope,omitempty"` | |
} | |
// SupportingDocumentFormdataBody defines parameters for SupportingDocument. | |
type SupportingDocumentFormdataBody struct { | |
// File Path to the file. | |
// | |
// Maximum length filename: **100**</br> | |
// Maximum size: **5 MB**</br> | |
// Allowed file types: **PDF**</br> | |
File string `json:"file"` | |
} | |
// OrdersParams defines parameters for Orders. | |
type OrdersParams struct { | |
// Address Get all orders belonging to a specific blockchain address. | |
Address *string `form:"address,omitempty" json:"address,omitempty"` | |
// TxHash The blockchains transaction hash. | |
TxHash *string `form:"txHash,omitempty" json:"txHash,omitempty"` | |
// Profile The Profile ID which the order belongs to. | |
Profile *string `form:"profile,omitempty" json:"profile,omitempty"` | |
Memo *Reference `form:"memo,omitempty" json:"memo,omitempty"` | |
// AccountId Get all orders that belong to a specific emoney account UUID. | |
AccountId *string `form:"accountId,omitempty" json:"accountId,omitempty"` | |
// State Get all orders in a particular state | |
State *OrdersParamsState `form:"state,omitempty" json:"state,omitempty"` | |
} | |
// OrdersParamsState defines parameters for Orders. | |
type OrdersParamsState string | |
// PostOrdersParams defines parameters for PostOrders. | |
type PostOrdersParams struct { | |
Automate *bool `form:"automate,omitempty" json:"automate,omitempty"` | |
} | |
// OrdersNotificationsParams defines parameters for OrdersNotifications. | |
type OrdersNotificationsParams struct { | |
// State Emits all orders in specific state. | |
State *OrdersNotificationsParamsState `form:"state,omitempty" json:"state,omitempty"` | |
// Profile Emit all orders that belong to a specific profile UUID. | |
Profile *string `form:"profile,omitempty" json:"profile,omitempty"` | |
} | |
// OrdersNotificationsParamsState defines parameters for OrdersNotifications. | |
type OrdersNotificationsParamsState string | |
// ProfileAddressesJSONBody defines parameters for ProfileAddresses. | |
type ProfileAddressesJSONBody struct { | |
// Accounts Choose which accounts should be visible by default in the Monerium UI. </br></br> How to activate EUR on Ethereum mainnet and USD on Polygon mainnet:</br>`[{"currency":"eur","chain":"ethereum","network":"mainnet"},{"currency":"usd","chain":"polygon","network":"mainnet"}]` | |
Accounts *[]struct { | |
// Chain <span class="enumtitle">Enum:</span> <span class="enum">"gnosis"</span> <span class="enum">"polygon"</span> <span class="enum">"ethereum"</span></br> | |
// Name of the blockchain | |
Chain *Chain `json:"chain,omitempty"` | |
// Currency Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. | |
Currency *Currency `json:"currency,omitempty"` | |
// Network <span class="enumtitle">Enum:</span> <span class="enum">"chiado"</span> <span class="enum">"goerli"</span> <span class="enum">"mumbai"</span> <span class="enum">"mainnet"</span></br> | |
// The blockchain network of the address. | |
Network *Network `json:"network,omitempty"` | |
} `json:"accounts,omitempty"` | |
// Address The blockchain address of the connecting wallet. | |
Address string `json:"address"` | |
// Message Fixed message to be signed with the private key corresponding to the given address. </br></br><strong><code>I hereby declare that I am the address owner.</code></strong> | |
Message string `json:"message"` | |
// Signature The signature result of the `message` using the `address` corresponding private key. | |
Signature Signature `json:"signature"` | |
union json.RawMessage | |
} | |
// ProfileAddressesJSONBody0 defines parameters for ProfileAddresses. | |
type ProfileAddressesJSONBody0 = interface{} | |
// ProfileAddressesJSONBody1 defines parameters for ProfileAddresses. | |
type ProfileAddressesJSONBody1 struct { | |
Chain ChainMultiSig `json:"chain"` | |
Network NetworkMultiSig `json:"network"` | |
// Signature The signature result of the `message` using the `address` | |
// corresponding private key. </br></br> When connecting a multi-signature address, | |
// your application has to trigger the signature process before. | |
// | |
// The `signature` should be set as <span class="enum">"0x"</span>, and the `chain` and the `network` the smart contract address belongs to should be defined. | |
// The EMI then verifies if the contract owner has signed the `message`. | |
Signature *SignatureMultiSig `json:"signature,omitempty"` | |
} | |
// ProfileOrdersParams defines parameters for ProfileOrders. | |
type ProfileOrdersParams struct { | |
// Address Get all orders belonging to a specific blockchain address. | |
Address *string `form:"address,omitempty" json:"address,omitempty"` | |
// TxHash The blockchains transaction hash. | |
TxHash *string `form:"txHash,omitempty" json:"txHash,omitempty"` | |
// Profile The Profile ID which the order belongs to. | |
Profile *string `form:"profile,omitempty" json:"profile,omitempty"` | |
Memo *Reference `form:"memo,omitempty" json:"memo,omitempty"` | |
// AccountId Get all orders that belong to a specific emoney account UUID. | |
AccountId *string `form:"accountId,omitempty" json:"accountId,omitempty"` | |
// State Get all orders in a particular state | |
State *ProfileOrdersParamsState `form:"state,omitempty" json:"state,omitempty"` | |
} | |
// ProfileOrdersParamsState defines parameters for ProfileOrders. | |
type ProfileOrdersParamsState string | |
// PostProfileOrdersParams defines parameters for PostProfileOrders. | |
type PostProfileOrdersParams struct { | |
Automate *bool `form:"automate,omitempty" json:"automate,omitempty"` | |
} | |
// ProfileOrdersNotificationsParams defines parameters for ProfileOrdersNotifications. | |
type ProfileOrdersNotificationsParams struct { | |
// State Emits all orders in specific state. | |
State *ProfileOrdersNotificationsParamsState `form:"state,omitempty" json:"state,omitempty"` | |
// Profile Emit all orders that belong to a specific profile UUID. | |
Profile *string `form:"profile,omitempty" json:"profile,omitempty"` | |
} | |
// ProfileOrdersNotificationsParamsState defines parameters for ProfileOrdersNotifications. | |
type ProfileOrdersNotificationsParamsState string | |
// AuthTokenFormdataRequestBody defines body for AuthToken for application/x-www-form-urlencoded ContentType. | |
type AuthTokenFormdataRequestBody AuthTokenFormdataBody | |
// SupportingDocumentFormdataRequestBody defines body for SupportingDocument for application/x-www-form-urlencoded ContentType. | |
type SupportingDocumentFormdataRequestBody SupportingDocumentFormdataBody | |
// PostOrdersJSONRequestBody defines body for PostOrders for application/json ContentType. | |
type PostOrdersJSONRequestBody = NewOrder | |
// ProfileAddressesJSONRequestBody defines body for ProfileAddresses for application/json ContentType. | |
type ProfileAddressesJSONRequestBody ProfileAddressesJSONBody | |
// PostProfileOrdersJSONRequestBody defines body for PostProfileOrders for application/json ContentType. | |
type PostProfileOrdersJSONRequestBody = NewOrder | |
// AsChainMultiSig0 returns the union data inside the ChainMultiSig as a ChainMultiSig0 | |
func (t ChainMultiSig) AsChainMultiSig0() (ChainMultiSig0, error) { | |
var body ChainMultiSig0 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromChainMultiSig0 overwrites any union data inside the ChainMultiSig as the provided ChainMultiSig0 | |
func (t *ChainMultiSig) FromChainMultiSig0(v ChainMultiSig0) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeChainMultiSig0 performs a merge with any union data inside the ChainMultiSig, using the provided ChainMultiSig0 | |
func (t *ChainMultiSig) MergeChainMultiSig0(v ChainMultiSig0) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
// AsChainMultiSig1 returns the union data inside the ChainMultiSig as a ChainMultiSig1 | |
func (t ChainMultiSig) AsChainMultiSig1() (ChainMultiSig1, error) { | |
var body ChainMultiSig1 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromChainMultiSig1 overwrites any union data inside the ChainMultiSig as the provided ChainMultiSig1 | |
func (t *ChainMultiSig) FromChainMultiSig1(v ChainMultiSig1) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeChainMultiSig1 performs a merge with any union data inside the ChainMultiSig, using the provided ChainMultiSig1 | |
func (t *ChainMultiSig) MergeChainMultiSig1(v ChainMultiSig1) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
// AsChainMultiSig2 returns the union data inside the ChainMultiSig as a ChainMultiSig2 | |
func (t ChainMultiSig) AsChainMultiSig2() (ChainMultiSig2, error) { | |
var body ChainMultiSig2 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromChainMultiSig2 overwrites any union data inside the ChainMultiSig as the provided ChainMultiSig2 | |
func (t *ChainMultiSig) FromChainMultiSig2(v ChainMultiSig2) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeChainMultiSig2 performs a merge with any union data inside the ChainMultiSig, using the provided ChainMultiSig2 | |
func (t *ChainMultiSig) MergeChainMultiSig2(v ChainMultiSig2) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
func (t ChainMultiSig) MarshalJSON() ([]byte, error) { | |
b, err := t.union.MarshalJSON() | |
return b, err | |
} | |
func (t *ChainMultiSig) UnmarshalJSON(b []byte) error { | |
err := t.union.UnmarshalJSON(b) | |
return err | |
} | |
// AsCounterpartDetails0 returns the union data inside the Counterpart_Details as a CounterpartDetails0 | |
func (t Counterpart_Details) AsCounterpartDetails0() (CounterpartDetails0, error) { | |
var body CounterpartDetails0 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromCounterpartDetails0 overwrites any union data inside the Counterpart_Details as the provided CounterpartDetails0 | |
func (t *Counterpart_Details) FromCounterpartDetails0(v CounterpartDetails0) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeCounterpartDetails0 performs a merge with any union data inside the Counterpart_Details, using the provided CounterpartDetails0 | |
func (t *Counterpart_Details) MergeCounterpartDetails0(v CounterpartDetails0) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
// AsCounterpartDetails1 returns the union data inside the Counterpart_Details as a CounterpartDetails1 | |
func (t Counterpart_Details) AsCounterpartDetails1() (CounterpartDetails1, error) { | |
var body CounterpartDetails1 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromCounterpartDetails1 overwrites any union data inside the Counterpart_Details as the provided CounterpartDetails1 | |
func (t *Counterpart_Details) FromCounterpartDetails1(v CounterpartDetails1) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeCounterpartDetails1 performs a merge with any union data inside the Counterpart_Details, using the provided CounterpartDetails1 | |
func (t *Counterpart_Details) MergeCounterpartDetails1(v CounterpartDetails1) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
func (t Counterpart_Details) MarshalJSON() ([]byte, error) { | |
b, err := t.union.MarshalJSON() | |
if err != nil { | |
return nil, err | |
} | |
object := make(map[string]json.RawMessage) | |
if t.union != nil { | |
err = json.Unmarshal(b, &object) | |
if err != nil { | |
return nil, err | |
} | |
} | |
if t.Country != nil { | |
object["country"], err = json.Marshal(t.Country) | |
if err != nil { | |
return nil, fmt.Errorf("error marshaling 'country': %w", err) | |
} | |
} | |
b, err = json.Marshal(object) | |
return b, err | |
} | |
func (t *Counterpart_Details) UnmarshalJSON(b []byte) error { | |
err := t.union.UnmarshalJSON(b) | |
if err != nil { | |
return err | |
} | |
object := make(map[string]json.RawMessage) | |
err = json.Unmarshal(b, &object) | |
if err != nil { | |
return err | |
} | |
if raw, found := object["country"]; found { | |
err = json.Unmarshal(raw, &t.Country) | |
if err != nil { | |
return fmt.Errorf("error reading 'country': %w", err) | |
} | |
} | |
return err | |
} | |
// AsCounterpartIdentifier0 returns the union data inside the Counterpart_Identifier as a CounterpartIdentifier0 | |
func (t Counterpart_Identifier) AsCounterpartIdentifier0() (CounterpartIdentifier0, error) { | |
var body CounterpartIdentifier0 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromCounterpartIdentifier0 overwrites any union data inside the Counterpart_Identifier as the provided CounterpartIdentifier0 | |
func (t *Counterpart_Identifier) FromCounterpartIdentifier0(v CounterpartIdentifier0) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeCounterpartIdentifier0 performs a merge with any union data inside the Counterpart_Identifier, using the provided CounterpartIdentifier0 | |
func (t *Counterpart_Identifier) MergeCounterpartIdentifier0(v CounterpartIdentifier0) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
// AsCounterpartIdentifier1 returns the union data inside the Counterpart_Identifier as a CounterpartIdentifier1 | |
func (t Counterpart_Identifier) AsCounterpartIdentifier1() (CounterpartIdentifier1, error) { | |
var body CounterpartIdentifier1 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromCounterpartIdentifier1 overwrites any union data inside the Counterpart_Identifier as the provided CounterpartIdentifier1 | |
func (t *Counterpart_Identifier) FromCounterpartIdentifier1(v CounterpartIdentifier1) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeCounterpartIdentifier1 performs a merge with any union data inside the Counterpart_Identifier, using the provided CounterpartIdentifier1 | |
func (t *Counterpart_Identifier) MergeCounterpartIdentifier1(v CounterpartIdentifier1) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
func (t Counterpart_Identifier) MarshalJSON() ([]byte, error) { | |
b, err := t.union.MarshalJSON() | |
return b, err | |
} | |
func (t *Counterpart_Identifier) UnmarshalJSON(b []byte) error { | |
err := t.union.UnmarshalJSON(b) | |
return err | |
} | |
// AsNetworkMultiSig0 returns the union data inside the NetworkMultiSig as a NetworkMultiSig0 | |
func (t NetworkMultiSig) AsNetworkMultiSig0() (NetworkMultiSig0, error) { | |
var body NetworkMultiSig0 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromNetworkMultiSig0 overwrites any union data inside the NetworkMultiSig as the provided NetworkMultiSig0 | |
func (t *NetworkMultiSig) FromNetworkMultiSig0(v NetworkMultiSig0) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeNetworkMultiSig0 performs a merge with any union data inside the NetworkMultiSig, using the provided NetworkMultiSig0 | |
func (t *NetworkMultiSig) MergeNetworkMultiSig0(v NetworkMultiSig0) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
// AsNetworkMultiSig1 returns the union data inside the NetworkMultiSig as a NetworkMultiSig1 | |
func (t NetworkMultiSig) AsNetworkMultiSig1() (NetworkMultiSig1, error) { | |
var body NetworkMultiSig1 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromNetworkMultiSig1 overwrites any union data inside the NetworkMultiSig as the provided NetworkMultiSig1 | |
func (t *NetworkMultiSig) FromNetworkMultiSig1(v NetworkMultiSig1) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeNetworkMultiSig1 performs a merge with any union data inside the NetworkMultiSig, using the provided NetworkMultiSig1 | |
func (t *NetworkMultiSig) MergeNetworkMultiSig1(v NetworkMultiSig1) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
func (t NetworkMultiSig) MarshalJSON() ([]byte, error) { | |
b, err := t.union.MarshalJSON() | |
return b, err | |
} | |
func (t *NetworkMultiSig) UnmarshalJSON(b []byte) error { | |
err := t.union.UnmarshalJSON(b) | |
return err | |
} | |
// AsNewOrder0 returns the union data inside the NewOrder as a NewOrder0 | |
func (t NewOrder) AsNewOrder0() (NewOrder0, error) { | |
var body NewOrder0 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromNewOrder0 overwrites any union data inside the NewOrder as the provided NewOrder0 | |
func (t *NewOrder) FromNewOrder0(v NewOrder0) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeNewOrder0 performs a merge with any union data inside the NewOrder, using the provided NewOrder0 | |
func (t *NewOrder) MergeNewOrder0(v NewOrder0) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
// AsNewOrder1 returns the union data inside the NewOrder as a NewOrder1 | |
func (t NewOrder) AsNewOrder1() (NewOrder1, error) { | |
var body NewOrder1 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromNewOrder1 overwrites any union data inside the NewOrder as the provided NewOrder1 | |
func (t *NewOrder) FromNewOrder1(v NewOrder1) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeNewOrder1 performs a merge with any union data inside the NewOrder, using the provided NewOrder1 | |
func (t *NewOrder) MergeNewOrder1(v NewOrder1) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
// AsNewOrder2 returns the union data inside the NewOrder as a NewOrder2 | |
func (t NewOrder) AsNewOrder2() (NewOrder2, error) { | |
var body NewOrder2 | |
err := json.Unmarshal(t.union, &body) | |
return body, err | |
} | |
// FromNewOrder2 overwrites any union data inside the NewOrder as the provided NewOrder2 | |
func (t *NewOrder) FromNewOrder2(v NewOrder2) error { | |
b, err := json.Marshal(v) | |
t.union = b | |
return err | |
} | |
// MergeNewOrder2 performs a merge with any union data inside the NewOrder, using the provided NewOrder2 | |
func (t *NewOrder) MergeNewOrder2(v NewOrder2) error { | |
b, err := json.Marshal(v) | |
if err != nil { | |
return err | |
} | |
merged, err := runtime.JsonMerge(b, t.union) | |
t.union = merged | |
return err | |
} | |
func (t NewOrder) MarshalJSON() ([]byte, error) { | |
b, err := t.union.MarshalJSON() | |
if err != nil { | |
return nil, err | |
} | |
object := make(map[string]json.RawMessage) | |
if t.union != nil { | |
err = json.Unmarshal(b, &object) | |
if err != nil { | |
return nil, err | |
} | |
} | |
object["amount"], err = json.Marshal(t.Amount) | |
if err != nil { | |
return nil, fmt.Errorf("error marshaling 'amount': %w", err) | |
} | |
object["counterpart"], err = json.Marshal(t.Counterpart) | |
if err != nil { | |
return nil, fmt.Errorf("error marshaling 'counterpart': %w", err) | |
} | |
object["kind"], err = json.Marshal(t.Kind) | |
if err != nil { | |
return nil, fmt.Errorf("error marshaling 'kind': %w", err) | |
} | |
if t.Memo != nil { | |
object["memo"], err = json.Marshal(t.Memo) | |
if err != nil { | |
return nil, fmt.Errorf("error marshaling 'memo': %w", err) | |
} | |
} | |
object["message"], err = json.Marshal(t.Message) | |
if err != nil { | |
return nil, fmt.Errorf("error marshaling 'message': %w", err) | |
} | |
object["signature"], err = json.Marshal(t.Signature) | |
if err != nil { | |
return nil, fmt.Errorf("error marshaling 'signature': %w", err) | |
} | |
if t.SupportingDocumentId != nil { | |
object["supportingDocumentId"], err = json.Marshal(t.SupportingDocumentId) | |
if err != nil { | |
return nil, fmt.Errorf("error marshaling 'supportingDocumentId': %w", err) | |
} | |
} | |
b, err = json.Marshal(object) | |
return b, err | |
} | |
func (t *NewOrder) UnmarshalJSON(b []byte) error { | |
err := t.union.UnmarshalJSON(b) | |
if err != nil { | |
return err | |
} | |
object := make(map[string]json.RawMessage) | |
err = json.Unmarshal(b, &object) | |
if err != nil { | |
return err | |
} | |
if raw, found := object["amount"]; found { | |
err = json.Unmarshal(raw, &t.Amount) | |
if err != nil { | |
return fmt.Errorf("error reading 'amount': %w", err) | |
} | |
} | |
if raw, found := object["counterpart"]; found { | |
err = json.Unmarshal(raw, &t.Counterpart) | |
if err != nil { | |
return fmt.Errorf("error reading 'counterpart': %w", err) | |
} | |
} | |
if raw, found := object["kind"]; found { | |
err = json.Unmarshal(raw, &t.Kind) | |
if err != nil { | |
return fmt.Errorf("error reading 'kind': %w", err) | |
} | |
} | |
if raw, found := object["memo"]; found { | |
err = json.Unmarshal(raw, &t.Memo) | |
if err != nil { | |
return fmt.Errorf("error reading 'memo': %w", err) | |
} | |
} | |
if raw, found := object["message"]; found { | |
err = json.Unmarshal(raw, &t.Message) | |
if err != nil { | |
return fmt.Errorf("error reading 'message': %w", err) | |
} | |
} | |
if raw, found := object["signature"]; found { | |
err = json.Unmarshal(raw, &t.Signature) | |
if err != nil { | |
return fmt.Errorf("error reading 'signature': %w", err) | |
} | |
} | |
if raw, found := object["supportingDocumentId"]; found { | |
err = json.Unmarshal(raw, &t.SupportingDocumentId) | |
if err != nil { | |
return fmt.Errorf("error reading 'supportingDocumentId': %w", err) | |
} | |
} | |
return err | |
} | |
// RequestEditorFn is the function signature for the RequestEditor callback function | |
type RequestEditorFn func(ctx context.Context, req *http.Request) error | |
// Doer performs HTTP requests. | |
// | |
// The standard http.Client implements this interface. | |
type HttpRequestDoer interface { | |
Do(req *http.Request) (*http.Response, error) | |
} | |
// Client which conforms to the OpenAPI3 specification for this service. | |
type Client struct { | |
// The endpoint of the server conforming to this interface, with scheme, | |
// https://api.deepmap.com for example. This can contain a path relative | |
// to the server, such as https://api.deepmap.com/dev-test, and all the | |
// paths in the swagger spec will be appended to the server. | |
Server string | |
// Doer for performing requests, typically a *http.Client with any | |
// customized settings, such as certificate chains. | |
Client HttpRequestDoer | |
// A list of callbacks for modifying requests which are generated before sending over | |
// the network. | |
RequestEditors []RequestEditorFn | |
} | |
// ClientOption allows setting custom parameters during construction | |
type ClientOption func(*Client) error | |
// Creates a new Client, with reasonable defaults | |
func NewClient(server string, opts ...ClientOption) (*Client, error) { | |
// create a client with sane default values | |
client := Client{ | |
Server: server, | |
} | |
// mutate client and add all optional params | |
for _, o := range opts { | |
if err := o(&client); err != nil { | |
return nil, err | |
} | |
} | |
// ensure the server URL always has a trailing slash | |
if !strings.HasSuffix(client.Server, "/") { | |
client.Server += "/" | |
} | |
// create httpClient, if not already present | |
if client.Client == nil { | |
client.Client = &http.Client{} | |
} | |
return &client, nil | |
} | |
// WithHTTPClient allows overriding the default Doer, which is | |
// automatically created using http.Client. This is useful for tests. | |
func WithHTTPClient(doer HttpRequestDoer) ClientOption { | |
return func(c *Client) error { | |
c.Client = doer | |
return nil | |
} | |
} | |
// WithRequestEditorFn allows setting up a callback function, which will be | |
// called right before sending the request. This can be used to mutate the request. | |
func WithRequestEditorFn(fn RequestEditorFn) ClientOption { | |
return func(c *Client) error { | |
c.RequestEditors = append(c.RequestEditors, fn) | |
return nil | |
} | |
} | |
// The interface specification for the client above. | |
type ClientInterface interface { | |
// Welcome request | |
Welcome(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// Auth request | |
Auth(ctx context.Context, params *AuthParams, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// AuthContext request | |
AuthContext(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// AuthToken request with any body | |
AuthTokenWithBody(ctx context.Context, params *AuthTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) | |
AuthTokenWithFormdataBody(ctx context.Context, params *AuthTokenParams, body AuthTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// Balances request | |
Balances(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// SupportingDocument request with any body | |
SupportingDocumentWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) | |
SupportingDocumentWithFormdataBody(ctx context.Context, body SupportingDocumentFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// Orders request | |
Orders(ctx context.Context, params *OrdersParams, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// PostOrders request with any body | |
PostOrdersWithBody(ctx context.Context, params *PostOrdersParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) | |
PostOrders(ctx context.Context, params *PostOrdersParams, body PostOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// OrdersNotifications request | |
OrdersNotifications(ctx context.Context, params *OrdersNotificationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// Order request | |
Order(ctx context.Context, orderId string, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// Profiles request | |
Profiles(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// Profile request | |
Profile(ctx context.Context, profileId string, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// ProfileAddresses request with any body | |
ProfileAddressesWithBody(ctx context.Context, profileId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) | |
ProfileAddresses(ctx context.Context, profileId string, body ProfileAddressesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// ProfileBalances request | |
ProfileBalances(ctx context.Context, profileId string, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// ProfileOrders request | |
ProfileOrders(ctx context.Context, profileId string, params *ProfileOrdersParams, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// PostProfileOrders request with any body | |
PostProfileOrdersWithBody(ctx context.Context, profileId string, params *PostProfileOrdersParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) | |
PostProfileOrders(ctx context.Context, profileId string, params *PostProfileOrdersParams, body PostProfileOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// ProfileOrdersNotifications request | |
ProfileOrdersNotifications(ctx context.Context, profileId string, params *ProfileOrdersNotificationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) | |
// Tokens request | |
Tokens(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) | |
} | |
func (c *Client) Welcome(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewWelcomeRequest(c.Server) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) Auth(ctx context.Context, params *AuthParams, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewAuthRequest(c.Server, params) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) AuthContext(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewAuthContextRequest(c.Server) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) AuthTokenWithBody(ctx context.Context, params *AuthTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewAuthTokenRequestWithBody(c.Server, params, contentType, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) AuthTokenWithFormdataBody(ctx context.Context, params *AuthTokenParams, body AuthTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewAuthTokenRequestWithFormdataBody(c.Server, params, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) Balances(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewBalancesRequest(c.Server) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) SupportingDocumentWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewSupportingDocumentRequestWithBody(c.Server, contentType, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) SupportingDocumentWithFormdataBody(ctx context.Context, body SupportingDocumentFormdataRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewSupportingDocumentRequestWithFormdataBody(c.Server, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) Orders(ctx context.Context, params *OrdersParams, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewOrdersRequest(c.Server, params) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) PostOrdersWithBody(ctx context.Context, params *PostOrdersParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewPostOrdersRequestWithBody(c.Server, params, contentType, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) PostOrders(ctx context.Context, params *PostOrdersParams, body PostOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewPostOrdersRequest(c.Server, params, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) OrdersNotifications(ctx context.Context, params *OrdersNotificationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewOrdersNotificationsRequest(c.Server, params) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) Order(ctx context.Context, orderId string, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewOrderRequest(c.Server, orderId) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) Profiles(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewProfilesRequest(c.Server) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) Profile(ctx context.Context, profileId string, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewProfileRequest(c.Server, profileId) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) ProfileAddressesWithBody(ctx context.Context, profileId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewProfileAddressesRequestWithBody(c.Server, profileId, contentType, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) ProfileAddresses(ctx context.Context, profileId string, body ProfileAddressesJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewProfileAddressesRequest(c.Server, profileId, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) ProfileBalances(ctx context.Context, profileId string, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewProfileBalancesRequest(c.Server, profileId) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) ProfileOrders(ctx context.Context, profileId string, params *ProfileOrdersParams, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewProfileOrdersRequest(c.Server, profileId, params) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) PostProfileOrdersWithBody(ctx context.Context, profileId string, params *PostProfileOrdersParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewPostProfileOrdersRequestWithBody(c.Server, profileId, params, contentType, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) PostProfileOrders(ctx context.Context, profileId string, params *PostProfileOrdersParams, body PostProfileOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewPostProfileOrdersRequest(c.Server, profileId, params, body) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) ProfileOrdersNotifications(ctx context.Context, profileId string, params *ProfileOrdersNotificationsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewProfileOrdersNotificationsRequest(c.Server, profileId, params) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
func (c *Client) Tokens(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { | |
req, err := NewTokensRequest(c.Server) | |
if err != nil { | |
return nil, err | |
} | |
req = req.WithContext(ctx) | |
if err := c.applyEditors(ctx, req, reqEditors); err != nil { | |
return nil, err | |
} | |
return c.Client.Do(req) | |
} | |
// NewWelcomeRequest generates requests for Welcome | |
func NewWelcomeRequest(server string) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewAuthRequest generates requests for Auth | |
func NewAuthRequest(server string, params *AuthParams) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/auth") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
queryValues := queryURL.Query() | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "client_id", runtime.ParamLocationQuery, params.ClientId); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code_challenge", runtime.ParamLocationQuery, params.CodeChallenge); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
if params.CodeChallengeMethod != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code_challenge_method", runtime.ParamLocationQuery, *params.CodeChallengeMethod); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.ResponseType != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "response_type", runtime.ParamLocationQuery, *params.ResponseType); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.State != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.RedirectUri != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "redirect_uri", runtime.ParamLocationQuery, *params.RedirectUri); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Scope != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "scope", runtime.ParamLocationQuery, *params.Scope); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Address != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "address", runtime.ParamLocationQuery, *params.Address); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Signature != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "signature", runtime.ParamLocationQuery, *params.Signature); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Network != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "network", runtime.ParamLocationQuery, *params.Network); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Chain != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "chain", runtime.ParamLocationQuery, *params.Chain); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
queryURL.RawQuery = queryValues.Encode() | |
req, err := http.NewRequest("POST", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewAuthContextRequest generates requests for AuthContext | |
func NewAuthContextRequest(server string) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/auth/context") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewAuthTokenRequestWithFormdataBody calls the generic AuthToken builder with application/x-www-form-urlencoded body | |
func NewAuthTokenRequestWithFormdataBody(server string, params *AuthTokenParams, body AuthTokenFormdataRequestBody) (*http.Request, error) { | |
var bodyReader io.Reader | |
bodyStr, err := runtime.MarshalForm(body, nil) | |
if err != nil { | |
return nil, err | |
} | |
bodyReader = strings.NewReader(bodyStr.Encode()) | |
return NewAuthTokenRequestWithBody(server, params, "application/x-www-form-urlencoded", bodyReader) | |
} | |
// NewAuthTokenRequestWithBody generates requests for AuthToken with any type of body | |
func NewAuthTokenRequestWithBody(server string, params *AuthTokenParams, contentType string, body io.Reader) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/auth/token") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
queryValues := queryURL.Query() | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "grant_type", runtime.ParamLocationQuery, params.GrantType); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "client_id", runtime.ParamLocationQuery, params.ClientId); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
if params.ClientSecret != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "client_secret", runtime.ParamLocationQuery, *params.ClientSecret); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Code != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code", runtime.ParamLocationQuery, *params.Code); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.CodeVerifier != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "code_verifier", runtime.ParamLocationQuery, *params.CodeVerifier); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.RedirectUri != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "redirect_uri", runtime.ParamLocationQuery, *params.RedirectUri); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.RefreshToken != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "refresh_token", runtime.ParamLocationQuery, *params.RefreshToken); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Scope != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "scope", runtime.ParamLocationQuery, *params.Scope); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
queryURL.RawQuery = queryValues.Encode() | |
req, err := http.NewRequest("POST", queryURL.String(), body) | |
if err != nil { | |
return nil, err | |
} | |
req.Header.Add("Content-Type", contentType) | |
return req, nil | |
} | |
// NewBalancesRequest generates requests for Balances | |
func NewBalancesRequest(server string) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/balances") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewSupportingDocumentRequestWithFormdataBody calls the generic SupportingDocument builder with application/x-www-form-urlencoded body | |
func NewSupportingDocumentRequestWithFormdataBody(server string, body SupportingDocumentFormdataRequestBody) (*http.Request, error) { | |
var bodyReader io.Reader | |
bodyStr, err := runtime.MarshalForm(body, nil) | |
if err != nil { | |
return nil, err | |
} | |
bodyReader = strings.NewReader(bodyStr.Encode()) | |
return NewSupportingDocumentRequestWithBody(server, "application/x-www-form-urlencoded", bodyReader) | |
} | |
// NewSupportingDocumentRequestWithBody generates requests for SupportingDocument with any type of body | |
func NewSupportingDocumentRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/files") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("POST", queryURL.String(), body) | |
if err != nil { | |
return nil, err | |
} | |
req.Header.Add("Content-Type", contentType) | |
return req, nil | |
} | |
// NewOrdersRequest generates requests for Orders | |
func NewOrdersRequest(server string, params *OrdersParams) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/orders") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
queryValues := queryURL.Query() | |
if params.Address != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "address", runtime.ParamLocationQuery, *params.Address); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.TxHash != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "txHash", runtime.ParamLocationQuery, *params.TxHash); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Profile != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "profile", runtime.ParamLocationQuery, *params.Profile); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Memo != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "memo", runtime.ParamLocationQuery, *params.Memo); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.AccountId != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "accountId", runtime.ParamLocationQuery, *params.AccountId); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.State != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
queryURL.RawQuery = queryValues.Encode() | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewPostOrdersRequest calls the generic PostOrders builder with application/json body | |
func NewPostOrdersRequest(server string, params *PostOrdersParams, body PostOrdersJSONRequestBody) (*http.Request, error) { | |
var bodyReader io.Reader | |
buf, err := json.Marshal(body) | |
if err != nil { | |
return nil, err | |
} | |
bodyReader = bytes.NewReader(buf) | |
return NewPostOrdersRequestWithBody(server, params, "application/json", bodyReader) | |
} | |
// NewPostOrdersRequestWithBody generates requests for PostOrders with any type of body | |
func NewPostOrdersRequestWithBody(server string, params *PostOrdersParams, contentType string, body io.Reader) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/orders") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
queryValues := queryURL.Query() | |
if params.Automate != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "automate", runtime.ParamLocationQuery, *params.Automate); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
queryURL.RawQuery = queryValues.Encode() | |
req, err := http.NewRequest("POST", queryURL.String(), body) | |
if err != nil { | |
return nil, err | |
} | |
req.Header.Add("Content-Type", contentType) | |
return req, nil | |
} | |
// NewOrdersNotificationsRequest generates requests for OrdersNotifications | |
func NewOrdersNotificationsRequest(server string, params *OrdersNotificationsParams) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/orders (websocket)") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
queryValues := queryURL.Query() | |
if params.State != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Profile != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "profile", runtime.ParamLocationQuery, *params.Profile); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
queryURL.RawQuery = queryValues.Encode() | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewOrderRequest generates requests for Order | |
func NewOrderRequest(server string, orderId string) (*http.Request, error) { | |
var err error | |
var pathParam0 string | |
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orderId", runtime.ParamLocationPath, orderId) | |
if err != nil { | |
return nil, err | |
} | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/orders/%s", pathParam0) | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewProfilesRequest generates requests for Profiles | |
func NewProfilesRequest(server string) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/profiles") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewProfileRequest generates requests for Profile | |
func NewProfileRequest(server string, profileId string) (*http.Request, error) { | |
var err error | |
var pathParam0 string | |
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "profileId", runtime.ParamLocationPath, profileId) | |
if err != nil { | |
return nil, err | |
} | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/profiles/%s", pathParam0) | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewProfileAddressesRequest calls the generic ProfileAddresses builder with application/json body | |
func NewProfileAddressesRequest(server string, profileId string, body ProfileAddressesJSONRequestBody) (*http.Request, error) { | |
var bodyReader io.Reader | |
buf, err := json.Marshal(body) | |
if err != nil { | |
return nil, err | |
} | |
bodyReader = bytes.NewReader(buf) | |
return NewProfileAddressesRequestWithBody(server, profileId, "application/json", bodyReader) | |
} | |
// NewProfileAddressesRequestWithBody generates requests for ProfileAddresses with any type of body | |
func NewProfileAddressesRequestWithBody(server string, profileId string, contentType string, body io.Reader) (*http.Request, error) { | |
var err error | |
var pathParam0 string | |
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "profileId", runtime.ParamLocationPath, profileId) | |
if err != nil { | |
return nil, err | |
} | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/profiles/%s/addresses", pathParam0) | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("POST", queryURL.String(), body) | |
if err != nil { | |
return nil, err | |
} | |
req.Header.Add("Content-Type", contentType) | |
return req, nil | |
} | |
// NewProfileBalancesRequest generates requests for ProfileBalances | |
func NewProfileBalancesRequest(server string, profileId string) (*http.Request, error) { | |
var err error | |
var pathParam0 string | |
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "profileId", runtime.ParamLocationPath, profileId) | |
if err != nil { | |
return nil, err | |
} | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/profiles/%s/balances", pathParam0) | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewProfileOrdersRequest generates requests for ProfileOrders | |
func NewProfileOrdersRequest(server string, profileId string, params *ProfileOrdersParams) (*http.Request, error) { | |
var err error | |
var pathParam0 string | |
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "profileId", runtime.ParamLocationPath, profileId) | |
if err != nil { | |
return nil, err | |
} | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/profiles/%s/orders", pathParam0) | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
queryValues := queryURL.Query() | |
if params.Address != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "address", runtime.ParamLocationQuery, *params.Address); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.TxHash != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "txHash", runtime.ParamLocationQuery, *params.TxHash); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Profile != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "profile", runtime.ParamLocationQuery, *params.Profile); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Memo != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "memo", runtime.ParamLocationQuery, *params.Memo); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.AccountId != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "accountId", runtime.ParamLocationQuery, *params.AccountId); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.State != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
queryURL.RawQuery = queryValues.Encode() | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewPostProfileOrdersRequest calls the generic PostProfileOrders builder with application/json body | |
func NewPostProfileOrdersRequest(server string, profileId string, params *PostProfileOrdersParams, body PostProfileOrdersJSONRequestBody) (*http.Request, error) { | |
var bodyReader io.Reader | |
buf, err := json.Marshal(body) | |
if err != nil { | |
return nil, err | |
} | |
bodyReader = bytes.NewReader(buf) | |
return NewPostProfileOrdersRequestWithBody(server, profileId, params, "application/json", bodyReader) | |
} | |
// NewPostProfileOrdersRequestWithBody generates requests for PostProfileOrders with any type of body | |
func NewPostProfileOrdersRequestWithBody(server string, profileId string, params *PostProfileOrdersParams, contentType string, body io.Reader) (*http.Request, error) { | |
var err error | |
var pathParam0 string | |
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "profileId", runtime.ParamLocationPath, profileId) | |
if err != nil { | |
return nil, err | |
} | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/profiles/%s/orders", pathParam0) | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
queryValues := queryURL.Query() | |
if params.Automate != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "automate", runtime.ParamLocationQuery, *params.Automate); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
queryURL.RawQuery = queryValues.Encode() | |
req, err := http.NewRequest("POST", queryURL.String(), body) | |
if err != nil { | |
return nil, err | |
} | |
req.Header.Add("Content-Type", contentType) | |
return req, nil | |
} | |
// NewProfileOrdersNotificationsRequest generates requests for ProfileOrdersNotifications | |
func NewProfileOrdersNotificationsRequest(server string, profileId string, params *ProfileOrdersNotificationsParams) (*http.Request, error) { | |
var err error | |
var pathParam0 string | |
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "profileId", runtime.ParamLocationPath, profileId) | |
if err != nil { | |
return nil, err | |
} | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/profiles/%s/orders (websocket)", pathParam0) | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
queryValues := queryURL.Query() | |
if params.State != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "state", runtime.ParamLocationQuery, *params.State); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
if params.Profile != nil { | |
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "profile", runtime.ParamLocationQuery, *params.Profile); err != nil { | |
return nil, err | |
} else if parsed, err := url.ParseQuery(queryFrag); err != nil { | |
return nil, err | |
} else { | |
for k, v := range parsed { | |
for _, v2 := range v { | |
queryValues.Add(k, v2) | |
} | |
} | |
} | |
} | |
queryURL.RawQuery = queryValues.Encode() | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
// NewTokensRequest generates requests for Tokens | |
func NewTokensRequest(server string) (*http.Request, error) { | |
var err error | |
serverURL, err := url.Parse(server) | |
if err != nil { | |
return nil, err | |
} | |
operationPath := fmt.Sprintf("/tokens") | |
if operationPath[0] == '/' { | |
operationPath = "." + operationPath | |
} | |
queryURL, err := serverURL.Parse(operationPath) | |
if err != nil { | |
return nil, err | |
} | |
req, err := http.NewRequest("GET", queryURL.String(), nil) | |
if err != nil { | |
return nil, err | |
} | |
return req, nil | |
} | |
func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { | |
for _, r := range c.RequestEditors { | |
if err := r(ctx, req); err != nil { | |
return err | |
} | |
} | |
for _, r := range additionalEditors { | |
if err := r(ctx, req); err != nil { | |
return err | |
} | |
} | |
return nil | |
} | |
// ClientWithResponses builds on ClientInterface to offer response payloads | |
type ClientWithResponses struct { | |
ClientInterface | |
} | |
// NewClientWithResponses creates a new ClientWithResponses, which wraps | |
// Client with return type handling | |
func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { | |
client, err := NewClient(server, opts...) | |
if err != nil { | |
return nil, err | |
} | |
return &ClientWithResponses{client}, nil | |
} | |
// WithBaseURL overrides the baseURL. | |
func WithBaseURL(baseURL string) ClientOption { | |
return func(c *Client) error { | |
newBaseURL, err := url.Parse(baseURL) | |
if err != nil { | |
return err | |
} | |
c.Server = newBaseURL.String() | |
return nil | |
} | |
} | |
// ClientWithResponsesInterface is the interface specification for the client with responses above. | |
type ClientWithResponsesInterface interface { | |
// Welcome request | |
WelcomeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*WelcomeResponse, error) | |
// Auth request | |
AuthWithResponse(ctx context.Context, params *AuthParams, reqEditors ...RequestEditorFn) (*AuthResponse, error) | |
// AuthContext request | |
AuthContextWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthContextResponse, error) | |
// AuthToken request with any body | |
AuthTokenWithBodyWithResponse(ctx context.Context, params *AuthTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthTokenResponse, error) | |
AuthTokenWithFormdataBodyWithResponse(ctx context.Context, params *AuthTokenParams, body AuthTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*AuthTokenResponse, error) | |
// Balances request | |
BalancesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*BalancesResponse, error) | |
// SupportingDocument request with any body | |
SupportingDocumentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SupportingDocumentResponse, error) | |
SupportingDocumentWithFormdataBodyWithResponse(ctx context.Context, body SupportingDocumentFormdataRequestBody, reqEditors ...RequestEditorFn) (*SupportingDocumentResponse, error) | |
// Orders request | |
OrdersWithResponse(ctx context.Context, params *OrdersParams, reqEditors ...RequestEditorFn) (*OrdersResponse, error) | |
// PostOrders request with any body | |
PostOrdersWithBodyWithResponse(ctx context.Context, params *PostOrdersParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostOrdersResponse, error) | |
PostOrdersWithResponse(ctx context.Context, params *PostOrdersParams, body PostOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostOrdersResponse, error) | |
// OrdersNotifications request | |
OrdersNotificationsWithResponse(ctx context.Context, params *OrdersNotificationsParams, reqEditors ...RequestEditorFn) (*OrdersNotificationsResponse, error) | |
// Order request | |
OrderWithResponse(ctx context.Context, orderId string, reqEditors ...RequestEditorFn) (*OrderResponse, error) | |
// Profiles request | |
ProfilesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ProfilesResponse, error) | |
// Profile request | |
ProfileWithResponse(ctx context.Context, profileId string, reqEditors ...RequestEditorFn) (*ProfileResponse, error) | |
// ProfileAddresses request with any body | |
ProfileAddressesWithBodyWithResponse(ctx context.Context, profileId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ProfileAddressesResponse, error) | |
ProfileAddressesWithResponse(ctx context.Context, profileId string, body ProfileAddressesJSONRequestBody, reqEditors ...RequestEditorFn) (*ProfileAddressesResponse, error) | |
// ProfileBalances request | |
ProfileBalancesWithResponse(ctx context.Context, profileId string, reqEditors ...RequestEditorFn) (*ProfileBalancesResponse, error) | |
// ProfileOrders request | |
ProfileOrdersWithResponse(ctx context.Context, profileId string, params *ProfileOrdersParams, reqEditors ...RequestEditorFn) (*ProfileOrdersResponse, error) | |
// PostProfileOrders request with any body | |
PostProfileOrdersWithBodyWithResponse(ctx context.Context, profileId string, params *PostProfileOrdersParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostProfileOrdersResponse, error) | |
PostProfileOrdersWithResponse(ctx context.Context, profileId string, params *PostProfileOrdersParams, body PostProfileOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostProfileOrdersResponse, error) | |
// ProfileOrdersNotifications request | |
ProfileOrdersNotificationsWithResponse(ctx context.Context, profileId string, params *ProfileOrdersNotificationsParams, reqEditors ...RequestEditorFn) (*ProfileOrdersNotificationsResponse, error) | |
// Tokens request | |
TokensWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TokensResponse, error) | |
} | |
type WelcomeResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *struct { | |
Docs *string `json:"docs,omitempty"` | |
Hello *string `json:"hello,omitempty"` | |
Twitter *string `json:"twitter,omitempty"` | |
} | |
} | |
// Status returns HTTPResponse.Status | |
func (r WelcomeResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r WelcomeResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type AuthResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
} | |
// Status returns HTTPResponse.Status | |
func (r AuthResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r AuthResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type AuthContextResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *UserContext | |
JSON401 *Error | |
} | |
// Status returns HTTPResponse.Status | |
func (r AuthContextResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r AuthContextResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type AuthTokenResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *AccessToken | |
} | |
// Status returns HTTPResponse.Status | |
func (r AuthTokenResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r AuthTokenResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type BalancesResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *interface{} | |
} | |
// Status returns HTTPResponse.Status | |
func (r BalancesResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r BalancesResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type SupportingDocumentResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *struct { | |
Hash *string `json:"hash,omitempty"` | |
// Id File ID | |
Id *string `json:"id,omitempty"` | |
Meta *struct { | |
CreatedAt *openapi_types.Date `json:"createdAt,omitempty"` | |
UpdatedAt *openapi_types.Date `json:"updatedAt,omitempty"` | |
// UploadedBy User ID of the uploader | |
UploadedBy *string `json:"uploadedBy,omitempty"` | |
} `json:"meta,omitempty"` | |
// Name File name | |
Name *string `json:"name,omitempty"` | |
// Size File size | |
Size *int `json:"size,omitempty"` | |
// Type File type | |
Type *string `json:"type,omitempty"` | |
} | |
} | |
// Status returns HTTPResponse.Status | |
func (r SupportingDocumentResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r SupportingDocumentResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type OrdersResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *[]Order | |
} | |
// Status returns HTTPResponse.Status | |
func (r OrdersResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r OrdersResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type PostOrdersResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *Order | |
} | |
// Status returns HTTPResponse.Status | |
func (r PostOrdersResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r PostOrdersResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type OrdersNotificationsResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *[]Order | |
} | |
// Status returns HTTPResponse.Status | |
func (r OrdersNotificationsResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r OrdersNotificationsResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type OrderResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *Order | |
} | |
// Status returns HTTPResponse.Status | |
func (r OrderResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r OrderResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type ProfilesResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *Profiles | |
JSON401 *Error | |
JSON403 *Error | |
} | |
// Status returns HTTPResponse.Status | |
func (r ProfilesResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r ProfilesResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type ProfileResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *Profile | |
JSON401 *Error | |
JSON403 *Error | |
} | |
// Status returns HTTPResponse.Status | |
func (r ProfileResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r ProfileResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type ProfileAddressesResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *Profile | |
JSON400 *Error | |
JSON401 *Error | |
JSON403 *Error | |
} | |
// Status returns HTTPResponse.Status | |
func (r ProfileAddressesResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r ProfileAddressesResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type ProfileBalancesResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *AccountBalances | |
JSON401 *Error | |
JSON403 *Error | |
} | |
// Status returns HTTPResponse.Status | |
func (r ProfileBalancesResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r ProfileBalancesResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type ProfileOrdersResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *[]Order | |
} | |
// Status returns HTTPResponse.Status | |
func (r ProfileOrdersResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r ProfileOrdersResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type PostProfileOrdersResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *[]Order | |
} | |
// Status returns HTTPResponse.Status | |
func (r PostProfileOrdersResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r PostProfileOrdersResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type ProfileOrdersNotificationsResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *Order | |
} | |
// Status returns HTTPResponse.Status | |
func (r ProfileOrdersNotificationsResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r ProfileOrdersNotificationsResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
type TokensResponse struct { | |
Body []byte | |
HTTPResponse *http.Response | |
JSON200 *Tokens | |
} | |
// Status returns HTTPResponse.Status | |
func (r TokensResponse) Status() string { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.Status | |
} | |
return http.StatusText(0) | |
} | |
// StatusCode returns HTTPResponse.StatusCode | |
func (r TokensResponse) StatusCode() int { | |
if r.HTTPResponse != nil { | |
return r.HTTPResponse.StatusCode | |
} | |
return 0 | |
} | |
// WelcomeWithResponse request returning *WelcomeResponse | |
func (c *ClientWithResponses) WelcomeWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*WelcomeResponse, error) { | |
rsp, err := c.Welcome(ctx, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseWelcomeResponse(rsp) | |
} | |
// AuthWithResponse request returning *AuthResponse | |
func (c *ClientWithResponses) AuthWithResponse(ctx context.Context, params *AuthParams, reqEditors ...RequestEditorFn) (*AuthResponse, error) { | |
rsp, err := c.Auth(ctx, params, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseAuthResponse(rsp) | |
} | |
// AuthContextWithResponse request returning *AuthContextResponse | |
func (c *ClientWithResponses) AuthContextWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*AuthContextResponse, error) { | |
rsp, err := c.AuthContext(ctx, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseAuthContextResponse(rsp) | |
} | |
// AuthTokenWithBodyWithResponse request with arbitrary body returning *AuthTokenResponse | |
func (c *ClientWithResponses) AuthTokenWithBodyWithResponse(ctx context.Context, params *AuthTokenParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthTokenResponse, error) { | |
rsp, err := c.AuthTokenWithBody(ctx, params, contentType, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseAuthTokenResponse(rsp) | |
} | |
func (c *ClientWithResponses) AuthTokenWithFormdataBodyWithResponse(ctx context.Context, params *AuthTokenParams, body AuthTokenFormdataRequestBody, reqEditors ...RequestEditorFn) (*AuthTokenResponse, error) { | |
rsp, err := c.AuthTokenWithFormdataBody(ctx, params, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseAuthTokenResponse(rsp) | |
} | |
// BalancesWithResponse request returning *BalancesResponse | |
func (c *ClientWithResponses) BalancesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*BalancesResponse, error) { | |
rsp, err := c.Balances(ctx, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseBalancesResponse(rsp) | |
} | |
// SupportingDocumentWithBodyWithResponse request with arbitrary body returning *SupportingDocumentResponse | |
func (c *ClientWithResponses) SupportingDocumentWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SupportingDocumentResponse, error) { | |
rsp, err := c.SupportingDocumentWithBody(ctx, contentType, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseSupportingDocumentResponse(rsp) | |
} | |
func (c *ClientWithResponses) SupportingDocumentWithFormdataBodyWithResponse(ctx context.Context, body SupportingDocumentFormdataRequestBody, reqEditors ...RequestEditorFn) (*SupportingDocumentResponse, error) { | |
rsp, err := c.SupportingDocumentWithFormdataBody(ctx, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseSupportingDocumentResponse(rsp) | |
} | |
// OrdersWithResponse request returning *OrdersResponse | |
func (c *ClientWithResponses) OrdersWithResponse(ctx context.Context, params *OrdersParams, reqEditors ...RequestEditorFn) (*OrdersResponse, error) { | |
rsp, err := c.Orders(ctx, params, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseOrdersResponse(rsp) | |
} | |
// PostOrdersWithBodyWithResponse request with arbitrary body returning *PostOrdersResponse | |
func (c *ClientWithResponses) PostOrdersWithBodyWithResponse(ctx context.Context, params *PostOrdersParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostOrdersResponse, error) { | |
rsp, err := c.PostOrdersWithBody(ctx, params, contentType, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParsePostOrdersResponse(rsp) | |
} | |
func (c *ClientWithResponses) PostOrdersWithResponse(ctx context.Context, params *PostOrdersParams, body PostOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostOrdersResponse, error) { | |
rsp, err := c.PostOrders(ctx, params, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParsePostOrdersResponse(rsp) | |
} | |
// OrdersNotificationsWithResponse request returning *OrdersNotificationsResponse | |
func (c *ClientWithResponses) OrdersNotificationsWithResponse(ctx context.Context, params *OrdersNotificationsParams, reqEditors ...RequestEditorFn) (*OrdersNotificationsResponse, error) { | |
rsp, err := c.OrdersNotifications(ctx, params, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseOrdersNotificationsResponse(rsp) | |
} | |
// OrderWithResponse request returning *OrderResponse | |
func (c *ClientWithResponses) OrderWithResponse(ctx context.Context, orderId string, reqEditors ...RequestEditorFn) (*OrderResponse, error) { | |
rsp, err := c.Order(ctx, orderId, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseOrderResponse(rsp) | |
} | |
// ProfilesWithResponse request returning *ProfilesResponse | |
func (c *ClientWithResponses) ProfilesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ProfilesResponse, error) { | |
rsp, err := c.Profiles(ctx, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseProfilesResponse(rsp) | |
} | |
// ProfileWithResponse request returning *ProfileResponse | |
func (c *ClientWithResponses) ProfileWithResponse(ctx context.Context, profileId string, reqEditors ...RequestEditorFn) (*ProfileResponse, error) { | |
rsp, err := c.Profile(ctx, profileId, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseProfileResponse(rsp) | |
} | |
// ProfileAddressesWithBodyWithResponse request with arbitrary body returning *ProfileAddressesResponse | |
func (c *ClientWithResponses) ProfileAddressesWithBodyWithResponse(ctx context.Context, profileId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ProfileAddressesResponse, error) { | |
rsp, err := c.ProfileAddressesWithBody(ctx, profileId, contentType, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseProfileAddressesResponse(rsp) | |
} | |
func (c *ClientWithResponses) ProfileAddressesWithResponse(ctx context.Context, profileId string, body ProfileAddressesJSONRequestBody, reqEditors ...RequestEditorFn) (*ProfileAddressesResponse, error) { | |
rsp, err := c.ProfileAddresses(ctx, profileId, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseProfileAddressesResponse(rsp) | |
} | |
// ProfileBalancesWithResponse request returning *ProfileBalancesResponse | |
func (c *ClientWithResponses) ProfileBalancesWithResponse(ctx context.Context, profileId string, reqEditors ...RequestEditorFn) (*ProfileBalancesResponse, error) { | |
rsp, err := c.ProfileBalances(ctx, profileId, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseProfileBalancesResponse(rsp) | |
} | |
// ProfileOrdersWithResponse request returning *ProfileOrdersResponse | |
func (c *ClientWithResponses) ProfileOrdersWithResponse(ctx context.Context, profileId string, params *ProfileOrdersParams, reqEditors ...RequestEditorFn) (*ProfileOrdersResponse, error) { | |
rsp, err := c.ProfileOrders(ctx, profileId, params, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseProfileOrdersResponse(rsp) | |
} | |
// PostProfileOrdersWithBodyWithResponse request with arbitrary body returning *PostProfileOrdersResponse | |
func (c *ClientWithResponses) PostProfileOrdersWithBodyWithResponse(ctx context.Context, profileId string, params *PostProfileOrdersParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostProfileOrdersResponse, error) { | |
rsp, err := c.PostProfileOrdersWithBody(ctx, profileId, params, contentType, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParsePostProfileOrdersResponse(rsp) | |
} | |
func (c *ClientWithResponses) PostProfileOrdersWithResponse(ctx context.Context, profileId string, params *PostProfileOrdersParams, body PostProfileOrdersJSONRequestBody, reqEditors ...RequestEditorFn) (*PostProfileOrdersResponse, error) { | |
rsp, err := c.PostProfileOrders(ctx, profileId, params, body, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParsePostProfileOrdersResponse(rsp) | |
} | |
// ProfileOrdersNotificationsWithResponse request returning *ProfileOrdersNotificationsResponse | |
func (c *ClientWithResponses) ProfileOrdersNotificationsWithResponse(ctx context.Context, profileId string, params *ProfileOrdersNotificationsParams, reqEditors ...RequestEditorFn) (*ProfileOrdersNotificationsResponse, error) { | |
rsp, err := c.ProfileOrdersNotifications(ctx, profileId, params, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseProfileOrdersNotificationsResponse(rsp) | |
} | |
// TokensWithResponse request returning *TokensResponse | |
func (c *ClientWithResponses) TokensWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*TokensResponse, error) { | |
rsp, err := c.Tokens(ctx, reqEditors...) | |
if err != nil { | |
return nil, err | |
} | |
return ParseTokensResponse(rsp) | |
} | |
// ParseWelcomeResponse parses an HTTP response from a WelcomeWithResponse call | |
func ParseWelcomeResponse(rsp *http.Response) (*WelcomeResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &WelcomeResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest struct { | |
Docs *string `json:"docs,omitempty"` | |
Hello *string `json:"hello,omitempty"` | |
Twitter *string `json:"twitter,omitempty"` | |
} | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseAuthResponse parses an HTTP response from a AuthWithResponse call | |
func ParseAuthResponse(rsp *http.Response) (*AuthResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &AuthResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
return response, nil | |
} | |
// ParseAuthContextResponse parses an HTTP response from a AuthContextWithResponse call | |
func ParseAuthContextResponse(rsp *http.Response) (*AuthContextResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &AuthContextResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest UserContext | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON401 = &dest | |
} | |
return response, nil | |
} | |
// ParseAuthTokenResponse parses an HTTP response from a AuthTokenWithResponse call | |
func ParseAuthTokenResponse(rsp *http.Response) (*AuthTokenResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &AuthTokenResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest AccessToken | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseBalancesResponse parses an HTTP response from a BalancesWithResponse call | |
func ParseBalancesResponse(rsp *http.Response) (*BalancesResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &BalancesResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest interface{} | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseSupportingDocumentResponse parses an HTTP response from a SupportingDocumentWithResponse call | |
func ParseSupportingDocumentResponse(rsp *http.Response) (*SupportingDocumentResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &SupportingDocumentResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest struct { | |
Hash *string `json:"hash,omitempty"` | |
// Id File ID | |
Id *string `json:"id,omitempty"` | |
Meta *struct { | |
CreatedAt *openapi_types.Date `json:"createdAt,omitempty"` | |
UpdatedAt *openapi_types.Date `json:"updatedAt,omitempty"` | |
// UploadedBy User ID of the uploader | |
UploadedBy *string `json:"uploadedBy,omitempty"` | |
} `json:"meta,omitempty"` | |
// Name File name | |
Name *string `json:"name,omitempty"` | |
// Size File size | |
Size *int `json:"size,omitempty"` | |
// Type File type | |
Type *string `json:"type,omitempty"` | |
} | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseOrdersResponse parses an HTTP response from a OrdersWithResponse call | |
func ParseOrdersResponse(rsp *http.Response) (*OrdersResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &OrdersResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest []Order | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParsePostOrdersResponse parses an HTTP response from a PostOrdersWithResponse call | |
func ParsePostOrdersResponse(rsp *http.Response) (*PostOrdersResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &PostOrdersResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest Order | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseOrdersNotificationsResponse parses an HTTP response from a OrdersNotificationsWithResponse call | |
func ParseOrdersNotificationsResponse(rsp *http.Response) (*OrdersNotificationsResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &OrdersNotificationsResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest []Order | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseOrderResponse parses an HTTP response from a OrderWithResponse call | |
func ParseOrderResponse(rsp *http.Response) (*OrderResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &OrderResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest Order | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseProfilesResponse parses an HTTP response from a ProfilesWithResponse call | |
func ParseProfilesResponse(rsp *http.Response) (*ProfilesResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &ProfilesResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest Profiles | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON401 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON403 = &dest | |
} | |
return response, nil | |
} | |
// ParseProfileResponse parses an HTTP response from a ProfileWithResponse call | |
func ParseProfileResponse(rsp *http.Response) (*ProfileResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &ProfileResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest Profile | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON401 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON403 = &dest | |
} | |
return response, nil | |
} | |
// ParseProfileAddressesResponse parses an HTTP response from a ProfileAddressesWithResponse call | |
func ParseProfileAddressesResponse(rsp *http.Response) (*ProfileAddressesResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &ProfileAddressesResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest Profile | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON400 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON401 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON403 = &dest | |
} | |
return response, nil | |
} | |
// ParseProfileBalancesResponse parses an HTTP response from a ProfileBalancesWithResponse call | |
func ParseProfileBalancesResponse(rsp *http.Response) (*ProfileBalancesResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &ProfileBalancesResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest AccountBalances | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON401 = &dest | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: | |
var dest Error | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON403 = &dest | |
} | |
return response, nil | |
} | |
// ParseProfileOrdersResponse parses an HTTP response from a ProfileOrdersWithResponse call | |
func ParseProfileOrdersResponse(rsp *http.Response) (*ProfileOrdersResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &ProfileOrdersResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest []Order | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParsePostProfileOrdersResponse parses an HTTP response from a PostProfileOrdersWithResponse call | |
func ParsePostProfileOrdersResponse(rsp *http.Response) (*PostProfileOrdersResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &PostProfileOrdersResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest []Order | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseProfileOrdersNotificationsResponse parses an HTTP response from a ProfileOrdersNotificationsWithResponse call | |
func ParseProfileOrdersNotificationsResponse(rsp *http.Response) (*ProfileOrdersNotificationsResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &ProfileOrdersNotificationsResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest Order | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ParseTokensResponse parses an HTTP response from a TokensWithResponse call | |
func ParseTokensResponse(rsp *http.Response) (*TokensResponse, error) { | |
bodyBytes, err := io.ReadAll(rsp.Body) | |
defer func() { _ = rsp.Body.Close() }() | |
if err != nil { | |
return nil, err | |
} | |
response := &TokensResponse{ | |
Body: bodyBytes, | |
HTTPResponse: rsp, | |
} | |
switch { | |
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: | |
var dest Tokens | |
if err := json.Unmarshal(bodyBytes, &dest); err != nil { | |
return nil, err | |
} | |
response.JSON200 = &dest | |
} | |
return response, nil | |
} | |
// ServerInterface represents all server handlers. | |
type ServerInterface interface { | |
// Welcome | |
// (GET /) | |
Welcome(ctx echo.Context) error | |
// Authorization flow | |
// (POST /auth) | |
Auth(ctx echo.Context, params AuthParams) error | |
// Get auth context | |
// (GET /auth/context) | |
AuthContext(ctx echo.Context) error | |
// Get access token | |
// (POST /auth/token) | |
AuthToken(ctx echo.Context, params AuthTokenParams) error | |
// Get all balances for accounts | |
// (GET /balances) | |
Balances(ctx echo.Context) error | |
// Add supporting document to order | |
// (POST /files) | |
SupportingDocument(ctx echo.Context) error | |
// Get all orders | |
// (GET /orders) | |
Orders(ctx echo.Context, params OrdersParams) error | |
// Place order | |
// (POST /orders) | |
PostOrders(ctx echo.Context, params PostOrdersParams) error | |
// Orders notifications | |
// (GET /orders (websocket)) | |
OrdersNotifications(ctx echo.Context, params OrdersNotificationsParams) error | |
// Get single order | |
// (GET /orders/{orderId}) | |
Order(ctx echo.Context, orderId string) error | |
// Get profiles | |
// (GET /profiles) | |
Profiles(ctx echo.Context) error | |
// Get profile | |
// (GET /profiles/{profileId}) | |
Profile(ctx echo.Context, profileId string) error | |
// Add address to profile. | |
// (POST /profiles/{profileId}/addresses) | |
ProfileAddresses(ctx echo.Context, profileId string) error | |
// Get balances | |
// (GET /profiles/{profileId}/balances) | |
ProfileBalances(ctx echo.Context, profileId string) error | |
// Get orders by profile | |
// (GET /profiles/{profileId}/orders) | |
ProfileOrders(ctx echo.Context, profileId string, params ProfileOrdersParams) error | |
// Place order by profile | |
// (POST /profiles/{profileId}/orders) | |
PostProfileOrders(ctx echo.Context, profileId string, params PostProfileOrdersParams) error | |
// Order notifications by profile | |
// (GET /profiles/{profileId}/orders (websocket)) | |
ProfileOrdersNotifications(ctx echo.Context, profileId string, params ProfileOrdersNotificationsParams) error | |
// Get tokens | |
// (GET /tokens) | |
Tokens(ctx echo.Context) error | |
} | |
// ServerInterfaceWrapper converts echo contexts to parameters. | |
type ServerInterfaceWrapper struct { | |
Handler ServerInterface | |
} | |
// Welcome converts echo context to params. | |
func (w *ServerInterfaceWrapper) Welcome(ctx echo.Context) error { | |
var err error | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.Welcome(ctx) | |
return err | |
} | |
// Auth converts echo context to params. | |
func (w *ServerInterfaceWrapper) Auth(ctx echo.Context) error { | |
var err error | |
// Parameter object where we will unmarshal all parameters from the context | |
var params AuthParams | |
// ------------- Required query parameter "client_id" ------------- | |
err = runtime.BindQueryParameter("form", true, true, "client_id", ctx.QueryParams(), ¶ms.ClientId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter client_id: %s", err)) | |
} | |
// ------------- Required query parameter "code_challenge" ------------- | |
err = runtime.BindQueryParameter("form", true, true, "code_challenge", ctx.QueryParams(), ¶ms.CodeChallenge) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter code_challenge: %s", err)) | |
} | |
// ------------- Optional query parameter "code_challenge_method" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "code_challenge_method", ctx.QueryParams(), ¶ms.CodeChallengeMethod) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter code_challenge_method: %s", err)) | |
} | |
// ------------- Optional query parameter "response_type" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "response_type", ctx.QueryParams(), ¶ms.ResponseType) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter response_type: %s", err)) | |
} | |
// ------------- Optional query parameter "state" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "state", ctx.QueryParams(), ¶ms.State) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter state: %s", err)) | |
} | |
// ------------- Optional query parameter "redirect_uri" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "redirect_uri", ctx.QueryParams(), ¶ms.RedirectUri) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter redirect_uri: %s", err)) | |
} | |
// ------------- Optional query parameter "scope" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "scope", ctx.QueryParams(), ¶ms.Scope) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter scope: %s", err)) | |
} | |
// ------------- Optional query parameter "address" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "address", ctx.QueryParams(), ¶ms.Address) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter address: %s", err)) | |
} | |
// ------------- Optional query parameter "signature" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "signature", ctx.QueryParams(), ¶ms.Signature) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter signature: %s", err)) | |
} | |
// ------------- Optional query parameter "network" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "network", ctx.QueryParams(), ¶ms.Network) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter network: %s", err)) | |
} | |
// ------------- Optional query parameter "chain" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "chain", ctx.QueryParams(), ¶ms.Chain) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter chain: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.Auth(ctx, params) | |
return err | |
} | |
// AuthContext converts echo context to params. | |
func (w *ServerInterfaceWrapper) AuthContext(ctx echo.Context) error { | |
var err error | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.AuthContext(ctx) | |
return err | |
} | |
// AuthToken converts echo context to params. | |
func (w *ServerInterfaceWrapper) AuthToken(ctx echo.Context) error { | |
var err error | |
// Parameter object where we will unmarshal all parameters from the context | |
var params AuthTokenParams | |
// ------------- Required query parameter "grant_type" ------------- | |
err = runtime.BindQueryParameter("form", true, true, "grant_type", ctx.QueryParams(), ¶ms.GrantType) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter grant_type: %s", err)) | |
} | |
// ------------- Required query parameter "client_id" ------------- | |
err = runtime.BindQueryParameter("form", true, true, "client_id", ctx.QueryParams(), ¶ms.ClientId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter client_id: %s", err)) | |
} | |
// ------------- Optional query parameter "client_secret" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "client_secret", ctx.QueryParams(), ¶ms.ClientSecret) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter client_secret: %s", err)) | |
} | |
// ------------- Optional query parameter "code" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "code", ctx.QueryParams(), ¶ms.Code) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter code: %s", err)) | |
} | |
// ------------- Optional query parameter "code_verifier" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "code_verifier", ctx.QueryParams(), ¶ms.CodeVerifier) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter code_verifier: %s", err)) | |
} | |
// ------------- Optional query parameter "redirect_uri" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "redirect_uri", ctx.QueryParams(), ¶ms.RedirectUri) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter redirect_uri: %s", err)) | |
} | |
// ------------- Optional query parameter "refresh_token" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "refresh_token", ctx.QueryParams(), ¶ms.RefreshToken) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter refresh_token: %s", err)) | |
} | |
// ------------- Optional query parameter "scope" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "scope", ctx.QueryParams(), ¶ms.Scope) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter scope: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.AuthToken(ctx, params) | |
return err | |
} | |
// Balances converts echo context to params. | |
func (w *ServerInterfaceWrapper) Balances(ctx echo.Context) error { | |
var err error | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.Balances(ctx) | |
return err | |
} | |
// SupportingDocument converts echo context to params. | |
func (w *ServerInterfaceWrapper) SupportingDocument(ctx echo.Context) error { | |
var err error | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.SupportingDocument(ctx) | |
return err | |
} | |
// Orders converts echo context to params. | |
func (w *ServerInterfaceWrapper) Orders(ctx echo.Context) error { | |
var err error | |
// Parameter object where we will unmarshal all parameters from the context | |
var params OrdersParams | |
// ------------- Optional query parameter "address" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "address", ctx.QueryParams(), ¶ms.Address) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter address: %s", err)) | |
} | |
// ------------- Optional query parameter "txHash" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "txHash", ctx.QueryParams(), ¶ms.TxHash) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter txHash: %s", err)) | |
} | |
// ------------- Optional query parameter "profile" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "profile", ctx.QueryParams(), ¶ms.Profile) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profile: %s", err)) | |
} | |
// ------------- Optional query parameter "memo" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "memo", ctx.QueryParams(), ¶ms.Memo) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter memo: %s", err)) | |
} | |
// ------------- Optional query parameter "accountId" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "accountId", ctx.QueryParams(), ¶ms.AccountId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter accountId: %s", err)) | |
} | |
// ------------- Optional query parameter "state" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "state", ctx.QueryParams(), ¶ms.State) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter state: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.Orders(ctx, params) | |
return err | |
} | |
// PostOrders converts echo context to params. | |
func (w *ServerInterfaceWrapper) PostOrders(ctx echo.Context) error { | |
var err error | |
// Parameter object where we will unmarshal all parameters from the context | |
var params PostOrdersParams | |
// ------------- Optional query parameter "automate" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "automate", ctx.QueryParams(), ¶ms.Automate) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter automate: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.PostOrders(ctx, params) | |
return err | |
} | |
// OrdersNotifications converts echo context to params. | |
func (w *ServerInterfaceWrapper) OrdersNotifications(ctx echo.Context) error { | |
var err error | |
// Parameter object where we will unmarshal all parameters from the context | |
var params OrdersNotificationsParams | |
// ------------- Optional query parameter "state" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "state", ctx.QueryParams(), ¶ms.State) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter state: %s", err)) | |
} | |
// ------------- Optional query parameter "profile" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "profile", ctx.QueryParams(), ¶ms.Profile) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profile: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.OrdersNotifications(ctx, params) | |
return err | |
} | |
// Order converts echo context to params. | |
func (w *ServerInterfaceWrapper) Order(ctx echo.Context) error { | |
var err error | |
// ------------- Path parameter "orderId" ------------- | |
var orderId string | |
err = runtime.BindStyledParameterWithLocation("simple", false, "orderId", runtime.ParamLocationPath, ctx.Param("orderId"), &orderId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter orderId: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.Order(ctx, orderId) | |
return err | |
} | |
// Profiles converts echo context to params. | |
func (w *ServerInterfaceWrapper) Profiles(ctx echo.Context) error { | |
var err error | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.Profiles(ctx) | |
return err | |
} | |
// Profile converts echo context to params. | |
func (w *ServerInterfaceWrapper) Profile(ctx echo.Context) error { | |
var err error | |
// ------------- Path parameter "profileId" ------------- | |
var profileId string | |
err = runtime.BindStyledParameterWithLocation("simple", false, "profileId", runtime.ParamLocationPath, ctx.Param("profileId"), &profileId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profileId: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.Profile(ctx, profileId) | |
return err | |
} | |
// ProfileAddresses converts echo context to params. | |
func (w *ServerInterfaceWrapper) ProfileAddresses(ctx echo.Context) error { | |
var err error | |
// ------------- Path parameter "profileId" ------------- | |
var profileId string | |
err = runtime.BindStyledParameterWithLocation("simple", false, "profileId", runtime.ParamLocationPath, ctx.Param("profileId"), &profileId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profileId: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.ProfileAddresses(ctx, profileId) | |
return err | |
} | |
// ProfileBalances converts echo context to params. | |
func (w *ServerInterfaceWrapper) ProfileBalances(ctx echo.Context) error { | |
var err error | |
// ------------- Path parameter "profileId" ------------- | |
var profileId string | |
err = runtime.BindStyledParameterWithLocation("simple", false, "profileId", runtime.ParamLocationPath, ctx.Param("profileId"), &profileId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profileId: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.ProfileBalances(ctx, profileId) | |
return err | |
} | |
// ProfileOrders converts echo context to params. | |
func (w *ServerInterfaceWrapper) ProfileOrders(ctx echo.Context) error { | |
var err error | |
// ------------- Path parameter "profileId" ------------- | |
var profileId string | |
err = runtime.BindStyledParameterWithLocation("simple", false, "profileId", runtime.ParamLocationPath, ctx.Param("profileId"), &profileId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profileId: %s", err)) | |
} | |
// Parameter object where we will unmarshal all parameters from the context | |
var params ProfileOrdersParams | |
// ------------- Optional query parameter "address" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "address", ctx.QueryParams(), ¶ms.Address) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter address: %s", err)) | |
} | |
// ------------- Optional query parameter "txHash" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "txHash", ctx.QueryParams(), ¶ms.TxHash) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter txHash: %s", err)) | |
} | |
// ------------- Optional query parameter "profile" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "profile", ctx.QueryParams(), ¶ms.Profile) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profile: %s", err)) | |
} | |
// ------------- Optional query parameter "memo" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "memo", ctx.QueryParams(), ¶ms.Memo) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter memo: %s", err)) | |
} | |
// ------------- Optional query parameter "accountId" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "accountId", ctx.QueryParams(), ¶ms.AccountId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter accountId: %s", err)) | |
} | |
// ------------- Optional query parameter "state" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "state", ctx.QueryParams(), ¶ms.State) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter state: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.ProfileOrders(ctx, profileId, params) | |
return err | |
} | |
// PostProfileOrders converts echo context to params. | |
func (w *ServerInterfaceWrapper) PostProfileOrders(ctx echo.Context) error { | |
var err error | |
// ------------- Path parameter "profileId" ------------- | |
var profileId string | |
err = runtime.BindStyledParameterWithLocation("simple", false, "profileId", runtime.ParamLocationPath, ctx.Param("profileId"), &profileId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profileId: %s", err)) | |
} | |
// Parameter object where we will unmarshal all parameters from the context | |
var params PostProfileOrdersParams | |
// ------------- Optional query parameter "automate" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "automate", ctx.QueryParams(), ¶ms.Automate) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter automate: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.PostProfileOrders(ctx, profileId, params) | |
return err | |
} | |
// ProfileOrdersNotifications converts echo context to params. | |
func (w *ServerInterfaceWrapper) ProfileOrdersNotifications(ctx echo.Context) error { | |
var err error | |
// ------------- Path parameter "profileId" ------------- | |
var profileId string | |
err = runtime.BindStyledParameterWithLocation("simple", false, "profileId", runtime.ParamLocationPath, ctx.Param("profileId"), &profileId) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profileId: %s", err)) | |
} | |
// Parameter object where we will unmarshal all parameters from the context | |
var params ProfileOrdersNotificationsParams | |
// ------------- Optional query parameter "state" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "state", ctx.QueryParams(), ¶ms.State) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter state: %s", err)) | |
} | |
// ------------- Optional query parameter "profile" ------------- | |
err = runtime.BindQueryParameter("form", true, false, "profile", ctx.QueryParams(), ¶ms.Profile) | |
if err != nil { | |
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter profile: %s", err)) | |
} | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.ProfileOrdersNotifications(ctx, profileId, params) | |
return err | |
} | |
// Tokens converts echo context to params. | |
func (w *ServerInterfaceWrapper) Tokens(ctx echo.Context) error { | |
var err error | |
// Invoke the callback with all the unmarshalled arguments | |
err = w.Handler.Tokens(ctx) | |
return err | |
} | |
// This is a simple interface which specifies echo.Route addition functions which | |
// are present on both echo.Echo and echo.Group, since we want to allow using | |
// either of them for path registration | |
type EchoRouter interface { | |
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route | |
} | |
// RegisterHandlers adds each server route to the EchoRouter. | |
func RegisterHandlers(router EchoRouter, si ServerInterface) { | |
RegisterHandlersWithBaseURL(router, si, "") | |
} | |
// Registers handlers, and prepends BaseURL to the paths, so that the paths | |
// can be served under a prefix. | |
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) { | |
wrapper := ServerInterfaceWrapper{ | |
Handler: si, | |
} | |
router.GET(baseURL+"/", wrapper.Welcome) | |
router.POST(baseURL+"/auth", wrapper.Auth) | |
router.GET(baseURL+"/auth/context", wrapper.AuthContext) | |
router.POST(baseURL+"/auth/token", wrapper.AuthToken) | |
router.GET(baseURL+"/balances", wrapper.Balances) | |
router.POST(baseURL+"/files", wrapper.SupportingDocument) | |
router.GET(baseURL+"/orders", wrapper.Orders) | |
router.POST(baseURL+"/orders", wrapper.PostOrders) | |
router.GET(baseURL+"/orders (websocket)", wrapper.OrdersNotifications) | |
router.GET(baseURL+"/orders/:orderId", wrapper.Order) | |
router.GET(baseURL+"/profiles", wrapper.Profiles) | |
router.GET(baseURL+"/profiles/:profileId", wrapper.Profile) | |
router.POST(baseURL+"/profiles/:profileId/addresses", wrapper.ProfileAddresses) | |
router.GET(baseURL+"/profiles/:profileId/balances", wrapper.ProfileBalances) | |
router.GET(baseURL+"/profiles/:profileId/orders", wrapper.ProfileOrders) | |
router.POST(baseURL+"/profiles/:profileId/orders", wrapper.PostProfileOrders) | |
router.GET(baseURL+"/profiles/:profileId/orders (websocket)", wrapper.ProfileOrdersNotifications) | |
router.GET(baseURL+"/tokens", wrapper.Tokens) | |
} | |
// Base64 encoded, gzipped, json marshaled Swagger object | |
var swaggerSpec = []string{ | |
"H4sIAAAAAAAC/+y9+XLcNro3fCuonqkaW9Xd4tabqlLnaE00ji1Fy8nYlioCSbAbEQkwBKh2J+Wqqe8q", | |
"vnMP71XNlbyFjUuTvSlyJu85nj8yVhPrgwfPhh8e/NYJaJJSgghnnYPfOiyYoQTKfx4GAWLshj4iIv5M", | |
"M5qijGMkP0L58SduvqJPMElj1DnonNIfkzRw8usPMBvOHP/NdNbpdvgiFR8ZzzCZdj53O+hTijPEfsL1", | |
"6u7QsorSmHA0RZk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
"updxgqYwutEv+q0PrWgouuxAAtO7AKnk6C1MFdHlDGaSn7smCFMZFJAXeivrv8I+LGe2No5RHDY2WLHl", | |
"DcMmiVovnrTpKhyWT3xJBbqvp1aL5ApTWCU9SnIif5UpLUzit/7viihVslRMAn8UDpyeO7Y8dRXUtwb2", | |
"hrux7d5/4dHt7W1gp+Y2AM9xm2pcvpuXtm68bbKo9SW/tji2DNZURbgU1XqllW23JvS0woM5erp5/0Oa", | |
"JT/8+oaP318T9xO7+fGHZ62LsoO3nWEGSUgTaZmoPsoJGpGvT1vK2GIRPdNPzsHiyty+NHgQ4ep8rNgA", | |
"bQbwuviciV6uoNabC2dxNj6+vf50O37zd5TiTyfJP0J8fHF28/bth7PvT5L/+vld6P3d+a+Zf3Z7fT29", | |
"teN/xBZ8v/jx/Zvx7PzD+el3E//06AT9fTQ+Ps/fUXRxHny4WPi//vrLWXz+LQp5EP999OHmzdnw2+Tq", | |
"6IMXhW+fpsOLf5DICeM/YF0YTMpwyU+5cCOW10UzoD4zaGl418hH0xuYz+f9teCU3fbdBk35LBGxLLf/", | |
"tIGc+655EvGIhos1pvWn3nw+7wnvopdnMSJiMcO6rb0qbfVhi7oVvlYj/XuhRNrC+yY5fOuHcm+2laho", | |
"4vUK9741HUOFMVvPHSTxt802X7MKqmpzWcTU+q3kolxNzU3Px5whHsxAnoYKxlg97JTmY82o6e+4PO00", | |
"ru+DdvIuvSL9XPoub7kVhK5Q8mrJiNtEv6Z5vCuR6pbD9mTcyuzbnhMrXNdGJT286ps7jZm3vhGiOvpC", | |
"4YHq2+fbQHqkv13hceWpV1/MXAXTyjB6QgzootI1UIBFk/xjJYb1FAaz4qC9cuGZIDWGLqDSMCnS6eio", | |
"axPZVbw1+zspuku+jKLPz1vTN44NmZhyoUx6FEnsAh/aHhFRijZVavaQcxjM1NW/VdkvU7igOWfgVS2f", | |
"0msAffqEgMqjKTOI1l7Eum62Vl74JjKTDw7MfW84zZBMCmHCAGnVX6Zx9a8Yq79u05jCELy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Qu2ILbgMOWwXUW0kc+fTUOurI", | |
"AhvJU856A4QQ9L4Df6ulazgAehBvb36w3v3898cPyQ+Di5u3zruTU/vDzYef3337Ifnw87n7t4f1wYCd", | |
"UIftiuvFQwNboQu/oh//rejHl0G1tWi6hjblxSuyrcryvBWqpn1uLVaV5Sff5mNdoB4FZN3iEcKuzl3S", | |
"eEjXGJM6uq3QGTJyVAHIdcG8moxT37gsj79FJX3evSkjoMxJAQr8iKxqcJuitQOghYya175Jkqj+fN3Y", | |
"6TcGLPLFllr3sK0TzSvFGcqe2sXMZUbDXIW+VCHQAxmCsdKofXDNZa5vRJ5wRkkik3mnuR/jIF6UucD7", | |
"4C1cCGsjhlMZBvTRTCanl2dolcqs33g9qiaHYZq25HC5hiT06adyhBF8RLuO8BJmmC8Uf6aNWc9n6spx", | |
"ksfKL0hRhtMZyhZAvzi1aegheup8vv/8fwMAAP//cebNAwnCAAA=", | |
} | |
// GetSwagger returns the content of the embedded swagger specification file | |
// or error if failed to decode | |
func decodeSpec() ([]byte, error) { | |
zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, "")) | |
if err != nil { | |
return nil, fmt.Errorf("error base64 decoding spec: %s", err) | |
} | |
zr, err := gzip.NewReader(bytes.NewReader(zipped)) | |
if err != nil { | |
return nil, fmt.Errorf("error decompressing spec: %s", err) | |
} | |
var buf bytes.Buffer | |
_, err = buf.ReadFrom(zr) | |
if err != nil { | |
return nil, fmt.Errorf("error decompressing spec: %s", err) | |
} | |
return buf.Bytes(), nil | |
} | |
var rawSpec = decodeSpecCached() | |
// a naive cached of a decoded swagger spec | |
func decodeSpecCached() func() ([]byte, error) { | |
data, err := decodeSpec() | |
return func() ([]byte, error) { | |
return data, err | |
} | |
} | |
// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. | |
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { | |
var res = make(map[string]func() ([]byte, error)) | |
if len(pathToFile) > 0 { | |
res[pathToFile] = rawSpec | |
} | |
return res | |
} | |
// GetSwagger returns the Swagger specification corresponding to the generated code | |
// in this file. The external references of Swagger specification are resolved. | |
// The logic of resolving external references is tightly connected to "import-mapping" feature. | |
// Externally referenced files must be embedded in the corresponding golang packages. | |
// Urls can be supported but this task was out of the scope. | |
func GetSwagger() (swagger *openapi3.T, err error) { | |
var resolvePath = PathToRawSpec("") | |
loader := openapi3.NewLoader() | |
loader.IsExternalRefsAllowed = true | |
loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { | |
var pathToFile = url.String() | |
pathToFile = path.Clean(pathToFile) | |
getSpec, ok := resolvePath[pathToFile] | |
if !ok { | |
err1 := fmt.Errorf("path not found: %s", pathToFile) | |
return nil, err1 | |
} | |
return getSpec() | |
} | |
var specData []byte | |
specData, err = rawSpec() | |
if err != nil { | |
return | |
} | |
swagger, err = loader.LoadFromData(specData) | |
if err != nil { | |
return | |
} | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment