From af634e3ae191e351d0a0658cbd84dd517f6e64e1 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 17:06:01 +0800 Subject: [PATCH 01/11] Add linting configuration file and linting script --- .golangci.yml | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 3 +++ 2 files changed, 70 insertions(+) create mode 100644 .golangci.yml diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000..46d3ef8 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,67 @@ +linters-settings: + exhaustive: + default-signifies-exhaustive: true + errcheck: + check-type-assertions: true + goconst: + min-len: 2 + min-occurrences: 3 + gocritic: + enabled-tags: + - diagnostic + - experimental + - opinionated + - performance + - style + govet: + check-shadowing: true + enable: + - fieldalignment + nolintlint: + require-explanation: true + require-specific: true + +linters: + disable-all: true + enable: + - bodyclose + - dogsled + - dupl + - errcheck + - exportloopref + - exhaustive + - goconst + - gocritic + - gofmt + - goimports + - gomnd + - gocyclo + - gosec + - gosimple + - govet + - ineffassign + - misspell + - nolintlint + - nakedret + - prealloc + - predeclared + - revive + - staticcheck + - stylecheck + - thelper + - tparallel + - typecheck + - unconvert + - unparam + - unused + - whitespace + - wsl + +issues: + exclude-rules: + - path: _test\.go$ + linters: + - goconst + +run: + issues-exit-code: 1 diff --git a/Makefile b/Makefile index 6039b4d..fead988 100644 --- a/Makefile +++ b/Makefile @@ -31,3 +31,6 @@ coverage: cat coverage.out | grep -v "/calls.go" | grep -v "custom_subscription_calls.go" | grep -v "subscription_calls.go" > coverage.final.out go tool cover -func=coverage.final.out rm coverage.out coverage.final.out + +lint: + golangci-lint run From c38a6c2c25b31157442cd34a2d47d152ce37bf78 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 17:14:56 +0800 Subject: [PATCH 02/11] Unify api reciver on methods --- bin/generate_calls.go | 12 +- calls.go | 732 ++--- custom_subscription_calls.go | 16 +- schema/account_list.go | 28 +- schema/account_list_resp.go | 190 +- schema/active_symbols.go | 212 +- schema/active_symbols_resp.go | 230 +- schema/api_token.go | 56 +- schema/api_token_resp.go | 151 +- schema/app_delete.go | 2 +- schema/app_delete_resp.go | 40 +- schema/app_get.go | 2 +- schema/app_get_resp.go | 58 +- schema/app_list.go | 36 +- schema/app_list_resp.go | 58 +- schema/app_markup_details.go | 88 +- schema/app_markup_details_resp.go | 40 +- schema/app_markup_statistics.go | 52 +- schema/app_markup_statistics_resp.go | 40 +- schema/app_register.go | 147 +- schema/app_register_resp.go | 58 +- schema/app_update.go | 74 +- schema/app_update_resp.go | 40 +- schema/asset_index.go | 67 +- schema/asset_index_resp.go | 42 +- schema/authorize.go | 52 +- schema/authorize_resp.go | 217 +- schema/balance.go | 52 +- schema/balance_resp.go | 138 +- schema/buy.go | 188 +- schema/buy_contract_for_multiple_accounts.go | 143 +- ...buy_contract_for_multiple_accounts_resp.go | 42 +- schema/buy_resp.go | 66 +- schema/cancel.go | 2 +- schema/cancel_resp.go | 40 +- schema/cashier.go | 95 +- schema/cashier_resp.go | 52 +- schema/confirm_email.go | 50 +- schema/confirm_email_resp.go | 40 +- schema/contract_update.go | 52 +- schema/contract_update_history.go | 50 +- schema/contract_update_history_resp.go | 40 +- schema/contract_update_resp.go | 40 +- schema/contracts_for.go | 28 +- schema/contracts_for_company.go | 61 +- schema/contracts_for_company_resp.go | 74 +- schema/contracts_for_resp.go | 136 +- schema/copy_start.go | 2 +- schema/copy_start_resp.go | 40 +- schema/copy_stop.go | 2 +- schema/copy_stop_resp.go | 40 +- schema/copytrading_list.go | 36 +- schema/copytrading_list_resp.go | 64 +- schema/copytrading_statistics.go | 36 +- schema/copytrading_statistics_resp.go | 62 +- schema/crypto_config.go | 44 +- schema/crypto_config_resp.go | 42 +- schema/crypto_estimations.go | 52 +- schema/crypto_estimations_resp.go | 48 +- schema/document_upload.go | 148 +- schema/document_upload_resp.go | 44 +- schema/economic_calendar.go | 50 +- schema/economic_calendar_resp.go | 40 +- schema/exchange_rates.go | 70 +- schema/exchange_rates_resp.go | 50 +- schema/forget.go | 2 +- schema/forget_all.go | 60 +- schema/forget_all_resp.go | 40 +- schema/forget_resp.go | 40 +- schema/get_account_status.go | 36 +- schema/get_account_status_resp.go | 1025 +++---- schema/get_financial_assessment.go | 40 +- schema/get_financial_assessment_resp.go | 40 +- schema/get_limits.go | 36 +- schema/get_limits_resp.go | 12 +- schema/get_self_exclusion.go | 40 +- schema/get_self_exclusion_resp.go | 40 +- schema/get_settings.go | 36 +- schema/get_settings_resp.go | 340 +-- schema/identity_verification_document_add.go | 60 +- ...identity_verification_document_add_resp.go | 42 +- schema/kyc_auth_status.go | 50 +- schema/kyc_auth_status_resp.go | 42 +- schema/landing_company.go | 2 +- schema/landing_company_details.go | 30 +- schema/landing_company_details_resp.go | 58 +- schema/landing_company_resp.go | 2708 ++++++++--------- schema/login_history.go | 42 +- schema/login_history_resp.go | 78 +- schema/logout.go | 36 +- schema/logout_resp.go | 40 +- schema/mt5_deposit.go | 56 +- schema/mt5_deposit_resp.go | 46 +- schema/mt5_get_settings.go | 44 +- schema/mt5_get_settings_resp.go | 272 +- schema/mt5_login_list.go | 36 +- schema/mt5_login_list_resp.go | 446 +-- schema/mt5_new_account.go | 239 +- schema/mt5_new_account_resp.go | 160 +- schema/mt5_password_change.go | 78 +- schema/mt5_password_change_resp.go | 40 +- schema/mt5_password_check.go | 64 +- schema/mt5_password_check_resp.go | 40 +- schema/mt5_password_reset.go | 78 +- schema/mt5_password_reset_resp.go | 40 +- schema/mt5_withdrawal.go | 60 +- schema/mt5_withdrawal_resp.go | 46 +- schema/new_account_maltainvest.go | 1038 ++++--- schema/new_account_maltainvest_resp.go | 46 +- schema/new_account_real.go | 348 ++- schema/new_account_real_resp.go | 46 +- schema/new_account_virtual.go | 87 +- schema/new_account_virtual_resp.go | 70 +- schema/oauth_apps.go | 36 +- schema/oauth_apps_resp.go | 92 +- schema/p2p_advert_create.go | 97 +- schema/p2p_advert_create_resp.go | 415 ++- schema/p2p_advert_info.go | 60 +- schema/p2p_advert_info_resp.go | 450 ++- schema/p2p_advert_list.go | 148 +- schema/p2p_advert_list_resp.go | 682 ++--- schema/p2p_advert_update.go | 230 +- schema/p2p_advert_update_resp.go | 554 ++-- schema/p2p_advertiser_adverts.go | 54 +- schema/p2p_advertiser_adverts_resp.go | 459 ++- schema/p2p_advertiser_create.go | 88 +- schema/p2p_advertiser_create_resp.go | 436 +-- schema/p2p_advertiser_info.go | 52 +- schema/p2p_advertiser_info_resp.go | 524 ++-- schema/p2p_advertiser_list.go | 79 +- schema/p2p_advertiser_list_resp.go | 352 +-- schema/p2p_advertiser_payment_methods.go | 56 +- schema/p2p_advertiser_payment_methods_resp.go | 40 +- schema/p2p_advertiser_relations.go | 54 +- schema/p2p_advertiser_relations_resp.go | 44 +- schema/p2p_advertiser_update.go | 98 +- schema/p2p_advertiser_update_resp.go | 502 +-- schema/p2p_chat_create.go | 44 +- schema/p2p_chat_create_resp.go | 44 +- schema/p2p_country_list.go | 42 +- schema/p2p_country_list_resp.go | 40 +- schema/p2p_order_cancel.go | 44 +- schema/p2p_order_cancel_resp.go | 58 +- schema/p2p_order_confirm.go | 56 +- schema/p2p_order_confirm_resp.go | 69 +- schema/p2p_order_create.go | 86 +- schema/p2p_order_create_resp.go | 809 +++-- schema/p2p_order_dispute.go | 22 +- schema/p2p_order_dispute_resp.go | 557 ++-- schema/p2p_order_info.go | 50 +- schema/p2p_order_info_resp.go | 577 ++-- schema/p2p_order_list.go | 84 +- schema/p2p_order_list_resp.go | 741 +++-- schema/p2p_order_review.go | 68 +- schema/p2p_order_review_resp.go | 72 +- schema/p2p_payment_methods.go | 36 +- schema/p2p_payment_methods_resp.go | 40 +- schema/p2p_ping.go | 38 +- schema/p2p_ping_resp.go | 44 +- schema/p2p_settings.go | 44 +- schema/p2p_settings_resp.go | 340 +-- schema/payment_methods.go | 44 +- schema/payment_methods_resp.go | 68 +- schema/paymentagent_create.go | 118 +- schema/paymentagent_create_resp.go | 34 +- schema/paymentagent_details.go | 36 +- schema/paymentagent_details_resp.go | 100 +- schema/paymentagent_list.go | 2 +- schema/paymentagent_list_resp.go | 80 +- schema/paymentagent_transfer.go | 74 +- schema/paymentagent_transfer_resp.go | 58 +- schema/paymentagent_withdraw.go | 84 +- schema/paymentagent_withdraw_justification.go | 42 +- ...aymentagent_withdraw_justification_resp.go | 40 +- schema/paymentagent_withdraw_resp.go | 52 +- schema/payout_currencies.go | 38 +- schema/payout_currencies_resp.go | 42 +- schema/ping.go | 30 +- schema/ping_resp.go | 44 +- schema/portfolio.go | 84 +- schema/portfolio_resp.go | 42 +- schema/profit_table.go | 124 +- schema/profit_table_resp.go | 40 +- schema/proposal.go | 210 +- schema/proposal_open_contract.go | 50 +- schema/proposal_open_contract_resp.go | 1104 +++---- schema/proposal_resp.go | 70 +- schema/reality_check.go | 42 +- schema/reality_check_resp.go | 40 +- schema/residence_list.go | 62 +- schema/residence_list_resp.go | 249 +- schema/revoke_oauth_app.go | 2 +- schema/revoke_oauth_app_resp.go | 40 +- schema/sell.go | 4 +- schema/sell_contract_for_multiple_accounts.go | 68 +- ...ell_contract_for_multiple_accounts_resp.go | 40 +- schema/sell_expired.go | 38 +- schema/sell_expired_resp.go | 40 +- schema/sell_resp.go | 40 +- schema/set_account_currency.go | 2 +- schema/set_account_currency_resp.go | 40 +- schema/set_financial_assessment.go | 2009 ++++++------ schema/set_financial_assessment_resp.go | 40 +- schema/set_self_exclusion.go | 62 +- schema/set_self_exclusion_resp.go | 40 +- schema/set_settings.go | 410 +-- schema/set_settings_resp.go | 40 +- schema/statement.go | 24 +- schema/statement_resp.go | 116 +- schema/states_list.go | 2 +- schema/states_list_resp.go | 40 +- schema/ticks.go | 36 +- schema/ticks_history.go | 91 +- schema/ticks_history_resp.go | 23 +- schema/ticks_resp.go | 52 +- schema/time.go | 28 +- schema/time_resp.go | 40 +- schema/tin_validations.go | 36 +- schema/tin_validations_resp.go | 70 +- schema/tnc_approval.go | 48 +- schema/tnc_approval_resp.go | 40 +- schema/topup_virtual.go | 38 +- schema/topup_virtual_resp.go | 40 +- schema/trading_durations.go | 24 +- schema/trading_durations_resp.go | 52 +- ...rading_platform_investor_password_reset.go | 80 +- ...g_platform_investor_password_reset_resp.go | 40 +- schema/trading_platform_password_reset.go | 78 +- .../trading_platform_password_reset_resp.go | 40 +- schema/trading_platform_status.go | 28 +- schema/trading_platform_status_resp.go | 42 +- schema/trading_servers.go | 118 +- schema/trading_servers_resp.go | 145 +- schema/trading_times.go | 2 +- schema/trading_times_resp.go | 101 +- schema/transaction.go | 46 +- schema/transaction_resp.go | 95 +- schema/transfer_between_accounts.go | 84 +- schema/transfer_between_accounts_resp.go | 221 +- schema/unsubscribe_email.go | 44 +- schema/unsubscribe_email_resp.go | 48 +- schema/verify_email.go | 80 +- schema/verify_email_resp.go | 40 +- schema/website_config.go | 28 +- schema/website_config_resp.go | 160 +- schema/website_status.go | 34 +- schema/website_status_resp.go | 468 +-- subscription_calls.go | 90 +- 248 files changed, 15866 insertions(+), 16025 deletions(-) diff --git a/bin/generate_calls.go b/bin/generate_calls.go index d51924f..023a372 100644 --- a/bin/generate_calls.go +++ b/bin/generate_calls.go @@ -86,12 +86,12 @@ func CreateTitle(name string) string { } func CreateApiCallFunction(title string, description string) string { - signature := fmt.Sprintf("// %s %s\nfunc (a *DerivAPI) %s(r schema.%s) (resp schema.%sResp, err error)", title, description, title, title, title) + signature := fmt.Sprintf("// %s %s\nfunc (api *DerivAPI) %s(r schema.%s) (resp schema.%sResp, err error)", title, description, title, title, title) body := fmt.Sprintf( - `id := a.getNextRequestID() + `id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return`) return fmt.Sprintf("%s {\n\t%s\n}\n\n", signature, body) @@ -116,14 +116,14 @@ func CreateSubscriptionCallFunction(title string, description string) string { Resp = initResp } - signature := fmt.Sprintf("// Subscribe%s %s\nfunc (a *DerivAPI) Subscribe%s(r schema.%s) (rsp schema.%s, s *Subsciption[schema.%s, schema.%s], err error)", title, description, title, title, initResp, initResp, Resp) + signature := fmt.Sprintf("// Subscribe%s %s\nfunc (api *DerivAPI) Subscribe%s(r schema.%s) (rsp schema.%s, s *Subsciption[schema.%s, schema.%s], err error)", title, description, title, title, initResp, initResp, Resp) body := fmt.Sprintf( - `id := a.getNextRequestID() + `id := api.getNextRequestID() var f schema.%sSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.%s, schema.%s](a) + s = NewSubcription[schema.%s, schema.%s](api) rsp, err = s.Start(id, r) return`, title, initResp, Resp) diff --git a/calls.go b/calls.go index 2caf653..0c5b3d6 100644 --- a/calls.go +++ b/calls.go @@ -5,978 +5,978 @@ package deriv import "github.com/ksysoev/deriv-api/schema" // AccountList Returns all accounts belonging to the authorized user. -func (a *DerivAPI) AccountList(r schema.AccountList) (resp schema.AccountListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AccountList(r schema.AccountList) (resp schema.AccountListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ActiveSymbols Retrieve a list of all currently active symbols (underlying markets upon which contracts are available for trading). -func (a *DerivAPI) ActiveSymbols(r schema.ActiveSymbols) (resp schema.ActiveSymbolsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ActiveSymbols(r schema.ActiveSymbols) (resp schema.ActiveSymbolsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ApiToken This call manages API tokens -func (a *DerivAPI) ApiToken(r schema.ApiToken) (resp schema.ApiTokenResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ApiToken(r schema.ApiToken) (resp schema.ApiTokenResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // AppDelete The request for deleting an application. -func (a *DerivAPI) AppDelete(r schema.AppDelete) (resp schema.AppDeleteResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AppDelete(r schema.AppDelete) (resp schema.AppDeleteResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // AppGet To get the information of the OAuth application specified by 'app_id' -func (a *DerivAPI) AppGet(r schema.AppGet) (resp schema.AppGetResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AppGet(r schema.AppGet) (resp schema.AppGetResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // AppList List all of the account's OAuth applications -func (a *DerivAPI) AppList(r schema.AppList) (resp schema.AppListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AppList(r schema.AppList) (resp schema.AppListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // AppMarkupDetails Retrieve details of `app_markup` according to criteria specified. -func (a *DerivAPI) AppMarkupDetails(r schema.AppMarkupDetails) (resp schema.AppMarkupDetailsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AppMarkupDetails(r schema.AppMarkupDetails) (resp schema.AppMarkupDetailsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // AppMarkupStatistics Retrieve statistics of `app_markup`. -func (a *DerivAPI) AppMarkupStatistics(r schema.AppMarkupStatistics) (resp schema.AppMarkupStatisticsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AppMarkupStatistics(r schema.AppMarkupStatistics) (resp schema.AppMarkupStatisticsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // AppRegister Register a new OAuth application -func (a *DerivAPI) AppRegister(r schema.AppRegister) (resp schema.AppRegisterResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AppRegister(r schema.AppRegister) (resp schema.AppRegisterResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // AppUpdate Update a new OAuth application -func (a *DerivAPI) AppUpdate(r schema.AppUpdate) (resp schema.AppUpdateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AppUpdate(r schema.AppUpdate) (resp schema.AppUpdateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // AssetIndex Retrieve a list of all available underlyings and the corresponding contract types and duration boundaries. If the user is logged in, only the assets available for that user's landing company will be returned. -func (a *DerivAPI) AssetIndex(r schema.AssetIndex) (resp schema.AssetIndexResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) AssetIndex(r schema.AssetIndex) (resp schema.AssetIndexResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Authorize Authorize current WebSocket session to act on behalf of the owner of a given token. Must precede requests that need to access client account, for example purchasing and selling contracts or viewing portfolio. -func (a *DerivAPI) Authorize(r schema.Authorize) (resp schema.AuthorizeResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Authorize(r schema.Authorize) (resp schema.AuthorizeResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Balance Get user account balance -func (a *DerivAPI) Balance(r schema.Balance) (resp schema.BalanceResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Balance(r schema.Balance) (resp schema.BalanceResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Buy Buy a Contract -func (a *DerivAPI) Buy(r schema.Buy) (resp schema.BuyResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Buy(r schema.Buy) (resp schema.BuyResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // BuyContractForMultipleAccounts Buy a Contract for multiple Accounts specified by the `tokens` parameter. Note, although this is an authorized call, the contract is not bought for the authorized account. -func (a *DerivAPI) BuyContractForMultipleAccounts(r schema.BuyContractForMultipleAccounts) (resp schema.BuyContractForMultipleAccountsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) BuyContractForMultipleAccounts(r schema.BuyContractForMultipleAccounts) (resp schema.BuyContractForMultipleAccountsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Cancel Cancel contract with contract id -func (a *DerivAPI) Cancel(r schema.Cancel) (resp schema.CancelResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Cancel(r schema.Cancel) (resp schema.CancelResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Cashier Request the cashier info for the specified type. -func (a *DerivAPI) Cashier(r schema.Cashier) (resp schema.CashierResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Cashier(r schema.Cashier) (resp schema.CashierResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ConfirmEmail Verifies the email for the user using verification code passed in the request object -func (a *DerivAPI) ConfirmEmail(r schema.ConfirmEmail) (resp schema.ConfirmEmailResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ConfirmEmail(r schema.ConfirmEmail) (resp schema.ConfirmEmailResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ContractUpdate Update a contract condition. -func (a *DerivAPI) ContractUpdate(r schema.ContractUpdate) (resp schema.ContractUpdateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ContractUpdate(r schema.ContractUpdate) (resp schema.ContractUpdateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ContractUpdateHistory Request for contract update history. -func (a *DerivAPI) ContractUpdateHistory(r schema.ContractUpdateHistory) (resp schema.ContractUpdateHistoryResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ContractUpdateHistory(r schema.ContractUpdateHistory) (resp schema.ContractUpdateHistoryResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ContractsFor For a given symbol, get the list of currently available contracts, and the latest barrier and duration limits for each contract. -func (a *DerivAPI) ContractsFor(r schema.ContractsFor) (resp schema.ContractsForResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ContractsFor(r schema.ContractsFor) (resp schema.ContractsForResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ContractsForCompany Get the list of currently available contracts for a given landing company. -func (a *DerivAPI) ContractsForCompany(r schema.ContractsForCompany) (resp schema.ContractsForCompanyResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ContractsForCompany(r schema.ContractsForCompany) (resp schema.ContractsForCompanyResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // CopyStart Start copy trader bets -func (a *DerivAPI) CopyStart(r schema.CopyStart) (resp schema.CopyStartResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) CopyStart(r schema.CopyStart) (resp schema.CopyStartResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // CopyStop Stop copy trader bets -func (a *DerivAPI) CopyStop(r schema.CopyStop) (resp schema.CopyStopResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) CopyStop(r schema.CopyStop) (resp schema.CopyStopResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // CopytradingList Retrieves a list of active copiers and/or traders for Copy Trading -func (a *DerivAPI) CopytradingList(r schema.CopytradingList) (resp schema.CopytradingListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) CopytradingList(r schema.CopytradingList) (resp schema.CopytradingListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // CopytradingStatistics Retrieve performance, trading, risk and copiers statistics of trader. -func (a *DerivAPI) CopytradingStatistics(r schema.CopytradingStatistics) (resp schema.CopytradingStatisticsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) CopytradingStatistics(r schema.CopytradingStatistics) (resp schema.CopytradingStatisticsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // CryptoConfig The request for cryptocurrencies configuration. -func (a *DerivAPI) CryptoConfig(r schema.CryptoConfig) (resp schema.CryptoConfigResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) CryptoConfig(r schema.CryptoConfig) (resp schema.CryptoConfigResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // CryptoEstimations Get the current estimations for cryptocurrencies. E.g. Withdrawal fee. -func (a *DerivAPI) CryptoEstimations(r schema.CryptoEstimations) (resp schema.CryptoEstimationsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) CryptoEstimations(r schema.CryptoEstimations) (resp schema.CryptoEstimationsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // DocumentUpload Request KYC information from client -func (a *DerivAPI) DocumentUpload(r schema.DocumentUpload) (resp schema.DocumentUploadResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) DocumentUpload(r schema.DocumentUpload) (resp schema.DocumentUploadResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // EconomicCalendar Specify a currency to receive a list of events related to that specific currency. For example, specifying USD will return a list of USD-related events. If the currency is omitted, you will receive a list for all currencies. -func (a *DerivAPI) EconomicCalendar(r schema.EconomicCalendar) (resp schema.EconomicCalendarResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) EconomicCalendar(r schema.EconomicCalendar) (resp schema.EconomicCalendarResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ExchangeRates Retrieves the exchange rate from a base currency to a target currency supported by the system. -func (a *DerivAPI) ExchangeRates(r schema.ExchangeRates) (resp schema.ExchangeRatesResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ExchangeRates(r schema.ExchangeRates) (resp schema.ExchangeRatesResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Forget Immediately cancel the real-time stream of messages with a specific ID. -func (a *DerivAPI) Forget(r schema.Forget) (resp schema.ForgetResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Forget(r schema.Forget) (resp schema.ForgetResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ForgetAll Immediately cancel the real-time streams of messages of given type. -func (a *DerivAPI) ForgetAll(r schema.ForgetAll) (resp schema.ForgetAllResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ForgetAll(r schema.ForgetAll) (resp schema.ForgetAllResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // GetAccountStatus Get Account Status -func (a *DerivAPI) GetAccountStatus(r schema.GetAccountStatus) (resp schema.GetAccountStatusResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) GetAccountStatus(r schema.GetAccountStatus) (resp schema.GetAccountStatusResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // GetFinancialAssessment This call gets the financial assessment details. The 'financial assessment' is a questionnaire that clients of certain Landing Companies need to complete, due to regulatory and KYC (know your client) requirements. -func (a *DerivAPI) GetFinancialAssessment(r schema.GetFinancialAssessment) (resp schema.GetFinancialAssessmentResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) GetFinancialAssessment(r schema.GetFinancialAssessment) (resp schema.GetFinancialAssessmentResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // GetLimits Trading and Withdrawal Limits for a given user -func (a *DerivAPI) GetLimits(r schema.GetLimits) (resp schema.GetLimitsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) GetLimits(r schema.GetLimits) (resp schema.GetLimitsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // GetSelfExclusion Allows users to exclude themselves from the website for certain periods of time, or to set limits on their trading activities. This facility is a regulatory requirement for certain Landing Companies. -func (a *DerivAPI) GetSelfExclusion(r schema.GetSelfExclusion) (resp schema.GetSelfExclusionResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) GetSelfExclusion(r schema.GetSelfExclusion) (resp schema.GetSelfExclusionResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // GetSettings Get User Settings (email, date of birth, address etc) -func (a *DerivAPI) GetSettings(r schema.GetSettings) (resp schema.GetSettingsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) GetSettings(r schema.GetSettings) (resp schema.GetSettingsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // IdentityVerificationDocumentAdd Adds document information such as issuing country, id and type for identity verification processes. -func (a *DerivAPI) IdentityVerificationDocumentAdd(r schema.IdentityVerificationDocumentAdd) (resp schema.IdentityVerificationDocumentAddResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) IdentityVerificationDocumentAdd(r schema.IdentityVerificationDocumentAdd) (resp schema.IdentityVerificationDocumentAddResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // KycAuthStatus Get KYC Authentication Status -func (a *DerivAPI) KycAuthStatus(r schema.KycAuthStatus) (resp schema.KycAuthStatusResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) KycAuthStatus(r schema.KycAuthStatus) (resp schema.KycAuthStatusResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // LandingCompany The company has a number of licensed subsidiaries in various jurisdictions, which are called Landing Companies. This call will return the appropriate Landing Company for clients of a given country. The landing company may differ for derived contracts (Synthetic Indices) and Financial contracts (Forex, Stock Indices, Commodities). -func (a *DerivAPI) LandingCompany(r schema.LandingCompany) (resp schema.LandingCompanyResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) LandingCompany(r schema.LandingCompany) (resp schema.LandingCompanyResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // LandingCompanyDetails The company has a number of licensed subsidiaries in various jurisdictions, which are called Landing Companies (and which are wholly owned subsidiaries of the Deriv Group). This call provides information about each Landing Company. -func (a *DerivAPI) LandingCompanyDetails(r schema.LandingCompanyDetails) (resp schema.LandingCompanyDetailsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) LandingCompanyDetails(r schema.LandingCompanyDetails) (resp schema.LandingCompanyDetailsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // LoginHistory Retrieve a summary of login history for user. -func (a *DerivAPI) LoginHistory(r schema.LoginHistory) (resp schema.LoginHistoryResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) LoginHistory(r schema.LoginHistory) (resp schema.LoginHistoryResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Logout Logout the session -func (a *DerivAPI) Logout(r schema.Logout) (resp schema.LogoutResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Logout(r schema.Logout) (resp schema.LogoutResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Mt5Deposit This call allows deposit into MT5 account from Binary account. -func (a *DerivAPI) Mt5Deposit(r schema.Mt5Deposit) (resp schema.Mt5DepositResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Mt5Deposit(r schema.Mt5Deposit) (resp schema.Mt5DepositResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Mt5GetSettings Get MT5 user account settings -func (a *DerivAPI) Mt5GetSettings(r schema.Mt5GetSettings) (resp schema.Mt5GetSettingsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Mt5GetSettings(r schema.Mt5GetSettings) (resp schema.Mt5GetSettingsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Mt5LoginList Get list of MT5 accounts for client -func (a *DerivAPI) Mt5LoginList(r schema.Mt5LoginList) (resp schema.Mt5LoginListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Mt5LoginList(r schema.Mt5LoginList) (resp schema.Mt5LoginListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Mt5NewAccount This call creates new MT5 user, either demo or real money user. -func (a *DerivAPI) Mt5NewAccount(r schema.Mt5NewAccount) (resp schema.Mt5NewAccountResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Mt5NewAccount(r schema.Mt5NewAccount) (resp schema.Mt5NewAccountResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Mt5PasswordChange To change passwords of the MT5 account. -func (a *DerivAPI) Mt5PasswordChange(r schema.Mt5PasswordChange) (resp schema.Mt5PasswordChangeResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Mt5PasswordChange(r schema.Mt5PasswordChange) (resp schema.Mt5PasswordChangeResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Mt5PasswordCheck This call validates the main password for the MT5 user -func (a *DerivAPI) Mt5PasswordCheck(r schema.Mt5PasswordCheck) (resp schema.Mt5PasswordCheckResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Mt5PasswordCheck(r schema.Mt5PasswordCheck) (resp schema.Mt5PasswordCheckResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Mt5PasswordReset To reset the password of MT5 account. -func (a *DerivAPI) Mt5PasswordReset(r schema.Mt5PasswordReset) (resp schema.Mt5PasswordResetResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Mt5PasswordReset(r schema.Mt5PasswordReset) (resp schema.Mt5PasswordResetResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Mt5Withdrawal This call allows withdrawal from MT5 account to Binary account. -func (a *DerivAPI) Mt5Withdrawal(r schema.Mt5Withdrawal) (resp schema.Mt5WithdrawalResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Mt5Withdrawal(r schema.Mt5Withdrawal) (resp schema.Mt5WithdrawalResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // NewAccountMaltainvest This call opens a new real-money account with the `maltainvest` Landing Company. This call can be made from a virtual-money account or real-money account at Deriv (Europe) Limited. If it is the latter, client information fields in this call will be ignored and data from your existing real-money account will be used. -func (a *DerivAPI) NewAccountMaltainvest(r schema.NewAccountMaltainvest) (resp schema.NewAccountMaltainvestResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) NewAccountMaltainvest(r schema.NewAccountMaltainvest) (resp schema.NewAccountMaltainvestResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // NewAccountReal This call opens a new real-money account. This call can be made from a virtual-money or a real-money account. If it is the latter, client information fields in this call will be ignored and data from your existing real-money account will be used. -func (a *DerivAPI) NewAccountReal(r schema.NewAccountReal) (resp schema.NewAccountRealResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) NewAccountReal(r schema.NewAccountReal) (resp schema.NewAccountRealResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // NewAccountVirtual Create a new virtual-money account. -func (a *DerivAPI) NewAccountVirtual(r schema.NewAccountVirtual) (resp schema.NewAccountVirtualResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) NewAccountVirtual(r schema.NewAccountVirtual) (resp schema.NewAccountVirtualResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // OauthApps List all my used OAuth applications. -func (a *DerivAPI) OauthApps(r schema.OauthApps) (resp schema.OauthAppsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) OauthApps(r schema.OauthApps) (resp schema.OauthAppsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertCreate Creates a P2P (Peer to Peer) advert. Can only be used by an approved P2P advertiser. -func (a *DerivAPI) P2PAdvertCreate(r schema.P2PAdvertCreate) (resp schema.P2PAdvertCreateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertCreate(r schema.P2PAdvertCreate) (resp schema.P2PAdvertCreateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertInfo Retrieve information about a P2P advert. -func (a *DerivAPI) P2PAdvertInfo(r schema.P2PAdvertInfo) (resp schema.P2PAdvertInfoResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertInfo(r schema.P2PAdvertInfo) (resp schema.P2PAdvertInfoResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertList Returns available adverts for use with `p2p_order_create` . -func (a *DerivAPI) P2PAdvertList(r schema.P2PAdvertList) (resp schema.P2PAdvertListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertList(r schema.P2PAdvertList) (resp schema.P2PAdvertListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertUpdate Updates a P2P advert. Can only be used by the advertiser. -func (a *DerivAPI) P2PAdvertUpdate(r schema.P2PAdvertUpdate) (resp schema.P2PAdvertUpdateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertUpdate(r schema.P2PAdvertUpdate) (resp schema.P2PAdvertUpdateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertiserAdverts Returns all P2P adverts created by the authorized client. Can only be used by a registered P2P advertiser. -func (a *DerivAPI) P2PAdvertiserAdverts(r schema.P2PAdvertiserAdverts) (resp schema.P2PAdvertiserAdvertsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertiserAdverts(r schema.P2PAdvertiserAdverts) (resp schema.P2PAdvertiserAdvertsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertiserCreate Registers the client as a P2P advertiser. -func (a *DerivAPI) P2PAdvertiserCreate(r schema.P2PAdvertiserCreate) (resp schema.P2PAdvertiserCreateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertiserCreate(r schema.P2PAdvertiserCreate) (resp schema.P2PAdvertiserCreateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertiserInfo Retrieve information about a P2P advertiser. -func (a *DerivAPI) P2PAdvertiserInfo(r schema.P2PAdvertiserInfo) (resp schema.P2PAdvertiserInfoResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertiserInfo(r schema.P2PAdvertiserInfo) (resp schema.P2PAdvertiserInfoResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertiserList Retrieve advertisers has/had trade with the current advertiser. -func (a *DerivAPI) P2PAdvertiserList(r schema.P2PAdvertiserList) (resp schema.P2PAdvertiserListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertiserList(r schema.P2PAdvertiserList) (resp schema.P2PAdvertiserListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertiserPaymentMethods Manage or list P2P advertiser payment methods. -func (a *DerivAPI) P2PAdvertiserPaymentMethods(r schema.P2PAdvertiserPaymentMethods) (resp schema.P2PAdvertiserPaymentMethodsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertiserPaymentMethods(r schema.P2PAdvertiserPaymentMethods) (resp schema.P2PAdvertiserPaymentMethodsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertiserRelations Updates and returns favourite and blocked advertisers of the current user. -func (a *DerivAPI) P2PAdvertiserRelations(r schema.P2PAdvertiserRelations) (resp schema.P2PAdvertiserRelationsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertiserRelations(r schema.P2PAdvertiserRelations) (resp schema.P2PAdvertiserRelationsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PAdvertiserUpdate Update the information of the P2P advertiser for the current account. Can only be used by an approved P2P advertiser. -func (a *DerivAPI) P2PAdvertiserUpdate(r schema.P2PAdvertiserUpdate) (resp schema.P2PAdvertiserUpdateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PAdvertiserUpdate(r schema.P2PAdvertiserUpdate) (resp schema.P2PAdvertiserUpdateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PChatCreate Creates a P2P chat for the specified order. -func (a *DerivAPI) P2PChatCreate(r schema.P2PChatCreate) (resp schema.P2PChatCreateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PChatCreate(r schema.P2PChatCreate) (resp schema.P2PChatCreateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PCountryList List all or specific country and its payment methods. -func (a *DerivAPI) P2PCountryList(r schema.P2PCountryList) (resp schema.P2PCountryListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PCountryList(r schema.P2PCountryList) (resp schema.P2PCountryListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2POrderCancel Cancel a P2P order. -func (a *DerivAPI) P2POrderCancel(r schema.P2POrderCancel) (resp schema.P2POrderCancelResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2POrderCancel(r schema.P2POrderCancel) (resp schema.P2POrderCancelResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2POrderConfirm Confirm a P2P order. -func (a *DerivAPI) P2POrderConfirm(r schema.P2POrderConfirm) (resp schema.P2POrderConfirmResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2POrderConfirm(r schema.P2POrderConfirm) (resp schema.P2POrderConfirmResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2POrderCreate Creates a P2P order for the specified advert. -func (a *DerivAPI) P2POrderCreate(r schema.P2POrderCreate) (resp schema.P2POrderCreateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2POrderCreate(r schema.P2POrderCreate) (resp schema.P2POrderCreateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2POrderDispute Dispute a P2P order. -func (a *DerivAPI) P2POrderDispute(r schema.P2POrderDispute) (resp schema.P2POrderDisputeResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2POrderDispute(r schema.P2POrderDispute) (resp schema.P2POrderDisputeResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2POrderInfo Retrieves the information about a P2P order. -func (a *DerivAPI) P2POrderInfo(r schema.P2POrderInfo) (resp schema.P2POrderInfoResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2POrderInfo(r schema.P2POrderInfo) (resp schema.P2POrderInfoResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2POrderList List active orders. -func (a *DerivAPI) P2POrderList(r schema.P2POrderList) (resp schema.P2POrderListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2POrderList(r schema.P2POrderList) (resp schema.P2POrderListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2POrderReview Creates a review for the specified order. -func (a *DerivAPI) P2POrderReview(r schema.P2POrderReview) (resp schema.P2POrderReviewResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2POrderReview(r schema.P2POrderReview) (resp schema.P2POrderReviewResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PPaymentMethods List all P2P payment methods. -func (a *DerivAPI) P2PPaymentMethods(r schema.P2PPaymentMethods) (resp schema.P2PPaymentMethodsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PPaymentMethods(r schema.P2PPaymentMethods) (resp schema.P2PPaymentMethodsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PPing Keeps the connection alive and updates the P2P advertiser's online status. The advertiser will be considered offline 60 seconds after a call is made. -func (a *DerivAPI) P2PPing(r schema.P2PPing) (resp schema.P2PPingResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PPing(r schema.P2PPing) (resp schema.P2PPingResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // P2PSettings Request P2P Settings information. -func (a *DerivAPI) P2PSettings(r schema.P2PSettings) (resp schema.P2PSettingsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) P2PSettings(r schema.P2PSettings) (resp schema.P2PSettingsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // PaymentMethods Will return a list payment methods available for the given country. If the request is authenticated the client's residence country will be used. -func (a *DerivAPI) PaymentMethods(r schema.PaymentMethods) (resp schema.PaymentMethodsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) PaymentMethods(r schema.PaymentMethods) (resp schema.PaymentMethodsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // PaymentagentCreate Saves client's payment agent details. -func (a *DerivAPI) PaymentagentCreate(r schema.PaymentagentCreate) (resp schema.PaymentagentCreateResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) PaymentagentCreate(r schema.PaymentagentCreate) (resp schema.PaymentagentCreateResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // PaymentagentDetails Gets client's payment agent details. -func (a *DerivAPI) PaymentagentDetails(r schema.PaymentagentDetails) (resp schema.PaymentagentDetailsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) PaymentagentDetails(r schema.PaymentagentDetails) (resp schema.PaymentagentDetailsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // PaymentagentList Will return a list of Payment Agents for a given country for a given currency. Payment agents allow users to deposit and withdraw funds using local payment methods that might not be available via the main website's cashier system. -func (a *DerivAPI) PaymentagentList(r schema.PaymentagentList) (resp schema.PaymentagentListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) PaymentagentList(r schema.PaymentagentList) (resp schema.PaymentagentListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // PaymentagentTransfer Payment Agent Transfer - this call is available only to accounts that are approved Payment Agents. -func (a *DerivAPI) PaymentagentTransfer(r schema.PaymentagentTransfer) (resp schema.PaymentagentTransferResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) PaymentagentTransfer(r schema.PaymentagentTransfer) (resp schema.PaymentagentTransferResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // PaymentagentWithdraw Initiate a withdrawal to an approved Payment Agent. -func (a *DerivAPI) PaymentagentWithdraw(r schema.PaymentagentWithdraw) (resp schema.PaymentagentWithdrawResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) PaymentagentWithdraw(r schema.PaymentagentWithdraw) (resp schema.PaymentagentWithdrawResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // PaymentagentWithdrawJustification Provide justification to perform withdrawal using a Payment Agent. -func (a *DerivAPI) PaymentagentWithdrawJustification(r schema.PaymentagentWithdrawJustification) (resp schema.PaymentagentWithdrawJustificationResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) PaymentagentWithdrawJustification(r schema.PaymentagentWithdrawJustification) (resp schema.PaymentagentWithdrawJustificationResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // PayoutCurrencies Retrieve a list of available option payout currencies. If a user is logged in, only the currencies available for the account will be returned. -func (a *DerivAPI) PayoutCurrencies(r schema.PayoutCurrencies) (resp schema.PayoutCurrenciesResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) PayoutCurrencies(r schema.PayoutCurrencies) (resp schema.PayoutCurrenciesResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Ping To send the ping request to the server. Mostly used to test the connection or to keep it alive. -func (a *DerivAPI) Ping(r schema.Ping) (resp schema.PingResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Ping(r schema.Ping) (resp schema.PingResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Portfolio Receive information about my current portfolio of outstanding options -func (a *DerivAPI) Portfolio(r schema.Portfolio) (resp schema.PortfolioResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Portfolio(r schema.Portfolio) (resp schema.PortfolioResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ProfitTable Retrieve a summary of account Profit Table, according to given search criteria -func (a *DerivAPI) ProfitTable(r schema.ProfitTable) (resp schema.ProfitTableResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ProfitTable(r schema.ProfitTable) (resp schema.ProfitTableResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Proposal Gets latest price for a specific contract. -func (a *DerivAPI) Proposal(r schema.Proposal) (resp schema.ProposalResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Proposal(r schema.Proposal) (resp schema.ProposalResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ProposalOpenContract Get latest price (and other information) for a contract in the user's portfolio -func (a *DerivAPI) ProposalOpenContract(r schema.ProposalOpenContract) (resp schema.ProposalOpenContractResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ProposalOpenContract(r schema.ProposalOpenContract) (resp schema.ProposalOpenContractResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // RealityCheck Retrieve summary of client's trades and account for the Reality Check facility. A 'reality check' means a display of time elapsed since the session began, and associated client profit/loss. The Reality Check facility is a regulatory requirement for certain landing companies. -func (a *DerivAPI) RealityCheck(r schema.RealityCheck) (resp schema.RealityCheckResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) RealityCheck(r schema.RealityCheck) (resp schema.RealityCheckResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // ResidenceList This call returns a list of countries and 2-letter country codes, suitable for populating the account opening form. -func (a *DerivAPI) ResidenceList(r schema.ResidenceList) (resp schema.ResidenceListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) ResidenceList(r schema.ResidenceList) (resp schema.ResidenceListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // RevokeOauthApp Used for revoking access of particular app. -func (a *DerivAPI) RevokeOauthApp(r schema.RevokeOauthApp) (resp schema.RevokeOauthAppResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) RevokeOauthApp(r schema.RevokeOauthApp) (resp schema.RevokeOauthAppResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Sell Sell a Contract as identified from a previous `portfolio` call. -func (a *DerivAPI) Sell(r schema.Sell) (resp schema.SellResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Sell(r schema.Sell) (resp schema.SellResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // SellContractForMultipleAccounts Sell contracts for multiple accounts simultaneously. Uses the shortcode response from `buy_contract_for_multiple_accounts` to identify the contract, and authorisation tokens to select which accounts to sell those contracts on. Note that only the accounts identified by the tokens will be affected. This will not sell the contract on the currently-authorised account unless you include the token for the current account. -func (a *DerivAPI) SellContractForMultipleAccounts(r schema.SellContractForMultipleAccounts) (resp schema.SellContractForMultipleAccountsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SellContractForMultipleAccounts(r schema.SellContractForMultipleAccounts) (resp schema.SellContractForMultipleAccountsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // SellExpired This call will try to sell any expired contracts and return the number of sold contracts. -func (a *DerivAPI) SellExpired(r schema.SellExpired) (resp schema.SellExpiredResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SellExpired(r schema.SellExpired) (resp schema.SellExpiredResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // SetAccountCurrency Set account currency, this will be default currency for your account i.e currency for trading, deposit. Please note that account currency can only be set once, and then can never be changed. -func (a *DerivAPI) SetAccountCurrency(r schema.SetAccountCurrency) (resp schema.SetAccountCurrencyResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SetAccountCurrency(r schema.SetAccountCurrency) (resp schema.SetAccountCurrencyResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // SetFinancialAssessment This call sets the financial assessment details based on the client's answers to analyze whether they possess the experience and knowledge to understand the risks involved with binary options trading. -func (a *DerivAPI) SetFinancialAssessment(r schema.SetFinancialAssessment) (resp schema.SetFinancialAssessmentResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SetFinancialAssessment(r schema.SetFinancialAssessment) (resp schema.SetFinancialAssessmentResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // SetSelfExclusion Set Self-Exclusion (this call should be used in conjunction with `get_self_exclusion`) -func (a *DerivAPI) SetSelfExclusion(r schema.SetSelfExclusion) (resp schema.SetSelfExclusionResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SetSelfExclusion(r schema.SetSelfExclusion) (resp schema.SetSelfExclusionResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // SetSettings Set User Settings (this call should be used in conjunction with `get_settings`) -func (a *DerivAPI) SetSettings(r schema.SetSettings) (resp schema.SetSettingsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SetSettings(r schema.SetSettings) (resp schema.SetSettingsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Statement Retrieve a summary of account transactions, according to given search criteria -func (a *DerivAPI) Statement(r schema.Statement) (resp schema.StatementResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Statement(r schema.Statement) (resp schema.StatementResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // StatesList For a given country, returns a list of States of that country. This is useful to populate the account opening form. -func (a *DerivAPI) StatesList(r schema.StatesList) (resp schema.StatesListResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) StatesList(r schema.StatesList) (resp schema.StatesListResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Ticks Initiate a continuous stream of spot price updates for a given symbol. -func (a *DerivAPI) Ticks(r schema.Ticks) (resp schema.TicksResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Ticks(r schema.Ticks) (resp schema.TicksResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TicksHistory Get historic tick data for a given symbol. -func (a *DerivAPI) TicksHistory(r schema.TicksHistory) (resp schema.TicksHistoryResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TicksHistory(r schema.TicksHistory) (resp schema.TicksHistoryResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Time Request back-end server epoch time. -func (a *DerivAPI) Time(r schema.Time) (resp schema.TimeResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Time(r schema.Time) (resp schema.TimeResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TinValidations Get the validations for Tax Identification Numbers (TIN) -func (a *DerivAPI) TinValidations(r schema.TinValidations) (resp schema.TinValidationsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TinValidations(r schema.TinValidations) (resp schema.TinValidationsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TncApproval To approve the latest version of terms and conditions. -func (a *DerivAPI) TncApproval(r schema.TncApproval) (resp schema.TncApprovalResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TncApproval(r schema.TncApproval) (resp schema.TncApprovalResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TopupVirtual When a virtual-money's account balance becomes low, it can be topped up using this call. -func (a *DerivAPI) TopupVirtual(r schema.TopupVirtual) (resp schema.TopupVirtualResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TopupVirtual(r schema.TopupVirtual) (resp schema.TopupVirtualResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TradingDurations Retrieve a list of all available underlyings and the corresponding contract types and trading duration boundaries. If the user is logged in, only the assets available for that user's landing company will be returned. -func (a *DerivAPI) TradingDurations(r schema.TradingDurations) (resp schema.TradingDurationsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TradingDurations(r schema.TradingDurations) (resp schema.TradingDurationsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TradingPlatformInvestorPasswordReset Reset the investor password of a Trading Platform Account -func (a *DerivAPI) TradingPlatformInvestorPasswordReset(r schema.TradingPlatformInvestorPasswordReset) (resp schema.TradingPlatformInvestorPasswordResetResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TradingPlatformInvestorPasswordReset(r schema.TradingPlatformInvestorPasswordReset) (resp schema.TradingPlatformInvestorPasswordResetResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TradingPlatformPasswordReset Reset the password of a Trading Platform Account -func (a *DerivAPI) TradingPlatformPasswordReset(r schema.TradingPlatformPasswordReset) (resp schema.TradingPlatformPasswordResetResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TradingPlatformPasswordReset(r schema.TradingPlatformPasswordReset) (resp schema.TradingPlatformPasswordResetResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TradingPlatformStatus Request trading platform status -func (a *DerivAPI) TradingPlatformStatus(r schema.TradingPlatformStatus) (resp schema.TradingPlatformStatusResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TradingPlatformStatus(r schema.TradingPlatformStatus) (resp schema.TradingPlatformStatusResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TradingServers Get the list of servers for a trading platform. -func (a *DerivAPI) TradingServers(r schema.TradingServers) (resp schema.TradingServersResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TradingServers(r schema.TradingServers) (resp schema.TradingServersResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TradingTimes Receive a list of market opening times for a given date. -func (a *DerivAPI) TradingTimes(r schema.TradingTimes) (resp schema.TradingTimesResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TradingTimes(r schema.TradingTimes) (resp schema.TradingTimesResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // Transaction Subscribe to transaction notifications -func (a *DerivAPI) Transaction(r schema.Transaction) (resp schema.TransactionResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) Transaction(r schema.Transaction) (resp schema.TransactionResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // TransferBetweenAccounts This call allows transfers between accounts held by a given user. Transfer funds between your fiat and cryptocurrency accounts (for a fee). Please note that account_from should be same as current authorized account. -func (a *DerivAPI) TransferBetweenAccounts(r schema.TransferBetweenAccounts) (resp schema.TransferBetweenAccountsResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) TransferBetweenAccounts(r schema.TransferBetweenAccounts) (resp schema.TransferBetweenAccountsResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // UnsubscribeEmail It unsubscribe user from the email subscription. -func (a *DerivAPI) UnsubscribeEmail(r schema.UnsubscribeEmail) (resp schema.UnsubscribeEmailResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) UnsubscribeEmail(r schema.UnsubscribeEmail) (resp schema.UnsubscribeEmailResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // VerifyEmail Verify an email address for various purposes. The system will send an email to the address containing a security code for verification. -func (a *DerivAPI) VerifyEmail(r schema.VerifyEmail) (resp schema.VerifyEmailResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) VerifyEmail(r schema.VerifyEmail) (resp schema.VerifyEmailResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // WebsiteConfig Request server config. -func (a *DerivAPI) WebsiteConfig(r schema.WebsiteConfig) (resp schema.WebsiteConfigResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) WebsiteConfig(r schema.WebsiteConfig) (resp schema.WebsiteConfigResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } // WebsiteStatus Request server status. -func (a *DerivAPI) WebsiteStatus(r schema.WebsiteStatus) (resp schema.WebsiteStatusResp, err error) { - id := a.getNextRequestID() +func (api *DerivAPI) WebsiteStatus(r schema.WebsiteStatus) (resp schema.WebsiteStatusResp, err error) { + id := api.getNextRequestID() r.ReqId = &id - err = a.SendRequest(id, r, &resp) + err = api.SendRequest(id, r, &resp) return } diff --git a/custom_subscription_calls.go b/custom_subscription_calls.go index 5b63e47..5a01e98 100644 --- a/custom_subscription_calls.go +++ b/custom_subscription_calls.go @@ -3,36 +3,36 @@ package deriv import "github.com/ksysoev/deriv-api/schema" // SubscribeTicksHistory Get historic tick data for a given symbol. -func (a *DerivAPI) SubscribeTicksHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeTicksHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksResp], err error) { + id := api.getNextRequestID() var f schema.TicksHistorySubscribe = 1 r.ReqId = &id r.Subscribe = &f r.Style = schema.TicksHistoryStyleTicks - s = NewSubcription[schema.TicksHistoryResp, schema.TicksResp](a) + s = NewSubcription[schema.TicksHistoryResp, schema.TicksResp](api) rsp, err = s.Start(id, r) return } // SubscribeTicksHistory Get historic candles data for a given symbol. -func (a *DerivAPI) SubscribeCandlesHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksHistoryResp], err error) { +func (api *DerivAPI) SubscribeCandlesHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksHistoryResp], err error) { id := a.getNextRequestID() var f schema.TicksHistorySubscribe = 1 r.ReqId = &id r.Subscribe = &f r.Style = schema.TicksHistoryStyleCandles - s = NewSubcription[schema.TicksHistoryResp, schema.TicksHistoryResp](a) + s = NewSubcription[schema.TicksHistoryResp, schema.TicksHistoryResp](api) rsp, err = s.Start(id, r) return } // SubscribeTransaction Subscribe to transaction notifications -func (a *DerivAPI) SubscribeTransaction(r schema.Transaction) (rsp schema.TransactionResp, s *Subsciption[schema.TransactionResp, schema.TransactionResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeTransaction(r schema.Transaction) (rsp schema.TransactionResp, s *Subsciption[schema.TransactionResp, schema.TransactionResp], err error) { + id := api.getNextRequestID() var f schema.TransactionSubscribe = 1 r.ReqId = &id r.Subscribe = f - s = NewSubcription[schema.TransactionResp, schema.TransactionResp](a) + s = NewSubcription[schema.TransactionResp, schema.TransactionResp](api) rsp, err = s.Start(id, r) return } diff --git a/schema/account_list.go b/schema/account_list.go index 2267a08..9a0f7c0 100644 --- a/schema/account_list.go +++ b/schema/account_list.go @@ -6,19 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Returns all accounts belonging to the authorized user. -type AccountList struct { - // Must be `1` - AccountList AccountListAccountList `json:"account_list"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough AccountListPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type AccountListAccountList int var enumValues_AccountListAccountList = []interface{}{ @@ -45,6 +32,19 @@ func (j *AccountListAccountList) UnmarshalJSON(b []byte) error { return nil } +// Returns all accounts belonging to the authorized user. +type AccountList struct { + // Must be `1` + AccountList AccountListAccountList `json:"account_list"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough AccountListPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type AccountListPassthrough map[string]interface{} @@ -55,7 +55,7 @@ func (j *AccountList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_list"]; raw != nil && !ok { + if v, ok := raw["account_list"]; !ok || v == nil { return fmt.Errorf("field account_list in AccountList: required") } type Plain AccountList diff --git a/schema/account_list_resp.go b/schema/account_list_resp.go index d4801c4..53db515 100644 --- a/schema/account_list_resp.go +++ b/schema/account_list_resp.go @@ -62,109 +62,129 @@ type AccountListRespAccountListElemAccountCategory string const AccountListRespAccountListElemAccountCategoryTrading AccountListRespAccountListElemAccountCategory = "trading" const AccountListRespAccountListElemAccountCategoryWallet AccountListRespAccountListElemAccountCategory = "wallet" -var enumValues_AccountListRespAccountListElemAccountCategory = []interface{}{ - "trading", - "wallet", +type AccountListRespAccountListElemIsDisabled int + +type AccountListRespAccountListElemIsVirtual int + +type AccountListRespAccountListElemLinkedToElem struct { + // Account ID. + Loginid *string `json:"loginid,omitempty"` + + // Account platform name. + Platform *AccountListRespAccountListElemLinkedToElemPlatform `json:"platform,omitempty"` } +type AccountListRespAccountListElemLinkedToElemPlatform string + +const AccountListRespAccountListElemLinkedToElemPlatformCtrader AccountListRespAccountListElemLinkedToElemPlatform = "ctrader" +const AccountListRespAccountListElemLinkedToElemPlatformDerivez AccountListRespAccountListElemLinkedToElemPlatform = "derivez" +const AccountListRespAccountListElemLinkedToElemPlatformDtrade AccountListRespAccountListElemLinkedToElemPlatform = "dtrade" +const AccountListRespAccountListElemLinkedToElemPlatformDwallet AccountListRespAccountListElemLinkedToElemPlatform = "dwallet" +const AccountListRespAccountListElemLinkedToElemPlatformDxtrade AccountListRespAccountListElemLinkedToElemPlatform = "dxtrade" +const AccountListRespAccountListElemLinkedToElemPlatformMt5 AccountListRespAccountListElemLinkedToElemPlatform = "mt5" + +// Echo of the request made. +type AccountListRespEchoReq map[string]interface{} + // UnmarshalJSON implements json.Unmarshaler. -func (j *AccountListRespAccountListElemAccountCategory) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { +func (j *AccountListRespAccountListElem) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { return err } - var ok bool - for _, expected := range enumValues_AccountListRespAccountListElemAccountCategory { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if v, ok := raw["account_category"]; !ok || v == nil { + return fmt.Errorf("field account_category in AccountListRespAccountListElem: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AccountListRespAccountListElemAccountCategory, v) + if v, ok := raw["account_type"]; !ok || v == nil { + return fmt.Errorf("field account_type in AccountListRespAccountListElem: required") } - *j = AccountListRespAccountListElemAccountCategory(v) + if v, ok := raw["created_at"]; !ok || v == nil { + return fmt.Errorf("field created_at in AccountListRespAccountListElem: required") + } + if v, ok := raw["currency"]; !ok || v == nil { + return fmt.Errorf("field currency in AccountListRespAccountListElem: required") + } + if v, ok := raw["is_disabled"]; !ok || v == nil { + return fmt.Errorf("field is_disabled in AccountListRespAccountListElem: required") + } + if v, ok := raw["is_virtual"]; !ok || v == nil { + return fmt.Errorf("field is_virtual in AccountListRespAccountListElem: required") + } + if v, ok := raw["landing_company_name"]; !ok || v == nil { + return fmt.Errorf("field landing_company_name in AccountListRespAccountListElem: required") + } + if v, ok := raw["linked_to"]; !ok || v == nil { + return fmt.Errorf("field linked_to in AccountListRespAccountListElem: required") + } + if v, ok := raw["loginid"]; !ok || v == nil { + return fmt.Errorf("field loginid in AccountListRespAccountListElem: required") + } + type Plain AccountListRespAccountListElem + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = AccountListRespAccountListElem(plain) return nil } -type AccountListRespAccountListElemIsDisabled int - -var enumValues_AccountListRespAccountListElemIsDisabled = []interface{}{ - 1, - 0, +var enumValues_AccountListRespAccountListElemLinkedToElemPlatform = []interface{}{ + "ctrader", + "derivez", + "dtrade", + "dwallet", + "dxtrade", + "mt5", } // UnmarshalJSON implements json.Unmarshaler. -func (j *AccountListRespAccountListElemIsDisabled) UnmarshalJSON(b []byte) error { +func (j *AccountListRespAccountListElemIsVirtual) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_AccountListRespAccountListElemIsDisabled { + for _, expected := range enumValues_AccountListRespAccountListElemIsVirtual { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AccountListRespAccountListElemIsDisabled, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AccountListRespAccountListElemIsVirtual, v) } - *j = AccountListRespAccountListElemIsDisabled(v) + *j = AccountListRespAccountListElemIsVirtual(v) return nil } -type AccountListRespAccountListElemIsVirtual int - var enumValues_AccountListRespAccountListElemIsVirtual = []interface{}{ 1, 0, } // UnmarshalJSON implements json.Unmarshaler. -func (j *AccountListRespAccountListElemIsVirtual) UnmarshalJSON(b []byte) error { +func (j *AccountListRespAccountListElemIsDisabled) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_AccountListRespAccountListElemIsVirtual { + for _, expected := range enumValues_AccountListRespAccountListElemIsDisabled { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AccountListRespAccountListElemIsVirtual, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AccountListRespAccountListElemIsDisabled, v) } - *j = AccountListRespAccountListElemIsVirtual(v) + *j = AccountListRespAccountListElemIsDisabled(v) return nil } -type AccountListRespAccountListElemLinkedToElem struct { - // Account ID. - Loginid *string `json:"loginid,omitempty"` - - // Account platform name. - Platform *AccountListRespAccountListElemLinkedToElemPlatform `json:"platform,omitempty"` -} - -type AccountListRespAccountListElemLinkedToElemPlatform string - -const AccountListRespAccountListElemLinkedToElemPlatformCtrader AccountListRespAccountListElemLinkedToElemPlatform = "ctrader" -const AccountListRespAccountListElemLinkedToElemPlatformDerivez AccountListRespAccountListElemLinkedToElemPlatform = "derivez" -const AccountListRespAccountListElemLinkedToElemPlatformDtrade AccountListRespAccountListElemLinkedToElemPlatform = "dtrade" -const AccountListRespAccountListElemLinkedToElemPlatformDwallet AccountListRespAccountListElemLinkedToElemPlatform = "dwallet" -const AccountListRespAccountListElemLinkedToElemPlatformDxtrade AccountListRespAccountListElemLinkedToElemPlatform = "dxtrade" -const AccountListRespAccountListElemLinkedToElemPlatformMt5 AccountListRespAccountListElemLinkedToElemPlatform = "mt5" - -var enumValues_AccountListRespAccountListElemLinkedToElemPlatform = []interface{}{ - "ctrader", - "derivez", - "dtrade", - "dwallet", - "dxtrade", - "mt5", +var enumValues_AccountListRespAccountListElemIsDisabled = []interface{}{ + 1, + 0, } // UnmarshalJSON implements json.Unmarshaler. @@ -188,54 +208,27 @@ func (j *AccountListRespAccountListElemLinkedToElemPlatform) UnmarshalJSON(b []b } // UnmarshalJSON implements json.Unmarshaler. -func (j *AccountListRespAccountListElem) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *AccountListRespAccountListElemAccountCategory) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { return err } - if _, ok := raw["account_category"]; raw != nil && !ok { - return fmt.Errorf("field account_category in AccountListRespAccountListElem: required") - } - if _, ok := raw["account_type"]; raw != nil && !ok { - return fmt.Errorf("field account_type in AccountListRespAccountListElem: required") - } - if _, ok := raw["created_at"]; raw != nil && !ok { - return fmt.Errorf("field created_at in AccountListRespAccountListElem: required") - } - if _, ok := raw["currency"]; raw != nil && !ok { - return fmt.Errorf("field currency in AccountListRespAccountListElem: required") - } - if _, ok := raw["is_disabled"]; raw != nil && !ok { - return fmt.Errorf("field is_disabled in AccountListRespAccountListElem: required") - } - if _, ok := raw["is_virtual"]; raw != nil && !ok { - return fmt.Errorf("field is_virtual in AccountListRespAccountListElem: required") - } - if _, ok := raw["landing_company_name"]; raw != nil && !ok { - return fmt.Errorf("field landing_company_name in AccountListRespAccountListElem: required") - } - if _, ok := raw["linked_to"]; raw != nil && !ok { - return fmt.Errorf("field linked_to in AccountListRespAccountListElem: required") - } - if _, ok := raw["loginid"]; raw != nil && !ok { - return fmt.Errorf("field loginid in AccountListRespAccountListElem: required") + var ok bool + for _, expected := range enumValues_AccountListRespAccountListElemAccountCategory { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain AccountListRespAccountListElem - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AccountListRespAccountListElemAccountCategory, v) } - *j = AccountListRespAccountListElem(plain) + *j = AccountListRespAccountListElemAccountCategory(v) return nil } -// Echo of the request made. -type AccountListRespEchoReq map[string]interface{} - type AccountListRespMsgType string -const AccountListRespMsgTypeAccountList AccountListRespMsgType = "account_list" - var enumValues_AccountListRespMsgType = []interface{}{ "account_list", } @@ -260,16 +253,23 @@ func (j *AccountListRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const AccountListRespMsgTypeAccountList AccountListRespMsgType = "account_list" + +var enumValues_AccountListRespAccountListElemAccountCategory = []interface{}{ + "trading", + "wallet", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *AccountListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AccountListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AccountListResp: required") } type Plain AccountListResp diff --git a/schema/active_symbols.go b/schema/active_symbols.go index 7cdf2fe..d65ba16 100644 --- a/schema/active_symbols.go +++ b/schema/active_symbols.go @@ -48,31 +48,6 @@ type ActiveSymbolsActiveSymbols string const ActiveSymbolsActiveSymbolsBrief ActiveSymbolsActiveSymbols = "brief" const ActiveSymbolsActiveSymbolsFull ActiveSymbolsActiveSymbols = "full" -var enumValues_ActiveSymbolsActiveSymbols = []interface{}{ - "brief", - "full", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsActiveSymbols) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ActiveSymbolsActiveSymbols { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsActiveSymbols, v) - } - *j = ActiveSymbolsActiveSymbols(v) - return nil -} - type ActiveSymbolsBarrierCategoryElem string const ActiveSymbolsBarrierCategoryElemAmerican ActiveSymbolsBarrierCategoryElem = "american" @@ -83,36 +58,6 @@ const ActiveSymbolsBarrierCategoryElemLookback ActiveSymbolsBarrierCategoryElem const ActiveSymbolsBarrierCategoryElemNonFinancial ActiveSymbolsBarrierCategoryElem = "non_financial" const ActiveSymbolsBarrierCategoryElemReset ActiveSymbolsBarrierCategoryElem = "reset" -var enumValues_ActiveSymbolsBarrierCategoryElem = []interface{}{ - "american", - "asian", - "euro_atm", - "euro_non_atm", - "non_financial", - "lookback", - "reset", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsBarrierCategoryElem) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ActiveSymbolsBarrierCategoryElem { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsBarrierCategoryElem, v) - } - *j = ActiveSymbolsBarrierCategoryElem(v) - return nil -} - type ActiveSymbolsContractTypeElem string const ActiveSymbolsContractTypeElemACCU ActiveSymbolsContractTypeElem = "ACCU" @@ -154,6 +99,45 @@ const ActiveSymbolsContractTypeElemUPORDOWN ActiveSymbolsContractTypeElem = "UPO const ActiveSymbolsContractTypeElemVANILLALONGCALL ActiveSymbolsContractTypeElem = "VANILLALONGCALL" const ActiveSymbolsContractTypeElemVANILLALONGPUT ActiveSymbolsContractTypeElem = "VANILLALONGPUT" +type ActiveSymbolsLandingCompany string + +const ActiveSymbolsLandingCompanyIom ActiveSymbolsLandingCompany = "iom" +const ActiveSymbolsLandingCompanyMalta ActiveSymbolsLandingCompany = "malta" +const ActiveSymbolsLandingCompanyMaltainvest ActiveSymbolsLandingCompany = "maltainvest" + +type ActiveSymbolsLandingCompanyShort string + +const ActiveSymbolsLandingCompanyShortIom ActiveSymbolsLandingCompanyShort = "iom" +const ActiveSymbolsLandingCompanyShortMalta ActiveSymbolsLandingCompanyShort = "malta" +const ActiveSymbolsLandingCompanyShortMaltainvest ActiveSymbolsLandingCompanyShort = "maltainvest" +const ActiveSymbolsLandingCompanyShortSvg ActiveSymbolsLandingCompanyShort = "svg" +const ActiveSymbolsLandingCompanyShortVanuatu ActiveSymbolsLandingCompanyShort = "vanuatu" +const ActiveSymbolsLandingCompanyShortVirtual ActiveSymbolsLandingCompanyShort = "virtual" +const ActiveSymbolsLandingCompanySvg ActiveSymbolsLandingCompany = "svg" +const ActiveSymbolsLandingCompanyVanuatu ActiveSymbolsLandingCompany = "vanuatu" +const ActiveSymbolsLandingCompanyVirtual ActiveSymbolsLandingCompany = "virtual" + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type ActiveSymbolsPassthrough map[string]interface{} + +type ActiveSymbolsProductType string + +const ActiveSymbolsProductTypeBasic ActiveSymbolsProductType = "basic" + +var enumValues_ActiveSymbolsActiveSymbols = []interface{}{ + "brief", + "full", +} +var enumValues_ActiveSymbolsBarrierCategoryElem = []interface{}{ + "american", + "asian", + "euro_atm", + "euro_non_atm", + "non_financial", + "lookback", + "reset", +} var enumValues_ActiveSymbolsContractTypeElem = []interface{}{ "MULTUP", "MULTDOWN", @@ -194,84 +178,55 @@ var enumValues_ActiveSymbolsContractTypeElem = []interface{}{ "TURBOSLONG", "TURBOSSHORT", } +var enumValues_ActiveSymbolsLandingCompany = []interface{}{ + "iom", + "malta", + "maltainvest", + "svg", + "virtual", + "vanuatu", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsContractTypeElem) UnmarshalJSON(b []byte) error { +func (j *ActiveSymbolsActiveSymbols) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ActiveSymbolsContractTypeElem { + for _, expected := range enumValues_ActiveSymbolsActiveSymbols { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsContractTypeElem, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsActiveSymbols, v) } - *j = ActiveSymbolsContractTypeElem(v) + *j = ActiveSymbolsActiveSymbols(v) return nil } -type ActiveSymbolsLandingCompany string - -const ActiveSymbolsLandingCompanyIom ActiveSymbolsLandingCompany = "iom" -const ActiveSymbolsLandingCompanyMalta ActiveSymbolsLandingCompany = "malta" -const ActiveSymbolsLandingCompanyMaltainvest ActiveSymbolsLandingCompany = "maltainvest" - -type ActiveSymbolsLandingCompanyShort string - -const ActiveSymbolsLandingCompanyShortIom ActiveSymbolsLandingCompanyShort = "iom" -const ActiveSymbolsLandingCompanyShortMalta ActiveSymbolsLandingCompanyShort = "malta" -const ActiveSymbolsLandingCompanyShortMaltainvest ActiveSymbolsLandingCompanyShort = "maltainvest" -const ActiveSymbolsLandingCompanyShortSvg ActiveSymbolsLandingCompanyShort = "svg" -const ActiveSymbolsLandingCompanyShortVanuatu ActiveSymbolsLandingCompanyShort = "vanuatu" -const ActiveSymbolsLandingCompanyShortVirtual ActiveSymbolsLandingCompanyShort = "virtual" - -var enumValues_ActiveSymbolsLandingCompanyShort = []interface{}{ - "iom", - "malta", - "maltainvest", - "svg", - "virtual", - "vanuatu", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsLandingCompanyShort) UnmarshalJSON(b []byte) error { +func (j *ActiveSymbolsBarrierCategoryElem) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ActiveSymbolsLandingCompanyShort { + for _, expected := range enumValues_ActiveSymbolsBarrierCategoryElem { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsLandingCompanyShort, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsBarrierCategoryElem, v) } - *j = ActiveSymbolsLandingCompanyShort(v) + *j = ActiveSymbolsBarrierCategoryElem(v) return nil } -const ActiveSymbolsLandingCompanySvg ActiveSymbolsLandingCompany = "svg" -const ActiveSymbolsLandingCompanyVanuatu ActiveSymbolsLandingCompany = "vanuatu" -const ActiveSymbolsLandingCompanyVirtual ActiveSymbolsLandingCompany = "virtual" - -var enumValues_ActiveSymbolsLandingCompany = []interface{}{ - "iom", - "malta", - "maltainvest", - "svg", - "virtual", - "vanuatu", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *ActiveSymbolsLandingCompany) UnmarshalJSON(b []byte) error { var v string @@ -292,13 +247,25 @@ func (j *ActiveSymbolsLandingCompany) UnmarshalJSON(b []byte) error { return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type ActiveSymbolsPassthrough map[string]interface{} - -type ActiveSymbolsProductType string - -const ActiveSymbolsProductTypeBasic ActiveSymbolsProductType = "basic" +// UnmarshalJSON implements json.Unmarshaler. +func (j *ActiveSymbolsContractTypeElem) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ActiveSymbolsContractTypeElem { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsContractTypeElem, v) + } + *j = ActiveSymbolsContractTypeElem(v) + return nil +} var enumValues_ActiveSymbolsProductType = []interface{}{ "basic", @@ -324,13 +291,42 @@ func (j *ActiveSymbolsProductType) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *ActiveSymbolsLandingCompanyShort) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ActiveSymbolsLandingCompanyShort { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsLandingCompanyShort, v) + } + *j = ActiveSymbolsLandingCompanyShort(v) + return nil +} + +var enumValues_ActiveSymbolsLandingCompanyShort = []interface{}{ + "iom", + "malta", + "maltainvest", + "svg", + "virtual", + "vanuatu", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ActiveSymbols) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["active_symbols"]; raw != nil && !ok { + if v, ok := raw["active_symbols"]; !ok || v == nil { return fmt.Errorf("field active_symbols in ActiveSymbols: required") } type Plain ActiveSymbols diff --git a/schema/active_symbols_resp.go b/schema/active_symbols_resp.go index 886b95b..21787ab 100644 --- a/schema/active_symbols_resp.go +++ b/schema/active_symbols_resp.go @@ -6,20 +6,44 @@ import "encoding/json" import "fmt" import "reflect" -// A message containing the list of active symbols. -type ActiveSymbolsResp struct { - // List of active symbols. - ActiveSymbols []ActiveSymbolsRespActiveSymbolsElem `json:"active_symbols,omitempty"` - - // Echo of the request made. - EchoReq ActiveSymbolsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType ActiveSymbolsRespMsgType `json:"msg_type"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended, v) + } + *j = ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended(v) + return nil +} - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting, v) + } + *j = ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting(v) + return nil } // The information about each symbol. @@ -96,35 +120,60 @@ type ActiveSymbolsRespActiveSymbolsElem struct { SymbolType string `json:"symbol_type"` } -type ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting int - -var enumValues_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *ActiveSymbolsRespActiveSymbolsElem) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { return err } - var ok bool - for _, expected := range enumValues_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if v, ok := raw["display_name"]; !ok || v == nil { + return fmt.Errorf("field display_name in ActiveSymbolsRespActiveSymbolsElem: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting, v) + if v, ok := raw["display_order"]; !ok || v == nil { + return fmt.Errorf("field display_order in ActiveSymbolsRespActiveSymbolsElem: required") } - *j = ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting(v) + if v, ok := raw["exchange_is_open"]; !ok || v == nil { + return fmt.Errorf("field exchange_is_open in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["is_trading_suspended"]; !ok || v == nil { + return fmt.Errorf("field is_trading_suspended in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["market"]; !ok || v == nil { + return fmt.Errorf("field market in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["market_display_name"]; !ok || v == nil { + return fmt.Errorf("field market_display_name in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["pip"]; !ok || v == nil { + return fmt.Errorf("field pip in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["subgroup"]; !ok || v == nil { + return fmt.Errorf("field subgroup in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["subgroup_display_name"]; !ok || v == nil { + return fmt.Errorf("field subgroup_display_name in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["submarket"]; !ok || v == nil { + return fmt.Errorf("field submarket in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["submarket_display_name"]; !ok || v == nil { + return fmt.Errorf("field submarket_display_name in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["symbol"]; !ok || v == nil { + return fmt.Errorf("field symbol in ActiveSymbolsRespActiveSymbolsElem: required") + } + if v, ok := raw["symbol_type"]; !ok || v == nil { + return fmt.Errorf("field symbol_type in ActiveSymbolsRespActiveSymbolsElem: required") + } + type Plain ActiveSymbolsRespActiveSymbolsElem + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = ActiveSymbolsRespActiveSymbolsElem(plain) return nil } -type ActiveSymbolsRespActiveSymbolsElemExchangeIsOpen int - var enumValues_ActiveSymbolsRespActiveSymbolsElemExchangeIsOpen = []interface{}{ 0, 1, @@ -158,86 +207,38 @@ var enumValues_ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended = []interfac } // UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended, v) - } - *j = ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsRespActiveSymbolsElem) UnmarshalJSON(b []byte) error { +func (j *ActiveSymbolsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["display_name"]; raw != nil && !ok { - return fmt.Errorf("field display_name in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["display_order"]; raw != nil && !ok { - return fmt.Errorf("field display_order in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["exchange_is_open"]; raw != nil && !ok { - return fmt.Errorf("field exchange_is_open in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["is_trading_suspended"]; raw != nil && !ok { - return fmt.Errorf("field is_trading_suspended in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["market"]; raw != nil && !ok { - return fmt.Errorf("field market in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["market_display_name"]; raw != nil && !ok { - return fmt.Errorf("field market_display_name in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["pip"]; raw != nil && !ok { - return fmt.Errorf("field pip in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["subgroup"]; raw != nil && !ok { - return fmt.Errorf("field subgroup in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["subgroup_display_name"]; raw != nil && !ok { - return fmt.Errorf("field subgroup_display_name in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["submarket"]; raw != nil && !ok { - return fmt.Errorf("field submarket in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["submarket_display_name"]; raw != nil && !ok { - return fmt.Errorf("field submarket_display_name in ActiveSymbolsRespActiveSymbolsElem: required") - } - if _, ok := raw["symbol"]; raw != nil && !ok { - return fmt.Errorf("field symbol in ActiveSymbolsRespActiveSymbolsElem: required") + if v, ok := raw["echo_req"]; !ok || v == nil { + return fmt.Errorf("field echo_req in ActiveSymbolsResp: required") } - if _, ok := raw["symbol_type"]; raw != nil && !ok { - return fmt.Errorf("field symbol_type in ActiveSymbolsRespActiveSymbolsElem: required") + if v, ok := raw["msg_type"]; !ok || v == nil { + return fmt.Errorf("field msg_type in ActiveSymbolsResp: required") } - type Plain ActiveSymbolsRespActiveSymbolsElem + type Plain ActiveSymbolsResp var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = ActiveSymbolsRespActiveSymbolsElem(plain) + *j = ActiveSymbolsResp(plain) return nil } +var enumValues_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting = []interface{}{ + 0, + 1, +} + +type ActiveSymbolsRespActiveSymbolsElemExchangeIsOpen int + // Echo of the request made. type ActiveSymbolsRespEchoReq map[string]interface{} type ActiveSymbolsRespMsgType string -const ActiveSymbolsRespMsgTypeActiveSymbols ActiveSymbolsRespMsgType = "active_symbols" - var enumValues_ActiveSymbolsRespMsgType = []interface{}{ "active_symbols", } @@ -262,23 +263,22 @@ func (j *ActiveSymbolsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsResp) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["echo_req"]; raw != nil && !ok { - return fmt.Errorf("field echo_req in ActiveSymbolsResp: required") - } - if _, ok := raw["msg_type"]; raw != nil && !ok { - return fmt.Errorf("field msg_type in ActiveSymbolsResp: required") - } - type Plain ActiveSymbolsResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = ActiveSymbolsResp(plain) - return nil +const ActiveSymbolsRespMsgTypeActiveSymbols ActiveSymbolsRespMsgType = "active_symbols" + +// A message containing the list of active symbols. +type ActiveSymbolsResp struct { + // List of active symbols. + ActiveSymbols []ActiveSymbolsRespActiveSymbolsElem `json:"active_symbols,omitempty"` + + // Echo of the request made. + EchoReq ActiveSymbolsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType ActiveSymbolsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` } + +type ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting int diff --git a/schema/api_token.go b/schema/api_token.go index 930d401..739a11e 100644 --- a/schema/api_token.go +++ b/schema/api_token.go @@ -38,38 +38,40 @@ type ApiToken struct { type ApiTokenApiToken int -var enumValues_ApiTokenApiToken = []interface{}{ - 1, -} +type ApiTokenNewTokenScopesElem string + +const ApiTokenNewTokenScopesElemAdmin ApiTokenNewTokenScopesElem = "admin" +const ApiTokenNewTokenScopesElemPayments ApiTokenNewTokenScopesElem = "payments" +const ApiTokenNewTokenScopesElemRead ApiTokenNewTokenScopesElem = "read" +const ApiTokenNewTokenScopesElemTrade ApiTokenNewTokenScopesElem = "trade" +const ApiTokenNewTokenScopesElemTradingInformation ApiTokenNewTokenScopesElem = "trading_information" + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type ApiTokenPassthrough map[string]interface{} + +type ApiTokenValidForCurrentIpOnly int // UnmarshalJSON implements json.Unmarshaler. -func (j *ApiTokenApiToken) UnmarshalJSON(b []byte) error { - var v int +func (j *ApiTokenNewTokenScopesElem) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ApiTokenApiToken { + for _, expected := range enumValues_ApiTokenNewTokenScopesElem { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ApiTokenApiToken, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ApiTokenNewTokenScopesElem, v) } - *j = ApiTokenApiToken(v) + *j = ApiTokenNewTokenScopesElem(v) return nil } -type ApiTokenNewTokenScopesElem string - -const ApiTokenNewTokenScopesElemAdmin ApiTokenNewTokenScopesElem = "admin" -const ApiTokenNewTokenScopesElemPayments ApiTokenNewTokenScopesElem = "payments" -const ApiTokenNewTokenScopesElemRead ApiTokenNewTokenScopesElem = "read" -const ApiTokenNewTokenScopesElemTrade ApiTokenNewTokenScopesElem = "trade" -const ApiTokenNewTokenScopesElemTradingInformation ApiTokenNewTokenScopesElem = "trading_information" - var enumValues_ApiTokenNewTokenScopesElem = []interface{}{ "read", "trade", @@ -79,31 +81,25 @@ var enumValues_ApiTokenNewTokenScopesElem = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *ApiTokenNewTokenScopesElem) UnmarshalJSON(b []byte) error { - var v string +func (j *ApiTokenApiToken) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ApiTokenNewTokenScopesElem { + for _, expected := range enumValues_ApiTokenApiToken { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ApiTokenNewTokenScopesElem, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ApiTokenApiToken, v) } - *j = ApiTokenNewTokenScopesElem(v) + *j = ApiTokenApiToken(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type ApiTokenPassthrough map[string]interface{} - -type ApiTokenValidForCurrentIpOnly int - var enumValues_ApiTokenValidForCurrentIpOnly = []interface{}{ 0, 1, @@ -129,13 +125,17 @@ func (j *ApiTokenValidForCurrentIpOnly) UnmarshalJSON(b []byte) error { return nil } +var enumValues_ApiTokenApiToken = []interface{}{ + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ApiToken) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["api_token"]; raw != nil && !ok { + if v, ok := raw["api_token"]; !ok || v == nil { return fmt.Errorf("field api_token in ApiToken: required") } type Plain ApiToken diff --git a/schema/api_token_resp.go b/schema/api_token_resp.go index e208724..5900159 100644 --- a/schema/api_token_resp.go +++ b/schema/api_token_resp.go @@ -36,34 +36,86 @@ type ApiTokenRespApiToken struct { type ApiTokenRespApiTokenDeleteToken int -var enumValues_ApiTokenRespApiTokenDeleteToken = []interface{}{ - 1, +type ApiTokenRespApiTokenNewToken int + +// The information for each token. +type ApiTokenRespApiTokenTokensElem struct { + // The token name specified when creating. + DisplayName *string `json:"display_name,omitempty"` + + // The last date which the token has been used. + LastUsed *string `json:"last_used,omitempty"` + + // List of permission scopes of the token. + Scopes []ApiTokenRespApiTokenTokensElemScopesElem `json:"scopes,omitempty"` + + // The token that can be used to `authorize` with. + Token *string `json:"token,omitempty"` + + // The IP restriction for the token. No restriction if empty. + ValidForIp *string `json:"valid_for_ip,omitempty"` } +type ApiTokenRespApiTokenTokensElemScopesElem string + +const ApiTokenRespApiTokenTokensElemScopesElemAdmin ApiTokenRespApiTokenTokensElemScopesElem = "admin" +const ApiTokenRespApiTokenTokensElemScopesElemPayments ApiTokenRespApiTokenTokensElemScopesElem = "payments" +const ApiTokenRespApiTokenTokensElemScopesElemRead ApiTokenRespApiTokenTokensElemScopesElem = "read" +const ApiTokenRespApiTokenTokensElemScopesElemTrade ApiTokenRespApiTokenTokensElemScopesElem = "trade" +const ApiTokenRespApiTokenTokensElemScopesElemTradingInformation ApiTokenRespApiTokenTokensElemScopesElem = "trading_information" + +// Echo of the request made. +type ApiTokenRespEchoReq map[string]interface{} + +type ApiTokenRespMsgType string + // UnmarshalJSON implements json.Unmarshaler. -func (j *ApiTokenRespApiTokenDeleteToken) UnmarshalJSON(b []byte) error { - var v int +func (j *ApiTokenResp) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["echo_req"]; !ok || v == nil { + return fmt.Errorf("field echo_req in ApiTokenResp: required") + } + if v, ok := raw["msg_type"]; !ok || v == nil { + return fmt.Errorf("field msg_type in ApiTokenResp: required") + } + type Plain ApiTokenResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = ApiTokenResp(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ApiTokenRespApiTokenTokensElemScopesElem) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ApiTokenRespApiTokenDeleteToken { + for _, expected := range enumValues_ApiTokenRespApiTokenTokensElemScopesElem { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ApiTokenRespApiTokenDeleteToken, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ApiTokenRespApiTokenTokensElemScopesElem, v) } - *j = ApiTokenRespApiTokenDeleteToken(v) + *j = ApiTokenRespApiTokenTokensElemScopesElem(v) return nil } -type ApiTokenRespApiTokenNewToken int - -var enumValues_ApiTokenRespApiTokenNewToken = []interface{}{ - 1, +var enumValues_ApiTokenRespApiTokenTokensElemScopesElem = []interface{}{ + "read", + "trade", + "trading_information", + "payments", + "admin", } // UnmarshalJSON implements json.Unmarshaler. @@ -86,67 +138,26 @@ func (j *ApiTokenRespApiTokenNewToken) UnmarshalJSON(b []byte) error { return nil } -// The information for each token. -type ApiTokenRespApiTokenTokensElem struct { - // The token name specified when creating. - DisplayName *string `json:"display_name,omitempty"` - - // The last date which the token has been used. - LastUsed *string `json:"last_used,omitempty"` - - // List of permission scopes of the token. - Scopes []ApiTokenRespApiTokenTokensElemScopesElem `json:"scopes,omitempty"` - - // The token that can be used to `authorize` with. - Token *string `json:"token,omitempty"` - - // The IP restriction for the token. No restriction if empty. - ValidForIp *string `json:"valid_for_ip,omitempty"` -} - -type ApiTokenRespApiTokenTokensElemScopesElem string - -const ApiTokenRespApiTokenTokensElemScopesElemAdmin ApiTokenRespApiTokenTokensElemScopesElem = "admin" -const ApiTokenRespApiTokenTokensElemScopesElemPayments ApiTokenRespApiTokenTokensElemScopesElem = "payments" -const ApiTokenRespApiTokenTokensElemScopesElemRead ApiTokenRespApiTokenTokensElemScopesElem = "read" -const ApiTokenRespApiTokenTokensElemScopesElemTrade ApiTokenRespApiTokenTokensElemScopesElem = "trade" -const ApiTokenRespApiTokenTokensElemScopesElemTradingInformation ApiTokenRespApiTokenTokensElemScopesElem = "trading_information" - -var enumValues_ApiTokenRespApiTokenTokensElemScopesElem = []interface{}{ - "read", - "trade", - "trading_information", - "payments", - "admin", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *ApiTokenRespApiTokenTokensElemScopesElem) UnmarshalJSON(b []byte) error { - var v string +func (j *ApiTokenRespApiTokenDeleteToken) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ApiTokenRespApiTokenTokensElemScopesElem { + for _, expected := range enumValues_ApiTokenRespApiTokenDeleteToken { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ApiTokenRespApiTokenTokensElemScopesElem, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ApiTokenRespApiTokenDeleteToken, v) } - *j = ApiTokenRespApiTokenTokensElemScopesElem(v) + *j = ApiTokenRespApiTokenDeleteToken(v) return nil } -// Echo of the request made. -type ApiTokenRespEchoReq map[string]interface{} - -type ApiTokenRespMsgType string - -const ApiTokenRespMsgTypeApiToken ApiTokenRespMsgType = "api_token" - var enumValues_ApiTokenRespMsgType = []interface{}{ "api_token", } @@ -171,23 +182,11 @@ func (j *ApiTokenRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *ApiTokenResp) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["echo_req"]; raw != nil && !ok { - return fmt.Errorf("field echo_req in ApiTokenResp: required") - } - if _, ok := raw["msg_type"]; raw != nil && !ok { - return fmt.Errorf("field msg_type in ApiTokenResp: required") - } - type Plain ApiTokenResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = ApiTokenResp(plain) - return nil +const ApiTokenRespMsgTypeApiToken ApiTokenRespMsgType = "api_token" + +var enumValues_ApiTokenRespApiTokenDeleteToken = []interface{}{ + 1, +} +var enumValues_ApiTokenRespApiTokenNewToken = []interface{}{ + 1, } diff --git a/schema/app_delete.go b/schema/app_delete.go index 66b6cef..f4969d6 100644 --- a/schema/app_delete.go +++ b/schema/app_delete.go @@ -32,7 +32,7 @@ func (j *AppDelete) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_delete"]; raw != nil && !ok { + if v, ok := raw["app_delete"]; !ok || v == nil { return fmt.Errorf("field app_delete in AppDelete: required") } type Plain AppDelete diff --git a/schema/app_delete_resp.go b/schema/app_delete_resp.go index d8407e7..d242d6a 100644 --- a/schema/app_delete_resp.go +++ b/schema/app_delete_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of delete application request made. -type AppDeleteResp struct { - // 1 on success - AppDelete *int `json:"app_delete,omitempty"` - - // Echo of the request made. - EchoReq AppDeleteRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType AppDeleteRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type AppDeleteRespEchoReq map[string]interface{} type AppDeleteRespMsgType string -const AppDeleteRespMsgTypeAppDelete AppDeleteRespMsgType = "app_delete" - var enumValues_AppDeleteRespMsgType = []interface{}{ "app_delete", } @@ -53,16 +35,34 @@ func (j *AppDeleteRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of delete application request made. +type AppDeleteResp struct { + // 1 on success + AppDelete *int `json:"app_delete,omitempty"` + + // Echo of the request made. + EchoReq AppDeleteRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType AppDeleteRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const AppDeleteRespMsgTypeAppDelete AppDeleteRespMsgType = "app_delete" + // UnmarshalJSON implements json.Unmarshaler. func (j *AppDeleteResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AppDeleteResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AppDeleteResp: required") } type Plain AppDeleteResp diff --git a/schema/app_get.go b/schema/app_get.go index a570eb3..21b5252 100644 --- a/schema/app_get.go +++ b/schema/app_get.go @@ -32,7 +32,7 @@ func (j *AppGet) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_get"]; raw != nil && !ok { + if v, ok := raw["app_get"]; !ok || v == nil { return fmt.Errorf("field app_get in AppGet: required") } type Plain AppGet diff --git a/schema/app_get_resp.go b/schema/app_get_resp.go index 1660c2f..bb4352f 100644 --- a/schema/app_get_resp.go +++ b/schema/app_get_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with requested application details -type AppGetResp struct { - // The information of the requested application. - AppGet *AppGetRespAppGet `json:"app_get,omitempty"` - - // Echo of the request made. - EchoReq AppGetRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType AppGetRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // The information of the requested application. type AppGetRespAppGet struct { // Active. @@ -66,31 +50,31 @@ func (j *AppGetRespAppGet) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_id"]; raw != nil && !ok { + if v, ok := raw["app_id"]; !ok || v == nil { return fmt.Errorf("field app_id in AppGetRespAppGet: required") } - if _, ok := raw["app_markup_percentage"]; raw != nil && !ok { + if v, ok := raw["app_markup_percentage"]; !ok || v == nil { return fmt.Errorf("field app_markup_percentage in AppGetRespAppGet: required") } - if _, ok := raw["appstore"]; raw != nil && !ok { + if v, ok := raw["appstore"]; !ok || v == nil { return fmt.Errorf("field appstore in AppGetRespAppGet: required") } - if _, ok := raw["github"]; raw != nil && !ok { + if v, ok := raw["github"]; !ok || v == nil { return fmt.Errorf("field github in AppGetRespAppGet: required") } - if _, ok := raw["googleplay"]; raw != nil && !ok { + if v, ok := raw["googleplay"]; !ok || v == nil { return fmt.Errorf("field googleplay in AppGetRespAppGet: required") } - if _, ok := raw["homepage"]; raw != nil && !ok { + if v, ok := raw["homepage"]; !ok || v == nil { return fmt.Errorf("field homepage in AppGetRespAppGet: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in AppGetRespAppGet: required") } - if _, ok := raw["redirect_uri"]; raw != nil && !ok { + if v, ok := raw["redirect_uri"]; !ok || v == nil { return fmt.Errorf("field redirect_uri in AppGetRespAppGet: required") } - if _, ok := raw["verification_uri"]; raw != nil && !ok { + if v, ok := raw["verification_uri"]; !ok || v == nil { return fmt.Errorf("field verification_uri in AppGetRespAppGet: required") } type Plain AppGetRespAppGet @@ -107,8 +91,6 @@ type AppGetRespEchoReq map[string]interface{} type AppGetRespMsgType string -const AppGetRespMsgTypeAppGet AppGetRespMsgType = "app_get" - var enumValues_AppGetRespMsgType = []interface{}{ "app_get", } @@ -133,16 +115,34 @@ func (j *AppGetRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with requested application details +type AppGetResp struct { + // The information of the requested application. + AppGet *AppGetRespAppGet `json:"app_get,omitempty"` + + // Echo of the request made. + EchoReq AppGetRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType AppGetRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const AppGetRespMsgTypeAppGet AppGetRespMsgType = "app_get" + // UnmarshalJSON implements json.Unmarshaler. func (j *AppGetResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AppGetResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AppGetResp: required") } type Plain AppGetResp diff --git a/schema/app_list.go b/schema/app_list.go index 85152aa..90cc9ae 100644 --- a/schema/app_list.go +++ b/schema/app_list.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// List all of the account's OAuth applications -type AppList struct { - // Must be `1` - AppList AppListAppList `json:"app_list"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough AppListPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type AppListAppList int var enumValues_AppListAppList = []interface{}{ @@ -49,6 +32,23 @@ func (j *AppListAppList) UnmarshalJSON(b []byte) error { return nil } +// List all of the account's OAuth applications +type AppList struct { + // Must be `1` + AppList AppListAppList `json:"app_list"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough AppListPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type AppListPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *AppList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_list"]; raw != nil && !ok { + if v, ok := raw["app_list"]; !ok || v == nil { return fmt.Errorf("field app_list in AppList: required") } type Plain AppList diff --git a/schema/app_list_resp.go b/schema/app_list_resp.go index c90f5d2..bb10c00 100644 --- a/schema/app_list_resp.go +++ b/schema/app_list_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with created applications -type AppListResp struct { - // List of created applications for the authorized account. - AppList []AppListRespAppListElem `json:"app_list,omitempty"` - - // Echo of the request made. - EchoReq AppListRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType AppListRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - type AppListRespAppListElem struct { // Active. Active *int `json:"active,omitempty"` @@ -65,31 +49,31 @@ func (j *AppListRespAppListElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_id"]; raw != nil && !ok { + if v, ok := raw["app_id"]; !ok || v == nil { return fmt.Errorf("field app_id in AppListRespAppListElem: required") } - if _, ok := raw["app_markup_percentage"]; raw != nil && !ok { + if v, ok := raw["app_markup_percentage"]; !ok || v == nil { return fmt.Errorf("field app_markup_percentage in AppListRespAppListElem: required") } - if _, ok := raw["appstore"]; raw != nil && !ok { + if v, ok := raw["appstore"]; !ok || v == nil { return fmt.Errorf("field appstore in AppListRespAppListElem: required") } - if _, ok := raw["github"]; raw != nil && !ok { + if v, ok := raw["github"]; !ok || v == nil { return fmt.Errorf("field github in AppListRespAppListElem: required") } - if _, ok := raw["googleplay"]; raw != nil && !ok { + if v, ok := raw["googleplay"]; !ok || v == nil { return fmt.Errorf("field googleplay in AppListRespAppListElem: required") } - if _, ok := raw["homepage"]; raw != nil && !ok { + if v, ok := raw["homepage"]; !ok || v == nil { return fmt.Errorf("field homepage in AppListRespAppListElem: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in AppListRespAppListElem: required") } - if _, ok := raw["redirect_uri"]; raw != nil && !ok { + if v, ok := raw["redirect_uri"]; !ok || v == nil { return fmt.Errorf("field redirect_uri in AppListRespAppListElem: required") } - if _, ok := raw["verification_uri"]; raw != nil && !ok { + if v, ok := raw["verification_uri"]; !ok || v == nil { return fmt.Errorf("field verification_uri in AppListRespAppListElem: required") } type Plain AppListRespAppListElem @@ -106,8 +90,6 @@ type AppListRespEchoReq map[string]interface{} type AppListRespMsgType string -const AppListRespMsgTypeAppList AppListRespMsgType = "app_list" - var enumValues_AppListRespMsgType = []interface{}{ "app_list", } @@ -132,16 +114,34 @@ func (j *AppListRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with created applications +type AppListResp struct { + // List of created applications for the authorized account. + AppList []AppListRespAppListElem `json:"app_list,omitempty"` + + // Echo of the request made. + EchoReq AppListRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType AppListRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const AppListRespMsgTypeAppList AppListRespMsgType = "app_list" + // UnmarshalJSON implements json.Unmarshaler. func (j *AppListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AppListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AppListResp: required") } type Plain AppListResp diff --git a/schema/app_markup_details.go b/schema/app_markup_details.go index b6c25b9..7805da0 100644 --- a/schema/app_markup_details.go +++ b/schema/app_markup_details.go @@ -54,8 +54,42 @@ type AppMarkupDetails struct { type AppMarkupDetailsAppMarkupDetails int -var enumValues_AppMarkupDetailsAppMarkupDetails = []interface{}{ - 1, +type AppMarkupDetailsDescription int + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type AppMarkupDetailsPassthrough map[string]interface{} + +type AppMarkupDetailsSort string + +const AppMarkupDetailsSortASC AppMarkupDetailsSort = "ASC" +const AppMarkupDetailsSortDESC AppMarkupDetailsSort = "DESC" + +type AppMarkupDetailsSortFieldsElem string + +var enumValues_AppMarkupDetailsSort = []interface{}{ + "ASC", + "DESC", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *AppMarkupDetailsSort) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_AppMarkupDetailsSort { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AppMarkupDetailsSort, v) + } + *j = AppMarkupDetailsSort(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -78,8 +112,6 @@ func (j *AppMarkupDetailsAppMarkupDetails) UnmarshalJSON(b []byte) error { return nil } -type AppMarkupDetailsDescription int - var enumValues_AppMarkupDetailsDescription = []interface{}{ 0, 1, @@ -105,21 +137,6 @@ func (j *AppMarkupDetailsDescription) UnmarshalJSON(b []byte) error { return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type AppMarkupDetailsPassthrough map[string]interface{} - -type AppMarkupDetailsSort string - -const AppMarkupDetailsSortASC AppMarkupDetailsSort = "ASC" -const AppMarkupDetailsSortDESC AppMarkupDetailsSort = "DESC" - -type AppMarkupDetailsSortFieldsElem string - -const AppMarkupDetailsSortFieldsElemAppId AppMarkupDetailsSortFieldsElem = "app_id" -const AppMarkupDetailsSortFieldsElemClientLoginid AppMarkupDetailsSortFieldsElem = "client_loginid" -const AppMarkupDetailsSortFieldsElemTransactionTime AppMarkupDetailsSortFieldsElem = "transaction_time" - var enumValues_AppMarkupDetailsSortFieldsElem = []interface{}{ "app_id", "client_loginid", @@ -146,29 +163,12 @@ func (j *AppMarkupDetailsSortFieldsElem) UnmarshalJSON(b []byte) error { return nil } -var enumValues_AppMarkupDetailsSort = []interface{}{ - "ASC", - "DESC", -} +const AppMarkupDetailsSortFieldsElemAppId AppMarkupDetailsSortFieldsElem = "app_id" +const AppMarkupDetailsSortFieldsElemClientLoginid AppMarkupDetailsSortFieldsElem = "client_loginid" +const AppMarkupDetailsSortFieldsElemTransactionTime AppMarkupDetailsSortFieldsElem = "transaction_time" -// UnmarshalJSON implements json.Unmarshaler. -func (j *AppMarkupDetailsSort) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_AppMarkupDetailsSort { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AppMarkupDetailsSort, v) - } - *j = AppMarkupDetailsSort(v) - return nil +var enumValues_AppMarkupDetailsAppMarkupDetails = []interface{}{ + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -177,13 +177,13 @@ func (j *AppMarkupDetails) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_markup_details"]; raw != nil && !ok { + if v, ok := raw["app_markup_details"]; !ok || v == nil { return fmt.Errorf("field app_markup_details in AppMarkupDetails: required") } - if _, ok := raw["date_from"]; raw != nil && !ok { + if v, ok := raw["date_from"]; !ok || v == nil { return fmt.Errorf("field date_from in AppMarkupDetails: required") } - if _, ok := raw["date_to"]; raw != nil && !ok { + if v, ok := raw["date_to"]; !ok || v == nil { return fmt.Errorf("field date_to in AppMarkupDetails: required") } type Plain AppMarkupDetails diff --git a/schema/app_markup_details_resp.go b/schema/app_markup_details_resp.go index 5b44e0f..9ca3e10 100644 --- a/schema/app_markup_details_resp.go +++ b/schema/app_markup_details_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Per transaction reporting of app_markup -type AppMarkupDetailsResp struct { - // App Markup transaction details - AppMarkupDetails *AppMarkupDetailsRespAppMarkupDetails `json:"app_markup_details,omitempty"` - - // Echo of the request made. - EchoReq AppMarkupDetailsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType AppMarkupDetailsRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // App Markup transaction details type AppMarkupDetailsRespAppMarkupDetails struct { // Array of returned transactions @@ -66,8 +50,6 @@ type AppMarkupDetailsRespEchoReq map[string]interface{} type AppMarkupDetailsRespMsgType string -const AppMarkupDetailsRespMsgTypeAppMarkupDetails AppMarkupDetailsRespMsgType = "app_markup_details" - var enumValues_AppMarkupDetailsRespMsgType = []interface{}{ "app_markup_details", } @@ -92,16 +74,34 @@ func (j *AppMarkupDetailsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Per transaction reporting of app_markup +type AppMarkupDetailsResp struct { + // App Markup transaction details + AppMarkupDetails *AppMarkupDetailsRespAppMarkupDetails `json:"app_markup_details,omitempty"` + + // Echo of the request made. + EchoReq AppMarkupDetailsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType AppMarkupDetailsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const AppMarkupDetailsRespMsgTypeAppMarkupDetails AppMarkupDetailsRespMsgType = "app_markup_details" + // UnmarshalJSON implements json.Unmarshaler. func (j *AppMarkupDetailsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AppMarkupDetailsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AppMarkupDetailsResp: required") } type Plain AppMarkupDetailsResp diff --git a/schema/app_markup_statistics.go b/schema/app_markup_statistics.go index 335fabf..482a118 100644 --- a/schema/app_markup_statistics.go +++ b/schema/app_markup_statistics.go @@ -6,29 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieve statistics of `app_markup`. -type AppMarkupStatistics struct { - // Must be `1` - AppMarkupStatistics AppMarkupStatisticsAppMarkupStatistics `json:"app_markup_statistics"` - - // Start date (epoch or YYYY-MM-DD HH:MM:SS). Results are inclusive of this time. - DateFrom string `json:"date_from"` - - // End date (epoch or YYYY-MM-DD HH::MM::SS). Results are inclusive of this time. - DateTo string `json:"date_to"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough AppMarkupStatisticsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type AppMarkupStatisticsAppMarkupStatistics int var enumValues_AppMarkupStatisticsAppMarkupStatistics = []interface{}{ @@ -55,6 +32,29 @@ func (j *AppMarkupStatisticsAppMarkupStatistics) UnmarshalJSON(b []byte) error { return nil } +// Retrieve statistics of `app_markup`. +type AppMarkupStatistics struct { + // Must be `1` + AppMarkupStatistics AppMarkupStatisticsAppMarkupStatistics `json:"app_markup_statistics"` + + // Start date (epoch or YYYY-MM-DD HH:MM:SS). Results are inclusive of this time. + DateFrom string `json:"date_from"` + + // End date (epoch or YYYY-MM-DD HH::MM::SS). Results are inclusive of this time. + DateTo string `json:"date_to"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough AppMarkupStatisticsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type AppMarkupStatisticsPassthrough map[string]interface{} @@ -65,13 +65,13 @@ func (j *AppMarkupStatistics) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_markup_statistics"]; raw != nil && !ok { + if v, ok := raw["app_markup_statistics"]; !ok || v == nil { return fmt.Errorf("field app_markup_statistics in AppMarkupStatistics: required") } - if _, ok := raw["date_from"]; raw != nil && !ok { + if v, ok := raw["date_from"]; !ok || v == nil { return fmt.Errorf("field date_from in AppMarkupStatistics: required") } - if _, ok := raw["date_to"]; raw != nil && !ok { + if v, ok := raw["date_to"]; !ok || v == nil { return fmt.Errorf("field date_to in AppMarkupStatistics: required") } type Plain AppMarkupStatistics diff --git a/schema/app_markup_statistics_resp.go b/schema/app_markup_statistics_resp.go index 1c887b2..eae2923 100644 --- a/schema/app_markup_statistics_resp.go +++ b/schema/app_markup_statistics_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Per application reporting of app_markup -type AppMarkupStatisticsResp struct { - // App Markup transaction statistics - AppMarkupStatistics *AppMarkupStatisticsRespAppMarkupStatistics `json:"app_markup_statistics,omitempty"` - - // Echo of the request made. - EchoReq AppMarkupStatisticsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType AppMarkupStatisticsRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // App Markup transaction statistics type AppMarkupStatisticsRespAppMarkupStatistics struct { // Array of summed app markups grouped by app_id @@ -56,8 +40,6 @@ type AppMarkupStatisticsRespEchoReq map[string]interface{} type AppMarkupStatisticsRespMsgType string -const AppMarkupStatisticsRespMsgTypeAppMarkupStatistics AppMarkupStatisticsRespMsgType = "app_markup_statistics" - var enumValues_AppMarkupStatisticsRespMsgType = []interface{}{ "app_markup_statistics", } @@ -82,16 +64,34 @@ func (j *AppMarkupStatisticsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Per application reporting of app_markup +type AppMarkupStatisticsResp struct { + // App Markup transaction statistics + AppMarkupStatistics *AppMarkupStatisticsRespAppMarkupStatistics `json:"app_markup_statistics,omitempty"` + + // Echo of the request made. + EchoReq AppMarkupStatisticsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType AppMarkupStatisticsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const AppMarkupStatisticsRespMsgTypeAppMarkupStatistics AppMarkupStatisticsRespMsgType = "app_markup_statistics" + // UnmarshalJSON implements json.Unmarshaler. func (j *AppMarkupStatisticsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AppMarkupStatisticsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AppMarkupStatisticsResp: required") } type Plain AppMarkupStatisticsResp diff --git a/schema/app_register.go b/schema/app_register.go index 5efd9df..d85bf95 100644 --- a/schema/app_register.go +++ b/schema/app_register.go @@ -6,6 +6,76 @@ import "encoding/json" import "fmt" import "reflect" +// UnmarshalJSON implements json.Unmarshaler. +func (j *AppRegisterScopesElem) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_AppRegisterScopesElem { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AppRegisterScopesElem, v) + } + *j = AppRegisterScopesElem(v) + return nil +} + +type AppRegisterScopesElem string + +// UnmarshalJSON implements json.Unmarshaler. +func (j *AppRegisterAppRegister) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_AppRegisterAppRegister { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AppRegisterAppRegister, v) + } + *j = AppRegisterAppRegister(v) + return nil +} + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type AppRegisterPassthrough map[string]interface{} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *AppRegister) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["app_register"]; !ok || v == nil { + return fmt.Errorf("field app_register in AppRegister: required") + } + if v, ok := raw["name"]; !ok || v == nil { + return fmt.Errorf("field name in AppRegister: required") + } + if v, ok := raw["scopes"]; !ok || v == nil { + return fmt.Errorf("field scopes in AppRegister: required") + } + type Plain AppRegister + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = AppRegister(plain) + return nil +} + // Register a new OAuth application type AppRegister struct { // [Optional] Markup to be added to contract prices (as a percentage of contract @@ -56,42 +126,15 @@ type AppRegister struct { type AppRegisterAppRegister int -var enumValues_AppRegisterAppRegister = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *AppRegisterAppRegister) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_AppRegisterAppRegister { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AppRegisterAppRegister, v) - } - *j = AppRegisterAppRegister(v) - return nil -} - -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type AppRegisterPassthrough map[string]interface{} - -type AppRegisterScopesElem string - const AppRegisterScopesElemAdmin AppRegisterScopesElem = "admin" const AppRegisterScopesElemPayments AppRegisterScopesElem = "payments" const AppRegisterScopesElemRead AppRegisterScopesElem = "read" const AppRegisterScopesElemTrade AppRegisterScopesElem = "trade" const AppRegisterScopesElemTradingInformation AppRegisterScopesElem = "trading_information" +var enumValues_AppRegisterAppRegister = []interface{}{ + 1, +} var enumValues_AppRegisterScopesElem = []interface{}{ "read", "trade", @@ -99,47 +142,3 @@ var enumValues_AppRegisterScopesElem = []interface{}{ "payments", "admin", } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *AppRegisterScopesElem) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_AppRegisterScopesElem { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AppRegisterScopesElem, v) - } - *j = AppRegisterScopesElem(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *AppRegister) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["app_register"]; raw != nil && !ok { - return fmt.Errorf("field app_register in AppRegister: required") - } - if _, ok := raw["name"]; raw != nil && !ok { - return fmt.Errorf("field name in AppRegister: required") - } - if _, ok := raw["scopes"]; raw != nil && !ok { - return fmt.Errorf("field scopes in AppRegister: required") - } - type Plain AppRegister - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = AppRegister(plain) - return nil -} diff --git a/schema/app_register_resp.go b/schema/app_register_resp.go index 76e7bb5..8cff39a 100644 --- a/schema/app_register_resp.go +++ b/schema/app_register_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with created application details -type AppRegisterResp struct { - // The information of the created application. - AppRegister *AppRegisterRespAppRegister `json:"app_register,omitempty"` - - // Echo of the request made. - EchoReq AppRegisterRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType AppRegisterRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // The information of the created application. type AppRegisterRespAppRegister struct { // Active. @@ -66,31 +50,31 @@ func (j *AppRegisterRespAppRegister) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_id"]; raw != nil && !ok { + if v, ok := raw["app_id"]; !ok || v == nil { return fmt.Errorf("field app_id in AppRegisterRespAppRegister: required") } - if _, ok := raw["app_markup_percentage"]; raw != nil && !ok { + if v, ok := raw["app_markup_percentage"]; !ok || v == nil { return fmt.Errorf("field app_markup_percentage in AppRegisterRespAppRegister: required") } - if _, ok := raw["appstore"]; raw != nil && !ok { + if v, ok := raw["appstore"]; !ok || v == nil { return fmt.Errorf("field appstore in AppRegisterRespAppRegister: required") } - if _, ok := raw["github"]; raw != nil && !ok { + if v, ok := raw["github"]; !ok || v == nil { return fmt.Errorf("field github in AppRegisterRespAppRegister: required") } - if _, ok := raw["googleplay"]; raw != nil && !ok { + if v, ok := raw["googleplay"]; !ok || v == nil { return fmt.Errorf("field googleplay in AppRegisterRespAppRegister: required") } - if _, ok := raw["homepage"]; raw != nil && !ok { + if v, ok := raw["homepage"]; !ok || v == nil { return fmt.Errorf("field homepage in AppRegisterRespAppRegister: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in AppRegisterRespAppRegister: required") } - if _, ok := raw["redirect_uri"]; raw != nil && !ok { + if v, ok := raw["redirect_uri"]; !ok || v == nil { return fmt.Errorf("field redirect_uri in AppRegisterRespAppRegister: required") } - if _, ok := raw["verification_uri"]; raw != nil && !ok { + if v, ok := raw["verification_uri"]; !ok || v == nil { return fmt.Errorf("field verification_uri in AppRegisterRespAppRegister: required") } type Plain AppRegisterRespAppRegister @@ -107,8 +91,6 @@ type AppRegisterRespEchoReq map[string]interface{} type AppRegisterRespMsgType string -const AppRegisterRespMsgTypeAppRegister AppRegisterRespMsgType = "app_register" - var enumValues_AppRegisterRespMsgType = []interface{}{ "app_register", } @@ -133,16 +115,34 @@ func (j *AppRegisterRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with created application details +type AppRegisterResp struct { + // The information of the created application. + AppRegister *AppRegisterRespAppRegister `json:"app_register,omitempty"` + + // Echo of the request made. + EchoReq AppRegisterRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType AppRegisterRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const AppRegisterRespMsgTypeAppRegister AppRegisterRespMsgType = "app_register" + // UnmarshalJSON implements json.Unmarshaler. func (j *AppRegisterResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AppRegisterResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AppRegisterResp: required") } type Plain AppRegisterResp diff --git a/schema/app_update.go b/schema/app_update.go index df05770..d9beec2 100644 --- a/schema/app_update.go +++ b/schema/app_update.go @@ -6,6 +6,40 @@ import "encoding/json" import "fmt" import "reflect" +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type AppUpdatePassthrough map[string]interface{} + +type AppUpdateScopesElem string + +var enumValues_AppUpdateScopesElem = []interface{}{ + "read", + "trade", + "trading_information", + "payments", + "admin", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *AppUpdateScopesElem) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_AppUpdateScopesElem { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AppUpdateScopesElem, v) + } + *j = AppUpdateScopesElem(v) + return nil +} + // Update a new OAuth application type AppUpdate struct { // [Optional] Markup to be added to contract prices (as a percentage of contract @@ -54,59 +88,25 @@ type AppUpdate struct { VerificationUri *string `json:"verification_uri,omitempty"` } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type AppUpdatePassthrough map[string]interface{} - -type AppUpdateScopesElem string - const AppUpdateScopesElemAdmin AppUpdateScopesElem = "admin" const AppUpdateScopesElemPayments AppUpdateScopesElem = "payments" const AppUpdateScopesElemRead AppUpdateScopesElem = "read" const AppUpdateScopesElemTrade AppUpdateScopesElem = "trade" const AppUpdateScopesElemTradingInformation AppUpdateScopesElem = "trading_information" -var enumValues_AppUpdateScopesElem = []interface{}{ - "read", - "trade", - "trading_information", - "payments", - "admin", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *AppUpdateScopesElem) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_AppUpdateScopesElem { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AppUpdateScopesElem, v) - } - *j = AppUpdateScopesElem(v) - return nil -} - // UnmarshalJSON implements json.Unmarshaler. func (j *AppUpdate) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_update"]; raw != nil && !ok { + if v, ok := raw["app_update"]; !ok || v == nil { return fmt.Errorf("field app_update in AppUpdate: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in AppUpdate: required") } - if _, ok := raw["scopes"]; raw != nil && !ok { + if v, ok := raw["scopes"]; !ok || v == nil { return fmt.Errorf("field scopes in AppUpdate: required") } type Plain AppUpdate diff --git a/schema/app_update_resp.go b/schema/app_update_resp.go index d228998..f0eb654 100644 --- a/schema/app_update_resp.go +++ b/schema/app_update_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with created application -type AppUpdateResp struct { - // Information of the updated application. - AppUpdate *AppUpdateRespAppUpdate `json:"app_update,omitempty"` - - // Echo of the request made. - EchoReq AppUpdateRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType AppUpdateRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Information of the updated application. type AppUpdateRespAppUpdate struct { // Active. @@ -65,8 +49,6 @@ type AppUpdateRespEchoReq map[string]interface{} type AppUpdateRespMsgType string -const AppUpdateRespMsgTypeAppUpdate AppUpdateRespMsgType = "app_update" - var enumValues_AppUpdateRespMsgType = []interface{}{ "app_update", } @@ -91,16 +73,34 @@ func (j *AppUpdateRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with created application +type AppUpdateResp struct { + // Information of the updated application. + AppUpdate *AppUpdateRespAppUpdate `json:"app_update,omitempty"` + + // Echo of the request made. + EchoReq AppUpdateRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType AppUpdateRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const AppUpdateRespMsgTypeAppUpdate AppUpdateRespMsgType = "app_update" + // UnmarshalJSON implements json.Unmarshaler. func (j *AppUpdateResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AppUpdateResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AppUpdateResp: required") } type Plain AppUpdateResp diff --git a/schema/asset_index.go b/schema/asset_index.go index e6ef511..079fea6 100644 --- a/schema/asset_index.go +++ b/schema/asset_index.go @@ -34,30 +34,6 @@ type AssetIndex struct { type AssetIndexAssetIndex int -var enumValues_AssetIndexAssetIndex = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *AssetIndexAssetIndex) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_AssetIndexAssetIndex { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AssetIndexAssetIndex, v) - } - *j = AssetIndexAssetIndex(v) - return nil -} - type AssetIndexLandingCompany string const AssetIndexLandingCompanyIom AssetIndexLandingCompany = "iom" @@ -102,19 +78,30 @@ func (j *AssetIndexLandingCompanyShort) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *AssetIndexAssetIndex) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_AssetIndexAssetIndex { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AssetIndexAssetIndex, v) + } + *j = AssetIndexAssetIndex(v) + return nil +} + const AssetIndexLandingCompanySvg AssetIndexLandingCompany = "svg" const AssetIndexLandingCompanyVanuatu AssetIndexLandingCompany = "vanuatu" const AssetIndexLandingCompanyVirtual AssetIndexLandingCompany = "virtual" -var enumValues_AssetIndexLandingCompany = []interface{}{ - "iom", - "malta", - "maltainvest", - "svg", - "virtual", - "vanuatu", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *AssetIndexLandingCompany) UnmarshalJSON(b []byte) error { var v string @@ -139,13 +126,25 @@ func (j *AssetIndexLandingCompany) UnmarshalJSON(b []byte) error { // the `echo_req` output field. type AssetIndexPassthrough map[string]interface{} +var enumValues_AssetIndexAssetIndex = []interface{}{ + 1, +} +var enumValues_AssetIndexLandingCompany = []interface{}{ + "iom", + "malta", + "maltainvest", + "svg", + "virtual", + "vanuatu", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *AssetIndex) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["asset_index"]; raw != nil && !ok { + if v, ok := raw["asset_index"]; !ok || v == nil { return fmt.Errorf("field asset_index in AssetIndex: required") } type Plain AssetIndex diff --git a/schema/asset_index_resp.go b/schema/asset_index_resp.go index b99fd86..d10debb 100644 --- a/schema/asset_index_resp.go +++ b/schema/asset_index_resp.go @@ -6,30 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with Asset Index -type AssetIndexResp struct { - // List of underlyings by their display name and symbol followed by their - // available contract types and duration boundaries. - AssetIndex []interface{} `json:"asset_index,omitempty"` - - // Echo of the request made. - EchoReq AssetIndexRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType AssetIndexRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type AssetIndexRespEchoReq map[string]interface{} type AssetIndexRespMsgType string -const AssetIndexRespMsgTypeAssetIndex AssetIndexRespMsgType = "asset_index" - var enumValues_AssetIndexRespMsgType = []interface{}{ "asset_index", } @@ -54,16 +35,35 @@ func (j *AssetIndexRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with Asset Index +type AssetIndexResp struct { + // List of underlyings by their display name and symbol followed by their + // available contract types and duration boundaries. + AssetIndex []interface{} `json:"asset_index,omitempty"` + + // Echo of the request made. + EchoReq AssetIndexRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType AssetIndexRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const AssetIndexRespMsgTypeAssetIndex AssetIndexRespMsgType = "asset_index" + // UnmarshalJSON implements json.Unmarshaler. func (j *AssetIndexResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AssetIndexResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AssetIndexResp: required") } type Plain AssetIndexResp diff --git a/schema/authorize.go b/schema/authorize.go index ef9570f..b3608c6 100644 --- a/schema/authorize.go +++ b/schema/authorize.go @@ -6,31 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Authorize current WebSocket session to act on behalf of the owner of a given -// token. Must precede requests that need to access client account, for example -// purchasing and selling contracts or viewing portfolio. -type Authorize struct { - // [Optional] Send this when you use api tokens for authorization and want to - // track activity using `login_history` call. - AddToLoginHistory AuthorizeAddToLoginHistory `json:"add_to_login_history,omitempty"` - - // Authentication token. May be retrieved from - // https://www.binary.com/en/user/security/api_tokenws.html. Set to MULTI when - // using multiple tokens. - Authorize string `json:"authorize"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough AuthorizePassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Additional Authentication tokens of authorized user that may be used in this - // session. Upto 25 tokens. - Tokens []string `json:"tokens,omitempty"` -} - type AuthorizeAddToLoginHistory int var enumValues_AuthorizeAddToLoginHistory = []interface{}{ @@ -58,6 +33,31 @@ func (j *AuthorizeAddToLoginHistory) UnmarshalJSON(b []byte) error { return nil } +// Authorize current WebSocket session to act on behalf of the owner of a given +// token. Must precede requests that need to access client account, for example +// purchasing and selling contracts or viewing portfolio. +type Authorize struct { + // [Optional] Send this when you use api tokens for authorization and want to + // track activity using `login_history` call. + AddToLoginHistory AuthorizeAddToLoginHistory `json:"add_to_login_history,omitempty"` + + // Authentication token. May be retrieved from + // https://www.binary.com/en/user/security/api_tokenws.html. Set to MULTI when + // using multiple tokens. + Authorize string `json:"authorize"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough AuthorizePassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Additional Authentication tokens of authorized user that may be used in this + // session. Upto 25 tokens. + Tokens []string `json:"tokens,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type AuthorizePassthrough map[string]interface{} @@ -68,7 +68,7 @@ func (j *Authorize) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["authorize"]; raw != nil && !ok { + if v, ok := raw["authorize"]; !ok || v == nil { return fmt.Errorf("field authorize in Authorize: required") } type Plain Authorize diff --git a/schema/authorize_resp.go b/schema/authorize_resp.go index 803c4cc..720606a 100644 --- a/schema/authorize_resp.go +++ b/schema/authorize_resp.go @@ -121,10 +121,108 @@ type AuthorizeRespAuthorizeAccountListElemAccountCategory string const AuthorizeRespAuthorizeAccountListElemAccountCategoryTrading AuthorizeRespAuthorizeAccountListElemAccountCategory = "trading" const AuthorizeRespAuthorizeAccountListElemAccountCategoryWallet AuthorizeRespAuthorizeAccountListElemAccountCategory = "wallet" +type AuthorizeRespAuthorizeAccountListElemIsDisabled int + +type AuthorizeRespAuthorizeAccountListElemIsVirtual int + +type AuthorizeRespAuthorizeAccountListElemLinkedToElem struct { + // Account ID. + Loginid *string `json:"loginid,omitempty"` + + // Account platform name. + Platform *AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform `json:"platform,omitempty"` +} + +type AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform string + +const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformCtrader AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "ctrader" +const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformDerivez AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "derivez" +const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformDtrade AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "dtrade" +const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformDwallet AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "dwallet" +const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformDxtrade AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "dxtrade" +const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformMt5 AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "mt5" + +type AuthorizeRespAuthorizeIsVirtual int + +type AuthorizeRespAuthorizeLinkedToElem struct { + // Account ID. + Loginid *string `json:"loginid,omitempty"` + + // Account platform name. + Platform *AuthorizeRespAuthorizeLinkedToElemPlatform `json:"platform,omitempty"` +} + +type AuthorizeRespAuthorizeLinkedToElemPlatform string + +const AuthorizeRespAuthorizeLinkedToElemPlatformCtrader AuthorizeRespAuthorizeLinkedToElemPlatform = "ctrader" +const AuthorizeRespAuthorizeLinkedToElemPlatformDerivez AuthorizeRespAuthorizeLinkedToElemPlatform = "derivez" +const AuthorizeRespAuthorizeLinkedToElemPlatformDtrade AuthorizeRespAuthorizeLinkedToElemPlatform = "dtrade" +const AuthorizeRespAuthorizeLinkedToElemPlatformDwallet AuthorizeRespAuthorizeLinkedToElemPlatform = "dwallet" +const AuthorizeRespAuthorizeLinkedToElemPlatformDxtrade AuthorizeRespAuthorizeLinkedToElemPlatform = "dxtrade" +const AuthorizeRespAuthorizeLinkedToElemPlatformMt5 AuthorizeRespAuthorizeLinkedToElemPlatform = "mt5" + +// Currencies in client's residence country +type AuthorizeRespAuthorizeLocalCurrencies map[string]interface{} + +// Echo of the request made. +type AuthorizeRespEchoReq map[string]interface{} + +type AuthorizeRespMsgType string + +const AuthorizeRespMsgTypeAuthorize AuthorizeRespMsgType = "authorize" + var enumValues_AuthorizeRespAuthorizeAccountListElemAccountCategory = []interface{}{ "trading", "wallet", } +var enumValues_AuthorizeRespAuthorizeAccountListElemIsDisabled = []interface{}{ + 1, + 0, +} +var enumValues_AuthorizeRespAuthorizeAccountListElemIsVirtual = []interface{}{ + 1, + 0, +} +var enumValues_AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = []interface{}{ + "ctrader", + "derivez", + "dtrade", + "dwallet", + "dxtrade", + "mt5", +} +var enumValues_AuthorizeRespAuthorizeIsVirtual = []interface{}{ + 0, + 1, +} +var enumValues_AuthorizeRespAuthorizeLinkedToElemPlatform = []interface{}{ + "ctrader", + "derivez", + "dtrade", + "dwallet", + "dxtrade", + "mt5", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform, v) + } + *j = AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform(v) + return nil +} // UnmarshalJSON implements json.Unmarshaler. func (j *AuthorizeRespAuthorizeAccountListElemAccountCategory) UnmarshalJSON(b []byte) error { @@ -146,13 +244,6 @@ func (j *AuthorizeRespAuthorizeAccountListElemAccountCategory) UnmarshalJSON(b [ return nil } -type AuthorizeRespAuthorizeAccountListElemIsDisabled int - -var enumValues_AuthorizeRespAuthorizeAccountListElemIsDisabled = []interface{}{ - 1, - 0, -} - // UnmarshalJSON implements json.Unmarshaler. func (j *AuthorizeRespAuthorizeAccountListElemIsDisabled) UnmarshalJSON(b []byte) error { var v int @@ -173,13 +264,6 @@ func (j *AuthorizeRespAuthorizeAccountListElemIsDisabled) UnmarshalJSON(b []byte return nil } -type AuthorizeRespAuthorizeAccountListElemIsVirtual int - -var enumValues_AuthorizeRespAuthorizeAccountListElemIsVirtual = []interface{}{ - 1, - 0, -} - // UnmarshalJSON implements json.Unmarshaler. func (j *AuthorizeRespAuthorizeAccountListElemIsVirtual) UnmarshalJSON(b []byte) error { var v int @@ -200,59 +284,30 @@ func (j *AuthorizeRespAuthorizeAccountListElemIsVirtual) UnmarshalJSON(b []byte) return nil } -type AuthorizeRespAuthorizeAccountListElemLinkedToElem struct { - // Account ID. - Loginid *string `json:"loginid,omitempty"` - - // Account platform name. - Platform *AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform `json:"platform,omitempty"` -} - -type AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform string - -const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformCtrader AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "ctrader" -const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformDerivez AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "derivez" -const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformDtrade AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "dtrade" -const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformDwallet AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "dwallet" -const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformDxtrade AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "dxtrade" -const AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatformMt5 AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = "mt5" - -var enumValues_AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform = []interface{}{ - "ctrader", - "derivez", - "dtrade", - "dwallet", - "dxtrade", - "mt5", +var enumValues_AuthorizeRespMsgType = []interface{}{ + "authorize", } // UnmarshalJSON implements json.Unmarshaler. -func (j *AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform) UnmarshalJSON(b []byte) error { +func (j *AuthorizeRespMsgType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform { + for _, expected := range enumValues_AuthorizeRespMsgType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AuthorizeRespMsgType, v) } - *j = AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform(v) + *j = AuthorizeRespMsgType(v) return nil } -type AuthorizeRespAuthorizeIsVirtual int - -var enumValues_AuthorizeRespAuthorizeIsVirtual = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. func (j *AuthorizeRespAuthorizeIsVirtual) UnmarshalJSON(b []byte) error { var v int @@ -273,32 +328,6 @@ func (j *AuthorizeRespAuthorizeIsVirtual) UnmarshalJSON(b []byte) error { return nil } -type AuthorizeRespAuthorizeLinkedToElem struct { - // Account ID. - Loginid *string `json:"loginid,omitempty"` - - // Account platform name. - Platform *AuthorizeRespAuthorizeLinkedToElemPlatform `json:"platform,omitempty"` -} - -type AuthorizeRespAuthorizeLinkedToElemPlatform string - -const AuthorizeRespAuthorizeLinkedToElemPlatformCtrader AuthorizeRespAuthorizeLinkedToElemPlatform = "ctrader" -const AuthorizeRespAuthorizeLinkedToElemPlatformDerivez AuthorizeRespAuthorizeLinkedToElemPlatform = "derivez" -const AuthorizeRespAuthorizeLinkedToElemPlatformDtrade AuthorizeRespAuthorizeLinkedToElemPlatform = "dtrade" -const AuthorizeRespAuthorizeLinkedToElemPlatformDwallet AuthorizeRespAuthorizeLinkedToElemPlatform = "dwallet" -const AuthorizeRespAuthorizeLinkedToElemPlatformDxtrade AuthorizeRespAuthorizeLinkedToElemPlatform = "dxtrade" -const AuthorizeRespAuthorizeLinkedToElemPlatformMt5 AuthorizeRespAuthorizeLinkedToElemPlatform = "mt5" - -var enumValues_AuthorizeRespAuthorizeLinkedToElemPlatform = []interface{}{ - "ctrader", - "derivez", - "dtrade", - "dwallet", - "dxtrade", - "mt5", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *AuthorizeRespAuthorizeLinkedToElemPlatform) UnmarshalJSON(b []byte) error { var v string @@ -319,50 +348,16 @@ func (j *AuthorizeRespAuthorizeLinkedToElemPlatform) UnmarshalJSON(b []byte) err return nil } -// Currencies in client's residence country -type AuthorizeRespAuthorizeLocalCurrencies map[string]interface{} - -// Echo of the request made. -type AuthorizeRespEchoReq map[string]interface{} - -type AuthorizeRespMsgType string - -const AuthorizeRespMsgTypeAuthorize AuthorizeRespMsgType = "authorize" - -var enumValues_AuthorizeRespMsgType = []interface{}{ - "authorize", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *AuthorizeRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_AuthorizeRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AuthorizeRespMsgType, v) - } - *j = AuthorizeRespMsgType(v) - return nil -} - // UnmarshalJSON implements json.Unmarshaler. func (j *AuthorizeResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in AuthorizeResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in AuthorizeResp: required") } type Plain AuthorizeResp diff --git a/schema/balance.go b/schema/balance.go index 7ddc706..08fdb32 100644 --- a/schema/balance.go +++ b/schema/balance.go @@ -6,31 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get user account balance -type Balance struct { - // [Optional] If set to `all`, return the balances of all accounts one by one; if - // set to `current`, return the balance of current account; if set as an account - // id, return the balance of that account. - Account string `json:"account,omitempty"` - - // Must be `1` - Balance BalanceBalance `json:"balance"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough BalancePassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to 1, will send updates whenever the balance changes. - Subscribe *BalanceSubscribe `json:"subscribe,omitempty"` -} - type BalanceBalance int var enumValues_BalanceBalance = []interface{}{ @@ -88,13 +63,38 @@ func (j *BalanceSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Get user account balance +type Balance struct { + // [Optional] If set to `all`, return the balances of all accounts one by one; if + // set to `current`, return the balance of current account; if set as an account + // id, return the balance of that account. + Account string `json:"account,omitempty"` + + // Must be `1` + Balance BalanceBalance `json:"balance"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough BalancePassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to 1, will send updates whenever the balance changes. + Subscribe *BalanceSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Balance) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["balance"]; raw != nil && !ok { + if v, ok := raw["balance"]; !ok || v == nil { return fmt.Errorf("field balance in Balance: required") } type Plain Balance diff --git a/schema/balance_resp.go b/schema/balance_resp.go index 72a1081..98b3ddd 100644 --- a/schema/balance_resp.go +++ b/schema/balance_resp.go @@ -83,16 +83,39 @@ type BalanceRespBalanceTotalDerivDemo struct { Currency string `json:"currency"` } +// Total balance of all MT5 real money accounts. +type BalanceRespBalanceTotalMt5 struct { + // Total balance of all MT5 accounts + Amount float64 `json:"amount"` + + // Currency of total. + Currency string `json:"currency"` +} + +// Total balance of all MT5 demo accounts. +type BalanceRespBalanceTotalMt5Demo struct { + // Total of balances. + Amount float64 `json:"amount"` + + // Currency of total. + Currency string `json:"currency"` +} + +// Echo of the request made. +type BalanceRespEchoReq map[string]interface{} + +type BalanceRespMsgType string + // UnmarshalJSON implements json.Unmarshaler. func (j *BalanceRespBalanceTotalDerivDemo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in BalanceRespBalanceTotalDerivDemo: required") } - if _, ok := raw["currency"]; raw != nil && !ok { + if v, ok := raw["currency"]; !ok || v == nil { return fmt.Errorf("field currency in BalanceRespBalanceTotalDerivDemo: required") } type Plain BalanceRespBalanceTotalDerivDemo @@ -105,62 +128,26 @@ func (j *BalanceRespBalanceTotalDerivDemo) UnmarshalJSON(b []byte) error { } // UnmarshalJSON implements json.Unmarshaler. -func (j *BalanceRespBalanceTotalDeriv) UnmarshalJSON(b []byte) error { +func (j *BalanceRespBalance) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["amount"]; raw != nil && !ok { - return fmt.Errorf("field amount in BalanceRespBalanceTotalDeriv: required") - } - if _, ok := raw["currency"]; raw != nil && !ok { - return fmt.Errorf("field currency in BalanceRespBalanceTotalDeriv: required") - } - type Plain BalanceRespBalanceTotalDeriv - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = BalanceRespBalanceTotalDeriv(plain) - return nil -} - -// Total balance of all MT5 real money accounts. -type BalanceRespBalanceTotalMt5 struct { - // Total balance of all MT5 accounts - Amount float64 `json:"amount"` - - // Currency of total. - Currency string `json:"currency"` -} - -// Total balance of all MT5 demo accounts. -type BalanceRespBalanceTotalMt5Demo struct { - // Total of balances. - Amount float64 `json:"amount"` - - // Currency of total. - Currency string `json:"currency"` -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *BalanceRespBalanceTotalMt5Demo) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err + if v, ok := raw["balance"]; !ok || v == nil { + return fmt.Errorf("field balance in BalanceRespBalance: required") } - if _, ok := raw["amount"]; raw != nil && !ok { - return fmt.Errorf("field amount in BalanceRespBalanceTotalMt5Demo: required") + if v, ok := raw["currency"]; !ok || v == nil { + return fmt.Errorf("field currency in BalanceRespBalance: required") } - if _, ok := raw["currency"]; raw != nil && !ok { - return fmt.Errorf("field currency in BalanceRespBalanceTotalMt5Demo: required") + if v, ok := raw["loginid"]; !ok || v == nil { + return fmt.Errorf("field loginid in BalanceRespBalance: required") } - type Plain BalanceRespBalanceTotalMt5Demo + type Plain BalanceRespBalance var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = BalanceRespBalanceTotalMt5Demo(plain) + *j = BalanceRespBalance(plain) return nil } @@ -170,10 +157,10 @@ func (j *BalanceRespBalanceTotalMt5) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in BalanceRespBalanceTotalMt5: required") } - if _, ok := raw["currency"]; raw != nil && !ok { + if v, ok := raw["currency"]; !ok || v == nil { return fmt.Errorf("field currency in BalanceRespBalanceTotalMt5: required") } type Plain BalanceRespBalanceTotalMt5 @@ -186,36 +173,26 @@ func (j *BalanceRespBalanceTotalMt5) UnmarshalJSON(b []byte) error { } // UnmarshalJSON implements json.Unmarshaler. -func (j *BalanceRespBalance) UnmarshalJSON(b []byte) error { +func (j *BalanceRespBalanceTotalMt5Demo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["balance"]; raw != nil && !ok { - return fmt.Errorf("field balance in BalanceRespBalance: required") - } - if _, ok := raw["currency"]; raw != nil && !ok { - return fmt.Errorf("field currency in BalanceRespBalance: required") + if v, ok := raw["amount"]; !ok || v == nil { + return fmt.Errorf("field amount in BalanceRespBalanceTotalMt5Demo: required") } - if _, ok := raw["loginid"]; raw != nil && !ok { - return fmt.Errorf("field loginid in BalanceRespBalance: required") + if v, ok := raw["currency"]; !ok || v == nil { + return fmt.Errorf("field currency in BalanceRespBalanceTotalMt5Demo: required") } - type Plain BalanceRespBalance + type Plain BalanceRespBalanceTotalMt5Demo var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = BalanceRespBalance(plain) + *j = BalanceRespBalanceTotalMt5Demo(plain) return nil } -// Echo of the request made. -type BalanceRespEchoReq map[string]interface{} - -type BalanceRespMsgType string - -const BalanceRespMsgTypeBalance BalanceRespMsgType = "balance" - var enumValues_BalanceRespMsgType = []interface{}{ "balance", } @@ -240,6 +217,8 @@ func (j *BalanceRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const BalanceRespMsgTypeBalance BalanceRespMsgType = "balance" + // For subscription requests only. type BalanceRespSubscription struct { // A per-connection unique identifier. Can be passed to the `forget` API call to @@ -253,7 +232,7 @@ func (j *BalanceRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in BalanceRespSubscription: required") } type Plain BalanceRespSubscription @@ -265,16 +244,37 @@ func (j *BalanceRespSubscription) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *BalanceRespBalanceTotalDeriv) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["amount"]; !ok || v == nil { + return fmt.Errorf("field amount in BalanceRespBalanceTotalDeriv: required") + } + if v, ok := raw["currency"]; !ok || v == nil { + return fmt.Errorf("field currency in BalanceRespBalanceTotalDeriv: required") + } + type Plain BalanceRespBalanceTotalDeriv + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = BalanceRespBalanceTotalDeriv(plain) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *BalanceResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in BalanceResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in BalanceResp: required") } type Plain BalanceResp diff --git a/schema/buy.go b/schema/buy.go index 78deaf6..edcf90d 100644 --- a/schema/buy.go +++ b/schema/buy.go @@ -119,62 +119,11 @@ const BuyParametersBarrierRangeMiddle BuyParametersBarrierRange = "middle" const BuyParametersBarrierRangeTight BuyParametersBarrierRange = "tight" const BuyParametersBarrierRangeWide BuyParametersBarrierRange = "wide" -var enumValues_BuyParametersBarrierRange = []interface{}{ - "tight", - "middle", - "wide", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *BuyParametersBarrierRange) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_BuyParametersBarrierRange { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersBarrierRange, v) - } - *j = BuyParametersBarrierRange(v) - return nil -} - type BuyParametersBasis string const BuyParametersBasisPayout BuyParametersBasis = "payout" const BuyParametersBasisStake BuyParametersBasis = "stake" -var enumValues_BuyParametersBasis = []interface{}{ - "payout", - "stake", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *BuyParametersBasis) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_BuyParametersBasis { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersBasis, v) - } - *j = BuyParametersBasis(v) - return nil -} - type BuyParametersContractType string const BuyParametersContractTypeACCU BuyParametersContractType = "ACCU" @@ -216,6 +165,74 @@ const BuyParametersContractTypeUPORDOWN BuyParametersContractType = "UPORDOWN" const BuyParametersContractTypeVANILLALONGCALL BuyParametersContractType = "VANILLALONGCALL" const BuyParametersContractTypeVANILLALONGPUT BuyParametersContractType = "VANILLALONGPUT" +type BuyParametersDurationUnit string + +const BuyParametersDurationUnitD BuyParametersDurationUnit = "d" +const BuyParametersDurationUnitH BuyParametersDurationUnit = "h" +const BuyParametersDurationUnitM BuyParametersDurationUnit = "m" +const BuyParametersDurationUnitS BuyParametersDurationUnit = "s" +const BuyParametersDurationUnitT BuyParametersDurationUnit = "t" + +// Add an order to close the contract once the order condition is met (only for +// `MULTUP` and `MULTDOWN` and `ACCU` contracts). +type BuyParametersLimitOrder struct { + // Contract will be automatically closed when the value of the contract reaches a + // specific loss. + StopLoss *float64 `json:"stop_loss,omitempty"` + + // Contract will be automatically closed when the value of the contract reaches a + // specific profit. + TakeProfit *float64 `json:"take_profit,omitempty"` +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *BuyParametersProductType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_BuyParametersProductType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersProductType, v) + } + *j = BuyParametersProductType(v) + return nil +} + +var enumValues_BuyParametersDurationUnit = []interface{}{ + "d", + "m", + "s", + "h", + "t", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *BuyParametersContractType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_BuyParametersContractType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersContractType, v) + } + *j = BuyParametersContractType(v) + return nil +} + var enumValues_BuyParametersContractType = []interface{}{ "MULTUP", "MULTDOWN", @@ -258,39 +275,34 @@ var enumValues_BuyParametersContractType = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *BuyParametersContractType) UnmarshalJSON(b []byte) error { +func (j *BuyParametersBasis) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_BuyParametersContractType { + for _, expected := range enumValues_BuyParametersBasis { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersContractType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersBasis, v) } - *j = BuyParametersContractType(v) + *j = BuyParametersBasis(v) return nil } -type BuyParametersDurationUnit string +var enumValues_BuyParametersBasis = []interface{}{ + "payout", + "stake", +} -const BuyParametersDurationUnitD BuyParametersDurationUnit = "d" -const BuyParametersDurationUnitH BuyParametersDurationUnit = "h" -const BuyParametersDurationUnitM BuyParametersDurationUnit = "m" -const BuyParametersDurationUnitS BuyParametersDurationUnit = "s" -const BuyParametersDurationUnitT BuyParametersDurationUnit = "t" +type BuyParametersProductType string -var enumValues_BuyParametersDurationUnit = []interface{}{ - "d", - "m", - "s", - "h", - "t", +var enumValues_BuyParametersProductType = []interface{}{ + "basic", } // UnmarshalJSON implements json.Unmarshaler. @@ -313,43 +325,25 @@ func (j *BuyParametersDurationUnit) UnmarshalJSON(b []byte) error { return nil } -// Add an order to close the contract once the order condition is met (only for -// `MULTUP` and `MULTDOWN` and `ACCU` contracts). -type BuyParametersLimitOrder struct { - // Contract will be automatically closed when the value of the contract reaches a - // specific loss. - StopLoss *float64 `json:"stop_loss,omitempty"` - - // Contract will be automatically closed when the value of the contract reaches a - // specific profit. - TakeProfit *float64 `json:"take_profit,omitempty"` -} - -type BuyParametersProductType string - const BuyParametersProductTypeBasic BuyParametersProductType = "basic" -var enumValues_BuyParametersProductType = []interface{}{ - "basic", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *BuyParametersProductType) UnmarshalJSON(b []byte) error { +func (j *BuyParametersBarrierRange) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_BuyParametersProductType { + for _, expected := range enumValues_BuyParametersBarrierRange { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersProductType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersBarrierRange, v) } - *j = BuyParametersProductType(v) + *j = BuyParametersBarrierRange(v) return nil } @@ -359,13 +353,13 @@ func (j *BuyParameters) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["contract_type"]; raw != nil && !ok { + if v, ok := raw["contract_type"]; !ok || v == nil { return fmt.Errorf("field contract_type in BuyParameters: required") } - if _, ok := raw["currency"]; raw != nil && !ok { + if v, ok := raw["currency"]; !ok || v == nil { return fmt.Errorf("field currency in BuyParameters: required") } - if _, ok := raw["symbol"]; raw != nil && !ok { + if v, ok := raw["symbol"]; !ok || v == nil { return fmt.Errorf("field symbol in BuyParameters: required") } type Plain BuyParameters @@ -410,16 +404,22 @@ func (j *BuySubscribe) UnmarshalJSON(b []byte) error { return nil } +var enumValues_BuyParametersBarrierRange = []interface{}{ + "tight", + "middle", + "wide", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Buy) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["buy"]; raw != nil && !ok { + if v, ok := raw["buy"]; !ok || v == nil { return fmt.Errorf("field buy in Buy: required") } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in Buy: required") } type Plain Buy diff --git a/schema/buy_contract_for_multiple_accounts.go b/schema/buy_contract_for_multiple_accounts.go index 3aa6725..6c37293 100644 --- a/schema/buy_contract_for_multiple_accounts.go +++ b/schema/buy_contract_for_multiple_accounts.go @@ -99,31 +99,6 @@ type BuyContractForMultipleAccountsParametersBasis string const BuyContractForMultipleAccountsParametersBasisPayout BuyContractForMultipleAccountsParametersBasis = "payout" const BuyContractForMultipleAccountsParametersBasisStake BuyContractForMultipleAccountsParametersBasis = "stake" -var enumValues_BuyContractForMultipleAccountsParametersBasis = []interface{}{ - "payout", - "stake", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *BuyContractForMultipleAccountsParametersBasis) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_BuyContractForMultipleAccountsParametersBasis { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyContractForMultipleAccountsParametersBasis, v) - } - *j = BuyContractForMultipleAccountsParametersBasis(v) - return nil -} - type BuyContractForMultipleAccountsParametersContractType string const BuyContractForMultipleAccountsParametersContractTypeASIAND BuyContractForMultipleAccountsParametersContractType = "ASIAND" @@ -164,6 +139,63 @@ const BuyContractForMultipleAccountsParametersContractTypeUPORDOWN BuyContractFo const BuyContractForMultipleAccountsParametersContractTypeVANILLALONGCALL BuyContractForMultipleAccountsParametersContractType = "VANILLALONGCALL" const BuyContractForMultipleAccountsParametersContractTypeVANILLALONGPUT BuyContractForMultipleAccountsParametersContractType = "VANILLALONGPUT" +type BuyContractForMultipleAccountsParametersDurationUnit string + +const BuyContractForMultipleAccountsParametersDurationUnitD BuyContractForMultipleAccountsParametersDurationUnit = "d" +const BuyContractForMultipleAccountsParametersDurationUnitH BuyContractForMultipleAccountsParametersDurationUnit = "h" + +var enumValues_BuyContractForMultipleAccountsParametersDurationUnit = []interface{}{ + "d", + "m", + "s", + "h", + "t", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *BuyContractForMultipleAccountsParametersDurationUnit) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_BuyContractForMultipleAccountsParametersDurationUnit { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyContractForMultipleAccountsParametersDurationUnit, v) + } + *j = BuyContractForMultipleAccountsParametersDurationUnit(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *BuyContractForMultipleAccountsParametersContractType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_BuyContractForMultipleAccountsParametersContractType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyContractForMultipleAccountsParametersContractType, v) + } + *j = BuyContractForMultipleAccountsParametersContractType(v) + return nil +} + +const BuyContractForMultipleAccountsParametersDurationUnitM BuyContractForMultipleAccountsParametersDurationUnit = "m" +const BuyContractForMultipleAccountsParametersDurationUnitS BuyContractForMultipleAccountsParametersDurationUnit = "s" +const BuyContractForMultipleAccountsParametersDurationUnitT BuyContractForMultipleAccountsParametersDurationUnit = "t" + var enumValues_BuyContractForMultipleAccountsParametersContractType = []interface{}{ "MULTUP", "MULTDOWN", @@ -205,58 +237,22 @@ var enumValues_BuyContractForMultipleAccountsParametersContractType = []interfac } // UnmarshalJSON implements json.Unmarshaler. -func (j *BuyContractForMultipleAccountsParametersContractType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_BuyContractForMultipleAccountsParametersContractType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyContractForMultipleAccountsParametersContractType, v) - } - *j = BuyContractForMultipleAccountsParametersContractType(v) - return nil -} - -type BuyContractForMultipleAccountsParametersDurationUnit string - -const BuyContractForMultipleAccountsParametersDurationUnitD BuyContractForMultipleAccountsParametersDurationUnit = "d" -const BuyContractForMultipleAccountsParametersDurationUnitH BuyContractForMultipleAccountsParametersDurationUnit = "h" -const BuyContractForMultipleAccountsParametersDurationUnitM BuyContractForMultipleAccountsParametersDurationUnit = "m" -const BuyContractForMultipleAccountsParametersDurationUnitS BuyContractForMultipleAccountsParametersDurationUnit = "s" -const BuyContractForMultipleAccountsParametersDurationUnitT BuyContractForMultipleAccountsParametersDurationUnit = "t" - -var enumValues_BuyContractForMultipleAccountsParametersDurationUnit = []interface{}{ - "d", - "m", - "s", - "h", - "t", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *BuyContractForMultipleAccountsParametersDurationUnit) UnmarshalJSON(b []byte) error { +func (j *BuyContractForMultipleAccountsParametersBasis) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_BuyContractForMultipleAccountsParametersDurationUnit { + for _, expected := range enumValues_BuyContractForMultipleAccountsParametersBasis { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyContractForMultipleAccountsParametersDurationUnit, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyContractForMultipleAccountsParametersBasis, v) } - *j = BuyContractForMultipleAccountsParametersDurationUnit(v) + *j = BuyContractForMultipleAccountsParametersBasis(v) return nil } @@ -266,13 +262,13 @@ func (j *BuyContractForMultipleAccountsParameters) UnmarshalJSON(b []byte) error if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["contract_type"]; raw != nil && !ok { + if v, ok := raw["contract_type"]; !ok || v == nil { return fmt.Errorf("field contract_type in BuyContractForMultipleAccountsParameters: required") } - if _, ok := raw["currency"]; raw != nil && !ok { + if v, ok := raw["currency"]; !ok || v == nil { return fmt.Errorf("field currency in BuyContractForMultipleAccountsParameters: required") } - if _, ok := raw["symbol"]; raw != nil && !ok { + if v, ok := raw["symbol"]; !ok || v == nil { return fmt.Errorf("field symbol in BuyContractForMultipleAccountsParameters: required") } type Plain BuyContractForMultipleAccountsParameters @@ -288,19 +284,24 @@ func (j *BuyContractForMultipleAccountsParameters) UnmarshalJSON(b []byte) error // the `echo_req` output field. type BuyContractForMultipleAccountsPassthrough map[string]interface{} +var enumValues_BuyContractForMultipleAccountsParametersBasis = []interface{}{ + "payout", + "stake", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *BuyContractForMultipleAccounts) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["buy_contract_for_multiple_accounts"]; raw != nil && !ok { + if v, ok := raw["buy_contract_for_multiple_accounts"]; !ok || v == nil { return fmt.Errorf("field buy_contract_for_multiple_accounts in BuyContractForMultipleAccounts: required") } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in BuyContractForMultipleAccounts: required") } - if _, ok := raw["tokens"]; raw != nil && !ok { + if v, ok := raw["tokens"]; !ok || v == nil { return fmt.Errorf("field tokens in BuyContractForMultipleAccounts: required") } type Plain BuyContractForMultipleAccounts diff --git a/schema/buy_contract_for_multiple_accounts_resp.go b/schema/buy_contract_for_multiple_accounts_resp.go index 3355c29..95c67d2 100644 --- a/schema/buy_contract_for_multiple_accounts_resp.go +++ b/schema/buy_contract_for_multiple_accounts_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with transaction results is received -type BuyContractForMultipleAccountsResp struct { - // Receipt confirmation for the purchase - BuyContractForMultipleAccounts *BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts `json:"buy_contract_for_multiple_accounts,omitempty"` - - // Echo of the request made. - EchoReq BuyContractForMultipleAccountsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType BuyContractForMultipleAccountsRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Receipt confirmation for the purchase type BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts struct { // List of results containing transactions and/or errors for the bought contracts. @@ -34,7 +18,7 @@ func (j *BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts) Unmar if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["result"]; raw != nil && !ok { + if v, ok := raw["result"]; !ok || v == nil { return fmt.Errorf("field result in BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts: required") } type Plain BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts @@ -51,8 +35,6 @@ type BuyContractForMultipleAccountsRespEchoReq map[string]interface{} type BuyContractForMultipleAccountsRespMsgType string -const BuyContractForMultipleAccountsRespMsgTypeBuyContractForMultipleAccounts BuyContractForMultipleAccountsRespMsgType = "buy_contract_for_multiple_accounts" - var enumValues_BuyContractForMultipleAccountsRespMsgType = []interface{}{ "buy_contract_for_multiple_accounts", } @@ -77,16 +59,34 @@ func (j *BuyContractForMultipleAccountsRespMsgType) UnmarshalJSON(b []byte) erro return nil } +// A message with transaction results is received +type BuyContractForMultipleAccountsResp struct { + // Receipt confirmation for the purchase + BuyContractForMultipleAccounts *BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts `json:"buy_contract_for_multiple_accounts,omitempty"` + + // Echo of the request made. + EchoReq BuyContractForMultipleAccountsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType BuyContractForMultipleAccountsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const BuyContractForMultipleAccountsRespMsgTypeBuyContractForMultipleAccounts BuyContractForMultipleAccountsRespMsgType = "buy_contract_for_multiple_accounts" + // UnmarshalJSON implements json.Unmarshaler. func (j *BuyContractForMultipleAccountsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in BuyContractForMultipleAccountsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in BuyContractForMultipleAccountsResp: required") } type Plain BuyContractForMultipleAccountsResp diff --git a/schema/buy_resp.go b/schema/buy_resp.go index 1ccb577..0ee9a71 100644 --- a/schema/buy_resp.go +++ b/schema/buy_resp.go @@ -6,25 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with transaction results is received -type BuyResp struct { - // Receipt confirmation for the purchase - Buy *BuyRespBuy `json:"buy,omitempty"` - - // Echo of the request made. - EchoReq BuyRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType BuyRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *BuyRespSubscription `json:"subscription,omitempty"` -} - // Receipt confirmation for the purchase type BuyRespBuy struct { // The new account balance after completion of the purchase @@ -61,31 +42,31 @@ func (j *BuyRespBuy) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["balance_after"]; raw != nil && !ok { + if v, ok := raw["balance_after"]; !ok || v == nil { return fmt.Errorf("field balance_after in BuyRespBuy: required") } - if _, ok := raw["buy_price"]; raw != nil && !ok { + if v, ok := raw["buy_price"]; !ok || v == nil { return fmt.Errorf("field buy_price in BuyRespBuy: required") } - if _, ok := raw["contract_id"]; raw != nil && !ok { + if v, ok := raw["contract_id"]; !ok || v == nil { return fmt.Errorf("field contract_id in BuyRespBuy: required") } - if _, ok := raw["longcode"]; raw != nil && !ok { + if v, ok := raw["longcode"]; !ok || v == nil { return fmt.Errorf("field longcode in BuyRespBuy: required") } - if _, ok := raw["payout"]; raw != nil && !ok { + if v, ok := raw["payout"]; !ok || v == nil { return fmt.Errorf("field payout in BuyRespBuy: required") } - if _, ok := raw["purchase_time"]; raw != nil && !ok { + if v, ok := raw["purchase_time"]; !ok || v == nil { return fmt.Errorf("field purchase_time in BuyRespBuy: required") } - if _, ok := raw["shortcode"]; raw != nil && !ok { + if v, ok := raw["shortcode"]; !ok || v == nil { return fmt.Errorf("field shortcode in BuyRespBuy: required") } - if _, ok := raw["start_time"]; raw != nil && !ok { + if v, ok := raw["start_time"]; !ok || v == nil { return fmt.Errorf("field start_time in BuyRespBuy: required") } - if _, ok := raw["transaction_id"]; raw != nil && !ok { + if v, ok := raw["transaction_id"]; !ok || v == nil { return fmt.Errorf("field transaction_id in BuyRespBuy: required") } type Plain BuyRespBuy @@ -102,8 +83,6 @@ type BuyRespEchoReq map[string]interface{} type BuyRespMsgType string -const BuyRespMsgTypeBuy BuyRespMsgType = "buy" - var enumValues_BuyRespMsgType = []interface{}{ "buy", } @@ -128,6 +107,8 @@ func (j *BuyRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const BuyRespMsgTypeBuy BuyRespMsgType = "buy" + // For subscription requests only. type BuyRespSubscription struct { // A per-connection unique identifier. Can be passed to the `forget` API call to @@ -141,7 +122,7 @@ func (j *BuyRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in BuyRespSubscription: required") } type Plain BuyRespSubscription @@ -153,16 +134,35 @@ func (j *BuyRespSubscription) UnmarshalJSON(b []byte) error { return nil } +// A message with transaction results is received +type BuyResp struct { + // Receipt confirmation for the purchase + Buy *BuyRespBuy `json:"buy,omitempty"` + + // Echo of the request made. + EchoReq BuyRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType BuyRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *BuyRespSubscription `json:"subscription,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *BuyResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in BuyResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in BuyResp: required") } type Plain BuyResp diff --git a/schema/cancel.go b/schema/cancel.go index e850242..76909e9 100644 --- a/schema/cancel.go +++ b/schema/cancel.go @@ -32,7 +32,7 @@ func (j *Cancel) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["cancel"]; raw != nil && !ok { + if v, ok := raw["cancel"]; !ok || v == nil { return fmt.Errorf("field cancel in Cancel: required") } type Plain Cancel diff --git a/schema/cancel_resp.go b/schema/cancel_resp.go index 39335b4..7665564 100644 --- a/schema/cancel_resp.go +++ b/schema/cancel_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with transaction results is received -type CancelResp struct { - // Receipt for the transaction - Cancel *CancelRespCancel `json:"cancel,omitempty"` - - // Echo of the request made. - EchoReq CancelRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType CancelRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Receipt for the transaction type CancelRespCancel struct { // New account balance after completion of the sale @@ -45,8 +29,6 @@ type CancelRespEchoReq map[string]interface{} type CancelRespMsgType string -const CancelRespMsgTypeCancel CancelRespMsgType = "cancel" - var enumValues_CancelRespMsgType = []interface{}{ "cancel", } @@ -71,16 +53,34 @@ func (j *CancelRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with transaction results is received +type CancelResp struct { + // Receipt for the transaction + Cancel *CancelRespCancel `json:"cancel,omitempty"` + + // Echo of the request made. + EchoReq CancelRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType CancelRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const CancelRespMsgTypeCancel CancelRespMsgType = "cancel" + // UnmarshalJSON implements json.Unmarshaler. func (j *CancelResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in CancelResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in CancelResp: required") } type Plain CancelResp diff --git a/schema/cashier.go b/schema/cashier.go index a899ffd..fed07d0 100644 --- a/schema/cashier.go +++ b/schema/cashier.go @@ -55,119 +55,116 @@ type CashierCashier string const CashierCashierDeposit CashierCashier = "deposit" const CashierCashierWithdraw CashierCashier = "withdraw" +type CashierDryRun int + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type CashierPassthrough map[string]interface{} + +type CashierProvider string + +const CashierProviderCrypto CashierProvider = "crypto" +const CashierProviderDoughflow CashierProvider = "doughflow" + +type CashierType string + +const CashierTypeApi CashierType = "api" +const CashierTypeUrl CashierType = "url" + var enumValues_CashierCashier = []interface{}{ "deposit", "withdraw", } +var enumValues_CashierDryRun = []interface{}{ + 0, + 1, +} +var enumValues_CashierProvider = []interface{}{ + "doughflow", + "crypto", +} +var enumValues_CashierType = []interface{}{ + "url", + "api", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *CashierCashier) UnmarshalJSON(b []byte) error { +func (j *CashierType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_CashierCashier { + for _, expected := range enumValues_CashierType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_CashierCashier, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_CashierType, v) } - *j = CashierCashier(v) + *j = CashierType(v) return nil } -type CashierDryRun int - -var enumValues_CashierDryRun = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *CashierDryRun) UnmarshalJSON(b []byte) error { - var v int +func (j *CashierProvider) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_CashierDryRun { + for _, expected := range enumValues_CashierProvider { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_CashierDryRun, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_CashierProvider, v) } - *j = CashierDryRun(v) + *j = CashierProvider(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type CashierPassthrough map[string]interface{} - -type CashierProvider string - -const CashierProviderCrypto CashierProvider = "crypto" -const CashierProviderDoughflow CashierProvider = "doughflow" - -var enumValues_CashierProvider = []interface{}{ - "doughflow", - "crypto", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *CashierProvider) UnmarshalJSON(b []byte) error { - var v string +func (j *CashierDryRun) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_CashierProvider { + for _, expected := range enumValues_CashierDryRun { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_CashierProvider, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_CashierDryRun, v) } - *j = CashierProvider(v) + *j = CashierDryRun(v) return nil } -type CashierType string - -const CashierTypeApi CashierType = "api" -const CashierTypeUrl CashierType = "url" - -var enumValues_CashierType = []interface{}{ - "url", - "api", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *CashierType) UnmarshalJSON(b []byte) error { +func (j *CashierCashier) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_CashierType { + for _, expected := range enumValues_CashierCashier { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_CashierType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_CashierCashier, v) } - *j = CashierType(v) + *j = CashierCashier(v) return nil } diff --git a/schema/cashier_resp.go b/schema/cashier_resp.go index e30e298..ca72b64 100644 --- a/schema/cashier_resp.go +++ b/schema/cashier_resp.go @@ -6,35 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Cashier information for the specified type. -type CashierResp struct { - // Possible error codes are: - // - `ASK_TNC_APPROVAL`: API call `tnc_approval` - // - `ASK_AUTHENTICATE` - // - `ASK_UK_FUNDS_PROTECTION`: API call `tnc_approval` - // - `ASK_CURRENCY`: API call `set_account_currency` - // - `ASK_EMAIL_VERIFY`: API call `verify_email` - // - `ASK_FIX_DETAILS`: API call `set_settings` - Cashier interface{} `json:"cashier,omitempty"` - - // Echo of the request made. - EchoReq CashierRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType CashierRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type CashierRespEchoReq map[string]interface{} type CashierRespMsgType string -const CashierRespMsgTypeCashier CashierRespMsgType = "cashier" - var enumValues_CashierRespMsgType = []interface{}{ "cashier", } @@ -59,16 +35,40 @@ func (j *CashierRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Cashier information for the specified type. +type CashierResp struct { + // Possible error codes are: + // - `ASK_TNC_APPROVAL`: API call `tnc_approval` + // - `ASK_AUTHENTICATE` + // - `ASK_UK_FUNDS_PROTECTION`: API call `tnc_approval` + // - `ASK_CURRENCY`: API call `set_account_currency` + // - `ASK_EMAIL_VERIFY`: API call `verify_email` + // - `ASK_FIX_DETAILS`: API call `set_settings` + Cashier interface{} `json:"cashier,omitempty"` + + // Echo of the request made. + EchoReq CashierRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType CashierRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const CashierRespMsgTypeCashier CashierRespMsgType = "cashier" + // UnmarshalJSON implements json.Unmarshaler. func (j *CashierResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in CashierResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in CashierResp: required") } type Plain CashierResp diff --git a/schema/confirm_email.go b/schema/confirm_email.go index 9fc9701..f2bd1d5 100644 --- a/schema/confirm_email.go +++ b/schema/confirm_email.go @@ -6,28 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Verifies the email for the user using verification code passed in the request -// object -type ConfirmEmail struct { - // Must be `1` - ConfirmEmail ConfirmEmailConfirmEmail `json:"confirm_email"` - - // Boolean value: 1 or 0, indicating whether the client has given consent for - // marketing emails. - EmailConsent ConfirmEmailEmailConsent `json:"email_consent"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough ConfirmEmailPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Email verification code (received from a `verify_email` call, which must be - // done first). - VerificationCode string `json:"verification_code"` -} - type ConfirmEmailConfirmEmail int var enumValues_ConfirmEmailConfirmEmail = []interface{}{ @@ -81,6 +59,28 @@ func (j *ConfirmEmailEmailConsent) UnmarshalJSON(b []byte) error { return nil } +// Verifies the email for the user using verification code passed in the request +// object +type ConfirmEmail struct { + // Must be `1` + ConfirmEmail ConfirmEmailConfirmEmail `json:"confirm_email"` + + // Boolean value: 1 or 0, indicating whether the client has given consent for + // marketing emails. + EmailConsent ConfirmEmailEmailConsent `json:"email_consent"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough ConfirmEmailPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Email verification code (received from a `verify_email` call, which must be + // done first). + VerificationCode string `json:"verification_code"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type ConfirmEmailPassthrough map[string]interface{} @@ -91,13 +91,13 @@ func (j *ConfirmEmail) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["confirm_email"]; raw != nil && !ok { + if v, ok := raw["confirm_email"]; !ok || v == nil { return fmt.Errorf("field confirm_email in ConfirmEmail: required") } - if _, ok := raw["email_consent"]; raw != nil && !ok { + if v, ok := raw["email_consent"]; !ok || v == nil { return fmt.Errorf("field email_consent in ConfirmEmail: required") } - if _, ok := raw["verification_code"]; raw != nil && !ok { + if v, ok := raw["verification_code"]; !ok || v == nil { return fmt.Errorf("field verification_code in ConfirmEmail: required") } type Plain ConfirmEmail diff --git a/schema/confirm_email_resp.go b/schema/confirm_email_resp.go index 86af5fb..8f857b4 100644 --- a/schema/confirm_email_resp.go +++ b/schema/confirm_email_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Confirm Email Response -type ConfirmEmailResp struct { - // 1 for success (The verification code has been successfully verified) - ConfirmEmail *ConfirmEmailRespConfirmEmail `json:"confirm_email,omitempty"` - - // Echo of the request made. - EchoReq ConfirmEmailRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType ConfirmEmailRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - type ConfirmEmailRespConfirmEmail int var enumValues_ConfirmEmailRespConfirmEmail = []interface{}{ @@ -54,8 +38,6 @@ type ConfirmEmailRespEchoReq map[string]interface{} type ConfirmEmailRespMsgType string -const ConfirmEmailRespMsgTypeConfirmEmail ConfirmEmailRespMsgType = "confirm_email" - var enumValues_ConfirmEmailRespMsgType = []interface{}{ "confirm_email", } @@ -80,16 +62,34 @@ func (j *ConfirmEmailRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Confirm Email Response +type ConfirmEmailResp struct { + // 1 for success (The verification code has been successfully verified) + ConfirmEmail *ConfirmEmailRespConfirmEmail `json:"confirm_email,omitempty"` + + // Echo of the request made. + EchoReq ConfirmEmailRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType ConfirmEmailRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const ConfirmEmailRespMsgTypeConfirmEmail ConfirmEmailRespMsgType = "confirm_email" + // UnmarshalJSON implements json.Unmarshaler. func (j *ConfirmEmailResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ConfirmEmailResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ConfirmEmailResp: required") } type Plain ConfirmEmailResp diff --git a/schema/contract_update.go b/schema/contract_update.go index 6a9f3fb..ddfd688 100644 --- a/schema/contract_update.go +++ b/schema/contract_update.go @@ -6,29 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Update a contract condition. -type ContractUpdate struct { - // Internal unique contract identifier. - ContractId int `json:"contract_id"` - - // Must be `1` - ContractUpdate ContractUpdateContractUpdate `json:"contract_update"` - - // Specify limit order to update. - LimitOrder ContractUpdateLimitOrder `json:"limit_order"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough ContractUpdatePassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type ContractUpdateContractUpdate int var enumValues_ContractUpdateContractUpdate = []interface{}{ @@ -55,6 +32,29 @@ func (j *ContractUpdateContractUpdate) UnmarshalJSON(b []byte) error { return nil } +// Update a contract condition. +type ContractUpdate struct { + // Internal unique contract identifier. + ContractId int `json:"contract_id"` + + // Must be `1` + ContractUpdate ContractUpdateContractUpdate `json:"contract_update"` + + // Specify limit order to update. + LimitOrder ContractUpdateLimitOrder `json:"limit_order"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough ContractUpdatePassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // Specify limit order to update. type ContractUpdateLimitOrder struct { // New stop loss value for a contract. To cancel, pass `null`. @@ -74,13 +74,13 @@ func (j *ContractUpdate) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["contract_id"]; raw != nil && !ok { + if v, ok := raw["contract_id"]; !ok || v == nil { return fmt.Errorf("field contract_id in ContractUpdate: required") } - if _, ok := raw["contract_update"]; raw != nil && !ok { + if v, ok := raw["contract_update"]; !ok || v == nil { return fmt.Errorf("field contract_update in ContractUpdate: required") } - if _, ok := raw["limit_order"]; raw != nil && !ok { + if v, ok := raw["limit_order"]; !ok || v == nil { return fmt.Errorf("field limit_order in ContractUpdate: required") } type Plain ContractUpdate diff --git a/schema/contract_update_history.go b/schema/contract_update_history.go index 8614c9a..f081ea0 100644 --- a/schema/contract_update_history.go +++ b/schema/contract_update_history.go @@ -6,29 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Request for contract update history. -type ContractUpdateHistory struct { - // Internal unique contract identifier. - ContractId int `json:"contract_id"` - - // Must be `1` - ContractUpdateHistory ContractUpdateHistoryContractUpdateHistory `json:"contract_update_history"` - - // [Optional] Maximum number of historical updates to receive. - Limit float64 `json:"limit,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough ContractUpdateHistoryPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type ContractUpdateHistoryContractUpdateHistory int var enumValues_ContractUpdateHistoryContractUpdateHistory = []interface{}{ @@ -55,6 +32,29 @@ func (j *ContractUpdateHistoryContractUpdateHistory) UnmarshalJSON(b []byte) err return nil } +// Request for contract update history. +type ContractUpdateHistory struct { + // Internal unique contract identifier. + ContractId int `json:"contract_id"` + + // Must be `1` + ContractUpdateHistory ContractUpdateHistoryContractUpdateHistory `json:"contract_update_history"` + + // [Optional] Maximum number of historical updates to receive. + Limit float64 `json:"limit,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough ContractUpdateHistoryPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type ContractUpdateHistoryPassthrough map[string]interface{} @@ -65,10 +65,10 @@ func (j *ContractUpdateHistory) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["contract_id"]; raw != nil && !ok { + if v, ok := raw["contract_id"]; !ok || v == nil { return fmt.Errorf("field contract_id in ContractUpdateHistory: required") } - if _, ok := raw["contract_update_history"]; raw != nil && !ok { + if v, ok := raw["contract_update_history"]; !ok || v == nil { return fmt.Errorf("field contract_update_history in ContractUpdateHistory: required") } type Plain ContractUpdateHistory diff --git a/schema/contract_update_history_resp.go b/schema/contract_update_history_resp.go index 4f878ce..9f76871 100644 --- a/schema/contract_update_history_resp.go +++ b/schema/contract_update_history_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Contract update history status -type ContractUpdateHistoryResp struct { - // Contains the historical and the most recent update status of the contract - ContractUpdateHistory []ContractUpdateHistoryRespContractUpdateHistoryElem `json:"contract_update_history,omitempty"` - - // Echo of the request made. - EchoReq ContractUpdateHistoryRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType ContractUpdateHistoryRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Contains the changed parameter. type ContractUpdateHistoryRespContractUpdateHistoryElem struct { // Display name of the changed parameter. @@ -45,8 +29,6 @@ type ContractUpdateHistoryRespEchoReq map[string]interface{} type ContractUpdateHistoryRespMsgType string -const ContractUpdateHistoryRespMsgTypeContractUpdateHistory ContractUpdateHistoryRespMsgType = "contract_update_history" - var enumValues_ContractUpdateHistoryRespMsgType = []interface{}{ "contract_update_history", } @@ -71,16 +53,34 @@ func (j *ContractUpdateHistoryRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Contract update history status +type ContractUpdateHistoryResp struct { + // Contains the historical and the most recent update status of the contract + ContractUpdateHistory []ContractUpdateHistoryRespContractUpdateHistoryElem `json:"contract_update_history,omitempty"` + + // Echo of the request made. + EchoReq ContractUpdateHistoryRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType ContractUpdateHistoryRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const ContractUpdateHistoryRespMsgTypeContractUpdateHistory ContractUpdateHistoryRespMsgType = "contract_update_history" + // UnmarshalJSON implements json.Unmarshaler. func (j *ContractUpdateHistoryResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ContractUpdateHistoryResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ContractUpdateHistoryResp: required") } type Plain ContractUpdateHistoryResp diff --git a/schema/contract_update_resp.go b/schema/contract_update_resp.go index 7818198..e6f4891 100644 --- a/schema/contract_update_resp.go +++ b/schema/contract_update_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Contract update status -type ContractUpdateResp struct { - // Contains the update status of the request - ContractUpdate *ContractUpdateRespContractUpdate `json:"contract_update,omitempty"` - - // Echo of the request made. - EchoReq ContractUpdateRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType ContractUpdateRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Contains the update status of the request type ContractUpdateRespContractUpdate struct { // The target spot price where the contract will be closed automatically at the @@ -70,8 +54,6 @@ type ContractUpdateRespEchoReq map[string]interface{} type ContractUpdateRespMsgType string -const ContractUpdateRespMsgTypeContractUpdate ContractUpdateRespMsgType = "contract_update" - var enumValues_ContractUpdateRespMsgType = []interface{}{ "contract_update", } @@ -96,16 +78,34 @@ func (j *ContractUpdateRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Contract update status +type ContractUpdateResp struct { + // Contains the update status of the request + ContractUpdate *ContractUpdateRespContractUpdate `json:"contract_update,omitempty"` + + // Echo of the request made. + EchoReq ContractUpdateRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType ContractUpdateRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const ContractUpdateRespMsgTypeContractUpdate ContractUpdateRespMsgType = "contract_update" + // UnmarshalJSON implements json.Unmarshaler. func (j *ContractUpdateResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ContractUpdateResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ContractUpdateResp: required") } type Plain ContractUpdateResp diff --git a/schema/contracts_for.go b/schema/contracts_for.go index 4f764a6..51ea447 100644 --- a/schema/contracts_for.go +++ b/schema/contracts_for.go @@ -55,15 +55,7 @@ const ContractsForLandingCompanyShortMaltainvest ContractsForLandingCompanyShort const ContractsForLandingCompanyShortSvg ContractsForLandingCompanyShort = "svg" const ContractsForLandingCompanyShortVanuatu ContractsForLandingCompanyShort = "vanuatu" const ContractsForLandingCompanyShortVirtual ContractsForLandingCompanyShort = "virtual" - -var enumValues_ContractsForLandingCompanyShort = []interface{}{ - "iom", - "malta", - "maltainvest", - "svg", - "virtual", - "vanuatu", -} +const ContractsForLandingCompanySvg ContractsForLandingCompany = "svg" // UnmarshalJSON implements json.Unmarshaler. func (j *ContractsForLandingCompanyShort) UnmarshalJSON(b []byte) error { @@ -85,11 +77,10 @@ func (j *ContractsForLandingCompanyShort) UnmarshalJSON(b []byte) error { return nil } -const ContractsForLandingCompanySvg ContractsForLandingCompany = "svg" const ContractsForLandingCompanyVanuatu ContractsForLandingCompany = "vanuatu" const ContractsForLandingCompanyVirtual ContractsForLandingCompany = "virtual" -var enumValues_ContractsForLandingCompany = []interface{}{ +var enumValues_ContractsForLandingCompanyShort = []interface{}{ "iom", "malta", "maltainvest", @@ -124,8 +115,6 @@ type ContractsForPassthrough map[string]interface{} type ContractsForProductType string -const ContractsForProductTypeBasic ContractsForProductType = "basic" - var enumValues_ContractsForProductType = []interface{}{ "basic", } @@ -150,13 +139,24 @@ func (j *ContractsForProductType) UnmarshalJSON(b []byte) error { return nil } +const ContractsForProductTypeBasic ContractsForProductType = "basic" + +var enumValues_ContractsForLandingCompany = []interface{}{ + "iom", + "malta", + "maltainvest", + "svg", + "virtual", + "vanuatu", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ContractsFor) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["contracts_for"]; raw != nil && !ok { + if v, ok := raw["contracts_for"]; !ok || v == nil { return fmt.Errorf("field contracts_for in ContractsFor: required") } type Plain ContractsFor diff --git a/schema/contracts_for_company.go b/schema/contracts_for_company.go index 3d71492..ea11636 100644 --- a/schema/contracts_for_company.go +++ b/schema/contracts_for_company.go @@ -29,38 +29,9 @@ type ContractsForCompany struct { type ContractsForCompanyContractsForCompany int -var enumValues_ContractsForCompanyContractsForCompany = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ContractsForCompanyContractsForCompany) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ContractsForCompanyContractsForCompany { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ContractsForCompanyContractsForCompany, v) - } - *j = ContractsForCompanyContractsForCompany(v) - return nil -} - type ContractsForCompanyLandingCompany string const ContractsForCompanyLandingCompanyIom ContractsForCompanyLandingCompany = "iom" -const ContractsForCompanyLandingCompanyMalta ContractsForCompanyLandingCompany = "malta" -const ContractsForCompanyLandingCompanyMaltainvest ContractsForCompanyLandingCompany = "maltainvest" -const ContractsForCompanyLandingCompanySvg ContractsForCompanyLandingCompany = "svg" -const ContractsForCompanyLandingCompanyVanuatu ContractsForCompanyLandingCompany = "vanuatu" -const ContractsForCompanyLandingCompanyVirtual ContractsForCompanyLandingCompany = "virtual" var enumValues_ContractsForCompanyLandingCompany = []interface{}{ "iom", @@ -91,17 +62,47 @@ func (j *ContractsForCompanyLandingCompany) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *ContractsForCompanyContractsForCompany) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ContractsForCompanyContractsForCompany { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ContractsForCompanyContractsForCompany, v) + } + *j = ContractsForCompanyContractsForCompany(v) + return nil +} + +const ContractsForCompanyLandingCompanyMalta ContractsForCompanyLandingCompany = "malta" +const ContractsForCompanyLandingCompanyMaltainvest ContractsForCompanyLandingCompany = "maltainvest" +const ContractsForCompanyLandingCompanySvg ContractsForCompanyLandingCompany = "svg" +const ContractsForCompanyLandingCompanyVanuatu ContractsForCompanyLandingCompany = "vanuatu" +const ContractsForCompanyLandingCompanyVirtual ContractsForCompanyLandingCompany = "virtual" + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type ContractsForCompanyPassthrough map[string]interface{} +var enumValues_ContractsForCompanyContractsForCompany = []interface{}{ + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ContractsForCompany) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["contracts_for_company"]; raw != nil && !ok { + if v, ok := raw["contracts_for_company"]; !ok || v == nil { return fmt.Errorf("field contracts_for_company in ContractsForCompany: required") } type Plain ContractsForCompany diff --git a/schema/contracts_for_company_resp.go b/schema/contracts_for_company_resp.go index 01ac552..c77863f 100644 --- a/schema/contracts_for_company_resp.go +++ b/schema/contracts_for_company_resp.go @@ -6,31 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get the list of currently available contracts for a given landing company. -type ContractsForCompanyResp struct { - // List of available contracts for a given landing company. - ContractsForCompany *ContractsForCompanyRespContractsForCompany `json:"contracts_for_company,omitempty"` - - // Echo of the request made. - EchoReq ContractsForCompanyRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType ContractsForCompanyRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - -// List of available contracts for a given landing company. -type ContractsForCompanyRespContractsForCompany struct { - // List of available contracts. - Available []ContractsForCompanyRespContractsForCompanyAvailableElem `json:"available"` - - // Count of contracts available - HitCount float64 `json:"hit_count"` -} - type ContractsForCompanyRespContractsForCompanyAvailableElem struct { // Category of contract barrier. BarrierCategory string `json:"barrier_category"` @@ -60,22 +35,22 @@ func (j *ContractsForCompanyRespContractsForCompanyAvailableElem) UnmarshalJSON( if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["barrier_category"]; raw != nil && !ok { + if v, ok := raw["barrier_category"]; !ok || v == nil { return fmt.Errorf("field barrier_category in ContractsForCompanyRespContractsForCompanyAvailableElem: required") } - if _, ok := raw["contract_category"]; raw != nil && !ok { + if v, ok := raw["contract_category"]; !ok || v == nil { return fmt.Errorf("field contract_category in ContractsForCompanyRespContractsForCompanyAvailableElem: required") } - if _, ok := raw["contract_category_display"]; raw != nil && !ok { + if v, ok := raw["contract_category_display"]; !ok || v == nil { return fmt.Errorf("field contract_category_display in ContractsForCompanyRespContractsForCompanyAvailableElem: required") } - if _, ok := raw["contract_display"]; raw != nil && !ok { + if v, ok := raw["contract_display"]; !ok || v == nil { return fmt.Errorf("field contract_display in ContractsForCompanyRespContractsForCompanyAvailableElem: required") } - if _, ok := raw["contract_type"]; raw != nil && !ok { + if v, ok := raw["contract_type"]; !ok || v == nil { return fmt.Errorf("field contract_type in ContractsForCompanyRespContractsForCompanyAvailableElem: required") } - if _, ok := raw["sentiment"]; raw != nil && !ok { + if v, ok := raw["sentiment"]; !ok || v == nil { return fmt.Errorf("field sentiment in ContractsForCompanyRespContractsForCompanyAvailableElem: required") } type Plain ContractsForCompanyRespContractsForCompanyAvailableElem @@ -87,16 +62,25 @@ func (j *ContractsForCompanyRespContractsForCompanyAvailableElem) UnmarshalJSON( return nil } +// List of available contracts for a given landing company. +type ContractsForCompanyRespContractsForCompany struct { + // List of available contracts. + Available []ContractsForCompanyRespContractsForCompanyAvailableElem `json:"available"` + + // Count of contracts available + HitCount float64 `json:"hit_count"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ContractsForCompanyRespContractsForCompany) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["available"]; raw != nil && !ok { + if v, ok := raw["available"]; !ok || v == nil { return fmt.Errorf("field available in ContractsForCompanyRespContractsForCompany: required") } - if _, ok := raw["hit_count"]; raw != nil && !ok { + if v, ok := raw["hit_count"]; !ok || v == nil { return fmt.Errorf("field hit_count in ContractsForCompanyRespContractsForCompany: required") } type Plain ContractsForCompanyRespContractsForCompany @@ -116,8 +100,6 @@ type ContractsForCompanyRespEchoReq map[string]interface{} type ContractsForCompanyRespMsgType string -const ContractsForCompanyRespMsgTypeContractsForCompany ContractsForCompanyRespMsgType = "contracts_for_company" - var enumValues_ContractsForCompanyRespMsgType = []interface{}{ "contracts_for_company", } @@ -142,16 +124,34 @@ func (j *ContractsForCompanyRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Get the list of currently available contracts for a given landing company. +type ContractsForCompanyResp struct { + // List of available contracts for a given landing company. + ContractsForCompany *ContractsForCompanyRespContractsForCompany `json:"contracts_for_company,omitempty"` + + // Echo of the request made. + EchoReq ContractsForCompanyRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType ContractsForCompanyRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const ContractsForCompanyRespMsgTypeContractsForCompany ContractsForCompanyRespMsgType = "contracts_for_company" + // UnmarshalJSON implements json.Unmarshaler. func (j *ContractsForCompanyResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ContractsForCompanyResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ContractsForCompanyResp: required") } type Plain ContractsForCompanyResp diff --git a/schema/contracts_for_resp.go b/schema/contracts_for_resp.go index f6ceb43..ad83538 100644 --- a/schema/contracts_for_resp.go +++ b/schema/contracts_for_resp.go @@ -167,52 +167,104 @@ type ContractsForRespContractsForAvailableElemForwardStartingOptionsElem struct // A hash of predefined trading period type ContractsForRespContractsForAvailableElemTradingPeriod map[string]interface{} +// Echo of the request made. +type ContractsForRespEchoReq map[string]interface{} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ContractsForRespContractsFor) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["available"]; !ok || v == nil { + return fmt.Errorf("field available in ContractsForRespContractsFor: required") + } + type Plain ContractsForRespContractsFor + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + if plain.Available != nil && len(plain.Available) < 1 { + return fmt.Errorf("field %s length: must be >= %d", "available", 1) + } + *j = ContractsForRespContractsFor(plain) + return nil +} + +type ContractsForRespMsgType string + +var enumValues_ContractsForRespMsgType = []interface{}{ + "contracts_for", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ContractsForRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ContractsForRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ContractsForRespMsgType, v) + } + *j = ContractsForRespMsgType(v) + return nil +} + +const ContractsForRespMsgTypeContractsFor ContractsForRespMsgType = "contracts_for" + // UnmarshalJSON implements json.Unmarshaler. func (j *ContractsForRespContractsForAvailableElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["barrier_category"]; raw != nil && !ok { + if v, ok := raw["barrier_category"]; !ok || v == nil { return fmt.Errorf("field barrier_category in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["barriers"]; raw != nil && !ok { + if v, ok := raw["barriers"]; !ok || v == nil { return fmt.Errorf("field barriers in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["contract_category"]; raw != nil && !ok { + if v, ok := raw["contract_category"]; !ok || v == nil { return fmt.Errorf("field contract_category in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["contract_category_display"]; raw != nil && !ok { + if v, ok := raw["contract_category_display"]; !ok || v == nil { return fmt.Errorf("field contract_category_display in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["contract_type"]; raw != nil && !ok { + if v, ok := raw["contract_type"]; !ok || v == nil { return fmt.Errorf("field contract_type in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["exchange_name"]; raw != nil && !ok { + if v, ok := raw["exchange_name"]; !ok || v == nil { return fmt.Errorf("field exchange_name in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["expiry_type"]; raw != nil && !ok { + if v, ok := raw["expiry_type"]; !ok || v == nil { return fmt.Errorf("field expiry_type in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["market"]; raw != nil && !ok { + if v, ok := raw["market"]; !ok || v == nil { return fmt.Errorf("field market in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["max_contract_duration"]; raw != nil && !ok { + if v, ok := raw["max_contract_duration"]; !ok || v == nil { return fmt.Errorf("field max_contract_duration in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["min_contract_duration"]; raw != nil && !ok { + if v, ok := raw["min_contract_duration"]; !ok || v == nil { return fmt.Errorf("field min_contract_duration in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["sentiment"]; raw != nil && !ok { + if v, ok := raw["sentiment"]; !ok || v == nil { return fmt.Errorf("field sentiment in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["start_type"]; raw != nil && !ok { + if v, ok := raw["start_type"]; !ok || v == nil { return fmt.Errorf("field start_type in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["submarket"]; raw != nil && !ok { + if v, ok := raw["submarket"]; !ok || v == nil { return fmt.Errorf("field submarket in ContractsForRespContractsForAvailableElem: required") } - if _, ok := raw["underlying_symbol"]; raw != nil && !ok { + if v, ok := raw["underlying_symbol"]; !ok || v == nil { return fmt.Errorf("field underlying_symbol in ContractsForRespContractsForAvailableElem: required") } type Plain ContractsForRespContractsForAvailableElem @@ -230,68 +282,16 @@ func (j *ContractsForRespContractsForAvailableElem) UnmarshalJSON(b []byte) erro return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *ContractsForRespContractsFor) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["available"]; raw != nil && !ok { - return fmt.Errorf("field available in ContractsForRespContractsFor: required") - } - type Plain ContractsForRespContractsFor - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - if plain.Available != nil && len(plain.Available) < 1 { - return fmt.Errorf("field %s length: must be >= %d", "available", 1) - } - *j = ContractsForRespContractsFor(plain) - return nil -} - -// Echo of the request made. -type ContractsForRespEchoReq map[string]interface{} - -type ContractsForRespMsgType string - -const ContractsForRespMsgTypeContractsFor ContractsForRespMsgType = "contracts_for" - -var enumValues_ContractsForRespMsgType = []interface{}{ - "contracts_for", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ContractsForRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ContractsForRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ContractsForRespMsgType, v) - } - *j = ContractsForRespMsgType(v) - return nil -} - // UnmarshalJSON implements json.Unmarshaler. func (j *ContractsForResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ContractsForResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ContractsForResp: required") } type Plain ContractsForResp diff --git a/schema/copy_start.go b/schema/copy_start.go index 13b76f5..ff3b7f0 100644 --- a/schema/copy_start.go +++ b/schema/copy_start.go @@ -44,7 +44,7 @@ func (j *CopyStart) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["copy_start"]; raw != nil && !ok { + if v, ok := raw["copy_start"]; !ok || v == nil { return fmt.Errorf("field copy_start in CopyStart: required") } type Plain CopyStart diff --git a/schema/copy_start_resp.go b/schema/copy_start_resp.go index 203fc35..2b94da2 100644 --- a/schema/copy_start_resp.go +++ b/schema/copy_start_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with results is received -type CopyStartResp struct { - // Copy start confirmation. Returns 1 is success. - CopyStart *int `json:"copy_start,omitempty"` - - // Echo of the request made. - EchoReq CopyStartRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType CopyStartRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type CopyStartRespEchoReq map[string]interface{} type CopyStartRespMsgType string -const CopyStartRespMsgTypeCopyStart CopyStartRespMsgType = "copy_start" - var enumValues_CopyStartRespMsgType = []interface{}{ "copy_start", } @@ -53,16 +35,34 @@ func (j *CopyStartRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with results is received +type CopyStartResp struct { + // Copy start confirmation. Returns 1 is success. + CopyStart *int `json:"copy_start,omitempty"` + + // Echo of the request made. + EchoReq CopyStartRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType CopyStartRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const CopyStartRespMsgTypeCopyStart CopyStartRespMsgType = "copy_start" + // UnmarshalJSON implements json.Unmarshaler. func (j *CopyStartResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in CopyStartResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in CopyStartResp: required") } type Plain CopyStartResp diff --git a/schema/copy_stop.go b/schema/copy_stop.go index cecfaa3..302af81 100644 --- a/schema/copy_stop.go +++ b/schema/copy_stop.go @@ -32,7 +32,7 @@ func (j *CopyStop) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["copy_stop"]; raw != nil && !ok { + if v, ok := raw["copy_stop"]; !ok || v == nil { return fmt.Errorf("field copy_stop in CopyStop: required") } type Plain CopyStop diff --git a/schema/copy_stop_resp.go b/schema/copy_stop_resp.go index 3cd7479..716a6fd 100644 --- a/schema/copy_stop_resp.go +++ b/schema/copy_stop_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with results is received -type CopyStopResp struct { - // Copy stopping confirmation. Returns 1 is success. - CopyStop *int `json:"copy_stop,omitempty"` - - // Echo of the request made. - EchoReq CopyStopRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType CopyStopRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type CopyStopRespEchoReq map[string]interface{} type CopyStopRespMsgType string -const CopyStopRespMsgTypeCopyStop CopyStopRespMsgType = "copy_stop" - var enumValues_CopyStopRespMsgType = []interface{}{ "copy_stop", } @@ -53,16 +35,34 @@ func (j *CopyStopRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with results is received +type CopyStopResp struct { + // Copy stopping confirmation. Returns 1 is success. + CopyStop *int `json:"copy_stop,omitempty"` + + // Echo of the request made. + EchoReq CopyStopRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType CopyStopRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const CopyStopRespMsgTypeCopyStop CopyStopRespMsgType = "copy_stop" + // UnmarshalJSON implements json.Unmarshaler. func (j *CopyStopResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in CopyStopResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in CopyStopResp: required") } type Plain CopyStopResp diff --git a/schema/copytrading_list.go b/schema/copytrading_list.go index 9d16a37..5d9f240 100644 --- a/schema/copytrading_list.go +++ b/schema/copytrading_list.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieves a list of active copiers and/or traders for Copy Trading -type CopytradingList struct { - // Must be `1` - CopytradingList CopytradingListCopytradingList `json:"copytrading_list"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough CopytradingListPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type CopytradingListCopytradingList int var enumValues_CopytradingListCopytradingList = []interface{}{ @@ -49,6 +32,23 @@ func (j *CopytradingListCopytradingList) UnmarshalJSON(b []byte) error { return nil } +// Retrieves a list of active copiers and/or traders for Copy Trading +type CopytradingList struct { + // Must be `1` + CopytradingList CopytradingListCopytradingList `json:"copytrading_list"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough CopytradingListPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type CopytradingListPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *CopytradingList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["copytrading_list"]; raw != nil && !ok { + if v, ok := raw["copytrading_list"]; !ok || v == nil { return fmt.Errorf("field copytrading_list in CopytradingList: required") } type Plain CopytradingList diff --git a/schema/copytrading_list_resp.go b/schema/copytrading_list_resp.go index c274fa3..fb28dad 100644 --- a/schema/copytrading_list_resp.go +++ b/schema/copytrading_list_resp.go @@ -6,31 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Details of copiers and/or traders for Copy Trading -type CopytradingListResp struct { - // The trading information of copiers or traders. - CopytradingList *CopytradingListRespCopytradingList `json:"copytrading_list,omitempty"` - - // Echo of the request made. - EchoReq CopytradingListRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType CopytradingListRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - -// The trading information of copiers or traders. -type CopytradingListRespCopytradingList struct { - // List of users who are currently copy trading the authenticated user - Copiers []CopytradingListRespCopytradingListCopiersElem `json:"copiers"` - - // List of traders being followed by the authenticated user - Traders []CopytradingListRespCopytradingListTradersElem `json:"traders"` -} - type CopytradingListRespCopytradingListCopiersElem struct { // The loginid of the copier's account. Loginid string `json:"loginid"` @@ -42,7 +17,7 @@ func (j *CopytradingListRespCopytradingListCopiersElem) UnmarshalJSON(b []byte) if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["loginid"]; raw != nil && !ok { + if v, ok := raw["loginid"]; !ok || v == nil { return fmt.Errorf("field loginid in CopytradingListRespCopytradingListCopiersElem: required") } type Plain CopytradingListRespCopytradingListCopiersElem @@ -54,6 +29,15 @@ func (j *CopytradingListRespCopytradingListCopiersElem) UnmarshalJSON(b []byte) return nil } +// The trading information of copiers or traders. +type CopytradingListRespCopytradingList struct { + // List of users who are currently copy trading the authenticated user + Copiers []CopytradingListRespCopytradingListCopiersElem `json:"copiers"` + + // List of traders being followed by the authenticated user + Traders []CopytradingListRespCopytradingListTradersElem `json:"traders"` +} + type CopytradingListRespCopytradingListTradersElem struct { // The list of assets to copy the trades of. Assets []string `json:"assets,omitempty"` @@ -80,10 +64,10 @@ func (j *CopytradingListRespCopytradingList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["copiers"]; raw != nil && !ok { + if v, ok := raw["copiers"]; !ok || v == nil { return fmt.Errorf("field copiers in CopytradingListRespCopytradingList: required") } - if _, ok := raw["traders"]; raw != nil && !ok { + if v, ok := raw["traders"]; !ok || v == nil { return fmt.Errorf("field traders in CopytradingListRespCopytradingList: required") } type Plain CopytradingListRespCopytradingList @@ -100,8 +84,6 @@ type CopytradingListRespEchoReq map[string]interface{} type CopytradingListRespMsgType string -const CopytradingListRespMsgTypeCopytradingList CopytradingListRespMsgType = "copytrading_list" - var enumValues_CopytradingListRespMsgType = []interface{}{ "copytrading_list", } @@ -126,16 +108,34 @@ func (j *CopytradingListRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Details of copiers and/or traders for Copy Trading +type CopytradingListResp struct { + // The trading information of copiers or traders. + CopytradingList *CopytradingListRespCopytradingList `json:"copytrading_list,omitempty"` + + // Echo of the request made. + EchoReq CopytradingListRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType CopytradingListRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const CopytradingListRespMsgTypeCopytradingList CopytradingListRespMsgType = "copytrading_list" + // UnmarshalJSON implements json.Unmarshaler. func (j *CopytradingListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in CopytradingListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in CopytradingListResp: required") } type Plain CopytradingListResp diff --git a/schema/copytrading_statistics.go b/schema/copytrading_statistics.go index 70cad92..60db136 100644 --- a/schema/copytrading_statistics.go +++ b/schema/copytrading_statistics.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieve performance, trading, risk and copiers statistics of trader. -type CopytradingStatistics struct { - // Must be `1` - CopytradingStatistics CopytradingStatisticsCopytradingStatistics `json:"copytrading_statistics"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough CopytradingStatisticsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // The ID of the target trader. - TraderId string `json:"trader_id"` -} - type CopytradingStatisticsCopytradingStatistics int var enumValues_CopytradingStatisticsCopytradingStatistics = []interface{}{ @@ -48,6 +32,22 @@ func (j *CopytradingStatisticsCopytradingStatistics) UnmarshalJSON(b []byte) err return nil } +// Retrieve performance, trading, risk and copiers statistics of trader. +type CopytradingStatistics struct { + // Must be `1` + CopytradingStatistics CopytradingStatisticsCopytradingStatistics `json:"copytrading_statistics"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough CopytradingStatisticsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // The ID of the target trader. + TraderId string `json:"trader_id"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type CopytradingStatisticsPassthrough map[string]interface{} @@ -58,10 +58,10 @@ func (j *CopytradingStatistics) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["copytrading_statistics"]; raw != nil && !ok { + if v, ok := raw["copytrading_statistics"]; !ok || v == nil { return fmt.Errorf("field copytrading_statistics in CopytradingStatistics: required") } - if _, ok := raw["trader_id"]; raw != nil && !ok { + if v, ok := raw["trader_id"]; !ok || v == nil { return fmt.Errorf("field trader_id in CopytradingStatistics: required") } type Plain CopytradingStatistics diff --git a/schema/copytrading_statistics_resp.go b/schema/copytrading_statistics_resp.go index 55433b8..a83f2dc 100644 --- a/schema/copytrading_statistics_resp.go +++ b/schema/copytrading_statistics_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// The statistics of the trader. -type CopytradingStatisticsResp struct { - // Statistics of the trader - CopytradingStatistics *CopytradingStatisticsRespCopytradingStatistics `json:"copytrading_statistics,omitempty"` - - // Echo of the request made. - EchoReq CopytradingStatisticsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType CopytradingStatisticsRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Statistics of the trader type CopytradingStatisticsRespCopytradingStatistics struct { // This is the epoch the investor started trading. @@ -76,37 +60,37 @@ func (j *CopytradingStatisticsRespCopytradingStatistics) UnmarshalJSON(b []byte) if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["active_since"]; raw != nil && !ok { + if v, ok := raw["active_since"]; !ok || v == nil { return fmt.Errorf("field active_since in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["avg_duration"]; raw != nil && !ok { + if v, ok := raw["avg_duration"]; !ok || v == nil { return fmt.Errorf("field avg_duration in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["avg_loss"]; raw != nil && !ok { + if v, ok := raw["avg_loss"]; !ok || v == nil { return fmt.Errorf("field avg_loss in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["avg_profit"]; raw != nil && !ok { + if v, ok := raw["avg_profit"]; !ok || v == nil { return fmt.Errorf("field avg_profit in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["copiers"]; raw != nil && !ok { + if v, ok := raw["copiers"]; !ok || v == nil { return fmt.Errorf("field copiers in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["last_12months_profitable_trades"]; raw != nil && !ok { + if v, ok := raw["last_12months_profitable_trades"]; !ok || v == nil { return fmt.Errorf("field last_12months_profitable_trades in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["monthly_profitable_trades"]; raw != nil && !ok { + if v, ok := raw["monthly_profitable_trades"]; !ok || v == nil { return fmt.Errorf("field monthly_profitable_trades in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["performance_probability"]; raw != nil && !ok { + if v, ok := raw["performance_probability"]; !ok || v == nil { return fmt.Errorf("field performance_probability in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["total_trades"]; raw != nil && !ok { + if v, ok := raw["total_trades"]; !ok || v == nil { return fmt.Errorf("field total_trades in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["trades_breakdown"]; raw != nil && !ok { + if v, ok := raw["trades_breakdown"]; !ok || v == nil { return fmt.Errorf("field trades_breakdown in CopytradingStatisticsRespCopytradingStatistics: required") } - if _, ok := raw["trades_profitable"]; raw != nil && !ok { + if v, ok := raw["trades_profitable"]; !ok || v == nil { return fmt.Errorf("field trades_profitable in CopytradingStatisticsRespCopytradingStatistics: required") } type Plain CopytradingStatisticsRespCopytradingStatistics @@ -123,8 +107,6 @@ type CopytradingStatisticsRespEchoReq map[string]interface{} type CopytradingStatisticsRespMsgType string -const CopytradingStatisticsRespMsgTypeCopytradingStatistics CopytradingStatisticsRespMsgType = "copytrading_statistics" - var enumValues_CopytradingStatisticsRespMsgType = []interface{}{ "copytrading_statistics", } @@ -149,16 +131,34 @@ func (j *CopytradingStatisticsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The statistics of the trader. +type CopytradingStatisticsResp struct { + // Statistics of the trader + CopytradingStatistics *CopytradingStatisticsRespCopytradingStatistics `json:"copytrading_statistics,omitempty"` + + // Echo of the request made. + EchoReq CopytradingStatisticsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType CopytradingStatisticsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const CopytradingStatisticsRespMsgTypeCopytradingStatistics CopytradingStatisticsRespMsgType = "copytrading_statistics" + // UnmarshalJSON implements json.Unmarshaler. func (j *CopytradingStatisticsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in CopytradingStatisticsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in CopytradingStatisticsResp: required") } type Plain CopytradingStatisticsResp diff --git a/schema/crypto_config.go b/schema/crypto_config.go index 30799ae..e861e5c 100644 --- a/schema/crypto_config.go +++ b/schema/crypto_config.go @@ -6,27 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// The request for cryptocurrencies configuration. -type CryptoConfig struct { - // Must be `1` - CryptoConfig CryptoConfigCryptoConfig `json:"crypto_config"` - - // [Optional] Cryptocurrency code. Sending request with currency_code provides - // crypto config for the sent cryptocurrency code only. - CurrencyCode *string `json:"currency_code,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough CryptoConfigPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type CryptoConfigCryptoConfig int var enumValues_CryptoConfigCryptoConfig = []interface{}{ @@ -53,6 +32,27 @@ func (j *CryptoConfigCryptoConfig) UnmarshalJSON(b []byte) error { return nil } +// The request for cryptocurrencies configuration. +type CryptoConfig struct { + // Must be `1` + CryptoConfig CryptoConfigCryptoConfig `json:"crypto_config"` + + // [Optional] Cryptocurrency code. Sending request with currency_code provides + // crypto config for the sent cryptocurrency code only. + CurrencyCode *string `json:"currency_code,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough CryptoConfigPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type CryptoConfigPassthrough map[string]interface{} @@ -63,7 +63,7 @@ func (j *CryptoConfig) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["crypto_config"]; raw != nil && !ok { + if v, ok := raw["crypto_config"]; !ok || v == nil { return fmt.Errorf("field crypto_config in CryptoConfig: required") } type Plain CryptoConfig diff --git a/schema/crypto_config_resp.go b/schema/crypto_config_resp.go index 58f4270..bfffe74 100644 --- a/schema/crypto_config_resp.go +++ b/schema/crypto_config_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// The response will display the configuration details related to cryptocurrencies -type CryptoConfigResp struct { - // Provides cryptocurrencies configuration. - CryptoConfig *CryptoConfigRespCryptoConfig `json:"crypto_config,omitempty"` - - // Echo of the request made. - EchoReq CryptoConfigRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType CryptoConfigRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Provides cryptocurrencies configuration. type CryptoConfigRespCryptoConfig struct { // Currency configuration including limitiations for each crypto currency. @@ -37,7 +21,7 @@ func (j *CryptoConfigRespCryptoConfig) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["currencies_config"]; raw != nil && !ok { + if v, ok := raw["currencies_config"]; !ok || v == nil { return fmt.Errorf("field currencies_config in CryptoConfigRespCryptoConfig: required") } type Plain CryptoConfigRespCryptoConfig @@ -54,8 +38,6 @@ type CryptoConfigRespEchoReq map[string]interface{} type CryptoConfigRespMsgType string -const CryptoConfigRespMsgTypeCryptoConfig CryptoConfigRespMsgType = "crypto_config" - var enumValues_CryptoConfigRespMsgType = []interface{}{ "crypto_config", } @@ -80,16 +62,34 @@ func (j *CryptoConfigRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The response will display the configuration details related to cryptocurrencies +type CryptoConfigResp struct { + // Provides cryptocurrencies configuration. + CryptoConfig *CryptoConfigRespCryptoConfig `json:"crypto_config,omitempty"` + + // Echo of the request made. + EchoReq CryptoConfigRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType CryptoConfigRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const CryptoConfigRespMsgTypeCryptoConfig CryptoConfigRespMsgType = "crypto_config" + // UnmarshalJSON implements json.Unmarshaler. func (j *CryptoConfigResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in CryptoConfigResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in CryptoConfigResp: required") } type Plain CryptoConfigResp diff --git a/schema/crypto_estimations.go b/schema/crypto_estimations.go index 8c605fa..69e475b 100644 --- a/schema/crypto_estimations.go +++ b/schema/crypto_estimations.go @@ -6,30 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get the current estimations for cryptocurrencies. E.g. Withdrawal fee. -type CryptoEstimations struct { - // Must be `1` - CryptoEstimations CryptoEstimationsCryptoEstimations `json:"crypto_estimations"` - - // Cryptocurrency code for which fee estimation is provided. - CurrencyCode string `json:"currency_code"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough CryptoEstimationsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to 1, will send updates whenever there is an update to crypto - // estimations. - Subscribe *CryptoEstimationsSubscribe `json:"subscribe,omitempty"` -} - type CryptoEstimationsCryptoEstimations int var enumValues_CryptoEstimationsCryptoEstimations = []interface{}{ @@ -86,16 +62,40 @@ func (j *CryptoEstimationsSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Get the current estimations for cryptocurrencies. E.g. Withdrawal fee. +type CryptoEstimations struct { + // Must be `1` + CryptoEstimations CryptoEstimationsCryptoEstimations `json:"crypto_estimations"` + + // Cryptocurrency code for which fee estimation is provided. + CurrencyCode string `json:"currency_code"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough CryptoEstimationsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to 1, will send updates whenever there is an update to crypto + // estimations. + Subscribe *CryptoEstimationsSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *CryptoEstimations) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["crypto_estimations"]; raw != nil && !ok { + if v, ok := raw["crypto_estimations"]; !ok || v == nil { return fmt.Errorf("field crypto_estimations in CryptoEstimations: required") } - if _, ok := raw["currency_code"]; raw != nil && !ok { + if v, ok := raw["currency_code"]; !ok || v == nil { return fmt.Errorf("field currency_code in CryptoEstimations: required") } type Plain CryptoEstimations diff --git a/schema/crypto_estimations_resp.go b/schema/crypto_estimations_resp.go index 0664ba9..7f31776 100644 --- a/schema/crypto_estimations_resp.go +++ b/schema/crypto_estimations_resp.go @@ -6,25 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Latest cryptocurrency estimations. -type CryptoEstimationsResp struct { - // Cryptocurrency estimations. E.g. Withdrawal fee estimations. - CryptoEstimations CryptoEstimationsRespCryptoEstimations `json:"crypto_estimations,omitempty"` - - // Echo of the request made. - EchoReq CryptoEstimationsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType CryptoEstimationsRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *CryptoEstimationsRespSubscription `json:"subscription,omitempty"` -} - // Cryptocurrency estimations. E.g. Withdrawal fee estimations. type CryptoEstimationsRespCryptoEstimations map[string]interface{} @@ -33,8 +14,6 @@ type CryptoEstimationsRespEchoReq map[string]interface{} type CryptoEstimationsRespMsgType string -const CryptoEstimationsRespMsgTypeCryptoEstimations CryptoEstimationsRespMsgType = "crypto_estimations" - var enumValues_CryptoEstimationsRespMsgType = []interface{}{ "crypto_estimations", } @@ -59,6 +38,8 @@ func (j *CryptoEstimationsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const CryptoEstimationsRespMsgTypeCryptoEstimations CryptoEstimationsRespMsgType = "crypto_estimations" + // For subscription requests only. type CryptoEstimationsRespSubscription struct { // A per-connection unique identifier. Can be passed to the `forget` API call to @@ -72,7 +53,7 @@ func (j *CryptoEstimationsRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in CryptoEstimationsRespSubscription: required") } type Plain CryptoEstimationsRespSubscription @@ -84,16 +65,35 @@ func (j *CryptoEstimationsRespSubscription) UnmarshalJSON(b []byte) error { return nil } +// Latest cryptocurrency estimations. +type CryptoEstimationsResp struct { + // Cryptocurrency estimations. E.g. Withdrawal fee estimations. + CryptoEstimations CryptoEstimationsRespCryptoEstimations `json:"crypto_estimations,omitempty"` + + // Echo of the request made. + EchoReq CryptoEstimationsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType CryptoEstimationsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *CryptoEstimationsRespSubscription `json:"subscription,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *CryptoEstimationsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in CryptoEstimationsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in CryptoEstimationsResp: required") } type Plain CryptoEstimationsResp diff --git a/schema/document_upload.go b/schema/document_upload.go index 700ec15..d53b577 100644 --- a/schema/document_upload.go +++ b/schema/document_upload.go @@ -66,34 +66,6 @@ const DocumentUploadDocumentFormatJPG DocumentUploadDocumentFormat = "JPG" const DocumentUploadDocumentFormatPDF DocumentUploadDocumentFormat = "PDF" const DocumentUploadDocumentFormatPNG DocumentUploadDocumentFormat = "PNG" -var enumValues_DocumentUploadDocumentFormat = []interface{}{ - "PNG", - "JPG", - "JPEG", - "GIF", - "PDF", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *DocumentUploadDocumentFormat) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_DocumentUploadDocumentFormat { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DocumentUploadDocumentFormat, v) - } - *j = DocumentUploadDocumentFormat(v) - return nil -} - type DocumentUploadDocumentType string const DocumentUploadDocumentTypeAmlglobalcheck DocumentUploadDocumentType = "amlglobalcheck" @@ -124,17 +96,57 @@ const DocumentUploadDocumentTypePhoneBill DocumentUploadDocumentType = "phone_bi const DocumentUploadDocumentTypePoaOthers DocumentUploadDocumentType = "poa_others" const DocumentUploadDocumentTypePoiOthers DocumentUploadDocumentType = "poi_others" const DocumentUploadDocumentTypePowerOfAttorney DocumentUploadDocumentType = "power_of_attorney" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *DocumentUploadDocumentUpload) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_DocumentUploadDocumentUpload { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DocumentUploadDocumentUpload, v) + } + *j = DocumentUploadDocumentUpload(v) + return nil +} + const DocumentUploadDocumentTypeProofOfOwnership DocumentUploadDocumentType = "proof_of_ownership" -const DocumentUploadDocumentTypeProofaddress DocumentUploadDocumentType = "proofaddress" -const DocumentUploadDocumentTypeProofid DocumentUploadDocumentType = "proofid" +const DocumentUploadDocumentTypeTaxReturn DocumentUploadDocumentType = "tax_return" const DocumentUploadDocumentTypeSelfieWithId DocumentUploadDocumentType = "selfie_with_id" -const DocumentUploadDocumentTypeServiceIdCard DocumentUploadDocumentType = "service_id_card" -const DocumentUploadDocumentTypeStudentCard DocumentUploadDocumentType = "student_card" const DocumentUploadDocumentTypeTaxPhotoId DocumentUploadDocumentType = "tax_photo_id" -const DocumentUploadDocumentTypeTaxReceipt DocumentUploadDocumentType = "tax_receipt" -const DocumentUploadDocumentTypeTaxReturn DocumentUploadDocumentType = "tax_return" -const DocumentUploadDocumentTypeUtilityBill DocumentUploadDocumentType = "utility_bill" +const DocumentUploadDocumentTypeStudentCard DocumentUploadDocumentType = "student_card" const DocumentUploadDocumentTypeVoterCard DocumentUploadDocumentType = "voter_card" +const DocumentUploadDocumentTypeProofaddress DocumentUploadDocumentType = "proofaddress" +const DocumentUploadDocumentTypeProofid DocumentUploadDocumentType = "proofid" +const DocumentUploadDocumentTypeUtilityBill DocumentUploadDocumentType = "utility_bill" +const DocumentUploadDocumentTypeServiceIdCard DocumentUploadDocumentType = "service_id_card" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *DocumentUploadDocumentType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_DocumentUploadDocumentType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DocumentUploadDocumentType, v) + } + *j = DocumentUploadDocumentType(v) + return nil +} var enumValues_DocumentUploadDocumentType = []interface{}{ "passport", @@ -179,22 +191,22 @@ var enumValues_DocumentUploadDocumentType = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *DocumentUploadDocumentType) UnmarshalJSON(b []byte) error { +func (j *DocumentUploadDocumentFormat) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_DocumentUploadDocumentType { + for _, expected := range enumValues_DocumentUploadDocumentFormat { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DocumentUploadDocumentType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DocumentUploadDocumentFormat, v) } - *j = DocumentUploadDocumentType(v) + *j = DocumentUploadDocumentFormat(v) return nil } @@ -204,25 +216,7 @@ var enumValues_DocumentUploadDocumentUpload = []interface{}{ 1, } -// UnmarshalJSON implements json.Unmarshaler. -func (j *DocumentUploadDocumentUpload) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_DocumentUploadDocumentUpload { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DocumentUploadDocumentUpload, v) - } - *j = DocumentUploadDocumentUpload(v) - return nil -} +const DocumentUploadDocumentTypeTaxReceipt DocumentUploadDocumentType = "tax_receipt" type DocumentUploadLifetimeValid int @@ -253,10 +247,6 @@ func (j *DocumentUploadLifetimeValid) UnmarshalJSON(b []byte) error { type DocumentUploadPageType string -const DocumentUploadPageTypeBack DocumentUploadPageType = "back" -const DocumentUploadPageTypeFront DocumentUploadPageType = "front" -const DocumentUploadPageTypePhoto DocumentUploadPageType = "photo" - var enumValues_DocumentUploadPageType = []interface{}{ "front", "back", @@ -283,10 +273,18 @@ func (j *DocumentUploadPageType) UnmarshalJSON(b []byte) error { return nil } +const DocumentUploadPageTypeFront DocumentUploadPageType = "front" +const DocumentUploadPageTypeBack DocumentUploadPageType = "back" +const DocumentUploadPageTypePhoto DocumentUploadPageType = "photo" + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type DocumentUploadPassthrough map[string]interface{} +// A collection of unspecific information related to the proof of ownership being +// uploaded +type DocumentUploadProofOfOwnershipDetails map[string]interface{} + // [Optional] It contains info about the proof of ownership being uploaded // (mandatory for proof_of_ownership document type) type DocumentUploadProofOfOwnership struct { @@ -299,20 +297,16 @@ type DocumentUploadProofOfOwnership struct { Id float64 `json:"id"` } -// A collection of unspecific information related to the proof of ownership being -// uploaded -type DocumentUploadProofOfOwnershipDetails map[string]interface{} - // UnmarshalJSON implements json.Unmarshaler. func (j *DocumentUploadProofOfOwnership) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["details"]; raw != nil && !ok { + if v, ok := raw["details"]; !ok || v == nil { return fmt.Errorf("field details in DocumentUploadProofOfOwnership: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in DocumentUploadProofOfOwnership: required") } type Plain DocumentUploadProofOfOwnership @@ -324,25 +318,33 @@ func (j *DocumentUploadProofOfOwnership) UnmarshalJSON(b []byte) error { return nil } +var enumValues_DocumentUploadDocumentFormat = []interface{}{ + "PNG", + "JPG", + "JPEG", + "GIF", + "PDF", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *DocumentUpload) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["document_format"]; raw != nil && !ok { + if v, ok := raw["document_format"]; !ok || v == nil { return fmt.Errorf("field document_format in DocumentUpload: required") } - if _, ok := raw["document_type"]; raw != nil && !ok { + if v, ok := raw["document_type"]; !ok || v == nil { return fmt.Errorf("field document_type in DocumentUpload: required") } - if _, ok := raw["document_upload"]; raw != nil && !ok { + if v, ok := raw["document_upload"]; !ok || v == nil { return fmt.Errorf("field document_upload in DocumentUpload: required") } - if _, ok := raw["expected_checksum"]; raw != nil && !ok { + if v, ok := raw["expected_checksum"]; !ok || v == nil { return fmt.Errorf("field expected_checksum in DocumentUpload: required") } - if _, ok := raw["file_size"]; raw != nil && !ok { + if v, ok := raw["file_size"]; !ok || v == nil { return fmt.Errorf("field file_size in DocumentUpload: required") } type Plain DocumentUpload diff --git a/schema/document_upload_resp.go b/schema/document_upload_resp.go index a8206e5..ae7a745 100644 --- a/schema/document_upload_resp.go +++ b/schema/document_upload_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Receive details of uploaded authentication documents -type DocumentUploadResp struct { - // Details of the uploaded documents. - DocumentUpload *DocumentUploadRespDocumentUpload `json:"document_upload,omitempty"` - - // Echo of the request made. - EchoReq DocumentUploadRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType DocumentUploadRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Details of the uploaded documents. type DocumentUploadRespDocumentUpload struct { // Current call type, add this to your binary payload metadata @@ -49,10 +33,10 @@ func (j *DocumentUploadRespDocumentUpload) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["call_type"]; raw != nil && !ok { + if v, ok := raw["call_type"]; !ok || v == nil { return fmt.Errorf("field call_type in DocumentUploadRespDocumentUpload: required") } - if _, ok := raw["upload_id"]; raw != nil && !ok { + if v, ok := raw["upload_id"]; !ok || v == nil { return fmt.Errorf("field upload_id in DocumentUploadRespDocumentUpload: required") } type Plain DocumentUploadRespDocumentUpload @@ -69,8 +53,6 @@ type DocumentUploadRespEchoReq map[string]interface{} type DocumentUploadRespMsgType string -const DocumentUploadRespMsgTypeDocumentUpload DocumentUploadRespMsgType = "document_upload" - var enumValues_DocumentUploadRespMsgType = []interface{}{ "document_upload", } @@ -95,16 +77,34 @@ func (j *DocumentUploadRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Receive details of uploaded authentication documents +type DocumentUploadResp struct { + // Details of the uploaded documents. + DocumentUpload *DocumentUploadRespDocumentUpload `json:"document_upload,omitempty"` + + // Echo of the request made. + EchoReq DocumentUploadRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType DocumentUploadRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const DocumentUploadRespMsgTypeDocumentUpload DocumentUploadRespMsgType = "document_upload" + // UnmarshalJSON implements json.Unmarshaler. func (j *DocumentUploadResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in DocumentUploadResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in DocumentUploadResp: required") } type Plain DocumentUploadResp diff --git a/schema/economic_calendar.go b/schema/economic_calendar.go index 3fe5fb9..e3c86ff 100644 --- a/schema/economic_calendar.go +++ b/schema/economic_calendar.go @@ -6,30 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Specify a currency to receive a list of events related to that specific -// currency. For example, specifying USD will return a list of USD-related events. -// If the currency is omitted, you will receive a list for all currencies. -type EconomicCalendar struct { - // [Optional] Currency symbol. - Currency *string `json:"currency,omitempty"` - - // Must be `1` - EconomicCalendar EconomicCalendarEconomicCalendar `json:"economic_calendar"` - - // [Optional] End date. - EndDate *int `json:"end_date,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough EconomicCalendarPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] Start date. - StartDate *int `json:"start_date,omitempty"` -} - type EconomicCalendarEconomicCalendar int var enumValues_EconomicCalendarEconomicCalendar = []interface{}{ @@ -56,6 +32,30 @@ func (j *EconomicCalendarEconomicCalendar) UnmarshalJSON(b []byte) error { return nil } +// Specify a currency to receive a list of events related to that specific +// currency. For example, specifying USD will return a list of USD-related events. +// If the currency is omitted, you will receive a list for all currencies. +type EconomicCalendar struct { + // [Optional] Currency symbol. + Currency *string `json:"currency,omitempty"` + + // Must be `1` + EconomicCalendar EconomicCalendarEconomicCalendar `json:"economic_calendar"` + + // [Optional] End date. + EndDate *int `json:"end_date,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough EconomicCalendarPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] Start date. + StartDate *int `json:"start_date,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type EconomicCalendarPassthrough map[string]interface{} @@ -66,7 +66,7 @@ func (j *EconomicCalendar) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["economic_calendar"]; raw != nil && !ok { + if v, ok := raw["economic_calendar"]; !ok || v == nil { return fmt.Errorf("field economic_calendar in EconomicCalendar: required") } type Plain EconomicCalendar diff --git a/schema/economic_calendar_resp.go b/schema/economic_calendar_resp.go index bffc04b..a90319f 100644 --- a/schema/economic_calendar_resp.go +++ b/schema/economic_calendar_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A list of economic events. -type EconomicCalendarResp struct { - // Echo of the request made. - EchoReq EconomicCalendarRespEchoReq `json:"echo_req"` - - // Economic calendar. - EconomicCalendar *EconomicCalendarRespEconomicCalendar `json:"economic_calendar,omitempty"` - - // Action name of the request made. - MsgType EconomicCalendarRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type EconomicCalendarRespEchoReq map[string]interface{} @@ -74,8 +58,6 @@ type EconomicCalendarRespEconomicCalendarEventsElemPrevious struct { type EconomicCalendarRespMsgType string -const EconomicCalendarRespMsgTypeEconomicCalendar EconomicCalendarRespMsgType = "economic_calendar" - var enumValues_EconomicCalendarRespMsgType = []interface{}{ "economic_calendar", } @@ -100,16 +82,34 @@ func (j *EconomicCalendarRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A list of economic events. +type EconomicCalendarResp struct { + // Echo of the request made. + EchoReq EconomicCalendarRespEchoReq `json:"echo_req"` + + // Economic calendar. + EconomicCalendar *EconomicCalendarRespEconomicCalendar `json:"economic_calendar,omitempty"` + + // Action name of the request made. + MsgType EconomicCalendarRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const EconomicCalendarRespMsgTypeEconomicCalendar EconomicCalendarRespMsgType = "economic_calendar" + // UnmarshalJSON implements json.Unmarshaler. func (j *EconomicCalendarResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in EconomicCalendarResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in EconomicCalendarResp: required") } type Plain EconomicCalendarResp diff --git a/schema/exchange_rates.go b/schema/exchange_rates.go index fd9ef34..de1eabe 100644 --- a/schema/exchange_rates.go +++ b/schema/exchange_rates.go @@ -6,39 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieves the exchange rate from a base currency to a target currency supported -// by the system. -type ExchangeRates struct { - // Base currency (can be obtained from `payout_currencies` call) - BaseCurrency string `json:"base_currency"` - - // Must be `1` - ExchangeRates ExchangeRatesExchangeRates `json:"exchange_rates"` - - // [Optional] 1 - Request for ask and bid rates along with the spot rate. Only - // available if target_currency is provided. - IncludeSpread *ExchangeRatesIncludeSpread `json:"include_spread,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough ExchangeRatesPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] 1 - to initiate a realtime stream of exchange rates relative to base - // currency. - Subscribe *ExchangeRatesSubscribe `json:"subscribe,omitempty"` - - // [Optional] Target currency for the exchange rate. If subscribe is set, - // target_currency must be specified as well. - TargetCurrency *string `json:"target_currency,omitempty"` -} - type ExchangeRatesExchangeRates int var enumValues_ExchangeRatesExchangeRates = []interface{}{ @@ -121,16 +88,49 @@ func (j *ExchangeRatesSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Retrieves the exchange rate from a base currency to a target currency supported +// by the system. +type ExchangeRates struct { + // Base currency (can be obtained from `payout_currencies` call) + BaseCurrency string `json:"base_currency"` + + // Must be `1` + ExchangeRates ExchangeRatesExchangeRates `json:"exchange_rates"` + + // [Optional] 1 - Request for ask and bid rates along with the spot rate. Only + // available if target_currency is provided. + IncludeSpread *ExchangeRatesIncludeSpread `json:"include_spread,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough ExchangeRatesPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] 1 - to initiate a realtime stream of exchange rates relative to base + // currency. + Subscribe *ExchangeRatesSubscribe `json:"subscribe,omitempty"` + + // [Optional] Target currency for the exchange rate. If subscribe is set, + // target_currency must be specified as well. + TargetCurrency *string `json:"target_currency,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ExchangeRates) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["base_currency"]; raw != nil && !ok { + if v, ok := raw["base_currency"]; !ok || v == nil { return fmt.Errorf("field base_currency in ExchangeRates: required") } - if _, ok := raw["exchange_rates"]; raw != nil && !ok { + if v, ok := raw["exchange_rates"]; !ok || v == nil { return fmt.Errorf("field exchange_rates in ExchangeRates: required") } type Plain ExchangeRates diff --git a/schema/exchange_rates_resp.go b/schema/exchange_rates_resp.go index 2669424..3d2a6b3 100644 --- a/schema/exchange_rates_resp.go +++ b/schema/exchange_rates_resp.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// The exchange rate values from the specified base currency to the specified -// target currency supported by the system. -type ExchangeRatesResp struct { - // Echo of the request made. - EchoReq ExchangeRatesRespEchoReq `json:"echo_req"` - - // Exchange rate values from base to target currency - ExchangeRates *ExchangeRatesRespExchangeRates `json:"exchange_rates,omitempty"` - - // Action name of the request made. - MsgType ExchangeRatesRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *ExchangeRatesRespSubscription `json:"subscription,omitempty"` -} - // Echo of the request made. type ExchangeRatesRespEchoReq map[string]interface{} @@ -46,8 +26,6 @@ type ExchangeRatesRespExchangeRatesRates map[string]interface{} type ExchangeRatesRespMsgType string -const ExchangeRatesRespMsgTypeExchangeRates ExchangeRatesRespMsgType = "exchange_rates" - var enumValues_ExchangeRatesRespMsgType = []interface{}{ "exchange_rates", } @@ -72,6 +50,8 @@ func (j *ExchangeRatesRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const ExchangeRatesRespMsgTypeExchangeRates ExchangeRatesRespMsgType = "exchange_rates" + // For subscription requests only. type ExchangeRatesRespSubscription struct { // A per-connection unique identifier. Can be passed to the `forget` API call to @@ -85,7 +65,7 @@ func (j *ExchangeRatesRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in ExchangeRatesRespSubscription: required") } type Plain ExchangeRatesRespSubscription @@ -97,16 +77,36 @@ func (j *ExchangeRatesRespSubscription) UnmarshalJSON(b []byte) error { return nil } +// The exchange rate values from the specified base currency to the specified +// target currency supported by the system. +type ExchangeRatesResp struct { + // Echo of the request made. + EchoReq ExchangeRatesRespEchoReq `json:"echo_req"` + + // Exchange rate values from base to target currency + ExchangeRates *ExchangeRatesRespExchangeRates `json:"exchange_rates,omitempty"` + + // Action name of the request made. + MsgType ExchangeRatesRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *ExchangeRatesRespSubscription `json:"subscription,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ExchangeRatesResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ExchangeRatesResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ExchangeRatesResp: required") } type Plain ExchangeRatesResp diff --git a/schema/forget.go b/schema/forget.go index 8706f46..03c664f 100644 --- a/schema/forget.go +++ b/schema/forget.go @@ -28,7 +28,7 @@ func (j *Forget) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["forget"]; raw != nil && !ok { + if v, ok := raw["forget"]; !ok || v == nil { return fmt.Errorf("field forget in Forget: required") } type Plain Forget diff --git a/schema/forget_all.go b/schema/forget_all.go index 5daab7e..fbdf3ea 100644 --- a/schema/forget_all.go +++ b/schema/forget_all.go @@ -24,24 +24,6 @@ type ForgetAll struct { // the `echo_req` output field. type ForgetAllPassthrough map[string]interface{} -// UnmarshalJSON implements json.Unmarshaler. -func (j *ForgetAll) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["forget_all"]; raw != nil && !ok { - return fmt.Errorf("field forget_all in ForgetAll: required") - } - type Plain ForgetAll - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = ForgetAll(plain) - return nil -} - type StreamTypes string const StreamTypesBalance StreamTypes = "balance" @@ -59,6 +41,26 @@ const StreamTypesTradingPlatformAssetListing StreamTypes = "trading_platform_ass const StreamTypesTransaction StreamTypes = "transaction" const StreamTypesWebsiteStatus StreamTypes = "website_status" +// UnmarshalJSON implements json.Unmarshaler. +func (j *StreamTypes) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_StreamTypes { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_StreamTypes, v) + } + *j = StreamTypes(v) + return nil +} + var enumValues_StreamTypes = []interface{}{ "balance", "candles", @@ -77,21 +79,19 @@ var enumValues_StreamTypes = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *StreamTypes) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { +func (j *ForgetAll) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { return err } - var ok bool - for _, expected := range enumValues_StreamTypes { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if v, ok := raw["forget_all"]; !ok || v == nil { + return fmt.Errorf("field forget_all in ForgetAll: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_StreamTypes, v) + type Plain ForgetAll + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err } - *j = StreamTypes(v) + *j = ForgetAll(plain) return nil } diff --git a/schema/forget_all_resp.go b/schema/forget_all_resp.go index a16aa5d..72d82b5 100644 --- a/schema/forget_all_resp.go +++ b/schema/forget_all_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of forget all request made. -type ForgetAllResp struct { - // Echo of the request made. - EchoReq ForgetAllRespEchoReq `json:"echo_req"` - - // IDs of the cancelled streams - ForgetAll []interface{} `json:"forget_all,omitempty"` - - // Action name of the request made. - MsgType ForgetAllRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type ForgetAllRespEchoReq map[string]interface{} type ForgetAllRespMsgType string -const ForgetAllRespMsgTypeForgetAll ForgetAllRespMsgType = "forget_all" - var enumValues_ForgetAllRespMsgType = []interface{}{ "forget_all", } @@ -53,16 +35,34 @@ func (j *ForgetAllRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of forget all request made. +type ForgetAllResp struct { + // Echo of the request made. + EchoReq ForgetAllRespEchoReq `json:"echo_req"` + + // IDs of the cancelled streams + ForgetAll []interface{} `json:"forget_all,omitempty"` + + // Action name of the request made. + MsgType ForgetAllRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const ForgetAllRespMsgTypeForgetAll ForgetAllRespMsgType = "forget_all" + // UnmarshalJSON implements json.Unmarshaler. func (j *ForgetAllResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ForgetAllResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ForgetAllResp: required") } type Plain ForgetAllResp diff --git a/schema/forget_resp.go b/schema/forget_resp.go index d9ce6ac..e350704 100644 --- a/schema/forget_resp.go +++ b/schema/forget_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// The result of forget request made. -type ForgetResp struct { - // Echo of the request made. - EchoReq ForgetRespEchoReq `json:"echo_req"` - - // If set to 1, stream exited and stopped. If set to 0, stream did not exist. - Forget *ForgetRespForget `json:"forget,omitempty"` - - // Action name of the request made. - MsgType ForgetRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type ForgetRespEchoReq map[string]interface{} @@ -54,8 +38,6 @@ func (j *ForgetRespForget) UnmarshalJSON(b []byte) error { type ForgetRespMsgType string -const ForgetRespMsgTypeForget ForgetRespMsgType = "forget" - var enumValues_ForgetRespMsgType = []interface{}{ "forget", } @@ -80,16 +62,34 @@ func (j *ForgetRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of forget request made. +type ForgetResp struct { + // Echo of the request made. + EchoReq ForgetRespEchoReq `json:"echo_req"` + + // If set to 1, stream exited and stopped. If set to 0, stream did not exist. + Forget *ForgetRespForget `json:"forget,omitempty"` + + // Action name of the request made. + MsgType ForgetRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const ForgetRespMsgTypeForget ForgetRespMsgType = "forget" + // UnmarshalJSON implements json.Unmarshaler. func (j *ForgetResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ForgetResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ForgetResp: required") } type Plain ForgetResp diff --git a/schema/get_account_status.go b/schema/get_account_status.go index 6b48791..c94bf87 100644 --- a/schema/get_account_status.go +++ b/schema/get_account_status.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get Account Status -type GetAccountStatus struct { - // Must be `1` - GetAccountStatus GetAccountStatusGetAccountStatus `json:"get_account_status"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough GetAccountStatusPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type GetAccountStatusGetAccountStatus int var enumValues_GetAccountStatusGetAccountStatus = []interface{}{ @@ -49,6 +32,23 @@ func (j *GetAccountStatusGetAccountStatus) UnmarshalJSON(b []byte) error { return nil } +// Get Account Status +type GetAccountStatus struct { + // Must be `1` + GetAccountStatus GetAccountStatusGetAccountStatus `json:"get_account_status"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough GetAccountStatusPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type GetAccountStatusPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *GetAccountStatus) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["get_account_status"]; raw != nil && !ok { + if v, ok := raw["get_account_status"]; !ok || v == nil { return fmt.Errorf("field get_account_status in GetAccountStatus: required") } type Plain GetAccountStatus diff --git a/schema/get_account_status_resp.go b/schema/get_account_status_resp.go index 023cd94..5a93968 100644 --- a/schema/get_account_status_resp.go +++ b/schema/get_account_status_resp.go @@ -188,34 +188,6 @@ const GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatu const GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus = "rejected" const GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus = "verified" -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus = []interface{}{ - "verified", - "rejected", - "pending", - "expired", - "none", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus(v) - return nil -} - // The latest POI attempt made by the client type GetAccountStatusRespGetAccountStatusAuthenticationAttemptsLatest map[string]interface{} @@ -241,35 +213,6 @@ const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusRejected G const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "suspected" const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "verified" -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", - "suspected", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus(v) - return nil -} - // This represents the current status of authentication for each mt5 jurisdiction. type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdiction struct { // This represents whether the client is allowed or not to create an account under @@ -319,352 +262,439 @@ type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdict type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi int -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi = []interface{}{ - 0, - 1, +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu int + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual int + +// The authentication status for identity. +type GetAccountStatusRespGetAccountStatusAuthenticationIdentity struct { + // This is the epoch of the document expiry date. + ExpiryDate *int `json:"expiry_date,omitempty"` + + // This shows the information about the authentication services implemented + Services *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServices `json:"services,omitempty"` + + // This represent the current status for proof of identity document submitted for + // authentication. + Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus `json:"status,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi(v) - return nil +// This shows the information about the authentication services implemented +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServices struct { + // This shows the information related to IDV supported services + Idv *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdv `json:"idv,omitempty"` + + // This shows the information related to the manual POI checks + Manual *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManual `json:"manual,omitempty"` + + // This shows the information related to Onfido supported services + Onfido *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfido `json:"onfido,omitempty"` } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl int +// This shows the information related to IDV supported services +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdv struct { + // This is the epoch of the document expiry date. + ExpiryDate *int `json:"expiry_date,omitempty"` -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl = []interface{}{ - 0, - 1, + // Show the last IDV reported reasons for the rejected cases + LastRejected []string `json:"last_rejected,omitempty"` + + // Indicate if the verification report was returned by the provider + ReportAvailable *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable `json:"report_available,omitempty"` + + // Shows the latest document properties detected and reported by IDVS + ReportedProperties GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportedProperties `json:"reported_properties,omitempty"` + + // This represents the status of the latest IDV check. + Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus `json:"status,omitempty"` + + // This shows the number of IDV submissions left for the client + SubmissionsLeft *int `json:"submissions_left,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl(v) - return nil +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable int + +// Shows the latest document properties detected and reported by IDVS +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportedProperties map[string]interface{} + +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus string + +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "expired" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "none" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "pending" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "rejected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "verified" + +// This shows the information related to the manual POI checks +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManual struct { + // This represents the status of the current manual POI check. + Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus `json:"status,omitempty"` } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom int +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus string -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom = []interface{}{ - 0, - 1, +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "expired" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "none" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "pending" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "rejected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "suspected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "verified" + +// This shows the information related to Onfido supported services +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfido struct { + // 3 letter country code for Onfide SDK + CountryCode *string `json:"country_code,omitempty"` + + // This shows the list of documents types supported by Onfido + Documents []string `json:"documents,omitempty"` + + // This shows the list of documents types supported. + DocumentsSupported []string `json:"documents_supported,omitempty"` + + // This shows the information if the country is supported by Onfido + IsCountrySupported *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported `json:"is_country_supported,omitempty"` + + // Show the last Onfido reported reasons for the rejected cases + LastRejected []string `json:"last_rejected,omitempty"` + + // Shows the latest document properties detected and reported by Onfido + ReportedProperties GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoReportedProperties `json:"reported_properties,omitempty"` + + // This represents the status of the latest Onfido check. + Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus `json:"status,omitempty"` + + // This shows the number of Onfido submissions left for the client + SubmissionsLeft *int `json:"submissions_left,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom(v) - return nil +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported int + +// Shows the latest document properties detected and reported by Onfido +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoReportedProperties map[string]interface{} + +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus string + +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "expired" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "none" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "pending" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "rejected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "suspected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "verified" + +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus string + +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "expired" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "none" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "pending" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "rejected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "suspected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "verified" + +// The authentication status for source of income document. +type GetAccountStatusRespGetAccountStatusAuthenticationIncome struct { + // Epoch of the source of income document expiry date. + ExpiryDate *int `json:"expiry_date,omitempty"` + + // Current status of the proof of income document submitted for authentication. + Status *GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus `json:"status,omitempty"` } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan int +type GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus string -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan = []interface{}{ - 0, - 1, +const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusLocked GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "locked" +const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "none" +const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "pending" +const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "rejected" +const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "verified" + +// The current state of the proof of ownership. +type GetAccountStatusRespGetAccountStatusAuthenticationOwnership struct { + // The list of proof of ownership requests to fullfil + Requests []GetAccountStatusRespGetAccountStatusAuthenticationOwnershipRequestsElem `json:"requests,omitempty"` + + // This represents the current status of the proof of ownership + Status *GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus `json:"status,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan(v) - return nil +type GetAccountStatusRespGetAccountStatusAuthenticationOwnershipRequestsElem struct { + // The request timestamp of creation + CreationTime *string `json:"creation_time,omitempty"` + + // Number of documents required to be uploaded for proof of ownership + DocumentsRequired *float64 `json:"documents_required,omitempty"` + + // The identifier of the proof of ownership request + Id *float64 `json:"id,omitempty"` + + // The display name of the payment method being requested + PaymentMethod *string `json:"payment_method,omitempty"` } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta int +type GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus string + +const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusNone GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "none" +const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusPending GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "pending" +const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "rejected" +const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "verified" + +// Provides cashier details for client currency. +type GetAccountStatusRespGetAccountStatusCurrencyConfig map[string]interface{} + +type GetAccountStatusRespGetAccountStatusP2PPoaRequired int + +type GetAccountStatusRespGetAccountStatusP2PStatus string +const GetAccountStatusRespGetAccountStatusP2PStatusActive GetAccountStatusRespGetAccountStatusP2PStatus = "active" +const GetAccountStatusRespGetAccountStatusP2PStatusNone GetAccountStatusRespGetAccountStatusP2PStatus = "none" +const GetAccountStatusRespGetAccountStatusP2PStatusPermBan GetAccountStatusRespGetAccountStatusP2PStatus = "perm_ban" +const GetAccountStatusRespGetAccountStatusP2PStatusTempBan GetAccountStatusRespGetAccountStatusP2PStatus = "temp_ban" + +type GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate int + +type GetAccountStatusRespGetAccountStatusSocialIdentityProvider string + +const GetAccountStatusRespGetAccountStatusSocialIdentityProviderApple GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "apple" +const GetAccountStatusRespGetAccountStatusSocialIdentityProviderFacebook GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "facebook" +const GetAccountStatusRespGetAccountStatusSocialIdentityProviderGoogle GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "google" + +type GetAccountStatusRespMsgType string + +const GetAccountStatusRespMsgTypeGetAccountStatus GetAccountStatusRespMsgType = "get_account_status" + +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus = []interface{}{ + "verified", + "rejected", + "pending", + "expired", + "none", +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = []interface{}{ + "none", + "pending", + "rejected", + "verified", + "expired", + "suspected", +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan = []interface{}{ + 0, + 1, +} var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta = []interface{}{ 0, 1, } +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual = []interface{}{ + 0, + 1, +} +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual(v) return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest int - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported(v) return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa int - -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual int - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi(v) return nil } -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest(v) return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg int - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg = []interface{}{ - 0, - 1, +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = []interface{}{ + "none", + "pending", + "rejected", + "verified", } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg) UnmarshalJSON(b []byte) error { - var v int +func (j *GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus(v) return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu int - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu(v) - return nil -} - -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual int - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual = []interface{}{ - 0, - 1, + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta(v) return nil } -// The authentication status for identity. -type GetAccountStatusRespGetAccountStatusAuthenticationIdentity struct { - // This is the epoch of the document expiry date. - ExpiryDate *int `json:"expiry_date,omitempty"` - - // This shows the information about the authentication services implemented - Services *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServices `json:"services,omitempty"` - - // This represent the current status for proof of identity document submitted for - // authentication. - Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus `json:"status,omitempty"` -} - -// This shows the information about the authentication services implemented -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServices struct { - // This shows the information related to IDV supported services - Idv *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdv `json:"idv,omitempty"` - - // This shows the information related to the manual POI checks - Manual *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManual `json:"manual,omitempty"` - - // This shows the information related to Onfido supported services - Onfido *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfido `json:"onfido,omitempty"` -} - -// This shows the information related to IDV supported services -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdv struct { - // This is the epoch of the document expiry date. - ExpiryDate *int `json:"expiry_date,omitempty"` - - // Show the last IDV reported reasons for the rejected cases - LastRejected []string `json:"last_rejected,omitempty"` - - // Indicate if the verification report was returned by the provider - ReportAvailable *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable `json:"report_available,omitempty"` - - // Shows the latest document properties detected and reported by IDVS - ReportedProperties GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportedProperties `json:"reported_properties,omitempty"` - - // This represents the status of the latest IDV check. - Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus `json:"status,omitempty"` - - // This shows the number of IDV submissions left for the client - SubmissionsLeft *int `json:"submissions_left,omitempty"` -} - -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable int - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable = []interface{}{ - 0, - 1, +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = []interface{}{ + "none", + "pending", + "rejected", + "verified", + "expired", + "suspected", } // UnmarshalJSON implements json.Unmarshaler. @@ -687,67 +717,46 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvRe return nil } -// Shows the latest document properties detected and reported by IDVS -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportedProperties map[string]interface{} - -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus string - -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "expired" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "verified" - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", +var enumValues_GetAccountStatusRespMsgType = []interface{}{ + "get_account_status", } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus(v) return nil } -// This shows the information related to the manual POI checks -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManual struct { - // This represents the status of the current manual POI check. - Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus `json:"status,omitempty"` -} - -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus string - -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "expired" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "suspected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "verified" - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", - "suspected", +// UnmarshalJSON implements json.Unmarshaler. +func (j *GetAccountStatusRespGetAccountStatusAuthentication) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["needs_verification"]; !ok || v == nil { + return fmt.Errorf("field needs_verification in GetAccountStatusRespGetAccountStatusAuthentication: required") + } + type Plain GetAccountStatusRespGetAccountStatusAuthentication + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = GetAccountStatusRespGetAccountStatusAuthentication(plain) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -770,156 +779,90 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManua return nil } -// This shows the information related to Onfido supported services -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfido struct { - // 3 letter country code for Onfide SDK - CountryCode *string `json:"country_code,omitempty"` - - // This shows the list of documents types supported by Onfido - Documents []string `json:"documents,omitempty"` - - // This shows the list of documents types supported. - DocumentsSupported []string `json:"documents_supported,omitempty"` - - // This shows the information if the country is supported by Onfido - IsCountrySupported *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported `json:"is_country_supported,omitempty"` - - // Show the last Onfido reported reasons for the rejected cases - LastRejected []string `json:"last_rejected,omitempty"` - - // Shows the latest document properties detected and reported by Onfido - ReportedProperties GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoReportedProperties `json:"reported_properties,omitempty"` - - // This represents the status of the latest Onfido check. - Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus `json:"status,omitempty"` - - // This shows the number of Onfido submissions left for the client - SubmissionsLeft *int `json:"submissions_left,omitempty"` +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = []interface{}{ + "none", + "pending", + "rejected", + "verified", + "expired", + "suspected", } - -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported int - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported = []interface{}{ - 1, +var enumValues_GetAccountStatusRespGetAccountStatusP2PPoaRequired = []interface{}{ 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusP2PPoaRequired) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusP2PPoaRequired { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusP2PPoaRequired, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported(v) + *j = GetAccountStatusRespGetAccountStatusP2PPoaRequired(v) return nil } -// Shows the latest document properties detected and reported by Onfido -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoReportedProperties map[string]interface{} - -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus string - -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "expired" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "suspected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "verified" - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", - "suspected", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus) UnmarshalJSON(b []byte) error { - var v string +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan(v) return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus string - -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "expired" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "suspected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "verified" - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = []interface{}{ +var enumValues_GetAccountStatusRespGetAccountStatusP2PStatus = []interface{}{ "none", - "pending", - "rejected", - "verified", - "expired", - "suspected", + "active", + "temp_ban", + "perm_ban", } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusP2PStatus) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusP2PStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusP2PStatus, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus(v) + *j = GetAccountStatusRespGetAccountStatusP2PStatus(v) return nil } -// The authentication status for source of income document. -type GetAccountStatusRespGetAccountStatusAuthenticationIncome struct { - // Epoch of the source of income document expiry date. - ExpiryDate *int `json:"expiry_date,omitempty"` - - // Current status of the proof of income document submitted for authentication. - Status *GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus `json:"status,omitempty"` +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported = []interface{}{ + 1, + 0, } - -type GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus string - -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusLocked GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "locked" -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "verified" - var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = []interface{}{ "none", "pending", @@ -929,220 +872,201 @@ var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus(v) return nil } -// The current state of the proof of ownership. -type GetAccountStatusRespGetAccountStatusAuthenticationOwnership struct { - // The list of proof of ownership requests to fullfil - Requests []GetAccountStatusRespGetAccountStatusAuthenticationOwnershipRequestsElem `json:"requests,omitempty"` - - // This represents the current status of the proof of ownership - Status *GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus `json:"status,omitempty"` -} - -type GetAccountStatusRespGetAccountStatusAuthenticationOwnershipRequestsElem struct { - // The request timestamp of creation - CreationTime *string `json:"creation_time,omitempty"` - - // Number of documents required to be uploaded for proof of ownership - DocumentsRequired *float64 `json:"documents_required,omitempty"` - - // The identifier of the proof of ownership request - Id *float64 `json:"id,omitempty"` - - // The display name of the payment method being requested - PaymentMethod *string `json:"payment_method,omitempty"` -} - -type GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus string - -const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusNone GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusPending GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "verified" - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = []interface{}{ +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = []interface{}{ "none", "pending", "rejected", "verified", + "expired", } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus(v) return nil } +var enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate = []interface{}{ + 1, + 0, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthentication) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - if _, ok := raw["needs_verification"]; raw != nil && !ok { - return fmt.Errorf("field needs_verification in GetAccountStatusRespGetAccountStatusAuthentication: required") + var ok bool + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain GetAccountStatusRespGetAccountStatusAuthentication - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate, v) } - *j = GetAccountStatusRespGetAccountStatusAuthentication(plain) + *j = GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate(v) return nil } -// Provides cashier details for client currency. -type GetAccountStatusRespGetAccountStatusCurrencyConfig map[string]interface{} - -type GetAccountStatusRespGetAccountStatusP2PPoaRequired int - -var enumValues_GetAccountStatusRespGetAccountStatusP2PPoaRequired = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusP2PPoaRequired) UnmarshalJSON(b []byte) error { - var v int +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusP2PPoaRequired { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusP2PPoaRequired, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus, v) } - *j = GetAccountStatusRespGetAccountStatusP2PPoaRequired(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus(v) return nil } -type GetAccountStatusRespGetAccountStatusP2PStatus string - -const GetAccountStatusRespGetAccountStatusP2PStatusActive GetAccountStatusRespGetAccountStatusP2PStatus = "active" -const GetAccountStatusRespGetAccountStatusP2PStatusNone GetAccountStatusRespGetAccountStatusP2PStatus = "none" -const GetAccountStatusRespGetAccountStatusP2PStatusPermBan GetAccountStatusRespGetAccountStatusP2PStatus = "perm_ban" -const GetAccountStatusRespGetAccountStatusP2PStatusTempBan GetAccountStatusRespGetAccountStatusP2PStatus = "temp_ban" - -var enumValues_GetAccountStatusRespGetAccountStatusP2PStatus = []interface{}{ - "none", - "active", - "temp_ban", - "perm_ban", +var enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider = []interface{}{ + "google", + "facebook", + "apple", } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusP2PStatus) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusSocialIdentityProvider) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusP2PStatus { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusP2PStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider, v) } - *j = GetAccountStatusRespGetAccountStatusP2PStatus(v) + *j = GetAccountStatusRespGetAccountStatusSocialIdentityProvider(v) return nil } -type GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate int - -var enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate = []interface{}{ - 1, - 0, +// UnmarshalJSON implements json.Unmarshaler. +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu, v) + } + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa, v) } - *j = GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa(v) return nil } -type GetAccountStatusRespGetAccountStatusSocialIdentityProvider string - -const GetAccountStatusRespGetAccountStatusSocialIdentityProviderApple GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "apple" -const GetAccountStatusRespGetAccountStatusSocialIdentityProviderFacebook GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "facebook" -const GetAccountStatusRespGetAccountStatusSocialIdentityProviderGoogle GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "google" - -var enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider = []interface{}{ - "google", - "facebook", - "apple", +// UnmarshalJSON implements json.Unmarshaler. +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual, v) + } + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusSocialIdentityProvider) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus, v) } - *j = GetAccountStatusRespGetAccountStatusSocialIdentityProvider(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus(v) return nil } @@ -1152,22 +1076,22 @@ func (j *GetAccountStatusRespGetAccountStatus) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["currency_config"]; raw != nil && !ok { + if v, ok := raw["currency_config"]; !ok || v == nil { return fmt.Errorf("field currency_config in GetAccountStatusRespGetAccountStatus: required") } - if _, ok := raw["p2p_poa_required"]; raw != nil && !ok { + if v, ok := raw["p2p_poa_required"]; !ok || v == nil { return fmt.Errorf("field p2p_poa_required in GetAccountStatusRespGetAccountStatus: required") } - if _, ok := raw["p2p_status"]; raw != nil && !ok { + if v, ok := raw["p2p_status"]; !ok || v == nil { return fmt.Errorf("field p2p_status in GetAccountStatusRespGetAccountStatus: required") } - if _, ok := raw["prompt_client_to_authenticate"]; raw != nil && !ok { + if v, ok := raw["prompt_client_to_authenticate"]; !ok || v == nil { return fmt.Errorf("field prompt_client_to_authenticate in GetAccountStatusRespGetAccountStatus: required") } - if _, ok := raw["risk_classification"]; raw != nil && !ok { + if v, ok := raw["risk_classification"]; !ok || v == nil { return fmt.Errorf("field risk_classification in GetAccountStatusRespGetAccountStatus: required") } - if _, ok := raw["status"]; raw != nil && !ok { + if v, ok := raw["status"]; !ok || v == nil { return fmt.Errorf("field status in GetAccountStatusRespGetAccountStatus: required") } type Plain GetAccountStatusRespGetAccountStatus @@ -1179,12 +1103,44 @@ func (j *GetAccountStatusRespGetAccountStatus) UnmarshalJSON(b []byte) error { return nil } -type GetAccountStatusRespMsgType string - -const GetAccountStatusRespMsgTypeGetAccountStatus GetAccountStatusRespMsgType = "get_account_status" +// UnmarshalJSON implements json.Unmarshaler. +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg, v) + } + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg(v) + return nil +} -var enumValues_GetAccountStatusRespMsgType = []interface{}{ - "get_account_status", +// UnmarshalJSON implements json.Unmarshaler. +func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus, v) + } + *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -1207,16 +1163,45 @@ func (j *GetAccountStatusRespMsgType) UnmarshalJSON(b []byte) error { return nil } +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = []interface{}{ + "none", + "pending", + "rejected", + "verified", + "expired", + "suspected", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom, v) + } + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in GetAccountStatusResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in GetAccountStatusResp: required") } type Plain GetAccountStatusResp diff --git a/schema/get_financial_assessment.go b/schema/get_financial_assessment.go index 227bdf5..57e3e4d 100644 --- a/schema/get_financial_assessment.go +++ b/schema/get_financial_assessment.go @@ -6,25 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// This call gets the financial assessment details. The 'financial assessment' is a -// questionnaire that clients of certain Landing Companies need to complete, due to -// regulatory and KYC (know your client) requirements. -type GetFinancialAssessment struct { - // Must be `1` - GetFinancialAssessment GetFinancialAssessmentGetFinancialAssessment `json:"get_financial_assessment"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough GetFinancialAssessmentPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type GetFinancialAssessmentGetFinancialAssessment int var enumValues_GetFinancialAssessmentGetFinancialAssessment = []interface{}{ @@ -51,6 +32,25 @@ func (j *GetFinancialAssessmentGetFinancialAssessment) UnmarshalJSON(b []byte) e return nil } +// This call gets the financial assessment details. The 'financial assessment' is a +// questionnaire that clients of certain Landing Companies need to complete, due to +// regulatory and KYC (know your client) requirements. +type GetFinancialAssessment struct { + // Must be `1` + GetFinancialAssessment GetFinancialAssessmentGetFinancialAssessment `json:"get_financial_assessment"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough GetFinancialAssessmentPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type GetFinancialAssessmentPassthrough map[string]interface{} @@ -61,7 +61,7 @@ func (j *GetFinancialAssessment) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["get_financial_assessment"]; raw != nil && !ok { + if v, ok := raw["get_financial_assessment"]; !ok || v == nil { return fmt.Errorf("field get_financial_assessment in GetFinancialAssessment: required") } type Plain GetFinancialAssessment diff --git a/schema/get_financial_assessment_resp.go b/schema/get_financial_assessment_resp.go index 9b9894e..97b733d 100644 --- a/schema/get_financial_assessment_resp.go +++ b/schema/get_financial_assessment_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// This call gets the financial assessment details of client's account. -type GetFinancialAssessmentResp struct { - // Echo of the request made. - EchoReq GetFinancialAssessmentRespEchoReq `json:"echo_req"` - - // Client's financial assessment details - GetFinancialAssessment *GetFinancialAssessmentRespGetFinancialAssessment `json:"get_financial_assessment,omitempty"` - - // Action name of the request made. - MsgType GetFinancialAssessmentRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type GetFinancialAssessmentRespEchoReq map[string]interface{} @@ -150,8 +134,6 @@ type GetFinancialAssessmentRespGetFinancialAssessment struct { type GetFinancialAssessmentRespMsgType string -const GetFinancialAssessmentRespMsgTypeGetFinancialAssessment GetFinancialAssessmentRespMsgType = "get_financial_assessment" - var enumValues_GetFinancialAssessmentRespMsgType = []interface{}{ "get_financial_assessment", } @@ -176,16 +158,34 @@ func (j *GetFinancialAssessmentRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// This call gets the financial assessment details of client's account. +type GetFinancialAssessmentResp struct { + // Echo of the request made. + EchoReq GetFinancialAssessmentRespEchoReq `json:"echo_req"` + + // Client's financial assessment details + GetFinancialAssessment *GetFinancialAssessmentRespGetFinancialAssessment `json:"get_financial_assessment,omitempty"` + + // Action name of the request made. + MsgType GetFinancialAssessmentRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const GetFinancialAssessmentRespMsgTypeGetFinancialAssessment GetFinancialAssessmentRespMsgType = "get_financial_assessment" + // UnmarshalJSON implements json.Unmarshaler. func (j *GetFinancialAssessmentResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in GetFinancialAssessmentResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in GetFinancialAssessmentResp: required") } type Plain GetFinancialAssessmentResp diff --git a/schema/get_limits.go b/schema/get_limits.go index 1b98d9f..5a57b25 100644 --- a/schema/get_limits.go +++ b/schema/get_limits.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Trading and Withdrawal Limits for a given user -type GetLimits struct { - // Must be `1` - GetLimits GetLimitsGetLimits `json:"get_limits"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough GetLimitsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type GetLimitsGetLimits int var enumValues_GetLimitsGetLimits = []interface{}{ @@ -49,6 +32,23 @@ func (j *GetLimitsGetLimits) UnmarshalJSON(b []byte) error { return nil } +// Trading and Withdrawal Limits for a given user +type GetLimits struct { + // Must be `1` + GetLimits GetLimitsGetLimits `json:"get_limits"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough GetLimitsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type GetLimitsPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *GetLimits) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["get_limits"]; raw != nil && !ok { + if v, ok := raw["get_limits"]; !ok || v == nil { return fmt.Errorf("field get_limits in GetLimits: required") } type Plain GetLimits diff --git a/schema/get_limits_resp.go b/schema/get_limits_resp.go index 0b27988..083f4f2 100644 --- a/schema/get_limits_resp.go +++ b/schema/get_limits_resp.go @@ -150,10 +150,6 @@ type GetLimitsRespGetLimitsPayoutPerSymbolNonAtm struct { MoreThanSevenDays *float64 `json:"more_than_seven_days,omitempty"` } -type GetLimitsRespMsgType string - -const GetLimitsRespMsgTypeGetLimits GetLimitsRespMsgType = "get_limits" - var enumValues_GetLimitsRespMsgType = []interface{}{ "get_limits", } @@ -178,16 +174,20 @@ func (j *GetLimitsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +type GetLimitsRespMsgType string + +const GetLimitsRespMsgTypeGetLimits GetLimitsRespMsgType = "get_limits" + // UnmarshalJSON implements json.Unmarshaler. func (j *GetLimitsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in GetLimitsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in GetLimitsResp: required") } type Plain GetLimitsResp diff --git a/schema/get_self_exclusion.go b/schema/get_self_exclusion.go index 73bae9f..0753812 100644 --- a/schema/get_self_exclusion.go +++ b/schema/get_self_exclusion.go @@ -6,25 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Allows users to exclude themselves from the website for certain periods of time, -// or to set limits on their trading activities. This facility is a regulatory -// requirement for certain Landing Companies. -type GetSelfExclusion struct { - // Must be `1` - GetSelfExclusion GetSelfExclusionGetSelfExclusion `json:"get_self_exclusion"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough GetSelfExclusionPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type GetSelfExclusionGetSelfExclusion int var enumValues_GetSelfExclusionGetSelfExclusion = []interface{}{ @@ -51,6 +32,25 @@ func (j *GetSelfExclusionGetSelfExclusion) UnmarshalJSON(b []byte) error { return nil } +// Allows users to exclude themselves from the website for certain periods of time, +// or to set limits on their trading activities. This facility is a regulatory +// requirement for certain Landing Companies. +type GetSelfExclusion struct { + // Must be `1` + GetSelfExclusion GetSelfExclusionGetSelfExclusion `json:"get_self_exclusion"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough GetSelfExclusionPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type GetSelfExclusionPassthrough map[string]interface{} @@ -61,7 +61,7 @@ func (j *GetSelfExclusion) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["get_self_exclusion"]; raw != nil && !ok { + if v, ok := raw["get_self_exclusion"]; !ok || v == nil { return fmt.Errorf("field get_self_exclusion in GetSelfExclusion: required") } type Plain GetSelfExclusion diff --git a/schema/get_self_exclusion_resp.go b/schema/get_self_exclusion_resp.go index c517542..e098d4c 100644 --- a/schema/get_self_exclusion_resp.go +++ b/schema/get_self_exclusion_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with User Self-Exclusion -type GetSelfExclusionResp struct { - // Echo of the request made. - EchoReq GetSelfExclusionRespEchoReq `json:"echo_req"` - - // List of values set for self exclusion. - GetSelfExclusion *GetSelfExclusionRespGetSelfExclusion `json:"get_self_exclusion,omitempty"` - - // Action name of the request made. - MsgType GetSelfExclusionRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type GetSelfExclusionRespEchoReq map[string]interface{} @@ -75,8 +59,6 @@ type GetSelfExclusionRespGetSelfExclusion struct { type GetSelfExclusionRespMsgType string -const GetSelfExclusionRespMsgTypeGetSelfExclusion GetSelfExclusionRespMsgType = "get_self_exclusion" - var enumValues_GetSelfExclusionRespMsgType = []interface{}{ "get_self_exclusion", } @@ -101,16 +83,34 @@ func (j *GetSelfExclusionRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with User Self-Exclusion +type GetSelfExclusionResp struct { + // Echo of the request made. + EchoReq GetSelfExclusionRespEchoReq `json:"echo_req"` + + // List of values set for self exclusion. + GetSelfExclusion *GetSelfExclusionRespGetSelfExclusion `json:"get_self_exclusion,omitempty"` + + // Action name of the request made. + MsgType GetSelfExclusionRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const GetSelfExclusionRespMsgTypeGetSelfExclusion GetSelfExclusionRespMsgType = "get_self_exclusion" + // UnmarshalJSON implements json.Unmarshaler. func (j *GetSelfExclusionResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in GetSelfExclusionResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in GetSelfExclusionResp: required") } type Plain GetSelfExclusionResp diff --git a/schema/get_settings.go b/schema/get_settings.go index 313c18c..c6fcc73 100644 --- a/schema/get_settings.go +++ b/schema/get_settings.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get User Settings (email, date of birth, address etc) -type GetSettings struct { - // Must be `1` - GetSettings GetSettingsGetSettings `json:"get_settings"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough GetSettingsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type GetSettingsGetSettings int var enumValues_GetSettingsGetSettings = []interface{}{ @@ -49,6 +32,23 @@ func (j *GetSettingsGetSettings) UnmarshalJSON(b []byte) error { return nil } +// Get User Settings (email, date of birth, address etc) +type GetSettings struct { + // Must be `1` + GetSettings GetSettingsGetSettings `json:"get_settings"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough GetSettingsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type GetSettingsPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *GetSettings) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["get_settings"]; raw != nil && !ok { + if v, ok := raw["get_settings"]; !ok || v == nil { return fmt.Errorf("field get_settings in GetSettings: required") } type Plain GetSettings diff --git a/schema/get_settings_resp.go b/schema/get_settings_resp.go index ea869de..4eebd6a 100644 --- a/schema/get_settings_resp.go +++ b/schema/get_settings_resp.go @@ -152,134 +152,175 @@ type GetSettingsRespGetSettings struct { type GetSettingsRespGetSettingsAllowCopiers int +type GetSettingsRespGetSettingsDxtradeUserException int + +type GetSettingsRespGetSettingsEmailConsent int + +type GetSettingsRespGetSettingsEmploymentStatus string + +const GetSettingsRespGetSettingsEmploymentStatusEmployed GetSettingsRespGetSettingsEmploymentStatus = "Employed" +const GetSettingsRespGetSettingsEmploymentStatusPensioner GetSettingsRespGetSettingsEmploymentStatus = "Pensioner" +const GetSettingsRespGetSettingsEmploymentStatusSelfEmployed GetSettingsRespGetSettingsEmploymentStatus = "Self-Employed" +const GetSettingsRespGetSettingsEmploymentStatusStudent GetSettingsRespGetSettingsEmploymentStatus = "Student" +const GetSettingsRespGetSettingsEmploymentStatusUnemployed GetSettingsRespGetSettingsEmploymentStatus = "Unemployed" + +// Contains features that are enabled or disabled for this user +type GetSettingsRespGetSettingsFeatureFlag struct { + // Boolean value 1 or 0 indicating whether his feature this enabled or not + Wallet *GetSettingsRespGetSettingsFeatureFlagWallet `json:"wallet,omitempty"` +} + +type GetSettingsRespGetSettingsFeatureFlagWallet int + +type GetSettingsRespGetSettingsHasSecretAnswer int + +type GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent int + +type GetSettingsRespGetSettingsNonPepDeclaration int + +// The status of the Phone Number Verification. +type GetSettingsRespGetSettingsPhoneNumberVerification struct { + // A list of available carriers (if empty assume Phone Number Verification is not + // available at the moment) + Carriers []interface{} `json:"carriers,omitempty"` + + // (Optional) Indicates the timestamp for the next verification attempt + NextAttempt *int `json:"next_attempt,omitempty"` + + // (Optional) Indicates the timestamp for the next email verification attempt + NextEmailAttempt *int `json:"next_email_attempt,omitempty"` + + // (Optional) Indicates the timestamp for the next verify attempt + NextVerifyAttempt *int `json:"next_verify_attempt,omitempty"` + + // Indicates the verification status of the client's phone number. + Verified GetSettingsRespGetSettingsPhoneNumberVerificationVerified `json:"verified"` +} + +type GetSettingsRespGetSettingsPhoneNumberVerificationVerified int + +type GetSettingsRespGetSettingsRequestProfessionalStatus int + +type GetSettingsRespMsgType string + +const GetSettingsRespMsgTypeGetSettings GetSettingsRespMsgType = "get_settings" + var enumValues_GetSettingsRespGetSettingsAllowCopiers = []interface{}{ 0, 1, } +var enumValues_GetSettingsRespGetSettingsDxtradeUserException = []interface{}{ + 0, + 1, +} +var enumValues_GetSettingsRespGetSettingsEmailConsent = []interface{}{ + 0, + 1, +} +var enumValues_GetSettingsRespGetSettingsEmploymentStatus = []interface{}{ + "Employed", + "Pensioner", + "Self-Employed", + "Student", + "Unemployed", +} +var enumValues_GetSettingsRespGetSettingsFeatureFlagWallet = []interface{}{ + 0, + 1, +} +var enumValues_GetSettingsRespGetSettingsHasSecretAnswer = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsAllowCopiers) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *GetSettingsResp) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { return err } - var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsAllowCopiers { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if v, ok := raw["echo_req"]; !ok || v == nil { + return fmt.Errorf("field echo_req in GetSettingsResp: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsAllowCopiers, v) + if v, ok := raw["msg_type"]; !ok || v == nil { + return fmt.Errorf("field msg_type in GetSettingsResp: required") } - *j = GetSettingsRespGetSettingsAllowCopiers(v) + type Plain GetSettingsResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = GetSettingsResp(plain) return nil } -type GetSettingsRespGetSettingsDxtradeUserException int - -var enumValues_GetSettingsRespGetSettingsDxtradeUserException = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsDxtradeUserException) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *GetSettingsRespGetSettingsPhoneNumberVerification) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { return err } - var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsDxtradeUserException { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if v, ok := raw["verified"]; !ok || v == nil { + return fmt.Errorf("field verified in GetSettingsRespGetSettingsPhoneNumberVerification: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsDxtradeUserException, v) + type Plain GetSettingsRespGetSettingsPhoneNumberVerification + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err } - *j = GetSettingsRespGetSettingsDxtradeUserException(v) + *j = GetSettingsRespGetSettingsPhoneNumberVerification(plain) return nil } -type GetSettingsRespGetSettingsEmailConsent int - -var enumValues_GetSettingsRespGetSettingsEmailConsent = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsEmailConsent) UnmarshalJSON(b []byte) error { +func (j *GetSettingsRespGetSettingsNonPepDeclaration) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsEmailConsent { + for _, expected := range enumValues_GetSettingsRespGetSettingsNonPepDeclaration { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsEmailConsent, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsNonPepDeclaration, v) } - *j = GetSettingsRespGetSettingsEmailConsent(v) + *j = GetSettingsRespGetSettingsNonPepDeclaration(v) return nil } -type GetSettingsRespGetSettingsEmploymentStatus string - -const GetSettingsRespGetSettingsEmploymentStatusEmployed GetSettingsRespGetSettingsEmploymentStatus = "Employed" -const GetSettingsRespGetSettingsEmploymentStatusPensioner GetSettingsRespGetSettingsEmploymentStatus = "Pensioner" -const GetSettingsRespGetSettingsEmploymentStatusSelfEmployed GetSettingsRespGetSettingsEmploymentStatus = "Self-Employed" -const GetSettingsRespGetSettingsEmploymentStatusStudent GetSettingsRespGetSettingsEmploymentStatus = "Student" -const GetSettingsRespGetSettingsEmploymentStatusUnemployed GetSettingsRespGetSettingsEmploymentStatus = "Unemployed" - -var enumValues_GetSettingsRespGetSettingsEmploymentStatus = []interface{}{ - "Employed", - "Pensioner", - "Self-Employed", - "Student", - "Unemployed", +var enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent = []interface{}{ + 0, + 1, +} +var enumValues_GetSettingsRespGetSettingsPhoneNumberVerificationVerified = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsEmploymentStatus) UnmarshalJSON(b []byte) error { - var v string +func (j *GetSettingsRespGetSettingsPhoneNumberVerificationVerified) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsEmploymentStatus { + for _, expected := range enumValues_GetSettingsRespGetSettingsPhoneNumberVerificationVerified { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsEmploymentStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsPhoneNumberVerificationVerified, v) } - *j = GetSettingsRespGetSettingsEmploymentStatus(v) + *j = GetSettingsRespGetSettingsPhoneNumberVerificationVerified(v) return nil } -// Contains features that are enabled or disabled for this user -type GetSettingsRespGetSettingsFeatureFlag struct { - // Boolean value 1 or 0 indicating whether his feature this enabled or not - Wallet *GetSettingsRespGetSettingsFeatureFlagWallet `json:"wallet,omitempty"` -} - -type GetSettingsRespGetSettingsFeatureFlagWallet int - -var enumValues_GetSettingsRespGetSettingsFeatureFlagWallet = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. func (j *GetSettingsRespGetSettingsFeatureFlagWallet) UnmarshalJSON(b []byte) error { var v int @@ -300,9 +341,7 @@ func (j *GetSettingsRespGetSettingsFeatureFlagWallet) UnmarshalJSON(b []byte) er return nil } -type GetSettingsRespGetSettingsHasSecretAnswer int - -var enumValues_GetSettingsRespGetSettingsHasSecretAnswer = []interface{}{ +var enumValues_GetSettingsRespGetSettingsNonPepDeclaration = []interface{}{ 0, 1, } @@ -327,196 +366,151 @@ func (j *GetSettingsRespGetSettingsHasSecretAnswer) UnmarshalJSON(b []byte) erro return nil } -type GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent int - -var enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent) UnmarshalJSON(b []byte) error { +func (j *GetSettingsRespGetSettingsRequestProfessionalStatus) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent { + for _, expected := range enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus, v) } - *j = GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent(v) + *j = GetSettingsRespGetSettingsRequestProfessionalStatus(v) return nil } -type GetSettingsRespGetSettingsNonPepDeclaration int - -var enumValues_GetSettingsRespGetSettingsNonPepDeclaration = []interface{}{ +var enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsNonPepDeclaration) UnmarshalJSON(b []byte) error { - var v int +func (j *GetSettingsRespGetSettingsEmploymentStatus) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsNonPepDeclaration { + for _, expected := range enumValues_GetSettingsRespGetSettingsEmploymentStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsNonPepDeclaration, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsEmploymentStatus, v) } - *j = GetSettingsRespGetSettingsNonPepDeclaration(v) + *j = GetSettingsRespGetSettingsEmploymentStatus(v) return nil } -// The status of the Phone Number Verification. -type GetSettingsRespGetSettingsPhoneNumberVerification struct { - // A list of available carriers (if empty assume Phone Number Verification is not - // available at the moment) - Carriers []interface{} `json:"carriers,omitempty"` - - // (Optional) Indicates the timestamp for the next verification attempt - NextAttempt *int `json:"next_attempt,omitempty"` - - // (Optional) Indicates the timestamp for the next email verification attempt - NextEmailAttempt *int `json:"next_email_attempt,omitempty"` - - // (Optional) Indicates the timestamp for the next verify attempt - NextVerifyAttempt *int `json:"next_verify_attempt,omitempty"` - - // Indicates the verification status of the client's phone number. - Verified GetSettingsRespGetSettingsPhoneNumberVerificationVerified `json:"verified"` -} - -type GetSettingsRespGetSettingsPhoneNumberVerificationVerified int - -var enumValues_GetSettingsRespGetSettingsPhoneNumberVerificationVerified = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsPhoneNumberVerificationVerified) UnmarshalJSON(b []byte) error { +func (j *GetSettingsRespGetSettingsEmailConsent) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsPhoneNumberVerificationVerified { + for _, expected := range enumValues_GetSettingsRespGetSettingsEmailConsent { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsPhoneNumberVerificationVerified, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsEmailConsent, v) } - *j = GetSettingsRespGetSettingsPhoneNumberVerificationVerified(v) + *j = GetSettingsRespGetSettingsEmailConsent(v) return nil } +var enumValues_GetSettingsRespMsgType = []interface{}{ + "get_settings", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsPhoneNumberVerification) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *GetSettingsRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { return err } - if _, ok := raw["verified"]; raw != nil && !ok { - return fmt.Errorf("field verified in GetSettingsRespGetSettingsPhoneNumberVerification: required") + var ok bool + for _, expected := range enumValues_GetSettingsRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain GetSettingsRespGetSettingsPhoneNumberVerification - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespMsgType, v) } - *j = GetSettingsRespGetSettingsPhoneNumberVerification(plain) + *j = GetSettingsRespMsgType(v) return nil } -type GetSettingsRespGetSettingsRequestProfessionalStatus int - -var enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsRequestProfessionalStatus) UnmarshalJSON(b []byte) error { +func (j *GetSettingsRespGetSettingsDxtradeUserException) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus { + for _, expected := range enumValues_GetSettingsRespGetSettingsDxtradeUserException { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsDxtradeUserException, v) } - *j = GetSettingsRespGetSettingsRequestProfessionalStatus(v) + *j = GetSettingsRespGetSettingsDxtradeUserException(v) return nil } -type GetSettingsRespMsgType string - -const GetSettingsRespMsgTypeGetSettings GetSettingsRespMsgType = "get_settings" - -var enumValues_GetSettingsRespMsgType = []interface{}{ - "get_settings", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespMsgType) UnmarshalJSON(b []byte) error { - var v string +func (j *GetSettingsRespGetSettingsAllowCopiers) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetSettingsRespMsgType { + for _, expected := range enumValues_GetSettingsRespGetSettingsAllowCopiers { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsAllowCopiers, v) } - *j = GetSettingsRespMsgType(v) + *j = GetSettingsRespGetSettingsAllowCopiers(v) return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsResp) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { - return fmt.Errorf("field echo_req in GetSettingsResp: required") - } - if _, ok := raw["msg_type"]; raw != nil && !ok { - return fmt.Errorf("field msg_type in GetSettingsResp: required") + var ok bool + for _, expected := range enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain GetSettingsResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent, v) } - *j = GetSettingsResp(plain) + *j = GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent(v) return nil } diff --git a/schema/identity_verification_document_add.go b/schema/identity_verification_document_add.go index d3c6c5c..8dc3fe5 100644 --- a/schema/identity_verification_document_add.go +++ b/schema/identity_verification_document_add.go @@ -6,6 +6,32 @@ import "encoding/json" import "fmt" import "reflect" +type IdentityVerificationDocumentAddIdentityVerificationDocumentAdd int + +var enumValues_IdentityVerificationDocumentAddIdentityVerificationDocumentAdd = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *IdentityVerificationDocumentAddIdentityVerificationDocumentAdd) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_IdentityVerificationDocumentAddIdentityVerificationDocumentAdd { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_IdentityVerificationDocumentAddIdentityVerificationDocumentAdd, v) + } + *j = IdentityVerificationDocumentAddIdentityVerificationDocumentAdd(v) + return nil +} + // Adds document information such as issuing country, id and type for identity // verification processes. type IdentityVerificationDocumentAdd struct { @@ -37,32 +63,6 @@ type IdentityVerificationDocumentAdd struct { ReqId *int `json:"req_id,omitempty"` } -type IdentityVerificationDocumentAddIdentityVerificationDocumentAdd int - -var enumValues_IdentityVerificationDocumentAddIdentityVerificationDocumentAdd = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *IdentityVerificationDocumentAddIdentityVerificationDocumentAdd) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_IdentityVerificationDocumentAddIdentityVerificationDocumentAdd { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_IdentityVerificationDocumentAddIdentityVerificationDocumentAdd, v) - } - *j = IdentityVerificationDocumentAddIdentityVerificationDocumentAdd(v) - return nil -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type IdentityVerificationDocumentAddPassthrough map[string]interface{} @@ -73,16 +73,16 @@ func (j *IdentityVerificationDocumentAdd) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["document_number"]; raw != nil && !ok { + if v, ok := raw["document_number"]; !ok || v == nil { return fmt.Errorf("field document_number in IdentityVerificationDocumentAdd: required") } - if _, ok := raw["document_type"]; raw != nil && !ok { + if v, ok := raw["document_type"]; !ok || v == nil { return fmt.Errorf("field document_type in IdentityVerificationDocumentAdd: required") } - if _, ok := raw["identity_verification_document_add"]; raw != nil && !ok { + if v, ok := raw["identity_verification_document_add"]; !ok || v == nil { return fmt.Errorf("field identity_verification_document_add in IdentityVerificationDocumentAdd: required") } - if _, ok := raw["issuing_country"]; raw != nil && !ok { + if v, ok := raw["issuing_country"]; !ok || v == nil { return fmt.Errorf("field issuing_country in IdentityVerificationDocumentAdd: required") } type Plain IdentityVerificationDocumentAdd diff --git a/schema/identity_verification_document_add_resp.go b/schema/identity_verification_document_add_resp.go index 25a87c6..d5ad45c 100644 --- a/schema/identity_verification_document_add_resp.go +++ b/schema/identity_verification_document_add_resp.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Adds document information such as issuing country, id and type for identity -// verification processes. -type IdentityVerificationDocumentAddResp struct { - // Echo of the request made. - EchoReq IdentityVerificationDocumentAddRespEchoReq `json:"echo_req"` - - // 1 on success - IdentityVerificationDocumentAdd *IdentityVerificationDocumentAddRespIdentityVerificationDocumentAdd `json:"identity_verification_document_add,omitempty"` - - // Action name of the request made. - MsgType IdentityVerificationDocumentAddRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type IdentityVerificationDocumentAddRespEchoReq map[string]interface{} @@ -54,8 +37,6 @@ func (j *IdentityVerificationDocumentAddRespIdentityVerificationDocumentAdd) Unm type IdentityVerificationDocumentAddRespMsgType string -const IdentityVerificationDocumentAddRespMsgTypeIdentityVerificationDocumentAdd IdentityVerificationDocumentAddRespMsgType = "identity_verification_document_add" - var enumValues_IdentityVerificationDocumentAddRespMsgType = []interface{}{ "identity_verification_document_add", } @@ -80,16 +61,35 @@ func (j *IdentityVerificationDocumentAddRespMsgType) UnmarshalJSON(b []byte) err return nil } +// Adds document information such as issuing country, id and type for identity +// verification processes. +type IdentityVerificationDocumentAddResp struct { + // Echo of the request made. + EchoReq IdentityVerificationDocumentAddRespEchoReq `json:"echo_req"` + + // 1 on success + IdentityVerificationDocumentAdd *IdentityVerificationDocumentAddRespIdentityVerificationDocumentAdd `json:"identity_verification_document_add,omitempty"` + + // Action name of the request made. + MsgType IdentityVerificationDocumentAddRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const IdentityVerificationDocumentAddRespMsgTypeIdentityVerificationDocumentAdd IdentityVerificationDocumentAddRespMsgType = "identity_verification_document_add" + // UnmarshalJSON implements json.Unmarshaler. func (j *IdentityVerificationDocumentAddResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in IdentityVerificationDocumentAddResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in IdentityVerificationDocumentAddResp: required") } type Plain IdentityVerificationDocumentAddResp diff --git a/schema/kyc_auth_status.go b/schema/kyc_auth_status.go index 78a597e..4073992 100644 --- a/schema/kyc_auth_status.go +++ b/schema/kyc_auth_status.go @@ -32,30 +32,6 @@ type KycAuthStatus struct { type KycAuthStatusKycAuthStatus int -var enumValues_KycAuthStatusKycAuthStatus = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *KycAuthStatusKycAuthStatus) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_KycAuthStatusKycAuthStatus { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KycAuthStatusKycAuthStatus, v) - } - *j = KycAuthStatusKycAuthStatus(v) - return nil -} - type KycAuthStatusLandingCompaniesElem string const KycAuthStatusLandingCompaniesElemBvi KycAuthStatusLandingCompaniesElem = "bvi" @@ -84,6 +60,26 @@ var enumValues_KycAuthStatusLandingCompaniesElem = []interface{}{ "dsl", } +// UnmarshalJSON implements json.Unmarshaler. +func (j *KycAuthStatusKycAuthStatus) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_KycAuthStatusKycAuthStatus { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_KycAuthStatusKycAuthStatus, v) + } + *j = KycAuthStatusKycAuthStatus(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *KycAuthStatusLandingCompaniesElem) UnmarshalJSON(b []byte) error { var v string @@ -108,13 +104,17 @@ func (j *KycAuthStatusLandingCompaniesElem) UnmarshalJSON(b []byte) error { // the `echo_req` output field. type KycAuthStatusPassthrough map[string]interface{} +var enumValues_KycAuthStatusKycAuthStatus = []interface{}{ + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *KycAuthStatus) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["kyc_auth_status"]; raw != nil && !ok { + if v, ok := raw["kyc_auth_status"]; !ok || v == nil { return fmt.Errorf("field kyc_auth_status in KycAuthStatus: required") } type Plain KycAuthStatus diff --git a/schema/kyc_auth_status_resp.go b/schema/kyc_auth_status_resp.go index d672a94..711cc22 100644 --- a/schema/kyc_auth_status_resp.go +++ b/schema/kyc_auth_status_resp.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// A message with KYC Authentication Status. -type KycAuthStatusResp struct { - // Echo of the request made. - EchoReq KycAuthStatusRespEchoReq `json:"echo_req"` - - // Proof of Identity (POI) and Proof of Address (POA) authentication status - // details. - KycAuthStatus KycAuthStatusRespKycAuthStatus `json:"kyc_auth_status,omitempty"` - - // Action name of the request made. - MsgType KycAuthStatusRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type KycAuthStatusRespEchoReq map[string]interface{} @@ -32,8 +15,6 @@ type KycAuthStatusRespKycAuthStatus map[string]interface{} type KycAuthStatusRespMsgType string -const KycAuthStatusRespMsgTypeKycAuthStatus KycAuthStatusRespMsgType = "kyc_auth_status" - var enumValues_KycAuthStatusRespMsgType = []interface{}{ "kyc_auth_status", } @@ -58,16 +39,35 @@ func (j *KycAuthStatusRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with KYC Authentication Status. +type KycAuthStatusResp struct { + // Echo of the request made. + EchoReq KycAuthStatusRespEchoReq `json:"echo_req"` + + // Proof of Identity (POI) and Proof of Address (POA) authentication status + // details. + KycAuthStatus KycAuthStatusRespKycAuthStatus `json:"kyc_auth_status,omitempty"` + + // Action name of the request made. + MsgType KycAuthStatusRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const KycAuthStatusRespMsgTypeKycAuthStatus KycAuthStatusRespMsgType = "kyc_auth_status" + // UnmarshalJSON implements json.Unmarshaler. func (j *KycAuthStatusResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in KycAuthStatusResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in KycAuthStatusResp: required") } type Plain KycAuthStatusResp diff --git a/schema/landing_company.go b/schema/landing_company.go index 765c88c..1ef28dc 100644 --- a/schema/landing_company.go +++ b/schema/landing_company.go @@ -32,7 +32,7 @@ func (j *LandingCompany) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["landing_company"]; raw != nil && !ok { + if v, ok := raw["landing_company"]; !ok || v == nil { return fmt.Errorf("field landing_company in LandingCompany: required") } type Plain LandingCompany diff --git a/schema/landing_company_details.go b/schema/landing_company_details.go index 8781a37..ab88079 100644 --- a/schema/landing_company_details.go +++ b/schema/landing_company_details.go @@ -40,20 +40,6 @@ const LandingCompanyDetailsLandingCompanyDetailsSvg LandingCompanyDetailsLanding const LandingCompanyDetailsLandingCompanyDetailsVanuatu LandingCompanyDetailsLandingCompanyDetails = "vanuatu" const LandingCompanyDetailsLandingCompanyDetailsVirtual LandingCompanyDetailsLandingCompanyDetails = "virtual" -var enumValues_LandingCompanyDetailsLandingCompanyDetails = []interface{}{ - "iom", - "malta", - "maltainvest", - "svg", - "virtual", - "vanuatu", - "samoa", - "samoa-virtual", - "dsl", - "bvi", - "labuan", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *LandingCompanyDetailsLandingCompanyDetails) UnmarshalJSON(b []byte) error { var v string @@ -78,13 +64,27 @@ func (j *LandingCompanyDetailsLandingCompanyDetails) UnmarshalJSON(b []byte) err // the `echo_req` output field. type LandingCompanyDetailsPassthrough map[string]interface{} +var enumValues_LandingCompanyDetailsLandingCompanyDetails = []interface{}{ + "iom", + "malta", + "maltainvest", + "svg", + "virtual", + "vanuatu", + "samoa", + "samoa-virtual", + "dsl", + "bvi", + "labuan", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *LandingCompanyDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["landing_company_details"]; raw != nil && !ok { + if v, ok := raw["landing_company_details"]; !ok || v == nil { return fmt.Errorf("field landing_company_details in LandingCompanyDetails: required") } type Plain LandingCompanyDetails diff --git a/schema/landing_company_details_resp.go b/schema/landing_company_details_resp.go index 8eb1779..636b201 100644 --- a/schema/landing_company_details_resp.go +++ b/schema/landing_company_details_resp.go @@ -132,31 +132,6 @@ type LandingCompanyDetailsRespLandingCompanyDetailsCurrencyConfigSyntheticIndex type LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck int -var enumValues_LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck, v) - } - *j = LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck(v) - return nil -} - // Legal requirements for the given Landing Company. type LandingCompanyDetailsRespLandingCompanyDetailsRequirements struct { // After first deposit requirements @@ -241,9 +216,27 @@ func (j *LandingCompanyDetailsRespLandingCompanyDetailsTinNotMandatory) Unmarsha return nil } -type LandingCompanyDetailsRespMsgType string +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck, v) + } + *j = LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck(v) + return nil +} -const LandingCompanyDetailsRespMsgTypeLandingCompanyDetails LandingCompanyDetailsRespMsgType = "landing_company_details" +type LandingCompanyDetailsRespMsgType string var enumValues_LandingCompanyDetailsRespMsgType = []interface{}{ "landing_company_details", @@ -269,16 +262,23 @@ func (j *LandingCompanyDetailsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const LandingCompanyDetailsRespMsgTypeLandingCompanyDetails LandingCompanyDetailsRespMsgType = "landing_company_details" + +var enumValues_LandingCompanyDetailsRespLandingCompanyDetailsHasRealityCheck = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *LandingCompanyDetailsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in LandingCompanyDetailsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in LandingCompanyDetailsResp: required") } type Plain LandingCompanyDetailsResp diff --git a/schema/landing_company_resp.go b/schema/landing_company_resp.go index ae98c73..0ca209c 100644 --- a/schema/landing_company_resp.go +++ b/schema/landing_company_resp.go @@ -6,158 +6,83 @@ import "encoding/json" import "fmt" import "reflect" -// After first deposit requirements -type AfterFirstDepositRequirements struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type ComplianceRequirements struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} - -type LandingCompanyInfo struct { - // Landing Company address - Address []string `json:"address,omitempty"` - - // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyInfoChangeableFields `json:"changeable_fields,omitempty"` - - // Landing Company country of incorporation - Country *string `json:"country,omitempty"` - - // The configuration of each currency. - CurrencyConfig LandingCompanyInfoCurrencyConfig `json:"currency_config,omitempty"` - - // Flag to indicate whether reality check is applicable for this Landing Company. - // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives - // a summary of the client's trades and account balances on a regular basis - // throughout his session, and is a regulatory requirement for certain Landing - // Companies. - HasRealityCheck *LandingCompanyInfoHasRealityCheck `json:"has_reality_check,omitempty"` - - // Allowed contract types - LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - - // Allowable currencies - LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - - // Allowable markets - LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` - - // Default account currency - LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` - - // Landing Company legal name - Name *string `json:"name,omitempty"` - - // Legal requirements for the Landing Company - Requirements *LegalRequirements `json:"requirements,omitempty"` - - // Landing Company short code - Shortcode *string `json:"shortcode,omitempty"` - - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyInfoSupportProfessionalClient `json:"support_professional_client,omitempty"` - - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyInfoTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Special conditions for changing sensitive fields -type LandingCompanyInfoChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyInfoCurrencyConfig map[string]interface{} - -type LandingCompanyInfoHasRealityCheck int - -var enumValues_LandingCompanyInfoHasRealityCheck = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyInfoHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyInfoHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyInfoHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory, v) } - *j = LandingCompanyInfoHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory(v) return nil } -type LandingCompanyInfoSupportProfessionalClient int - -var enumValues_LandingCompanyInfoSupportProfessionalClient = []interface{}{ - 0, - 1, +// Available DerivEZ accounts. +type LandingCompanyRespLandingCompanyDerivez struct { + // DerivEZ all account types (Synthetic Indices and Financials). + All *LandingCompanyRespLandingCompanyDerivezAll `json:"all,omitempty"` } +// Special conditions for changing sensitive fields +type LandingCompanyInfoChangeableFields map[string]interface{} + +// The configuration of each currency. +type LandingCompanyInfoCurrencyConfig map[string]interface{} + +type LandingCompanyInfoHasRealityCheck int + // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyInfoSupportProfessionalClient) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *LandingCompanyResp) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { return err } - var ok bool - for _, expected := range enumValues_LandingCompanyInfoSupportProfessionalClient { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if v, ok := raw["echo_req"]; !ok || v == nil { + return fmt.Errorf("field echo_req in LandingCompanyResp: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyInfoSupportProfessionalClient, v) + if v, ok := raw["msg_type"]; !ok || v == nil { + return fmt.Errorf("field msg_type in LandingCompanyResp: required") } - *j = LandingCompanyInfoSupportProfessionalClient(v) + type Plain LandingCompanyResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = LandingCompanyResp(plain) return nil } -type LandingCompanyInfoTinNotMandatory int - -var enumValues_LandingCompanyInfoTinNotMandatory = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyInfoTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyInfoHasRealityCheck) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyInfoTinNotMandatory { + for _, expected := range enumValues_LandingCompanyInfoHasRealityCheck { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyInfoTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyInfoHasRealityCheck, v) } - *j = LandingCompanyInfoTinNotMandatory(v) + *j = LandingCompanyInfoHasRealityCheck(v) return nil } +type LandingCompanyInfoSupportProfessionalClient int + // Returns the Landing Company for clients of a given country. type LandingCompanyResp struct { // Echo of the request made. @@ -174,8 +99,25 @@ type LandingCompanyResp struct { ReqId *int `json:"req_id,omitempty"` } -// Echo of the request made. -type LandingCompanyRespEchoReq map[string]interface{} +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespMsgType, v) + } + *j = LandingCompanyRespMsgType(v) + return nil +} // Landing Company type LandingCompanyRespLandingCompany struct { @@ -270,176 +212,107 @@ type LandingCompanyRespLandingCompany struct { VirtualCompany *string `json:"virtual_company,omitempty"` } -type LandingCompanyRespLandingCompanyAddressParseable int - -var enumValues_LandingCompanyRespLandingCompanyAddressParseable = []interface{}{ - 1, - 0, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyAddressParseable) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyUkgcFundsProtection) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyAddressParseable { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyUkgcFundsProtection { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyAddressParseable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyUkgcFundsProtection, v) } - *j = LandingCompanyRespLandingCompanyAddressParseable(v) + *j = LandingCompanyRespLandingCompanyUkgcFundsProtection(v) return nil } -type LandingCompanyRespLandingCompanyAllCompany string - -const LandingCompanyRespLandingCompanyAllCompanyNone LandingCompanyRespLandingCompanyAllCompany = "none" -const LandingCompanyRespLandingCompanyAllCompanySvg LandingCompanyRespLandingCompanyAllCompany = "svg" - -var enumValues_LandingCompanyRespLandingCompanyAllCompany = []interface{}{ - "svg", - "none", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyAllCompany) UnmarshalJSON(b []byte) error { - var v string +func (j *LandingCompanyInfoSupportProfessionalClient) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyAllCompany { + for _, expected := range enumValues_LandingCompanyInfoSupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyAllCompany, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyInfoSupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyAllCompany(v) + *j = LandingCompanyInfoSupportProfessionalClient(v) return nil } -// Config structure with document types ,taxRequired ,tin format details. -type LandingCompanyRespLandingCompanyConfig map[string]interface{} - -// Available CTrader accounts. -type LandingCompanyRespLandingCompanyCtrader struct { - // CTrader all account types (Synthetic Indices and Financials). - All *LandingCompanyRespLandingCompanyCtraderAll `json:"all,omitempty"` -} - -// CTrader all account types (Synthetic Indices and Financials). -type LandingCompanyRespLandingCompanyCtraderAll struct { - // For standard client - Standard *LandingCompanyRespLandingCompanyCtraderAllStandard `json:"standard,omitempty"` -} - -type LandingCompanyRespLandingCompanyCtraderAllStandard string - -const LandingCompanyRespLandingCompanyCtraderAllStandardNone LandingCompanyRespLandingCompanyCtraderAllStandard = "none" -const LandingCompanyRespLandingCompanyCtraderAllStandardSvg LandingCompanyRespLandingCompanyCtraderAllStandard = "svg" - -var enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard = []interface{}{ - "svg", - "none", -} +type LandingCompanyInfoTinNotMandatory int // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyCtraderAllStandard) UnmarshalJSON(b []byte) error { - var v string +func (j *LandingCompanyRespLandingCompanySkipDepositVerification) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard { + for _, expected := range enumValues_LandingCompanyRespLandingCompanySkipDepositVerification { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanySkipDepositVerification, v) } - *j = LandingCompanyRespLandingCompanyCtraderAllStandard(v) + *j = LandingCompanyRespLandingCompanySkipDepositVerification(v) return nil } -// Available DerivEZ accounts. -type LandingCompanyRespLandingCompanyDerivez struct { - // DerivEZ all account types (Synthetic Indices and Financials). - All *LandingCompanyRespLandingCompanyDerivezAll `json:"all,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyInfoTinNotMandatory) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyInfoTinNotMandatory { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyInfoTinNotMandatory, v) + } + *j = LandingCompanyInfoTinNotMandatory(v) + return nil } -// DerivEZ all account types (Synthetic Indices and Financials). -type LandingCompanyRespLandingCompanyDerivezAll struct { - // For standard client - Standard *LandingCompanyRespLandingCompanyDerivezAllStandard `json:"standard,omitempty"` -} - -type LandingCompanyRespLandingCompanyDerivezAllStandard string - -const LandingCompanyRespLandingCompanyDerivezAllStandardNone LandingCompanyRespLandingCompanyDerivezAllStandard = "none" -const LandingCompanyRespLandingCompanyDerivezAllStandardSvg LandingCompanyRespLandingCompanyDerivezAllStandard = "svg" - -var enumValues_LandingCompanyRespLandingCompanyDerivezAllStandard = []interface{}{ - "svg", - "none", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDerivezAllStandard) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDerivezAllStandard { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDerivezAllStandard, v) - } - *j = LandingCompanyRespLandingCompanyDerivezAllStandard(v) - return nil -} - -// Available Deriv X all account types (Synthetic Indices and Financials). -type LandingCompanyRespLandingCompanyDxtradeAllCompany struct { - // Landing Company details. - Standard *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard `json:"standard,omitempty"` -} - -// Landing Company details. -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard struct { +type LandingCompanyInfo struct { // Landing Company address Address []string `json:"address,omitempty"` // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` + ChangeableFields LandingCompanyInfoChangeableFields `json:"changeable_fields,omitempty"` // Landing Company country of incorporation Country *string `json:"country,omitempty"` // The configuration of each currency. - CurrencyConfig LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardCurrencyConfig `json:"currency_config,omitempty"` + CurrencyConfig LandingCompanyInfoCurrencyConfig `json:"currency_config,omitempty"` // Flag to indicate whether reality check is applicable for this Landing Company. // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives // a summary of the client's trades and account balances on a regular basis // throughout his session, and is a regulatory requirement for certain Landing // Companies. - HasRealityCheck *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` + HasRealityCheck *LandingCompanyInfoHasRealityCheck `json:"has_reality_check,omitempty"` // Allowed contract types LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` @@ -457,826 +330,472 @@ type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard struct { Name *string `json:"name,omitempty"` // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirements `json:"requirements,omitempty"` + Requirements *LegalRequirements `json:"requirements,omitempty"` // Landing Company short code Shortcode *string `json:"shortcode,omitempty"` // Flag that indicates whether the landing company supports professional accounts // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` + SupportProfessionalClient *LandingCompanyInfoSupportProfessionalClient `json:"support_professional_client,omitempty"` // Flag that indicates whether tax identifier number is not mandatory for the // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` + TinNotMandatory *LandingCompanyInfoTinNotMandatory `json:"tin_not_mandatory,omitempty"` } -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck int +// Echo of the request made. +type LandingCompanyRespEchoReq map[string]interface{} -var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck = []interface{}{ - 0, - 1, -} +type LandingCompanyRespLandingCompanyAddressParseable int // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified, v) } - *j = LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified(v) return nil } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -// After first deposit requirements -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} - -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient int - -var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyAddressParseable) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyAddressParseable { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyAddressParseable, v) } - *j = LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient(v) + *j = LandingCompanyRespLandingCompanyAddressParseable(v) return nil } -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory int - -var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyRequirePoi) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyRequirePoi { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequirePoi, v) } - *j = LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory(v) + *j = LandingCompanyRespLandingCompanyRequirePoi(v) return nil } -// Available Deriv X financial account types (all except Synthetic Indices). -type LandingCompanyRespLandingCompanyDxtradeFinancialCompany struct { - // Landing Company details. - Standard *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard `json:"standard,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic, v) + } + *j = LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic(v) + return nil } -// Landing Company details. -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard struct { - // Landing Company address - Address []string `json:"address,omitempty"` - - // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` - - // Landing Company country of incorporation - Country *string `json:"country,omitempty"` - - // The configuration of each currency. - CurrencyConfig LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardCurrencyConfig `json:"currency_config,omitempty"` - - // Flag to indicate whether reality check is applicable for this Landing Company. - // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives - // a summary of the client's trades and account balances on a regular basis - // throughout his session, and is a regulatory requirement for certain Landing - // Companies. - HasRealityCheck *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` - - // Allowed contract types - LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - - // Allowable currencies - LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - - // Allowable markets - LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` - - // Default account currency - LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` - - // Landing Company legal name - Name *string `json:"name,omitempty"` - - // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirements `json:"requirements,omitempty"` - - // Landing Company short code - Shortcode *string `json:"shortcode,omitempty"` - - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` - - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyAllCompany) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyAllCompany { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyAllCompany, v) + } + *j = LandingCompanyRespLandingCompanyAllCompany(v) + return nil } -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardCurrencyConfig map[string]interface{} +const LandingCompanyRespLandingCompanyAllCompanyNone LandingCompanyRespLandingCompanyAllCompany = "none" +const LandingCompanyRespLandingCompanyAllCompanySvg LandingCompanyRespLandingCompanyAllCompany = "svg" -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck int +// Config structure with document types ,taxRequired ,tin format details. +type LandingCompanyRespLandingCompanyConfig map[string]interface{} -var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck = []interface{}{ - 0, - 1, -} +type LandingCompanyRespLandingCompanyCtraderAllStandard string // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyRequireAddressPostcode) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode, v) } - *j = LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyRequireAddressPostcode(v) return nil } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyCtraderAllStandard) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard, v) + } + *j = LandingCompanyRespLandingCompanyCtraderAllStandard(v) + return nil } -// After first deposit requirements -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` +// CTrader all account types (Synthetic Indices and Financials). +type LandingCompanyRespLandingCompanyCtraderAll struct { + // For standard client + Standard *LandingCompanyRespLandingCompanyCtraderAllStandard `json:"standard,omitempty"` } -// Compliance requirements -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` +// Available CTrader accounts. +type LandingCompanyRespLandingCompanyCtrader struct { + // CTrader all account types (Synthetic Indices and Financials). + All *LandingCompanyRespLandingCompanyCtraderAll `json:"all,omitempty"` } -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient int - -var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient = []interface{}{ - 0, - 1, -} +const LandingCompanyRespLandingCompanyCtraderAllStandardNone LandingCompanyRespLandingCompanyCtraderAllStandard = "none" +const LandingCompanyRespLandingCompanyCtraderAllStandardSvg LandingCompanyRespLandingCompanyCtraderAllStandard = "svg" // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyNoProvince) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyNoProvince { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyNoProvince, v) } - *j = LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient(v) + *j = LandingCompanyRespLandingCompanyNoProvince(v) return nil } -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory int - -var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit, v) } - *j = LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory(v) + *j = LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit(v) return nil } -// Available Deriv X derived account types (Synthetic Indices). -type LandingCompanyRespLandingCompanyDxtradeGamingCompany struct { - // Landing Company details. - Standard *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandard `json:"standard,omitempty"` -} - -// Landing Company details. -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandard struct { - // Landing Company address - Address []string `json:"address,omitempty"` - - // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` - - // Landing Company country of incorporation - Country *string `json:"country,omitempty"` - - // The configuration of each currency. - CurrencyConfig LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardCurrencyConfig `json:"currency_config,omitempty"` - - // Flag to indicate whether reality check is applicable for this Landing Company. - // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives - // a summary of the client's trades and account balances on a regular basis - // throughout his session, and is a regulatory requirement for certain Landing - // Companies. - HasRealityCheck *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` - - // Allowed contract types - LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - - // Allowable currencies - LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - - // Allowable markets - LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` - - // Default account currency - LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` - - // Landing Company legal name - Name *string `json:"name,omitempty"` - - // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirements `json:"requirements,omitempty"` - - // Landing Company short code - Shortcode *string `json:"shortcode,omitempty"` - - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` - - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck int - -var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck = []interface{}{ - 0, - 1, +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyDerivezAllStandard) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDerivezAllStandard { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDerivezAllStandard, v) + } + *j = LandingCompanyRespLandingCompanyDerivezAllStandard(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory, v) } - *j = LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory(v) return nil } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -// After first deposit requirements -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} - -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient int - -var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient(v) + *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient(v) return nil } -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory int - -var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory = []interface{}{ - 0, - 1, +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck, v) + } + *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory, v) } - *j = LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory(v) + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory(v) return nil } -// Landing Company for financial contracts (all except Synthetic Indices) -type LandingCompanyRespLandingCompanyFinancialCompany struct { - // Landing Company address - Address []string `json:"address,omitempty"` - - // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyFinancialCompanyChangeableFields `json:"changeable_fields,omitempty"` - - // Landing Company country of incorporation - Country *string `json:"country,omitempty"` - - // The configuration of each currency. - CurrencyConfig LandingCompanyRespLandingCompanyFinancialCompanyCurrencyConfig `json:"currency_config,omitempty"` - - // Flag to indicate whether reality check is applicable for this Landing Company. - // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives - // a summary of the client's trades and account balances on a regular basis - // throughout his session, and is a regulatory requirement for certain Landing - // Companies. - HasRealityCheck *LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck `json:"has_reality_check,omitempty"` - - // Allowed contract types for this Landing Company - LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - - // Allowed account currencies for this Landing Company - LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - - // Allowed markets for this Landing Company - LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` - - // Default account currency - LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` - - // Landing Company legal name - Name *string `json:"name,omitempty"` - - // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyFinancialCompanyRequirements `json:"requirements,omitempty"` - - // Landing Company short code - Shortcode *string `json:"shortcode,omitempty"` - - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient `json:"support_professional_client,omitempty"` - - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyFinancialCompanyChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyFinancialCompanyCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck int - -var enumValues_LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck = []interface{}{ - 1, - 0, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient(v) return nil } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyFinancialCompanyRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyFinancialCompanyRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyFinancialCompanyRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -// After first deposit requirements -type LandingCompanyRespLandingCompanyFinancialCompanyRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type LandingCompanyRespLandingCompanyFinancialCompanyRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} - -type LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient int - -var enumValues_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck, v) } - *j = LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient(v) + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck(v) return nil } -type LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory int - -var enumValues_LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory = []interface{}{ - 0, - 1, +// After first deposit requirements +type AfterFirstDepositRequirements struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` } // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory, v) } - *j = LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory(v) + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory(v) return nil } -// Landing Company for derived contracts (Synthetic Indices) -type LandingCompanyRespLandingCompanyGamingCompany struct { - // Landing Company address - Address []string `json:"address,omitempty"` - - // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyGamingCompanyChangeableFields `json:"changeable_fields,omitempty"` - - // Landing Company country of incorporation - Country *string `json:"country,omitempty"` - - // The configuration of each currency. - CurrencyConfig LandingCompanyRespLandingCompanyGamingCompanyCurrencyConfig `json:"currency_config,omitempty"` - - // Flag to indicate whether reality check is applicable for this Landing Company. - // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives - // a summary of the client's trades and account balances on a regular basis - // throughout his session, and is a regulatory requirement for certain Landing - // Companies. - HasRealityCheck *LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck `json:"has_reality_check,omitempty"` - - // Allowed contract types - LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - - // Allowable currencies - LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - - // Allowable markets - LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` - - // Default account currency - LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` - - // Landing Company legal name - Name *string `json:"name,omitempty"` - - // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyGamingCompanyRequirements `json:"requirements,omitempty"` - - // Landing Company short code - Shortcode *string `json:"shortcode,omitempty"` - - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient `json:"support_professional_client,omitempty"` - - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyGamingCompanyChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyGamingCompanyCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck int - -var enumValues_LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck, v) } - *j = LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck(v) return nil } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyGamingCompanyRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyGamingCompanyRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyGamingCompanyRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -// After first deposit requirements -type LandingCompanyRespLandingCompanyGamingCompanyRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type LandingCompanyRespLandingCompanyGamingCompanyRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} - -type LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient int - -var enumValues_LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient(v) + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient(v) return nil } -type LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory int - -var enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck, v) } - *j = LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory(v) + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck(v) return nil } -type LandingCompanyRespLandingCompanyIsIdvSupported int - -var enumValues_LandingCompanyRespLandingCompanyIsIdvSupported = []interface{}{ - 1, - 0, +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyMt5AgeVerification) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMt5AgeVerification { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMt5AgeVerification, v) + } + *j = LandingCompanyRespLandingCompanyMt5AgeVerification(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -1299,858 +818,1299 @@ func (j *LandingCompanyRespLandingCompanyIsIdvSupported) UnmarshalJSON(b []byte) return nil } -type LandingCompanyRespLandingCompanyMt5AgeVerification int - -var enumValues_LandingCompanyRespLandingCompanyMt5AgeVerification = []interface{}{ - 1, - 0, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMt5AgeVerification) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMt5AgeVerification { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMt5AgeVerification, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory, v) } - *j = LandingCompanyRespLandingCompanyMt5AgeVerification(v) + *j = LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory(v) return nil } -// Landing Company for MT5 standard combined all Synthetic and financial, currently -// has Financial as subtype. -type LandingCompanyRespLandingCompanyMtAllCompany struct { - // Landing Company for MT5 combined all Synthetic and financial - SwapFree *LandingCompanyInfo `json:"swap_free,omitempty"` - - // Contain details for landing company for zero_spread sub account type. - ZeroSpread *LandingCompanyInfo `json:"zero_spread,omitempty"` -} - -// Landing Company for MT5 financial contracts (all except Synthetic Indices), -// currently divided into Financial STP, Financial (standard) as subtypes. -type LandingCompanyRespLandingCompanyMtFinancialCompany struct { - // Contain details for landing company for financial subtype. The Financial - // account is suitable for a wide range of traders, both new and experienced. It - // gives you mid-range leverage and variable spreads that give you a great deal of - // flexibility for whatever position you wish to take in the market. - Financial *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancial `json:"financial,omitempty"` - - // Contain details for landing company for Financial STP subtype. The Financial - // STP account provides you with tight spreads, higher ticket size and offers a - // variety of FX pairs from majors to exotics. It is a straight through processing - // (STP) account with direct access to FX liquidity from various providers. - FinancialStp *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStp `json:"financial_stp,omitempty"` -} - -// Contain details for landing company for financial subtype. The Financial account -// is suitable for a wide range of traders, both new and experienced. It gives you -// mid-range leverage and variable spreads that give you a great deal of -// flexibility for whatever position you wish to take in the market. -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancial struct { - // Landing Company address - Address []string `json:"address,omitempty"` - - // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialChangeableFields `json:"changeable_fields,omitempty"` - - // Landing Company country of incorporation - Country *string `json:"country,omitempty"` - - // The configuration of each currency. - CurrencyConfig LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialCurrencyConfig `json:"currency_config,omitempty"` - - // Flag to indicate whether reality check is applicable for this Landing Company. - // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives - // a summary of the client's trades and account balances on a regular basis - // throughout his session, and is a regulatory requirement for certain Landing - // Companies. - HasRealityCheck *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck `json:"has_reality_check,omitempty"` - - // Allowed contract types for this Landing Company - LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - - // Allowed account currencies for this Landing Company - LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - - // Allowed markets for this Landing Company - LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` - - // Default account currency - LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` - - // Landing Company legal name - Name *string `json:"name,omitempty"` - - // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirements `json:"requirements,omitempty"` - - // Landing Company short code - Shortcode *string `json:"shortcode,omitempty"` - - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient `json:"support_professional_client,omitempty"` - - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck int - -var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient(v) return nil } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -// After first deposit requirements -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} - -// Contain details for landing company for Financial STP subtype. The Financial STP -// account provides you with tight spreads, higher ticket size and offers a variety -// of FX pairs from majors to exotics. It is a straight through processing (STP) -// account with direct access to FX liquidity from various providers. -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStp struct { - // Landing Company address - Address []string `json:"address,omitempty"` - - // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpChangeableFields `json:"changeable_fields,omitempty"` - - // Landing Company country of incorporation - Country *string `json:"country,omitempty"` - - // The configuration of each currency. - CurrencyConfig LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpCurrencyConfig `json:"currency_config,omitempty"` - - // Flag to indicate whether reality check is applicable for this Landing Company. - // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives - // a summary of the client's trades and account balances on a regular basis - // throughout his session, and is a regulatory requirement for certain Landing - // Companies. - HasRealityCheck *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck `json:"has_reality_check,omitempty"` - - // Allowed contract types for this Landing Company - LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - - // Allowed account currencies for this Landing Company - LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - - // Allowed markets for this Landing Company - LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` - - // Default account currency - LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` - - // Landing Company legal name - Name *string `json:"name,omitempty"` - - // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirements `json:"requirements,omitempty"` - - // Landing Company short code - Shortcode *string `json:"shortcode,omitempty"` - - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient `json:"support_professional_client,omitempty"` - - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck int - -var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient(v) return nil } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -// After first deposit requirements -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} - -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient int - -var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck, v) } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient(v) + *j = LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck(v) return nil } -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory int - -var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory, v) } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory(v) + *j = LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory(v) return nil } -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient int +type LandingCompanyRespLandingCompanyAllCompany string -var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient = []interface{}{ - 0, - 1, +// Compliance requirements +type ComplianceRequirements struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` } // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient(v) + *j = LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient(v) return nil } -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory int - -var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck, v) } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory(v) + *j = LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck(v) return nil } -// Landing Company for MT5 standard derived contracts (Synthetic Indices), -// currently has Financial as subtype. -type LandingCompanyRespLandingCompanyMtGamingCompany struct { - // Landing Company for MT5 derived contracts (Synthetic Indices) - Financial *LandingCompanyRespLandingCompanyMtGamingCompanyFinancial `json:"financial,omitempty"` -} - -// Landing Company for MT5 derived contracts (Synthetic Indices) -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancial struct { - // Landing Company address - Address []string `json:"address,omitempty"` - - // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyMtGamingCompanyFinancialChangeableFields `json:"changeable_fields,omitempty"` - - // Landing Company country of incorporation - Country *string `json:"country,omitempty"` - - // The configuration of each currency. - CurrencyConfig LandingCompanyRespLandingCompanyMtGamingCompanyFinancialCurrencyConfig `json:"currency_config,omitempty"` - - // Flag to indicate whether reality check is applicable for this Landing Company. - // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives - // a summary of the client's trades and account balances on a regular basis - // throughout his session, and is a regulatory requirement for certain Landing - // Companies. - HasRealityCheck *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck `json:"has_reality_check,omitempty"` - - // Allowed contract types - LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - - // Allowable currencies - LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - - // Allowable markets - LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` - - // Default account currency - LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` - - // Landing Company legal name - Name *string `json:"name,omitempty"` - - // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirements `json:"requirements,omitempty"` - - // Landing Company short code - Shortcode *string `json:"shortcode,omitempty"` - - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient `json:"support_professional_client,omitempty"` - - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialChangeableFields map[string]interface{} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck int - -var enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory, v) } - *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory(v) return nil } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -// After first deposit requirements -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` - - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} - -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient int - -var enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient(v) + *j = LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient(v) return nil } -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory int - -var enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck, v) } - *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory(v) + *j = LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck(v) return nil } -type LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit int - -var enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck, v) } - *j = LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit(v) + *j = LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck(v) return nil } -type LandingCompanyRespLandingCompanyNoProvince int - -var enumValues_LandingCompanyRespLandingCompanyNoProvince = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyNoProvince) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyNoProvince { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyNoProvince, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory, v) } - *j = LandingCompanyRespLandingCompanyNoProvince(v) + *j = LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory(v) return nil } -type LandingCompanyRespLandingCompanyRequireAddressPostcode int - -var enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyRequireAddressPostcode) UnmarshalJSON(b []byte) error { +func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode { + for _, expected := range enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient, v) } - *j = LandingCompanyRespLandingCompanyRequireAddressPostcode(v) + *j = LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient(v) return nil } -type LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic int +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpChangeableFields map[string]interface{} -var enumValues_LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic = []interface{}{ - 0, - 1, -} +type LandingCompanyRespLandingCompanyDerivezAllStandard string -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic, v) - } - *j = LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic(v) - return nil -} +// Legal requirements for the Landing Company +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirements struct { + // After first deposit requirements + AfterFirstDeposit *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` -type LandingCompanyRespLandingCompanyRequirePoi int + // Compliance requirements + Compliance *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsCompliance `json:"compliance,omitempty"` -var enumValues_LandingCompanyRespLandingCompanyRequirePoi = []interface{}{ - 0, - 1, -} + // Sign up requirements + Signup []string `json:"signup,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyRequirePoi) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyRequirePoi { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequirePoi, v) - } - *j = LandingCompanyRespLandingCompanyRequirePoi(v) - return nil + // Withdrawal requirements + Withdrawal []string `json:"withdrawal,omitempty"` } -type LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified int +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory int -var enumValues_LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified = []interface{}{ - 0, - 1, -} +const LandingCompanyRespLandingCompanyDerivezAllStandardSvg LandingCompanyRespLandingCompanyDerivezAllStandard = "svg" -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified, v) - } - *j = LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified(v) - return nil +// Compliance requirements +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` } -type LandingCompanyRespLandingCompanySkipDepositVerification int +// Landing Company details. +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard struct { + // Landing Company address + Address []string `json:"address,omitempty"` -var enumValues_LandingCompanyRespLandingCompanySkipDepositVerification = []interface{}{ - 0, - 1, -} + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanySkipDepositVerification) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanySkipDepositVerification { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanySkipDepositVerification, v) - } - *j = LandingCompanyRespLandingCompanySkipDepositVerification(v) - return nil -} + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` -type LandingCompanyRespLandingCompanyUkgcFundsProtection int + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardCurrencyConfig `json:"currency_config,omitempty"` -var enumValues_LandingCompanyRespLandingCompanyUkgcFundsProtection = []interface{}{ - 0, - 1, -} + // Flag to indicate whether reality check is applicable for this Landing Company. + // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives + // a summary of the client's trades and account balances on a regular basis + // throughout his session, and is a regulatory requirement for certain Landing + // Companies. + HasRealityCheck *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyUkgcFundsProtection) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyUkgcFundsProtection { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyUkgcFundsProtection, v) - } - *j = LandingCompanyRespLandingCompanyUkgcFundsProtection(v) - return nil -} + // Allowed contract types + LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` -type LandingCompanyRespMsgType string + // Allowable currencies + LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` -const LandingCompanyRespMsgTypeLandingCompany LandingCompanyRespMsgType = "landing_company" + // Allowable markets + LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` -var enumValues_LandingCompanyRespMsgType = []interface{}{ - "landing_company", -} + // Default account currency + LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespMsgType, v) - } - *j = LandingCompanyRespMsgType(v) - return nil + // Landing Company legal name + Name *string `json:"name,omitempty"` + + // Legal requirements for the Landing Company + Requirements *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirements `json:"requirements,omitempty"` + + // Landing Company short code + Shortcode *string `json:"shortcode,omitempty"` + + // Flag that indicates whether the landing company supports professional accounts + // or not + SupportProfessionalClient *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` + + // Flag that indicates whether tax identifier number is not mandatory for the + // current country and landing company. + TinNotMandatory *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyResp) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["echo_req"]; raw != nil && !ok { - return fmt.Errorf("field echo_req in LandingCompanyResp: required") - } - if _, ok := raw["msg_type"]; raw != nil && !ok { - return fmt.Errorf("field msg_type in LandingCompanyResp: required") - } - type Plain LandingCompanyResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = LandingCompanyResp(plain) - return nil +// Available Deriv X financial account types (all except Synthetic Indices). +type LandingCompanyRespLandingCompanyDxtradeFinancialCompany struct { + // Landing Company details. + Standard *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard `json:"standard,omitempty"` } // Legal requirements for the Landing Company -type LegalRequirements struct { +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirements struct { // After first deposit requirements - AfterFirstDeposit *AfterFirstDepositRequirements `json:"after_first_deposit,omitempty"` + AfterFirstDeposit *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` // Compliance requirements - Compliance *ComplianceRequirements `json:"compliance,omitempty"` + Compliance *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsCompliance `json:"compliance,omitempty"` // Sign up requirements - Signup SignUpRequirements `json:"signup,omitempty"` + Signup []string `json:"signup,omitempty"` // Withdrawal requirements - Withdrawal WithdrawalRequirements `json:"withdrawal,omitempty"` + Withdrawal []string `json:"withdrawal,omitempty"` } -// Sign up requirements -type SignUpRequirements []string +// The configuration of each currency. +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardCurrencyConfig map[string]interface{} -// Withdrawal requirements -type WithdrawalRequirements []string +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck int + +const LandingCompanyRespLandingCompanyDerivezAllStandardNone LandingCompanyRespLandingCompanyDerivezAllStandard = "none" + +// After first deposit requirements +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} + +// After first deposit requirements +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} + +// Compliance requirements +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` +} + +// Legal requirements for the Landing Company +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirements struct { + // After first deposit requirements + AfterFirstDeposit *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + + // Compliance requirements + Compliance *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirementsCompliance `json:"compliance,omitempty"` + + // Sign up requirements + Signup []string `json:"signup,omitempty"` + + // Withdrawal requirements + Withdrawal []string `json:"withdrawal,omitempty"` +} + +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient int + +// DerivEZ all account types (Synthetic Indices and Financials). +type LandingCompanyRespLandingCompanyDerivezAll struct { + // For standard client + Standard *LandingCompanyRespLandingCompanyDerivezAllStandard `json:"standard,omitempty"` +} + +// Landing Company for MT5 financial contracts (all except Synthetic Indices), +// currently divided into Financial STP, Financial (standard) as subtypes. +type LandingCompanyRespLandingCompanyMtFinancialCompany struct { + // Contain details for landing company for financial subtype. The Financial + // account is suitable for a wide range of traders, both new and experienced. It + // gives you mid-range leverage and variable spreads that give you a great deal of + // flexibility for whatever position you wish to take in the market. + Financial *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancial `json:"financial,omitempty"` + + // Contain details for landing company for Financial STP subtype. The Financial + // STP account provides you with tight spreads, higher ticket size and offers a + // variety of FX pairs from majors to exotics. It is a straight through processing + // (STP) account with direct access to FX liquidity from various providers. + FinancialStp *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStp `json:"financial_stp,omitempty"` +} + +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory int + +// Contain details for landing company for Financial STP subtype. The Financial STP +// account provides you with tight spreads, higher ticket size and offers a variety +// of FX pairs from majors to exotics. It is a straight through processing (STP) +// account with direct access to FX liquidity from various providers. +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStp struct { + // Landing Company address + Address []string `json:"address,omitempty"` + + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpChangeableFields `json:"changeable_fields,omitempty"` + + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` + + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpCurrencyConfig `json:"currency_config,omitempty"` + + // Flag to indicate whether reality check is applicable for this Landing Company. + // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives + // a summary of the client's trades and account balances on a regular basis + // throughout his session, and is a regulatory requirement for certain Landing + // Companies. + HasRealityCheck *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck `json:"has_reality_check,omitempty"` + + // Allowed contract types for this Landing Company + LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` + + // Allowed account currencies for this Landing Company + LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` + + // Allowed markets for this Landing Company + LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` + + // Default account currency + LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` + + // Landing Company legal name + Name *string `json:"name,omitempty"` + + // Legal requirements for the Landing Company + Requirements *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirements `json:"requirements,omitempty"` + + // Landing Company short code + Shortcode *string `json:"shortcode,omitempty"` + + // Flag that indicates whether the landing company supports professional accounts + // or not + SupportProfessionalClient *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient `json:"support_professional_client,omitempty"` + + // Flag that indicates whether tax identifier number is not mandatory for the + // current country and landing company. + TinNotMandatory *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory `json:"tin_not_mandatory,omitempty"` +} + +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck int + +// Landing Company details. +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandard struct { + // Landing Company address + Address []string `json:"address,omitempty"` + + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` + + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` + + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardCurrencyConfig `json:"currency_config,omitempty"` + + // Flag to indicate whether reality check is applicable for this Landing Company. + // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives + // a summary of the client's trades and account balances on a regular basis + // throughout his session, and is a regulatory requirement for certain Landing + // Companies. + HasRealityCheck *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` + + // Allowed contract types + LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` + + // Allowable currencies + LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` + + // Allowable markets + LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` + + // Default account currency + LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` + + // Landing Company legal name + Name *string `json:"name,omitempty"` + + // Legal requirements for the Landing Company + Requirements *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirements `json:"requirements,omitempty"` + + // Landing Company short code + Shortcode *string `json:"shortcode,omitempty"` + + // Flag that indicates whether the landing company supports professional accounts + // or not + SupportProfessionalClient *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` + + // Flag that indicates whether tax identifier number is not mandatory for the + // current country and landing company. + TinNotMandatory *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` +} + +// Available Deriv X derived account types (Synthetic Indices). +type LandingCompanyRespLandingCompanyDxtradeGamingCompany struct { + // Landing Company details. + Standard *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandard `json:"standard,omitempty"` +} + +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyFinancialCompanyChangeableFields map[string]interface{} + +// The configuration of each currency. +type LandingCompanyRespLandingCompanyFinancialCompanyCurrencyConfig map[string]interface{} + +type LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck int + +type LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory int + +// The configuration of each currency. +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardCurrencyConfig map[string]interface{} + +// After first deposit requirements +type LandingCompanyRespLandingCompanyFinancialCompanyRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} + +// Compliance requirements +type LandingCompanyRespLandingCompanyFinancialCompanyRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` +} + +// Legal requirements for the Landing Company +type LandingCompanyRespLandingCompanyFinancialCompanyRequirements struct { + // After first deposit requirements + AfterFirstDeposit *LandingCompanyRespLandingCompanyFinancialCompanyRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + + // Compliance requirements + Compliance *LandingCompanyRespLandingCompanyFinancialCompanyRequirementsCompliance `json:"compliance,omitempty"` + + // Sign up requirements + Signup []string `json:"signup,omitempty"` + + // Withdrawal requirements + Withdrawal []string `json:"withdrawal,omitempty"` +} + +type LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient int + +// Compliance requirements +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` +} + +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardChangeableFields map[string]interface{} + +// Available Deriv X all account types (Synthetic Indices and Financials). +type LandingCompanyRespLandingCompanyDxtradeAllCompany struct { + // Landing Company details. + Standard *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard `json:"standard,omitempty"` +} + +// Landing Company details. +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard struct { + // Landing Company address + Address []string `json:"address,omitempty"` + + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` + + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` + + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardCurrencyConfig `json:"currency_config,omitempty"` + + // Flag to indicate whether reality check is applicable for this Landing Company. + // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives + // a summary of the client's trades and account balances on a regular basis + // throughout his session, and is a regulatory requirement for certain Landing + // Companies. + HasRealityCheck *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` + + // Allowed contract types + LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` + + // Allowable currencies + LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` + + // Allowable markets + LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` + + // Default account currency + LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` + + // Landing Company legal name + Name *string `json:"name,omitempty"` + + // Legal requirements for the Landing Company + Requirements *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirements `json:"requirements,omitempty"` + + // Landing Company short code + Shortcode *string `json:"shortcode,omitempty"` + + // Flag that indicates whether the landing company supports professional accounts + // or not + SupportProfessionalClient *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` + + // Flag that indicates whether tax identifier number is not mandatory for the + // current country and landing company. + TinNotMandatory *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` +} + +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardChangeableFields map[string]interface{} + +// Landing Company for financial contracts (all except Synthetic Indices) +type LandingCompanyRespLandingCompanyFinancialCompany struct { + // Landing Company address + Address []string `json:"address,omitempty"` + + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyFinancialCompanyChangeableFields `json:"changeable_fields,omitempty"` + + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` + + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyFinancialCompanyCurrencyConfig `json:"currency_config,omitempty"` + + // Flag to indicate whether reality check is applicable for this Landing Company. + // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives + // a summary of the client's trades and account balances on a regular basis + // throughout his session, and is a regulatory requirement for certain Landing + // Companies. + HasRealityCheck *LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck `json:"has_reality_check,omitempty"` + + // Allowed contract types for this Landing Company + LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` + + // Allowed account currencies for this Landing Company + LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` + + // Allowed markets for this Landing Company + LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` + + // Default account currency + LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` + + // Landing Company legal name + Name *string `json:"name,omitempty"` + + // Legal requirements for the Landing Company + Requirements *LandingCompanyRespLandingCompanyFinancialCompanyRequirements `json:"requirements,omitempty"` + + // Landing Company short code + Shortcode *string `json:"shortcode,omitempty"` + + // Flag that indicates whether the landing company supports professional accounts + // or not + SupportProfessionalClient *LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient `json:"support_professional_client,omitempty"` + + // Flag that indicates whether tax identifier number is not mandatory for the + // current country and landing company. + TinNotMandatory *LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory `json:"tin_not_mandatory,omitempty"` +} + +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyGamingCompanyChangeableFields map[string]interface{} + +// The configuration of each currency. +type LandingCompanyRespLandingCompanyGamingCompanyCurrencyConfig map[string]interface{} + +type LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck int + +// The configuration of each currency. +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardCurrencyConfig map[string]interface{} + +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck int + +// After first deposit requirements +type LandingCompanyRespLandingCompanyGamingCompanyRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} + +// Compliance requirements +type LandingCompanyRespLandingCompanyGamingCompanyRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` +} + +// Legal requirements for the Landing Company +type LandingCompanyRespLandingCompanyGamingCompanyRequirements struct { + // After first deposit requirements + AfterFirstDeposit *LandingCompanyRespLandingCompanyGamingCompanyRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + + // Compliance requirements + Compliance *LandingCompanyRespLandingCompanyGamingCompanyRequirementsCompliance `json:"compliance,omitempty"` + + // Sign up requirements + Signup []string `json:"signup,omitempty"` + + // Withdrawal requirements + Withdrawal []string `json:"withdrawal,omitempty"` +} + +type LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient int + +// Contain details for landing company for financial subtype. The Financial account +// is suitable for a wide range of traders, both new and experienced. It gives you +// mid-range leverage and variable spreads that give you a great deal of +// flexibility for whatever position you wish to take in the market. +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancial struct { + // Landing Company address + Address []string `json:"address,omitempty"` + + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialChangeableFields `json:"changeable_fields,omitempty"` + + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` + + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialCurrencyConfig `json:"currency_config,omitempty"` + + // Flag to indicate whether reality check is applicable for this Landing Company. + // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives + // a summary of the client's trades and account balances on a regular basis + // throughout his session, and is a regulatory requirement for certain Landing + // Companies. + HasRealityCheck *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck `json:"has_reality_check,omitempty"` + + // Allowed contract types for this Landing Company + LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` + + // Allowed account currencies for this Landing Company + LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` + + // Allowed markets for this Landing Company + LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` + + // Default account currency + LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` + + // Landing Company legal name + Name *string `json:"name,omitempty"` + + // Legal requirements for the Landing Company + Requirements *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirements `json:"requirements,omitempty"` + + // Landing Company short code + Shortcode *string `json:"shortcode,omitempty"` + + // Flag that indicates whether the landing company supports professional accounts + // or not + SupportProfessionalClient *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient `json:"support_professional_client,omitempty"` + + // Flag that indicates whether tax identifier number is not mandatory for the + // current country and landing company. + TinNotMandatory *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory `json:"tin_not_mandatory,omitempty"` +} + +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory int + +type LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory int + +// After first deposit requirements +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} + +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient int + +// Landing Company for derived contracts (Synthetic Indices) +type LandingCompanyRespLandingCompanyGamingCompany struct { + // Landing Company address + Address []string `json:"address,omitempty"` + + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyGamingCompanyChangeableFields `json:"changeable_fields,omitempty"` + + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` + + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyGamingCompanyCurrencyConfig `json:"currency_config,omitempty"` + + // Flag to indicate whether reality check is applicable for this Landing Company. + // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives + // a summary of the client's trades and account balances on a regular basis + // throughout his session, and is a regulatory requirement for certain Landing + // Companies. + HasRealityCheck *LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck `json:"has_reality_check,omitempty"` + + // Allowed contract types + LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` + + // Allowable currencies + LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` + + // Allowable markets + LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` + + // Default account currency + LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` + + // Landing Company legal name + Name *string `json:"name,omitempty"` + + // Legal requirements for the Landing Company + Requirements *LandingCompanyRespLandingCompanyGamingCompanyRequirements `json:"requirements,omitempty"` + + // Landing Company short code + Shortcode *string `json:"shortcode,omitempty"` + + // Flag that indicates whether the landing company supports professional accounts + // or not + SupportProfessionalClient *LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient `json:"support_professional_client,omitempty"` + + // Flag that indicates whether tax identifier number is not mandatory for the + // current country and landing company. + TinNotMandatory *LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory `json:"tin_not_mandatory,omitempty"` +} + +type LandingCompanyRespLandingCompanyIsIdvSupported int + +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardChangeableFields map[string]interface{} + +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient int + +type LandingCompanyRespLandingCompanyMt5AgeVerification int + +// After first deposit requirements +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} + +// Legal requirements for the Landing Company +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirements struct { + // After first deposit requirements + AfterFirstDeposit *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + + // Compliance requirements + Compliance *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsCompliance `json:"compliance,omitempty"` + + // Sign up requirements + Signup []string `json:"signup,omitempty"` + + // Withdrawal requirements + Withdrawal []string `json:"withdrawal,omitempty"` +} + +// Landing Company for MT5 standard combined all Synthetic and financial, currently +// has Financial as subtype. +type LandingCompanyRespLandingCompanyMtAllCompany struct { + // Landing Company for MT5 combined all Synthetic and financial + SwapFree *LandingCompanyInfo `json:"swap_free,omitempty"` + + // Contain details for landing company for zero_spread sub account type. + ZeroSpread *LandingCompanyInfo `json:"zero_spread,omitempty"` +} + +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialChangeableFields map[string]interface{} + +// The configuration of each currency. +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialCurrencyConfig map[string]interface{} + +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck int + +// Compliance requirements +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` +} + +// The configuration of each currency. +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpCurrencyConfig map[string]interface{} + +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck int + +// Legal requirements for the Landing Company +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirements struct { + // After first deposit requirements + AfterFirstDeposit *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + + // Compliance requirements + Compliance *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsCompliance `json:"compliance,omitempty"` + + // Sign up requirements + Signup []string `json:"signup,omitempty"` + + // Withdrawal requirements + Withdrawal []string `json:"withdrawal,omitempty"` +} + +// After first deposit requirements +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} + +// Compliance requirements +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` +} + +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient int + +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory int + +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient int + +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory int + +// Landing Company for MT5 standard derived contracts (Synthetic Indices), +// currently has Financial as subtype. +type LandingCompanyRespLandingCompanyMtGamingCompany struct { + // Landing Company for MT5 derived contracts (Synthetic Indices) + Financial *LandingCompanyRespLandingCompanyMtGamingCompanyFinancial `json:"financial,omitempty"` +} + +// Landing Company for MT5 derived contracts (Synthetic Indices) +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancial struct { + // Landing Company address + Address []string `json:"address,omitempty"` + + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyMtGamingCompanyFinancialChangeableFields `json:"changeable_fields,omitempty"` + + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` + + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyMtGamingCompanyFinancialCurrencyConfig `json:"currency_config,omitempty"` + + // Flag to indicate whether reality check is applicable for this Landing Company. + // `1`: applicable, `0`: not applicable. The Reality Check is a feature that gives + // a summary of the client's trades and account balances on a regular basis + // throughout his session, and is a regulatory requirement for certain Landing + // Companies. + HasRealityCheck *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck `json:"has_reality_check,omitempty"` + + // Allowed contract types + LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` + + // Allowable currencies + LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` + + // Allowable markets + LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` + + // Default account currency + LegalDefaultCurrency *string `json:"legal_default_currency,omitempty"` + + // Landing Company legal name + Name *string `json:"name,omitempty"` + + // Legal requirements for the Landing Company + Requirements *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirements `json:"requirements,omitempty"` + + // Landing Company short code + Shortcode *string `json:"shortcode,omitempty"` + + // Flag that indicates whether the landing company supports professional accounts + // or not + SupportProfessionalClient *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient `json:"support_professional_client,omitempty"` + + // Flag that indicates whether tax identifier number is not mandatory for the + // current country and landing company. + TinNotMandatory *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory `json:"tin_not_mandatory,omitempty"` +} + +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialChangeableFields map[string]interface{} + +// The configuration of each currency. +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialCurrencyConfig map[string]interface{} + +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck int + +// Legal requirements for the Landing Company +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirements struct { + // After first deposit requirements + AfterFirstDeposit *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + + // Compliance requirements + Compliance *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsCompliance `json:"compliance,omitempty"` + + // Sign up requirements + Signup []string `json:"signup,omitempty"` + + // Withdrawal requirements + Withdrawal []string `json:"withdrawal,omitempty"` +} + +// After first deposit requirements +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} + +// Compliance requirements +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` +} + +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient int + +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory int + +type LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit int + +type LandingCompanyRespLandingCompanyNoProvince int + +type LandingCompanyRespLandingCompanyRequireAddressPostcode int + +type LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic int + +type LandingCompanyRespLandingCompanyRequirePoi int + +type LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified int + +type LandingCompanyRespLandingCompanySkipDepositVerification int + +type LandingCompanyRespLandingCompanyUkgcFundsProtection int + +type LandingCompanyRespMsgType string + +const LandingCompanyRespMsgTypeLandingCompany LandingCompanyRespMsgType = "landing_company" + +// Legal requirements for the Landing Company +type LegalRequirements struct { + // After first deposit requirements + AfterFirstDeposit *AfterFirstDepositRequirements `json:"after_first_deposit,omitempty"` + + // Compliance requirements + Compliance *ComplianceRequirements `json:"compliance,omitempty"` + + // Sign up requirements + Signup SignUpRequirements `json:"signup,omitempty"` + + // Withdrawal requirements + Withdrawal WithdrawalRequirements `json:"withdrawal,omitempty"` +} + +// Sign up requirements +type SignUpRequirements []string + +// Withdrawal requirements +type WithdrawalRequirements []string + +var enumValues_LandingCompanyInfoHasRealityCheck = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyInfoSupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyInfoTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyAddressParseable = []interface{}{ + 1, + 0, +} +var enumValues_LandingCompanyRespLandingCompanyAllCompany = []interface{}{ + "svg", + "none", +} +var enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard = []interface{}{ + "svg", + "none", +} +var enumValues_LandingCompanyRespLandingCompanyDerivezAllStandard = []interface{}{ + "svg", + "none", +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck = []interface{}{ + 1, + 0, +} +var enumValues_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyIsIdvSupported = []interface{}{ + 1, + 0, +} +var enumValues_LandingCompanyRespLandingCompanyMt5AgeVerification = []interface{}{ + 1, + 0, +} +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyNoProvince = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyRequirePoi = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanySkipDepositVerification = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespLandingCompanyUkgcFundsProtection = []interface{}{ + 0, + 1, +} +var enumValues_LandingCompanyRespMsgType = []interface{}{ + "landing_company", +} diff --git a/schema/login_history.go b/schema/login_history.go index b5f8aa4..c369680 100644 --- a/schema/login_history.go +++ b/schema/login_history.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieve a summary of login history for user. -type LoginHistory struct { - // [Optional] Apply limit to count of login history records. - Limit int `json:"limit,omitempty"` - - // Must be `1` - LoginHistory LoginHistoryLoginHistory `json:"login_history"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough LoginHistoryPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type LoginHistoryLoginHistory int var enumValues_LoginHistoryLoginHistory = []interface{}{ @@ -52,6 +32,26 @@ func (j *LoginHistoryLoginHistory) UnmarshalJSON(b []byte) error { return nil } +// Retrieve a summary of login history for user. +type LoginHistory struct { + // [Optional] Apply limit to count of login history records. + Limit int `json:"limit,omitempty"` + + // Must be `1` + LoginHistory LoginHistoryLoginHistory `json:"login_history"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough LoginHistoryPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type LoginHistoryPassthrough map[string]interface{} @@ -62,7 +62,7 @@ func (j *LoginHistory) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["login_history"]; raw != nil && !ok { + if v, ok := raw["login_history"]; !ok || v == nil { return fmt.Errorf("field login_history in LoginHistory: required") } type Plain LoginHistory diff --git a/schema/login_history_resp.go b/schema/login_history_resp.go index 558a5da..cd6e49d 100644 --- a/schema/login_history_resp.go +++ b/schema/login_history_resp.go @@ -6,40 +6,9 @@ import "encoding/json" import "fmt" import "reflect" -// Recent login/logout history records -type LoginHistoryResp struct { - // Echo of the request made. - EchoReq LoginHistoryRespEchoReq `json:"echo_req"` - - // Array of records of client login/logout activities - LoginHistory []LoginHistoryRespLoginHistoryElem `json:"login_history,omitempty"` - - // Action name of the request made. - MsgType LoginHistoryRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type LoginHistoryRespEchoReq map[string]interface{} -// User login history -type LoginHistoryRespLoginHistoryElem struct { - // Type of action. - Action string `json:"action"` - - // Provides details about browser, device used during login or logout - Environment string `json:"environment"` - - // Status of activity: 1 - success, 0 - failure - Status LoginHistoryRespLoginHistoryElemStatus `json:"status"` - - // Epoch time of the activity - Time int `json:"time"` -} - type LoginHistoryRespLoginHistoryElemStatus int var enumValues_LoginHistoryRespLoginHistoryElemStatus = []interface{}{ @@ -67,22 +36,37 @@ func (j *LoginHistoryRespLoginHistoryElemStatus) UnmarshalJSON(b []byte) error { return nil } +// User login history +type LoginHistoryRespLoginHistoryElem struct { + // Type of action. + Action string `json:"action"` + + // Provides details about browser, device used during login or logout + Environment string `json:"environment"` + + // Status of activity: 1 - success, 0 - failure + Status LoginHistoryRespLoginHistoryElemStatus `json:"status"` + + // Epoch time of the activity + Time int `json:"time"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *LoginHistoryRespLoginHistoryElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["action"]; raw != nil && !ok { + if v, ok := raw["action"]; !ok || v == nil { return fmt.Errorf("field action in LoginHistoryRespLoginHistoryElem: required") } - if _, ok := raw["environment"]; raw != nil && !ok { + if v, ok := raw["environment"]; !ok || v == nil { return fmt.Errorf("field environment in LoginHistoryRespLoginHistoryElem: required") } - if _, ok := raw["status"]; raw != nil && !ok { + if v, ok := raw["status"]; !ok || v == nil { return fmt.Errorf("field status in LoginHistoryRespLoginHistoryElem: required") } - if _, ok := raw["time"]; raw != nil && !ok { + if v, ok := raw["time"]; !ok || v == nil { return fmt.Errorf("field time in LoginHistoryRespLoginHistoryElem: required") } type Plain LoginHistoryRespLoginHistoryElem @@ -96,8 +80,6 @@ func (j *LoginHistoryRespLoginHistoryElem) UnmarshalJSON(b []byte) error { type LoginHistoryRespMsgType string -const LoginHistoryRespMsgTypeLoginHistory LoginHistoryRespMsgType = "login_history" - var enumValues_LoginHistoryRespMsgType = []interface{}{ "login_history", } @@ -122,16 +104,34 @@ func (j *LoginHistoryRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Recent login/logout history records +type LoginHistoryResp struct { + // Echo of the request made. + EchoReq LoginHistoryRespEchoReq `json:"echo_req"` + + // Array of records of client login/logout activities + LoginHistory []LoginHistoryRespLoginHistoryElem `json:"login_history,omitempty"` + + // Action name of the request made. + MsgType LoginHistoryRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const LoginHistoryRespMsgTypeLoginHistory LoginHistoryRespMsgType = "login_history" + // UnmarshalJSON implements json.Unmarshaler. func (j *LoginHistoryResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in LoginHistoryResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in LoginHistoryResp: required") } type Plain LoginHistoryResp diff --git a/schema/logout.go b/schema/logout.go index 3a6e07d..a878794 100644 --- a/schema/logout.go +++ b/schema/logout.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Logout the session -type Logout struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - Logout LogoutLogout `json:"logout"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough LogoutPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type LogoutLogout int var enumValues_LogoutLogout = []interface{}{ @@ -49,6 +32,23 @@ func (j *LogoutLogout) UnmarshalJSON(b []byte) error { return nil } +// Logout the session +type Logout struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + Logout LogoutLogout `json:"logout"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough LogoutPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type LogoutPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *Logout) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["logout"]; raw != nil && !ok { + if v, ok := raw["logout"]; !ok || v == nil { return fmt.Errorf("field logout in Logout: required") } type Plain Logout diff --git a/schema/logout_resp.go b/schema/logout_resp.go index 51f30bf..409352a 100644 --- a/schema/logout_resp.go +++ b/schema/logout_resp.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// The response of logout request made. -type LogoutResp struct { - // Echo of the request made. - EchoReq LogoutRespEchoReq `json:"echo_req"` - - // The result of logout request which is 1 - Logout *LogoutRespLogout `json:"logout,omitempty"` - - // Action name of the request made. - MsgType LogoutRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type LogoutRespEchoReq map[string]interface{} @@ -53,8 +37,6 @@ func (j *LogoutRespLogout) UnmarshalJSON(b []byte) error { type LogoutRespMsgType string -const LogoutRespMsgTypeLogout LogoutRespMsgType = "logout" - var enumValues_LogoutRespMsgType = []interface{}{ "logout", } @@ -79,16 +61,34 @@ func (j *LogoutRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The response of logout request made. +type LogoutResp struct { + // Echo of the request made. + EchoReq LogoutRespEchoReq `json:"echo_req"` + + // The result of logout request which is 1 + Logout *LogoutRespLogout `json:"logout,omitempty"` + + // Action name of the request made. + MsgType LogoutRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const LogoutRespMsgTypeLogout LogoutRespMsgType = "logout" + // UnmarshalJSON implements json.Unmarshaler. func (j *LogoutResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in LogoutResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in LogoutResp: required") } type Plain LogoutResp diff --git a/schema/mt5_deposit.go b/schema/mt5_deposit.go index d242524..cdc9a6d 100644 --- a/schema/mt5_deposit.go +++ b/schema/mt5_deposit.go @@ -6,6 +6,32 @@ import "encoding/json" import "fmt" import "reflect" +type Mt5DepositMt5Deposit int + +var enumValues_Mt5DepositMt5Deposit = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5DepositMt5Deposit) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5DepositMt5Deposit { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5DepositMt5Deposit, v) + } + *j = Mt5DepositMt5Deposit(v) + return nil +} + // This call allows deposit into MT5 account from Binary account. type Mt5Deposit struct { // Amount to deposit (in the currency of from_binary); min = $1 or an equivalent @@ -33,32 +59,6 @@ type Mt5Deposit struct { ToMt5 string `json:"to_mt5"` } -type Mt5DepositMt5Deposit int - -var enumValues_Mt5DepositMt5Deposit = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5DepositMt5Deposit) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5DepositMt5Deposit { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5DepositMt5Deposit, v) - } - *j = Mt5DepositMt5Deposit(v) - return nil -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type Mt5DepositPassthrough map[string]interface{} @@ -69,10 +69,10 @@ func (j *Mt5Deposit) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["mt5_deposit"]; raw != nil && !ok { + if v, ok := raw["mt5_deposit"]; !ok || v == nil { return fmt.Errorf("field mt5_deposit in Mt5Deposit: required") } - if _, ok := raw["to_mt5"]; raw != nil && !ok { + if v, ok := raw["to_mt5"]; !ok || v == nil { return fmt.Errorf("field to_mt5 in Mt5Deposit: required") } type Plain Mt5Deposit diff --git a/schema/mt5_deposit_resp.go b/schema/mt5_deposit_resp.go index 78e78c9..02081ff 100644 --- a/schema/mt5_deposit_resp.go +++ b/schema/mt5_deposit_resp.go @@ -6,32 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of MT5 deposit request. -type Mt5DepositResp struct { - // Withdrawal reference ID of Binary account - BinaryTransactionId *int `json:"binary_transaction_id,omitempty"` - - // Echo of the request made. - EchoReq Mt5DepositRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType Mt5DepositRespMsgType `json:"msg_type"` - - // 1 on success - Mt5Deposit *int `json:"mt5_deposit,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type Mt5DepositRespEchoReq map[string]interface{} type Mt5DepositRespMsgType string -const Mt5DepositRespMsgTypeMt5Deposit Mt5DepositRespMsgType = "mt5_deposit" - var enumValues_Mt5DepositRespMsgType = []interface{}{ "mt5_deposit", } @@ -56,16 +35,37 @@ func (j *Mt5DepositRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of MT5 deposit request. +type Mt5DepositResp struct { + // Withdrawal reference ID of Binary account + BinaryTransactionId *int `json:"binary_transaction_id,omitempty"` + + // Echo of the request made. + EchoReq Mt5DepositRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType Mt5DepositRespMsgType `json:"msg_type"` + + // 1 on success + Mt5Deposit *int `json:"mt5_deposit,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const Mt5DepositRespMsgTypeMt5Deposit Mt5DepositRespMsgType = "mt5_deposit" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5DepositResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in Mt5DepositResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in Mt5DepositResp: required") } type Plain Mt5DepositResp diff --git a/schema/mt5_get_settings.go b/schema/mt5_get_settings.go index 7d9caae..69d073d 100644 --- a/schema/mt5_get_settings.go +++ b/schema/mt5_get_settings.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get MT5 user account settings -type Mt5GetSettings struct { - // MT5 user login - Login string `json:"login"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - Mt5GetSettings Mt5GetSettingsMt5GetSettings `json:"mt5_get_settings"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough Mt5GetSettingsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type Mt5GetSettingsMt5GetSettings int var enumValues_Mt5GetSettingsMt5GetSettings = []interface{}{ @@ -52,6 +32,26 @@ func (j *Mt5GetSettingsMt5GetSettings) UnmarshalJSON(b []byte) error { return nil } +// Get MT5 user account settings +type Mt5GetSettings struct { + // MT5 user login + Login string `json:"login"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + Mt5GetSettings Mt5GetSettingsMt5GetSettings `json:"mt5_get_settings"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough Mt5GetSettingsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type Mt5GetSettingsPassthrough map[string]interface{} @@ -62,10 +62,10 @@ func (j *Mt5GetSettings) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["login"]; raw != nil && !ok { + if v, ok := raw["login"]; !ok || v == nil { return fmt.Errorf("field login in Mt5GetSettings: required") } - if _, ok := raw["mt5_get_settings"]; raw != nil && !ok { + if v, ok := raw["mt5_get_settings"]; !ok || v == nil { return fmt.Errorf("field mt5_get_settings in Mt5GetSettings: required") } type Plain Mt5GetSettings diff --git a/schema/mt5_get_settings_resp.go b/schema/mt5_get_settings_resp.go index 01630da..b35233f 100644 --- a/schema/mt5_get_settings_resp.go +++ b/schema/mt5_get_settings_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Get MT5 user settings -type Mt5GetSettingsResp struct { - // Echo of the request made. - EchoReq Mt5GetSettingsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType Mt5GetSettingsRespMsgType `json:"msg_type"` - - // MT5 user account details - Mt5GetSettings *Mt5GetSettingsRespMt5GetSettings `json:"mt5_get_settings,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type Mt5GetSettingsRespEchoReq map[string]interface{} type Mt5GetSettingsRespMsgType string -const Mt5GetSettingsRespMsgTypeMt5GetSettings Mt5GetSettingsRespMsgType = "mt5_get_settings" - var enumValues_Mt5GetSettingsRespMsgType = []interface{}{ "mt5_get_settings", } @@ -53,85 +35,10 @@ func (j *Mt5GetSettingsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// MT5 user account details -type Mt5GetSettingsRespMt5GetSettings struct { - // Account type. - AccountType *Mt5GetSettingsRespMt5GetSettingsAccountType `json:"account_type,omitempty"` - - // The address of the user. The maximum length of the address is 128 characters. - Address *string `json:"address,omitempty"` - - // Balance of the Trading account. - Balance *float64 `json:"balance,omitempty"` - - // User's city of residence. - City *string `json:"city,omitempty"` - - // Name of the client's company. The maximum length of the company name is 64 - // characters. - Company *string `json:"company,omitempty"` - - // 2-letter country code. - Country *string `json:"country,omitempty"` - - // MT5 account currency (`USD` or `EUR`) that depends on the MT5 company - // (`vanuatu`, `svg`, `malta`). - Currency *string `json:"currency,omitempty"` - - // Account balance, formatted to appropriate decimal places. - DisplayBalance *string `json:"display_balance,omitempty"` - - // Email address. - Email *string `json:"email,omitempty"` - - // The group where account belongs to. - Group *string `json:"group,omitempty"` - - // Landing company shortcode of the MT5 account. - LandingCompanyShort *Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort `json:"landing_company_short,omitempty"` - - // Client leverage (from 1 to 1000). - Leverage *float64 `json:"leverage,omitempty"` - - // Login ID of the user's MT5 account. - Login *string `json:"login,omitempty"` - - // Market type - MarketType *Mt5GetSettingsRespMt5GetSettingsMarketType `json:"market_type,omitempty"` - - // Client's name. The maximum length of a client's symbol name is 128 characters. - Name *string `json:"name,omitempty"` - - // User's phone number. - Phone *string `json:"phone,omitempty"` - - // The user's phone password. - PhonePassword *string `json:"phonePassword,omitempty"` - - // Trade server name of the MT5 account. - Server *string `json:"server,omitempty"` - - // Trade server information. - ServerInfo *Mt5GetSettingsRespMt5GetSettingsServerInfo `json:"server_info,omitempty"` - - // User's state (region) of residence. - State *string `json:"state,omitempty"` - - // Sub account category. - SubAccountCategory *Mt5GetSettingsRespMt5GetSettingsSubAccountCategory `json:"sub_account_category,omitempty"` - - // Sub account type - SubAccountType *Mt5GetSettingsRespMt5GetSettingsSubAccountType `json:"sub_account_type,omitempty"` - - // User's zip code. - ZipCode *string `json:"zipCode,omitempty"` -} +const Mt5GetSettingsRespMsgTypeMt5GetSettings Mt5GetSettingsRespMsgType = "mt5_get_settings" type Mt5GetSettingsRespMt5GetSettingsAccountType string -const Mt5GetSettingsRespMt5GetSettingsAccountTypeDemo Mt5GetSettingsRespMt5GetSettingsAccountType = "demo" -const Mt5GetSettingsRespMt5GetSettingsAccountTypeReal Mt5GetSettingsRespMt5GetSettingsAccountType = "real" - var enumValues_Mt5GetSettingsRespMt5GetSettingsAccountType = []interface{}{ "demo", "real", @@ -157,15 +64,10 @@ func (j *Mt5GetSettingsRespMt5GetSettingsAccountType) UnmarshalJSON(b []byte) er return nil } -type Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort string +const Mt5GetSettingsRespMt5GetSettingsAccountTypeDemo Mt5GetSettingsRespMt5GetSettingsAccountType = "demo" +const Mt5GetSettingsRespMt5GetSettingsAccountTypeReal Mt5GetSettingsRespMt5GetSettingsAccountType = "real" -const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortBvi Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "bvi" -const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortLabuan Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "labuan" -const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortMalta Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "malta" -const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortMaltainvest Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "maltainvest" -const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortSeychelles Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "seychelles" -const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortSvg Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "svg" -const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortVanuatu Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "vanuatu" +type Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort string var enumValues_Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = []interface{}{ "bvi", @@ -197,11 +99,15 @@ func (j *Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort) UnmarshalJSON(b [] return nil } -type Mt5GetSettingsRespMt5GetSettingsMarketType string +const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortBvi Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "bvi" +const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortLabuan Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "labuan" +const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortMalta Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "malta" +const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortMaltainvest Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "maltainvest" +const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortSeychelles Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "seychelles" +const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortSvg Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "svg" +const Mt5GetSettingsRespMt5GetSettingsLandingCompanyShortVanuatu Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = "vanuatu" -const Mt5GetSettingsRespMt5GetSettingsMarketTypeAll Mt5GetSettingsRespMt5GetSettingsMarketType = "all" -const Mt5GetSettingsRespMt5GetSettingsMarketTypeFinancial Mt5GetSettingsRespMt5GetSettingsMarketType = "financial" -const Mt5GetSettingsRespMt5GetSettingsMarketTypeSynthetic Mt5GetSettingsRespMt5GetSettingsMarketType = "synthetic" +type Mt5GetSettingsRespMt5GetSettingsMarketType string var enumValues_Mt5GetSettingsRespMt5GetSettingsMarketType = []interface{}{ "all", @@ -229,25 +135,12 @@ func (j *Mt5GetSettingsRespMt5GetSettingsMarketType) UnmarshalJSON(b []byte) err return nil } -// Trade server information. -type Mt5GetSettingsRespMt5GetSettingsServerInfo struct { - // The environment. E.g. Deriv-Server. - Environment *Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment `json:"environment,omitempty"` - - // Geographical location of the server. - Geolocation *Mt5GetSettingsRespMt5GetSettingsServerInfoGeolocation `json:"geolocation,omitempty"` - - // Server id. - Id *string `json:"id,omitempty"` -} +const Mt5GetSettingsRespMt5GetSettingsMarketTypeAll Mt5GetSettingsRespMt5GetSettingsMarketType = "all" +const Mt5GetSettingsRespMt5GetSettingsMarketTypeFinancial Mt5GetSettingsRespMt5GetSettingsMarketType = "financial" +const Mt5GetSettingsRespMt5GetSettingsMarketTypeSynthetic Mt5GetSettingsRespMt5GetSettingsMarketType = "synthetic" type Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment string -const Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironmentDerivDemo Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = "Deriv-Demo" -const Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironmentDerivServer Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = "Deriv-Server" -const Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironmentDerivServer02 Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = "Deriv-Server-02" -const Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironmentDerivServer03 Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = "Deriv-Server-03" - var enumValues_Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = []interface{}{ "Deriv-Demo", "Deriv-Server", @@ -275,6 +168,23 @@ func (j *Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment) UnmarshalJSON(b return nil } +// Trade server information. +type Mt5GetSettingsRespMt5GetSettingsServerInfo struct { + // The environment. E.g. Deriv-Server. + Environment *Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment `json:"environment,omitempty"` + + // Geographical location of the server. + Geolocation *Mt5GetSettingsRespMt5GetSettingsServerInfoGeolocation `json:"geolocation,omitempty"` + + // Server id. + Id *string `json:"id,omitempty"` +} + +const Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironmentDerivDemo Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = "Deriv-Demo" +const Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironmentDerivServer Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = "Deriv-Server" +const Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironmentDerivServer02 Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = "Deriv-Server-02" +const Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironmentDerivServer03 Mt5GetSettingsRespMt5GetSettingsServerInfoEnvironment = "Deriv-Server-03" + // Geographical location of the server. type Mt5GetSettingsRespMt5GetSettingsServerInfoGeolocation struct { // Internal server grouping. @@ -292,13 +202,6 @@ type Mt5GetSettingsRespMt5GetSettingsServerInfoGeolocation struct { type Mt5GetSettingsRespMt5GetSettingsSubAccountCategory string -const Mt5GetSettingsRespMt5GetSettingsSubAccountCategoryBlank Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "" -const Mt5GetSettingsRespMt5GetSettingsSubAccountCategoryIbt Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "ibt" -const Mt5GetSettingsRespMt5GetSettingsSubAccountCategoryLim Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "lim" -const Mt5GetSettingsRespMt5GetSettingsSubAccountCategoryStp Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "stp" -const Mt5GetSettingsRespMt5GetSettingsSubAccountCategorySwapFree Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "swap_free" -const Mt5GetSettingsRespMt5GetSettingsSubAccountCategorySwapFreeHighRisk Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "swap_free_high_risk" - var enumValues_Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = []interface{}{ "", "ibt", @@ -328,12 +231,14 @@ func (j *Mt5GetSettingsRespMt5GetSettingsSubAccountCategory) UnmarshalJSON(b []b return nil } -type Mt5GetSettingsRespMt5GetSettingsSubAccountType string +const Mt5GetSettingsRespMt5GetSettingsSubAccountCategoryBlank Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "" +const Mt5GetSettingsRespMt5GetSettingsSubAccountCategoryIbt Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "ibt" +const Mt5GetSettingsRespMt5GetSettingsSubAccountCategoryLim Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "lim" +const Mt5GetSettingsRespMt5GetSettingsSubAccountCategoryStp Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "stp" +const Mt5GetSettingsRespMt5GetSettingsSubAccountCategorySwapFree Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "swap_free" +const Mt5GetSettingsRespMt5GetSettingsSubAccountCategorySwapFreeHighRisk Mt5GetSettingsRespMt5GetSettingsSubAccountCategory = "swap_free_high_risk" -const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeDerivez Mt5GetSettingsRespMt5GetSettingsSubAccountType = "derivez" -const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeFinancial Mt5GetSettingsRespMt5GetSettingsSubAccountType = "financial" -const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeFinancialStp Mt5GetSettingsRespMt5GetSettingsSubAccountType = "financial_stp" -const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeStandard Mt5GetSettingsRespMt5GetSettingsSubAccountType = "standard" +type Mt5GetSettingsRespMt5GetSettingsSubAccountType string var enumValues_Mt5GetSettingsRespMt5GetSettingsSubAccountType = []interface{}{ "derivez", @@ -362,16 +267,111 @@ func (j *Mt5GetSettingsRespMt5GetSettingsSubAccountType) UnmarshalJSON(b []byte) return nil } +// Get MT5 user settings +type Mt5GetSettingsResp struct { + // Echo of the request made. + EchoReq Mt5GetSettingsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType Mt5GetSettingsRespMsgType `json:"msg_type"` + + // MT5 user account details + Mt5GetSettings *Mt5GetSettingsRespMt5GetSettings `json:"mt5_get_settings,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +// MT5 user account details +type Mt5GetSettingsRespMt5GetSettings struct { + // Account type. + AccountType *Mt5GetSettingsRespMt5GetSettingsAccountType `json:"account_type,omitempty"` + + // The address of the user. The maximum length of the address is 128 characters. + Address *string `json:"address,omitempty"` + + // Balance of the Trading account. + Balance *float64 `json:"balance,omitempty"` + + // User's city of residence. + City *string `json:"city,omitempty"` + + // Name of the client's company. The maximum length of the company name is 64 + // characters. + Company *string `json:"company,omitempty"` + + // 2-letter country code. + Country *string `json:"country,omitempty"` + + // MT5 account currency (`USD` or `EUR`) that depends on the MT5 company + // (`vanuatu`, `svg`, `malta`). + Currency *string `json:"currency,omitempty"` + + // Account balance, formatted to appropriate decimal places. + DisplayBalance *string `json:"display_balance,omitempty"` + + // Email address. + Email *string `json:"email,omitempty"` + + // The group where account belongs to. + Group *string `json:"group,omitempty"` + + // Landing company shortcode of the MT5 account. + LandingCompanyShort *Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort `json:"landing_company_short,omitempty"` + + // Client leverage (from 1 to 1000). + Leverage *float64 `json:"leverage,omitempty"` + + // Login ID of the user's MT5 account. + Login *string `json:"login,omitempty"` + + // Market type + MarketType *Mt5GetSettingsRespMt5GetSettingsMarketType `json:"market_type,omitempty"` + + // Client's name. The maximum length of a client's symbol name is 128 characters. + Name *string `json:"name,omitempty"` + + // User's phone number. + Phone *string `json:"phone,omitempty"` + + // The user's phone password. + PhonePassword *string `json:"phonePassword,omitempty"` + + // Trade server name of the MT5 account. + Server *string `json:"server,omitempty"` + + // Trade server information. + ServerInfo *Mt5GetSettingsRespMt5GetSettingsServerInfo `json:"server_info,omitempty"` + + // User's state (region) of residence. + State *string `json:"state,omitempty"` + + // Sub account category. + SubAccountCategory *Mt5GetSettingsRespMt5GetSettingsSubAccountCategory `json:"sub_account_category,omitempty"` + + // Sub account type + SubAccountType *Mt5GetSettingsRespMt5GetSettingsSubAccountType `json:"sub_account_type,omitempty"` + + // User's zip code. + ZipCode *string `json:"zipCode,omitempty"` +} + +const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeDerivez Mt5GetSettingsRespMt5GetSettingsSubAccountType = "derivez" +const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeFinancial Mt5GetSettingsRespMt5GetSettingsSubAccountType = "financial" +const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeFinancialStp Mt5GetSettingsRespMt5GetSettingsSubAccountType = "financial_stp" +const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeStandard Mt5GetSettingsRespMt5GetSettingsSubAccountType = "standard" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5GetSettingsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in Mt5GetSettingsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in Mt5GetSettingsResp: required") } type Plain Mt5GetSettingsResp diff --git a/schema/mt5_login_list.go b/schema/mt5_login_list.go index b47b25a..bdb7f9e 100644 --- a/schema/mt5_login_list.go +++ b/schema/mt5_login_list.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get list of MT5 accounts for client -type Mt5LoginList struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - Mt5LoginList Mt5LoginListMt5LoginList `json:"mt5_login_list"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough Mt5LoginListPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type Mt5LoginListMt5LoginList int var enumValues_Mt5LoginListMt5LoginList = []interface{}{ @@ -49,6 +32,23 @@ func (j *Mt5LoginListMt5LoginList) UnmarshalJSON(b []byte) error { return nil } +// Get list of MT5 accounts for client +type Mt5LoginList struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + Mt5LoginList Mt5LoginListMt5LoginList `json:"mt5_login_list"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough Mt5LoginListPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type Mt5LoginListPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *Mt5LoginList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["mt5_login_list"]; raw != nil && !ok { + if v, ok := raw["mt5_login_list"]; !ok || v == nil { return fmt.Errorf("field mt5_login_list in Mt5LoginList: required") } type Plain Mt5LoginList diff --git a/schema/mt5_login_list_resp.go b/schema/mt5_login_list_resp.go index dabf680..177f42f 100644 --- a/schema/mt5_login_list_resp.go +++ b/schema/mt5_login_list_resp.go @@ -29,30 +29,6 @@ type Mt5LoginListRespMsgType string const Mt5LoginListRespMsgTypeMt5LoginList Mt5LoginListRespMsgType = "mt5_login_list" -var enumValues_Mt5LoginListRespMsgType = []interface{}{ - "mt5_login_list", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMsgType, v) - } - *j = Mt5LoginListRespMsgType(v) - return nil -} - type Mt5LoginListRespMt5LoginListElem struct { // Account type. AccountType *Mt5LoginListRespMt5LoginListElemAccountType `json:"account_type,omitempty"` @@ -136,31 +112,6 @@ type Mt5LoginListRespMt5LoginListElemAccountType string const Mt5LoginListRespMt5LoginListElemAccountTypeDemo Mt5LoginListRespMt5LoginListElemAccountType = "demo" const Mt5LoginListRespMt5LoginListElemAccountTypeReal Mt5LoginListRespMt5LoginListElemAccountType = "real" -var enumValues_Mt5LoginListRespMt5LoginListElemAccountType = []interface{}{ - "demo", - "real", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemAccountType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemAccountType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemAccountType, v) - } - *j = Mt5LoginListRespMt5LoginListElemAccountType(v) - return nil -} - // [Optional] Determines the eligibility status for migrating a client account // based on verification and account type. type Mt5LoginListRespMt5LoginListElemEligibleToMigrate map[string]interface{} @@ -226,48 +177,6 @@ const Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironmentDerivVUSe const Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironmentDerivVUServer02 Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = "DerivVU-Server-02" const Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironmentDerivVUServer03 Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = "DerivVU-Server-03" -var enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = []interface{}{ - "Deriv-Demo", - "Deriv-Server", - "Deriv-Server-02", - "Deriv-Server-03", - "DerivFX-Server", - "DerivFX-Server-02", - "DerivFX-Server-03", - "DerivVU-Server", - "DerivVU-Server-02", - "DerivVU-Server-03", - "DerivSVG-Server", - "DerivSVG-Server-02", - "DerivSVG-Server-03", - "DerivMT-Server", - "DerivMT-Server-02", - "DerivMT-Server-03", - "DerivBVI-Server", - "DerivBVI-Server-02", - "DerivBVI-Server-03", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment, v) - } - *j = Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment(v) - return nil -} - // Geographical location of the server. type Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoGeolocation struct { // Internal server grouping. @@ -293,68 +202,12 @@ const Mt5LoginListRespMt5LoginListElemLandingCompanyShortSeychelles Mt5LoginList const Mt5LoginListRespMt5LoginListElemLandingCompanyShortSvg Mt5LoginListRespMt5LoginListElemLandingCompanyShort = "svg" const Mt5LoginListRespMt5LoginListElemLandingCompanyShortVanuatu Mt5LoginListRespMt5LoginListElemLandingCompanyShort = "vanuatu" -var enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort = []interface{}{ - "bvi", - "labuan", - "malta", - "maltainvest", - "svg", - "vanuatu", - "seychelles", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemLandingCompanyShort) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort, v) - } - *j = Mt5LoginListRespMt5LoginListElemLandingCompanyShort(v) - return nil -} - type Mt5LoginListRespMt5LoginListElemMarketType string const Mt5LoginListRespMt5LoginListElemMarketTypeAll Mt5LoginListRespMt5LoginListElemMarketType = "all" const Mt5LoginListRespMt5LoginListElemMarketTypeFinancial Mt5LoginListRespMt5LoginListElemMarketType = "financial" const Mt5LoginListRespMt5LoginListElemMarketTypeSynthetic Mt5LoginListRespMt5LoginListElemMarketType = "synthetic" -var enumValues_Mt5LoginListRespMt5LoginListElemMarketType = []interface{}{ - "financial", - "synthetic", - "all", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemMarketType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemMarketType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemMarketType, v) - } - *j = Mt5LoginListRespMt5LoginListElemMarketType(v) - return nil -} - type Mt5LoginListRespMt5LoginListElemProduct string const Mt5LoginListRespMt5LoginListElemProductBlank Mt5LoginListRespMt5LoginListElemProduct = "" @@ -365,36 +218,6 @@ const Mt5LoginListRespMt5LoginListElemProductSwapFree Mt5LoginListRespMt5LoginLi const Mt5LoginListRespMt5LoginListElemProductSynthetic Mt5LoginListRespMt5LoginListElemProduct = "synthetic" const Mt5LoginListRespMt5LoginListElemProductZeroSpread Mt5LoginListRespMt5LoginListElemProduct = "zero_spread" -var enumValues_Mt5LoginListRespMt5LoginListElemProduct = []interface{}{ - "", - "synthetic", - "financial", - "swap_free", - "zero_spread", - "standard", - "stp", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemProduct) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemProduct { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemProduct, v) - } - *j = Mt5LoginListRespMt5LoginListElemProduct(v) - return nil -} - // Rights assigned to the MT5 account. type Mt5LoginListRespMt5LoginListElemRights struct { // User is allowed to connect via MT5 Web API @@ -475,15 +298,153 @@ const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivMTServer02 Mt5Lo const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivMTServer03 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivMT-Server-03" const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivSVGServer Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivSVG-Server" const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivSVGServer02 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivSVG-Server-02" -const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivSVGServer03 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivSVG-Server-03" -const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Server" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5LoginListRespMt5LoginListElemSubAccountCategory) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory, v) + } + *j = Mt5LoginListRespMt5LoginListElemSubAccountCategory(v) + return nil +} + const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer02 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Server-02" const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer03 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Server-03" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5LoginListRespMt5LoginListElemServerInfoEnvironment) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment, v) + } + *j = Mt5LoginListRespMt5LoginListElemServerInfoEnvironment(v) + return nil +} + +var enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = []interface{}{ + "Deriv-Demo", + "Deriv-Server", + "Deriv-Server-02", + "Deriv-Server-03", + "DerivFX-Server", + "DerivFX-Server-02", + "DerivFX-Server-03", + "DerivVU-Server", + "DerivVU-Server-02", + "DerivVU-Server-03", + "DerivSVG-Server", + "DerivSVG-Server-02", + "DerivSVG-Server-03", + "DerivMT-Server", + "DerivMT-Server-02", + "DerivMT-Server-03", + "DerivBVI-Server", + "DerivBVI-Server-02", + "DerivBVI-Server-03", +} +var enumValues_Mt5LoginListRespMt5LoginListElemAccountType = []interface{}{ + "demo", + "real", +} + const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivVUServer Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivVU-Server" const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivVUServer02 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivVU-Server-02" const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivVUServer03 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivVU-Server-03" -var enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = []interface{}{ +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5LoginListRespMt5LoginListElemProduct) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemProduct { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemProduct, v) + } + *j = Mt5LoginListRespMt5LoginListElemProduct(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5LoginListRespMt5LoginListElemLandingCompanyShort) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort, v) + } + *j = Mt5LoginListRespMt5LoginListElemLandingCompanyShort(v) + return nil +} + +const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivSVGServer03 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivSVG-Server-03" + +var enumValues_Mt5LoginListRespMt5LoginListElemProduct = []interface{}{ + "", + "synthetic", + "financial", + "swap_free", + "zero_spread", + "standard", + "stp", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5LoginListRespMt5LoginListElemAccountType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemAccountType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemAccountType, v) + } + *j = Mt5LoginListRespMt5LoginListElemAccountType(v) + return nil +} + +var enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = []interface{}{ "Deriv-Demo", "Deriv-Server", "Deriv-Server-02", @@ -506,22 +467,52 @@ var enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = []interfa } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemServerInfoEnvironment) UnmarshalJSON(b []byte) error { +func (j *Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment { + for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment, v) } - *j = Mt5LoginListRespMt5LoginListElemServerInfoEnvironment(v) + *j = Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment(v) + return nil +} + +var enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort = []interface{}{ + "bvi", + "labuan", + "malta", + "maltainvest", + "svg", + "vanuatu", + "seychelles", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5LoginListRespMt5LoginListElemMarketType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemMarketType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemMarketType, v) + } + *j = Mt5LoginListRespMt5LoginListElemMarketType(v) return nil } @@ -540,16 +531,13 @@ type Mt5LoginListRespMt5LoginListElemServerInfoGeolocation struct { Sequence *int `json:"sequence,omitempty"` } -type Mt5LoginListRespMt5LoginListElemSubAccountCategory string +var enumValues_Mt5LoginListRespMt5LoginListElemMarketType = []interface{}{ + "financial", + "synthetic", + "all", +} -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryAb Mt5LoginListRespMt5LoginListElemSubAccountCategory = "ab" -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryBa Mt5LoginListRespMt5LoginListElemSubAccountCategory = "ba" -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryBlank Mt5LoginListRespMt5LoginListElemSubAccountCategory = "" -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryHr Mt5LoginListRespMt5LoginListElemSubAccountCategory = "hr" -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryLim Mt5LoginListRespMt5LoginListElemSubAccountCategory = "lim" -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryStp Mt5LoginListRespMt5LoginListElemSubAccountCategory = "stp" -const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFree Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free" -const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFreeHighRisk Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free_high_risk" +type Mt5LoginListRespMt5LoginListElemSubAccountCategory string var enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory = []interface{}{ "", @@ -562,36 +550,18 @@ var enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory = []interface{ "stp", } -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemSubAccountCategory) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory, v) - } - *j = Mt5LoginListRespMt5LoginListElemSubAccountCategory(v) - return nil -} +const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Server" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryBlank Mt5LoginListRespMt5LoginListElemSubAccountCategory = "" +const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFree Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free" +const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFreeHighRisk Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free_high_risk" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryLim Mt5LoginListRespMt5LoginListElemSubAccountCategory = "lim" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryHr Mt5LoginListRespMt5LoginListElemSubAccountCategory = "hr" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryAb Mt5LoginListRespMt5LoginListElemSubAccountCategory = "ab" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryBa Mt5LoginListRespMt5LoginListElemSubAccountCategory = "ba" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryStp Mt5LoginListRespMt5LoginListElemSubAccountCategory = "stp" type Mt5LoginListRespMt5LoginListElemSubAccountType string -const Mt5LoginListRespMt5LoginListElemSubAccountTypeFinancial Mt5LoginListRespMt5LoginListElemSubAccountType = "financial" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeFinancialStp Mt5LoginListRespMt5LoginListElemSubAccountType = "financial_stp" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeIbt Mt5LoginListRespMt5LoginListElemSubAccountType = "ibt" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeStandard Mt5LoginListRespMt5LoginListElemSubAccountType = "standard" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeStp Mt5LoginListRespMt5LoginListElemSubAccountType = "stp" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeSwapFree Mt5LoginListRespMt5LoginListElemSubAccountType = "swap_free" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeZeroSpread Mt5LoginListRespMt5LoginListElemSubAccountType = "zero_spread" - var enumValues_Mt5LoginListRespMt5LoginListElemSubAccountType = []interface{}{ "standard", "financial", @@ -622,6 +592,14 @@ func (j *Mt5LoginListRespMt5LoginListElemSubAccountType) UnmarshalJSON(b []byte) return nil } +const Mt5LoginListRespMt5LoginListElemSubAccountTypeStandard Mt5LoginListRespMt5LoginListElemSubAccountType = "standard" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeFinancial Mt5LoginListRespMt5LoginListElemSubAccountType = "financial" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeFinancialStp Mt5LoginListRespMt5LoginListElemSubAccountType = "financial_stp" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeSwapFree Mt5LoginListRespMt5LoginListElemSubAccountType = "swap_free" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeIbt Mt5LoginListRespMt5LoginListElemSubAccountType = "ibt" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeStp Mt5LoginListRespMt5LoginListElemSubAccountType = "stp" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeZeroSpread Mt5LoginListRespMt5LoginListElemSubAccountType = "zero_spread" + // Links to access MT5 application for different platforms. type Mt5LoginListRespMt5LoginListElemWhiteLabelLinks struct { // Download link for Android. @@ -637,16 +615,40 @@ type Mt5LoginListRespMt5LoginListElemWhiteLabelLinks struct { Windows *string `json:"windows,omitempty"` } +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5LoginListRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5LoginListRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMsgType, v) + } + *j = Mt5LoginListRespMsgType(v) + return nil +} + +var enumValues_Mt5LoginListRespMsgType = []interface{}{ + "mt5_login_list", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5LoginListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in Mt5LoginListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in Mt5LoginListResp: required") } type Plain Mt5LoginListResp diff --git a/schema/mt5_new_account.go b/schema/mt5_new_account.go index 24fe9a5..4207227 100644 --- a/schema/mt5_new_account.go +++ b/schema/mt5_new_account.go @@ -113,12 +113,53 @@ const Mt5NewAccountAccountTypeDemo Mt5NewAccountAccountType = "demo" const Mt5NewAccountAccountTypeFinancial Mt5NewAccountAccountType = "financial" const Mt5NewAccountAccountTypeGaming Mt5NewAccountAccountType = "gaming" -var enumValues_Mt5NewAccountAccountType = []interface{}{ - "demo", - "gaming", - "financial", - "all", -} +type Mt5NewAccountDryRun int + +type Mt5NewAccountMt5AccountCategory string + +const Mt5NewAccountMt5AccountCategoryConventional Mt5NewAccountMt5AccountCategory = "conventional" +const Mt5NewAccountMt5AccountCategorySwapFree Mt5NewAccountMt5AccountCategory = "swap_free" + +type Mt5NewAccountMt5AccountType string + +const Mt5NewAccountMt5AccountTypeFinancial Mt5NewAccountMt5AccountType = "financial" +const Mt5NewAccountMt5AccountTypeFinancialStp Mt5NewAccountMt5AccountType = "financial_stp" + +type Mt5NewAccountMt5NewAccount int + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type Mt5NewAccountPassthrough map[string]interface{} + +type Mt5NewAccountProduct string + +const Mt5NewAccountProductBlank Mt5NewAccountProduct = "" +const Mt5NewAccountProductFinancial Mt5NewAccountProduct = "financial" +const Mt5NewAccountProductStandard Mt5NewAccountProduct = "standard" +const Mt5NewAccountProductStp Mt5NewAccountProduct = "stp" +const Mt5NewAccountProductSwapFree Mt5NewAccountProduct = "swap_free" +const Mt5NewAccountProductSynthetic Mt5NewAccountProduct = "synthetic" +const Mt5NewAccountProductZeroSpread Mt5NewAccountProduct = "zero_spread" + +type Mt5NewAccountServer string + +const Mt5NewAccountServerP01Ts01 Mt5NewAccountServer = "p01_ts01" +const Mt5NewAccountServerP01Ts02 Mt5NewAccountServer = "p01_ts02" +const Mt5NewAccountServerP01Ts03 Mt5NewAccountServer = "p01_ts03" +const Mt5NewAccountServerP01Ts04 Mt5NewAccountServer = "p01_ts04" +const Mt5NewAccountServerP02Ts02 Mt5NewAccountServer = "p02_ts02" +const Mt5NewAccountServerP03Ts01 Mt5NewAccountServer = "p03_ts01" + +type Mt5NewAccountSubAccountCategory string + +const Mt5NewAccountSubAccountCategoryAb Mt5NewAccountSubAccountCategory = "ab" +const Mt5NewAccountSubAccountCategoryBa Mt5NewAccountSubAccountCategory = "ba" +const Mt5NewAccountSubAccountCategoryBlank Mt5NewAccountSubAccountCategory = "" +const Mt5NewAccountSubAccountCategoryHr Mt5NewAccountSubAccountCategory = "hr" +const Mt5NewAccountSubAccountCategoryLim Mt5NewAccountSubAccountCategory = "lim" +const Mt5NewAccountSubAccountCategorySwapFree Mt5NewAccountSubAccountCategory = "swap_free" + +type Mt5NewAccountSubAccountType string // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5NewAccountAccountType) UnmarshalJSON(b []byte) error { @@ -140,133 +181,112 @@ func (j *Mt5NewAccountAccountType) UnmarshalJSON(b []byte) error { return nil } -type Mt5NewAccountDryRun int - -var enumValues_Mt5NewAccountDryRun = []interface{}{ - 0, +var enumValues_Mt5NewAccountMt5NewAccount = []interface{}{ 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountDryRun) UnmarshalJSON(b []byte) error { - var v int +func (j *Mt5NewAccountMt5AccountType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountDryRun { + for _, expected := range enumValues_Mt5NewAccountMt5AccountType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountDryRun, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountMt5AccountType, v) } - *j = Mt5NewAccountDryRun(v) + *j = Mt5NewAccountMt5AccountType(v) return nil } -type Mt5NewAccountMt5AccountCategory string - -const Mt5NewAccountMt5AccountCategoryConventional Mt5NewAccountMt5AccountCategory = "conventional" -const Mt5NewAccountMt5AccountCategorySwapFree Mt5NewAccountMt5AccountCategory = "swap_free" - -var enumValues_Mt5NewAccountMt5AccountCategory = []interface{}{ - "conventional", - "swap_free", +var enumValues_Mt5NewAccountMt5AccountType = []interface{}{ + "financial", + "financial_stp", } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountMt5AccountCategory) UnmarshalJSON(b []byte) error { +func (j *Mt5NewAccountServer) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountMt5AccountCategory { + for _, expected := range enumValues_Mt5NewAccountServer { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountMt5AccountCategory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountServer, v) } - *j = Mt5NewAccountMt5AccountCategory(v) + *j = Mt5NewAccountServer(v) return nil } -type Mt5NewAccountMt5AccountType string - -const Mt5NewAccountMt5AccountTypeFinancial Mt5NewAccountMt5AccountType = "financial" -const Mt5NewAccountMt5AccountTypeFinancialStp Mt5NewAccountMt5AccountType = "financial_stp" - -var enumValues_Mt5NewAccountMt5AccountType = []interface{}{ - "financial", - "financial_stp", +var enumValues_Mt5NewAccountServer = []interface{}{ + "p01_ts01", + "p01_ts02", + "p01_ts03", + "p01_ts04", + "p02_ts02", + "p03_ts01", +} +var enumValues_Mt5NewAccountSubAccountCategory = []interface{}{ + "", + "swap_free", + "ab", + "ba", + "lim", + "hr", } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountMt5AccountType) UnmarshalJSON(b []byte) error { +func (j *Mt5NewAccountSubAccountCategory) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountMt5AccountType { + for _, expected := range enumValues_Mt5NewAccountSubAccountCategory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountMt5AccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountSubAccountCategory, v) } - *j = Mt5NewAccountMt5AccountType(v) + *j = Mt5NewAccountSubAccountCategory(v) return nil } -type Mt5NewAccountMt5NewAccount int - -var enumValues_Mt5NewAccountMt5NewAccount = []interface{}{ - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountMt5NewAccount) UnmarshalJSON(b []byte) error { - var v int +func (j *Mt5NewAccountMt5AccountCategory) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountMt5NewAccount { + for _, expected := range enumValues_Mt5NewAccountMt5AccountCategory { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountMt5NewAccount, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountMt5AccountCategory, v) } - *j = Mt5NewAccountMt5NewAccount(v) + *j = Mt5NewAccountMt5AccountCategory(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type Mt5NewAccountPassthrough map[string]interface{} - -type Mt5NewAccountProduct string - -const Mt5NewAccountProductBlank Mt5NewAccountProduct = "" -const Mt5NewAccountProductFinancial Mt5NewAccountProduct = "financial" -const Mt5NewAccountProductStandard Mt5NewAccountProduct = "standard" -const Mt5NewAccountProductStp Mt5NewAccountProduct = "stp" -const Mt5NewAccountProductSwapFree Mt5NewAccountProduct = "swap_free" -const Mt5NewAccountProductSynthetic Mt5NewAccountProduct = "synthetic" -const Mt5NewAccountProductZeroSpread Mt5NewAccountProduct = "zero_spread" - var enumValues_Mt5NewAccountProduct = []interface{}{ "", "synthetic", @@ -297,90 +317,56 @@ func (j *Mt5NewAccountProduct) UnmarshalJSON(b []byte) error { return nil } -type Mt5NewAccountServer string - -const Mt5NewAccountServerP01Ts01 Mt5NewAccountServer = "p01_ts01" -const Mt5NewAccountServerP01Ts02 Mt5NewAccountServer = "p01_ts02" -const Mt5NewAccountServerP01Ts03 Mt5NewAccountServer = "p01_ts03" -const Mt5NewAccountServerP01Ts04 Mt5NewAccountServer = "p01_ts04" -const Mt5NewAccountServerP02Ts02 Mt5NewAccountServer = "p02_ts02" -const Mt5NewAccountServerP03Ts01 Mt5NewAccountServer = "p03_ts01" - -var enumValues_Mt5NewAccountServer = []interface{}{ - "p01_ts01", - "p01_ts02", - "p01_ts03", - "p01_ts04", - "p02_ts02", - "p03_ts01", +var enumValues_Mt5NewAccountMt5AccountCategory = []interface{}{ + "conventional", + "swap_free", } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountServer) UnmarshalJSON(b []byte) error { - var v string +func (j *Mt5NewAccountMt5NewAccount) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountServer { + for _, expected := range enumValues_Mt5NewAccountMt5NewAccount { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountServer, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountMt5NewAccount, v) } - *j = Mt5NewAccountServer(v) + *j = Mt5NewAccountMt5NewAccount(v) return nil } -type Mt5NewAccountSubAccountCategory string - -const Mt5NewAccountSubAccountCategoryAb Mt5NewAccountSubAccountCategory = "ab" -const Mt5NewAccountSubAccountCategoryBa Mt5NewAccountSubAccountCategory = "ba" -const Mt5NewAccountSubAccountCategoryBlank Mt5NewAccountSubAccountCategory = "" -const Mt5NewAccountSubAccountCategoryHr Mt5NewAccountSubAccountCategory = "hr" -const Mt5NewAccountSubAccountCategoryLim Mt5NewAccountSubAccountCategory = "lim" -const Mt5NewAccountSubAccountCategorySwapFree Mt5NewAccountSubAccountCategory = "swap_free" - -var enumValues_Mt5NewAccountSubAccountCategory = []interface{}{ - "", - "swap_free", - "ab", - "ba", - "lim", - "hr", +var enumValues_Mt5NewAccountDryRun = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountSubAccountCategory) UnmarshalJSON(b []byte) error { - var v string +func (j *Mt5NewAccountDryRun) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountSubAccountCategory { + for _, expected := range enumValues_Mt5NewAccountDryRun { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountSubAccountCategory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountDryRun, v) } - *j = Mt5NewAccountSubAccountCategory(v) + *j = Mt5NewAccountDryRun(v) return nil } -type Mt5NewAccountSubAccountType string - -const Mt5NewAccountSubAccountTypeIbt Mt5NewAccountSubAccountType = "ibt" -const Mt5NewAccountSubAccountTypeStandard Mt5NewAccountSubAccountType = "standard" -const Mt5NewAccountSubAccountTypeStp Mt5NewAccountSubAccountType = "stp" -const Mt5NewAccountSubAccountTypeSwapFree Mt5NewAccountSubAccountType = "swap_free" -const Mt5NewAccountSubAccountTypeZeroSpread Mt5NewAccountSubAccountType = "zero_spread" - var enumValues_Mt5NewAccountSubAccountType = []interface{}{ "standard", "stp", @@ -409,28 +395,41 @@ func (j *Mt5NewAccountSubAccountType) UnmarshalJSON(b []byte) error { return nil } +const Mt5NewAccountSubAccountTypeStandard Mt5NewAccountSubAccountType = "standard" +const Mt5NewAccountSubAccountTypeStp Mt5NewAccountSubAccountType = "stp" +const Mt5NewAccountSubAccountTypeIbt Mt5NewAccountSubAccountType = "ibt" +const Mt5NewAccountSubAccountTypeSwapFree Mt5NewAccountSubAccountType = "swap_free" +const Mt5NewAccountSubAccountTypeZeroSpread Mt5NewAccountSubAccountType = "zero_spread" + +var enumValues_Mt5NewAccountAccountType = []interface{}{ + "demo", + "gaming", + "financial", + "all", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5NewAccount) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_type"]; raw != nil && !ok { + if v, ok := raw["account_type"]; !ok || v == nil { return fmt.Errorf("field account_type in Mt5NewAccount: required") } - if _, ok := raw["email"]; raw != nil && !ok { + if v, ok := raw["email"]; !ok || v == nil { return fmt.Errorf("field email in Mt5NewAccount: required") } - if _, ok := raw["leverage"]; raw != nil && !ok { + if v, ok := raw["leverage"]; !ok || v == nil { return fmt.Errorf("field leverage in Mt5NewAccount: required") } - if _, ok := raw["mainPassword"]; raw != nil && !ok { + if v, ok := raw["mainPassword"]; !ok || v == nil { return fmt.Errorf("field mainPassword in Mt5NewAccount: required") } - if _, ok := raw["mt5_new_account"]; raw != nil && !ok { + if v, ok := raw["mt5_new_account"]; !ok || v == nil { return fmt.Errorf("field mt5_new_account in Mt5NewAccount: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in Mt5NewAccount: required") } type Plain Mt5NewAccount diff --git a/schema/mt5_new_account_resp.go b/schema/mt5_new_account_resp.go index 7841089..7b24f6f 100644 --- a/schema/mt5_new_account_resp.go +++ b/schema/mt5_new_account_resp.go @@ -29,30 +29,6 @@ type Mt5NewAccountRespMsgType string const Mt5NewAccountRespMsgTypeMt5NewAccount Mt5NewAccountRespMsgType = "mt5_new_account" -var enumValues_Mt5NewAccountRespMsgType = []interface{}{ - "mt5_new_account", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5NewAccountRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMsgType, v) - } - *j = Mt5NewAccountRespMsgType(v) - return nil -} - // New MT5 account details type Mt5NewAccountRespMt5NewAccount struct { // Account type. @@ -96,38 +72,51 @@ const Mt5NewAccountRespMt5NewAccountAccountTypeDemo Mt5NewAccountRespMt5NewAccou const Mt5NewAccountRespMt5NewAccountAccountTypeFinancial Mt5NewAccountRespMt5NewAccountAccountType = "financial" const Mt5NewAccountRespMt5NewAccountAccountTypeGaming Mt5NewAccountRespMt5NewAccountAccountType = "gaming" -var enumValues_Mt5NewAccountRespMt5NewAccountAccountType = []interface{}{ - "demo", - "gaming", - "financial", - "all", -} +type Mt5NewAccountRespMt5NewAccountMt5AccountCategory string + +const Mt5NewAccountRespMt5NewAccountMt5AccountCategoryConventional Mt5NewAccountRespMt5NewAccountMt5AccountCategory = "conventional" +const Mt5NewAccountRespMt5NewAccountMt5AccountCategorySwapFree Mt5NewAccountRespMt5NewAccountMt5AccountCategory = "swap_free" + +type Mt5NewAccountRespMt5NewAccountMt5AccountType string + +const Mt5NewAccountRespMt5NewAccountMt5AccountTypeFinancial Mt5NewAccountRespMt5NewAccountMt5AccountType = "financial" +const Mt5NewAccountRespMt5NewAccountMt5AccountTypeFinancialStp Mt5NewAccountRespMt5NewAccountMt5AccountType = "financial_stp" +const Mt5NewAccountRespMt5NewAccountMt5AccountTypeStandard Mt5NewAccountRespMt5NewAccountMt5AccountType = "standard" + +type Mt5NewAccountRespMt5NewAccountProduct string + +const Mt5NewAccountRespMt5NewAccountProductBlank Mt5NewAccountRespMt5NewAccountProduct = "" +const Mt5NewAccountRespMt5NewAccountProductFinancial Mt5NewAccountRespMt5NewAccountProduct = "financial" +const Mt5NewAccountRespMt5NewAccountProductStandard Mt5NewAccountRespMt5NewAccountProduct = "standard" +const Mt5NewAccountRespMt5NewAccountProductStp Mt5NewAccountRespMt5NewAccountProduct = "stp" +const Mt5NewAccountRespMt5NewAccountProductSwapFree Mt5NewAccountRespMt5NewAccountProduct = "swap_free" +const Mt5NewAccountRespMt5NewAccountProductSynthetic Mt5NewAccountRespMt5NewAccountProduct = "synthetic" +const Mt5NewAccountRespMt5NewAccountProductZeroSpread Mt5NewAccountRespMt5NewAccountProduct = "zero_spread" + +type Mt5NewAccountRespMt5NewAccountSubAccountType string + +const Mt5NewAccountRespMt5NewAccountSubAccountTypeIbt Mt5NewAccountRespMt5NewAccountSubAccountType = "ibt" // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountRespMt5NewAccountAccountType) UnmarshalJSON(b []byte) error { +func (j *Mt5NewAccountRespMt5NewAccountSubAccountType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountRespMt5NewAccountAccountType { + for _, expected := range enumValues_Mt5NewAccountRespMt5NewAccountSubAccountType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMt5NewAccountAccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMt5NewAccountSubAccountType, v) } - *j = Mt5NewAccountRespMt5NewAccountAccountType(v) + *j = Mt5NewAccountRespMt5NewAccountSubAccountType(v) return nil } -type Mt5NewAccountRespMt5NewAccountMt5AccountCategory string - -const Mt5NewAccountRespMt5NewAccountMt5AccountCategoryConventional Mt5NewAccountRespMt5NewAccountMt5AccountCategory = "conventional" -const Mt5NewAccountRespMt5NewAccountMt5AccountCategorySwapFree Mt5NewAccountRespMt5NewAccountMt5AccountCategory = "swap_free" - var enumValues_Mt5NewAccountRespMt5NewAccountMt5AccountCategory = []interface{}{ "conventional", "swap_free", @@ -153,16 +142,24 @@ func (j *Mt5NewAccountRespMt5NewAccountMt5AccountCategory) UnmarshalJSON(b []byt return nil } -type Mt5NewAccountRespMt5NewAccountMt5AccountType string - -const Mt5NewAccountRespMt5NewAccountMt5AccountTypeFinancial Mt5NewAccountRespMt5NewAccountMt5AccountType = "financial" -const Mt5NewAccountRespMt5NewAccountMt5AccountTypeFinancialStp Mt5NewAccountRespMt5NewAccountMt5AccountType = "financial_stp" -const Mt5NewAccountRespMt5NewAccountMt5AccountTypeStandard Mt5NewAccountRespMt5NewAccountMt5AccountType = "standard" - -var enumValues_Mt5NewAccountRespMt5NewAccountMt5AccountType = []interface{}{ - "financial", - "financial_stp", - "standard", +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5NewAccountRespMt5NewAccountProduct) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5NewAccountRespMt5NewAccountProduct { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMt5NewAccountProduct, v) + } + *j = Mt5NewAccountRespMt5NewAccountProduct(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -185,16 +182,11 @@ func (j *Mt5NewAccountRespMt5NewAccountMt5AccountType) UnmarshalJSON(b []byte) e return nil } -type Mt5NewAccountRespMt5NewAccountProduct string - -const Mt5NewAccountRespMt5NewAccountProductBlank Mt5NewAccountRespMt5NewAccountProduct = "" -const Mt5NewAccountRespMt5NewAccountProductFinancial Mt5NewAccountRespMt5NewAccountProduct = "financial" -const Mt5NewAccountRespMt5NewAccountProductStandard Mt5NewAccountRespMt5NewAccountProduct = "standard" -const Mt5NewAccountRespMt5NewAccountProductStp Mt5NewAccountRespMt5NewAccountProduct = "stp" -const Mt5NewAccountRespMt5NewAccountProductSwapFree Mt5NewAccountRespMt5NewAccountProduct = "swap_free" -const Mt5NewAccountRespMt5NewAccountProductSynthetic Mt5NewAccountRespMt5NewAccountProduct = "synthetic" -const Mt5NewAccountRespMt5NewAccountProductZeroSpread Mt5NewAccountRespMt5NewAccountProduct = "zero_spread" - +var enumValues_Mt5NewAccountRespMt5NewAccountMt5AccountType = []interface{}{ + "financial", + "financial_stp", + "standard", +} var enumValues_Mt5NewAccountRespMt5NewAccountProduct = []interface{}{ "", "synthetic", @@ -204,73 +196,81 @@ var enumValues_Mt5NewAccountRespMt5NewAccountProduct = []interface{}{ "standard", "stp", } +var enumValues_Mt5NewAccountRespMt5NewAccountSubAccountType = []interface{}{ + "standard", + "stp", + "ibt", + "swap_free", + "zero_spread", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountRespMt5NewAccountProduct) UnmarshalJSON(b []byte) error { +func (j *Mt5NewAccountRespMt5NewAccountAccountType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountRespMt5NewAccountProduct { + for _, expected := range enumValues_Mt5NewAccountRespMt5NewAccountAccountType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMt5NewAccountProduct, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMt5NewAccountAccountType, v) } - *j = Mt5NewAccountRespMt5NewAccountProduct(v) + *j = Mt5NewAccountRespMt5NewAccountAccountType(v) return nil } -type Mt5NewAccountRespMt5NewAccountSubAccountType string - -const Mt5NewAccountRespMt5NewAccountSubAccountTypeIbt Mt5NewAccountRespMt5NewAccountSubAccountType = "ibt" const Mt5NewAccountRespMt5NewAccountSubAccountTypeStandard Mt5NewAccountRespMt5NewAccountSubAccountType = "standard" const Mt5NewAccountRespMt5NewAccountSubAccountTypeStp Mt5NewAccountRespMt5NewAccountSubAccountType = "stp" -const Mt5NewAccountRespMt5NewAccountSubAccountTypeSwapFree Mt5NewAccountRespMt5NewAccountSubAccountType = "swap_free" -const Mt5NewAccountRespMt5NewAccountSubAccountTypeZeroSpread Mt5NewAccountRespMt5NewAccountSubAccountType = "zero_spread" -var enumValues_Mt5NewAccountRespMt5NewAccountSubAccountType = []interface{}{ - "standard", - "stp", - "ibt", - "swap_free", - "zero_spread", +var enumValues_Mt5NewAccountRespMt5NewAccountAccountType = []interface{}{ + "demo", + "gaming", + "financial", + "all", } +const Mt5NewAccountRespMt5NewAccountSubAccountTypeSwapFree Mt5NewAccountRespMt5NewAccountSubAccountType = "swap_free" +const Mt5NewAccountRespMt5NewAccountSubAccountTypeZeroSpread Mt5NewAccountRespMt5NewAccountSubAccountType = "zero_spread" + // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountRespMt5NewAccountSubAccountType) UnmarshalJSON(b []byte) error { +func (j *Mt5NewAccountRespMsgType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountRespMt5NewAccountSubAccountType { + for _, expected := range enumValues_Mt5NewAccountRespMsgType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMt5NewAccountSubAccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMsgType, v) } - *j = Mt5NewAccountRespMt5NewAccountSubAccountType(v) + *j = Mt5NewAccountRespMsgType(v) return nil } +var enumValues_Mt5NewAccountRespMsgType = []interface{}{ + "mt5_new_account", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5NewAccountResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in Mt5NewAccountResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in Mt5NewAccountResp: required") } type Plain Mt5NewAccountResp diff --git a/schema/mt5_password_change.go b/schema/mt5_password_change.go index 6d6bc6e..d174606 100644 --- a/schema/mt5_password_change.go +++ b/schema/mt5_password_change.go @@ -6,38 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// To change passwords of the MT5 account. -type Mt5PasswordChange struct { - // MT5 user login - Login string `json:"login"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - Mt5PasswordChange Mt5PasswordChangeMt5PasswordChange `json:"mt5_password_change"` - - // New password of the account. For validation (Accepts any printable ASCII - // character. Must be within 8-25 characters, and include numbers, lowercase and - // uppercase letters. Must not be the same as the user's email address). - NewPassword string `json:"new_password"` - - // Old password for validation (non-empty string, accepts any printable ASCII - // character) - OldPassword string `json:"old_password"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough Mt5PasswordChangePassthrough `json:"passthrough,omitempty"` - - // [Optional] Type of the password to change. - PasswordType Mt5PasswordChangePasswordType `json:"password_type,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type Mt5PasswordChangeMt5PasswordChange int var enumValues_Mt5PasswordChangeMt5PasswordChange = []interface{}{ @@ -70,9 +38,6 @@ type Mt5PasswordChangePassthrough map[string]interface{} type Mt5PasswordChangePasswordType string -const Mt5PasswordChangePasswordTypeInvestor Mt5PasswordChangePasswordType = "investor" -const Mt5PasswordChangePasswordTypeMain Mt5PasswordChangePasswordType = "main" - var enumValues_Mt5PasswordChangePasswordType = []interface{}{ "main", "investor", @@ -98,22 +63,57 @@ func (j *Mt5PasswordChangePasswordType) UnmarshalJSON(b []byte) error { return nil } +// To change passwords of the MT5 account. +type Mt5PasswordChange struct { + // MT5 user login + Login string `json:"login"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + Mt5PasswordChange Mt5PasswordChangeMt5PasswordChange `json:"mt5_password_change"` + + // New password of the account. For validation (Accepts any printable ASCII + // character. Must be within 8-25 characters, and include numbers, lowercase and + // uppercase letters. Must not be the same as the user's email address). + NewPassword string `json:"new_password"` + + // Old password for validation (non-empty string, accepts any printable ASCII + // character) + OldPassword string `json:"old_password"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough Mt5PasswordChangePassthrough `json:"passthrough,omitempty"` + + // [Optional] Type of the password to change. + PasswordType Mt5PasswordChangePasswordType `json:"password_type,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + +const Mt5PasswordChangePasswordTypeInvestor Mt5PasswordChangePasswordType = "investor" +const Mt5PasswordChangePasswordTypeMain Mt5PasswordChangePasswordType = "main" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5PasswordChange) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["login"]; raw != nil && !ok { + if v, ok := raw["login"]; !ok || v == nil { return fmt.Errorf("field login in Mt5PasswordChange: required") } - if _, ok := raw["mt5_password_change"]; raw != nil && !ok { + if v, ok := raw["mt5_password_change"]; !ok || v == nil { return fmt.Errorf("field mt5_password_change in Mt5PasswordChange: required") } - if _, ok := raw["new_password"]; raw != nil && !ok { + if v, ok := raw["new_password"]; !ok || v == nil { return fmt.Errorf("field new_password in Mt5PasswordChange: required") } - if _, ok := raw["old_password"]; raw != nil && !ok { + if v, ok := raw["old_password"]; !ok || v == nil { return fmt.Errorf("field old_password in Mt5PasswordChange: required") } type Plain Mt5PasswordChange diff --git a/schema/mt5_password_change_resp.go b/schema/mt5_password_change_resp.go index 6a5cc6f..8def241 100644 --- a/schema/mt5_password_change_resp.go +++ b/schema/mt5_password_change_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// MT5 user password change receive -type Mt5PasswordChangeResp struct { - // Echo of the request made. - EchoReq Mt5PasswordChangeRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType Mt5PasswordChangeRespMsgType `json:"msg_type"` - - // `1` on success - Mt5PasswordChange *int `json:"mt5_password_change,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type Mt5PasswordChangeRespEchoReq map[string]interface{} type Mt5PasswordChangeRespMsgType string -const Mt5PasswordChangeRespMsgTypeMt5PasswordChange Mt5PasswordChangeRespMsgType = "mt5_password_change" - var enumValues_Mt5PasswordChangeRespMsgType = []interface{}{ "mt5_password_change", } @@ -53,16 +35,34 @@ func (j *Mt5PasswordChangeRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// MT5 user password change receive +type Mt5PasswordChangeResp struct { + // Echo of the request made. + EchoReq Mt5PasswordChangeRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType Mt5PasswordChangeRespMsgType `json:"msg_type"` + + // `1` on success + Mt5PasswordChange *int `json:"mt5_password_change,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const Mt5PasswordChangeRespMsgTypeMt5PasswordChange Mt5PasswordChangeRespMsgType = "mt5_password_change" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5PasswordChangeResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in Mt5PasswordChangeResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in Mt5PasswordChangeResp: required") } type Plain Mt5PasswordChangeResp diff --git a/schema/mt5_password_check.go b/schema/mt5_password_check.go index e8b596c..fe7f9ee 100644 --- a/schema/mt5_password_check.go +++ b/schema/mt5_password_check.go @@ -6,32 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// This call validates the main password for the MT5 user -type Mt5PasswordCheck struct { - // MT5 user login - Login string `json:"login"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - Mt5PasswordCheck Mt5PasswordCheckMt5PasswordCheck `json:"mt5_password_check"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough Mt5PasswordCheckPassthrough `json:"passthrough,omitempty"` - - // The password of the account. - Password string `json:"password"` - - // [Optional] Type of the password to check. - PasswordType Mt5PasswordCheckPasswordType `json:"password_type,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type Mt5PasswordCheckMt5PasswordCheck int var enumValues_Mt5PasswordCheckMt5PasswordCheck = []interface{}{ @@ -64,9 +38,6 @@ type Mt5PasswordCheckPassthrough map[string]interface{} type Mt5PasswordCheckPasswordType string -const Mt5PasswordCheckPasswordTypeInvestor Mt5PasswordCheckPasswordType = "investor" -const Mt5PasswordCheckPasswordTypeMain Mt5PasswordCheckPasswordType = "main" - var enumValues_Mt5PasswordCheckPasswordType = []interface{}{ "main", "investor", @@ -92,19 +63,48 @@ func (j *Mt5PasswordCheckPasswordType) UnmarshalJSON(b []byte) error { return nil } +// This call validates the main password for the MT5 user +type Mt5PasswordCheck struct { + // MT5 user login + Login string `json:"login"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + Mt5PasswordCheck Mt5PasswordCheckMt5PasswordCheck `json:"mt5_password_check"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough Mt5PasswordCheckPassthrough `json:"passthrough,omitempty"` + + // The password of the account. + Password string `json:"password"` + + // [Optional] Type of the password to check. + PasswordType Mt5PasswordCheckPasswordType `json:"password_type,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + +const Mt5PasswordCheckPasswordTypeInvestor Mt5PasswordCheckPasswordType = "investor" +const Mt5PasswordCheckPasswordTypeMain Mt5PasswordCheckPasswordType = "main" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5PasswordCheck) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["login"]; raw != nil && !ok { + if v, ok := raw["login"]; !ok || v == nil { return fmt.Errorf("field login in Mt5PasswordCheck: required") } - if _, ok := raw["mt5_password_check"]; raw != nil && !ok { + if v, ok := raw["mt5_password_check"]; !ok || v == nil { return fmt.Errorf("field mt5_password_check in Mt5PasswordCheck: required") } - if _, ok := raw["password"]; raw != nil && !ok { + if v, ok := raw["password"]; !ok || v == nil { return fmt.Errorf("field password in Mt5PasswordCheck: required") } type Plain Mt5PasswordCheck diff --git a/schema/mt5_password_check_resp.go b/schema/mt5_password_check_resp.go index f0de082..457f616 100644 --- a/schema/mt5_password_check_resp.go +++ b/schema/mt5_password_check_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// MT5 user password check receive -type Mt5PasswordCheckResp struct { - // Echo of the request made. - EchoReq Mt5PasswordCheckRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType Mt5PasswordCheckRespMsgType `json:"msg_type"` - - // `1` on success - Mt5PasswordCheck *int `json:"mt5_password_check,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type Mt5PasswordCheckRespEchoReq map[string]interface{} type Mt5PasswordCheckRespMsgType string -const Mt5PasswordCheckRespMsgTypeMt5PasswordCheck Mt5PasswordCheckRespMsgType = "mt5_password_check" - var enumValues_Mt5PasswordCheckRespMsgType = []interface{}{ "mt5_password_check", } @@ -53,16 +35,34 @@ func (j *Mt5PasswordCheckRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// MT5 user password check receive +type Mt5PasswordCheckResp struct { + // Echo of the request made. + EchoReq Mt5PasswordCheckRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType Mt5PasswordCheckRespMsgType `json:"msg_type"` + + // `1` on success + Mt5PasswordCheck *int `json:"mt5_password_check,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const Mt5PasswordCheckRespMsgTypeMt5PasswordCheck Mt5PasswordCheckRespMsgType = "mt5_password_check" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5PasswordCheckResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in Mt5PasswordCheckResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in Mt5PasswordCheckResp: required") } type Plain Mt5PasswordCheckResp diff --git a/schema/mt5_password_reset.go b/schema/mt5_password_reset.go index 85b8d3a..3d9fa09 100644 --- a/schema/mt5_password_reset.go +++ b/schema/mt5_password_reset.go @@ -6,38 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// To reset the password of MT5 account. -type Mt5PasswordReset struct { - // MT5 user login - Login string `json:"login"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - Mt5PasswordReset Mt5PasswordResetMt5PasswordReset `json:"mt5_password_reset"` - - // New password of the account. For validation (Accepts any printable ASCII - // character. Must be within 8-25 characters, and include numbers, lowercase and - // uppercase letters. Must not be the same as the user's email address). - NewPassword string `json:"new_password"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough Mt5PasswordResetPassthrough `json:"passthrough,omitempty"` - - // [Optional] Type of the password to reset. - PasswordType Mt5PasswordResetPasswordType `json:"password_type,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Email verification code (received from a `verify_email` call, which must be - // done first) - VerificationCode string `json:"verification_code"` -} - type Mt5PasswordResetMt5PasswordReset int var enumValues_Mt5PasswordResetMt5PasswordReset = []interface{}{ @@ -70,9 +38,6 @@ type Mt5PasswordResetPassthrough map[string]interface{} type Mt5PasswordResetPasswordType string -const Mt5PasswordResetPasswordTypeInvestor Mt5PasswordResetPasswordType = "investor" -const Mt5PasswordResetPasswordTypeMain Mt5PasswordResetPasswordType = "main" - var enumValues_Mt5PasswordResetPasswordType = []interface{}{ "main", "investor", @@ -98,22 +63,57 @@ func (j *Mt5PasswordResetPasswordType) UnmarshalJSON(b []byte) error { return nil } +// To reset the password of MT5 account. +type Mt5PasswordReset struct { + // MT5 user login + Login string `json:"login"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + Mt5PasswordReset Mt5PasswordResetMt5PasswordReset `json:"mt5_password_reset"` + + // New password of the account. For validation (Accepts any printable ASCII + // character. Must be within 8-25 characters, and include numbers, lowercase and + // uppercase letters. Must not be the same as the user's email address). + NewPassword string `json:"new_password"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough Mt5PasswordResetPassthrough `json:"passthrough,omitempty"` + + // [Optional] Type of the password to reset. + PasswordType Mt5PasswordResetPasswordType `json:"password_type,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Email verification code (received from a `verify_email` call, which must be + // done first) + VerificationCode string `json:"verification_code"` +} + +const Mt5PasswordResetPasswordTypeInvestor Mt5PasswordResetPasswordType = "investor" +const Mt5PasswordResetPasswordTypeMain Mt5PasswordResetPasswordType = "main" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5PasswordReset) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["login"]; raw != nil && !ok { + if v, ok := raw["login"]; !ok || v == nil { return fmt.Errorf("field login in Mt5PasswordReset: required") } - if _, ok := raw["mt5_password_reset"]; raw != nil && !ok { + if v, ok := raw["mt5_password_reset"]; !ok || v == nil { return fmt.Errorf("field mt5_password_reset in Mt5PasswordReset: required") } - if _, ok := raw["new_password"]; raw != nil && !ok { + if v, ok := raw["new_password"]; !ok || v == nil { return fmt.Errorf("field new_password in Mt5PasswordReset: required") } - if _, ok := raw["verification_code"]; raw != nil && !ok { + if v, ok := raw["verification_code"]; !ok || v == nil { return fmt.Errorf("field verification_code in Mt5PasswordReset: required") } type Plain Mt5PasswordReset diff --git a/schema/mt5_password_reset_resp.go b/schema/mt5_password_reset_resp.go index af07c8a..ce83c82 100644 --- a/schema/mt5_password_reset_resp.go +++ b/schema/mt5_password_reset_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// MT5 user password reset receive -type Mt5PasswordResetResp struct { - // Echo of the request made. - EchoReq Mt5PasswordResetRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType Mt5PasswordResetRespMsgType `json:"msg_type"` - - // `1` on success - Mt5PasswordReset *int `json:"mt5_password_reset,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type Mt5PasswordResetRespEchoReq map[string]interface{} type Mt5PasswordResetRespMsgType string -const Mt5PasswordResetRespMsgTypeMt5PasswordReset Mt5PasswordResetRespMsgType = "mt5_password_reset" - var enumValues_Mt5PasswordResetRespMsgType = []interface{}{ "mt5_password_reset", } @@ -53,16 +35,34 @@ func (j *Mt5PasswordResetRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// MT5 user password reset receive +type Mt5PasswordResetResp struct { + // Echo of the request made. + EchoReq Mt5PasswordResetRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType Mt5PasswordResetRespMsgType `json:"msg_type"` + + // `1` on success + Mt5PasswordReset *int `json:"mt5_password_reset,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const Mt5PasswordResetRespMsgTypeMt5PasswordReset Mt5PasswordResetRespMsgType = "mt5_password_reset" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5PasswordResetResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in Mt5PasswordResetResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in Mt5PasswordResetResp: required") } type Plain Mt5PasswordResetResp diff --git a/schema/mt5_withdrawal.go b/schema/mt5_withdrawal.go index 82453a2..07abc35 100644 --- a/schema/mt5_withdrawal.go +++ b/schema/mt5_withdrawal.go @@ -6,6 +6,32 @@ import "encoding/json" import "fmt" import "reflect" +type Mt5WithdrawalMt5Withdrawal int + +var enumValues_Mt5WithdrawalMt5Withdrawal = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *Mt5WithdrawalMt5Withdrawal) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_Mt5WithdrawalMt5Withdrawal { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5WithdrawalMt5Withdrawal, v) + } + *j = Mt5WithdrawalMt5Withdrawal(v) + return nil +} + // This call allows withdrawal from MT5 account to Binary account. type Mt5Withdrawal struct { // Amount to withdraw (in the currency of the MT5 account); min = $1 or an @@ -33,32 +59,6 @@ type Mt5Withdrawal struct { ToBinary string `json:"to_binary"` } -type Mt5WithdrawalMt5Withdrawal int - -var enumValues_Mt5WithdrawalMt5Withdrawal = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5WithdrawalMt5Withdrawal) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5WithdrawalMt5Withdrawal { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5WithdrawalMt5Withdrawal, v) - } - *j = Mt5WithdrawalMt5Withdrawal(v) - return nil -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type Mt5WithdrawalPassthrough map[string]interface{} @@ -69,16 +69,16 @@ func (j *Mt5Withdrawal) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in Mt5Withdrawal: required") } - if _, ok := raw["from_mt5"]; raw != nil && !ok { + if v, ok := raw["from_mt5"]; !ok || v == nil { return fmt.Errorf("field from_mt5 in Mt5Withdrawal: required") } - if _, ok := raw["mt5_withdrawal"]; raw != nil && !ok { + if v, ok := raw["mt5_withdrawal"]; !ok || v == nil { return fmt.Errorf("field mt5_withdrawal in Mt5Withdrawal: required") } - if _, ok := raw["to_binary"]; raw != nil && !ok { + if v, ok := raw["to_binary"]; !ok || v == nil { return fmt.Errorf("field to_binary in Mt5Withdrawal: required") } type Plain Mt5Withdrawal diff --git a/schema/mt5_withdrawal_resp.go b/schema/mt5_withdrawal_resp.go index e61776e..9d64dd2 100644 --- a/schema/mt5_withdrawal_resp.go +++ b/schema/mt5_withdrawal_resp.go @@ -6,32 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of MT5 withdrawal request made. -type Mt5WithdrawalResp struct { - // Deposit reference ID of Binary account. - BinaryTransactionId *int `json:"binary_transaction_id,omitempty"` - - // Echo of the request made. - EchoReq Mt5WithdrawalRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType Mt5WithdrawalRespMsgType `json:"msg_type"` - - // `1` on success - Mt5Withdrawal *int `json:"mt5_withdrawal,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type Mt5WithdrawalRespEchoReq map[string]interface{} type Mt5WithdrawalRespMsgType string -const Mt5WithdrawalRespMsgTypeMt5Withdrawal Mt5WithdrawalRespMsgType = "mt5_withdrawal" - var enumValues_Mt5WithdrawalRespMsgType = []interface{}{ "mt5_withdrawal", } @@ -56,16 +35,37 @@ func (j *Mt5WithdrawalRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of MT5 withdrawal request made. +type Mt5WithdrawalResp struct { + // Deposit reference ID of Binary account. + BinaryTransactionId *int `json:"binary_transaction_id,omitempty"` + + // Echo of the request made. + EchoReq Mt5WithdrawalRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType Mt5WithdrawalRespMsgType `json:"msg_type"` + + // `1` on success + Mt5Withdrawal *int `json:"mt5_withdrawal,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const Mt5WithdrawalRespMsgTypeMt5Withdrawal Mt5WithdrawalRespMsgType = "mt5_withdrawal" + // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5WithdrawalResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in Mt5WithdrawalResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in Mt5WithdrawalResp: required") } type Plain Mt5WithdrawalResp diff --git a/schema/new_account_maltainvest.go b/schema/new_account_maltainvest.go index 3b2bb90..5ca7277 100644 --- a/schema/new_account_maltainvest.go +++ b/schema/new_account_maltainvest.go @@ -174,63 +174,12 @@ type NewAccountMaltainvest struct { type NewAccountMaltainvestAcceptRisk int -var enumValues_NewAccountMaltainvestAcceptRisk = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestAcceptRisk) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_NewAccountMaltainvestAcceptRisk { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestAcceptRisk, v) - } - *j = NewAccountMaltainvestAcceptRisk(v) - return nil -} - type NewAccountMaltainvestAccountOpeningReason string const NewAccountMaltainvestAccountOpeningReasonHedging NewAccountMaltainvestAccountOpeningReason = "Hedging" const NewAccountMaltainvestAccountOpeningReasonIncomeEarning NewAccountMaltainvestAccountOpeningReason = "Income Earning" const NewAccountMaltainvestAccountOpeningReasonSpeculative NewAccountMaltainvestAccountOpeningReason = "Speculative" -var enumValues_NewAccountMaltainvestAccountOpeningReason = []interface{}{ - "Speculative", - "Income Earning", - "Hedging", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestAccountOpeningReason) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_NewAccountMaltainvestAccountOpeningReason { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestAccountOpeningReason, v) - } - *j = NewAccountMaltainvestAccountOpeningReason(v) - return nil -} - type NewAccountMaltainvestAccountTurnover string const NewAccountMaltainvestAccountTurnoverA100001500000 NewAccountMaltainvestAccountTurnover = "$100,001 - $500,000" @@ -239,6 +188,202 @@ const NewAccountMaltainvestAccountTurnoverA50001100000 NewAccountMaltainvestAcco const NewAccountMaltainvestAccountTurnoverLessThan25000 NewAccountMaltainvestAccountTurnover = "Less than $25,000" const NewAccountMaltainvestAccountTurnoverOver500000 NewAccountMaltainvestAccountTurnover = "Over $500,000" +type NewAccountMaltainvestCfdExperience string + +const NewAccountMaltainvestCfdExperienceA12Years NewAccountMaltainvestCfdExperience = "1 - 2 years" +const NewAccountMaltainvestCfdExperienceLessThanAYear NewAccountMaltainvestCfdExperience = "Less than a year" +const NewAccountMaltainvestCfdExperienceNoExperience NewAccountMaltainvestCfdExperience = "No experience" +const NewAccountMaltainvestCfdExperienceOver3Years NewAccountMaltainvestCfdExperience = "Over 3 years" + +type NewAccountMaltainvestCfdFrequency string + +const NewAccountMaltainvestCfdFrequencyA1139TransactionsInThePast12Months NewAccountMaltainvestCfdFrequency = "11 - 39 transactions in the past 12 months" +const NewAccountMaltainvestCfdFrequencyA15TransactionsInThePast12Months NewAccountMaltainvestCfdFrequency = "1 - 5 transactions in the past 12 months" +const NewAccountMaltainvestCfdFrequencyA40TransactionsOrMoreInThePast12Months NewAccountMaltainvestCfdFrequency = "40 transactions or more in the past 12 months" +const NewAccountMaltainvestCfdFrequencyA610TransactionsInThePast12Months NewAccountMaltainvestCfdFrequency = "6 - 10 transactions in the past 12 months" +const NewAccountMaltainvestCfdFrequencyNoTransactionsInThePast12Months NewAccountMaltainvestCfdFrequency = "No transactions in the past 12 months" + +type NewAccountMaltainvestCfdTradingDefinition string + +const NewAccountMaltainvestCfdTradingDefinitionMakeALongTermInvestment NewAccountMaltainvestCfdTradingDefinition = "Make a long-term investment." +const NewAccountMaltainvestCfdTradingDefinitionPlaceABetOnThePriceMovement NewAccountMaltainvestCfdTradingDefinition = "Place a bet on the price movement." +const NewAccountMaltainvestCfdTradingDefinitionPurchaseSharesOfACompanyOrPhysicalCommodities NewAccountMaltainvestCfdTradingDefinition = "Purchase shares of a company or physical commodities." +const NewAccountMaltainvestCfdTradingDefinitionSpeculateOnThePriceMovement NewAccountMaltainvestCfdTradingDefinition = "Speculate on the price movement." + +type NewAccountMaltainvestClientType string + +const NewAccountMaltainvestClientTypeProfessional NewAccountMaltainvestClientType = "professional" +const NewAccountMaltainvestClientTypeRetail NewAccountMaltainvestClientType = "retail" + +type NewAccountMaltainvestEducationLevel string + +const NewAccountMaltainvestEducationLevelPrimary NewAccountMaltainvestEducationLevel = "Primary" +const NewAccountMaltainvestEducationLevelSecondary NewAccountMaltainvestEducationLevel = "Secondary" +const NewAccountMaltainvestEducationLevelTertiary NewAccountMaltainvestEducationLevel = "Tertiary" + +type NewAccountMaltainvestEmploymentIndustry string + +const NewAccountMaltainvestEmploymentIndustryAgriculture NewAccountMaltainvestEmploymentIndustry = "Agriculture" +const NewAccountMaltainvestEmploymentIndustryConstruction NewAccountMaltainvestEmploymentIndustry = "Construction" +const NewAccountMaltainvestEmploymentIndustryEducation NewAccountMaltainvestEmploymentIndustry = "Education" +const NewAccountMaltainvestEmploymentIndustryFinance NewAccountMaltainvestEmploymentIndustry = "Finance" +const NewAccountMaltainvestEmploymentIndustryFoodServices NewAccountMaltainvestEmploymentIndustry = "Food Services" +const NewAccountMaltainvestEmploymentIndustryHealth NewAccountMaltainvestEmploymentIndustry = "Health" +const NewAccountMaltainvestEmploymentIndustryInformationCommunicationsTechnology NewAccountMaltainvestEmploymentIndustry = "Information & Communications Technology" +const NewAccountMaltainvestEmploymentIndustryLegal NewAccountMaltainvestEmploymentIndustry = "Legal" +const NewAccountMaltainvestEmploymentIndustryManufacturing NewAccountMaltainvestEmploymentIndustry = "Manufacturing" +const NewAccountMaltainvestEmploymentIndustryRealEstate NewAccountMaltainvestEmploymentIndustry = "Real Estate" +const NewAccountMaltainvestEmploymentIndustryScienceEngineering NewAccountMaltainvestEmploymentIndustry = "Science & Engineering" +const NewAccountMaltainvestEmploymentIndustrySocialCultural NewAccountMaltainvestEmploymentIndustry = "Social & Cultural" +const NewAccountMaltainvestEmploymentIndustryTourism NewAccountMaltainvestEmploymentIndustry = "Tourism" +const NewAccountMaltainvestEmploymentIndustryUnemployed NewAccountMaltainvestEmploymentIndustry = "Unemployed" + +type NewAccountMaltainvestEmploymentStatus string + +const NewAccountMaltainvestEmploymentStatusEmployed NewAccountMaltainvestEmploymentStatus = "Employed" +const NewAccountMaltainvestEmploymentStatusPensioner NewAccountMaltainvestEmploymentStatus = "Pensioner" +const NewAccountMaltainvestEmploymentStatusSelfEmployed NewAccountMaltainvestEmploymentStatus = "Self-Employed" +const NewAccountMaltainvestEmploymentStatusStudent NewAccountMaltainvestEmploymentStatus = "Student" +const NewAccountMaltainvestEmploymentStatusUnemployed NewAccountMaltainvestEmploymentStatus = "Unemployed" + +type NewAccountMaltainvestEstimatedWorth string + +const NewAccountMaltainvestEstimatedWorthA100000250000 NewAccountMaltainvestEstimatedWorth = "$100,000 - $250,000" +const NewAccountMaltainvestEstimatedWorthA250001500000 NewAccountMaltainvestEstimatedWorth = "$250,001 - $500,000" +const NewAccountMaltainvestEstimatedWorthA5000011000000 NewAccountMaltainvestEstimatedWorth = "$500,001 - $1,000,000" +const NewAccountMaltainvestEstimatedWorthLessThan100000 NewAccountMaltainvestEstimatedWorth = "Less than $100,000" +const NewAccountMaltainvestEstimatedWorthOver1000000 NewAccountMaltainvestEstimatedWorth = "Over $1,000,000" + +type NewAccountMaltainvestFatcaDeclaration int + +type NewAccountMaltainvestIncomeSource string + +const NewAccountMaltainvestIncomeSourceInvestmentsDividends NewAccountMaltainvestIncomeSource = "Investments & Dividends" +const NewAccountMaltainvestIncomeSourcePension NewAccountMaltainvestIncomeSource = "Pension" +const NewAccountMaltainvestIncomeSourceSalariedEmployee NewAccountMaltainvestIncomeSource = "Salaried Employee" +const NewAccountMaltainvestIncomeSourceSavingsInheritance NewAccountMaltainvestIncomeSource = "Savings & Inheritance" +const NewAccountMaltainvestIncomeSourceSelfEmployed NewAccountMaltainvestIncomeSource = "Self-Employed" +const NewAccountMaltainvestIncomeSourceStateBenefits NewAccountMaltainvestIncomeSource = "State Benefits" + +type NewAccountMaltainvestLeverageImpactTrading string + +const NewAccountMaltainvestLeverageImpactTradingLeverageGuaranteesProfits NewAccountMaltainvestLeverageImpactTrading = "Leverage guarantees profits." +const NewAccountMaltainvestLeverageImpactTradingLeverageIsARiskMitigationTechnique NewAccountMaltainvestLeverageImpactTrading = "Leverage is a risk mitigation technique." +const NewAccountMaltainvestLeverageImpactTradingLeverageLetsYouOpenLargerPositionsForAFractionOfTheTradeSValue NewAccountMaltainvestLeverageImpactTrading = "Leverage lets you open larger positions for a fraction of the trade's value." +const NewAccountMaltainvestLeverageImpactTradingLeveragePreventsYouFromOpeningLargePositions NewAccountMaltainvestLeverageImpactTrading = "Leverage prevents you from opening large positions." + +type NewAccountMaltainvestLeverageTradingHighRiskStopLoss string + +const NewAccountMaltainvestLeverageTradingHighRiskStopLossCancelYourTradeAtAnyTimeWithinAChosenTimeframe NewAccountMaltainvestLeverageTradingHighRiskStopLoss = "Cancel your trade at any time within a chosen timeframe." +const NewAccountMaltainvestLeverageTradingHighRiskStopLossCloseYourTradeAutomaticallyWhenTheLossIsMoreThanOrEqualToASpecificAmount NewAccountMaltainvestLeverageTradingHighRiskStopLoss = "Close your trade automatically when the loss is more than or equal to a specific amount." +const NewAccountMaltainvestLeverageTradingHighRiskStopLossCloseYourTradeAutomaticallyWhenTheProfitIsMoreThanOrEqualToASpecificAmount NewAccountMaltainvestLeverageTradingHighRiskStopLoss = "Close your trade automatically when the profit is more than or equal to a specific amount." +const NewAccountMaltainvestLeverageTradingHighRiskStopLossMakeAGuaranteedProfitOnYourTrade NewAccountMaltainvestLeverageTradingHighRiskStopLoss = "Make a guaranteed profit on your trade." + +type NewAccountMaltainvestNetIncome string + +const NewAccountMaltainvestNetIncomeA100001500000 NewAccountMaltainvestNetIncome = "$100,001 - $500,000" +const NewAccountMaltainvestNetIncomeA2500050000 NewAccountMaltainvestNetIncome = "$25,000 - $50,000" +const NewAccountMaltainvestNetIncomeA50001100000 NewAccountMaltainvestNetIncome = "$50,001 - $100,000" +const NewAccountMaltainvestNetIncomeLessThan25000 NewAccountMaltainvestNetIncome = "Less than $25,000" +const NewAccountMaltainvestNetIncomeOver500000 NewAccountMaltainvestNetIncome = "Over $500,000" + +type NewAccountMaltainvestNewAccountMaltainvest int + +type NewAccountMaltainvestOccupation string + +const NewAccountMaltainvestOccupationAgriculturalForestryAndFisheryWorkers NewAccountMaltainvestOccupation = "Agricultural, Forestry and Fishery Workers" +const NewAccountMaltainvestOccupationArmedForces NewAccountMaltainvestOccupation = "Armed Forces" +const NewAccountMaltainvestOccupationChiefExecutivesSeniorOfficialsAndLegislators NewAccountMaltainvestOccupation = "Chief Executives, Senior Officials and Legislators" +const NewAccountMaltainvestOccupationCleanersAndHelpers NewAccountMaltainvestOccupation = "Cleaners and Helpers" +const NewAccountMaltainvestOccupationClerks NewAccountMaltainvestOccupation = "Clerks" +const NewAccountMaltainvestOccupationCraftMetalElectricalAndElectronicsWorkers NewAccountMaltainvestOccupation = "Craft, Metal, Electrical and Electronics Workers" +const NewAccountMaltainvestOccupationGovernmentOfficers NewAccountMaltainvestOccupation = "Government Officers" +const NewAccountMaltainvestOccupationManagers NewAccountMaltainvestOccupation = "Managers" +const NewAccountMaltainvestOccupationMiningConstructionManufacturingAndTransportWorkers NewAccountMaltainvestOccupation = "Mining, Construction, Manufacturing and Transport Workers" +const NewAccountMaltainvestOccupationPersonalCareSalesAndServiceWorkers NewAccountMaltainvestOccupation = "Personal Care, Sales and Service Workers" +const NewAccountMaltainvestOccupationPlantAndMachineOperatorsAndAssemblers NewAccountMaltainvestOccupation = "Plant and Machine Operators and Assemblers" +const NewAccountMaltainvestOccupationProfessionals NewAccountMaltainvestOccupation = "Professionals" +const NewAccountMaltainvestOccupationStudents NewAccountMaltainvestOccupation = "Students" +const NewAccountMaltainvestOccupationUnemployed NewAccountMaltainvestOccupation = "Unemployed" + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type NewAccountMaltainvestPassthrough map[string]interface{} + +type NewAccountMaltainvestRequiredInitialMargin string + +const NewAccountMaltainvestRequiredInitialMarginAllOfTheAbove NewAccountMaltainvestRequiredInitialMargin = "All of the above." +const NewAccountMaltainvestRequiredInitialMarginWhenBuyingSharesOfACompany NewAccountMaltainvestRequiredInitialMargin = "When buying shares of a company." +const NewAccountMaltainvestRequiredInitialMarginWhenOpeningALeveragedCFDTrade NewAccountMaltainvestRequiredInitialMargin = "When opening a Leveraged CFD trade." +const NewAccountMaltainvestRequiredInitialMarginWhenTradingMultipliers NewAccountMaltainvestRequiredInitialMargin = "When trading Multipliers." + +type NewAccountMaltainvestResidentSelfDeclaration int + +type NewAccountMaltainvestRiskTolerance string + +const NewAccountMaltainvestRiskToleranceNo NewAccountMaltainvestRiskTolerance = "No" +const NewAccountMaltainvestRiskToleranceYes NewAccountMaltainvestRiskTolerance = "Yes" + +type NewAccountMaltainvestSalutation string + +const NewAccountMaltainvestSalutationMiss NewAccountMaltainvestSalutation = "Miss" +const NewAccountMaltainvestSalutationMr NewAccountMaltainvestSalutation = "Mr" +const NewAccountMaltainvestSalutationMrs NewAccountMaltainvestSalutation = "Mrs" +const NewAccountMaltainvestSalutationMs NewAccountMaltainvestSalutation = "Ms" + +type NewAccountMaltainvestSecretQuestion string + +const NewAccountMaltainvestSecretQuestionBrandOfFirstCar NewAccountMaltainvestSecretQuestion = "Brand of first car" +const NewAccountMaltainvestSecretQuestionFavouriteArtist NewAccountMaltainvestSecretQuestion = "Favourite artist" +const NewAccountMaltainvestSecretQuestionFavouriteDish NewAccountMaltainvestSecretQuestion = "Favourite dish" +const NewAccountMaltainvestSecretQuestionMemorableDate NewAccountMaltainvestSecretQuestion = "Memorable date" +const NewAccountMaltainvestSecretQuestionMemorableTownCity NewAccountMaltainvestSecretQuestion = "Memorable town/city" +const NewAccountMaltainvestSecretQuestionMotherSMaidenName NewAccountMaltainvestSecretQuestion = "Mother's maiden name" +const NewAccountMaltainvestSecretQuestionNameOfFirstLove NewAccountMaltainvestSecretQuestion = "Name of first love" +const NewAccountMaltainvestSecretQuestionNameOfYourPet NewAccountMaltainvestSecretQuestion = "Name of your pet" + +type NewAccountMaltainvestSourceOfExperience string + +const NewAccountMaltainvestSourceOfExperienceIHaveAnAcademicDegreeProfessionalCertificationAndOrWorkExperience NewAccountMaltainvestSourceOfExperience = "I have an academic degree, professional certification, and/or work experience." +const NewAccountMaltainvestSourceOfExperienceIHaveAttendedSeminarsTrainingAndOrWorkshops NewAccountMaltainvestSourceOfExperience = "I have attended seminars, training, and/or workshops." +const NewAccountMaltainvestSourceOfExperienceIHaveLittleExperience NewAccountMaltainvestSourceOfExperience = "I have little experience." +const NewAccountMaltainvestSourceOfExperienceIHaveNoKnowledge NewAccountMaltainvestSourceOfExperience = "I have no knowledge." +const NewAccountMaltainvestSourceOfExperienceITradeForexCFDsAndOtherComplexFinancialInstruments NewAccountMaltainvestSourceOfExperience = "I trade forex CFDs and other complex financial instruments." + +type NewAccountMaltainvestSourceOfWealth string + +const NewAccountMaltainvestSourceOfWealthAccumulationOfIncomeSavings NewAccountMaltainvestSourceOfWealth = "Accumulation of Income/Savings" +const NewAccountMaltainvestSourceOfWealthCashBusiness NewAccountMaltainvestSourceOfWealth = "Cash Business" +const NewAccountMaltainvestSourceOfWealthCompanyOwnership NewAccountMaltainvestSourceOfWealth = "Company Ownership" +const NewAccountMaltainvestSourceOfWealthDivorceSettlement NewAccountMaltainvestSourceOfWealth = "Divorce Settlement" +const NewAccountMaltainvestSourceOfWealthInheritance NewAccountMaltainvestSourceOfWealth = "Inheritance" +const NewAccountMaltainvestSourceOfWealthInvestmentIncome NewAccountMaltainvestSourceOfWealth = "Investment Income" +const NewAccountMaltainvestSourceOfWealthSaleOfProperty NewAccountMaltainvestSourceOfWealth = "Sale of Property" + +type NewAccountMaltainvestTradingExperienceFinancialInstruments string + +const NewAccountMaltainvestTradingExperienceFinancialInstrumentsA12Years NewAccountMaltainvestTradingExperienceFinancialInstruments = "1 - 2 years" +const NewAccountMaltainvestTradingExperienceFinancialInstrumentsLessThanAYear NewAccountMaltainvestTradingExperienceFinancialInstruments = "Less than a year" +const NewAccountMaltainvestTradingExperienceFinancialInstrumentsNoExperience NewAccountMaltainvestTradingExperienceFinancialInstruments = "No experience" +const NewAccountMaltainvestTradingExperienceFinancialInstrumentsOver3Years NewAccountMaltainvestTradingExperienceFinancialInstruments = "Over 3 years" + +type NewAccountMaltainvestTradingFrequencyFinancialInstruments string + +const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsA1139TransactionsInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "11 - 39 transactions in the past 12 months" +const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsA15TransactionsInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "1 - 5 transactions in the past 12 months" +const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsA40TransactionsOrMoreInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "40 transactions or more in the past 12 months" +const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsA610TransactionsInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "6 - 10 transactions in the past 12 months" +const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsNoTransactionsInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "No transactions in the past 12 months" + +var enumValues_NewAccountMaltainvestAcceptRisk = []interface{}{ + 0, + 1, +} +var enumValues_NewAccountMaltainvestAccountOpeningReason = []interface{}{ + "Speculative", + "Income Earning", + "Hedging", +} var enumValues_NewAccountMaltainvestAccountTurnover = []interface{}{ "Less than $25,000", "$25,000 - $50,000", @@ -246,881 +391,720 @@ var enumValues_NewAccountMaltainvestAccountTurnover = []interface{}{ "$100,001 - $500,000", "Over $500,000", } +var enumValues_NewAccountMaltainvestCfdExperience = []interface{}{ + "No experience", + "Less than a year", + "1 - 2 years", + "Over 3 years", +} +var enumValues_NewAccountMaltainvestCfdFrequency = []interface{}{ + "No transactions in the past 12 months", + "1 - 5 transactions in the past 12 months", + "6 - 10 transactions in the past 12 months", + "11 - 39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} +var enumValues_NewAccountMaltainvestCfdTradingDefinition = []interface{}{ + "Purchase shares of a company or physical commodities.", + "Place a bet on the price movement.", + "Speculate on the price movement.", + "Make a long-term investment.", +} +var enumValues_NewAccountMaltainvestClientType = []interface{}{ + "professional", + "retail", +} +var enumValues_NewAccountMaltainvestEducationLevel = []interface{}{ + "Primary", + "Secondary", + "Tertiary", +} +var enumValues_NewAccountMaltainvestEmploymentIndustry = []interface{}{ + "Construction", + "Education", + "Finance", + "Health", + "Tourism", + "Information & Communications Technology", + "Science & Engineering", + "Legal", + "Social & Cultural", + "Agriculture", + "Real Estate", + "Food Services", + "Manufacturing", + "Unemployed", +} +var enumValues_NewAccountMaltainvestEmploymentStatus = []interface{}{ + "Employed", + "Pensioner", + "Self-Employed", + "Student", + "Unemployed", +} +var enumValues_NewAccountMaltainvestEstimatedWorth = []interface{}{ + "Less than $100,000", + "$100,000 - $250,000", + "$250,001 - $500,000", + "$500,001 - $1,000,000", + "Over $1,000,000", +} +var enumValues_NewAccountMaltainvestFatcaDeclaration = []interface{}{ + 0, + 1, +} +var enumValues_NewAccountMaltainvestIncomeSource = []interface{}{ + "Salaried Employee", + "Self-Employed", + "Investments & Dividends", + "Pension", + "State Benefits", + "Savings & Inheritance", +} +var enumValues_NewAccountMaltainvestLeverageImpactTrading = []interface{}{ + "Leverage is a risk mitigation technique.", + "Leverage prevents you from opening large positions.", + "Leverage guarantees profits.", + "Leverage lets you open larger positions for a fraction of the trade's value.", +} +var enumValues_NewAccountMaltainvestLeverageTradingHighRiskStopLoss = []interface{}{ + "Cancel your trade at any time within a chosen timeframe.", + "Close your trade automatically when the loss is more than or equal to a specific amount.", + "Close your trade automatically when the profit is more than or equal to a specific amount.", + "Make a guaranteed profit on your trade.", +} +var enumValues_NewAccountMaltainvestNetIncome = []interface{}{ + "Less than $25,000", + "$25,000 - $50,000", + "$50,001 - $100,000", + "$100,001 - $500,000", + "Over $500,000", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestAccountTurnover) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestRiskTolerance) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestAccountTurnover { + for _, expected := range enumValues_NewAccountMaltainvestRiskTolerance { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestAccountTurnover, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestRiskTolerance, v) } - *j = NewAccountMaltainvestAccountTurnover(v) + *j = NewAccountMaltainvestRiskTolerance(v) return nil } -type NewAccountMaltainvestCfdExperience string - -const NewAccountMaltainvestCfdExperienceA12Years NewAccountMaltainvestCfdExperience = "1 - 2 years" -const NewAccountMaltainvestCfdExperienceLessThanAYear NewAccountMaltainvestCfdExperience = "Less than a year" -const NewAccountMaltainvestCfdExperienceNoExperience NewAccountMaltainvestCfdExperience = "No experience" -const NewAccountMaltainvestCfdExperienceOver3Years NewAccountMaltainvestCfdExperience = "Over 3 years" - -var enumValues_NewAccountMaltainvestCfdExperience = []interface{}{ - "No experience", - "Less than a year", - "1 - 2 years", - "Over 3 years", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestCfdExperience) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestIncomeSource) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestCfdExperience { + for _, expected := range enumValues_NewAccountMaltainvestIncomeSource { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestIncomeSource, v) } - *j = NewAccountMaltainvestCfdExperience(v) + *j = NewAccountMaltainvestIncomeSource(v) return nil } -type NewAccountMaltainvestCfdFrequency string - -const NewAccountMaltainvestCfdFrequencyA1139TransactionsInThePast12Months NewAccountMaltainvestCfdFrequency = "11 - 39 transactions in the past 12 months" -const NewAccountMaltainvestCfdFrequencyA15TransactionsInThePast12Months NewAccountMaltainvestCfdFrequency = "1 - 5 transactions in the past 12 months" -const NewAccountMaltainvestCfdFrequencyA40TransactionsOrMoreInThePast12Months NewAccountMaltainvestCfdFrequency = "40 transactions or more in the past 12 months" -const NewAccountMaltainvestCfdFrequencyA610TransactionsInThePast12Months NewAccountMaltainvestCfdFrequency = "6 - 10 transactions in the past 12 months" -const NewAccountMaltainvestCfdFrequencyNoTransactionsInThePast12Months NewAccountMaltainvestCfdFrequency = "No transactions in the past 12 months" - -var enumValues_NewAccountMaltainvestCfdFrequency = []interface{}{ - "No transactions in the past 12 months", - "1 - 5 transactions in the past 12 months", - "6 - 10 transactions in the past 12 months", - "11 - 39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestCfdFrequency) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestOccupation) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestCfdFrequency { + for _, expected := range enumValues_NewAccountMaltainvestOccupation { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestOccupation, v) } - *j = NewAccountMaltainvestCfdFrequency(v) + *j = NewAccountMaltainvestOccupation(v) return nil } -type NewAccountMaltainvestCfdTradingDefinition string - -const NewAccountMaltainvestCfdTradingDefinitionMakeALongTermInvestment NewAccountMaltainvestCfdTradingDefinition = "Make a long-term investment." -const NewAccountMaltainvestCfdTradingDefinitionPlaceABetOnThePriceMovement NewAccountMaltainvestCfdTradingDefinition = "Place a bet on the price movement." -const NewAccountMaltainvestCfdTradingDefinitionPurchaseSharesOfACompanyOrPhysicalCommodities NewAccountMaltainvestCfdTradingDefinition = "Purchase shares of a company or physical commodities." -const NewAccountMaltainvestCfdTradingDefinitionSpeculateOnThePriceMovement NewAccountMaltainvestCfdTradingDefinition = "Speculate on the price movement." - -var enumValues_NewAccountMaltainvestCfdTradingDefinition = []interface{}{ - "Purchase shares of a company or physical commodities.", - "Place a bet on the price movement.", - "Speculate on the price movement.", - "Make a long-term investment.", +var enumValues_NewAccountMaltainvestOccupation = []interface{}{ + "Chief Executives, Senior Officials and Legislators", + "Managers", + "Professionals", + "Clerks", + "Personal Care, Sales and Service Workers", + "Agricultural, Forestry and Fishery Workers", + "Craft, Metal, Electrical and Electronics Workers", + "Plant and Machine Operators and Assemblers", + "Cleaners and Helpers", + "Mining, Construction, Manufacturing and Transport Workers", + "Armed Forces", + "Government Officers", + "Students", + "Unemployed", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestCfdTradingDefinition) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestEstimatedWorth) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestCfdTradingDefinition { + for _, expected := range enumValues_NewAccountMaltainvestEstimatedWorth { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdTradingDefinition, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEstimatedWorth, v) } - *j = NewAccountMaltainvestCfdTradingDefinition(v) + *j = NewAccountMaltainvestEstimatedWorth(v) return nil } -type NewAccountMaltainvestClientType string - -const NewAccountMaltainvestClientTypeProfessional NewAccountMaltainvestClientType = "professional" -const NewAccountMaltainvestClientTypeRetail NewAccountMaltainvestClientType = "retail" - -var enumValues_NewAccountMaltainvestClientType = []interface{}{ - "professional", - "retail", +var enumValues_NewAccountMaltainvestSourceOfExperience = []interface{}{ + "I have an academic degree, professional certification, and/or work experience.", + "I trade forex CFDs and other complex financial instruments.", + "I have attended seminars, training, and/or workshops.", + "I have little experience.", + "I have no knowledge.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestClientType) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestSourceOfExperience) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestClientType { + for _, expected := range enumValues_NewAccountMaltainvestSourceOfExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestClientType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSourceOfExperience, v) } - *j = NewAccountMaltainvestClientType(v) + *j = NewAccountMaltainvestSourceOfExperience(v) return nil } -type NewAccountMaltainvestEducationLevel string - -const NewAccountMaltainvestEducationLevelPrimary NewAccountMaltainvestEducationLevel = "Primary" -const NewAccountMaltainvestEducationLevelSecondary NewAccountMaltainvestEducationLevel = "Secondary" -const NewAccountMaltainvestEducationLevelTertiary NewAccountMaltainvestEducationLevel = "Tertiary" - -var enumValues_NewAccountMaltainvestEducationLevel = []interface{}{ - "Primary", - "Secondary", - "Tertiary", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestEducationLevel) UnmarshalJSON(b []byte) error { - var v string +func (j *NewAccountMaltainvestNewAccountMaltainvest) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestEducationLevel { + for _, expected := range enumValues_NewAccountMaltainvestNewAccountMaltainvest { if reflect.DeepEqual(v, expected) { ok = true break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEducationLevel, v) - } - *j = NewAccountMaltainvestEducationLevel(v) - return nil -} - -type NewAccountMaltainvestEmploymentIndustry string - -const NewAccountMaltainvestEmploymentIndustryAgriculture NewAccountMaltainvestEmploymentIndustry = "Agriculture" -const NewAccountMaltainvestEmploymentIndustryConstruction NewAccountMaltainvestEmploymentIndustry = "Construction" -const NewAccountMaltainvestEmploymentIndustryEducation NewAccountMaltainvestEmploymentIndustry = "Education" -const NewAccountMaltainvestEmploymentIndustryFinance NewAccountMaltainvestEmploymentIndustry = "Finance" -const NewAccountMaltainvestEmploymentIndustryFoodServices NewAccountMaltainvestEmploymentIndustry = "Food Services" -const NewAccountMaltainvestEmploymentIndustryHealth NewAccountMaltainvestEmploymentIndustry = "Health" -const NewAccountMaltainvestEmploymentIndustryInformationCommunicationsTechnology NewAccountMaltainvestEmploymentIndustry = "Information & Communications Technology" -const NewAccountMaltainvestEmploymentIndustryLegal NewAccountMaltainvestEmploymentIndustry = "Legal" -const NewAccountMaltainvestEmploymentIndustryManufacturing NewAccountMaltainvestEmploymentIndustry = "Manufacturing" -const NewAccountMaltainvestEmploymentIndustryRealEstate NewAccountMaltainvestEmploymentIndustry = "Real Estate" -const NewAccountMaltainvestEmploymentIndustryScienceEngineering NewAccountMaltainvestEmploymentIndustry = "Science & Engineering" -const NewAccountMaltainvestEmploymentIndustrySocialCultural NewAccountMaltainvestEmploymentIndustry = "Social & Cultural" -const NewAccountMaltainvestEmploymentIndustryTourism NewAccountMaltainvestEmploymentIndustry = "Tourism" -const NewAccountMaltainvestEmploymentIndustryUnemployed NewAccountMaltainvestEmploymentIndustry = "Unemployed" - -var enumValues_NewAccountMaltainvestEmploymentIndustry = []interface{}{ - "Construction", - "Education", - "Finance", - "Health", - "Tourism", - "Information & Communications Technology", - "Science & Engineering", - "Legal", - "Social & Cultural", - "Agriculture", - "Real Estate", - "Food Services", - "Manufacturing", - "Unemployed", + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestNewAccountMaltainvest, v) + } + *j = NewAccountMaltainvestNewAccountMaltainvest(v) + return nil +} + +var enumValues_NewAccountMaltainvestNewAccountMaltainvest = []interface{}{ + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestEmploymentIndustry) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestLeverageImpactTrading) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestEmploymentIndustry { + for _, expected := range enumValues_NewAccountMaltainvestLeverageImpactTrading { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEmploymentIndustry, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestLeverageImpactTrading, v) } - *j = NewAccountMaltainvestEmploymentIndustry(v) + *j = NewAccountMaltainvestLeverageImpactTrading(v) return nil } -type NewAccountMaltainvestEmploymentStatus string - -const NewAccountMaltainvestEmploymentStatusEmployed NewAccountMaltainvestEmploymentStatus = "Employed" -const NewAccountMaltainvestEmploymentStatusPensioner NewAccountMaltainvestEmploymentStatus = "Pensioner" -const NewAccountMaltainvestEmploymentStatusSelfEmployed NewAccountMaltainvestEmploymentStatus = "Self-Employed" -const NewAccountMaltainvestEmploymentStatusStudent NewAccountMaltainvestEmploymentStatus = "Student" -const NewAccountMaltainvestEmploymentStatusUnemployed NewAccountMaltainvestEmploymentStatus = "Unemployed" - -var enumValues_NewAccountMaltainvestEmploymentStatus = []interface{}{ - "Employed", - "Pensioner", - "Self-Employed", - "Student", - "Unemployed", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestEmploymentStatus) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestSecretQuestion) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestEmploymentStatus { + for _, expected := range enumValues_NewAccountMaltainvestSecretQuestion { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEmploymentStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSecretQuestion, v) } - *j = NewAccountMaltainvestEmploymentStatus(v) + *j = NewAccountMaltainvestSecretQuestion(v) return nil } -type NewAccountMaltainvestEstimatedWorth string - -const NewAccountMaltainvestEstimatedWorthA100000250000 NewAccountMaltainvestEstimatedWorth = "$100,000 - $250,000" -const NewAccountMaltainvestEstimatedWorthA250001500000 NewAccountMaltainvestEstimatedWorth = "$250,001 - $500,000" -const NewAccountMaltainvestEstimatedWorthA5000011000000 NewAccountMaltainvestEstimatedWorth = "$500,001 - $1,000,000" -const NewAccountMaltainvestEstimatedWorthLessThan100000 NewAccountMaltainvestEstimatedWorth = "Less than $100,000" -const NewAccountMaltainvestEstimatedWorthOver1000000 NewAccountMaltainvestEstimatedWorth = "Over $1,000,000" - -var enumValues_NewAccountMaltainvestEstimatedWorth = []interface{}{ - "Less than $100,000", - "$100,000 - $250,000", - "$250,001 - $500,000", - "$500,001 - $1,000,000", - "Over $1,000,000", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestEstimatedWorth) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestLeverageTradingHighRiskStopLoss) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestEstimatedWorth { + for _, expected := range enumValues_NewAccountMaltainvestLeverageTradingHighRiskStopLoss { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEstimatedWorth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestLeverageTradingHighRiskStopLoss, v) } - *j = NewAccountMaltainvestEstimatedWorth(v) + *j = NewAccountMaltainvestLeverageTradingHighRiskStopLoss(v) return nil } -type NewAccountMaltainvestFatcaDeclaration int - -var enumValues_NewAccountMaltainvestFatcaDeclaration = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestFatcaDeclaration) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestAcceptRisk) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestFatcaDeclaration { + for _, expected := range enumValues_NewAccountMaltainvestAcceptRisk { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestFatcaDeclaration, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestAcceptRisk, v) } - *j = NewAccountMaltainvestFatcaDeclaration(v) + *j = NewAccountMaltainvestAcceptRisk(v) return nil } -type NewAccountMaltainvestIncomeSource string - -const NewAccountMaltainvestIncomeSourceInvestmentsDividends NewAccountMaltainvestIncomeSource = "Investments & Dividends" -const NewAccountMaltainvestIncomeSourcePension NewAccountMaltainvestIncomeSource = "Pension" -const NewAccountMaltainvestIncomeSourceSalariedEmployee NewAccountMaltainvestIncomeSource = "Salaried Employee" -const NewAccountMaltainvestIncomeSourceSavingsInheritance NewAccountMaltainvestIncomeSource = "Savings & Inheritance" -const NewAccountMaltainvestIncomeSourceSelfEmployed NewAccountMaltainvestIncomeSource = "Self-Employed" -const NewAccountMaltainvestIncomeSourceStateBenefits NewAccountMaltainvestIncomeSource = "State Benefits" - -var enumValues_NewAccountMaltainvestIncomeSource = []interface{}{ - "Salaried Employee", - "Self-Employed", - "Investments & Dividends", - "Pension", - "State Benefits", - "Savings & Inheritance", +var enumValues_NewAccountMaltainvestSourceOfWealth = []interface{}{ + "Accumulation of Income/Savings", + "Cash Business", + "Company Ownership", + "Divorce Settlement", + "Inheritance", + "Investment Income", + "Sale of Property", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestIncomeSource) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestSourceOfWealth) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestIncomeSource { + for _, expected := range enumValues_NewAccountMaltainvestSourceOfWealth { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestIncomeSource, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSourceOfWealth, v) } - *j = NewAccountMaltainvestIncomeSource(v) + *j = NewAccountMaltainvestSourceOfWealth(v) return nil } -type NewAccountMaltainvestLeverageImpactTrading string - -const NewAccountMaltainvestLeverageImpactTradingLeverageGuaranteesProfits NewAccountMaltainvestLeverageImpactTrading = "Leverage guarantees profits." -const NewAccountMaltainvestLeverageImpactTradingLeverageIsARiskMitigationTechnique NewAccountMaltainvestLeverageImpactTrading = "Leverage is a risk mitigation technique." -const NewAccountMaltainvestLeverageImpactTradingLeverageLetsYouOpenLargerPositionsForAFractionOfTheTradeSValue NewAccountMaltainvestLeverageImpactTrading = "Leverage lets you open larger positions for a fraction of the trade's value." -const NewAccountMaltainvestLeverageImpactTradingLeveragePreventsYouFromOpeningLargePositions NewAccountMaltainvestLeverageImpactTrading = "Leverage prevents you from opening large positions." - -var enumValues_NewAccountMaltainvestLeverageImpactTrading = []interface{}{ - "Leverage is a risk mitigation technique.", - "Leverage prevents you from opening large positions.", - "Leverage guarantees profits.", - "Leverage lets you open larger positions for a fraction of the trade's value.", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestLeverageImpactTrading) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestNetIncome) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestLeverageImpactTrading { + for _, expected := range enumValues_NewAccountMaltainvestNetIncome { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestLeverageImpactTrading, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestNetIncome, v) } - *j = NewAccountMaltainvestLeverageImpactTrading(v) + *j = NewAccountMaltainvestNetIncome(v) return nil } -type NewAccountMaltainvestLeverageTradingHighRiskStopLoss string - -const NewAccountMaltainvestLeverageTradingHighRiskStopLossCancelYourTradeAtAnyTimeWithinAChosenTimeframe NewAccountMaltainvestLeverageTradingHighRiskStopLoss = "Cancel your trade at any time within a chosen timeframe." -const NewAccountMaltainvestLeverageTradingHighRiskStopLossCloseYourTradeAutomaticallyWhenTheLossIsMoreThanOrEqualToASpecificAmount NewAccountMaltainvestLeverageTradingHighRiskStopLoss = "Close your trade automatically when the loss is more than or equal to a specific amount." -const NewAccountMaltainvestLeverageTradingHighRiskStopLossCloseYourTradeAutomaticallyWhenTheProfitIsMoreThanOrEqualToASpecificAmount NewAccountMaltainvestLeverageTradingHighRiskStopLoss = "Close your trade automatically when the profit is more than or equal to a specific amount." -const NewAccountMaltainvestLeverageTradingHighRiskStopLossMakeAGuaranteedProfitOnYourTrade NewAccountMaltainvestLeverageTradingHighRiskStopLoss = "Make a guaranteed profit on your trade." - -var enumValues_NewAccountMaltainvestLeverageTradingHighRiskStopLoss = []interface{}{ - "Cancel your trade at any time within a chosen timeframe.", - "Close your trade automatically when the loss is more than or equal to a specific amount.", - "Close your trade automatically when the profit is more than or equal to a specific amount.", - "Make a guaranteed profit on your trade.", +var enumValues_NewAccountMaltainvestSecretQuestion = []interface{}{ + "Mother's maiden name", + "Name of your pet", + "Name of first love", + "Memorable town/city", + "Memorable date", + "Favourite dish", + "Brand of first car", + "Favourite artist", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestLeverageTradingHighRiskStopLoss) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestAccountOpeningReason) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestLeverageTradingHighRiskStopLoss { + for _, expected := range enumValues_NewAccountMaltainvestAccountOpeningReason { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestLeverageTradingHighRiskStopLoss, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestAccountOpeningReason, v) } - *j = NewAccountMaltainvestLeverageTradingHighRiskStopLoss(v) + *j = NewAccountMaltainvestAccountOpeningReason(v) return nil } -type NewAccountMaltainvestNetIncome string - -const NewAccountMaltainvestNetIncomeA100001500000 NewAccountMaltainvestNetIncome = "$100,001 - $500,000" -const NewAccountMaltainvestNetIncomeA2500050000 NewAccountMaltainvestNetIncome = "$25,000 - $50,000" -const NewAccountMaltainvestNetIncomeA50001100000 NewAccountMaltainvestNetIncome = "$50,001 - $100,000" -const NewAccountMaltainvestNetIncomeLessThan25000 NewAccountMaltainvestNetIncome = "Less than $25,000" -const NewAccountMaltainvestNetIncomeOver500000 NewAccountMaltainvestNetIncome = "Over $500,000" - -var enumValues_NewAccountMaltainvestNetIncome = []interface{}{ - "Less than $25,000", - "$25,000 - $50,000", - "$50,001 - $100,000", - "$100,001 - $500,000", - "Over $500,000", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestNetIncome) UnmarshalJSON(b []byte) error { - var v string +func (j *NewAccountMaltainvestFatcaDeclaration) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestNetIncome { + for _, expected := range enumValues_NewAccountMaltainvestFatcaDeclaration { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestNetIncome, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestFatcaDeclaration, v) } - *j = NewAccountMaltainvestNetIncome(v) + *j = NewAccountMaltainvestFatcaDeclaration(v) return nil } -type NewAccountMaltainvestNewAccountMaltainvest int - -var enumValues_NewAccountMaltainvestNewAccountMaltainvest = []interface{}{ - 1, +var enumValues_NewAccountMaltainvestRiskTolerance = []interface{}{ + "Yes", + "No", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestNewAccountMaltainvest) UnmarshalJSON(b []byte) error { - var v int +func (j *NewAccountMaltainvestEmploymentStatus) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestNewAccountMaltainvest { + for _, expected := range enumValues_NewAccountMaltainvestEmploymentStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestNewAccountMaltainvest, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEmploymentStatus, v) } - *j = NewAccountMaltainvestNewAccountMaltainvest(v) + *j = NewAccountMaltainvestEmploymentStatus(v) return nil } -type NewAccountMaltainvestOccupation string - -const NewAccountMaltainvestOccupationAgriculturalForestryAndFisheryWorkers NewAccountMaltainvestOccupation = "Agricultural, Forestry and Fishery Workers" -const NewAccountMaltainvestOccupationArmedForces NewAccountMaltainvestOccupation = "Armed Forces" -const NewAccountMaltainvestOccupationChiefExecutivesSeniorOfficialsAndLegislators NewAccountMaltainvestOccupation = "Chief Executives, Senior Officials and Legislators" -const NewAccountMaltainvestOccupationCleanersAndHelpers NewAccountMaltainvestOccupation = "Cleaners and Helpers" -const NewAccountMaltainvestOccupationClerks NewAccountMaltainvestOccupation = "Clerks" -const NewAccountMaltainvestOccupationCraftMetalElectricalAndElectronicsWorkers NewAccountMaltainvestOccupation = "Craft, Metal, Electrical and Electronics Workers" -const NewAccountMaltainvestOccupationGovernmentOfficers NewAccountMaltainvestOccupation = "Government Officers" -const NewAccountMaltainvestOccupationManagers NewAccountMaltainvestOccupation = "Managers" -const NewAccountMaltainvestOccupationMiningConstructionManufacturingAndTransportWorkers NewAccountMaltainvestOccupation = "Mining, Construction, Manufacturing and Transport Workers" -const NewAccountMaltainvestOccupationPersonalCareSalesAndServiceWorkers NewAccountMaltainvestOccupation = "Personal Care, Sales and Service Workers" -const NewAccountMaltainvestOccupationPlantAndMachineOperatorsAndAssemblers NewAccountMaltainvestOccupation = "Plant and Machine Operators and Assemblers" -const NewAccountMaltainvestOccupationProfessionals NewAccountMaltainvestOccupation = "Professionals" -const NewAccountMaltainvestOccupationStudents NewAccountMaltainvestOccupation = "Students" -const NewAccountMaltainvestOccupationUnemployed NewAccountMaltainvestOccupation = "Unemployed" - -var enumValues_NewAccountMaltainvestOccupation = []interface{}{ - "Chief Executives, Senior Officials and Legislators", - "Managers", - "Professionals", - "Clerks", - "Personal Care, Sales and Service Workers", - "Agricultural, Forestry and Fishery Workers", - "Craft, Metal, Electrical and Electronics Workers", - "Plant and Machine Operators and Assemblers", - "Cleaners and Helpers", - "Mining, Construction, Manufacturing and Transport Workers", - "Armed Forces", - "Government Officers", - "Students", - "Unemployed", +// UnmarshalJSON implements json.Unmarshaler. +func (j *NewAccountMaltainvestResidentSelfDeclaration) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_NewAccountMaltainvestResidentSelfDeclaration { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestResidentSelfDeclaration, v) + } + *j = NewAccountMaltainvestResidentSelfDeclaration(v) + return nil +} + +var enumValues_NewAccountMaltainvestResidentSelfDeclaration = []interface{}{ + 1, +} +var enumValues_NewAccountMaltainvestTradingExperienceFinancialInstruments = []interface{}{ + "No experience", + "Less than a year", + "1 - 2 years", + "Over 3 years", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestOccupation) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestTradingExperienceFinancialInstruments) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestOccupation { + for _, expected := range enumValues_NewAccountMaltainvestTradingExperienceFinancialInstruments { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestOccupation, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestTradingExperienceFinancialInstruments, v) } - *j = NewAccountMaltainvestOccupation(v) + *j = NewAccountMaltainvestTradingExperienceFinancialInstruments(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type NewAccountMaltainvestPassthrough map[string]interface{} - -type NewAccountMaltainvestRequiredInitialMargin string - -const NewAccountMaltainvestRequiredInitialMarginAllOfTheAbove NewAccountMaltainvestRequiredInitialMargin = "All of the above." -const NewAccountMaltainvestRequiredInitialMarginWhenBuyingSharesOfACompany NewAccountMaltainvestRequiredInitialMargin = "When buying shares of a company." -const NewAccountMaltainvestRequiredInitialMarginWhenOpeningALeveragedCFDTrade NewAccountMaltainvestRequiredInitialMargin = "When opening a Leveraged CFD trade." -const NewAccountMaltainvestRequiredInitialMarginWhenTradingMultipliers NewAccountMaltainvestRequiredInitialMargin = "When trading Multipliers." - -var enumValues_NewAccountMaltainvestRequiredInitialMargin = []interface{}{ - "When opening a Leveraged CFD trade.", - "When trading Multipliers.", - "When buying shares of a company.", - "All of the above.", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestRequiredInitialMargin) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestAccountTurnover) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestRequiredInitialMargin { + for _, expected := range enumValues_NewAccountMaltainvestAccountTurnover { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestRequiredInitialMargin, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestAccountTurnover, v) } - *j = NewAccountMaltainvestRequiredInitialMargin(v) + *j = NewAccountMaltainvestAccountTurnover(v) return nil } -type NewAccountMaltainvestResidentSelfDeclaration int - -var enumValues_NewAccountMaltainvestResidentSelfDeclaration = []interface{}{ - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestResidentSelfDeclaration) UnmarshalJSON(b []byte) error { - var v int +func (j *NewAccountMaltainvestEmploymentIndustry) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestResidentSelfDeclaration { + for _, expected := range enumValues_NewAccountMaltainvestEmploymentIndustry { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestResidentSelfDeclaration, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEmploymentIndustry, v) } - *j = NewAccountMaltainvestResidentSelfDeclaration(v) + *j = NewAccountMaltainvestEmploymentIndustry(v) return nil } -type NewAccountMaltainvestRiskTolerance string - -const NewAccountMaltainvestRiskToleranceNo NewAccountMaltainvestRiskTolerance = "No" -const NewAccountMaltainvestRiskToleranceYes NewAccountMaltainvestRiskTolerance = "Yes" - -var enumValues_NewAccountMaltainvestRiskTolerance = []interface{}{ - "Yes", - "No", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestRiskTolerance) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestCfdExperience) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestRiskTolerance { + for _, expected := range enumValues_NewAccountMaltainvestCfdExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestRiskTolerance, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdExperience, v) } - *j = NewAccountMaltainvestRiskTolerance(v) + *j = NewAccountMaltainvestCfdExperience(v) return nil } -type NewAccountMaltainvestSalutation string - -const NewAccountMaltainvestSalutationMiss NewAccountMaltainvestSalutation = "Miss" -const NewAccountMaltainvestSalutationMr NewAccountMaltainvestSalutation = "Mr" -const NewAccountMaltainvestSalutationMrs NewAccountMaltainvestSalutation = "Mrs" -const NewAccountMaltainvestSalutationMs NewAccountMaltainvestSalutation = "Ms" - -var enumValues_NewAccountMaltainvestSalutation = []interface{}{ - "Mr", - "Ms", - "Miss", - "Mrs", +// UnmarshalJSON implements json.Unmarshaler. +func (j *NewAccountMaltainvestEducationLevel) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_NewAccountMaltainvestEducationLevel { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEducationLevel, v) + } + *j = NewAccountMaltainvestEducationLevel(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestSalutation) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestCfdFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestSalutation { + for _, expected := range enumValues_NewAccountMaltainvestCfdFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSalutation, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdFrequency, v) } - *j = NewAccountMaltainvestSalutation(v) + *j = NewAccountMaltainvestCfdFrequency(v) return nil } -type NewAccountMaltainvestSecretQuestion string - -const NewAccountMaltainvestSecretQuestionBrandOfFirstCar NewAccountMaltainvestSecretQuestion = "Brand of first car" -const NewAccountMaltainvestSecretQuestionFavouriteArtist NewAccountMaltainvestSecretQuestion = "Favourite artist" -const NewAccountMaltainvestSecretQuestionFavouriteDish NewAccountMaltainvestSecretQuestion = "Favourite dish" -const NewAccountMaltainvestSecretQuestionMemorableDate NewAccountMaltainvestSecretQuestion = "Memorable date" -const NewAccountMaltainvestSecretQuestionMemorableTownCity NewAccountMaltainvestSecretQuestion = "Memorable town/city" -const NewAccountMaltainvestSecretQuestionMotherSMaidenName NewAccountMaltainvestSecretQuestion = "Mother's maiden name" -const NewAccountMaltainvestSecretQuestionNameOfFirstLove NewAccountMaltainvestSecretQuestion = "Name of first love" -const NewAccountMaltainvestSecretQuestionNameOfYourPet NewAccountMaltainvestSecretQuestion = "Name of your pet" - -var enumValues_NewAccountMaltainvestSecretQuestion = []interface{}{ - "Mother's maiden name", - "Name of your pet", - "Name of first love", - "Memorable town/city", - "Memorable date", - "Favourite dish", - "Brand of first car", - "Favourite artist", +var enumValues_NewAccountMaltainvestTradingFrequencyFinancialInstruments = []interface{}{ + "No transactions in the past 12 months", + "1 - 5 transactions in the past 12 months", + "6 - 10 transactions in the past 12 months", + "11 - 39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestSecretQuestion) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestTradingFrequencyFinancialInstruments) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestSecretQuestion { + for _, expected := range enumValues_NewAccountMaltainvestTradingFrequencyFinancialInstruments { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSecretQuestion, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestTradingFrequencyFinancialInstruments, v) } - *j = NewAccountMaltainvestSecretQuestion(v) + *j = NewAccountMaltainvestTradingFrequencyFinancialInstruments(v) return nil } -type NewAccountMaltainvestSourceOfExperience string - -const NewAccountMaltainvestSourceOfExperienceIHaveAnAcademicDegreeProfessionalCertificationAndOrWorkExperience NewAccountMaltainvestSourceOfExperience = "I have an academic degree, professional certification, and/or work experience." -const NewAccountMaltainvestSourceOfExperienceIHaveAttendedSeminarsTrainingAndOrWorkshops NewAccountMaltainvestSourceOfExperience = "I have attended seminars, training, and/or workshops." -const NewAccountMaltainvestSourceOfExperienceIHaveLittleExperience NewAccountMaltainvestSourceOfExperience = "I have little experience." -const NewAccountMaltainvestSourceOfExperienceIHaveNoKnowledge NewAccountMaltainvestSourceOfExperience = "I have no knowledge." -const NewAccountMaltainvestSourceOfExperienceITradeForexCFDsAndOtherComplexFinancialInstruments NewAccountMaltainvestSourceOfExperience = "I trade forex CFDs and other complex financial instruments." - -var enumValues_NewAccountMaltainvestSourceOfExperience = []interface{}{ - "I have an academic degree, professional certification, and/or work experience.", - "I trade forex CFDs and other complex financial instruments.", - "I have attended seminars, training, and/or workshops.", - "I have little experience.", - "I have no knowledge.", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestSourceOfExperience) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestRequiredInitialMargin) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestSourceOfExperience { + for _, expected := range enumValues_NewAccountMaltainvestRequiredInitialMargin { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSourceOfExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestRequiredInitialMargin, v) } - *j = NewAccountMaltainvestSourceOfExperience(v) + *j = NewAccountMaltainvestRequiredInitialMargin(v) return nil } -type NewAccountMaltainvestSourceOfWealth string - -const NewAccountMaltainvestSourceOfWealthAccumulationOfIncomeSavings NewAccountMaltainvestSourceOfWealth = "Accumulation of Income/Savings" -const NewAccountMaltainvestSourceOfWealthCashBusiness NewAccountMaltainvestSourceOfWealth = "Cash Business" -const NewAccountMaltainvestSourceOfWealthCompanyOwnership NewAccountMaltainvestSourceOfWealth = "Company Ownership" -const NewAccountMaltainvestSourceOfWealthDivorceSettlement NewAccountMaltainvestSourceOfWealth = "Divorce Settlement" -const NewAccountMaltainvestSourceOfWealthInheritance NewAccountMaltainvestSourceOfWealth = "Inheritance" -const NewAccountMaltainvestSourceOfWealthInvestmentIncome NewAccountMaltainvestSourceOfWealth = "Investment Income" -const NewAccountMaltainvestSourceOfWealthSaleOfProperty NewAccountMaltainvestSourceOfWealth = "Sale of Property" - -var enumValues_NewAccountMaltainvestSourceOfWealth = []interface{}{ - "Accumulation of Income/Savings", - "Cash Business", - "Company Ownership", - "Divorce Settlement", - "Inheritance", - "Investment Income", - "Sale of Property", +var enumValues_NewAccountMaltainvestRequiredInitialMargin = []interface{}{ + "When opening a Leveraged CFD trade.", + "When trading Multipliers.", + "When buying shares of a company.", + "All of the above.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestSourceOfWealth) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestSalutation) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestSourceOfWealth { + for _, expected := range enumValues_NewAccountMaltainvestSalutation { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSourceOfWealth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSalutation, v) } - *j = NewAccountMaltainvestSourceOfWealth(v) + *j = NewAccountMaltainvestSalutation(v) return nil } -type NewAccountMaltainvestTradingExperienceFinancialInstruments string - -const NewAccountMaltainvestTradingExperienceFinancialInstrumentsA12Years NewAccountMaltainvestTradingExperienceFinancialInstruments = "1 - 2 years" -const NewAccountMaltainvestTradingExperienceFinancialInstrumentsLessThanAYear NewAccountMaltainvestTradingExperienceFinancialInstruments = "Less than a year" -const NewAccountMaltainvestTradingExperienceFinancialInstrumentsNoExperience NewAccountMaltainvestTradingExperienceFinancialInstruments = "No experience" -const NewAccountMaltainvestTradingExperienceFinancialInstrumentsOver3Years NewAccountMaltainvestTradingExperienceFinancialInstruments = "Over 3 years" - -var enumValues_NewAccountMaltainvestTradingExperienceFinancialInstruments = []interface{}{ - "No experience", - "Less than a year", - "1 - 2 years", - "Over 3 years", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestTradingExperienceFinancialInstruments) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestCfdTradingDefinition) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestTradingExperienceFinancialInstruments { + for _, expected := range enumValues_NewAccountMaltainvestCfdTradingDefinition { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestTradingExperienceFinancialInstruments, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdTradingDefinition, v) } - *j = NewAccountMaltainvestTradingExperienceFinancialInstruments(v) + *j = NewAccountMaltainvestCfdTradingDefinition(v) return nil } -type NewAccountMaltainvestTradingFrequencyFinancialInstruments string - -const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsA1139TransactionsInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "11 - 39 transactions in the past 12 months" -const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsA15TransactionsInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "1 - 5 transactions in the past 12 months" -const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsA40TransactionsOrMoreInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "40 transactions or more in the past 12 months" -const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsA610TransactionsInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "6 - 10 transactions in the past 12 months" -const NewAccountMaltainvestTradingFrequencyFinancialInstrumentsNoTransactionsInThePast12Months NewAccountMaltainvestTradingFrequencyFinancialInstruments = "No transactions in the past 12 months" - -var enumValues_NewAccountMaltainvestTradingFrequencyFinancialInstruments = []interface{}{ - "No transactions in the past 12 months", - "1 - 5 transactions in the past 12 months", - "6 - 10 transactions in the past 12 months", - "11 - 39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", +var enumValues_NewAccountMaltainvestSalutation = []interface{}{ + "Mr", + "Ms", + "Miss", + "Mrs", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestTradingFrequencyFinancialInstruments) UnmarshalJSON(b []byte) error { +func (j *NewAccountMaltainvestClientType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountMaltainvestTradingFrequencyFinancialInstruments { + for _, expected := range enumValues_NewAccountMaltainvestClientType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestTradingFrequencyFinancialInstruments, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestClientType, v) } - *j = NewAccountMaltainvestTradingFrequencyFinancialInstruments(v) + *j = NewAccountMaltainvestClientType(v) return nil } @@ -1130,34 +1114,34 @@ func (j *NewAccountMaltainvest) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["address_city"]; raw != nil && !ok { + if v, ok := raw["address_city"]; !ok || v == nil { return fmt.Errorf("field address_city in NewAccountMaltainvest: required") } - if _, ok := raw["address_line_1"]; raw != nil && !ok { + if v, ok := raw["address_line_1"]; !ok || v == nil { return fmt.Errorf("field address_line_1 in NewAccountMaltainvest: required") } - if _, ok := raw["date_of_birth"]; raw != nil && !ok { + if v, ok := raw["date_of_birth"]; !ok || v == nil { return fmt.Errorf("field date_of_birth in NewAccountMaltainvest: required") } - if _, ok := raw["employment_status"]; raw != nil && !ok { + if v, ok := raw["employment_status"]; !ok || v == nil { return fmt.Errorf("field employment_status in NewAccountMaltainvest: required") } - if _, ok := raw["first_name"]; raw != nil && !ok { + if v, ok := raw["first_name"]; !ok || v == nil { return fmt.Errorf("field first_name in NewAccountMaltainvest: required") } - if _, ok := raw["last_name"]; raw != nil && !ok { + if v, ok := raw["last_name"]; !ok || v == nil { return fmt.Errorf("field last_name in NewAccountMaltainvest: required") } - if _, ok := raw["new_account_maltainvest"]; raw != nil && !ok { + if v, ok := raw["new_account_maltainvest"]; !ok || v == nil { return fmt.Errorf("field new_account_maltainvest in NewAccountMaltainvest: required") } - if _, ok := raw["residence"]; raw != nil && !ok { + if v, ok := raw["residence"]; !ok || v == nil { return fmt.Errorf("field residence in NewAccountMaltainvest: required") } - if _, ok := raw["salutation"]; raw != nil && !ok { + if v, ok := raw["salutation"]; !ok || v == nil { return fmt.Errorf("field salutation in NewAccountMaltainvest: required") } - if _, ok := raw["tax_residence"]; raw != nil && !ok { + if v, ok := raw["tax_residence"]; !ok || v == nil { return fmt.Errorf("field tax_residence in NewAccountMaltainvest: required") } type Plain NewAccountMaltainvest diff --git a/schema/new_account_maltainvest_resp.go b/schema/new_account_maltainvest_resp.go index 8bf9ba4..012cc7c 100644 --- a/schema/new_account_maltainvest_resp.go +++ b/schema/new_account_maltainvest_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Create maltainvest account Receive -type NewAccountMaltainvestResp struct { - // Echo of the request made. - EchoReq NewAccountMaltainvestRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType NewAccountMaltainvestRespMsgType `json:"msg_type"` - - // New `maltainvest` account details - NewAccountMaltainvest *NewAccountMaltainvestRespNewAccountMaltainvest `json:"new_account_maltainvest,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type NewAccountMaltainvestRespEchoReq map[string]interface{} type NewAccountMaltainvestRespMsgType string -const NewAccountMaltainvestRespMsgTypeNewAccountMaltainvest NewAccountMaltainvestRespMsgType = "new_account_maltainvest" - var enumValues_NewAccountMaltainvestRespMsgType = []interface{}{ "new_account_maltainvest", } @@ -53,6 +35,8 @@ func (j *NewAccountMaltainvestRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const NewAccountMaltainvestRespMsgTypeNewAccountMaltainvest NewAccountMaltainvestRespMsgType = "new_account_maltainvest" + // New `maltainvest` account details type NewAccountMaltainvestRespNewAccountMaltainvest struct { // Client ID of new `maltainvest` account @@ -83,13 +67,13 @@ func (j *NewAccountMaltainvestRespNewAccountMaltainvest) UnmarshalJSON(b []byte) if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["client_id"]; raw != nil && !ok { + if v, ok := raw["client_id"]; !ok || v == nil { return fmt.Errorf("field client_id in NewAccountMaltainvestRespNewAccountMaltainvest: required") } - if _, ok := raw["landing_company"]; raw != nil && !ok { + if v, ok := raw["landing_company"]; !ok || v == nil { return fmt.Errorf("field landing_company in NewAccountMaltainvestRespNewAccountMaltainvest: required") } - if _, ok := raw["oauth_token"]; raw != nil && !ok { + if v, ok := raw["oauth_token"]; !ok || v == nil { return fmt.Errorf("field oauth_token in NewAccountMaltainvestRespNewAccountMaltainvest: required") } type Plain NewAccountMaltainvestRespNewAccountMaltainvest @@ -101,16 +85,32 @@ func (j *NewAccountMaltainvestRespNewAccountMaltainvest) UnmarshalJSON(b []byte) return nil } +// Create maltainvest account Receive +type NewAccountMaltainvestResp struct { + // Echo of the request made. + EchoReq NewAccountMaltainvestRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType NewAccountMaltainvestRespMsgType `json:"msg_type"` + + // New `maltainvest` account details + NewAccountMaltainvest *NewAccountMaltainvestRespNewAccountMaltainvest `json:"new_account_maltainvest,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *NewAccountMaltainvestResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in NewAccountMaltainvestResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in NewAccountMaltainvestResp: required") } type Plain NewAccountMaltainvestResp diff --git a/schema/new_account_real.go b/schema/new_account_real.go index 54325e5..f87e15a 100644 --- a/schema/new_account_real.go +++ b/schema/new_account_real.go @@ -6,6 +6,139 @@ import "encoding/json" import "fmt" import "reflect" +// UnmarshalJSON implements json.Unmarshaler. +func (j *NewAccountRealFatcaDeclaration) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_NewAccountRealFatcaDeclaration { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealFatcaDeclaration, v) + } + *j = NewAccountRealFatcaDeclaration(v) + return nil +} + +type NewAccountRealSecretQuestion string + +// UnmarshalJSON implements json.Unmarshaler. +func (j *NewAccountRealAccountOpeningReason) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_NewAccountRealAccountOpeningReason { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealAccountOpeningReason, v) + } + *j = NewAccountRealAccountOpeningReason(v) + return nil +} + +const NewAccountRealAccountOpeningReasonSpeculative NewAccountRealAccountOpeningReason = "Speculative" +const NewAccountRealAccountOpeningReasonIncomeEarning NewAccountRealAccountOpeningReason = "Income Earning" +const NewAccountRealAccountOpeningReasonHedging NewAccountRealAccountOpeningReason = "Hedging" +const NewAccountRealAccountOpeningReasonPeerToPeerExchange NewAccountRealAccountOpeningReason = "Peer-to-peer exchange" + +type NewAccountRealAccountTurnover string + +// UnmarshalJSON implements json.Unmarshaler. +func (j *NewAccountReal) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["new_account_real"]; !ok || v == nil { + return fmt.Errorf("field new_account_real in NewAccountReal: required") + } + type Plain NewAccountReal + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + if v, ok := raw["client_type"]; !ok || v == nil { + plain.ClientType = "retail" + } + if plain.SecretAnswer != nil && len(*plain.SecretAnswer) < 4 { + return fmt.Errorf("field %s length: must be >= %d", "secret_answer", 4) + } + if plain.SecretAnswer != nil && len(*plain.SecretAnswer) > 50 { + return fmt.Errorf("field %s length: must be <= %d", "secret_answer", 50) + } + *j = NewAccountReal(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *NewAccountRealAccountTurnover) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_NewAccountRealAccountTurnover { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealAccountTurnover, v) + } + *j = NewAccountRealAccountTurnover(v) + return nil +} + +const NewAccountRealAccountTurnoverLessThan25000 NewAccountRealAccountTurnover = "Less than $25,000" +const NewAccountRealAccountTurnoverA2500050000 NewAccountRealAccountTurnover = "$25,000 - $50,000" +const NewAccountRealAccountTurnoverA50001100000 NewAccountRealAccountTurnover = "$50,001 - $100,000" +const NewAccountRealAccountTurnoverA100001500000 NewAccountRealAccountTurnover = "$100,001 - $500,000" +const NewAccountRealAccountTurnoverOver500000 NewAccountRealAccountTurnover = "Over $500,000" + +type NewAccountRealClientType string + +type NewAccountRealAccountOpeningReason string + +// UnmarshalJSON implements json.Unmarshaler. +func (j *NewAccountRealClientType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_NewAccountRealClientType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealClientType, v) + } + *j = NewAccountRealClientType(v) + return nil +} + +const NewAccountRealClientTypeProfessional NewAccountRealClientType = "professional" +const NewAccountRealClientTypeRetail NewAccountRealClientType = "retail" + +type NewAccountRealFatcaDeclaration int + +type NewAccountRealNewAccountReal int + // This call opens a new real-money account. This call can be made from a // virtual-money or a real-money account. If it is the latter, client information // fields in this call will be ignored and data from your existing real-money @@ -110,138 +243,27 @@ type NewAccountReal struct { TaxResidence *string `json:"tax_residence,omitempty"` } -type NewAccountRealAccountOpeningReason string - -const NewAccountRealAccountOpeningReasonHedging NewAccountRealAccountOpeningReason = "Hedging" -const NewAccountRealAccountOpeningReasonIncomeEarning NewAccountRealAccountOpeningReason = "Income Earning" -const NewAccountRealAccountOpeningReasonPeerToPeerExchange NewAccountRealAccountOpeningReason = "Peer-to-peer exchange" -const NewAccountRealAccountOpeningReasonSpeculative NewAccountRealAccountOpeningReason = "Speculative" - -var enumValues_NewAccountRealAccountOpeningReason = []interface{}{ - "Speculative", - "Income Earning", - "Hedging", - "Peer-to-peer exchange", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountRealAccountOpeningReason) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_NewAccountRealAccountOpeningReason { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealAccountOpeningReason, v) - } - *j = NewAccountRealAccountOpeningReason(v) - return nil -} - -type NewAccountRealAccountTurnover string - -const NewAccountRealAccountTurnoverA100001500000 NewAccountRealAccountTurnover = "$100,001 - $500,000" -const NewAccountRealAccountTurnoverA2500050000 NewAccountRealAccountTurnover = "$25,000 - $50,000" -const NewAccountRealAccountTurnoverA50001100000 NewAccountRealAccountTurnover = "$50,001 - $100,000" -const NewAccountRealAccountTurnoverLessThan25000 NewAccountRealAccountTurnover = "Less than $25,000" -const NewAccountRealAccountTurnoverOver500000 NewAccountRealAccountTurnover = "Over $500,000" - -var enumValues_NewAccountRealAccountTurnover = []interface{}{ - "Less than $25,000", - "$25,000 - $50,000", - "$50,001 - $100,000", - "$100,001 - $500,000", - "Over $500,000", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountRealAccountTurnover) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_NewAccountRealAccountTurnover { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealAccountTurnover, v) - } - *j = NewAccountRealAccountTurnover(v) - return nil -} - -type NewAccountRealClientType string - -const NewAccountRealClientTypeProfessional NewAccountRealClientType = "professional" -const NewAccountRealClientTypeRetail NewAccountRealClientType = "retail" - -var enumValues_NewAccountRealClientType = []interface{}{ - "professional", - "retail", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountRealClientType) UnmarshalJSON(b []byte) error { +func (j *NewAccountRealSecretQuestion) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountRealClientType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealClientType, v) - } - *j = NewAccountRealClientType(v) - return nil -} - -type NewAccountRealFatcaDeclaration int - -var enumValues_NewAccountRealFatcaDeclaration = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountRealFatcaDeclaration) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_NewAccountRealFatcaDeclaration { + for _, expected := range enumValues_NewAccountRealSecretQuestion { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealFatcaDeclaration, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealSecretQuestion, v) } - *j = NewAccountRealFatcaDeclaration(v) + *j = NewAccountRealSecretQuestion(v) return nil } -type NewAccountRealNewAccountReal int - -var enumValues_NewAccountRealNewAccountReal = []interface{}{ - 1, -} +type NewAccountRealSalutation string // UnmarshalJSON implements json.Unmarshaler. func (j *NewAccountRealNewAccountReal) UnmarshalJSON(b []byte) error { @@ -267,19 +289,8 @@ func (j *NewAccountRealNewAccountReal) UnmarshalJSON(b []byte) error { // the `echo_req` output field. type NewAccountRealPassthrough map[string]interface{} -type NewAccountRealSalutation string - -const NewAccountRealSalutationMiss NewAccountRealSalutation = "Miss" -const NewAccountRealSalutationMr NewAccountRealSalutation = "Mr" const NewAccountRealSalutationMrs NewAccountRealSalutation = "Mrs" -const NewAccountRealSalutationMs NewAccountRealSalutation = "Ms" - -var enumValues_NewAccountRealSalutation = []interface{}{ - "Mr", - "Ms", - "Miss", - "Mrs", -} +const NewAccountRealSalutationMiss NewAccountRealSalutation = "Miss" // UnmarshalJSON implements json.Unmarshaler. func (j *NewAccountRealSalutation) UnmarshalJSON(b []byte) error { @@ -301,8 +312,8 @@ func (j *NewAccountRealSalutation) UnmarshalJSON(b []byte) error { return nil } -type NewAccountRealSecretQuestion string - +const NewAccountRealSalutationMr NewAccountRealSalutation = "Mr" +const NewAccountRealSalutationMs NewAccountRealSalutation = "Ms" const NewAccountRealSecretQuestionBrandOfFirstCar NewAccountRealSecretQuestion = "Brand of first car" const NewAccountRealSecretQuestionFavouriteArtist NewAccountRealSecretQuestion = "Favourite artist" const NewAccountRealSecretQuestionFavouriteDish NewAccountRealSecretQuestion = "Favourite dish" @@ -312,6 +323,36 @@ const NewAccountRealSecretQuestionMotherSMaidenName NewAccountRealSecretQuestion const NewAccountRealSecretQuestionNameOfFirstLove NewAccountRealSecretQuestion = "Name of first love" const NewAccountRealSecretQuestionNameOfYourPet NewAccountRealSecretQuestion = "Name of your pet" +var enumValues_NewAccountRealAccountOpeningReason = []interface{}{ + "Speculative", + "Income Earning", + "Hedging", + "Peer-to-peer exchange", +} +var enumValues_NewAccountRealAccountTurnover = []interface{}{ + "Less than $25,000", + "$25,000 - $50,000", + "$50,001 - $100,000", + "$100,001 - $500,000", + "Over $500,000", +} +var enumValues_NewAccountRealClientType = []interface{}{ + "professional", + "retail", +} +var enumValues_NewAccountRealFatcaDeclaration = []interface{}{ + 0, + 1, +} +var enumValues_NewAccountRealNewAccountReal = []interface{}{ + 1, +} +var enumValues_NewAccountRealSalutation = []interface{}{ + "Mr", + "Ms", + "Miss", + "Mrs", +} var enumValues_NewAccountRealSecretQuestion = []interface{}{ "Mother's maiden name", "Name of your pet", @@ -322,50 +363,3 @@ var enumValues_NewAccountRealSecretQuestion = []interface{}{ "Brand of first car", "Favourite artist", } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountRealSecretQuestion) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_NewAccountRealSecretQuestion { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealSecretQuestion, v) - } - *j = NewAccountRealSecretQuestion(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountReal) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["new_account_real"]; raw != nil && !ok { - return fmt.Errorf("field new_account_real in NewAccountReal: required") - } - type Plain NewAccountReal - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - if v, ok := raw["client_type"]; !ok || v == nil { - plain.ClientType = "retail" - } - if plain.SecretAnswer != nil && len(*plain.SecretAnswer) < 4 { - return fmt.Errorf("field %s length: must be >= %d", "secret_answer", 4) - } - if plain.SecretAnswer != nil && len(*plain.SecretAnswer) > 50 { - return fmt.Errorf("field %s length: must be <= %d", "secret_answer", 50) - } - *j = NewAccountReal(plain) - return nil -} diff --git a/schema/new_account_real_resp.go b/schema/new_account_real_resp.go index 62e944f..7a3fdf2 100644 --- a/schema/new_account_real_resp.go +++ b/schema/new_account_real_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Create real account Receive -type NewAccountRealResp struct { - // Echo of the request made. - EchoReq NewAccountRealRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType NewAccountRealRespMsgType `json:"msg_type"` - - // New real money account details - NewAccountReal *NewAccountRealRespNewAccountReal `json:"new_account_real,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type NewAccountRealRespEchoReq map[string]interface{} type NewAccountRealRespMsgType string -const NewAccountRealRespMsgTypeNewAccountReal NewAccountRealRespMsgType = "new_account_real" - var enumValues_NewAccountRealRespMsgType = []interface{}{ "new_account_real", } @@ -53,6 +35,8 @@ func (j *NewAccountRealRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const NewAccountRealRespMsgTypeNewAccountReal NewAccountRealRespMsgType = "new_account_real" + // New real money account details type NewAccountRealRespNewAccountReal struct { // Client ID of new real money account @@ -83,13 +67,13 @@ func (j *NewAccountRealRespNewAccountReal) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["client_id"]; raw != nil && !ok { + if v, ok := raw["client_id"]; !ok || v == nil { return fmt.Errorf("field client_id in NewAccountRealRespNewAccountReal: required") } - if _, ok := raw["landing_company"]; raw != nil && !ok { + if v, ok := raw["landing_company"]; !ok || v == nil { return fmt.Errorf("field landing_company in NewAccountRealRespNewAccountReal: required") } - if _, ok := raw["oauth_token"]; raw != nil && !ok { + if v, ok := raw["oauth_token"]; !ok || v == nil { return fmt.Errorf("field oauth_token in NewAccountRealRespNewAccountReal: required") } type Plain NewAccountRealRespNewAccountReal @@ -101,16 +85,32 @@ func (j *NewAccountRealRespNewAccountReal) UnmarshalJSON(b []byte) error { return nil } +// Create real account Receive +type NewAccountRealResp struct { + // Echo of the request made. + EchoReq NewAccountRealRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType NewAccountRealRespMsgType `json:"msg_type"` + + // New real money account details + NewAccountReal *NewAccountRealRespNewAccountReal `json:"new_account_real,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *NewAccountRealResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in NewAccountRealResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in NewAccountRealResp: required") } type Plain NewAccountRealResp diff --git a/schema/new_account_virtual.go b/schema/new_account_virtual.go index 6b6c37d..aa32a39 100644 --- a/schema/new_account_virtual.go +++ b/schema/new_account_virtual.go @@ -108,118 +108,117 @@ type NewAccountVirtual struct { type NewAccountVirtualEmailConsent int +type NewAccountVirtualNewAccountVirtual int + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type NewAccountVirtualPassthrough map[string]interface{} + +type NewAccountVirtualSignupDevice string + +const NewAccountVirtualSignupDeviceDesktop NewAccountVirtualSignupDevice = "desktop" +const NewAccountVirtualSignupDeviceMobile NewAccountVirtualSignupDevice = "mobile" + +type NewAccountVirtualType string + +const NewAccountVirtualTypeTrading NewAccountVirtualType = "trading" +const NewAccountVirtualTypeWallet NewAccountVirtualType = "wallet" + var enumValues_NewAccountVirtualEmailConsent = []interface{}{ 1, 0, } +var enumValues_NewAccountVirtualNewAccountVirtual = []interface{}{ + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountVirtualEmailConsent) UnmarshalJSON(b []byte) error { - var v int +func (j *NewAccountVirtualSignupDevice) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountVirtualEmailConsent { + for _, expected := range enumValues_NewAccountVirtualSignupDevice { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualEmailConsent, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualSignupDevice, v) } - *j = NewAccountVirtualEmailConsent(v) + *j = NewAccountVirtualSignupDevice(v) return nil } -type NewAccountVirtualNewAccountVirtual int - -var enumValues_NewAccountVirtualNewAccountVirtual = []interface{}{ - 1, +var enumValues_NewAccountVirtualType = []interface{}{ + "trading", + "wallet", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountVirtualNewAccountVirtual) UnmarshalJSON(b []byte) error { - var v int +func (j *NewAccountVirtualType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountVirtualNewAccountVirtual { + for _, expected := range enumValues_NewAccountVirtualType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualNewAccountVirtual, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualType, v) } - *j = NewAccountVirtualNewAccountVirtual(v) + *j = NewAccountVirtualType(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type NewAccountVirtualPassthrough map[string]interface{} - -type NewAccountVirtualSignupDevice string - -const NewAccountVirtualSignupDeviceDesktop NewAccountVirtualSignupDevice = "desktop" -const NewAccountVirtualSignupDeviceMobile NewAccountVirtualSignupDevice = "mobile" - var enumValues_NewAccountVirtualSignupDevice = []interface{}{ "desktop", "mobile", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountVirtualSignupDevice) UnmarshalJSON(b []byte) error { - var v string +func (j *NewAccountVirtualNewAccountVirtual) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountVirtualSignupDevice { + for _, expected := range enumValues_NewAccountVirtualNewAccountVirtual { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualSignupDevice, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualNewAccountVirtual, v) } - *j = NewAccountVirtualSignupDevice(v) + *j = NewAccountVirtualNewAccountVirtual(v) return nil } -type NewAccountVirtualType string - -const NewAccountVirtualTypeTrading NewAccountVirtualType = "trading" -const NewAccountVirtualTypeWallet NewAccountVirtualType = "wallet" - -var enumValues_NewAccountVirtualType = []interface{}{ - "trading", - "wallet", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountVirtualType) UnmarshalJSON(b []byte) error { - var v string +func (j *NewAccountVirtualEmailConsent) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountVirtualType { + for _, expected := range enumValues_NewAccountVirtualEmailConsent { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualEmailConsent, v) } - *j = NewAccountVirtualType(v) + *j = NewAccountVirtualEmailConsent(v) return nil } @@ -229,7 +228,7 @@ func (j *NewAccountVirtual) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["new_account_virtual"]; raw != nil && !ok { + if v, ok := raw["new_account_virtual"]; !ok || v == nil { return fmt.Errorf("field new_account_virtual in NewAccountVirtual: required") } type Plain NewAccountVirtual diff --git a/schema/new_account_virtual_resp.go b/schema/new_account_virtual_resp.go index 45c9a2d..3ed532e 100644 --- a/schema/new_account_virtual_resp.go +++ b/schema/new_account_virtual_resp.go @@ -29,30 +29,6 @@ type NewAccountVirtualRespMsgType string const NewAccountVirtualRespMsgTypeNewAccountVirtual NewAccountVirtualRespMsgType = "new_account_virtual" -var enumValues_NewAccountVirtualRespMsgType = []interface{}{ - "new_account_virtual", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountVirtualRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_NewAccountVirtualRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualRespMsgType, v) - } - *j = NewAccountVirtualRespMsgType(v) - return nil -} - // New virtual-money account details type NewAccountVirtualRespNewAccountVirtual struct { // Account balance @@ -86,28 +62,48 @@ type NewAccountVirtualRespNewAccountVirtualType string const NewAccountVirtualRespNewAccountVirtualTypeTrading NewAccountVirtualRespNewAccountVirtualType = "trading" const NewAccountVirtualRespNewAccountVirtualTypeWallet NewAccountVirtualRespNewAccountVirtualType = "wallet" +// UnmarshalJSON implements json.Unmarshaler. +func (j *NewAccountVirtualRespNewAccountVirtualType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_NewAccountVirtualRespNewAccountVirtualType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualRespNewAccountVirtualType, v) + } + *j = NewAccountVirtualRespNewAccountVirtualType(v) + return nil +} + var enumValues_NewAccountVirtualRespNewAccountVirtualType = []interface{}{ "trading", "wallet", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountVirtualRespNewAccountVirtualType) UnmarshalJSON(b []byte) error { +func (j *NewAccountVirtualRespMsgType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_NewAccountVirtualRespNewAccountVirtualType { + for _, expected := range enumValues_NewAccountVirtualRespMsgType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualRespNewAccountVirtualType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualRespMsgType, v) } - *j = NewAccountVirtualRespNewAccountVirtualType(v) + *j = NewAccountVirtualRespMsgType(v) return nil } @@ -117,19 +113,19 @@ func (j *NewAccountVirtualRespNewAccountVirtual) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["balance"]; raw != nil && !ok { + if v, ok := raw["balance"]; !ok || v == nil { return fmt.Errorf("field balance in NewAccountVirtualRespNewAccountVirtual: required") } - if _, ok := raw["client_id"]; raw != nil && !ok { + if v, ok := raw["client_id"]; !ok || v == nil { return fmt.Errorf("field client_id in NewAccountVirtualRespNewAccountVirtual: required") } - if _, ok := raw["currency"]; raw != nil && !ok { + if v, ok := raw["currency"]; !ok || v == nil { return fmt.Errorf("field currency in NewAccountVirtualRespNewAccountVirtual: required") } - if _, ok := raw["email"]; raw != nil && !ok { + if v, ok := raw["email"]; !ok || v == nil { return fmt.Errorf("field email in NewAccountVirtualRespNewAccountVirtual: required") } - if _, ok := raw["oauth_token"]; raw != nil && !ok { + if v, ok := raw["oauth_token"]; !ok || v == nil { return fmt.Errorf("field oauth_token in NewAccountVirtualRespNewAccountVirtual: required") } type Plain NewAccountVirtualRespNewAccountVirtual @@ -141,16 +137,20 @@ func (j *NewAccountVirtualRespNewAccountVirtual) UnmarshalJSON(b []byte) error { return nil } +var enumValues_NewAccountVirtualRespMsgType = []interface{}{ + "new_account_virtual", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *NewAccountVirtualResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in NewAccountVirtualResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in NewAccountVirtualResp: required") } type Plain NewAccountVirtualResp diff --git a/schema/oauth_apps.go b/schema/oauth_apps.go index 18817bd..0751fdc 100644 --- a/schema/oauth_apps.go +++ b/schema/oauth_apps.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// List all my used OAuth applications. -type OauthApps struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - OauthApps OauthAppsOauthApps `json:"oauth_apps"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough OauthAppsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type OauthAppsOauthApps int var enumValues_OauthAppsOauthApps = []interface{}{ @@ -49,6 +32,23 @@ func (j *OauthAppsOauthApps) UnmarshalJSON(b []byte) error { return nil } +// List all my used OAuth applications. +type OauthApps struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + OauthApps OauthAppsOauthApps `json:"oauth_apps"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough OauthAppsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type OauthAppsPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *OauthApps) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["oauth_apps"]; raw != nil && !ok { + if v, ok := raw["oauth_apps"]; !ok || v == nil { return fmt.Errorf("field oauth_apps in OauthApps: required") } type Plain OauthApps diff --git a/schema/oauth_apps_resp.go b/schema/oauth_apps_resp.go index 813f8ca..e7a1401 100644 --- a/schema/oauth_apps_resp.go +++ b/schema/oauth_apps_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with used applications -type OauthAppsResp struct { - // Echo of the request made. - EchoReq OauthAppsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType OauthAppsRespMsgType `json:"msg_type"` - - // List of 3rd party OAuth applications that used for the authorized account. - OauthApps []OauthAppsRespOauthAppsElem `json:"oauth_apps,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type OauthAppsRespEchoReq map[string]interface{} type OauthAppsRespMsgType string -const OauthAppsRespMsgTypeOauthApps OauthAppsRespMsgType = "oauth_apps" - var enumValues_OauthAppsRespMsgType = []interface{}{ "oauth_apps", } @@ -53,26 +35,7 @@ func (j *OauthAppsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -type OauthAppsRespOauthAppsElem struct { - // Application ID. - AppId int `json:"app_id"` - - // Markup added to contract prices (as a percentage of contract payout) - AppMarkupPercentage float64 `json:"app_markup_percentage"` - - // The last date which the application has been used. - LastUsed *string `json:"last_used"` - - // Application name - Name string `json:"name"` - - // Boolean value: 1 or 0, indicating 1 if app is an official app and 0 incase of - // unofficial app - Official OauthAppsRespOauthAppsElemOfficial `json:"official"` - - // The list of permission scopes grant for each app. - Scopes []string `json:"scopes"` -} +const OauthAppsRespMsgTypeOauthApps OauthAppsRespMsgType = "oauth_apps" type OauthAppsRespOauthAppsElemOfficial int @@ -101,28 +64,49 @@ func (j *OauthAppsRespOauthAppsElemOfficial) UnmarshalJSON(b []byte) error { return nil } +type OauthAppsRespOauthAppsElem struct { + // Application ID. + AppId int `json:"app_id"` + + // Markup added to contract prices (as a percentage of contract payout) + AppMarkupPercentage float64 `json:"app_markup_percentage"` + + // The last date which the application has been used. + LastUsed *string `json:"last_used"` + + // Application name + Name string `json:"name"` + + // Boolean value: 1 or 0, indicating 1 if app is an official app and 0 incase of + // unofficial app + Official OauthAppsRespOauthAppsElemOfficial `json:"official"` + + // The list of permission scopes grant for each app. + Scopes []string `json:"scopes"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *OauthAppsRespOauthAppsElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["app_id"]; raw != nil && !ok { + if v, ok := raw["app_id"]; !ok || v == nil { return fmt.Errorf("field app_id in OauthAppsRespOauthAppsElem: required") } - if _, ok := raw["app_markup_percentage"]; raw != nil && !ok { + if v, ok := raw["app_markup_percentage"]; !ok || v == nil { return fmt.Errorf("field app_markup_percentage in OauthAppsRespOauthAppsElem: required") } - if _, ok := raw["last_used"]; raw != nil && !ok { + if v, ok := raw["last_used"]; !ok || v == nil { return fmt.Errorf("field last_used in OauthAppsRespOauthAppsElem: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in OauthAppsRespOauthAppsElem: required") } - if _, ok := raw["official"]; raw != nil && !ok { + if v, ok := raw["official"]; !ok || v == nil { return fmt.Errorf("field official in OauthAppsRespOauthAppsElem: required") } - if _, ok := raw["scopes"]; raw != nil && !ok { + if v, ok := raw["scopes"]; !ok || v == nil { return fmt.Errorf("field scopes in OauthAppsRespOauthAppsElem: required") } type Plain OauthAppsRespOauthAppsElem @@ -134,16 +118,32 @@ func (j *OauthAppsRespOauthAppsElem) UnmarshalJSON(b []byte) error { return nil } +// A message with used applications +type OauthAppsResp struct { + // Echo of the request made. + EchoReq OauthAppsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType OauthAppsRespMsgType `json:"msg_type"` + + // List of 3rd party OAuth applications that used for the authorized account. + OauthApps []OauthAppsRespOauthAppsElem `json:"oauth_apps,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *OauthAppsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in OauthAppsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in OauthAppsResp: required") } type Plain OauthAppsResp diff --git a/schema/p2p_advert_create.go b/schema/p2p_advert_create.go index dfa588b..c2ccc3e 100644 --- a/schema/p2p_advert_create.go +++ b/schema/p2p_advert_create.go @@ -95,118 +95,117 @@ type P2PAdvertCreate struct { type P2PAdvertCreateBlockTrade int +type P2PAdvertCreateP2PAdvertCreate int + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type P2PAdvertCreatePassthrough map[string]interface{} + +type P2PAdvertCreateRateType string + +const P2PAdvertCreateRateTypeFixed P2PAdvertCreateRateType = "fixed" +const P2PAdvertCreateRateTypeFloat P2PAdvertCreateRateType = "float" + +type P2PAdvertCreateType string + +const P2PAdvertCreateTypeBuy P2PAdvertCreateType = "buy" +const P2PAdvertCreateTypeSell P2PAdvertCreateType = "sell" + var enumValues_P2PAdvertCreateBlockTrade = []interface{}{ 0, 1, } +var enumValues_P2PAdvertCreateP2PAdvertCreate = []interface{}{ + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateBlockTrade) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertCreateRateType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateBlockTrade { + for _, expected := range enumValues_P2PAdvertCreateRateType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRateType, v) } - *j = P2PAdvertCreateBlockTrade(v) + *j = P2PAdvertCreateRateType(v) return nil } -type P2PAdvertCreateP2PAdvertCreate int - -var enumValues_P2PAdvertCreateP2PAdvertCreate = []interface{}{ - 1, +var enumValues_P2PAdvertCreateType = []interface{}{ + "buy", + "sell", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateP2PAdvertCreate) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertCreateType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateP2PAdvertCreate { + for _, expected := range enumValues_P2PAdvertCreateType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateP2PAdvertCreate, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateType, v) } - *j = P2PAdvertCreateP2PAdvertCreate(v) + *j = P2PAdvertCreateType(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type P2PAdvertCreatePassthrough map[string]interface{} - -type P2PAdvertCreateRateType string - -const P2PAdvertCreateRateTypeFixed P2PAdvertCreateRateType = "fixed" -const P2PAdvertCreateRateTypeFloat P2PAdvertCreateRateType = "float" - var enumValues_P2PAdvertCreateRateType = []interface{}{ "fixed", "float", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRateType) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertCreateP2PAdvertCreate) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRateType { + for _, expected := range enumValues_P2PAdvertCreateP2PAdvertCreate { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateP2PAdvertCreate, v) } - *j = P2PAdvertCreateRateType(v) + *j = P2PAdvertCreateP2PAdvertCreate(v) return nil } -type P2PAdvertCreateType string - -const P2PAdvertCreateTypeBuy P2PAdvertCreateType = "buy" -const P2PAdvertCreateTypeSell P2PAdvertCreateType = "sell" - -var enumValues_P2PAdvertCreateType = []interface{}{ - "buy", - "sell", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateType) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertCreateBlockTrade) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateType { + for _, expected := range enumValues_P2PAdvertCreateBlockTrade { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateBlockTrade, v) } - *j = P2PAdvertCreateType(v) + *j = P2PAdvertCreateBlockTrade(v) return nil } @@ -216,22 +215,22 @@ func (j *P2PAdvertCreate) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in P2PAdvertCreate: required") } - if _, ok := raw["max_order_amount"]; raw != nil && !ok { + if v, ok := raw["max_order_amount"]; !ok || v == nil { return fmt.Errorf("field max_order_amount in P2PAdvertCreate: required") } - if _, ok := raw["min_order_amount"]; raw != nil && !ok { + if v, ok := raw["min_order_amount"]; !ok || v == nil { return fmt.Errorf("field min_order_amount in P2PAdvertCreate: required") } - if _, ok := raw["p2p_advert_create"]; raw != nil && !ok { + if v, ok := raw["p2p_advert_create"]; !ok || v == nil { return fmt.Errorf("field p2p_advert_create in P2PAdvertCreate: required") } - if _, ok := raw["rate"]; raw != nil && !ok { + if v, ok := raw["rate"]; !ok || v == nil { return fmt.Errorf("field rate in P2PAdvertCreate: required") } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in P2PAdvertCreate: required") } type Plain P2PAdvertCreate diff --git a/schema/p2p_advert_create_resp.go b/schema/p2p_advert_create_resp.go index 0456c28..5bc0b77 100644 --- a/schema/p2p_advert_create_resp.go +++ b/schema/p2p_advert_create_resp.go @@ -29,30 +29,6 @@ type P2PAdvertCreateRespMsgType string const P2PAdvertCreateRespMsgTypeP2PAdvertCreate P2PAdvertCreateRespMsgType = "p2p_advert_create" -var enumValues_P2PAdvertCreateRespMsgType = []interface{}{ - "p2p_advert_create", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespMsgType, v) - } - *j = P2PAdvertCreateRespMsgType(v) - return nil -} - // The information of the created P2P advert. type P2PAdvertCreateRespP2PAdvertCreate struct { // Currency for this advert. This is the system currency to be transferred between @@ -270,289 +246,325 @@ type P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails struct { type P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline int -var enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} +type P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable int + +type P2PAdvertCreateRespP2PAdvertCreateBlockTrade int + +type P2PAdvertCreateRespP2PAdvertCreateCounterpartyType string + +const P2PAdvertCreateRespP2PAdvertCreateCounterpartyTypeBuy P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = "buy" +const P2PAdvertCreateRespP2PAdvertCreateCounterpartyTypeSell P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = "sell" + +type P2PAdvertCreateRespP2PAdvertCreateIsActive int + +type P2PAdvertCreateRespP2PAdvertCreateIsVisible int + +// Details of available payment methods (sell adverts only). +type P2PAdvertCreateRespP2PAdvertCreatePaymentMethodDetails map[string]interface{} + +type P2PAdvertCreateRespP2PAdvertCreateRateType string + +const P2PAdvertCreateRespP2PAdvertCreateRateTypeFixed P2PAdvertCreateRespP2PAdvertCreateRateType = "fixed" +const P2PAdvertCreateRespP2PAdvertCreateRateTypeFloat P2PAdvertCreateRespP2PAdvertCreateRateType = "float" + +type P2PAdvertCreateRespP2PAdvertCreateType string + +const P2PAdvertCreateRespP2PAdvertCreateTypeBuy P2PAdvertCreateRespP2PAdvertCreateType = "buy" +const P2PAdvertCreateRespP2PAdvertCreateTypeSell P2PAdvertCreateRespP2PAdvertCreateType = "sell" + +type P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem string + +const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_fixed_rate_disabled" +const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_float_rate_disabled" // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline { + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline(v) + *j = P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem(v) return nil } -type P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable int - -var enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable = []interface{}{ +var enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertCreateRespP2PAdvertCreateIsVisible) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable { + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable(v) + *j = P2PAdvertCreateRespP2PAdvertCreateIsVisible(v) return nil } +var enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *P2PAdvertCreateRespP2PAdvertCreateCounterpartyType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { return err } - if _, ok := raw["completed_orders_count"]; raw != nil && !ok { - return fmt.Errorf("field completed_orders_count in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["is_online"]; raw != nil && !ok { - return fmt.Errorf("field is_online in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { - return fmt.Errorf("field is_schedule_available in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["last_online_time"]; raw != nil && !ok { - return fmt.Errorf("field last_online_time in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["name"]; raw != nil && !ok { - return fmt.Errorf("field name in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["rating_average"]; raw != nil && !ok { - return fmt.Errorf("field rating_average in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["rating_count"]; raw != nil && !ok { - return fmt.Errorf("field rating_count in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["recommended_average"]; raw != nil && !ok { - return fmt.Errorf("field recommended_average in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["recommended_count"]; raw != nil && !ok { - return fmt.Errorf("field recommended_count in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") - } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { - return fmt.Errorf("field total_completion_rate in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + var ok bool + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateCounterpartyType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateCounterpartyType, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails(plain) + *j = P2PAdvertCreateRespP2PAdvertCreateCounterpartyType(v) return nil } -type P2PAdvertCreateRespP2PAdvertCreateBlockTrade int - -var enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade = []interface{}{ - 0, - 1, +var enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType = []interface{}{ + "fixed", + "float", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateBlockTrade) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertCreateRespP2PAdvertCreateRateType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade { + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateBlockTrade(v) + *j = P2PAdvertCreateRespP2PAdvertCreateRateType(v) return nil } -type P2PAdvertCreateRespP2PAdvertCreateCounterpartyType string - -const P2PAdvertCreateRespP2PAdvertCreateCounterpartyTypeBuy P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = "buy" -const P2PAdvertCreateRespP2PAdvertCreateCounterpartyTypeSell P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = "sell" - var enumValues_P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = []interface{}{ "buy", "sell", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateCounterpartyType) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertCreateRespP2PAdvertCreateBlockTrade) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateCounterpartyType { + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateCounterpartyType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateCounterpartyType(v) + *j = P2PAdvertCreateRespP2PAdvertCreateBlockTrade(v) return nil } -type P2PAdvertCreateRespP2PAdvertCreateIsActive int - -var enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive = []interface{}{ +var enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade = []interface{}{ 0, 1, } +var enumValues_P2PAdvertCreateRespP2PAdvertCreateType = []interface{}{ + "buy", + "sell", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateIsActive) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertCreateRespP2PAdvertCreateType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive { + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateType, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateIsActive(v) + *j = P2PAdvertCreateRespP2PAdvertCreateType(v) return nil } -type P2PAdvertCreateRespP2PAdvertCreateIsVisible int - -var enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible = []interface{}{ - 0, - 1, +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["completed_orders_count"]; !ok || v == nil { + return fmt.Errorf("field completed_orders_count in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["is_online"]; !ok || v == nil { + return fmt.Errorf("field is_online in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["is_schedule_available"]; !ok || v == nil { + return fmt.Errorf("field is_schedule_available in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["last_online_time"]; !ok || v == nil { + return fmt.Errorf("field last_online_time in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["name"]; !ok || v == nil { + return fmt.Errorf("field name in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["rating_average"]; !ok || v == nil { + return fmt.Errorf("field rating_average in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["rating_count"]; !ok || v == nil { + return fmt.Errorf("field rating_count in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["recommended_average"]; !ok || v == nil { + return fmt.Errorf("field recommended_average in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["recommended_count"]; !ok || v == nil { + return fmt.Errorf("field recommended_count in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + if v, ok := raw["total_completion_rate"]; !ok || v == nil { + return fmt.Errorf("field total_completion_rate in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") + } + type Plain P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails(plain) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateIsVisible) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible { + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateIsVisible(v) + *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable(v) return nil } -// Details of available payment methods (sell adverts only). -type P2PAdvertCreateRespP2PAdvertCreatePaymentMethodDetails map[string]interface{} - -type P2PAdvertCreateRespP2PAdvertCreateRateType string - -const P2PAdvertCreateRespP2PAdvertCreateRateTypeFixed P2PAdvertCreateRespP2PAdvertCreateRateType = "fixed" -const P2PAdvertCreateRespP2PAdvertCreateRateTypeFloat P2PAdvertCreateRespP2PAdvertCreateRateType = "float" - -var enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType = []interface{}{ - "fixed", - "float", +var enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsScheduleAvailable = []interface{}{ + 0, + 1, +} +var enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = []interface{}{ + "advert_fixed_rate_disabled", + "advert_float_rate_disabled", + "advert_inactive", + "advert_max_limit", + "advert_min_limit", + "advert_remaining", + "advert_no_payment_methods", + "advertiser_ads_paused", + "advertiser_approval", + "advertiser_balance", + "advertiser_block_trade_ineligible", + "advertiser_daily_limit", + "advertiser_schedule", + "advertiser_temp_ban", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateRateType) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertCreateRespP2PAdvertCreateIsActive) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType { + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateRateType(v) + *j = P2PAdvertCreateRespP2PAdvertCreateIsActive(v) return nil } -type P2PAdvertCreateRespP2PAdvertCreateType string - -const P2PAdvertCreateRespP2PAdvertCreateTypeBuy P2PAdvertCreateRespP2PAdvertCreateType = "buy" -const P2PAdvertCreateRespP2PAdvertCreateTypeSell P2PAdvertCreateRespP2PAdvertCreateType = "sell" - -var enumValues_P2PAdvertCreateRespP2PAdvertCreateType = []interface{}{ - "buy", - "sell", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateType) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateType { + for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateType(v) + *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline(v) return nil } -type P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem string +var enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, +} -const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_fixed_rate_disabled" -const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_float_rate_disabled" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertInactive P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_inactive" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertMaxLimit P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_max_limit" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertMinLimit P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_min_limit" -const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_no_payment_methods" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertRemaining P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_remaining" +const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_no_payment_methods" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserAdsPaused P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advertiser_ads_paused" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserApproval P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advertiser_approval" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserBalance P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advertiser_balance" @@ -561,40 +573,23 @@ const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserDailyLimit const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserSchedule P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advertiser_schedule" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserTempBan P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advertiser_temp_ban" -var enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = []interface{}{ - "advert_fixed_rate_disabled", - "advert_float_rate_disabled", - "advert_inactive", - "advert_max_limit", - "advert_min_limit", - "advert_remaining", - "advert_no_payment_methods", - "advertiser_ads_paused", - "advertiser_approval", - "advertiser_balance", - "advertiser_block_trade_ineligible", - "advertiser_daily_limit", - "advertiser_schedule", - "advertiser_temp_ban", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertCreateRespMsgType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem { + for _, expected := range enumValues_P2PAdvertCreateRespMsgType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespMsgType, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem(v) + *j = P2PAdvertCreateRespMsgType(v) return nil } @@ -604,103 +599,103 @@ func (j *P2PAdvertCreateRespP2PAdvertCreate) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_currency"]; raw != nil && !ok { + if v, ok := raw["account_currency"]; !ok || v == nil { return fmt.Errorf("field account_currency in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["active_orders"]; raw != nil && !ok { + if v, ok := raw["active_orders"]; !ok || v == nil { return fmt.Errorf("field active_orders in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["advertiser_details"]; raw != nil && !ok { + if v, ok := raw["advertiser_details"]; !ok || v == nil { return fmt.Errorf("field advertiser_details in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["amount_display"]; raw != nil && !ok { + if v, ok := raw["amount_display"]; !ok || v == nil { return fmt.Errorf("field amount_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["block_trade"]; raw != nil && !ok { + if v, ok := raw["block_trade"]; !ok || v == nil { return fmt.Errorf("field block_trade in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["counterparty_type"]; raw != nil && !ok { + if v, ok := raw["counterparty_type"]; !ok || v == nil { return fmt.Errorf("field counterparty_type in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["country"]; raw != nil && !ok { + if v, ok := raw["country"]; !ok || v == nil { return fmt.Errorf("field country in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["description"]; raw != nil && !ok { + if v, ok := raw["description"]; !ok || v == nil { return fmt.Errorf("field description in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["effective_rate"]; raw != nil && !ok { + if v, ok := raw["effective_rate"]; !ok || v == nil { return fmt.Errorf("field effective_rate in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["effective_rate_display"]; raw != nil && !ok { + if v, ok := raw["effective_rate_display"]; !ok || v == nil { return fmt.Errorf("field effective_rate_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["is_active"]; raw != nil && !ok { + if v, ok := raw["is_active"]; !ok || v == nil { return fmt.Errorf("field is_active in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["local_currency"]; raw != nil && !ok { + if v, ok := raw["local_currency"]; !ok || v == nil { return fmt.Errorf("field local_currency in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["max_order_amount"]; raw != nil && !ok { + if v, ok := raw["max_order_amount"]; !ok || v == nil { return fmt.Errorf("field max_order_amount in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["max_order_amount_display"]; raw != nil && !ok { + if v, ok := raw["max_order_amount_display"]; !ok || v == nil { return fmt.Errorf("field max_order_amount_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["max_order_amount_limit"]; raw != nil && !ok { + if v, ok := raw["max_order_amount_limit"]; !ok || v == nil { return fmt.Errorf("field max_order_amount_limit in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["max_order_amount_limit_display"]; raw != nil && !ok { + if v, ok := raw["max_order_amount_limit_display"]; !ok || v == nil { return fmt.Errorf("field max_order_amount_limit_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["min_order_amount"]; raw != nil && !ok { + if v, ok := raw["min_order_amount"]; !ok || v == nil { return fmt.Errorf("field min_order_amount in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["min_order_amount_display"]; raw != nil && !ok { + if v, ok := raw["min_order_amount_display"]; !ok || v == nil { return fmt.Errorf("field min_order_amount_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["min_order_amount_limit"]; raw != nil && !ok { + if v, ok := raw["min_order_amount_limit"]; !ok || v == nil { return fmt.Errorf("field min_order_amount_limit in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["min_order_amount_limit_display"]; raw != nil && !ok { + if v, ok := raw["min_order_amount_limit_display"]; !ok || v == nil { return fmt.Errorf("field min_order_amount_limit_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["order_expiry_period"]; raw != nil && !ok { + if v, ok := raw["order_expiry_period"]; !ok || v == nil { return fmt.Errorf("field order_expiry_period in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["payment_method"]; raw != nil && !ok { + if v, ok := raw["payment_method"]; !ok || v == nil { return fmt.Errorf("field payment_method in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["price_display"]; raw != nil && !ok { + if v, ok := raw["price_display"]; !ok || v == nil { return fmt.Errorf("field price_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["rate"]; raw != nil && !ok { + if v, ok := raw["rate"]; !ok || v == nil { return fmt.Errorf("field rate in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["rate_display"]; raw != nil && !ok { + if v, ok := raw["rate_display"]; !ok || v == nil { return fmt.Errorf("field rate_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["rate_type"]; raw != nil && !ok { + if v, ok := raw["rate_type"]; !ok || v == nil { return fmt.Errorf("field rate_type in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["remaining_amount"]; raw != nil && !ok { + if v, ok := raw["remaining_amount"]; !ok || v == nil { return fmt.Errorf("field remaining_amount in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["remaining_amount_display"]; raw != nil && !ok { + if v, ok := raw["remaining_amount_display"]; !ok || v == nil { return fmt.Errorf("field remaining_amount_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in P2PAdvertCreateRespP2PAdvertCreate: required") } type Plain P2PAdvertCreateRespP2PAdvertCreate @@ -715,16 +710,20 @@ func (j *P2PAdvertCreateRespP2PAdvertCreate) UnmarshalJSON(b []byte) error { return nil } +var enumValues_P2PAdvertCreateRespMsgType = []interface{}{ + "p2p_advert_create", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertCreateResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertCreateResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertCreateResp: required") } type Plain P2PAdvertCreateResp diff --git a/schema/p2p_advert_info.go b/schema/p2p_advert_info.go index dca70d1..f1ceffe 100644 --- a/schema/p2p_advert_info.go +++ b/schema/p2p_advert_info.go @@ -6,35 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieve information about a P2P advert. -type P2PAdvertInfo struct { - // [Optional] The unique identifier for this advert. Optional when subscribe is 1. - // If not provided, all advertiser adverts will be subscribed. - Id *string `json:"id,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2PAdvertInfo P2PAdvertInfoP2PAdvertInfo `json:"p2p_advert_info"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PAdvertInfoPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to 1, will send updates when changes occur. Optional when id - // is provided. - Subscribe *P2PAdvertInfoSubscribe `json:"subscribe,omitempty"` - - // [Optional] If set to 1, the maximum order amount will be adjusted to the - // current balance and turnover limits of the account. - UseClientLimits P2PAdvertInfoUseClientLimits `json:"use_client_limits,omitempty"` -} - type P2PAdvertInfoP2PAdvertInfo int var enumValues_P2PAdvertInfoP2PAdvertInfo = []interface{}{ @@ -118,13 +89,42 @@ func (j *P2PAdvertInfoUseClientLimits) UnmarshalJSON(b []byte) error { return nil } +// Retrieve information about a P2P advert. +type P2PAdvertInfo struct { + // [Optional] The unique identifier for this advert. Optional when subscribe is 1. + // If not provided, all advertiser adverts will be subscribed. + Id *string `json:"id,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2PAdvertInfo P2PAdvertInfoP2PAdvertInfo `json:"p2p_advert_info"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PAdvertInfoPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to 1, will send updates when changes occur. Optional when id + // is provided. + Subscribe *P2PAdvertInfoSubscribe `json:"subscribe,omitempty"` + + // [Optional] If set to 1, the maximum order amount will be adjusted to the + // current balance and turnover limits of the account. + UseClientLimits P2PAdvertInfoUseClientLimits `json:"use_client_limits,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertInfo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_advert_info"]; raw != nil && !ok { + if v, ok := raw["p2p_advert_info"]; !ok || v == nil { return fmt.Errorf("field p2p_advert_info in P2PAdvertInfo: required") } type Plain P2PAdvertInfo diff --git a/schema/p2p_advert_info_resp.go b/schema/p2p_advert_info_resp.go index d662b2d..e718af9 100644 --- a/schema/p2p_advert_info_resp.go +++ b/schema/p2p_advert_info_resp.go @@ -32,30 +32,6 @@ type P2PAdvertInfoRespMsgType string const P2PAdvertInfoRespMsgTypeP2PAdvertInfo P2PAdvertInfoRespMsgType = "p2p_advert_info" -var enumValues_P2PAdvertInfoRespMsgType = []interface{}{ - "p2p_advert_info", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespMsgType, v) - } - *j = P2PAdvertInfoRespMsgType(v) - return nil -} - // P2P advert information. type P2PAdvertInfoRespP2PAdvertInfo struct { // Currency for this advert. This is the system currency to be transferred between @@ -311,186 +287,207 @@ type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails struct { type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked int -var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked = []interface{}{ - 0, - 1, +type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite int + +type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline int + +type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended struct { + Value interface{} } +type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable int + +type P2PAdvertInfoRespP2PAdvertInfoBlockTrade int + +type P2PAdvertInfoRespP2PAdvertInfoCounterpartyType string + +const P2PAdvertInfoRespP2PAdvertInfoCounterpartyTypeBuy P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = "buy" +const P2PAdvertInfoRespP2PAdvertInfoCounterpartyTypeSell P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = "sell" + +type P2PAdvertInfoRespP2PAdvertInfoDeleted int + +type P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem string + +const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemCompletionRate P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "completion_rate" +const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemCountry P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "country" +const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemJoinDate P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "join_date" +const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemRatingAverage P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "rating_average" + +type P2PAdvertInfoRespP2PAdvertInfoIsActive int + +type P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable int + +type P2PAdvertInfoRespP2PAdvertInfoIsEligible int + +type P2PAdvertInfoRespP2PAdvertInfoIsVisible int + +// Details of available payment methods (sell adverts only). +type P2PAdvertInfoRespP2PAdvertInfoPaymentMethodDetails map[string]interface{} + +type P2PAdvertInfoRespP2PAdvertInfoRateType string + +const P2PAdvertInfoRespP2PAdvertInfoRateTypeFixed P2PAdvertInfoRespP2PAdvertInfoRateType = "fixed" +const P2PAdvertInfoRespP2PAdvertInfoRateTypeFloat P2PAdvertInfoRespP2PAdvertInfoRateType = "float" + +type P2PAdvertInfoRespP2PAdvertInfoType string + +const P2PAdvertInfoRespP2PAdvertInfoTypeBuy P2PAdvertInfoRespP2PAdvertInfoType = "buy" +const P2PAdvertInfoRespP2PAdvertInfoTypeSell P2PAdvertInfoRespP2PAdvertInfoType = "sell" + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked(v) + *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite int - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertInfoRespP2PAdvertInfoDeleted) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoDeleted { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoDeleted, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite(v) + *j = P2PAdvertInfoRespP2PAdvertInfoDeleted(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline int - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertInfoRespP2PAdvertInfoCounterpartyType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoCounterpartyType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoCounterpartyType, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline(v) + *j = P2PAdvertInfoRespP2PAdvertInfoCounterpartyType(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended struct { - Value interface{} -} - -// MarshalJSON implements json.Marshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, +var enumValues_P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = []interface{}{ + "completion_rate", + "country", + "join_date", + "rating_average", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { - var v struct { - Value interface{} - } - if err := json.Unmarshal(b, &v.Value); err != nil { +func (j *P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended { - if reflect.DeepEqual(v.Value, expected) { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem { + if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended, v.Value) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended(v) + *j = P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable int - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable = []interface{}{ - 0, - 1, +var enumValues_P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = []interface{}{ + "buy", + "sell", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertInfoRespP2PAdvertInfoBlockTrade) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoBlockTrade { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoBlockTrade, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable(v) + *j = P2PAdvertInfoRespP2PAdvertInfoBlockTrade(v) return nil } +var enumValues_P2PAdvertInfoRespP2PAdvertInfoBlockTrade = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["completed_orders_count"]; raw != nil && !ok { + if v, ok := raw["completed_orders_count"]; !ok || v == nil { return fmt.Errorf("field completed_orders_count in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { + if v, ok := raw["is_schedule_available"]; !ok || v == nil { return fmt.Errorf("field is_schedule_available in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["rating_average"]; raw != nil && !ok { + if v, ok := raw["rating_average"]; !ok || v == nil { return fmt.Errorf("field rating_average in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["rating_count"]; raw != nil && !ok { + if v, ok := raw["rating_count"]; !ok || v == nil { return fmt.Errorf("field rating_count in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["recommended_average"]; raw != nil && !ok { + if v, ok := raw["recommended_average"]; !ok || v == nil { return fmt.Errorf("field recommended_average in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["recommended_count"]; raw != nil && !ok { + if v, ok := raw["recommended_count"]; !ok || v == nil { return fmt.Errorf("field recommended_count in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { + if v, ok := raw["total_completion_rate"]; !ok || v == nil { return fmt.Errorf("field total_completion_rate in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } type Plain P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails @@ -502,239 +499,183 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails) UnmarshalJSON(b []byte return nil } -type P2PAdvertInfoRespP2PAdvertInfoBlockTrade int - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoBlockTrade = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoBlockTrade) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoBlockTrade { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoBlockTrade(v) + *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoCounterpartyType string - -const P2PAdvertInfoRespP2PAdvertInfoCounterpartyTypeBuy P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = "buy" -const P2PAdvertInfoRespP2PAdvertInfoCounterpartyTypeSell P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = "sell" - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = []interface{}{ - "buy", - "sell", +var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsActive = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoCounterpartyType) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertInfoRespP2PAdvertInfoIsActive) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoCounterpartyType { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoIsActive { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoCounterpartyType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoIsActive, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoCounterpartyType(v) + *j = P2PAdvertInfoRespP2PAdvertInfoIsActive(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoDeleted int - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoDeleted = []interface{}{ +var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsScheduleAvailable = []interface{}{ + 0, + 1, +} +var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable = []interface{}{ + 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoDeleted) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoDeleted { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoDeleted, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoDeleted(v) + *j = P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem string - -const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemCompletionRate P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "completion_rate" -const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemCountry P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "country" -const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemJoinDate P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "join_date" -const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemRatingAverage P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "rating_average" - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = []interface{}{ - "completion_rate", - "country", - "join_date", - "rating_average", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem, v) +func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { + var v struct { + Value interface{} } - *j = P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem(v) - return nil -} - -type P2PAdvertInfoRespP2PAdvertInfoIsActive int - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsActive = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoIsActive) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { + if err := json.Unmarshal(b, &v.Value); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoIsActive { - if reflect.DeepEqual(v, expected) { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended { + if reflect.DeepEqual(v.Value, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoIsActive, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended, v.Value) } - *j = P2PAdvertInfoRespP2PAdvertInfoIsActive(v) + *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable int - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable = []interface{}{ +var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsEligible = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertInfoRespP2PAdvertInfoIsEligible) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoIsEligible { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoIsEligible, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoIsClientScheduleAvailable(v) + *j = P2PAdvertInfoRespP2PAdvertInfoIsEligible(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoIsEligible int +// MarshalJSON implements json.Marshaler. +func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} -var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsEligible = []interface{}{ +var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsVisible = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoIsEligible) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertInfoRespP2PAdvertInfoIsVisible) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoIsEligible { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoIsVisible { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoIsEligible, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoIsVisible, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoIsEligible(v) + *j = P2PAdvertInfoRespP2PAdvertInfoIsVisible(v) return nil } -type P2PAdvertInfoRespP2PAdvertInfoIsVisible int - -var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsVisible = []interface{}{ - 0, - 1, +var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended = []interface{}{ + nil, + 0.0, + 1.0, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoIsVisible) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoIsVisible { + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoIsVisible, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline, v) } - *j = P2PAdvertInfoRespP2PAdvertInfoIsVisible(v) + *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline(v) return nil } -// Details of available payment methods (sell adverts only). -type P2PAdvertInfoRespP2PAdvertInfoPaymentMethodDetails map[string]interface{} - -type P2PAdvertInfoRespP2PAdvertInfoRateType string - -const P2PAdvertInfoRespP2PAdvertInfoRateTypeFixed P2PAdvertInfoRespP2PAdvertInfoRateType = "fixed" -const P2PAdvertInfoRespP2PAdvertInfoRateTypeFloat P2PAdvertInfoRespP2PAdvertInfoRateType = "float" - var enumValues_P2PAdvertInfoRespP2PAdvertInfoRateType = []interface{}{ "fixed", "float", @@ -760,11 +701,17 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoRateType) UnmarshalJSON(b []byte) error { return nil } -type P2PAdvertInfoRespP2PAdvertInfoType string - -const P2PAdvertInfoRespP2PAdvertInfoTypeBuy P2PAdvertInfoRespP2PAdvertInfoType = "buy" -const P2PAdvertInfoRespP2PAdvertInfoTypeSell P2PAdvertInfoRespP2PAdvertInfoType = "sell" - +var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, +} +var enumValues_P2PAdvertInfoRespP2PAdvertInfoDeleted = []interface{}{ + 1, +} +var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite = []interface{}{ + 0, + 1, +} var enumValues_P2PAdvertInfoRespP2PAdvertInfoType = []interface{}{ "buy", "sell", @@ -790,22 +737,32 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoType) UnmarshalJSON(b []byte) error { return nil } -type P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem string +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked, v) + } + *j = P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked(v) + return nil +} -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_fixed_rate_disabled" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_float_rate_disabled" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertInactive P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_inactive" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertMaxLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_max_limit" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertMinLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_min_limit" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_no_payment_methods" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertRemaining P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_remaining" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserAdsPaused P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_ads_paused" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserApproval P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_approval" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserBalance P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_balance" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_block_trade_ineligible" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserDailyLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_daily_limit" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserSchedule P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_schedule" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserTempBan P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_temp_ban" +var enumValues_P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked = []interface{}{ + 0, + 1, +} + +type P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem string var enumValues_P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = []interface{}{ "advert_fixed_rate_disabled", @@ -844,6 +801,41 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem) UnmarshalJSON(b []b return nil } +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_fixed_rate_disabled" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_float_rate_disabled" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertInactive P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_inactive" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertMaxLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_max_limit" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertMinLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_min_limit" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertRemaining P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_remaining" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_no_payment_methods" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserAdsPaused P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_ads_paused" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserApproval P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_approval" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserBalance P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_balance" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_block_trade_ineligible" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserDailyLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_daily_limit" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserSchedule P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_schedule" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserTempBan P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_temp_ban" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertInfoRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertInfoRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertInfoRespMsgType, v) + } + *j = P2PAdvertInfoRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertInfoRespP2PAdvertInfo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} @@ -878,7 +870,7 @@ func (j *P2PAdvertInfoRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertInfoRespSubscription: required") } type Plain P2PAdvertInfoRespSubscription @@ -890,16 +882,20 @@ func (j *P2PAdvertInfoRespSubscription) UnmarshalJSON(b []byte) error { return nil } +var enumValues_P2PAdvertInfoRespMsgType = []interface{}{ + "p2p_advert_info", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertInfoResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertInfoResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertInfoResp: required") } type Plain P2PAdvertInfoResp diff --git a/schema/p2p_advert_list.go b/schema/p2p_advert_list.go index 1883356..f8aea15 100644 --- a/schema/p2p_advert_list.go +++ b/schema/p2p_advert_list.go @@ -6,71 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Returns available adverts for use with `p2p_order_create` . -type P2PAdvertList struct { - // [Optional] ID of the advertiser to list adverts for. - AdvertiserId *string `json:"advertiser_id,omitempty"` - - // [Optional] Search for advertiser by name. Partial matches will be returned. - AdvertiserName *string `json:"advertiser_name,omitempty"` - - // [Optional] How much to buy or sell, used to calculate prices. - Amount *float64 `json:"amount,omitempty"` - - // [Optional] Return block trade adverts when 1, non-block trade adverts when 0 - // (default). - BlockTrade P2PAdvertListBlockTrade `json:"block_trade,omitempty"` - - // [Optional] Filter the adverts by `counterparty_type`. - CounterpartyType *P2PAdvertListCounterpartyType `json:"counterparty_type,omitempty"` - - // [Optional] Only show adverts from favourite advertisers. Default is 0. - FavouritesOnly *P2PAdvertListFavouritesOnly `json:"favourites_only,omitempty"` - - // [Optional] If set to 1, adverts for which the current user's shcedule does not - // have availability from now until the full possible order expiry are not - // returned. - HideClientScheduleUnavailable P2PAdvertListHideClientScheduleUnavailable `json:"hide_client_schedule_unavailable,omitempty"` - - // [Optional] If set to 1, adverts for which the current user does not meet - // counteryparty terms are not returned. - HideIneligible P2PAdvertListHideIneligible `json:"hide_ineligible,omitempty"` - - // [Optional] Used for paging. - Limit int `json:"limit,omitempty"` - - // [Optional] Currency to conduct payment transaction in. If not provided, only - // ads from country of residence will be returned. - LocalCurrency *string `json:"local_currency,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used for paging. - Offset int `json:"offset,omitempty"` - - // Must be 1 - P2PAdvertList P2PAdvertListP2PAdvertList `json:"p2p_advert_list"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PAdvertListPassthrough `json:"passthrough,omitempty"` - - // [Optional] Search by supported payment methods. - PaymentMethod []string `json:"payment_method,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] How the results are sorted. - SortBy P2PAdvertListSortBy `json:"sort_by,omitempty"` - - // [Optional] If set to 1, ads that exceed this account's balance or turnover - // limits will not be shown. - UseClientLimits P2PAdvertListUseClientLimits `json:"use_client_limits,omitempty"` -} - type P2PAdvertListBlockTrade int var enumValues_P2PAdvertListBlockTrade = []interface{}{ @@ -100,9 +35,6 @@ func (j *P2PAdvertListBlockTrade) UnmarshalJSON(b []byte) error { type P2PAdvertListCounterpartyType string -const P2PAdvertListCounterpartyTypeBuy P2PAdvertListCounterpartyType = "buy" -const P2PAdvertListCounterpartyTypeSell P2PAdvertListCounterpartyType = "sell" - var enumValues_P2PAdvertListCounterpartyType = []interface{}{ "buy", "sell", @@ -128,6 +60,9 @@ func (j *P2PAdvertListCounterpartyType) UnmarshalJSON(b []byte) error { return nil } +const P2PAdvertListCounterpartyTypeBuy P2PAdvertListCounterpartyType = "buy" +const P2PAdvertListCounterpartyTypeSell P2PAdvertListCounterpartyType = "sell" + type P2PAdvertListFavouritesOnly int var enumValues_P2PAdvertListFavouritesOnly = []interface{}{ @@ -241,11 +176,6 @@ type P2PAdvertListPassthrough map[string]interface{} type P2PAdvertListSortBy string -const P2PAdvertListSortByCompletion P2PAdvertListSortBy = "completion" -const P2PAdvertListSortByRate P2PAdvertListSortBy = "rate" -const P2PAdvertListSortByRating P2PAdvertListSortBy = "rating" -const P2PAdvertListSortByRecommended P2PAdvertListSortBy = "recommended" - var enumValues_P2PAdvertListSortBy = []interface{}{ "completion", "rate", @@ -273,6 +203,11 @@ func (j *P2PAdvertListSortBy) UnmarshalJSON(b []byte) error { return nil } +const P2PAdvertListSortByCompletion P2PAdvertListSortBy = "completion" +const P2PAdvertListSortByRate P2PAdvertListSortBy = "rate" +const P2PAdvertListSortByRating P2PAdvertListSortBy = "rating" +const P2PAdvertListSortByRecommended P2PAdvertListSortBy = "recommended" + type P2PAdvertListUseClientLimits int var enumValues_P2PAdvertListUseClientLimits = []interface{}{ @@ -300,13 +235,78 @@ func (j *P2PAdvertListUseClientLimits) UnmarshalJSON(b []byte) error { return nil } +// Returns available adverts for use with `p2p_order_create` . +type P2PAdvertList struct { + // [Optional] ID of the advertiser to list adverts for. + AdvertiserId *string `json:"advertiser_id,omitempty"` + + // [Optional] Search for advertiser by name. Partial matches will be returned. + AdvertiserName *string `json:"advertiser_name,omitempty"` + + // [Optional] How much to buy or sell, used to calculate prices. + Amount *float64 `json:"amount,omitempty"` + + // [Optional] Return block trade adverts when 1, non-block trade adverts when 0 + // (default). + BlockTrade P2PAdvertListBlockTrade `json:"block_trade,omitempty"` + + // [Optional] Filter the adverts by `counterparty_type`. + CounterpartyType *P2PAdvertListCounterpartyType `json:"counterparty_type,omitempty"` + + // [Optional] Only show adverts from favourite advertisers. Default is 0. + FavouritesOnly *P2PAdvertListFavouritesOnly `json:"favourites_only,omitempty"` + + // [Optional] If set to 1, adverts for which the current user's shcedule does not + // have availability from now until the full possible order expiry are not + // returned. + HideClientScheduleUnavailable P2PAdvertListHideClientScheduleUnavailable `json:"hide_client_schedule_unavailable,omitempty"` + + // [Optional] If set to 1, adverts for which the current user does not meet + // counteryparty terms are not returned. + HideIneligible P2PAdvertListHideIneligible `json:"hide_ineligible,omitempty"` + + // [Optional] Used for paging. + Limit int `json:"limit,omitempty"` + + // [Optional] Currency to conduct payment transaction in. If not provided, only + // ads from country of residence will be returned. + LocalCurrency *string `json:"local_currency,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used for paging. + Offset int `json:"offset,omitempty"` + + // Must be 1 + P2PAdvertList P2PAdvertListP2PAdvertList `json:"p2p_advert_list"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PAdvertListPassthrough `json:"passthrough,omitempty"` + + // [Optional] Search by supported payment methods. + PaymentMethod []string `json:"payment_method,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] How the results are sorted. + SortBy P2PAdvertListSortBy `json:"sort_by,omitempty"` + + // [Optional] If set to 1, ads that exceed this account's balance or turnover + // limits will not be shown. + UseClientLimits P2PAdvertListUseClientLimits `json:"use_client_limits,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertList) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_advert_list"]; raw != nil && !ok { + if v, ok := raw["p2p_advert_list"]; !ok || v == nil { return fmt.Errorf("field p2p_advert_list in P2PAdvertList: required") } type Plain P2PAdvertList diff --git a/schema/p2p_advert_list_resp.go b/schema/p2p_advert_list_resp.go index 950a09b..354b79d 100644 --- a/schema/p2p_advert_list_resp.go +++ b/schema/p2p_advert_list_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Available adverts matching the requested criteria. -type P2PAdvertListResp struct { - // Echo of the request made. - EchoReq P2PAdvertListRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertListRespMsgType `json:"msg_type"` - - // P2P adverts list. - P2PAdvertList *P2PAdvertListRespP2PAdvertList `json:"p2p_advert_list,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PAdvertListRespEchoReq map[string]interface{} type P2PAdvertListRespMsgType string -const P2PAdvertListRespMsgTypeP2PAdvertList P2PAdvertListRespMsgType = "p2p_advert_list" - var enumValues_P2PAdvertListRespMsgType = []interface{}{ "p2p_advert_list", } @@ -53,257 +35,7 @@ func (j *P2PAdvertListRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// P2P adverts list. -type P2PAdvertListRespP2PAdvertList struct { - // List of adverts. - List []P2PAdvertListRespP2PAdvertListListElem `json:"list"` -} - -type P2PAdvertListRespP2PAdvertListListElem struct { - // Currency for this advert. This is the system currency to be transferred between - // advertiser and client. - AccountCurrency string `json:"account_currency"` - - // The number of active orders against this advert. - ActiveOrders *int `json:"active_orders,omitempty"` - - // Details of the advertiser for this advert. - AdvertiserDetails P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails `json:"advertiser_details"` - - // The total amount specified in advert, in `account_currency`. It is only visible - // to the advert owner. - Amount *float64 `json:"amount,omitempty"` - - // The total amount specified in advert, in `account_currency`, formatted to - // appropriate decimal places. It is only visible to the advert owner. - AmountDisplay *string `json:"amount_display,omitempty"` - - // Indicates if this is block trade advert or not. - BlockTrade P2PAdvertListRespP2PAdvertListListElemBlockTrade `json:"block_trade"` - - // Advertiser contact information. Only applicable for 'sell adverts'. - ContactInfo *string `json:"contact_info,omitempty"` - - // Type of transaction from the opposite party's perspective. - CounterpartyType P2PAdvertListRespP2PAdvertListListElemCounterpartyType `json:"counterparty_type"` - - // The target country code of the advert. - Country string `json:"country"` - - // The advert creation time in epoch. - CreatedTime int `json:"created_time"` - - // Days until automatic inactivation of this ad, if no activity occurs. - DaysUntilArchive *int `json:"days_until_archive,omitempty"` - - // General information about the advert. - Description string `json:"description"` - - // Conversion rate from account currency to local currency, using current market - // rate if applicable. - EffectiveRate *float64 `json:"effective_rate"` - - // Conversion rate from account currency to local currency, using current market - // rate if applicable, formatted to appropriate decimal places. - EffectiveRateDisplay *string `json:"effective_rate_display"` - - // Reasons why the counterparty terms do not allow the current user to place - // orders against this advert. Possible values: - // - `completion_rate`: current user's 30 day completion rate is less than - // `min_completion_rate`. - // - `country`: current user's residence is not in `eligible_countries`. - // - `join_date`: current user registered on P2P less than `min_join_days` in the - // past. - // - `rating`: current user's average review rating is less than `min_rating`. - EligibilityStatus []P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem `json:"eligibility_status,omitempty"` - - // 2 letter country codes. Counterparties who do not live in these countries are - // not allowed to place orders against this advert. - EligibleCountries []string `json:"eligible_countries,omitempty"` - - // The unique identifier for this advert. - Id string `json:"id"` - - // The activation status of the advert. - IsActive P2PAdvertListRespP2PAdvertListListElemIsActive `json:"is_active"` - - // Inidcates whether the current user's schedule has availability between now and - // now + order_expiry_period. - IsClientScheduleAvailable *P2PAdvertListRespP2PAdvertListListElemIsClientScheduleAvailable `json:"is_client_schedule_available,omitempty"` - - // Indicates that the current user meets the counterparty terms for placing an - // order. - IsEligible P2PAdvertListRespP2PAdvertListListElemIsEligible `json:"is_eligible,omitempty"` - - // Indicates that this advert will appear on the main advert list. - IsVisible P2PAdvertListRespP2PAdvertListListElemIsVisible `json:"is_visible"` - - // Local currency for this advert. This is the form of payment to be arranged - // directly between advertiser and client. - LocalCurrency string `json:"local_currency"` - - // Maximum order amount specified in advert, in `account_currency`. It is only - // visible for advertisers. - MaxOrderAmount *float64 `json:"max_order_amount,omitempty"` - - // Maximum order amount specified in advert, in `account_currency`, formatted to - // appropriate decimal places. It is only visible to the advert owner. - MaxOrderAmountDisplay *string `json:"max_order_amount_display,omitempty"` - - // Maximum order amount at this time, in `account_currency`. - MaxOrderAmountLimit float64 `json:"max_order_amount_limit"` - - // Maximum order amount at this time, in `account_currency`, formatted to - // appropriate decimal places. - MaxOrderAmountLimitDisplay string `json:"max_order_amount_limit_display"` - - // Counterparties who have a 30 day completion rate less than this value are not - // allowed to place orders against this advert. - MinCompletionRate *float64 `json:"min_completion_rate,omitempty"` - - // Counterparties who joined less than this number of days ago are not allowed to - // place orders against this advert. - MinJoinDays *int `json:"min_join_days,omitempty"` - - // Minimum order amount specified in advert, in `account_currency`. It is only - // visible for advertisers. - MinOrderAmount *float64 `json:"min_order_amount,omitempty"` - - // Minimum order amount specified in advert, in `account_currency`, formatted to - // appropriate decimal places. It is only visible to the advert owner. - MinOrderAmountDisplay *string `json:"min_order_amount_display,omitempty"` - - // Minimum order amount at this time, in `account_currency`. - MinOrderAmountLimit float64 `json:"min_order_amount_limit"` - - // Minimum order amount at this time, in `account_currency`, formatted to - // appropriate decimal places. - MinOrderAmountLimitDisplay string `json:"min_order_amount_limit_display"` - - // Counterparties who have an average rating less than this value are not allowed - // to place orders against this advert. - MinRating *float64 `json:"min_rating,omitempty"` - - // Expiry period (seconds) for order created against this ad. - OrderExpiryPeriod int `json:"order_expiry_period"` - - // Payment instructions. Only applicable for 'sell adverts'. - PaymentInfo *string `json:"payment_info,omitempty"` - - // Payment method name (deprecated). - PaymentMethod *string `json:"payment_method"` - - // Names of supported payment methods. - PaymentMethodNames []string `json:"payment_method_names,omitempty"` - - // Cost of the advert in local currency. - Price *float64 `json:"price"` - - // Cost of the advert in local currency, formatted to appropriate decimal places. - PriceDisplay *string `json:"price_display"` - - // Conversion rate from advertiser's account currency to `local_currency`. An - // absolute rate value (fixed), or percentage offset from current market rate - // (floating). - Rate float64 `json:"rate"` - - // Conversion rate formatted to appropriate decimal places. - RateDisplay string `json:"rate_display"` - - // Type of rate, fixed or floating. - RateType P2PAdvertListRespP2PAdvertListListElemRateType `json:"rate_type"` - - // Amount currently available for orders, in `account_currency`. It is only - // visible to the advert owner. - RemainingAmount *float64 `json:"remaining_amount,omitempty"` - - // Amount currently available for orders, in `account_currency`, formatted to - // appropriate decimal places. It is only visible to the advert owner. - RemainingAmountDisplay *string `json:"remaining_amount_display,omitempty"` - - // Whether this is a buy or a sell. - Type P2PAdvertListRespP2PAdvertListListElemType `json:"type"` - - // Reasons why an advert is not visible. Possible values: - // - `advert_fixed_rate_disabled`: fixed rate adverts are no longer available in - // the advert's country. - // - `advert_float_rate_disabled`: floating rate adverts are no longer available - // in the advert's country. - // - `advert_inactive`: the advert is set inactive. - // - `advert_max_limit`: the minimum order amount exceeds the system maximum - // order. - // - `advert_min_limit`: the maximum order amount is too small to be shown on the - // advert list. - // - `advert_remaining`: the remaining amount of the advert is below the minimum - // order. - // - `advert_no_payment_methods`: the advert has no valid payment methods. - // - `advertiser_ads_paused`: the advertiser has paused all adverts. - // - `advertiser_approval`: the advertiser's proof of identity is not verified. - // - `advertiser_balance`: the advertiser's P2P balance is less than the minimum - // order. - // - `advertiser_schedule`: the advertiser's schedule does not have availability - // between now and now + order_expiry_period. - // - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible - // for block trading. - // - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than - // the minimum order. - // - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. - VisibilityStatus []P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem `json:"visibility_status,omitempty"` -} - -// Details of the advertiser for this advert. -type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails struct { - // The total number of orders completed in the past 30 days. - CompletedOrdersCount int `json:"completed_orders_count"` - - // The advertiser's first name. - FirstName *string `json:"first_name,omitempty"` - - // The advertiser's unique identifier. - Id string `json:"id"` - - // Indicates that the advertiser is blocked by the current user. - IsBlocked *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked `json:"is_blocked,omitempty"` - - // Indicates that the advertiser is a favourite. - IsFavourite *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsFavourite `json:"is_favourite,omitempty"` - - // Indicates if the advertiser is currently online. - IsOnline P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline `json:"is_online"` - - // Indicates that the advertiser was recommended in the most recent review by the - // current user. - IsRecommended *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended `json:"is_recommended,omitempty"` - - // Inidcates whether the advertiser's schedule has availability between now and - // now + order_expiry_period. - IsScheduleAvailable P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsScheduleAvailable `json:"is_schedule_available"` - - // The advertiser's last name. - LastName *string `json:"last_name,omitempty"` - - // Epoch of the latest time the advertiser was online, up to 6 months. - LastOnlineTime *int `json:"last_online_time"` - - // The advertiser's displayed name. - Name string `json:"name"` - - // Average rating of the advertiser, range is 1-5. - RatingAverage *float64 `json:"rating_average"` - - // Number of ratings given to the advertiser. - RatingCount int `json:"rating_count"` - - // Percentage of users who have recommended the advertiser. - RecommendedAverage *float64 `json:"recommended_average"` - - // Number of times the advertiser has been recommended. - RecommendedCount *float64 `json:"recommended_count"` - - // The percentage of successfully completed orders made by or placed against the - // advertiser within the past 30 days. - TotalCompletionRate *float64 `json:"total_completion_rate"` -} +const P2PAdvertListRespMsgTypeP2PAdvertList P2PAdvertListRespMsgType = "p2p_advert_list" type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked int @@ -389,17 +121,17 @@ type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended struct Value interface{} } -// MarshalJSON implements json.Marshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - var enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended = []interface{}{ nil, 0.0, 1.0, } +// MarshalJSON implements json.Marshaler. +func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -449,43 +181,97 @@ func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsScheduleAvaila return nil } +// Details of the advertiser for this advert. +type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails struct { + // The total number of orders completed in the past 30 days. + CompletedOrdersCount int `json:"completed_orders_count"` + + // The advertiser's first name. + FirstName *string `json:"first_name,omitempty"` + + // The advertiser's unique identifier. + Id string `json:"id"` + + // Indicates that the advertiser is blocked by the current user. + IsBlocked *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked `json:"is_blocked,omitempty"` + + // Indicates that the advertiser is a favourite. + IsFavourite *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsFavourite `json:"is_favourite,omitempty"` + + // Indicates if the advertiser is currently online. + IsOnline P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline `json:"is_online"` + + // Indicates that the advertiser was recommended in the most recent review by the + // current user. + IsRecommended *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended `json:"is_recommended,omitempty"` + + // Inidcates whether the advertiser's schedule has availability between now and + // now + order_expiry_period. + IsScheduleAvailable P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsScheduleAvailable `json:"is_schedule_available"` + + // The advertiser's last name. + LastName *string `json:"last_name,omitempty"` + + // Epoch of the latest time the advertiser was online, up to 6 months. + LastOnlineTime *int `json:"last_online_time"` + + // The advertiser's displayed name. + Name string `json:"name"` + + // Average rating of the advertiser, range is 1-5. + RatingAverage *float64 `json:"rating_average"` + + // Number of ratings given to the advertiser. + RatingCount int `json:"rating_count"` + + // Percentage of users who have recommended the advertiser. + RecommendedAverage *float64 `json:"recommended_average"` + + // Number of times the advertiser has been recommended. + RecommendedCount *float64 `json:"recommended_count"` + + // The percentage of successfully completed orders made by or placed against the + // advertiser within the past 30 days. + TotalCompletionRate *float64 `json:"total_completion_rate"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["completed_orders_count"]; raw != nil && !ok { + if v, ok := raw["completed_orders_count"]; !ok || v == nil { return fmt.Errorf("field completed_orders_count in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { + if v, ok := raw["is_schedule_available"]; !ok || v == nil { return fmt.Errorf("field is_schedule_available in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["rating_average"]; raw != nil && !ok { + if v, ok := raw["rating_average"]; !ok || v == nil { return fmt.Errorf("field rating_average in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["rating_count"]; raw != nil && !ok { + if v, ok := raw["rating_count"]; !ok || v == nil { return fmt.Errorf("field rating_count in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["recommended_average"]; raw != nil && !ok { + if v, ok := raw["recommended_average"]; !ok || v == nil { return fmt.Errorf("field recommended_average in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["recommended_count"]; raw != nil && !ok { + if v, ok := raw["recommended_count"]; !ok || v == nil { return fmt.Errorf("field recommended_count in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { + if v, ok := raw["total_completion_rate"]; !ok || v == nil { return fmt.Errorf("field total_completion_rate in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } type Plain P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails @@ -526,9 +312,6 @@ func (j *P2PAdvertListRespP2PAdvertListListElemBlockTrade) UnmarshalJSON(b []byt type P2PAdvertListRespP2PAdvertListListElemCounterpartyType string -const P2PAdvertListRespP2PAdvertListListElemCounterpartyTypeBuy P2PAdvertListRespP2PAdvertListListElemCounterpartyType = "buy" -const P2PAdvertListRespP2PAdvertListListElemCounterpartyTypeSell P2PAdvertListRespP2PAdvertListListElemCounterpartyType = "sell" - var enumValues_P2PAdvertListRespP2PAdvertListListElemCounterpartyType = []interface{}{ "buy", "sell", @@ -554,12 +337,10 @@ func (j *P2PAdvertListRespP2PAdvertListListElemCounterpartyType) UnmarshalJSON(b return nil } -type P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem string +const P2PAdvertListRespP2PAdvertListListElemCounterpartyTypeBuy P2PAdvertListRespP2PAdvertListListElemCounterpartyType = "buy" +const P2PAdvertListRespP2PAdvertListListElemCounterpartyTypeSell P2PAdvertListRespP2PAdvertListListElemCounterpartyType = "sell" -const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemCompletionRate P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "completion_rate" -const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemCountry P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "country" -const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemJoinDate P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "join_date" -const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemRatingAverage P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "rating_average" +type P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem string var enumValues_P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = []interface{}{ "completion_rate", @@ -588,6 +369,11 @@ func (j *P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem) UnmarshalJ return nil } +const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemCompletionRate P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "completion_rate" +const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemCountry P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "country" +const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemJoinDate P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "join_date" +const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemRatingAverage P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "rating_average" + type P2PAdvertListRespP2PAdvertListListElemIsActive int var enumValues_P2PAdvertListRespP2PAdvertListListElemIsActive = []interface{}{ @@ -698,9 +484,6 @@ func (j *P2PAdvertListRespP2PAdvertListListElemIsVisible) UnmarshalJSON(b []byte type P2PAdvertListRespP2PAdvertListListElemRateType string -const P2PAdvertListRespP2PAdvertListListElemRateTypeFixed P2PAdvertListRespP2PAdvertListListElemRateType = "fixed" -const P2PAdvertListRespP2PAdvertListListElemRateTypeFloat P2PAdvertListRespP2PAdvertListListElemRateType = "float" - var enumValues_P2PAdvertListRespP2PAdvertListListElemRateType = []interface{}{ "fixed", "float", @@ -726,10 +509,10 @@ func (j *P2PAdvertListRespP2PAdvertListListElemRateType) UnmarshalJSON(b []byte) return nil } -type P2PAdvertListRespP2PAdvertListListElemType string +const P2PAdvertListRespP2PAdvertListListElemRateTypeFixed P2PAdvertListRespP2PAdvertListListElemRateType = "fixed" +const P2PAdvertListRespP2PAdvertListListElemRateTypeFloat P2PAdvertListRespP2PAdvertListListElemRateType = "float" -const P2PAdvertListRespP2PAdvertListListElemTypeBuy P2PAdvertListRespP2PAdvertListListElemType = "buy" -const P2PAdvertListRespP2PAdvertListListElemTypeSell P2PAdvertListRespP2PAdvertListListElemType = "sell" +type P2PAdvertListRespP2PAdvertListListElemType string var enumValues_P2PAdvertListRespP2PAdvertListListElemType = []interface{}{ "buy", @@ -756,22 +539,10 @@ func (j *P2PAdvertListRespP2PAdvertListListElemType) UnmarshalJSON(b []byte) err return nil } -type P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem string +const P2PAdvertListRespP2PAdvertListListElemTypeBuy P2PAdvertListRespP2PAdvertListListElemType = "buy" +const P2PAdvertListRespP2PAdvertListListElemTypeSell P2PAdvertListRespP2PAdvertListListElemType = "sell" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_fixed_rate_disabled" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_float_rate_disabled" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertInactive P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_inactive" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertMaxLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_max_limit" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertMinLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_min_limit" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_no_payment_methods" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertRemaining P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_remaining" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserAdsPaused P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_ads_paused" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserApproval P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_approval" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserBalance P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_balance" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_block_trade_ineligible" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserDailyLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_daily_limit" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserSchedule P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_schedule" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserTempBan P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_temp_ban" +type P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem string var enumValues_P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = []interface{}{ "advert_fixed_rate_disabled", @@ -810,82 +581,289 @@ func (j *P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem) UnmarshalJS return nil } +type P2PAdvertListRespP2PAdvertListListElem struct { + // Currency for this advert. This is the system currency to be transferred between + // advertiser and client. + AccountCurrency string `json:"account_currency"` + + // The number of active orders against this advert. + ActiveOrders *int `json:"active_orders,omitempty"` + + // Details of the advertiser for this advert. + AdvertiserDetails P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails `json:"advertiser_details"` + + // The total amount specified in advert, in `account_currency`. It is only visible + // to the advert owner. + Amount *float64 `json:"amount,omitempty"` + + // The total amount specified in advert, in `account_currency`, formatted to + // appropriate decimal places. It is only visible to the advert owner. + AmountDisplay *string `json:"amount_display,omitempty"` + + // Indicates if this is block trade advert or not. + BlockTrade P2PAdvertListRespP2PAdvertListListElemBlockTrade `json:"block_trade"` + + // Advertiser contact information. Only applicable for 'sell adverts'. + ContactInfo *string `json:"contact_info,omitempty"` + + // Type of transaction from the opposite party's perspective. + CounterpartyType P2PAdvertListRespP2PAdvertListListElemCounterpartyType `json:"counterparty_type"` + + // The target country code of the advert. + Country string `json:"country"` + + // The advert creation time in epoch. + CreatedTime int `json:"created_time"` + + // Days until automatic inactivation of this ad, if no activity occurs. + DaysUntilArchive *int `json:"days_until_archive,omitempty"` + + // General information about the advert. + Description string `json:"description"` + + // Conversion rate from account currency to local currency, using current market + // rate if applicable. + EffectiveRate *float64 `json:"effective_rate"` + + // Conversion rate from account currency to local currency, using current market + // rate if applicable, formatted to appropriate decimal places. + EffectiveRateDisplay *string `json:"effective_rate_display"` + + // Reasons why the counterparty terms do not allow the current user to place + // orders against this advert. Possible values: + // - `completion_rate`: current user's 30 day completion rate is less than + // `min_completion_rate`. + // - `country`: current user's residence is not in `eligible_countries`. + // - `join_date`: current user registered on P2P less than `min_join_days` in the + // past. + // - `rating`: current user's average review rating is less than `min_rating`. + EligibilityStatus []P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem `json:"eligibility_status,omitempty"` + + // 2 letter country codes. Counterparties who do not live in these countries are + // not allowed to place orders against this advert. + EligibleCountries []string `json:"eligible_countries,omitempty"` + + // The unique identifier for this advert. + Id string `json:"id"` + + // The activation status of the advert. + IsActive P2PAdvertListRespP2PAdvertListListElemIsActive `json:"is_active"` + + // Inidcates whether the current user's schedule has availability between now and + // now + order_expiry_period. + IsClientScheduleAvailable *P2PAdvertListRespP2PAdvertListListElemIsClientScheduleAvailable `json:"is_client_schedule_available,omitempty"` + + // Indicates that the current user meets the counterparty terms for placing an + // order. + IsEligible P2PAdvertListRespP2PAdvertListListElemIsEligible `json:"is_eligible,omitempty"` + + // Indicates that this advert will appear on the main advert list. + IsVisible P2PAdvertListRespP2PAdvertListListElemIsVisible `json:"is_visible"` + + // Local currency for this advert. This is the form of payment to be arranged + // directly between advertiser and client. + LocalCurrency string `json:"local_currency"` + + // Maximum order amount specified in advert, in `account_currency`. It is only + // visible for advertisers. + MaxOrderAmount *float64 `json:"max_order_amount,omitempty"` + + // Maximum order amount specified in advert, in `account_currency`, formatted to + // appropriate decimal places. It is only visible to the advert owner. + MaxOrderAmountDisplay *string `json:"max_order_amount_display,omitempty"` + + // Maximum order amount at this time, in `account_currency`. + MaxOrderAmountLimit float64 `json:"max_order_amount_limit"` + + // Maximum order amount at this time, in `account_currency`, formatted to + // appropriate decimal places. + MaxOrderAmountLimitDisplay string `json:"max_order_amount_limit_display"` + + // Counterparties who have a 30 day completion rate less than this value are not + // allowed to place orders against this advert. + MinCompletionRate *float64 `json:"min_completion_rate,omitempty"` + + // Counterparties who joined less than this number of days ago are not allowed to + // place orders against this advert. + MinJoinDays *int `json:"min_join_days,omitempty"` + + // Minimum order amount specified in advert, in `account_currency`. It is only + // visible for advertisers. + MinOrderAmount *float64 `json:"min_order_amount,omitempty"` + + // Minimum order amount specified in advert, in `account_currency`, formatted to + // appropriate decimal places. It is only visible to the advert owner. + MinOrderAmountDisplay *string `json:"min_order_amount_display,omitempty"` + + // Minimum order amount at this time, in `account_currency`. + MinOrderAmountLimit float64 `json:"min_order_amount_limit"` + + // Minimum order amount at this time, in `account_currency`, formatted to + // appropriate decimal places. + MinOrderAmountLimitDisplay string `json:"min_order_amount_limit_display"` + + // Counterparties who have an average rating less than this value are not allowed + // to place orders against this advert. + MinRating *float64 `json:"min_rating,omitempty"` + + // Expiry period (seconds) for order created against this ad. + OrderExpiryPeriod int `json:"order_expiry_period"` + + // Payment instructions. Only applicable for 'sell adverts'. + PaymentInfo *string `json:"payment_info,omitempty"` + + // Payment method name (deprecated). + PaymentMethod *string `json:"payment_method"` + + // Names of supported payment methods. + PaymentMethodNames []string `json:"payment_method_names,omitempty"` + + // Cost of the advert in local currency. + Price *float64 `json:"price"` + + // Cost of the advert in local currency, formatted to appropriate decimal places. + PriceDisplay *string `json:"price_display"` + + // Conversion rate from advertiser's account currency to `local_currency`. An + // absolute rate value (fixed), or percentage offset from current market rate + // (floating). + Rate float64 `json:"rate"` + + // Conversion rate formatted to appropriate decimal places. + RateDisplay string `json:"rate_display"` + + // Type of rate, fixed or floating. + RateType P2PAdvertListRespP2PAdvertListListElemRateType `json:"rate_type"` + + // Amount currently available for orders, in `account_currency`. It is only + // visible to the advert owner. + RemainingAmount *float64 `json:"remaining_amount,omitempty"` + + // Amount currently available for orders, in `account_currency`, formatted to + // appropriate decimal places. It is only visible to the advert owner. + RemainingAmountDisplay *string `json:"remaining_amount_display,omitempty"` + + // Whether this is a buy or a sell. + Type P2PAdvertListRespP2PAdvertListListElemType `json:"type"` + + // Reasons why an advert is not visible. Possible values: + // - `advert_fixed_rate_disabled`: fixed rate adverts are no longer available in + // the advert's country. + // - `advert_float_rate_disabled`: floating rate adverts are no longer available + // in the advert's country. + // - `advert_inactive`: the advert is set inactive. + // - `advert_max_limit`: the minimum order amount exceeds the system maximum + // order. + // - `advert_min_limit`: the maximum order amount is too small to be shown on the + // advert list. + // - `advert_remaining`: the remaining amount of the advert is below the minimum + // order. + // - `advert_no_payment_methods`: the advert has no valid payment methods. + // - `advertiser_ads_paused`: the advertiser has paused all adverts. + // - `advertiser_approval`: the advertiser's proof of identity is not verified. + // - `advertiser_balance`: the advertiser's P2P balance is less than the minimum + // order. + // - `advertiser_schedule`: the advertiser's schedule does not have availability + // between now and now + order_expiry_period. + // - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible + // for block trading. + // - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than + // the minimum order. + // - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. + VisibilityStatus []P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem `json:"visibility_status,omitempty"` +} + +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_fixed_rate_disabled" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_float_rate_disabled" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertInactive P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_inactive" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertMaxLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_max_limit" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertMinLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_min_limit" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_no_payment_methods" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertRemaining P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_remaining" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserAdsPaused P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_ads_paused" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserApproval P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_approval" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserBalance P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_balance" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_block_trade_ineligible" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserDailyLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_daily_limit" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserSchedule P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_schedule" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserTempBan P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_temp_ban" + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertListRespP2PAdvertListListElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_currency"]; raw != nil && !ok { + if v, ok := raw["account_currency"]; !ok || v == nil { return fmt.Errorf("field account_currency in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["advertiser_details"]; raw != nil && !ok { + if v, ok := raw["advertiser_details"]; !ok || v == nil { return fmt.Errorf("field advertiser_details in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["block_trade"]; raw != nil && !ok { + if v, ok := raw["block_trade"]; !ok || v == nil { return fmt.Errorf("field block_trade in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["counterparty_type"]; raw != nil && !ok { + if v, ok := raw["counterparty_type"]; !ok || v == nil { return fmt.Errorf("field counterparty_type in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["country"]; raw != nil && !ok { + if v, ok := raw["country"]; !ok || v == nil { return fmt.Errorf("field country in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["description"]; raw != nil && !ok { + if v, ok := raw["description"]; !ok || v == nil { return fmt.Errorf("field description in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["effective_rate"]; raw != nil && !ok { + if v, ok := raw["effective_rate"]; !ok || v == nil { return fmt.Errorf("field effective_rate in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["effective_rate_display"]; raw != nil && !ok { + if v, ok := raw["effective_rate_display"]; !ok || v == nil { return fmt.Errorf("field effective_rate_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["is_active"]; raw != nil && !ok { + if v, ok := raw["is_active"]; !ok || v == nil { return fmt.Errorf("field is_active in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["local_currency"]; raw != nil && !ok { + if v, ok := raw["local_currency"]; !ok || v == nil { return fmt.Errorf("field local_currency in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["max_order_amount_limit"]; raw != nil && !ok { + if v, ok := raw["max_order_amount_limit"]; !ok || v == nil { return fmt.Errorf("field max_order_amount_limit in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["max_order_amount_limit_display"]; raw != nil && !ok { + if v, ok := raw["max_order_amount_limit_display"]; !ok || v == nil { return fmt.Errorf("field max_order_amount_limit_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["min_order_amount_limit"]; raw != nil && !ok { + if v, ok := raw["min_order_amount_limit"]; !ok || v == nil { return fmt.Errorf("field min_order_amount_limit in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["min_order_amount_limit_display"]; raw != nil && !ok { + if v, ok := raw["min_order_amount_limit_display"]; !ok || v == nil { return fmt.Errorf("field min_order_amount_limit_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["order_expiry_period"]; raw != nil && !ok { + if v, ok := raw["order_expiry_period"]; !ok || v == nil { return fmt.Errorf("field order_expiry_period in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["payment_method"]; raw != nil && !ok { + if v, ok := raw["payment_method"]; !ok || v == nil { return fmt.Errorf("field payment_method in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["price_display"]; raw != nil && !ok { + if v, ok := raw["price_display"]; !ok || v == nil { return fmt.Errorf("field price_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["rate"]; raw != nil && !ok { + if v, ok := raw["rate"]; !ok || v == nil { return fmt.Errorf("field rate in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["rate_display"]; raw != nil && !ok { + if v, ok := raw["rate_display"]; !ok || v == nil { return fmt.Errorf("field rate_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["rate_type"]; raw != nil && !ok { + if v, ok := raw["rate_type"]; !ok || v == nil { return fmt.Errorf("field rate_type in P2PAdvertListRespP2PAdvertListListElem: required") } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in P2PAdvertListRespP2PAdvertListListElem: required") } type Plain P2PAdvertListRespP2PAdvertListListElem @@ -903,13 +881,19 @@ func (j *P2PAdvertListRespP2PAdvertListListElem) UnmarshalJSON(b []byte) error { return nil } +// P2P adverts list. +type P2PAdvertListRespP2PAdvertList struct { + // List of adverts. + List []P2PAdvertListRespP2PAdvertListListElem `json:"list"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertListRespP2PAdvertList) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["list"]; raw != nil && !ok { + if v, ok := raw["list"]; !ok || v == nil { return fmt.Errorf("field list in P2PAdvertListRespP2PAdvertList: required") } type Plain P2PAdvertListRespP2PAdvertList @@ -921,16 +905,32 @@ func (j *P2PAdvertListRespP2PAdvertList) UnmarshalJSON(b []byte) error { return nil } +// Available adverts matching the requested criteria. +type P2PAdvertListResp struct { + // Echo of the request made. + EchoReq P2PAdvertListRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertListRespMsgType `json:"msg_type"` + + // P2P adverts list. + P2PAdvertList *P2PAdvertListRespP2PAdvertList `json:"p2p_advert_list,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertListResp: required") } type Plain P2PAdvertListResp diff --git a/schema/p2p_advert_update.go b/schema/p2p_advert_update.go index 1ea3fcf..24a6fb8 100644 --- a/schema/p2p_advert_update.go +++ b/schema/p2p_advert_update.go @@ -6,6 +6,110 @@ import "encoding/json" import "fmt" import "reflect" +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertUpdateP2PAdvertUpdate) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertUpdateP2PAdvertUpdate { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateP2PAdvertUpdate, v) + } + *j = P2PAdvertUpdateP2PAdvertUpdate(v) + return nil +} + +const P2PAdvertUpdateRateTypeFixed P2PAdvertUpdateRateType = "fixed" + +type P2PAdvertUpdateDelete int + +type P2PAdvertUpdateIsActive int + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type P2PAdvertUpdatePassthrough map[string]interface{} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertUpdateIsActive) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertUpdateIsActive { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateIsActive, v) + } + *j = P2PAdvertUpdateIsActive(v) + return nil +} + +type P2PAdvertUpdateP2PAdvertUpdate int + +type P2PAdvertUpdateRateType string + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertUpdateDelete) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertUpdateDelete { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateDelete, v) + } + *j = P2PAdvertUpdateDelete(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertUpdate) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2PAdvertUpdate: required") + } + if v, ok := raw["p2p_advert_update"]; !ok || v == nil { + return fmt.Errorf("field p2p_advert_update in P2PAdvertUpdate: required") + } + type Plain P2PAdvertUpdate + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + if len(plain.EligibleCountries) > 250 { + return fmt.Errorf("field %s length: must be <= %d", "eligible_countries", 250) + } + if len(plain.PaymentMethodIds) > 3 { + return fmt.Errorf("field %s length: must be <= %d", "payment_method_ids", 3) + } + if len(plain.PaymentMethodNames) > 3 { + return fmt.Errorf("field %s length: must be <= %d", "payment_method_names", 3) + } + *j = P2PAdvertUpdate(plain) + return nil +} + // Updates a P2P advert. Can only be used by the advertiser. type P2PAdvertUpdate struct { // [Optional] Advertiser contact information. @@ -98,146 +202,40 @@ type P2PAdvertUpdate struct { ReqId *int `json:"req_id,omitempty"` } -type P2PAdvertUpdateDelete int - -var enumValues_P2PAdvertUpdateDelete = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertUpdateDelete) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertUpdateRateType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertUpdateDelete { + for _, expected := range enumValues_P2PAdvertUpdateRateType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateDelete, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateRateType, v) } - *j = P2PAdvertUpdateDelete(v) + *j = P2PAdvertUpdateRateType(v) return nil } -type P2PAdvertUpdateIsActive int +const P2PAdvertUpdateRateTypeFloat P2PAdvertUpdateRateType = "float" -var enumValues_P2PAdvertUpdateIsActive = []interface{}{ +var enumValues_P2PAdvertUpdateDelete = []interface{}{ 0, 1, } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertUpdateIsActive) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertUpdateIsActive { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateIsActive, v) - } - *j = P2PAdvertUpdateIsActive(v) - return nil +var enumValues_P2PAdvertUpdateIsActive = []interface{}{ + 0, + 1, } - -type P2PAdvertUpdateP2PAdvertUpdate int - var enumValues_P2PAdvertUpdateP2PAdvertUpdate = []interface{}{ 1, } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertUpdateP2PAdvertUpdate) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertUpdateP2PAdvertUpdate { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateP2PAdvertUpdate, v) - } - *j = P2PAdvertUpdateP2PAdvertUpdate(v) - return nil -} - -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type P2PAdvertUpdatePassthrough map[string]interface{} - -type P2PAdvertUpdateRateType string - -const P2PAdvertUpdateRateTypeFixed P2PAdvertUpdateRateType = "fixed" -const P2PAdvertUpdateRateTypeFloat P2PAdvertUpdateRateType = "float" - var enumValues_P2PAdvertUpdateRateType = []interface{}{ "fixed", "float", } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertUpdateRateType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertUpdateRateType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateRateType, v) - } - *j = P2PAdvertUpdateRateType(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertUpdate) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2PAdvertUpdate: required") - } - if _, ok := raw["p2p_advert_update"]; raw != nil && !ok { - return fmt.Errorf("field p2p_advert_update in P2PAdvertUpdate: required") - } - type Plain P2PAdvertUpdate - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - if len(plain.EligibleCountries) > 250 { - return fmt.Errorf("field %s length: must be <= %d", "eligible_countries", 250) - } - if len(plain.PaymentMethodIds) > 3 { - return fmt.Errorf("field %s length: must be <= %d", "payment_method_ids", 3) - } - if len(plain.PaymentMethodNames) > 3 { - return fmt.Errorf("field %s length: must be <= %d", "payment_method_names", 3) - } - *j = P2PAdvertUpdate(plain) - return nil -} diff --git a/schema/p2p_advert_update_resp.go b/schema/p2p_advert_update_resp.go index 76671bf..e224590 100644 --- a/schema/p2p_advert_update_resp.go +++ b/schema/p2p_advert_update_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Returns information about the updated advert. -type P2PAdvertUpdateResp struct { - // Echo of the request made. - EchoReq P2PAdvertUpdateRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertUpdateRespMsgType `json:"msg_type"` - - // P2P updated advert information. - P2PAdvertUpdate *P2PAdvertUpdateRespP2PAdvertUpdate `json:"p2p_advert_update,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PAdvertUpdateRespEchoReq map[string]interface{} type P2PAdvertUpdateRespMsgType string -const P2PAdvertUpdateRespMsgTypeP2PAdvertUpdate P2PAdvertUpdateRespMsgType = "p2p_advert_update" - var enumValues_P2PAdvertUpdateRespMsgType = []interface{}{ "p2p_advert_update", } @@ -53,227 +35,7 @@ func (j *P2PAdvertUpdateRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// P2P updated advert information. -type P2PAdvertUpdateRespP2PAdvertUpdate struct { - // Currency for this advert. This is the system currency to be transferred between - // advertiser and client. - AccountCurrency *string `json:"account_currency,omitempty"` - - // The number of active orders against this advert. - ActiveOrders *int `json:"active_orders,omitempty"` - - // Details of the advertiser for this advert. - AdvertiserDetails *P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails `json:"advertiser_details,omitempty"` - - // The total amount specified in advert, in `account_currency`. - Amount *float64 `json:"amount,omitempty"` - - // The total amount specified in advert, in `account_currency`, formatted to - // appropriate decimal places. - AmountDisplay *string `json:"amount_display,omitempty"` - - // Indicates if this is block trade advert or not. - BlockTrade *P2PAdvertUpdateRespP2PAdvertUpdateBlockTrade `json:"block_trade,omitempty"` - - // Advertiser contact information. Only applicable for 'sell adverts'. - ContactInfo *string `json:"contact_info,omitempty"` - - // Type of transaction from the opposite party's perspective. - CounterpartyType *P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType `json:"counterparty_type,omitempty"` - - // The target country code of the advert. - Country *string `json:"country,omitempty"` - - // The advert creation time in epoch. - CreatedTime *int `json:"created_time,omitempty"` - - // Days until automatic inactivation of this ad, if no activity occurs. - DaysUntilArchive *int `json:"days_until_archive,omitempty"` - - // Indicates that the advert has been deleted. - Deleted *P2PAdvertUpdateRespP2PAdvertUpdateDeleted `json:"deleted,omitempty"` - - // General information about the advert. - Description *string `json:"description,omitempty"` - - // Conversion rate from account currency to local currency, using current market - // rate if applicable. - EffectiveRate *float64 `json:"effective_rate,omitempty"` - - // Conversion rate from account currency to local currency, using current market - // rate if applicable, formatted to appropriate decimal places. - EffectiveRateDisplay *string `json:"effective_rate_display,omitempty"` - - // 2 letter country codes. Counterparties who do not live in these countries are - // not allowed to place orders against this advert - EligibleCountries []string `json:"eligible_countries,omitempty"` - - // The unique identifier for this advert. - Id string `json:"id"` - - // The activation status of the advert. - IsActive *P2PAdvertUpdateRespP2PAdvertUpdateIsActive `json:"is_active,omitempty"` - - // Indicates that this advert will appear on the main advert list. - IsVisible P2PAdvertUpdateRespP2PAdvertUpdateIsVisible `json:"is_visible,omitempty"` - - // Local currency for this advert. This is the form of payment to be arranged - // directly between advertiser and client. - LocalCurrency *string `json:"local_currency,omitempty"` - - // Maximum order amount specified in advert, in `account_currency`. - MaxOrderAmount *float64 `json:"max_order_amount,omitempty"` - - // Maximum order amount specified in advert, in `account_currency`, formatted to - // appropriate decimal places. - MaxOrderAmountDisplay *string `json:"max_order_amount_display,omitempty"` - - // Maximum order amount at this time, in `account_currency`. - MaxOrderAmountLimit *float64 `json:"max_order_amount_limit,omitempty"` - - // Maximum order amount at this time, in `account_currency`, formatted to - // appropriate decimal places. - MaxOrderAmountLimitDisplay *string `json:"max_order_amount_limit_display,omitempty"` - - // Counterparties who have a 30 day completion rate less than this value are not - // allowed to place orders against this advert. - MinCompletionRate *float64 `json:"min_completion_rate,omitempty"` - - // Counterparties who joined less than this number of days ago are not allowed to - // place orders against this advert. - MinJoinDays *int `json:"min_join_days,omitempty"` - - // Minimum order amount specified in advert, in `account_currency`. It is only - // visible to the advert owner. - MinOrderAmount *float64 `json:"min_order_amount,omitempty"` - - // Minimum order amount specified in advert, in `account_currency`, formatted to - // appropriate decimal places. - MinOrderAmountDisplay *string `json:"min_order_amount_display,omitempty"` - - // Minimum order amount at this time, in `account_currency`. - MinOrderAmountLimit *float64 `json:"min_order_amount_limit,omitempty"` - - // Minimum order amount at this time, in `account_currency`, formatted to - // appropriate decimal places. - MinOrderAmountLimitDisplay *string `json:"min_order_amount_limit_display,omitempty"` - - // Counterparties who have an average rating less than this value are not allowed - // to place orders against this advert. - MinRating *float64 `json:"min_rating,omitempty"` - - // Expiry period (seconds) for order created against this ad. - OrderExpiryPeriod *int `json:"order_expiry_period,omitempty"` - - // Payment instructions. Only applicable for 'sell adverts'. - PaymentInfo *string `json:"payment_info,omitempty"` - - // Payment method name (deprecated). - PaymentMethod *string `json:"payment_method,omitempty"` - - // Details of available payment methods (sell adverts only). - PaymentMethodDetails P2PAdvertUpdateRespP2PAdvertUpdatePaymentMethodDetails `json:"payment_method_details,omitempty"` - - // Names of supported payment methods. - PaymentMethodNames []string `json:"payment_method_names,omitempty"` - - // Cost of the advert in local currency. - Price *float64 `json:"price,omitempty"` - - // Cost of the advert in local currency, formatted to appropriate decimal places. - PriceDisplay *string `json:"price_display,omitempty"` - - // Conversion rate from advertiser's account currency to `local_currency`. An - // absolute rate value (fixed), or percentage offset from current market rate - // (floating). - Rate *float64 `json:"rate,omitempty"` - - // Conversion rate formatted to appropriate decimal places. - RateDisplay *string `json:"rate_display,omitempty"` - - // Type of rate, fixed or floating. - RateType *P2PAdvertUpdateRespP2PAdvertUpdateRateType `json:"rate_type,omitempty"` - - // Amount currently available for orders, in `account_currency`. - RemainingAmount *float64 `json:"remaining_amount,omitempty"` - - // Amount currently available for orders, in `account_currency`, formatted to - // appropriate decimal places. - RemainingAmountDisplay *string `json:"remaining_amount_display,omitempty"` - - // Whether this is a buy or a sell. - Type *P2PAdvertUpdateRespP2PAdvertUpdateType `json:"type,omitempty"` - - // Reasons why an advert is not visible. Possible values: - // - `advert_fixed_rate_disabled`: fixed rate adverts are no longer available in - // the advert's country. - // - `advert_float_rate_disabled`: floating rate adverts are no longer available - // in the advert's country. - // - `advert_inactive`: the advert is set inactive. - // - `advert_max_limit`: the minimum order amount exceeds the system maximum - // order. - // - `advert_min_limit`: the maximum order amount is too small to be shown on the - // advert list. - // - `advert_remaining`: the remaining amount of the advert is below the minimum - // order. - // - `advert_no_payment_methods`: the advert has no valid payment methods. - // - `advertiser_ads_paused`: the advertiser has paused all adverts. - // - `advertiser_approval`: the advertiser's proof of identity is not verified. - // - `advertiser_balance`: the advertiser's P2P balance is less than the minimum - // order. - // - `advertiser_schedule`: the advertiser's schedule does not have availability - // between now and now + order_expiry_period. - // - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible - // for block trading. - // - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than - // the minimum order. - // - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. - VisibilityStatus []P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem `json:"visibility_status,omitempty"` -} - -// Details of the advertiser for this advert. -type P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails struct { - // The total number of orders completed in the past 30 days. - CompletedOrdersCount int `json:"completed_orders_count"` - - // The advertiser's first name. - FirstName *string `json:"first_name,omitempty"` - - // The advertiser's unique identifier. - Id string `json:"id"` - - // Indicates if the advertiser is currently online. - IsOnline P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline `json:"is_online"` - - // Inidcates whether the advertiser's schedule has availability between now and - // now + order_expiry_period. - IsScheduleAvailable P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsScheduleAvailable `json:"is_schedule_available"` - - // The advertiser's last name. - LastName *string `json:"last_name,omitempty"` - - // Epoch of the latest time the advertiser was online, up to 6 months. - LastOnlineTime *int `json:"last_online_time"` - - // The advertiser's displayed name. - Name string `json:"name"` - - // Average rating of the advertiser, range is 1-5. - RatingAverage *float64 `json:"rating_average"` - - // Number of ratings given to the advertiser. - RatingCount int `json:"rating_count"` - - // Percentage of users who have recommended the advertiser. - RecommendedAverage *float64 `json:"recommended_average"` - - // Number of times the advertiser has been recommended. - RecommendedCount *int `json:"recommended_count"` - - // The percentage of successfully completed orders made by or placed against the - // advertiser within the past 30 days. - TotalCompletionRate *float64 `json:"total_completion_rate"` -} +const P2PAdvertUpdateRespMsgTypeP2PAdvertUpdate P2PAdvertUpdateRespMsgType = "p2p_advert_update" type P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline int @@ -329,43 +91,87 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsScheduleAvailable) return nil } +// Details of the advertiser for this advert. +type P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails struct { + // The total number of orders completed in the past 30 days. + CompletedOrdersCount int `json:"completed_orders_count"` + + // The advertiser's first name. + FirstName *string `json:"first_name,omitempty"` + + // The advertiser's unique identifier. + Id string `json:"id"` + + // Indicates if the advertiser is currently online. + IsOnline P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline `json:"is_online"` + + // Inidcates whether the advertiser's schedule has availability between now and + // now + order_expiry_period. + IsScheduleAvailable P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsScheduleAvailable `json:"is_schedule_available"` + + // The advertiser's last name. + LastName *string `json:"last_name,omitempty"` + + // Epoch of the latest time the advertiser was online, up to 6 months. + LastOnlineTime *int `json:"last_online_time"` + + // The advertiser's displayed name. + Name string `json:"name"` + + // Average rating of the advertiser, range is 1-5. + RatingAverage *float64 `json:"rating_average"` + + // Number of ratings given to the advertiser. + RatingCount int `json:"rating_count"` + + // Percentage of users who have recommended the advertiser. + RecommendedAverage *float64 `json:"recommended_average"` + + // Number of times the advertiser has been recommended. + RecommendedCount *int `json:"recommended_count"` + + // The percentage of successfully completed orders made by or placed against the + // advertiser within the past 30 days. + TotalCompletionRate *float64 `json:"total_completion_rate"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["completed_orders_count"]; raw != nil && !ok { + if v, ok := raw["completed_orders_count"]; !ok || v == nil { return fmt.Errorf("field completed_orders_count in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { + if v, ok := raw["is_schedule_available"]; !ok || v == nil { return fmt.Errorf("field is_schedule_available in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["rating_average"]; raw != nil && !ok { + if v, ok := raw["rating_average"]; !ok || v == nil { return fmt.Errorf("field rating_average in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["rating_count"]; raw != nil && !ok { + if v, ok := raw["rating_count"]; !ok || v == nil { return fmt.Errorf("field rating_count in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["recommended_average"]; raw != nil && !ok { + if v, ok := raw["recommended_average"]; !ok || v == nil { return fmt.Errorf("field recommended_average in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["recommended_count"]; raw != nil && !ok { + if v, ok := raw["recommended_count"]; !ok || v == nil { return fmt.Errorf("field recommended_count in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { + if v, ok := raw["total_completion_rate"]; !ok || v == nil { return fmt.Errorf("field total_completion_rate in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } type Plain P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails @@ -406,9 +212,6 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateBlockTrade) UnmarshalJSON(b []byte) e type P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType string -const P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyTypeBuy P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = "buy" -const P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyTypeSell P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = "sell" - var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = []interface{}{ "buy", "sell", @@ -434,6 +237,9 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType) UnmarshalJSON(b []b return nil } +const P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyTypeBuy P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = "buy" +const P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyTypeSell P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = "sell" + type P2PAdvertUpdateRespP2PAdvertUpdateDeleted int var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateDeleted = []interface{}{ @@ -519,9 +325,6 @@ type P2PAdvertUpdateRespP2PAdvertUpdatePaymentMethodDetails map[string]interface type P2PAdvertUpdateRespP2PAdvertUpdateRateType string -const P2PAdvertUpdateRespP2PAdvertUpdateRateTypeFixed P2PAdvertUpdateRespP2PAdvertUpdateRateType = "fixed" -const P2PAdvertUpdateRespP2PAdvertUpdateRateTypeFloat P2PAdvertUpdateRespP2PAdvertUpdateRateType = "float" - var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateRateType = []interface{}{ "fixed", "float", @@ -547,10 +350,10 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateRateType) UnmarshalJSON(b []byte) err return nil } -type P2PAdvertUpdateRespP2PAdvertUpdateType string +const P2PAdvertUpdateRespP2PAdvertUpdateRateTypeFixed P2PAdvertUpdateRespP2PAdvertUpdateRateType = "fixed" +const P2PAdvertUpdateRespP2PAdvertUpdateRateTypeFloat P2PAdvertUpdateRespP2PAdvertUpdateRateType = "float" -const P2PAdvertUpdateRespP2PAdvertUpdateTypeBuy P2PAdvertUpdateRespP2PAdvertUpdateType = "buy" -const P2PAdvertUpdateRespP2PAdvertUpdateTypeSell P2PAdvertUpdateRespP2PAdvertUpdateType = "sell" +type P2PAdvertUpdateRespP2PAdvertUpdateType string var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateType = []interface{}{ "buy", @@ -577,22 +380,10 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateType) UnmarshalJSON(b []byte) error { return nil } -type P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem string +const P2PAdvertUpdateRespP2PAdvertUpdateTypeBuy P2PAdvertUpdateRespP2PAdvertUpdateType = "buy" +const P2PAdvertUpdateRespP2PAdvertUpdateTypeSell P2PAdvertUpdateRespP2PAdvertUpdateType = "sell" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_fixed_rate_disabled" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_float_rate_disabled" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertInactive P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_inactive" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertMaxLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_max_limit" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertMinLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_min_limit" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_no_payment_methods" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertRemaining P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_remaining" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserAdsPaused P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_ads_paused" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserApproval P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_approval" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserBalance P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_balance" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_block_trade_ineligible" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserDailyLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_daily_limit" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserSchedule P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_schedule" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserTempBan P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_temp_ban" +type P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem string var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = []interface{}{ "advert_fixed_rate_disabled", @@ -631,13 +422,206 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem) UnmarshalJSON(b return nil } +// P2P updated advert information. +type P2PAdvertUpdateRespP2PAdvertUpdate struct { + // Currency for this advert. This is the system currency to be transferred between + // advertiser and client. + AccountCurrency *string `json:"account_currency,omitempty"` + + // The number of active orders against this advert. + ActiveOrders *int `json:"active_orders,omitempty"` + + // Details of the advertiser for this advert. + AdvertiserDetails *P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails `json:"advertiser_details,omitempty"` + + // The total amount specified in advert, in `account_currency`. + Amount *float64 `json:"amount,omitempty"` + + // The total amount specified in advert, in `account_currency`, formatted to + // appropriate decimal places. + AmountDisplay *string `json:"amount_display,omitempty"` + + // Indicates if this is block trade advert or not. + BlockTrade *P2PAdvertUpdateRespP2PAdvertUpdateBlockTrade `json:"block_trade,omitempty"` + + // Advertiser contact information. Only applicable for 'sell adverts'. + ContactInfo *string `json:"contact_info,omitempty"` + + // Type of transaction from the opposite party's perspective. + CounterpartyType *P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType `json:"counterparty_type,omitempty"` + + // The target country code of the advert. + Country *string `json:"country,omitempty"` + + // The advert creation time in epoch. + CreatedTime *int `json:"created_time,omitempty"` + + // Days until automatic inactivation of this ad, if no activity occurs. + DaysUntilArchive *int `json:"days_until_archive,omitempty"` + + // Indicates that the advert has been deleted. + Deleted *P2PAdvertUpdateRespP2PAdvertUpdateDeleted `json:"deleted,omitempty"` + + // General information about the advert. + Description *string `json:"description,omitempty"` + + // Conversion rate from account currency to local currency, using current market + // rate if applicable. + EffectiveRate *float64 `json:"effective_rate,omitempty"` + + // Conversion rate from account currency to local currency, using current market + // rate if applicable, formatted to appropriate decimal places. + EffectiveRateDisplay *string `json:"effective_rate_display,omitempty"` + + // 2 letter country codes. Counterparties who do not live in these countries are + // not allowed to place orders against this advert + EligibleCountries []string `json:"eligible_countries,omitempty"` + + // The unique identifier for this advert. + Id string `json:"id"` + + // The activation status of the advert. + IsActive *P2PAdvertUpdateRespP2PAdvertUpdateIsActive `json:"is_active,omitempty"` + + // Indicates that this advert will appear on the main advert list. + IsVisible P2PAdvertUpdateRespP2PAdvertUpdateIsVisible `json:"is_visible,omitempty"` + + // Local currency for this advert. This is the form of payment to be arranged + // directly between advertiser and client. + LocalCurrency *string `json:"local_currency,omitempty"` + + // Maximum order amount specified in advert, in `account_currency`. + MaxOrderAmount *float64 `json:"max_order_amount,omitempty"` + + // Maximum order amount specified in advert, in `account_currency`, formatted to + // appropriate decimal places. + MaxOrderAmountDisplay *string `json:"max_order_amount_display,omitempty"` + + // Maximum order amount at this time, in `account_currency`. + MaxOrderAmountLimit *float64 `json:"max_order_amount_limit,omitempty"` + + // Maximum order amount at this time, in `account_currency`, formatted to + // appropriate decimal places. + MaxOrderAmountLimitDisplay *string `json:"max_order_amount_limit_display,omitempty"` + + // Counterparties who have a 30 day completion rate less than this value are not + // allowed to place orders against this advert. + MinCompletionRate *float64 `json:"min_completion_rate,omitempty"` + + // Counterparties who joined less than this number of days ago are not allowed to + // place orders against this advert. + MinJoinDays *int `json:"min_join_days,omitempty"` + + // Minimum order amount specified in advert, in `account_currency`. It is only + // visible to the advert owner. + MinOrderAmount *float64 `json:"min_order_amount,omitempty"` + + // Minimum order amount specified in advert, in `account_currency`, formatted to + // appropriate decimal places. + MinOrderAmountDisplay *string `json:"min_order_amount_display,omitempty"` + + // Minimum order amount at this time, in `account_currency`. + MinOrderAmountLimit *float64 `json:"min_order_amount_limit,omitempty"` + + // Minimum order amount at this time, in `account_currency`, formatted to + // appropriate decimal places. + MinOrderAmountLimitDisplay *string `json:"min_order_amount_limit_display,omitempty"` + + // Counterparties who have an average rating less than this value are not allowed + // to place orders against this advert. + MinRating *float64 `json:"min_rating,omitempty"` + + // Expiry period (seconds) for order created against this ad. + OrderExpiryPeriod *int `json:"order_expiry_period,omitempty"` + + // Payment instructions. Only applicable for 'sell adverts'. + PaymentInfo *string `json:"payment_info,omitempty"` + + // Payment method name (deprecated). + PaymentMethod *string `json:"payment_method,omitempty"` + + // Details of available payment methods (sell adverts only). + PaymentMethodDetails P2PAdvertUpdateRespP2PAdvertUpdatePaymentMethodDetails `json:"payment_method_details,omitempty"` + + // Names of supported payment methods. + PaymentMethodNames []string `json:"payment_method_names,omitempty"` + + // Cost of the advert in local currency. + Price *float64 `json:"price,omitempty"` + + // Cost of the advert in local currency, formatted to appropriate decimal places. + PriceDisplay *string `json:"price_display,omitempty"` + + // Conversion rate from advertiser's account currency to `local_currency`. An + // absolute rate value (fixed), or percentage offset from current market rate + // (floating). + Rate *float64 `json:"rate,omitempty"` + + // Conversion rate formatted to appropriate decimal places. + RateDisplay *string `json:"rate_display,omitempty"` + + // Type of rate, fixed or floating. + RateType *P2PAdvertUpdateRespP2PAdvertUpdateRateType `json:"rate_type,omitempty"` + + // Amount currently available for orders, in `account_currency`. + RemainingAmount *float64 `json:"remaining_amount,omitempty"` + + // Amount currently available for orders, in `account_currency`, formatted to + // appropriate decimal places. + RemainingAmountDisplay *string `json:"remaining_amount_display,omitempty"` + + // Whether this is a buy or a sell. + Type *P2PAdvertUpdateRespP2PAdvertUpdateType `json:"type,omitempty"` + + // Reasons why an advert is not visible. Possible values: + // - `advert_fixed_rate_disabled`: fixed rate adverts are no longer available in + // the advert's country. + // - `advert_float_rate_disabled`: floating rate adverts are no longer available + // in the advert's country. + // - `advert_inactive`: the advert is set inactive. + // - `advert_max_limit`: the minimum order amount exceeds the system maximum + // order. + // - `advert_min_limit`: the maximum order amount is too small to be shown on the + // advert list. + // - `advert_remaining`: the remaining amount of the advert is below the minimum + // order. + // - `advert_no_payment_methods`: the advert has no valid payment methods. + // - `advertiser_ads_paused`: the advertiser has paused all adverts. + // - `advertiser_approval`: the advertiser's proof of identity is not verified. + // - `advertiser_balance`: the advertiser's P2P balance is less than the minimum + // order. + // - `advertiser_schedule`: the advertiser's schedule does not have availability + // between now and now + order_expiry_period. + // - `advertiser_block_trade_ineligible`: the advertiser is not currently eligible + // for block trading. + // - `advertiser_daily_limit`: the advertiser's remaining daily limit is less than + // the minimum order. + // - `advertiser_temp_ban`: the advertiser is temporarily banned from P2P. + VisibilityStatus []P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem `json:"visibility_status,omitempty"` +} + +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_fixed_rate_disabled" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_float_rate_disabled" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertInactive P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_inactive" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertMaxLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_max_limit" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertMinLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_min_limit" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_no_payment_methods" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertRemaining P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_remaining" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserAdsPaused P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_ads_paused" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserApproval P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_approval" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserBalance P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_balance" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_block_trade_ineligible" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserDailyLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_daily_limit" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserSchedule P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_schedule" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserTempBan P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_temp_ban" + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertUpdateRespP2PAdvertUpdate) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertUpdateRespP2PAdvertUpdate: required") } type Plain P2PAdvertUpdateRespP2PAdvertUpdate @@ -652,16 +636,32 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdate) UnmarshalJSON(b []byte) error { return nil } +// Returns information about the updated advert. +type P2PAdvertUpdateResp struct { + // Echo of the request made. + EchoReq P2PAdvertUpdateRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertUpdateRespMsgType `json:"msg_type"` + + // P2P updated advert information. + P2PAdvertUpdate *P2PAdvertUpdateRespP2PAdvertUpdate `json:"p2p_advert_update,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertUpdateResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertUpdateResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertUpdateResp: required") } type Plain P2PAdvertUpdateResp diff --git a/schema/p2p_advertiser_adverts.go b/schema/p2p_advertiser_adverts.go index 3c84059..e428637 100644 --- a/schema/p2p_advertiser_adverts.go +++ b/schema/p2p_advertiser_adverts.go @@ -6,32 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Returns all P2P adverts created by the authorized client. Can only be used by a -// registered P2P advertiser. -type P2PAdvertiserAdverts struct { - // [Optional] Used for paging. This value will also apply to subsription - // responses. - Limit int `json:"limit,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used for paging. This value will also apply to subsription - // responses. - Offset int `json:"offset,omitempty"` - - // Must be 1 - P2PAdvertiserAdverts P2PAdvertiserAdvertsP2PAdvertiserAdverts `json:"p2p_advertiser_adverts"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PAdvertiserAdvertsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type P2PAdvertiserAdvertsP2PAdvertiserAdverts int var enumValues_P2PAdvertiserAdvertsP2PAdvertiserAdverts = []interface{}{ @@ -58,6 +32,32 @@ func (j *P2PAdvertiserAdvertsP2PAdvertiserAdverts) UnmarshalJSON(b []byte) error return nil } +// Returns all P2P adverts created by the authorized client. Can only be used by a +// registered P2P advertiser. +type P2PAdvertiserAdverts struct { + // [Optional] Used for paging. This value will also apply to subsription + // responses. + Limit int `json:"limit,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used for paging. This value will also apply to subsription + // responses. + Offset int `json:"offset,omitempty"` + + // Must be 1 + P2PAdvertiserAdverts P2PAdvertiserAdvertsP2PAdvertiserAdverts `json:"p2p_advertiser_adverts"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PAdvertiserAdvertsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2PAdvertiserAdvertsPassthrough map[string]interface{} @@ -68,7 +68,7 @@ func (j *P2PAdvertiserAdverts) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_advertiser_adverts"]; raw != nil && !ok { + if v, ok := raw["p2p_advertiser_adverts"]; !ok || v == nil { return fmt.Errorf("field p2p_advertiser_adverts in P2PAdvertiserAdverts: required") } type Plain P2PAdvertiserAdverts diff --git a/schema/p2p_advertiser_adverts_resp.go b/schema/p2p_advertiser_adverts_resp.go index 64ebe4c..6073922 100644 --- a/schema/p2p_advertiser_adverts_resp.go +++ b/schema/p2p_advertiser_adverts_resp.go @@ -29,30 +29,6 @@ type P2PAdvertiserAdvertsRespMsgType string const P2PAdvertiserAdvertsRespMsgTypeP2PAdvertiserAdverts P2PAdvertiserAdvertsRespMsgType = "p2p_advertiser_adverts" -var enumValues_P2PAdvertiserAdvertsRespMsgType = []interface{}{ - "p2p_advertiser_adverts", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserAdvertsRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertiserAdvertsRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespMsgType, v) - } - *j = P2PAdvertiserAdvertsRespMsgType(v) - return nil -} - // List of the P2P advertiser adverts. type P2PAdvertiserAdvertsRespP2PAdvertiserAdverts struct { // List of advertiser adverts. @@ -275,113 +251,114 @@ type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails struc type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline int +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable int + +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade int + +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType string + +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyTypeBuy P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = "buy" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyTypeSell P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = "sell" + +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive int + +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible int + +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType string + +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateTypeFixed P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = "fixed" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateTypeFloat P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = "float" + +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType string + +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemTypeBuy P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = "buy" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemTypeSell P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = "sell" + +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem string + +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_fixed_rate_disabled" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_float_rate_disabled" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertInactive P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_inactive" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertMaxLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_max_limit" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertMinLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_min_limit" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_no_payment_methods" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertRemaining P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_remaining" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserAdsPaused P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_ads_paused" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserApproval P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_approval" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserBalance P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_balance" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_block_trade_ineligible" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserDailyLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_daily_limit" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserSchedule P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_schedule" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserTempBan P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_temp_ban" + +var enumValues_P2PAdvertiserAdvertsRespMsgType = []interface{}{ + "p2p_advertiser_adverts", +} var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline = []interface{}{ 0, 1, } +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable = []interface{}{ + 0, + 1, +} +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade = []interface{}{ + 0, + 1, +} +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = []interface{}{ + "buy", + "sell", +} +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive = []interface{}{ + 0, + 1, +} +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline { + for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible, v) } - *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline(v) + *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible(v) return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable int - -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable { + for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable, v) - } - *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["completed_orders_count"]; raw != nil && !ok { - return fmt.Errorf("field completed_orders_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["is_online"]; raw != nil && !ok { - return fmt.Errorf("field is_online in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { - return fmt.Errorf("field is_schedule_available in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["last_online_time"]; raw != nil && !ok { - return fmt.Errorf("field last_online_time in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["name"]; raw != nil && !ok { - return fmt.Errorf("field name in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["rating_average"]; raw != nil && !ok { - return fmt.Errorf("field rating_average in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["rating_count"]; raw != nil && !ok { - return fmt.Errorf("field rating_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["recommended_average"]; raw != nil && !ok { - return fmt.Errorf("field recommended_average in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["recommended_count"]; raw != nil && !ok { - return fmt.Errorf("field recommended_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { - return fmt.Errorf("field total_completion_rate in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") - } - type Plain P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline, v) } - *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails(plain) + *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline(v) return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade int - -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade) UnmarshalJSON(b []byte) error { var v int @@ -402,16 +379,6 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade) Unmarsh return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType string - -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyTypeBuy P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = "buy" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyTypeSell P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = "sell" - -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = []interface{}{ - "buy", - "sell", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType) UnmarshalJSON(b []byte) error { var v string @@ -432,13 +399,6 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType) U return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive int - -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive) UnmarshalJSON(b []byte) error { var v int @@ -459,71 +419,109 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive) Unmarshal return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible int - -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible { + for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem, v) } - *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible(v) + *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem(v) return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType string - -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateTypeFixed P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = "fixed" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateTypeFloat P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = "float" - -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = []interface{}{ - "fixed", - "float", +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = []interface{}{ + "advert_fixed_rate_disabled", + "advert_float_rate_disabled", + "advert_inactive", + "advert_max_limit", + "advert_min_limit", + "advert_remaining", + "advert_no_payment_methods", + "advertiser_ads_paused", + "advertiser_approval", + "advertiser_balance", + "advertiser_block_trade_ineligible", + "advertiser_daily_limit", + "advertiser_schedule", + "advertiser_temp_ban", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType { + for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable, v) } - *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType(v) + *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsScheduleAvailable(v) return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType string - -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemTypeBuy P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = "buy" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemTypeSell P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = "sell" - -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = []interface{}{ - "buy", - "sell", +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["completed_orders_count"]; !ok || v == nil { + return fmt.Errorf("field completed_orders_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["is_online"]; !ok || v == nil { + return fmt.Errorf("field is_online in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["is_schedule_available"]; !ok || v == nil { + return fmt.Errorf("field is_schedule_available in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["last_online_time"]; !ok || v == nil { + return fmt.Errorf("field last_online_time in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["name"]; !ok || v == nil { + return fmt.Errorf("field name in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["rating_average"]; !ok || v == nil { + return fmt.Errorf("field rating_average in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["rating_count"]; !ok || v == nil { + return fmt.Errorf("field rating_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["recommended_average"]; !ok || v == nil { + return fmt.Errorf("field recommended_average in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["recommended_count"]; !ok || v == nil { + return fmt.Errorf("field recommended_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + if v, ok := raw["total_completion_rate"]; !ok || v == nil { + return fmt.Errorf("field total_completion_rate in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") + } + type Plain P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails(plain) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -546,58 +544,13 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType) UnmarshalJSON return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem string - -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertFixedRateDisabled P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_fixed_rate_disabled" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertFloatRateDisabled P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_float_rate_disabled" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertInactive P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_inactive" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertMaxLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_max_limit" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertMinLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_min_limit" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertNoPaymentMethods P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_no_payment_methods" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertRemaining P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_remaining" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserAdsPaused P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_ads_paused" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserApproval P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_approval" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserBalance P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_balance" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_block_trade_ineligible" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserDailyLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_daily_limit" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserSchedule P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_schedule" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserTempBan P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_temp_ban" - -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = []interface{}{ - "advert_fixed_rate_disabled", - "advert_float_rate_disabled", - "advert_inactive", - "advert_max_limit", - "advert_min_limit", - "advert_remaining", - "advert_no_payment_methods", - "advertiser_ads_paused", - "advertiser_approval", - "advertiser_balance", - "advertiser_block_trade_ineligible", - "advertiser_daily_limit", - "advertiser_schedule", - "advertiser_temp_ban", +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = []interface{}{ + "buy", + "sell", } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem, v) - } - *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem(v) - return nil +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = []interface{}{ + "fixed", + "float", } // UnmarshalJSON implements json.Unmarshaler. @@ -606,109 +559,109 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem) UnmarshalJSON(b [ if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_currency"]; raw != nil && !ok { + if v, ok := raw["account_currency"]; !ok || v == nil { return fmt.Errorf("field account_currency in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["active_orders"]; raw != nil && !ok { + if v, ok := raw["active_orders"]; !ok || v == nil { return fmt.Errorf("field active_orders in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["advertiser_details"]; raw != nil && !ok { + if v, ok := raw["advertiser_details"]; !ok || v == nil { return fmt.Errorf("field advertiser_details in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["amount_display"]; raw != nil && !ok { + if v, ok := raw["amount_display"]; !ok || v == nil { return fmt.Errorf("field amount_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["block_trade"]; raw != nil && !ok { + if v, ok := raw["block_trade"]; !ok || v == nil { return fmt.Errorf("field block_trade in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["contact_info"]; raw != nil && !ok { + if v, ok := raw["contact_info"]; !ok || v == nil { return fmt.Errorf("field contact_info in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["counterparty_type"]; raw != nil && !ok { + if v, ok := raw["counterparty_type"]; !ok || v == nil { return fmt.Errorf("field counterparty_type in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["country"]; raw != nil && !ok { + if v, ok := raw["country"]; !ok || v == nil { return fmt.Errorf("field country in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["description"]; raw != nil && !ok { + if v, ok := raw["description"]; !ok || v == nil { return fmt.Errorf("field description in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["effective_rate"]; raw != nil && !ok { + if v, ok := raw["effective_rate"]; !ok || v == nil { return fmt.Errorf("field effective_rate in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["effective_rate_display"]; raw != nil && !ok { + if v, ok := raw["effective_rate_display"]; !ok || v == nil { return fmt.Errorf("field effective_rate_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["is_active"]; raw != nil && !ok { + if v, ok := raw["is_active"]; !ok || v == nil { return fmt.Errorf("field is_active in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["local_currency"]; raw != nil && !ok { + if v, ok := raw["local_currency"]; !ok || v == nil { return fmt.Errorf("field local_currency in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["max_order_amount"]; raw != nil && !ok { + if v, ok := raw["max_order_amount"]; !ok || v == nil { return fmt.Errorf("field max_order_amount in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["max_order_amount_display"]; raw != nil && !ok { + if v, ok := raw["max_order_amount_display"]; !ok || v == nil { return fmt.Errorf("field max_order_amount_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["max_order_amount_limit"]; raw != nil && !ok { + if v, ok := raw["max_order_amount_limit"]; !ok || v == nil { return fmt.Errorf("field max_order_amount_limit in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["max_order_amount_limit_display"]; raw != nil && !ok { + if v, ok := raw["max_order_amount_limit_display"]; !ok || v == nil { return fmt.Errorf("field max_order_amount_limit_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["min_order_amount"]; raw != nil && !ok { + if v, ok := raw["min_order_amount"]; !ok || v == nil { return fmt.Errorf("field min_order_amount in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["min_order_amount_display"]; raw != nil && !ok { + if v, ok := raw["min_order_amount_display"]; !ok || v == nil { return fmt.Errorf("field min_order_amount_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["min_order_amount_limit"]; raw != nil && !ok { + if v, ok := raw["min_order_amount_limit"]; !ok || v == nil { return fmt.Errorf("field min_order_amount_limit in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["min_order_amount_limit_display"]; raw != nil && !ok { + if v, ok := raw["min_order_amount_limit_display"]; !ok || v == nil { return fmt.Errorf("field min_order_amount_limit_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["order_expiry_period"]; raw != nil && !ok { + if v, ok := raw["order_expiry_period"]; !ok || v == nil { return fmt.Errorf("field order_expiry_period in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["payment_info"]; raw != nil && !ok { + if v, ok := raw["payment_info"]; !ok || v == nil { return fmt.Errorf("field payment_info in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["payment_method"]; raw != nil && !ok { + if v, ok := raw["payment_method"]; !ok || v == nil { return fmt.Errorf("field payment_method in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["price_display"]; raw != nil && !ok { + if v, ok := raw["price_display"]; !ok || v == nil { return fmt.Errorf("field price_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["rate"]; raw != nil && !ok { + if v, ok := raw["rate"]; !ok || v == nil { return fmt.Errorf("field rate in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["rate_display"]; raw != nil && !ok { + if v, ok := raw["rate_display"]; !ok || v == nil { return fmt.Errorf("field rate_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["rate_type"]; raw != nil && !ok { + if v, ok := raw["rate_type"]; !ok || v == nil { return fmt.Errorf("field rate_type in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["remaining_amount"]; raw != nil && !ok { + if v, ok := raw["remaining_amount"]; !ok || v == nil { return fmt.Errorf("field remaining_amount in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["remaining_amount_display"]; raw != nil && !ok { + if v, ok := raw["remaining_amount_display"]; !ok || v == nil { return fmt.Errorf("field remaining_amount_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } type Plain P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem @@ -723,13 +676,33 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem) UnmarshalJSON(b [ return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertiserAdvertsRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertiserAdvertsRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespMsgType, v) + } + *j = P2PAdvertiserAdvertsRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdverts) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["list"]; raw != nil && !ok { + if v, ok := raw["list"]; !ok || v == nil { return fmt.Errorf("field list in P2PAdvertiserAdvertsRespP2PAdvertiserAdverts: required") } type Plain P2PAdvertiserAdvertsRespP2PAdvertiserAdverts @@ -741,16 +714,36 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdverts) UnmarshalJSON(b []byte) e return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType, v) + } + *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserAdvertsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertiserAdvertsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertiserAdvertsResp: required") } type Plain P2PAdvertiserAdvertsResp diff --git a/schema/p2p_advertiser_create.go b/schema/p2p_advertiser_create.go index c6d9faf..6fa503c 100644 --- a/schema/p2p_advertiser_create.go +++ b/schema/p2p_advertiser_create.go @@ -6,46 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Registers the client as a P2P advertiser. -type P2PAdvertiserCreate struct { - // [Optional] Advertiser's contact information, to be used as a default for new - // sell adverts. - ContactInfo *string `json:"contact_info,omitempty"` - - // [Optional] Default description that can be used every time an advert is - // created. - DefaultAdvertDescription *string `json:"default_advert_description,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // The advertiser's displayed name. - Name string `json:"name"` - - // Must be 1 - P2PAdvertiserCreate P2PAdvertiserCreateP2PAdvertiserCreate `json:"p2p_advertiser_create"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PAdvertiserCreatePassthrough `json:"passthrough,omitempty"` - - // [Optional] Advertiser's payment information, to be used as a default for new - // sell adverts. - PaymentInfo *string `json:"payment_info,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] Weekly availability schedule. Ads are visible and orders can be - // created only during available periods. - Schedule []P2PAdvertiserCreateScheduleElem `json:"schedule,omitempty"` - - // [Optional] If set to 1, will send updates whenever there is an update to - // advertiser - Subscribe *P2PAdvertiserCreateSubscribe `json:"subscribe,omitempty"` -} - type P2PAdvertiserCreateP2PAdvertiserCreate int var enumValues_P2PAdvertiserCreateP2PAdvertiserCreate = []interface{}{ @@ -91,10 +51,10 @@ func (j *P2PAdvertiserCreateScheduleElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["end_min"]; raw != nil && !ok { + if v, ok := raw["end_min"]; !ok || v == nil { return fmt.Errorf("field end_min in P2PAdvertiserCreateScheduleElem: required") } - if _, ok := raw["start_min"]; raw != nil && !ok { + if v, ok := raw["start_min"]; !ok || v == nil { return fmt.Errorf("field start_min in P2PAdvertiserCreateScheduleElem: required") } type Plain P2PAdvertiserCreateScheduleElem @@ -132,16 +92,56 @@ func (j *P2PAdvertiserCreateSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Registers the client as a P2P advertiser. +type P2PAdvertiserCreate struct { + // [Optional] Advertiser's contact information, to be used as a default for new + // sell adverts. + ContactInfo *string `json:"contact_info,omitempty"` + + // [Optional] Default description that can be used every time an advert is + // created. + DefaultAdvertDescription *string `json:"default_advert_description,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // The advertiser's displayed name. + Name string `json:"name"` + + // Must be 1 + P2PAdvertiserCreate P2PAdvertiserCreateP2PAdvertiserCreate `json:"p2p_advertiser_create"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PAdvertiserCreatePassthrough `json:"passthrough,omitempty"` + + // [Optional] Advertiser's payment information, to be used as a default for new + // sell adverts. + PaymentInfo *string `json:"payment_info,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] Weekly availability schedule. Ads are visible and orders can be + // created only during available periods. + Schedule []P2PAdvertiserCreateScheduleElem `json:"schedule,omitempty"` + + // [Optional] If set to 1, will send updates whenever there is an update to + // advertiser + Subscribe *P2PAdvertiserCreateSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserCreate) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2PAdvertiserCreate: required") } - if _, ok := raw["p2p_advertiser_create"]; raw != nil && !ok { + if v, ok := raw["p2p_advertiser_create"]; !ok || v == nil { return fmt.Errorf("field p2p_advertiser_create in P2PAdvertiserCreate: required") } type Plain P2PAdvertiserCreate diff --git a/schema/p2p_advertiser_create_resp.go b/schema/p2p_advertiser_create_resp.go index 4cc1f6e..2b03f18 100644 --- a/schema/p2p_advertiser_create_resp.go +++ b/schema/p2p_advertiser_create_resp.go @@ -6,32 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Returns information of the created advertiser. -type P2PAdvertiserCreateResp struct { - // Echo of the request made. - EchoReq P2PAdvertiserCreateRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertiserCreateRespMsgType `json:"msg_type"` - - // P2P advertiser information. - P2PAdvertiserCreate *P2PAdvertiserCreateRespP2PAdvertiserCreate `json:"p2p_advertiser_create,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *P2PAdvertiserCreateRespSubscription `json:"subscription,omitempty"` -} - // Echo of the request made. type P2PAdvertiserCreateRespEchoReq map[string]interface{} type P2PAdvertiserCreateRespMsgType string -const P2PAdvertiserCreateRespMsgTypeP2PAdvertiserCreate P2PAdvertiserCreateRespMsgType = "p2p_advertiser_create" - var enumValues_P2PAdvertiserCreateRespMsgType = []interface{}{ "p2p_advertiser_create", } @@ -56,161 +35,7 @@ func (j *P2PAdvertiserCreateRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// P2P advertiser information. -type P2PAdvertiserCreateRespP2PAdvertiserCreate struct { - // Average difference of advert rate compared to the market rate over the past 30 - // days. - AdvertRates *float64 `json:"advert_rates"` - - // Amount of funds available to sell on P2P. May be less than account balance - // according to deposit methods used. - BalanceAvailable float64 `json:"balance_available"` - - // Boolean value: 1 or 0, indicating whether the advertiser's identify has been - // verified. - BasicVerification P2PAdvertiserCreateRespP2PAdvertiserCreateBasicVerification `json:"basic_verification"` - - // The number of P2P users who have blocked this advertiser. - BlockedByCount int `json:"blocked_by_count"` - - // The percentage of completed orders out of total orders as a buyer within the - // past 30 days. - BuyCompletionRate *float64 `json:"buy_completion_rate"` - - // Buy order volume in the past 30 days. - BuyOrdersAmount string `json:"buy_orders_amount"` - - // The number of buy order completed within the past 30 days. - BuyOrdersCount int `json:"buy_orders_count"` - - // The average time in seconds taken to make payment as a buyer within the past 30 - // days. - BuyTimeAvg *int `json:"buy_time_avg"` - - // The average time in seconds taken to cancel orders as a buyer within the past - // 30 days. - CancelTimeAvg *int `json:"cancel_time_avg"` - - // The number of times the user may cancel orders before being temporarily - // blocked. - CancelsRemaining int `json:"cancels_remaining"` - - // The token to be used for authenticating the client for chat. - ChatToken *string `json:"chat_token"` - - // The unique identifier for the chat user. - ChatUserId *string `json:"chat_user_id"` - - // Advertiser's contact information. - ContactInfo string `json:"contact_info"` - - // The epoch time that the client became an advertiser. - CreatedTime int `json:"created_time"` - - // Total value of P2P buy transactions in the past 24 hours. - DailyBuy *string `json:"daily_buy,omitempty"` - - // Maximum allowed value of P2P buy transactions in a 24 hour period. - DailyBuyLimit *string `json:"daily_buy_limit,omitempty"` - - // Total value of P2P sell transactions in the past 24 hours. - DailySell *string `json:"daily_sell,omitempty"` - - // Maximum allowed value of P2P sell transactions in a 24 hour period. - DailySellLimit *string `json:"daily_sell_limit,omitempty"` - - // Default description that can be used every time an advert is created. - DefaultAdvertDescription string `json:"default_advert_description"` - - // Boolean value: 1 or 0, indicating whether the advertiser's address has been - // verified. - FullVerification P2PAdvertiserCreateRespP2PAdvertiserCreateFullVerification `json:"full_verification"` - - // The advertiser's identification number. - Id string `json:"id"` - - // The approval status of the advertiser. - IsApproved P2PAdvertiserCreateRespP2PAdvertiserCreateIsApproved `json:"is_approved"` - - // Indicates if the advertiser's active adverts are listed. When `0`, adverts - // won't be listed regardless if they are active or not. - IsListed P2PAdvertiserCreateRespP2PAdvertiserCreateIsListed `json:"is_listed"` - - // Indicates if the advertiser is currently online. - IsOnline P2PAdvertiserCreateRespP2PAdvertiserCreateIsOnline `json:"is_online"` - - // Inidcates whether the advertiser's schedule allows P2P transactions at the - // current time. - IsScheduleAvailable P2PAdvertiserCreateRespP2PAdvertiserCreateIsScheduleAvailable `json:"is_schedule_available"` - - // Epoch of the latest time the advertiser was online, up to 6 months. - LastOnlineTime *int `json:"last_online_time"` - - // Maximum order amount for adverts. - MaxOrderAmount *string `json:"max_order_amount,omitempty"` - - // Sell ads will be hidden when your available balance or remaining daily sell - // limit falls beneath this value. - MinBalance *string `json:"min_balance,omitempty"` - - // Minimum order amount for adverts. - MinOrderAmount *string `json:"min_order_amount,omitempty"` - - // The advertiser's displayed name. - Name string `json:"name"` - - // Number of different users the advertiser has traded with since registration. - PartnerCount int `json:"partner_count"` - - // Advertiser's payment information. - PaymentInfo string `json:"payment_info"` - - // Average rating of the advertiser, range is 1-5. - RatingAverage *float64 `json:"rating_average"` - - // Number of ratings given to the advertiser. - RatingCount int `json:"rating_count"` - - // Percentage of users who have recommended the advertiser. - RecommendedAverage *float64 `json:"recommended_average"` - - // Number of times the advertiser has been recommended. - RecommendedCount *int `json:"recommended_count"` - - // The average time in seconds taken to release funds as a seller within the past - // 30 days. - ReleaseTimeAvg *int `json:"release_time_avg"` - - // [Optional] Weekly availability schedule. Ads are visible and orders can be - // created only during available periods. - Schedule []P2PAdvertiserCreateRespP2PAdvertiserCreateScheduleElem `json:"schedule,omitempty"` - - // The percentage of completed orders out of total orders as a seller within the - // past 30 days. - SellCompletionRate *float64 `json:"sell_completion_rate"` - - // Sell order volume in the past 30 days. - SellOrdersAmount string `json:"sell_orders_amount"` - - // The number of sell order orders completed within the past 30 days. - SellOrdersCount int `json:"sell_orders_count"` - - // When `1`, the advertiser's real name will be displayed to other users on - // adverts and orders. - ShowName P2PAdvertiserCreateRespP2PAdvertiserCreateShowName `json:"show_name"` - - // The percentage of completed orders out of all orders within the past 30 days. - TotalCompletionRate *float64 `json:"total_completion_rate"` - - // The total number of orders completed since advertiser registration. - TotalOrdersCount int `json:"total_orders_count"` - - // Total order volume since advertiser registration. - TotalTurnover string `json:"total_turnover"` - - // Remaining withdrawal_limit of a non-fully authenticated advertiser. - WithdrawalLimit *string `json:"withdrawal_limit,omitempty"` -} +const P2PAdvertiserCreateRespMsgTypeP2PAdvertiserCreate P2PAdvertiserCreateRespMsgType = "p2p_advertiser_create" type P2PAdvertiserCreateRespP2PAdvertiserCreateBasicVerification int @@ -389,10 +214,10 @@ func (j *P2PAdvertiserCreateRespP2PAdvertiserCreateScheduleElem) UnmarshalJSON(b if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["end_min"]; raw != nil && !ok { + if v, ok := raw["end_min"]; !ok || v == nil { return fmt.Errorf("field end_min in P2PAdvertiserCreateRespP2PAdvertiserCreateScheduleElem: required") } - if _, ok := raw["start_min"]; raw != nil && !ok { + if v, ok := raw["start_min"]; !ok || v == nil { return fmt.Errorf("field start_min in P2PAdvertiserCreateRespP2PAdvertiserCreateScheduleElem: required") } type Plain P2PAdvertiserCreateRespP2PAdvertiserCreateScheduleElem @@ -431,121 +256,277 @@ func (j *P2PAdvertiserCreateRespP2PAdvertiserCreateShowName) UnmarshalJSON(b []b return nil } +// P2P advertiser information. +type P2PAdvertiserCreateRespP2PAdvertiserCreate struct { + // Average difference of advert rate compared to the market rate over the past 30 + // days. + AdvertRates *float64 `json:"advert_rates"` + + // Amount of funds available to sell on P2P. May be less than account balance + // according to deposit methods used. + BalanceAvailable float64 `json:"balance_available"` + + // Boolean value: 1 or 0, indicating whether the advertiser's identify has been + // verified. + BasicVerification P2PAdvertiserCreateRespP2PAdvertiserCreateBasicVerification `json:"basic_verification"` + + // The number of P2P users who have blocked this advertiser. + BlockedByCount int `json:"blocked_by_count"` + + // The percentage of completed orders out of total orders as a buyer within the + // past 30 days. + BuyCompletionRate *float64 `json:"buy_completion_rate"` + + // Buy order volume in the past 30 days. + BuyOrdersAmount string `json:"buy_orders_amount"` + + // The number of buy order completed within the past 30 days. + BuyOrdersCount int `json:"buy_orders_count"` + + // The average time in seconds taken to make payment as a buyer within the past 30 + // days. + BuyTimeAvg *int `json:"buy_time_avg"` + + // The average time in seconds taken to cancel orders as a buyer within the past + // 30 days. + CancelTimeAvg *int `json:"cancel_time_avg"` + + // The number of times the user may cancel orders before being temporarily + // blocked. + CancelsRemaining int `json:"cancels_remaining"` + + // The token to be used for authenticating the client for chat. + ChatToken *string `json:"chat_token"` + + // The unique identifier for the chat user. + ChatUserId *string `json:"chat_user_id"` + + // Advertiser's contact information. + ContactInfo string `json:"contact_info"` + + // The epoch time that the client became an advertiser. + CreatedTime int `json:"created_time"` + + // Total value of P2P buy transactions in the past 24 hours. + DailyBuy *string `json:"daily_buy,omitempty"` + + // Maximum allowed value of P2P buy transactions in a 24 hour period. + DailyBuyLimit *string `json:"daily_buy_limit,omitempty"` + + // Total value of P2P sell transactions in the past 24 hours. + DailySell *string `json:"daily_sell,omitempty"` + + // Maximum allowed value of P2P sell transactions in a 24 hour period. + DailySellLimit *string `json:"daily_sell_limit,omitempty"` + + // Default description that can be used every time an advert is created. + DefaultAdvertDescription string `json:"default_advert_description"` + + // Boolean value: 1 or 0, indicating whether the advertiser's address has been + // verified. + FullVerification P2PAdvertiserCreateRespP2PAdvertiserCreateFullVerification `json:"full_verification"` + + // The advertiser's identification number. + Id string `json:"id"` + + // The approval status of the advertiser. + IsApproved P2PAdvertiserCreateRespP2PAdvertiserCreateIsApproved `json:"is_approved"` + + // Indicates if the advertiser's active adverts are listed. When `0`, adverts + // won't be listed regardless if they are active or not. + IsListed P2PAdvertiserCreateRespP2PAdvertiserCreateIsListed `json:"is_listed"` + + // Indicates if the advertiser is currently online. + IsOnline P2PAdvertiserCreateRespP2PAdvertiserCreateIsOnline `json:"is_online"` + + // Inidcates whether the advertiser's schedule allows P2P transactions at the + // current time. + IsScheduleAvailable P2PAdvertiserCreateRespP2PAdvertiserCreateIsScheduleAvailable `json:"is_schedule_available"` + + // Epoch of the latest time the advertiser was online, up to 6 months. + LastOnlineTime *int `json:"last_online_time"` + + // Maximum order amount for adverts. + MaxOrderAmount *string `json:"max_order_amount,omitempty"` + + // Sell ads will be hidden when your available balance or remaining daily sell + // limit falls beneath this value. + MinBalance *string `json:"min_balance,omitempty"` + + // Minimum order amount for adverts. + MinOrderAmount *string `json:"min_order_amount,omitempty"` + + // The advertiser's displayed name. + Name string `json:"name"` + + // Number of different users the advertiser has traded with since registration. + PartnerCount int `json:"partner_count"` + + // Advertiser's payment information. + PaymentInfo string `json:"payment_info"` + + // Average rating of the advertiser, range is 1-5. + RatingAverage *float64 `json:"rating_average"` + + // Number of ratings given to the advertiser. + RatingCount int `json:"rating_count"` + + // Percentage of users who have recommended the advertiser. + RecommendedAverage *float64 `json:"recommended_average"` + + // Number of times the advertiser has been recommended. + RecommendedCount *int `json:"recommended_count"` + + // The average time in seconds taken to release funds as a seller within the past + // 30 days. + ReleaseTimeAvg *int `json:"release_time_avg"` + + // [Optional] Weekly availability schedule. Ads are visible and orders can be + // created only during available periods. + Schedule []P2PAdvertiserCreateRespP2PAdvertiserCreateScheduleElem `json:"schedule,omitempty"` + + // The percentage of completed orders out of total orders as a seller within the + // past 30 days. + SellCompletionRate *float64 `json:"sell_completion_rate"` + + // Sell order volume in the past 30 days. + SellOrdersAmount string `json:"sell_orders_amount"` + + // The number of sell order orders completed within the past 30 days. + SellOrdersCount int `json:"sell_orders_count"` + + // When `1`, the advertiser's real name will be displayed to other users on + // adverts and orders. + ShowName P2PAdvertiserCreateRespP2PAdvertiserCreateShowName `json:"show_name"` + + // The percentage of completed orders out of all orders within the past 30 days. + TotalCompletionRate *float64 `json:"total_completion_rate"` + + // The total number of orders completed since advertiser registration. + TotalOrdersCount int `json:"total_orders_count"` + + // Total order volume since advertiser registration. + TotalTurnover string `json:"total_turnover"` + + // Remaining withdrawal_limit of a non-fully authenticated advertiser. + WithdrawalLimit *string `json:"withdrawal_limit,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserCreateRespP2PAdvertiserCreate) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["advert_rates"]; raw != nil && !ok { + if v, ok := raw["advert_rates"]; !ok || v == nil { return fmt.Errorf("field advert_rates in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["balance_available"]; raw != nil && !ok { + if v, ok := raw["balance_available"]; !ok || v == nil { return fmt.Errorf("field balance_available in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["basic_verification"]; raw != nil && !ok { + if v, ok := raw["basic_verification"]; !ok || v == nil { return fmt.Errorf("field basic_verification in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["blocked_by_count"]; raw != nil && !ok { + if v, ok := raw["blocked_by_count"]; !ok || v == nil { return fmt.Errorf("field blocked_by_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["buy_completion_rate"]; raw != nil && !ok { + if v, ok := raw["buy_completion_rate"]; !ok || v == nil { return fmt.Errorf("field buy_completion_rate in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["buy_orders_amount"]; raw != nil && !ok { + if v, ok := raw["buy_orders_amount"]; !ok || v == nil { return fmt.Errorf("field buy_orders_amount in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["buy_orders_count"]; raw != nil && !ok { + if v, ok := raw["buy_orders_count"]; !ok || v == nil { return fmt.Errorf("field buy_orders_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["buy_time_avg"]; raw != nil && !ok { + if v, ok := raw["buy_time_avg"]; !ok || v == nil { return fmt.Errorf("field buy_time_avg in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["cancel_time_avg"]; raw != nil && !ok { + if v, ok := raw["cancel_time_avg"]; !ok || v == nil { return fmt.Errorf("field cancel_time_avg in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["cancels_remaining"]; raw != nil && !ok { + if v, ok := raw["cancels_remaining"]; !ok || v == nil { return fmt.Errorf("field cancels_remaining in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["chat_token"]; raw != nil && !ok { + if v, ok := raw["chat_token"]; !ok || v == nil { return fmt.Errorf("field chat_token in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["chat_user_id"]; raw != nil && !ok { + if v, ok := raw["chat_user_id"]; !ok || v == nil { return fmt.Errorf("field chat_user_id in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["contact_info"]; raw != nil && !ok { + if v, ok := raw["contact_info"]; !ok || v == nil { return fmt.Errorf("field contact_info in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["default_advert_description"]; raw != nil && !ok { + if v, ok := raw["default_advert_description"]; !ok || v == nil { return fmt.Errorf("field default_advert_description in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["full_verification"]; raw != nil && !ok { + if v, ok := raw["full_verification"]; !ok || v == nil { return fmt.Errorf("field full_verification in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["is_approved"]; raw != nil && !ok { + if v, ok := raw["is_approved"]; !ok || v == nil { return fmt.Errorf("field is_approved in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["is_listed"]; raw != nil && !ok { + if v, ok := raw["is_listed"]; !ok || v == nil { return fmt.Errorf("field is_listed in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { + if v, ok := raw["is_schedule_available"]; !ok || v == nil { return fmt.Errorf("field is_schedule_available in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["partner_count"]; raw != nil && !ok { + if v, ok := raw["partner_count"]; !ok || v == nil { return fmt.Errorf("field partner_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["payment_info"]; raw != nil && !ok { + if v, ok := raw["payment_info"]; !ok || v == nil { return fmt.Errorf("field payment_info in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["rating_average"]; raw != nil && !ok { + if v, ok := raw["rating_average"]; !ok || v == nil { return fmt.Errorf("field rating_average in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["rating_count"]; raw != nil && !ok { + if v, ok := raw["rating_count"]; !ok || v == nil { return fmt.Errorf("field rating_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["recommended_average"]; raw != nil && !ok { + if v, ok := raw["recommended_average"]; !ok || v == nil { return fmt.Errorf("field recommended_average in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["recommended_count"]; raw != nil && !ok { + if v, ok := raw["recommended_count"]; !ok || v == nil { return fmt.Errorf("field recommended_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["release_time_avg"]; raw != nil && !ok { + if v, ok := raw["release_time_avg"]; !ok || v == nil { return fmt.Errorf("field release_time_avg in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["sell_completion_rate"]; raw != nil && !ok { + if v, ok := raw["sell_completion_rate"]; !ok || v == nil { return fmt.Errorf("field sell_completion_rate in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["sell_orders_amount"]; raw != nil && !ok { + if v, ok := raw["sell_orders_amount"]; !ok || v == nil { return fmt.Errorf("field sell_orders_amount in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["sell_orders_count"]; raw != nil && !ok { + if v, ok := raw["sell_orders_count"]; !ok || v == nil { return fmt.Errorf("field sell_orders_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["show_name"]; raw != nil && !ok { + if v, ok := raw["show_name"]; !ok || v == nil { return fmt.Errorf("field show_name in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { + if v, ok := raw["total_completion_rate"]; !ok || v == nil { return fmt.Errorf("field total_completion_rate in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["total_orders_count"]; raw != nil && !ok { + if v, ok := raw["total_orders_count"]; !ok || v == nil { return fmt.Errorf("field total_orders_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if _, ok := raw["total_turnover"]; raw != nil && !ok { + if v, ok := raw["total_turnover"]; !ok || v == nil { return fmt.Errorf("field total_turnover in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } type Plain P2PAdvertiserCreateRespP2PAdvertiserCreate @@ -570,7 +551,7 @@ func (j *P2PAdvertiserCreateRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertiserCreateRespSubscription: required") } type Plain P2PAdvertiserCreateRespSubscription @@ -582,16 +563,35 @@ func (j *P2PAdvertiserCreateRespSubscription) UnmarshalJSON(b []byte) error { return nil } +// Returns information of the created advertiser. +type P2PAdvertiserCreateResp struct { + // Echo of the request made. + EchoReq P2PAdvertiserCreateRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertiserCreateRespMsgType `json:"msg_type"` + + // P2P advertiser information. + P2PAdvertiserCreate *P2PAdvertiserCreateRespP2PAdvertiserCreate `json:"p2p_advertiser_create,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *P2PAdvertiserCreateRespSubscription `json:"subscription,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserCreateResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertiserCreateResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertiserCreateResp: required") } type Plain P2PAdvertiserCreateResp diff --git a/schema/p2p_advertiser_info.go b/schema/p2p_advertiser_info.go index 849ea2c..ab707e1 100644 --- a/schema/p2p_advertiser_info.go +++ b/schema/p2p_advertiser_info.go @@ -6,31 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieve information about a P2P advertiser. -type P2PAdvertiserInfo struct { - // [Optional] The unique identifier for this advertiser. If not provided, returns - // advertiser information about the current account. - Id *string `json:"id,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2PAdvertiserInfo P2PAdvertiserInfoP2PAdvertiserInfo `json:"p2p_advertiser_info"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PAdvertiserInfoPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to 1, will send updates whenever there is an update to - // advertiser - Subscribe *P2PAdvertiserInfoSubscribe `json:"subscribe,omitempty"` -} - type P2PAdvertiserInfoP2PAdvertiserInfo int var enumValues_P2PAdvertiserInfoP2PAdvertiserInfo = []interface{}{ @@ -87,13 +62,38 @@ func (j *P2PAdvertiserInfoSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Retrieve information about a P2P advertiser. +type P2PAdvertiserInfo struct { + // [Optional] The unique identifier for this advertiser. If not provided, returns + // advertiser information about the current account. + Id *string `json:"id,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2PAdvertiserInfo P2PAdvertiserInfoP2PAdvertiserInfo `json:"p2p_advertiser_info"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PAdvertiserInfoPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to 1, will send updates whenever there is an update to + // advertiser + Subscribe *P2PAdvertiserInfoSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_advertiser_info"]; raw != nil && !ok { + if v, ok := raw["p2p_advertiser_info"]; !ok || v == nil { return fmt.Errorf("field p2p_advertiser_info in P2PAdvertiserInfo: required") } type Plain P2PAdvertiserInfo diff --git a/schema/p2p_advertiser_info_resp.go b/schema/p2p_advertiser_info_resp.go index 26b1c60..aae9f05 100644 --- a/schema/p2p_advertiser_info_resp.go +++ b/schema/p2p_advertiser_info_resp.go @@ -6,32 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Returns information about the given advertiser ID. -type P2PAdvertiserInfoResp struct { - // Echo of the request made. - EchoReq P2PAdvertiserInfoRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertiserInfoRespMsgType `json:"msg_type"` - - // P2P advertiser information. - P2PAdvertiserInfo *P2PAdvertiserInfoRespP2PAdvertiserInfo `json:"p2p_advertiser_info,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *P2PAdvertiserInfoRespSubscription `json:"subscription,omitempty"` -} - // Echo of the request made. type P2PAdvertiserInfoRespEchoReq map[string]interface{} type P2PAdvertiserInfoRespMsgType string -const P2PAdvertiserInfoRespMsgTypeP2PAdvertiserInfo P2PAdvertiserInfoRespMsgType = "p2p_advertiser_info" - var enumValues_P2PAdvertiserInfoRespMsgType = []interface{}{ "p2p_advertiser_info", } @@ -56,192 +35,7 @@ func (j *P2PAdvertiserInfoRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// P2P advertiser information. -type P2PAdvertiserInfoRespP2PAdvertiserInfo struct { - // Number of active fixed rate adverts belonging to the advertiser. - ActiveFixedAds *int `json:"active_fixed_ads,omitempty"` - - // Number of active floating rate adverts belonging to the advertiser. - ActiveFloatAds *int `json:"active_float_ads,omitempty"` - - // Average difference of advert rate compared to the market rate over the past 30 - // days. - AdvertRates *float64 `json:"advert_rates"` - - // Amount of funds available to sell on P2P. May be less than account balance - // according to deposit methods used. - BalanceAvailable *float64 `json:"balance_available,omitempty"` - - // Boolean value: 1 or 0, indicating whether the advertiser's identify has been - // verified. - BasicVerification P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification `json:"basic_verification"` - - // Block trading limits, if block trading is allowed. - BlockTrade *P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade `json:"block_trade,omitempty"` - - // The number of P2P users who have blocked this advertiser. - BlockedByCount *int `json:"blocked_by_count,omitempty"` - - // If a temporary bar was placed, this is the epoch time at which it will end. - BlockedUntil *int `json:"blocked_until,omitempty"` - - // The percentage of completed orders out of total orders as a buyer within the - // past 30 days. - BuyCompletionRate *float64 `json:"buy_completion_rate"` - - // Buy order volume in the past 30 days. - BuyOrdersAmount string `json:"buy_orders_amount"` - - // The number of buy order completed within the past 30 days. - BuyOrdersCount int `json:"buy_orders_count"` - - // The average time in seconds taken to make payment as a buyer within the past 30 - // days. - BuyTimeAvg *int `json:"buy_time_avg"` - - // The average time in seconds taken to cancel orders as a buyer within the past - // 30 days. - CancelTimeAvg *int `json:"cancel_time_avg"` - - // The number of times the user may cancel orders before being temporarily - // blocked. - CancelsRemaining *int `json:"cancels_remaining,omitempty"` - - // The token to be used for authenticating the client for chat. - ChatToken *string `json:"chat_token,omitempty"` - - // The unique identifier for the chat user. - ChatUserId *string `json:"chat_user_id,omitempty"` - - // Advertiser's contact information. - ContactInfo *string `json:"contact_info,omitempty"` - - // The epoch time that the client became an advertiser. - CreatedTime int `json:"created_time"` - - // Total value of P2P buy transactions in the past 24 hours. - DailyBuy *string `json:"daily_buy,omitempty"` - - // Maximum allowed value of P2P buy transactions in a 24 hour period. - DailyBuyLimit *string `json:"daily_buy_limit,omitempty"` - - // Total value of P2P sell transactions in the past 24 hours. - DailySell *string `json:"daily_sell,omitempty"` - - // Maximum allowed value of P2P sell transactions in a 24 hour period. - DailySellLimit *string `json:"daily_sell_limit,omitempty"` - - // Default description that can be used every time an advert is created. - DefaultAdvertDescription string `json:"default_advert_description"` - - // The advertiser's first name. - FirstName *string `json:"first_name,omitempty"` - - // Boolean value: 1 or 0, indicating whether the advertiser's address has been - // verified. - FullVerification P2PAdvertiserInfoRespP2PAdvertiserInfoFullVerification `json:"full_verification"` - - // The advertiser's identification number. - Id string `json:"id"` - - // The approval status of the advertiser. - IsApproved P2PAdvertiserInfoRespP2PAdvertiserInfoIsApproved `json:"is_approved"` - - // Indicates that the advertiser is blocked by the current user. - IsBlocked *P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked `json:"is_blocked,omitempty"` - - // Indicates that the advertiser is a favourite of the current user - IsFavourite *P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite `json:"is_favourite,omitempty"` - - // Indicates if the advertiser's active adverts are listed. When `0`, adverts - // won't be listed regardless if they are active or not. - IsListed P2PAdvertiserInfoRespP2PAdvertiserInfoIsListed `json:"is_listed"` - - // Indicates if the advertiser is currently online. - IsOnline P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline `json:"is_online"` - - // Indicates that the advertiser was recommended in the most recent review by the - // current user. - IsRecommended *P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended `json:"is_recommended,omitempty"` - - // Inidcates whether the advertiser's schedule allows P2P transactions at the - // current time. - IsScheduleAvailable P2PAdvertiserInfoRespP2PAdvertiserInfoIsScheduleAvailable `json:"is_schedule_available"` - - // The advertiser's last name. - LastName *string `json:"last_name,omitempty"` - - // Epoch of the latest time the advertiser was online, up to 6 months. - LastOnlineTime *int `json:"last_online_time"` - - // Maximum order amount for adverts. - MaxOrderAmount *string `json:"max_order_amount,omitempty"` - - // Sell ads will be hidden when your available balance or remaining daily sell - // limit falls beneath this value. - MinBalance *string `json:"min_balance,omitempty"` - - // Minimum order amount for adverts. - MinOrderAmount *string `json:"min_order_amount,omitempty"` - - // The advertiser's displayed name. - Name string `json:"name"` - - // Number of different users the advertiser has traded with since registration. - PartnerCount int `json:"partner_count"` - - // Advertiser's payment information. - PaymentInfo *string `json:"payment_info,omitempty"` - - // Average rating of the advertiser, range is 1-5. - RatingAverage *float64 `json:"rating_average"` - - // Number of ratings given to the advertiser. - RatingCount int `json:"rating_count"` - - // Percentage of users who have recommended the advertiser. - RecommendedAverage *float64 `json:"recommended_average"` - - // Number of times the advertiser has been recommended. - RecommendedCount *int `json:"recommended_count"` - - // The average time in seconds taken to release funds as a seller within the past - // 30 days. - ReleaseTimeAvg *int `json:"release_time_avg"` - - // [Optional] Weekly availability schedule. Ads are visible and orders can be - // created only during available periods. - Schedule []P2PAdvertiserInfoRespP2PAdvertiserInfoScheduleElem `json:"schedule,omitempty"` - - // The percentage of completed orders out of total orders as a seller within the - // past 30 days. - SellCompletionRate *float64 `json:"sell_completion_rate"` - - // Sell order volume in the past 30 days. - SellOrdersAmount string `json:"sell_orders_amount"` - - // The number of sell order orders completed within the past 30 days. - SellOrdersCount int `json:"sell_orders_count"` - - // When `1`, the advertiser's real name will be displayed on to other users on - // adverts and orders. - ShowName *P2PAdvertiserInfoRespP2PAdvertiserInfoShowName `json:"show_name,omitempty"` - - // The percentage of completed orders out of all orders within the past 30 days. - TotalCompletionRate *float64 `json:"total_completion_rate"` - - // The total number of orders completed since advertiser registration. - TotalOrdersCount int `json:"total_orders_count"` - - // Total order volume since advertiser registration. - TotalTurnover string `json:"total_turnover"` - - // New daily limits available. - UpgradableDailyLimits *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits `json:"upgradable_daily_limits,omitempty"` - - // Remaining withdrawal_limit of a non-fully authenticated advertiser. - WithdrawalLimit *string `json:"withdrawal_limit,omitempty"` -} +const P2PAdvertiserInfoRespMsgTypeP2PAdvertiserInfo P2PAdvertiserInfoRespMsgType = "p2p_advertiser_info" type P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification int @@ -285,10 +79,10 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade) UnmarshalJSON(b []byt if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["max_order_amount"]; raw != nil && !ok { + if v, ok := raw["max_order_amount"]; !ok || v == nil { return fmt.Errorf("field max_order_amount in P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade: required") } - if _, ok := raw["min_order_amount"]; raw != nil && !ok { + if v, ok := raw["min_order_amount"]; !ok || v == nil { return fmt.Errorf("field min_order_amount in P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade: required") } type Plain P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade @@ -466,17 +260,17 @@ type P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended struct { Value interface{} } -// MarshalJSON implements json.Marshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended = []interface{}{ nil, 0.0, 1.0, } +// MarshalJSON implements json.Marshaler. +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -541,10 +335,10 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoScheduleElem) UnmarshalJSON(b []b if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["end_min"]; raw != nil && !ok { + if v, ok := raw["end_min"]; !ok || v == nil { return fmt.Errorf("field end_min in P2PAdvertiserInfoRespP2PAdvertiserInfoScheduleElem: required") } - if _, ok := raw["start_min"]; raw != nil && !ok { + if v, ok := raw["start_min"]; !ok || v == nil { return fmt.Errorf("field start_min in P2PAdvertiserInfoRespP2PAdvertiserInfoScheduleElem: required") } type Plain P2PAdvertiserInfoRespP2PAdvertiserInfoScheduleElem @@ -583,18 +377,6 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoShowName) UnmarshalJSON(b []byte) return nil } -// New daily limits available. -type P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits struct { - // When `1`, upgrade will provide block trading. - BlockTrade *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade `json:"block_trade,omitempty"` - - // Upgradable daily buy limit. - MaxDailyBuy string `json:"max_daily_buy"` - - // Upgradable daily sell limit. - MaxDailySell string `json:"max_daily_sell"` -} - type P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade int var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade = []interface{}{ @@ -622,16 +404,28 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade) return nil } +// New daily limits available. +type P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits struct { + // When `1`, upgrade will provide block trading. + BlockTrade *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade `json:"block_trade,omitempty"` + + // Upgradable daily buy limit. + MaxDailyBuy string `json:"max_daily_buy"` + + // Upgradable daily sell limit. + MaxDailySell string `json:"max_daily_sell"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["max_daily_buy"]; raw != nil && !ok { + if v, ok := raw["max_daily_buy"]; !ok || v == nil { return fmt.Errorf("field max_daily_buy in P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits: required") } - if _, ok := raw["max_daily_sell"]; raw != nil && !ok { + if v, ok := raw["max_daily_sell"]; !ok || v == nil { return fmt.Errorf("field max_daily_sell in P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits: required") } type Plain P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits @@ -643,97 +437,284 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits) UnmarshalJ return nil } +// P2P advertiser information. +type P2PAdvertiserInfoRespP2PAdvertiserInfo struct { + // Number of active fixed rate adverts belonging to the advertiser. + ActiveFixedAds *int `json:"active_fixed_ads,omitempty"` + + // Number of active floating rate adverts belonging to the advertiser. + ActiveFloatAds *int `json:"active_float_ads,omitempty"` + + // Average difference of advert rate compared to the market rate over the past 30 + // days. + AdvertRates *float64 `json:"advert_rates"` + + // Amount of funds available to sell on P2P. May be less than account balance + // according to deposit methods used. + BalanceAvailable *float64 `json:"balance_available,omitempty"` + + // Boolean value: 1 or 0, indicating whether the advertiser's identify has been + // verified. + BasicVerification P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification `json:"basic_verification"` + + // Block trading limits, if block trading is allowed. + BlockTrade *P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade `json:"block_trade,omitempty"` + + // The number of P2P users who have blocked this advertiser. + BlockedByCount *int `json:"blocked_by_count,omitempty"` + + // If a temporary bar was placed, this is the epoch time at which it will end. + BlockedUntil *int `json:"blocked_until,omitempty"` + + // The percentage of completed orders out of total orders as a buyer within the + // past 30 days. + BuyCompletionRate *float64 `json:"buy_completion_rate"` + + // Buy order volume in the past 30 days. + BuyOrdersAmount string `json:"buy_orders_amount"` + + // The number of buy order completed within the past 30 days. + BuyOrdersCount int `json:"buy_orders_count"` + + // The average time in seconds taken to make payment as a buyer within the past 30 + // days. + BuyTimeAvg *int `json:"buy_time_avg"` + + // The average time in seconds taken to cancel orders as a buyer within the past + // 30 days. + CancelTimeAvg *int `json:"cancel_time_avg"` + + // The number of times the user may cancel orders before being temporarily + // blocked. + CancelsRemaining *int `json:"cancels_remaining,omitempty"` + + // The token to be used for authenticating the client for chat. + ChatToken *string `json:"chat_token,omitempty"` + + // The unique identifier for the chat user. + ChatUserId *string `json:"chat_user_id,omitempty"` + + // Advertiser's contact information. + ContactInfo *string `json:"contact_info,omitempty"` + + // The epoch time that the client became an advertiser. + CreatedTime int `json:"created_time"` + + // Total value of P2P buy transactions in the past 24 hours. + DailyBuy *string `json:"daily_buy,omitempty"` + + // Maximum allowed value of P2P buy transactions in a 24 hour period. + DailyBuyLimit *string `json:"daily_buy_limit,omitempty"` + + // Total value of P2P sell transactions in the past 24 hours. + DailySell *string `json:"daily_sell,omitempty"` + + // Maximum allowed value of P2P sell transactions in a 24 hour period. + DailySellLimit *string `json:"daily_sell_limit,omitempty"` + + // Default description that can be used every time an advert is created. + DefaultAdvertDescription string `json:"default_advert_description"` + + // The advertiser's first name. + FirstName *string `json:"first_name,omitempty"` + + // Boolean value: 1 or 0, indicating whether the advertiser's address has been + // verified. + FullVerification P2PAdvertiserInfoRespP2PAdvertiserInfoFullVerification `json:"full_verification"` + + // The advertiser's identification number. + Id string `json:"id"` + + // The approval status of the advertiser. + IsApproved P2PAdvertiserInfoRespP2PAdvertiserInfoIsApproved `json:"is_approved"` + + // Indicates that the advertiser is blocked by the current user. + IsBlocked *P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked `json:"is_blocked,omitempty"` + + // Indicates that the advertiser is a favourite of the current user + IsFavourite *P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite `json:"is_favourite,omitempty"` + + // Indicates if the advertiser's active adverts are listed. When `0`, adverts + // won't be listed regardless if they are active or not. + IsListed P2PAdvertiserInfoRespP2PAdvertiserInfoIsListed `json:"is_listed"` + + // Indicates if the advertiser is currently online. + IsOnline P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline `json:"is_online"` + + // Indicates that the advertiser was recommended in the most recent review by the + // current user. + IsRecommended *P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended `json:"is_recommended,omitempty"` + + // Inidcates whether the advertiser's schedule allows P2P transactions at the + // current time. + IsScheduleAvailable P2PAdvertiserInfoRespP2PAdvertiserInfoIsScheduleAvailable `json:"is_schedule_available"` + + // The advertiser's last name. + LastName *string `json:"last_name,omitempty"` + + // Epoch of the latest time the advertiser was online, up to 6 months. + LastOnlineTime *int `json:"last_online_time"` + + // Maximum order amount for adverts. + MaxOrderAmount *string `json:"max_order_amount,omitempty"` + + // Sell ads will be hidden when your available balance or remaining daily sell + // limit falls beneath this value. + MinBalance *string `json:"min_balance,omitempty"` + + // Minimum order amount for adverts. + MinOrderAmount *string `json:"min_order_amount,omitempty"` + + // The advertiser's displayed name. + Name string `json:"name"` + + // Number of different users the advertiser has traded with since registration. + PartnerCount int `json:"partner_count"` + + // Advertiser's payment information. + PaymentInfo *string `json:"payment_info,omitempty"` + + // Average rating of the advertiser, range is 1-5. + RatingAverage *float64 `json:"rating_average"` + + // Number of ratings given to the advertiser. + RatingCount int `json:"rating_count"` + + // Percentage of users who have recommended the advertiser. + RecommendedAverage *float64 `json:"recommended_average"` + + // Number of times the advertiser has been recommended. + RecommendedCount *int `json:"recommended_count"` + + // The average time in seconds taken to release funds as a seller within the past + // 30 days. + ReleaseTimeAvg *int `json:"release_time_avg"` + + // [Optional] Weekly availability schedule. Ads are visible and orders can be + // created only during available periods. + Schedule []P2PAdvertiserInfoRespP2PAdvertiserInfoScheduleElem `json:"schedule,omitempty"` + + // The percentage of completed orders out of total orders as a seller within the + // past 30 days. + SellCompletionRate *float64 `json:"sell_completion_rate"` + + // Sell order volume in the past 30 days. + SellOrdersAmount string `json:"sell_orders_amount"` + + // The number of sell order orders completed within the past 30 days. + SellOrdersCount int `json:"sell_orders_count"` + + // When `1`, the advertiser's real name will be displayed on to other users on + // adverts and orders. + ShowName *P2PAdvertiserInfoRespP2PAdvertiserInfoShowName `json:"show_name,omitempty"` + + // The percentage of completed orders out of all orders within the past 30 days. + TotalCompletionRate *float64 `json:"total_completion_rate"` + + // The total number of orders completed since advertiser registration. + TotalOrdersCount int `json:"total_orders_count"` + + // Total order volume since advertiser registration. + TotalTurnover string `json:"total_turnover"` + + // New daily limits available. + UpgradableDailyLimits *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits `json:"upgradable_daily_limits,omitempty"` + + // Remaining withdrawal_limit of a non-fully authenticated advertiser. + WithdrawalLimit *string `json:"withdrawal_limit,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfoRespP2PAdvertiserInfo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["advert_rates"]; raw != nil && !ok { + if v, ok := raw["advert_rates"]; !ok || v == nil { return fmt.Errorf("field advert_rates in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["basic_verification"]; raw != nil && !ok { + if v, ok := raw["basic_verification"]; !ok || v == nil { return fmt.Errorf("field basic_verification in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["buy_completion_rate"]; raw != nil && !ok { + if v, ok := raw["buy_completion_rate"]; !ok || v == nil { return fmt.Errorf("field buy_completion_rate in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["buy_orders_amount"]; raw != nil && !ok { + if v, ok := raw["buy_orders_amount"]; !ok || v == nil { return fmt.Errorf("field buy_orders_amount in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["buy_orders_count"]; raw != nil && !ok { + if v, ok := raw["buy_orders_count"]; !ok || v == nil { return fmt.Errorf("field buy_orders_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["buy_time_avg"]; raw != nil && !ok { + if v, ok := raw["buy_time_avg"]; !ok || v == nil { return fmt.Errorf("field buy_time_avg in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["cancel_time_avg"]; raw != nil && !ok { + if v, ok := raw["cancel_time_avg"]; !ok || v == nil { return fmt.Errorf("field cancel_time_avg in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["default_advert_description"]; raw != nil && !ok { + if v, ok := raw["default_advert_description"]; !ok || v == nil { return fmt.Errorf("field default_advert_description in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["full_verification"]; raw != nil && !ok { + if v, ok := raw["full_verification"]; !ok || v == nil { return fmt.Errorf("field full_verification in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["is_approved"]; raw != nil && !ok { + if v, ok := raw["is_approved"]; !ok || v == nil { return fmt.Errorf("field is_approved in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["is_listed"]; raw != nil && !ok { + if v, ok := raw["is_listed"]; !ok || v == nil { return fmt.Errorf("field is_listed in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { + if v, ok := raw["is_schedule_available"]; !ok || v == nil { return fmt.Errorf("field is_schedule_available in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["partner_count"]; raw != nil && !ok { + if v, ok := raw["partner_count"]; !ok || v == nil { return fmt.Errorf("field partner_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["rating_average"]; raw != nil && !ok { + if v, ok := raw["rating_average"]; !ok || v == nil { return fmt.Errorf("field rating_average in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["rating_count"]; raw != nil && !ok { + if v, ok := raw["rating_count"]; !ok || v == nil { return fmt.Errorf("field rating_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["recommended_average"]; raw != nil && !ok { + if v, ok := raw["recommended_average"]; !ok || v == nil { return fmt.Errorf("field recommended_average in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["recommended_count"]; raw != nil && !ok { + if v, ok := raw["recommended_count"]; !ok || v == nil { return fmt.Errorf("field recommended_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["release_time_avg"]; raw != nil && !ok { + if v, ok := raw["release_time_avg"]; !ok || v == nil { return fmt.Errorf("field release_time_avg in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["sell_completion_rate"]; raw != nil && !ok { + if v, ok := raw["sell_completion_rate"]; !ok || v == nil { return fmt.Errorf("field sell_completion_rate in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["sell_orders_amount"]; raw != nil && !ok { + if v, ok := raw["sell_orders_amount"]; !ok || v == nil { return fmt.Errorf("field sell_orders_amount in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["sell_orders_count"]; raw != nil && !ok { + if v, ok := raw["sell_orders_count"]; !ok || v == nil { return fmt.Errorf("field sell_orders_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { + if v, ok := raw["total_completion_rate"]; !ok || v == nil { return fmt.Errorf("field total_completion_rate in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["total_orders_count"]; raw != nil && !ok { + if v, ok := raw["total_orders_count"]; !ok || v == nil { return fmt.Errorf("field total_orders_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if _, ok := raw["total_turnover"]; raw != nil && !ok { + if v, ok := raw["total_turnover"]; !ok || v == nil { return fmt.Errorf("field total_turnover in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } type Plain P2PAdvertiserInfoRespP2PAdvertiserInfo @@ -758,7 +739,7 @@ func (j *P2PAdvertiserInfoRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertiserInfoRespSubscription: required") } type Plain P2PAdvertiserInfoRespSubscription @@ -770,16 +751,35 @@ func (j *P2PAdvertiserInfoRespSubscription) UnmarshalJSON(b []byte) error { return nil } +// Returns information about the given advertiser ID. +type P2PAdvertiserInfoResp struct { + // Echo of the request made. + EchoReq P2PAdvertiserInfoRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertiserInfoRespMsgType `json:"msg_type"` + + // P2P advertiser information. + P2PAdvertiserInfo *P2PAdvertiserInfoRespP2PAdvertiserInfo `json:"p2p_advertiser_info,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *P2PAdvertiserInfoRespSubscription `json:"subscription,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfoResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertiserInfoResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertiserInfoResp: required") } type Plain P2PAdvertiserInfoResp diff --git a/schema/p2p_advertiser_list.go b/schema/p2p_advertiser_list.go index 09d0d89..29b7edd 100644 --- a/schema/p2p_advertiser_list.go +++ b/schema/p2p_advertiser_list.go @@ -43,35 +43,52 @@ type P2PAdvertiserList struct { type P2PAdvertiserListIsBlocked int +type P2PAdvertiserListP2PAdvertiserList int + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type P2PAdvertiserListPassthrough map[string]interface{} + +type P2PAdvertiserListSortBy string + +const P2PAdvertiserListSortByCreatedTime P2PAdvertiserListSortBy = "created_time" +const P2PAdvertiserListSortByLastInteractionTime P2PAdvertiserListSortBy = "last_interaction_time" +const P2PAdvertiserListSortByName P2PAdvertiserListSortBy = "name" + +type P2PAdvertiserListTradePartners int + var enumValues_P2PAdvertiserListIsBlocked = []interface{}{ 0, 1, } +var enumValues_P2PAdvertiserListP2PAdvertiserList = []interface{}{ + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserListIsBlocked) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertiserListSortBy) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserListIsBlocked { + for _, expected := range enumValues_P2PAdvertiserListSortBy { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListIsBlocked, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListSortBy, v) } - *j = P2PAdvertiserListIsBlocked(v) + *j = P2PAdvertiserListSortBy(v) return nil } -type P2PAdvertiserListP2PAdvertiserList int - -var enumValues_P2PAdvertiserListP2PAdvertiserList = []interface{}{ - 1, +var enumValues_P2PAdvertiserListSortBy = []interface{}{ + "name", + "created_time", + "last_interaction_time", } // UnmarshalJSON implements json.Unmarshaler. @@ -94,66 +111,48 @@ func (j *P2PAdvertiserListP2PAdvertiserList) UnmarshalJSON(b []byte) error { return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type P2PAdvertiserListPassthrough map[string]interface{} - -type P2PAdvertiserListSortBy string - -const P2PAdvertiserListSortByCreatedTime P2PAdvertiserListSortBy = "created_time" -const P2PAdvertiserListSortByLastInteractionTime P2PAdvertiserListSortBy = "last_interaction_time" -const P2PAdvertiserListSortByName P2PAdvertiserListSortBy = "name" - -var enumValues_P2PAdvertiserListSortBy = []interface{}{ - "name", - "created_time", - "last_interaction_time", +var enumValues_P2PAdvertiserListTradePartners = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserListSortBy) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertiserListTradePartners) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserListSortBy { + for _, expected := range enumValues_P2PAdvertiserListTradePartners { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListSortBy, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListTradePartners, v) } - *j = P2PAdvertiserListSortBy(v) + *j = P2PAdvertiserListTradePartners(v) return nil } -type P2PAdvertiserListTradePartners int - -var enumValues_P2PAdvertiserListTradePartners = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserListTradePartners) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertiserListIsBlocked) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserListTradePartners { + for _, expected := range enumValues_P2PAdvertiserListIsBlocked { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListTradePartners, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListIsBlocked, v) } - *j = P2PAdvertiserListTradePartners(v) + *j = P2PAdvertiserListIsBlocked(v) return nil } @@ -163,7 +162,7 @@ func (j *P2PAdvertiserList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_advertiser_list"]; raw != nil && !ok { + if v, ok := raw["p2p_advertiser_list"]; !ok || v == nil { return fmt.Errorf("field p2p_advertiser_list in P2PAdvertiserList: required") } type Plain P2PAdvertiserList diff --git a/schema/p2p_advertiser_list_resp.go b/schema/p2p_advertiser_list_resp.go index ef4688b..260de83 100644 --- a/schema/p2p_advertiser_list_resp.go +++ b/schema/p2p_advertiser_list_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieve advertisers has/had trade with the current advertiser. -type P2PAdvertiserListResp struct { - // Echo of the request made. - EchoReq P2PAdvertiserListRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertiserListRespMsgType `json:"msg_type"` - - // P2P advertiser list. - P2PAdvertiserList *P2PAdvertiserListRespP2PAdvertiserList `json:"p2p_advertiser_list,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PAdvertiserListRespEchoReq map[string]interface{} type P2PAdvertiserListRespMsgType string -const P2PAdvertiserListRespMsgTypeP2PAdvertiserList P2PAdvertiserListRespMsgType = "p2p_advertiser_list" - var enumValues_P2PAdvertiserListRespMsgType = []interface{}{ "p2p_advertiser_list", } @@ -53,129 +35,7 @@ func (j *P2PAdvertiserListRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// P2P advertiser list. -type P2PAdvertiserListRespP2PAdvertiserList struct { - // List of advertisers. - List []P2PAdvertiserListRespP2PAdvertiserListListElem `json:"list"` -} - -type P2PAdvertiserListRespP2PAdvertiserListListElem struct { - // Average difference of advert rate compared to the market rate over the past 30 - // days. - AdvertRates *float64 `json:"advert_rates"` - - // Boolean value: 1 or 0, indicating whether the advertiser's identify has been - // verified. - BasicVerification P2PAdvertiserListRespP2PAdvertiserListListElemBasicVerification `json:"basic_verification"` - - // The percentage of completed orders out of total orders as a buyer within the - // past 30 days. - BuyCompletionRate *float64 `json:"buy_completion_rate"` - - // Buy order volume in the past 30 days. - BuyOrdersAmount string `json:"buy_orders_amount"` - - // The number of buy order completed within the past 30 days. - BuyOrdersCount int `json:"buy_orders_count"` - - // The average time in seconds taken to make payment as a buyer within the past 30 - // days. - BuyTimeAvg *int `json:"buy_time_avg"` - - // The average time in seconds taken to cancel orders as a buyer within the past - // 30 days. - CancelTimeAvg *int `json:"cancel_time_avg"` - - // The epoch time that the trade partner became an advertiser. - CreatedTime int `json:"created_time"` - - // Default description that can be used every time an advert is created. - DefaultAdvertDescription string `json:"default_advert_description"` - - // The advertiser's first name. - FirstName *string `json:"first_name,omitempty"` - - // Boolean value: 1 or 0, indicating whether the advertiser's address has been - // verified. - FullVerification P2PAdvertiserListRespP2PAdvertiserListListElemFullVerification `json:"full_verification"` - - // The advertiser's identification number. - Id string `json:"id"` - - // The approval status of the advertiser. - IsApproved P2PAdvertiserListRespP2PAdvertiserListListElemIsApproved `json:"is_approved"` - - // Indicates that the advertiser is blocked by the current user. - IsBlocked P2PAdvertiserListRespP2PAdvertiserListListElemIsBlocked `json:"is_blocked"` - - // Indicates if the trade partner is favourited by requester. - IsFavourite *P2PAdvertiserListRespP2PAdvertiserListListElemIsFavourite `json:"is_favourite,omitempty"` - - // Indicates if the advertiser's active adverts are listed. When `0`, adverts - // won't be listed regardless if they are active or not. - IsListed P2PAdvertiserListRespP2PAdvertiserListListElemIsListed `json:"is_listed"` - - // Indicates if the advertiser is currently online. - IsOnline P2PAdvertiserListRespP2PAdvertiserListListElemIsOnline `json:"is_online"` - - // Indicates if the trade partner is recommended by requester. - IsRecommended *P2PAdvertiserListRespP2PAdvertiserListListElemIsRecommended `json:"is_recommended,omitempty"` - - // Inidcates whether the advertiser's schedule allows P2P transactions at the - // current time. - IsScheduleAvailable P2PAdvertiserListRespP2PAdvertiserListListElemIsScheduleAvailable `json:"is_schedule_available"` - - // The advertiser's last name. - LastName *string `json:"last_name,omitempty"` - - // Epoch of the latest time the advertiser was online, up to 6 months. - LastOnlineTime *int `json:"last_online_time"` - - // The advertiser's displayed name. - Name string `json:"name"` - - // Number of different users the advertiser has traded with since registration. - PartnerCount int `json:"partner_count"` - - // Average rating of the advertiser, range is 1-5. - RatingAverage *float64 `json:"rating_average"` - - // Number of ratings given to the advertiser. - RatingCount int `json:"rating_count"` - - // Percentage of users who have recommended the advertiser. - RecommendedAverage *float64 `json:"recommended_average"` - - // Number of times the advertiser has been recommended. - RecommendedCount *int `json:"recommended_count"` - - // The average time in seconds taken to release funds as a seller within the past - // 30 days. - ReleaseTimeAvg *int `json:"release_time_avg"` - - // [Optional] Weekly availability schedule. Ads are visible and orders can be - // created only during available periods. - Schedule []P2PAdvertiserListRespP2PAdvertiserListListElemScheduleElem `json:"schedule,omitempty"` - - // The percentage of completed orders out of total orders as a seller within the - // past 30 days. - SellCompletionRate *float64 `json:"sell_completion_rate"` - - // Sell order volume in the past 30 days. - SellOrdersAmount string `json:"sell_orders_amount"` - - // The number of sell order orders completed within the past 30 days. - SellOrdersCount int `json:"sell_orders_count"` - - // The percentage of completed orders out of all orders within the past 30 days. - TotalCompletionRate *float64 `json:"total_completion_rate"` - - // The total number of orders completed since advertiser registration. - TotalOrdersCount int `json:"total_orders_count"` - - // Total order volume since advertiser registration. - TotalTurnover string `json:"total_turnover"` -} +const P2PAdvertiserListRespMsgTypeP2PAdvertiserList P2PAdvertiserListRespMsgType = "p2p_advertiser_list" type P2PAdvertiserListRespP2PAdvertiserListListElemBasicVerification int @@ -435,10 +295,10 @@ func (j *P2PAdvertiserListRespP2PAdvertiserListListElemScheduleElem) UnmarshalJS if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["end_min"]; raw != nil && !ok { + if v, ok := raw["end_min"]; !ok || v == nil { return fmt.Errorf("field end_min in P2PAdvertiserListRespP2PAdvertiserListListElemScheduleElem: required") } - if _, ok := raw["start_min"]; raw != nil && !ok { + if v, ok := raw["start_min"]; !ok || v == nil { return fmt.Errorf("field start_min in P2PAdvertiserListRespP2PAdvertiserListListElemScheduleElem: required") } type Plain P2PAdvertiserListRespP2PAdvertiserListListElemScheduleElem @@ -450,100 +310,218 @@ func (j *P2PAdvertiserListRespP2PAdvertiserListListElemScheduleElem) UnmarshalJS return nil } +type P2PAdvertiserListRespP2PAdvertiserListListElem struct { + // Average difference of advert rate compared to the market rate over the past 30 + // days. + AdvertRates *float64 `json:"advert_rates"` + + // Boolean value: 1 or 0, indicating whether the advertiser's identify has been + // verified. + BasicVerification P2PAdvertiserListRespP2PAdvertiserListListElemBasicVerification `json:"basic_verification"` + + // The percentage of completed orders out of total orders as a buyer within the + // past 30 days. + BuyCompletionRate *float64 `json:"buy_completion_rate"` + + // Buy order volume in the past 30 days. + BuyOrdersAmount string `json:"buy_orders_amount"` + + // The number of buy order completed within the past 30 days. + BuyOrdersCount int `json:"buy_orders_count"` + + // The average time in seconds taken to make payment as a buyer within the past 30 + // days. + BuyTimeAvg *int `json:"buy_time_avg"` + + // The average time in seconds taken to cancel orders as a buyer within the past + // 30 days. + CancelTimeAvg *int `json:"cancel_time_avg"` + + // The epoch time that the trade partner became an advertiser. + CreatedTime int `json:"created_time"` + + // Default description that can be used every time an advert is created. + DefaultAdvertDescription string `json:"default_advert_description"` + + // The advertiser's first name. + FirstName *string `json:"first_name,omitempty"` + + // Boolean value: 1 or 0, indicating whether the advertiser's address has been + // verified. + FullVerification P2PAdvertiserListRespP2PAdvertiserListListElemFullVerification `json:"full_verification"` + + // The advertiser's identification number. + Id string `json:"id"` + + // The approval status of the advertiser. + IsApproved P2PAdvertiserListRespP2PAdvertiserListListElemIsApproved `json:"is_approved"` + + // Indicates that the advertiser is blocked by the current user. + IsBlocked P2PAdvertiserListRespP2PAdvertiserListListElemIsBlocked `json:"is_blocked"` + + // Indicates if the trade partner is favourited by requester. + IsFavourite *P2PAdvertiserListRespP2PAdvertiserListListElemIsFavourite `json:"is_favourite,omitempty"` + + // Indicates if the advertiser's active adverts are listed. When `0`, adverts + // won't be listed regardless if they are active or not. + IsListed P2PAdvertiserListRespP2PAdvertiserListListElemIsListed `json:"is_listed"` + + // Indicates if the advertiser is currently online. + IsOnline P2PAdvertiserListRespP2PAdvertiserListListElemIsOnline `json:"is_online"` + + // Indicates if the trade partner is recommended by requester. + IsRecommended *P2PAdvertiserListRespP2PAdvertiserListListElemIsRecommended `json:"is_recommended,omitempty"` + + // Inidcates whether the advertiser's schedule allows P2P transactions at the + // current time. + IsScheduleAvailable P2PAdvertiserListRespP2PAdvertiserListListElemIsScheduleAvailable `json:"is_schedule_available"` + + // The advertiser's last name. + LastName *string `json:"last_name,omitempty"` + + // Epoch of the latest time the advertiser was online, up to 6 months. + LastOnlineTime *int `json:"last_online_time"` + + // The advertiser's displayed name. + Name string `json:"name"` + + // Number of different users the advertiser has traded with since registration. + PartnerCount int `json:"partner_count"` + + // Average rating of the advertiser, range is 1-5. + RatingAverage *float64 `json:"rating_average"` + + // Number of ratings given to the advertiser. + RatingCount int `json:"rating_count"` + + // Percentage of users who have recommended the advertiser. + RecommendedAverage *float64 `json:"recommended_average"` + + // Number of times the advertiser has been recommended. + RecommendedCount *int `json:"recommended_count"` + + // The average time in seconds taken to release funds as a seller within the past + // 30 days. + ReleaseTimeAvg *int `json:"release_time_avg"` + + // [Optional] Weekly availability schedule. Ads are visible and orders can be + // created only during available periods. + Schedule []P2PAdvertiserListRespP2PAdvertiserListListElemScheduleElem `json:"schedule,omitempty"` + + // The percentage of completed orders out of total orders as a seller within the + // past 30 days. + SellCompletionRate *float64 `json:"sell_completion_rate"` + + // Sell order volume in the past 30 days. + SellOrdersAmount string `json:"sell_orders_amount"` + + // The number of sell order orders completed within the past 30 days. + SellOrdersCount int `json:"sell_orders_count"` + + // The percentage of completed orders out of all orders within the past 30 days. + TotalCompletionRate *float64 `json:"total_completion_rate"` + + // The total number of orders completed since advertiser registration. + TotalOrdersCount int `json:"total_orders_count"` + + // Total order volume since advertiser registration. + TotalTurnover string `json:"total_turnover"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserListRespP2PAdvertiserListListElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["advert_rates"]; raw != nil && !ok { + if v, ok := raw["advert_rates"]; !ok || v == nil { return fmt.Errorf("field advert_rates in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["basic_verification"]; raw != nil && !ok { + if v, ok := raw["basic_verification"]; !ok || v == nil { return fmt.Errorf("field basic_verification in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["buy_completion_rate"]; raw != nil && !ok { + if v, ok := raw["buy_completion_rate"]; !ok || v == nil { return fmt.Errorf("field buy_completion_rate in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["buy_orders_amount"]; raw != nil && !ok { + if v, ok := raw["buy_orders_amount"]; !ok || v == nil { return fmt.Errorf("field buy_orders_amount in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["buy_orders_count"]; raw != nil && !ok { + if v, ok := raw["buy_orders_count"]; !ok || v == nil { return fmt.Errorf("field buy_orders_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["buy_time_avg"]; raw != nil && !ok { + if v, ok := raw["buy_time_avg"]; !ok || v == nil { return fmt.Errorf("field buy_time_avg in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["cancel_time_avg"]; raw != nil && !ok { + if v, ok := raw["cancel_time_avg"]; !ok || v == nil { return fmt.Errorf("field cancel_time_avg in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["default_advert_description"]; raw != nil && !ok { + if v, ok := raw["default_advert_description"]; !ok || v == nil { return fmt.Errorf("field default_advert_description in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["full_verification"]; raw != nil && !ok { + if v, ok := raw["full_verification"]; !ok || v == nil { return fmt.Errorf("field full_verification in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["is_approved"]; raw != nil && !ok { + if v, ok := raw["is_approved"]; !ok || v == nil { return fmt.Errorf("field is_approved in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["is_blocked"]; raw != nil && !ok { + if v, ok := raw["is_blocked"]; !ok || v == nil { return fmt.Errorf("field is_blocked in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["is_listed"]; raw != nil && !ok { + if v, ok := raw["is_listed"]; !ok || v == nil { return fmt.Errorf("field is_listed in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { + if v, ok := raw["is_schedule_available"]; !ok || v == nil { return fmt.Errorf("field is_schedule_available in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["partner_count"]; raw != nil && !ok { + if v, ok := raw["partner_count"]; !ok || v == nil { return fmt.Errorf("field partner_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["rating_average"]; raw != nil && !ok { + if v, ok := raw["rating_average"]; !ok || v == nil { return fmt.Errorf("field rating_average in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["rating_count"]; raw != nil && !ok { + if v, ok := raw["rating_count"]; !ok || v == nil { return fmt.Errorf("field rating_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["recommended_average"]; raw != nil && !ok { + if v, ok := raw["recommended_average"]; !ok || v == nil { return fmt.Errorf("field recommended_average in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["recommended_count"]; raw != nil && !ok { + if v, ok := raw["recommended_count"]; !ok || v == nil { return fmt.Errorf("field recommended_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["release_time_avg"]; raw != nil && !ok { + if v, ok := raw["release_time_avg"]; !ok || v == nil { return fmt.Errorf("field release_time_avg in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["sell_completion_rate"]; raw != nil && !ok { + if v, ok := raw["sell_completion_rate"]; !ok || v == nil { return fmt.Errorf("field sell_completion_rate in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["sell_orders_amount"]; raw != nil && !ok { + if v, ok := raw["sell_orders_amount"]; !ok || v == nil { return fmt.Errorf("field sell_orders_amount in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["sell_orders_count"]; raw != nil && !ok { + if v, ok := raw["sell_orders_count"]; !ok || v == nil { return fmt.Errorf("field sell_orders_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { + if v, ok := raw["total_completion_rate"]; !ok || v == nil { return fmt.Errorf("field total_completion_rate in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["total_orders_count"]; raw != nil && !ok { + if v, ok := raw["total_orders_count"]; !ok || v == nil { return fmt.Errorf("field total_orders_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if _, ok := raw["total_turnover"]; raw != nil && !ok { + if v, ok := raw["total_turnover"]; !ok || v == nil { return fmt.Errorf("field total_turnover in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } type Plain P2PAdvertiserListRespP2PAdvertiserListListElem @@ -555,13 +533,19 @@ func (j *P2PAdvertiserListRespP2PAdvertiserListListElem) UnmarshalJSON(b []byte) return nil } +// P2P advertiser list. +type P2PAdvertiserListRespP2PAdvertiserList struct { + // List of advertisers. + List []P2PAdvertiserListRespP2PAdvertiserListListElem `json:"list"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserListRespP2PAdvertiserList) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["list"]; raw != nil && !ok { + if v, ok := raw["list"]; !ok || v == nil { return fmt.Errorf("field list in P2PAdvertiserListRespP2PAdvertiserList: required") } type Plain P2PAdvertiserListRespP2PAdvertiserList @@ -573,16 +557,32 @@ func (j *P2PAdvertiserListRespP2PAdvertiserList) UnmarshalJSON(b []byte) error { return nil } +// Retrieve advertisers has/had trade with the current advertiser. +type P2PAdvertiserListResp struct { + // Echo of the request made. + EchoReq P2PAdvertiserListRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertiserListRespMsgType `json:"msg_type"` + + // P2P advertiser list. + P2PAdvertiserList *P2PAdvertiserListRespP2PAdvertiserList `json:"p2p_advertiser_list,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertiserListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertiserListResp: required") } type Plain P2PAdvertiserListResp diff --git a/schema/p2p_advertiser_payment_methods.go b/schema/p2p_advertiser_payment_methods.go index 813d3ff..71944e3 100644 --- a/schema/p2p_advertiser_payment_methods.go +++ b/schema/p2p_advertiser_payment_methods.go @@ -6,32 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Manage or list P2P advertiser payment methods. -type P2PAdvertiserPaymentMethods struct { - // Contains new payment method entries. - Create []P2PAdvertiserPaymentMethodsCreateElem `json:"create,omitempty"` - - // Contains payment methods to delete. - Delete []float64 `json:"delete,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2PAdvertiserPaymentMethods P2PAdvertiserPaymentMethodsP2PAdvertiserPaymentMethods `json:"p2p_advertiser_payment_methods"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PAdvertiserPaymentMethodsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Contains payment methods to update. - Update P2PAdvertiserPaymentMethodsUpdate `json:"update,omitempty"` -} - type P2PAdvertiserPaymentMethodsCreateElem struct { // Payment method identifer. Method string `json:"method"` @@ -43,7 +17,7 @@ func (j *P2PAdvertiserPaymentMethodsCreateElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["method"]; raw != nil && !ok { + if v, ok := raw["method"]; !ok || v == nil { return fmt.Errorf("field method in P2PAdvertiserPaymentMethodsCreateElem: required") } type Plain P2PAdvertiserPaymentMethodsCreateElem @@ -81,6 +55,32 @@ func (j *P2PAdvertiserPaymentMethodsP2PAdvertiserPaymentMethods) UnmarshalJSON(b return nil } +// Manage or list P2P advertiser payment methods. +type P2PAdvertiserPaymentMethods struct { + // Contains new payment method entries. + Create []P2PAdvertiserPaymentMethodsCreateElem `json:"create,omitempty"` + + // Contains payment methods to delete. + Delete []float64 `json:"delete,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2PAdvertiserPaymentMethods P2PAdvertiserPaymentMethodsP2PAdvertiserPaymentMethods `json:"p2p_advertiser_payment_methods"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PAdvertiserPaymentMethodsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Contains payment methods to update. + Update P2PAdvertiserPaymentMethodsUpdate `json:"update,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2PAdvertiserPaymentMethodsPassthrough map[string]interface{} @@ -94,7 +94,7 @@ func (j *P2PAdvertiserPaymentMethods) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_advertiser_payment_methods"]; raw != nil && !ok { + if v, ok := raw["p2p_advertiser_payment_methods"]; !ok || v == nil { return fmt.Errorf("field p2p_advertiser_payment_methods in P2PAdvertiserPaymentMethods: required") } type Plain P2PAdvertiserPaymentMethods diff --git a/schema/p2p_advertiser_payment_methods_resp.go b/schema/p2p_advertiser_payment_methods_resp.go index f12539f..c044d16 100644 --- a/schema/p2p_advertiser_payment_methods_resp.go +++ b/schema/p2p_advertiser_payment_methods_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// List P2P advertiser payment methods. -type P2PAdvertiserPaymentMethodsResp struct { - // Echo of the request made. - EchoReq P2PAdvertiserPaymentMethodsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertiserPaymentMethodsRespMsgType `json:"msg_type"` - - // List of current methods. - P2PAdvertiserPaymentMethods P2PAdvertiserPaymentMethodsRespP2PAdvertiserPaymentMethods `json:"p2p_advertiser_payment_methods,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PAdvertiserPaymentMethodsRespEchoReq map[string]interface{} type P2PAdvertiserPaymentMethodsRespMsgType string -const P2PAdvertiserPaymentMethodsRespMsgTypeP2PAdvertiserPaymentMethods P2PAdvertiserPaymentMethodsRespMsgType = "p2p_advertiser_payment_methods" - var enumValues_P2PAdvertiserPaymentMethodsRespMsgType = []interface{}{ "p2p_advertiser_payment_methods", } @@ -53,6 +35,24 @@ func (j *P2PAdvertiserPaymentMethodsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// List P2P advertiser payment methods. +type P2PAdvertiserPaymentMethodsResp struct { + // Echo of the request made. + EchoReq P2PAdvertiserPaymentMethodsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertiserPaymentMethodsRespMsgType `json:"msg_type"` + + // List of current methods. + P2PAdvertiserPaymentMethods P2PAdvertiserPaymentMethodsRespP2PAdvertiserPaymentMethods `json:"p2p_advertiser_payment_methods,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const P2PAdvertiserPaymentMethodsRespMsgTypeP2PAdvertiserPaymentMethods P2PAdvertiserPaymentMethodsRespMsgType = "p2p_advertiser_payment_methods" + // List of current methods. type P2PAdvertiserPaymentMethodsRespP2PAdvertiserPaymentMethods map[string]interface{} @@ -62,10 +62,10 @@ func (j *P2PAdvertiserPaymentMethodsResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertiserPaymentMethodsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertiserPaymentMethodsResp: required") } type Plain P2PAdvertiserPaymentMethodsResp diff --git a/schema/p2p_advertiser_relations.go b/schema/p2p_advertiser_relations.go index 7a10df8..a6b7c95 100644 --- a/schema/p2p_advertiser_relations.go +++ b/schema/p2p_advertiser_relations.go @@ -6,6 +6,32 @@ import "encoding/json" import "fmt" import "reflect" +type P2PAdvertiserRelationsP2PAdvertiserRelations int + +var enumValues_P2PAdvertiserRelationsP2PAdvertiserRelations = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertiserRelationsP2PAdvertiserRelations) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertiserRelationsP2PAdvertiserRelations { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserRelationsP2PAdvertiserRelations, v) + } + *j = P2PAdvertiserRelationsP2PAdvertiserRelations(v) + return nil +} + // Updates and returns favourite and blocked advertisers of the current user. type P2PAdvertiserRelations struct { // IDs of advertisers to block. @@ -35,32 +61,6 @@ type P2PAdvertiserRelations struct { ReqId *int `json:"req_id,omitempty"` } -type P2PAdvertiserRelationsP2PAdvertiserRelations int - -var enumValues_P2PAdvertiserRelationsP2PAdvertiserRelations = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserRelationsP2PAdvertiserRelations) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertiserRelationsP2PAdvertiserRelations { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserRelationsP2PAdvertiserRelations, v) - } - *j = P2PAdvertiserRelationsP2PAdvertiserRelations(v) - return nil -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2PAdvertiserRelationsPassthrough map[string]interface{} @@ -71,7 +71,7 @@ func (j *P2PAdvertiserRelations) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_advertiser_relations"]; raw != nil && !ok { + if v, ok := raw["p2p_advertiser_relations"]; !ok || v == nil { return fmt.Errorf("field p2p_advertiser_relations in P2PAdvertiserRelations: required") } type Plain P2PAdvertiserRelations diff --git a/schema/p2p_advertiser_relations_resp.go b/schema/p2p_advertiser_relations_resp.go index ebf3ecb..958c663 100644 --- a/schema/p2p_advertiser_relations_resp.go +++ b/schema/p2p_advertiser_relations_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Returns information about favourite and blocked advertisers. -type P2PAdvertiserRelationsResp struct { - // Echo of the request made. - EchoReq P2PAdvertiserRelationsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertiserRelationsRespMsgType `json:"msg_type"` - - // P2P advertiser relations information. - P2PAdvertiserRelations *P2PAdvertiserRelationsRespP2PAdvertiserRelations `json:"p2p_advertiser_relations,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PAdvertiserRelationsRespEchoReq map[string]interface{} type P2PAdvertiserRelationsRespMsgType string -const P2PAdvertiserRelationsRespMsgTypeP2PAdvertiserRelations P2PAdvertiserRelationsRespMsgType = "p2p_advertiser_relations" - var enumValues_P2PAdvertiserRelationsRespMsgType = []interface{}{ "p2p_advertiser_relations", } @@ -53,6 +35,8 @@ func (j *P2PAdvertiserRelationsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const P2PAdvertiserRelationsRespMsgTypeP2PAdvertiserRelations P2PAdvertiserRelationsRespMsgType = "p2p_advertiser_relations" + // P2P advertiser relations information. type P2PAdvertiserRelationsRespP2PAdvertiserRelations struct { // List of advertisers blocked by the current user. @@ -92,10 +76,10 @@ func (j *P2PAdvertiserRelationsRespP2PAdvertiserRelations) UnmarshalJSON(b []byt if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["blocked_advertisers"]; raw != nil && !ok { + if v, ok := raw["blocked_advertisers"]; !ok || v == nil { return fmt.Errorf("field blocked_advertisers in P2PAdvertiserRelationsRespP2PAdvertiserRelations: required") } - if _, ok := raw["favourite_advertisers"]; raw != nil && !ok { + if v, ok := raw["favourite_advertisers"]; !ok || v == nil { return fmt.Errorf("field favourite_advertisers in P2PAdvertiserRelationsRespP2PAdvertiserRelations: required") } type Plain P2PAdvertiserRelationsRespP2PAdvertiserRelations @@ -107,16 +91,32 @@ func (j *P2PAdvertiserRelationsRespP2PAdvertiserRelations) UnmarshalJSON(b []byt return nil } +// Returns information about favourite and blocked advertisers. +type P2PAdvertiserRelationsResp struct { + // Echo of the request made. + EchoReq P2PAdvertiserRelationsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertiserRelationsRespMsgType `json:"msg_type"` + + // P2P advertiser relations information. + P2PAdvertiserRelations *P2PAdvertiserRelationsRespP2PAdvertiserRelations `json:"p2p_advertiser_relations,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserRelationsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertiserRelationsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertiserRelationsResp: required") } type Plain P2PAdvertiserRelationsResp diff --git a/schema/p2p_advertiser_update.go b/schema/p2p_advertiser_update.go index 72967df..553c024 100644 --- a/schema/p2p_advertiser_update.go +++ b/schema/p2p_advertiser_update.go @@ -6,52 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Update the information of the P2P advertiser for the current account. Can only -// be used by an approved P2P advertiser. -type P2PAdvertiserUpdate struct { - // [Optional] Advertiser's contact information, to be used as a default for new - // sell adverts. - ContactInfo *string `json:"contact_info,omitempty"` - - // [Optional] Default description that can be used every time an advert is - // created. - DefaultAdvertDescription *string `json:"default_advert_description,omitempty"` - - // [Optional] Used to set if the advertiser's adverts could be listed. When `0`, - // adverts won't be listed regardless of they are active or not. This doesn't - // change the `is_active` of each individual advert. - IsListed *P2PAdvertiserUpdateIsListed `json:"is_listed,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2PAdvertiserUpdate P2PAdvertiserUpdateP2PAdvertiserUpdate `json:"p2p_advertiser_update"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PAdvertiserUpdatePassthrough `json:"passthrough,omitempty"` - - // [Optional] Advertiser's payment information, to be used as a default for new - // sell adverts. - PaymentInfo *string `json:"payment_info,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] Weekly availability schedule. Ads are visible and orders can be - // created only during available periods. - Schedule []P2PAdvertiserUpdateScheduleElem `json:"schedule,omitempty"` - - // [Optional] When `1`, the advertiser's real name will be displayed on to other - // users on adverts and orders. - ShowName *P2PAdvertiserUpdateShowName `json:"show_name,omitempty"` - - // [Optional] Used to upgrade daily limits of eligible advertiser. - UpgradeLimits *P2PAdvertiserUpdateUpgradeLimits `json:"upgrade_limits,omitempty"` -} - type P2PAdvertiserUpdateIsListed int var enumValues_P2PAdvertiserUpdateIsListed = []interface{}{ @@ -124,10 +78,10 @@ func (j *P2PAdvertiserUpdateScheduleElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["end_min"]; raw != nil && !ok { + if v, ok := raw["end_min"]; !ok || v == nil { return fmt.Errorf("field end_min in P2PAdvertiserUpdateScheduleElem: required") } - if _, ok := raw["start_min"]; raw != nil && !ok { + if v, ok := raw["start_min"]; !ok || v == nil { return fmt.Errorf("field start_min in P2PAdvertiserUpdateScheduleElem: required") } type Plain P2PAdvertiserUpdateScheduleElem @@ -192,13 +146,59 @@ func (j *P2PAdvertiserUpdateUpgradeLimits) UnmarshalJSON(b []byte) error { return nil } +// Update the information of the P2P advertiser for the current account. Can only +// be used by an approved P2P advertiser. +type P2PAdvertiserUpdate struct { + // [Optional] Advertiser's contact information, to be used as a default for new + // sell adverts. + ContactInfo *string `json:"contact_info,omitempty"` + + // [Optional] Default description that can be used every time an advert is + // created. + DefaultAdvertDescription *string `json:"default_advert_description,omitempty"` + + // [Optional] Used to set if the advertiser's adverts could be listed. When `0`, + // adverts won't be listed regardless of they are active or not. This doesn't + // change the `is_active` of each individual advert. + IsListed *P2PAdvertiserUpdateIsListed `json:"is_listed,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2PAdvertiserUpdate P2PAdvertiserUpdateP2PAdvertiserUpdate `json:"p2p_advertiser_update"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PAdvertiserUpdatePassthrough `json:"passthrough,omitempty"` + + // [Optional] Advertiser's payment information, to be used as a default for new + // sell adverts. + PaymentInfo *string `json:"payment_info,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] Weekly availability schedule. Ads are visible and orders can be + // created only during available periods. + Schedule []P2PAdvertiserUpdateScheduleElem `json:"schedule,omitempty"` + + // [Optional] When `1`, the advertiser's real name will be displayed on to other + // users on adverts and orders. + ShowName *P2PAdvertiserUpdateShowName `json:"show_name,omitempty"` + + // [Optional] Used to upgrade daily limits of eligible advertiser. + UpgradeLimits *P2PAdvertiserUpdateUpgradeLimits `json:"upgrade_limits,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserUpdate) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_advertiser_update"]; raw != nil && !ok { + if v, ok := raw["p2p_advertiser_update"]; !ok || v == nil { return fmt.Errorf("field p2p_advertiser_update in P2PAdvertiserUpdate: required") } type Plain P2PAdvertiserUpdate diff --git a/schema/p2p_advertiser_update_resp.go b/schema/p2p_advertiser_update_resp.go index 58cbb8a..1536834 100644 --- a/schema/p2p_advertiser_update_resp.go +++ b/schema/p2p_advertiser_update_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Returns latest information of the advertiser. -type P2PAdvertiserUpdateResp struct { - // Echo of the request made. - EchoReq P2PAdvertiserUpdateRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertiserUpdateRespMsgType `json:"msg_type"` - - // P2P advertiser information. - P2PAdvertiserUpdate *P2PAdvertiserUpdateRespP2PAdvertiserUpdate `json:"p2p_advertiser_update,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PAdvertiserUpdateRespEchoReq map[string]interface{} type P2PAdvertiserUpdateRespMsgType string -const P2PAdvertiserUpdateRespMsgTypeP2PAdvertiserUpdate P2PAdvertiserUpdateRespMsgType = "p2p_advertiser_update" - var enumValues_P2PAdvertiserUpdateRespMsgType = []interface{}{ "p2p_advertiser_update", } @@ -53,182 +35,7 @@ func (j *P2PAdvertiserUpdateRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// P2P advertiser information. -type P2PAdvertiserUpdateRespP2PAdvertiserUpdate struct { - // Number of active fixed rate adverts belonging to the advertiser. - ActiveFixedAds *int `json:"active_fixed_ads,omitempty"` - - // Number of active floating rate adverts belonging to the advertiser. - ActiveFloatAds *int `json:"active_float_ads,omitempty"` - - // Average difference of advert rate compared to the market rate over the past 30 - // days. - AdvertRates *float64 `json:"advert_rates"` - - // Amount of funds available to sell on P2P. May be less than account balance - // according to deposit methods used. - BalanceAvailable float64 `json:"balance_available"` - - // Boolean value: 1 or 0, indicating whether the advertiser's identify has been - // verified. - BasicVerification P2PAdvertiserUpdateRespP2PAdvertiserUpdateBasicVerification `json:"basic_verification"` - - // Block trading limits, if block trading is allowed. - BlockTrade *P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade `json:"block_trade,omitempty"` - - // The number of P2P users who have blocked this advertiser. - BlockedByCount int `json:"blocked_by_count"` - - // If a temporary bar was placed, this is the epoch time at which it will end. - BlockedUntil *int `json:"blocked_until,omitempty"` - - // The percentage of completed orders out of total orders as a buyer within the - // past 30 days. - BuyCompletionRate *float64 `json:"buy_completion_rate"` - - // Buy order volume in the past 30 days. - BuyOrdersAmount string `json:"buy_orders_amount"` - - // The number of buy order completed within the past 30 days. - BuyOrdersCount int `json:"buy_orders_count"` - - // The average time in seconds taken to make payment as a buyer within the past 30 - // days. - BuyTimeAvg *int `json:"buy_time_avg"` - - // The average time in seconds taken to cancel orders as a buyer within the past - // 30 days. - CancelTimeAvg *int `json:"cancel_time_avg"` - - // The number of times the user may cancel orders before being temporarily - // blocked. - CancelsRemaining int `json:"cancels_remaining"` - - // The token to be used for authenticating the client for chat. - ChatToken *string `json:"chat_token"` - - // The unique identifier for the chat user. - ChatUserId *string `json:"chat_user_id"` - - // Advertiser's contact information. - ContactInfo string `json:"contact_info"` - - // The epoch time that the client became an advertiser. - CreatedTime int `json:"created_time"` - - // Total value of P2P buy transactions in the past 24 hours. - DailyBuy *string `json:"daily_buy,omitempty"` - - // Maximum allowed value of P2P buy transactions in a 24 hour period. - DailyBuyLimit *string `json:"daily_buy_limit,omitempty"` - - // Total value of P2P sell transactions in the past 24 hours. - DailySell *string `json:"daily_sell,omitempty"` - - // Maximum allowed value of P2P sell transactions in a 24 hour period. - DailySellLimit *string `json:"daily_sell_limit,omitempty"` - - // Default description that can be used every time an advert is created. - DefaultAdvertDescription string `json:"default_advert_description"` - - // The advertiser's first name. - FirstName *string `json:"first_name,omitempty"` - - // Boolean value: 1 or 0, indicating whether the advertiser's address has been - // verified. - FullVerification P2PAdvertiserUpdateRespP2PAdvertiserUpdateFullVerification `json:"full_verification"` - - // The advertiser's identification number. - Id string `json:"id"` - - // The approval status of the advertiser. - IsApproved P2PAdvertiserUpdateRespP2PAdvertiserUpdateIsApproved `json:"is_approved"` - - // Indicates if the advertiser's active adverts are listed. When `0`, adverts - // won't be listed regardless if they are active or not. - IsListed P2PAdvertiserUpdateRespP2PAdvertiserUpdateIsListed `json:"is_listed"` - - // Indicates if the advertiser is currently online. - IsOnline P2PAdvertiserUpdateRespP2PAdvertiserUpdateIsOnline `json:"is_online"` - - // Inidcates whether the advertiser's schedule allows P2P transactions at the - // current time. - IsScheduleAvailable P2PAdvertiserUpdateRespP2PAdvertiserUpdateIsScheduleAvailable `json:"is_schedule_available"` - - // The advertiser's last name. - LastName *string `json:"last_name,omitempty"` - - // Epoch of the latest time the advertiser was online, up to 6 months. - LastOnlineTime *int `json:"last_online_time"` - - // Maximum order amount for adverts. - MaxOrderAmount *string `json:"max_order_amount,omitempty"` - - // Sell ads will be hidden when your available balance or remaining daily sell - // limit falls beneath this value. - MinBalance *string `json:"min_balance,omitempty"` - - // Minimum order amount for adverts. - MinOrderAmount *string `json:"min_order_amount,omitempty"` - - // The advertiser's displayed name. - Name string `json:"name"` - - // Number of different users the advertiser has traded with since registration. - PartnerCount int `json:"partner_count"` - - // Advertiser's payment information. - PaymentInfo string `json:"payment_info"` - - // Average rating of the advertiser, range is 1-5. - RatingAverage *float64 `json:"rating_average"` - - // Number of ratings given to the advertiser. - RatingCount int `json:"rating_count"` - - // Percentage of users who have recommended the advertiser. - RecommendedAverage *float64 `json:"recommended_average"` - - // Number of times the advertiser has been recommended. - RecommendedCount *int `json:"recommended_count"` - - // The average time in seconds taken to release funds as a seller within the past - // 30 days. - ReleaseTimeAvg *int `json:"release_time_avg"` - - // [Optional] Weekly availability schedule. Ads are visible and orders can be - // created only during available periods. - Schedule []P2PAdvertiserUpdateRespP2PAdvertiserUpdateScheduleElem `json:"schedule,omitempty"` - - // The percentage of completed orders out of total orders as a seller within the - // past 30 days. - SellCompletionRate *float64 `json:"sell_completion_rate"` - - // Sell order volume in the past 30 days. - SellOrdersAmount string `json:"sell_orders_amount"` - - // The number of sell order orders completed within the past 30 days. - SellOrdersCount int `json:"sell_orders_count"` - - // When `1`, the advertiser's real name will be displayed on to other users on - // adverts and orders. - ShowName P2PAdvertiserUpdateRespP2PAdvertiserUpdateShowName `json:"show_name"` - - // The percentage of completed orders out of all orders within the past 30 days. - TotalCompletionRate *float64 `json:"total_completion_rate"` - - // The total number of orders completed since advertiser registration. - TotalOrdersCount int `json:"total_orders_count"` - - // Total order volume since advertiser registration. - TotalTurnover string `json:"total_turnover"` - - // New daily limits available. - UpgradableDailyLimits *P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits `json:"upgradable_daily_limits,omitempty"` - - // Remaining withdrawal_limit of a non-fully authenticated advertiser. - WithdrawalLimit *string `json:"withdrawal_limit,omitempty"` -} +const P2PAdvertiserUpdateRespMsgTypeP2PAdvertiserUpdate P2PAdvertiserUpdateRespMsgType = "p2p_advertiser_update" type P2PAdvertiserUpdateRespP2PAdvertiserUpdateBasicVerification int @@ -272,10 +79,10 @@ func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade) UnmarshalJSON(b [ if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["max_order_amount"]; raw != nil && !ok { + if v, ok := raw["max_order_amount"]; !ok || v == nil { return fmt.Errorf("field max_order_amount in P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade: required") } - if _, ok := raw["min_order_amount"]; raw != nil && !ok { + if v, ok := raw["min_order_amount"]; !ok || v == nil { return fmt.Errorf("field min_order_amount in P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade: required") } type Plain P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade @@ -437,10 +244,10 @@ func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdateScheduleElem) UnmarshalJSON(b if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["end_min"]; raw != nil && !ok { + if v, ok := raw["end_min"]; !ok || v == nil { return fmt.Errorf("field end_min in P2PAdvertiserUpdateRespP2PAdvertiserUpdateScheduleElem: required") } - if _, ok := raw["start_min"]; raw != nil && !ok { + if v, ok := raw["start_min"]; !ok || v == nil { return fmt.Errorf("field start_min in P2PAdvertiserUpdateRespP2PAdvertiserUpdateScheduleElem: required") } type Plain P2PAdvertiserUpdateRespP2PAdvertiserUpdateScheduleElem @@ -479,18 +286,6 @@ func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdateShowName) UnmarshalJSON(b []b return nil } -// New daily limits available. -type P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits struct { - // When `1`, upgrade will provide block trading. - BlockTrade *P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimitsBlockTrade `json:"block_trade,omitempty"` - - // Upgradable daily buy limit. - MaxDailyBuy string `json:"max_daily_buy"` - - // Upgradable daily sell limit. - MaxDailySell string `json:"max_daily_sell"` -} - type P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimitsBlockTrade int var enumValues_P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimitsBlockTrade = []interface{}{ @@ -518,16 +313,28 @@ func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimitsBlockTra return nil } +// New daily limits available. +type P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits struct { + // When `1`, upgrade will provide block trading. + BlockTrade *P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimitsBlockTrade `json:"block_trade,omitempty"` + + // Upgradable daily buy limit. + MaxDailyBuy string `json:"max_daily_buy"` + + // Upgradable daily sell limit. + MaxDailySell string `json:"max_daily_sell"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["max_daily_buy"]; raw != nil && !ok { + if v, ok := raw["max_daily_buy"]; !ok || v == nil { return fmt.Errorf("field max_daily_buy in P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits: required") } - if _, ok := raw["max_daily_sell"]; raw != nil && !ok { + if v, ok := raw["max_daily_sell"]; !ok || v == nil { return fmt.Errorf("field max_daily_sell in P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits: required") } type Plain P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits @@ -539,121 +346,298 @@ func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits) Unmars return nil } +// P2P advertiser information. +type P2PAdvertiserUpdateRespP2PAdvertiserUpdate struct { + // Number of active fixed rate adverts belonging to the advertiser. + ActiveFixedAds *int `json:"active_fixed_ads,omitempty"` + + // Number of active floating rate adverts belonging to the advertiser. + ActiveFloatAds *int `json:"active_float_ads,omitempty"` + + // Average difference of advert rate compared to the market rate over the past 30 + // days. + AdvertRates *float64 `json:"advert_rates"` + + // Amount of funds available to sell on P2P. May be less than account balance + // according to deposit methods used. + BalanceAvailable float64 `json:"balance_available"` + + // Boolean value: 1 or 0, indicating whether the advertiser's identify has been + // verified. + BasicVerification P2PAdvertiserUpdateRespP2PAdvertiserUpdateBasicVerification `json:"basic_verification"` + + // Block trading limits, if block trading is allowed. + BlockTrade *P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade `json:"block_trade,omitempty"` + + // The number of P2P users who have blocked this advertiser. + BlockedByCount int `json:"blocked_by_count"` + + // If a temporary bar was placed, this is the epoch time at which it will end. + BlockedUntil *int `json:"blocked_until,omitempty"` + + // The percentage of completed orders out of total orders as a buyer within the + // past 30 days. + BuyCompletionRate *float64 `json:"buy_completion_rate"` + + // Buy order volume in the past 30 days. + BuyOrdersAmount string `json:"buy_orders_amount"` + + // The number of buy order completed within the past 30 days. + BuyOrdersCount int `json:"buy_orders_count"` + + // The average time in seconds taken to make payment as a buyer within the past 30 + // days. + BuyTimeAvg *int `json:"buy_time_avg"` + + // The average time in seconds taken to cancel orders as a buyer within the past + // 30 days. + CancelTimeAvg *int `json:"cancel_time_avg"` + + // The number of times the user may cancel orders before being temporarily + // blocked. + CancelsRemaining int `json:"cancels_remaining"` + + // The token to be used for authenticating the client for chat. + ChatToken *string `json:"chat_token"` + + // The unique identifier for the chat user. + ChatUserId *string `json:"chat_user_id"` + + // Advertiser's contact information. + ContactInfo string `json:"contact_info"` + + // The epoch time that the client became an advertiser. + CreatedTime int `json:"created_time"` + + // Total value of P2P buy transactions in the past 24 hours. + DailyBuy *string `json:"daily_buy,omitempty"` + + // Maximum allowed value of P2P buy transactions in a 24 hour period. + DailyBuyLimit *string `json:"daily_buy_limit,omitempty"` + + // Total value of P2P sell transactions in the past 24 hours. + DailySell *string `json:"daily_sell,omitempty"` + + // Maximum allowed value of P2P sell transactions in a 24 hour period. + DailySellLimit *string `json:"daily_sell_limit,omitempty"` + + // Default description that can be used every time an advert is created. + DefaultAdvertDescription string `json:"default_advert_description"` + + // The advertiser's first name. + FirstName *string `json:"first_name,omitempty"` + + // Boolean value: 1 or 0, indicating whether the advertiser's address has been + // verified. + FullVerification P2PAdvertiserUpdateRespP2PAdvertiserUpdateFullVerification `json:"full_verification"` + + // The advertiser's identification number. + Id string `json:"id"` + + // The approval status of the advertiser. + IsApproved P2PAdvertiserUpdateRespP2PAdvertiserUpdateIsApproved `json:"is_approved"` + + // Indicates if the advertiser's active adverts are listed. When `0`, adverts + // won't be listed regardless if they are active or not. + IsListed P2PAdvertiserUpdateRespP2PAdvertiserUpdateIsListed `json:"is_listed"` + + // Indicates if the advertiser is currently online. + IsOnline P2PAdvertiserUpdateRespP2PAdvertiserUpdateIsOnline `json:"is_online"` + + // Inidcates whether the advertiser's schedule allows P2P transactions at the + // current time. + IsScheduleAvailable P2PAdvertiserUpdateRespP2PAdvertiserUpdateIsScheduleAvailable `json:"is_schedule_available"` + + // The advertiser's last name. + LastName *string `json:"last_name,omitempty"` + + // Epoch of the latest time the advertiser was online, up to 6 months. + LastOnlineTime *int `json:"last_online_time"` + + // Maximum order amount for adverts. + MaxOrderAmount *string `json:"max_order_amount,omitempty"` + + // Sell ads will be hidden when your available balance or remaining daily sell + // limit falls beneath this value. + MinBalance *string `json:"min_balance,omitempty"` + + // Minimum order amount for adverts. + MinOrderAmount *string `json:"min_order_amount,omitempty"` + + // The advertiser's displayed name. + Name string `json:"name"` + + // Number of different users the advertiser has traded with since registration. + PartnerCount int `json:"partner_count"` + + // Advertiser's payment information. + PaymentInfo string `json:"payment_info"` + + // Average rating of the advertiser, range is 1-5. + RatingAverage *float64 `json:"rating_average"` + + // Number of ratings given to the advertiser. + RatingCount int `json:"rating_count"` + + // Percentage of users who have recommended the advertiser. + RecommendedAverage *float64 `json:"recommended_average"` + + // Number of times the advertiser has been recommended. + RecommendedCount *int `json:"recommended_count"` + + // The average time in seconds taken to release funds as a seller within the past + // 30 days. + ReleaseTimeAvg *int `json:"release_time_avg"` + + // [Optional] Weekly availability schedule. Ads are visible and orders can be + // created only during available periods. + Schedule []P2PAdvertiserUpdateRespP2PAdvertiserUpdateScheduleElem `json:"schedule,omitempty"` + + // The percentage of completed orders out of total orders as a seller within the + // past 30 days. + SellCompletionRate *float64 `json:"sell_completion_rate"` + + // Sell order volume in the past 30 days. + SellOrdersAmount string `json:"sell_orders_amount"` + + // The number of sell order orders completed within the past 30 days. + SellOrdersCount int `json:"sell_orders_count"` + + // When `1`, the advertiser's real name will be displayed on to other users on + // adverts and orders. + ShowName P2PAdvertiserUpdateRespP2PAdvertiserUpdateShowName `json:"show_name"` + + // The percentage of completed orders out of all orders within the past 30 days. + TotalCompletionRate *float64 `json:"total_completion_rate"` + + // The total number of orders completed since advertiser registration. + TotalOrdersCount int `json:"total_orders_count"` + + // Total order volume since advertiser registration. + TotalTurnover string `json:"total_turnover"` + + // New daily limits available. + UpgradableDailyLimits *P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits `json:"upgradable_daily_limits,omitempty"` + + // Remaining withdrawal_limit of a non-fully authenticated advertiser. + WithdrawalLimit *string `json:"withdrawal_limit,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdate) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["advert_rates"]; raw != nil && !ok { + if v, ok := raw["advert_rates"]; !ok || v == nil { return fmt.Errorf("field advert_rates in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["balance_available"]; raw != nil && !ok { + if v, ok := raw["balance_available"]; !ok || v == nil { return fmt.Errorf("field balance_available in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["basic_verification"]; raw != nil && !ok { + if v, ok := raw["basic_verification"]; !ok || v == nil { return fmt.Errorf("field basic_verification in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["blocked_by_count"]; raw != nil && !ok { + if v, ok := raw["blocked_by_count"]; !ok || v == nil { return fmt.Errorf("field blocked_by_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["buy_completion_rate"]; raw != nil && !ok { + if v, ok := raw["buy_completion_rate"]; !ok || v == nil { return fmt.Errorf("field buy_completion_rate in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["buy_orders_amount"]; raw != nil && !ok { + if v, ok := raw["buy_orders_amount"]; !ok || v == nil { return fmt.Errorf("field buy_orders_amount in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["buy_orders_count"]; raw != nil && !ok { + if v, ok := raw["buy_orders_count"]; !ok || v == nil { return fmt.Errorf("field buy_orders_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["buy_time_avg"]; raw != nil && !ok { + if v, ok := raw["buy_time_avg"]; !ok || v == nil { return fmt.Errorf("field buy_time_avg in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["cancel_time_avg"]; raw != nil && !ok { + if v, ok := raw["cancel_time_avg"]; !ok || v == nil { return fmt.Errorf("field cancel_time_avg in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["cancels_remaining"]; raw != nil && !ok { + if v, ok := raw["cancels_remaining"]; !ok || v == nil { return fmt.Errorf("field cancels_remaining in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["chat_token"]; raw != nil && !ok { + if v, ok := raw["chat_token"]; !ok || v == nil { return fmt.Errorf("field chat_token in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["chat_user_id"]; raw != nil && !ok { + if v, ok := raw["chat_user_id"]; !ok || v == nil { return fmt.Errorf("field chat_user_id in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["contact_info"]; raw != nil && !ok { + if v, ok := raw["contact_info"]; !ok || v == nil { return fmt.Errorf("field contact_info in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["default_advert_description"]; raw != nil && !ok { + if v, ok := raw["default_advert_description"]; !ok || v == nil { return fmt.Errorf("field default_advert_description in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["full_verification"]; raw != nil && !ok { + if v, ok := raw["full_verification"]; !ok || v == nil { return fmt.Errorf("field full_verification in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["is_approved"]; raw != nil && !ok { + if v, ok := raw["is_approved"]; !ok || v == nil { return fmt.Errorf("field is_approved in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["is_listed"]; raw != nil && !ok { + if v, ok := raw["is_listed"]; !ok || v == nil { return fmt.Errorf("field is_listed in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["is_schedule_available"]; raw != nil && !ok { + if v, ok := raw["is_schedule_available"]; !ok || v == nil { return fmt.Errorf("field is_schedule_available in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["partner_count"]; raw != nil && !ok { + if v, ok := raw["partner_count"]; !ok || v == nil { return fmt.Errorf("field partner_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["payment_info"]; raw != nil && !ok { + if v, ok := raw["payment_info"]; !ok || v == nil { return fmt.Errorf("field payment_info in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["rating_average"]; raw != nil && !ok { + if v, ok := raw["rating_average"]; !ok || v == nil { return fmt.Errorf("field rating_average in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["rating_count"]; raw != nil && !ok { + if v, ok := raw["rating_count"]; !ok || v == nil { return fmt.Errorf("field rating_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["recommended_average"]; raw != nil && !ok { + if v, ok := raw["recommended_average"]; !ok || v == nil { return fmt.Errorf("field recommended_average in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["recommended_count"]; raw != nil && !ok { + if v, ok := raw["recommended_count"]; !ok || v == nil { return fmt.Errorf("field recommended_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["release_time_avg"]; raw != nil && !ok { + if v, ok := raw["release_time_avg"]; !ok || v == nil { return fmt.Errorf("field release_time_avg in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["sell_completion_rate"]; raw != nil && !ok { + if v, ok := raw["sell_completion_rate"]; !ok || v == nil { return fmt.Errorf("field sell_completion_rate in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["sell_orders_amount"]; raw != nil && !ok { + if v, ok := raw["sell_orders_amount"]; !ok || v == nil { return fmt.Errorf("field sell_orders_amount in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["sell_orders_count"]; raw != nil && !ok { + if v, ok := raw["sell_orders_count"]; !ok || v == nil { return fmt.Errorf("field sell_orders_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["show_name"]; raw != nil && !ok { + if v, ok := raw["show_name"]; !ok || v == nil { return fmt.Errorf("field show_name in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["total_completion_rate"]; raw != nil && !ok { + if v, ok := raw["total_completion_rate"]; !ok || v == nil { return fmt.Errorf("field total_completion_rate in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["total_orders_count"]; raw != nil && !ok { + if v, ok := raw["total_orders_count"]; !ok || v == nil { return fmt.Errorf("field total_orders_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if _, ok := raw["total_turnover"]; raw != nil && !ok { + if v, ok := raw["total_turnover"]; !ok || v == nil { return fmt.Errorf("field total_turnover in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } type Plain P2PAdvertiserUpdateRespP2PAdvertiserUpdate @@ -665,16 +649,32 @@ func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdate) UnmarshalJSON(b []byte) err return nil } +// Returns latest information of the advertiser. +type P2PAdvertiserUpdateResp struct { + // Echo of the request made. + EchoReq P2PAdvertiserUpdateRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertiserUpdateRespMsgType `json:"msg_type"` + + // P2P advertiser information. + P2PAdvertiserUpdate *P2PAdvertiserUpdateRespP2PAdvertiserUpdate `json:"p2p_advertiser_update,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserUpdateResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PAdvertiserUpdateResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PAdvertiserUpdateResp: required") } type Plain P2PAdvertiserUpdateResp diff --git a/schema/p2p_chat_create.go b/schema/p2p_chat_create.go index 128e263..d2fa775 100644 --- a/schema/p2p_chat_create.go +++ b/schema/p2p_chat_create.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Creates a P2P chat for the specified order. -type P2PChatCreate struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // The unique identifier for the order to create the chat for. - OrderId string `json:"order_id"` - - // Must be 1 - P2PChatCreate P2PChatCreateP2PChatCreate `json:"p2p_chat_create"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PChatCreatePassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type P2PChatCreateP2PChatCreate int var enumValues_P2PChatCreateP2PChatCreate = []interface{}{ @@ -52,6 +32,26 @@ func (j *P2PChatCreateP2PChatCreate) UnmarshalJSON(b []byte) error { return nil } +// Creates a P2P chat for the specified order. +type P2PChatCreate struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // The unique identifier for the order to create the chat for. + OrderId string `json:"order_id"` + + // Must be 1 + P2PChatCreate P2PChatCreateP2PChatCreate `json:"p2p_chat_create"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PChatCreatePassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2PChatCreatePassthrough map[string]interface{} @@ -62,10 +62,10 @@ func (j *P2PChatCreate) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["order_id"]; raw != nil && !ok { + if v, ok := raw["order_id"]; !ok || v == nil { return fmt.Errorf("field order_id in P2PChatCreate: required") } - if _, ok := raw["p2p_chat_create"]; raw != nil && !ok { + if v, ok := raw["p2p_chat_create"]; !ok || v == nil { return fmt.Errorf("field p2p_chat_create in P2PChatCreate: required") } type Plain P2PChatCreate diff --git a/schema/p2p_chat_create_resp.go b/schema/p2p_chat_create_resp.go index 04c48f4..969d58c 100644 --- a/schema/p2p_chat_create_resp.go +++ b/schema/p2p_chat_create_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Information of the created P2P chat. -type P2PChatCreateResp struct { - // Echo of the request made. - EchoReq P2PChatCreateRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PChatCreateRespMsgType `json:"msg_type"` - - // Information of the P2P chat. - P2PChatCreate *P2PChatCreateRespP2PChatCreate `json:"p2p_chat_create,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PChatCreateRespEchoReq map[string]interface{} type P2PChatCreateRespMsgType string -const P2PChatCreateRespMsgTypeP2PChatCreate P2PChatCreateRespMsgType = "p2p_chat_create" - var enumValues_P2PChatCreateRespMsgType = []interface{}{ "p2p_chat_create", } @@ -53,6 +35,8 @@ func (j *P2PChatCreateRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const P2PChatCreateRespMsgTypeP2PChatCreate P2PChatCreateRespMsgType = "p2p_chat_create" + // Information of the P2P chat. type P2PChatCreateRespP2PChatCreate struct { // The URL to be used to initialise the chat for the requested order. @@ -68,10 +52,10 @@ func (j *P2PChatCreateRespP2PChatCreate) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["channel_url"]; raw != nil && !ok { + if v, ok := raw["channel_url"]; !ok || v == nil { return fmt.Errorf("field channel_url in P2PChatCreateRespP2PChatCreate: required") } - if _, ok := raw["order_id"]; raw != nil && !ok { + if v, ok := raw["order_id"]; !ok || v == nil { return fmt.Errorf("field order_id in P2PChatCreateRespP2PChatCreate: required") } type Plain P2PChatCreateRespP2PChatCreate @@ -83,16 +67,32 @@ func (j *P2PChatCreateRespP2PChatCreate) UnmarshalJSON(b []byte) error { return nil } +// Information of the created P2P chat. +type P2PChatCreateResp struct { + // Echo of the request made. + EchoReq P2PChatCreateRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PChatCreateRespMsgType `json:"msg_type"` + + // Information of the P2P chat. + P2PChatCreate *P2PChatCreateRespP2PChatCreate `json:"p2p_chat_create,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PChatCreateResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PChatCreateResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PChatCreateResp: required") } type Plain P2PChatCreateResp diff --git a/schema/p2p_country_list.go b/schema/p2p_country_list.go index 3a9ee8b..53a9428 100644 --- a/schema/p2p_country_list.go +++ b/schema/p2p_country_list.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// List all or specific country and its payment methods. -type P2PCountryList struct { - // [Optional] 2-letter country code. If not provided all countries are returned. - Country *string `json:"country,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2PCountryList P2PCountryListP2PCountryList `json:"p2p_country_list"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PCountryListPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type P2PCountryListP2PCountryList int var enumValues_P2PCountryListP2PCountryList = []interface{}{ @@ -52,6 +32,26 @@ func (j *P2PCountryListP2PCountryList) UnmarshalJSON(b []byte) error { return nil } +// List all or specific country and its payment methods. +type P2PCountryList struct { + // [Optional] 2-letter country code. If not provided all countries are returned. + Country *string `json:"country,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2PCountryList P2PCountryListP2PCountryList `json:"p2p_country_list"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PCountryListPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2PCountryListPassthrough map[string]interface{} @@ -62,7 +62,7 @@ func (j *P2PCountryList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_country_list"]; raw != nil && !ok { + if v, ok := raw["p2p_country_list"]; !ok || v == nil { return fmt.Errorf("field p2p_country_list in P2PCountryList: required") } type Plain P2PCountryList diff --git a/schema/p2p_country_list_resp.go b/schema/p2p_country_list_resp.go index 4bc3428..c584b4e 100644 --- a/schema/p2p_country_list_resp.go +++ b/schema/p2p_country_list_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// List all or specific country and its payment methods. -type P2PCountryListResp struct { - // Echo of the request made. - EchoReq P2PCountryListRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PCountryListRespMsgType `json:"msg_type"` - - // Country identified by country code - P2PCountryList P2PCountryListRespP2PCountryList `json:"p2p_country_list,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PCountryListRespEchoReq map[string]interface{} type P2PCountryListRespMsgType string -const P2PCountryListRespMsgTypeP2PCountryList P2PCountryListRespMsgType = "p2p_country_list" - var enumValues_P2PCountryListRespMsgType = []interface{}{ "p2p_country_list", } @@ -53,6 +35,24 @@ func (j *P2PCountryListRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// List all or specific country and its payment methods. +type P2PCountryListResp struct { + // Echo of the request made. + EchoReq P2PCountryListRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PCountryListRespMsgType `json:"msg_type"` + + // Country identified by country code + P2PCountryList P2PCountryListRespP2PCountryList `json:"p2p_country_list,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const P2PCountryListRespMsgTypeP2PCountryList P2PCountryListRespMsgType = "p2p_country_list" + // Country identified by country code type P2PCountryListRespP2PCountryList map[string]interface{} @@ -62,10 +62,10 @@ func (j *P2PCountryListResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PCountryListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PCountryListResp: required") } type Plain P2PCountryListResp diff --git a/schema/p2p_order_cancel.go b/schema/p2p_order_cancel.go index f9ea19a..4ed6029 100644 --- a/schema/p2p_order_cancel.go +++ b/schema/p2p_order_cancel.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Cancel a P2P order. -type P2POrderCancel struct { - // The unique identifier for this order. - Id string `json:"id"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2POrderCancel P2POrderCancelP2POrderCancel `json:"p2p_order_cancel"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2POrderCancelPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type P2POrderCancelP2POrderCancel int var enumValues_P2POrderCancelP2POrderCancel = []interface{}{ @@ -52,6 +32,26 @@ func (j *P2POrderCancelP2POrderCancel) UnmarshalJSON(b []byte) error { return nil } +// Cancel a P2P order. +type P2POrderCancel struct { + // The unique identifier for this order. + Id string `json:"id"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2POrderCancel P2POrderCancelP2POrderCancel `json:"p2p_order_cancel"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2POrderCancelPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2POrderCancelPassthrough map[string]interface{} @@ -62,10 +62,10 @@ func (j *P2POrderCancel) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderCancel: required") } - if _, ok := raw["p2p_order_cancel"]; raw != nil && !ok { + if v, ok := raw["p2p_order_cancel"]; !ok || v == nil { return fmt.Errorf("field p2p_order_cancel in P2POrderCancel: required") } type Plain P2POrderCancel diff --git a/schema/p2p_order_cancel_resp.go b/schema/p2p_order_cancel_resp.go index 0fba82d..574d292 100644 --- a/schema/p2p_order_cancel_resp.go +++ b/schema/p2p_order_cancel_resp.go @@ -29,64 +29,60 @@ type P2POrderCancelRespMsgType string const P2POrderCancelRespMsgTypeP2POrderCancel P2POrderCancelRespMsgType = "p2p_order_cancel" -var enumValues_P2POrderCancelRespMsgType = []interface{}{ - "p2p_order_cancel", +// Cancellation details +type P2POrderCancelRespP2POrderCancel struct { + // The unique identifier for the order. + Id string `json:"id"` + + // The new status of the order. + Status P2POrderCancelRespP2POrderCancelStatus `json:"status"` +} + +type P2POrderCancelRespP2POrderCancelStatus string + +var enumValues_P2POrderCancelRespP2POrderCancelStatus = []interface{}{ + "cancelled", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCancelRespMsgType) UnmarshalJSON(b []byte) error { +func (j *P2POrderCancelRespP2POrderCancelStatus) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCancelRespMsgType { + for _, expected := range enumValues_P2POrderCancelRespP2POrderCancelStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCancelRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCancelRespP2POrderCancelStatus, v) } - *j = P2POrderCancelRespMsgType(v) + *j = P2POrderCancelRespP2POrderCancelStatus(v) return nil } -// Cancellation details -type P2POrderCancelRespP2POrderCancel struct { - // The unique identifier for the order. - Id string `json:"id"` - - // The new status of the order. - Status P2POrderCancelRespP2POrderCancelStatus `json:"status"` -} - -type P2POrderCancelRespP2POrderCancelStatus string - const P2POrderCancelRespP2POrderCancelStatusCancelled P2POrderCancelRespP2POrderCancelStatus = "cancelled" -var enumValues_P2POrderCancelRespP2POrderCancelStatus = []interface{}{ - "cancelled", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCancelRespP2POrderCancelStatus) UnmarshalJSON(b []byte) error { +func (j *P2POrderCancelRespMsgType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCancelRespP2POrderCancelStatus { + for _, expected := range enumValues_P2POrderCancelRespMsgType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCancelRespP2POrderCancelStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCancelRespMsgType, v) } - *j = P2POrderCancelRespP2POrderCancelStatus(v) + *j = P2POrderCancelRespMsgType(v) return nil } @@ -96,10 +92,10 @@ func (j *P2POrderCancelRespP2POrderCancel) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderCancelRespP2POrderCancel: required") } - if _, ok := raw["status"]; raw != nil && !ok { + if v, ok := raw["status"]; !ok || v == nil { return fmt.Errorf("field status in P2POrderCancelRespP2POrderCancel: required") } type Plain P2POrderCancelRespP2POrderCancel @@ -111,16 +107,20 @@ func (j *P2POrderCancelRespP2POrderCancel) UnmarshalJSON(b []byte) error { return nil } +var enumValues_P2POrderCancelRespMsgType = []interface{}{ + "p2p_order_cancel", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderCancelResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2POrderCancelResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2POrderCancelResp: required") } type Plain P2POrderCancelResp diff --git a/schema/p2p_order_confirm.go b/schema/p2p_order_confirm.go index c846102..20b7f6e 100644 --- a/schema/p2p_order_confirm.go +++ b/schema/p2p_order_confirm.go @@ -6,32 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Confirm a P2P order. -type P2POrderConfirm struct { - // [Optional] If set to `1`, only validation is performed. - DryRun P2POrderConfirmDryRun `json:"dry_run,omitempty"` - - // The unique identifier for this order. - Id string `json:"id"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2POrderConfirm P2POrderConfirmP2POrderConfirm `json:"p2p_order_confirm"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2POrderConfirmPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] Verification code received from email. - VerificationCode *string `json:"verification_code,omitempty"` -} - type P2POrderConfirmDryRun int var enumValues_P2POrderConfirmDryRun = []interface{}{ @@ -85,6 +59,32 @@ func (j *P2POrderConfirmP2POrderConfirm) UnmarshalJSON(b []byte) error { return nil } +// Confirm a P2P order. +type P2POrderConfirm struct { + // [Optional] If set to `1`, only validation is performed. + DryRun P2POrderConfirmDryRun `json:"dry_run,omitempty"` + + // The unique identifier for this order. + Id string `json:"id"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2POrderConfirm P2POrderConfirmP2POrderConfirm `json:"p2p_order_confirm"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2POrderConfirmPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] Verification code received from email. + VerificationCode *string `json:"verification_code,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2POrderConfirmPassthrough map[string]interface{} @@ -95,10 +95,10 @@ func (j *P2POrderConfirm) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderConfirm: required") } - if _, ok := raw["p2p_order_confirm"]; raw != nil && !ok { + if v, ok := raw["p2p_order_confirm"]; !ok || v == nil { return fmt.Errorf("field p2p_order_confirm in P2POrderConfirm: required") } type Plain P2POrderConfirm diff --git a/schema/p2p_order_confirm_resp.go b/schema/p2p_order_confirm_resp.go index 996f1d9..e18f43e 100644 --- a/schema/p2p_order_confirm_resp.go +++ b/schema/p2p_order_confirm_resp.go @@ -29,30 +29,6 @@ type P2POrderConfirmRespMsgType string const P2POrderConfirmRespMsgTypeP2POrderConfirm P2POrderConfirmRespMsgType = "p2p_order_confirm" -var enumValues_P2POrderConfirmRespMsgType = []interface{}{ - "p2p_order_confirm", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderConfirmRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderConfirmRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderConfirmRespMsgType, v) - } - *j = P2POrderConfirmRespMsgType(v) - return nil -} - // Confirmation details type P2POrderConfirmRespP2POrderConfirm struct { // The `dry_run` was successful. @@ -67,9 +43,7 @@ type P2POrderConfirmRespP2POrderConfirm struct { type P2POrderConfirmRespP2POrderConfirmDryRun int -var enumValues_P2POrderConfirmRespP2POrderConfirmDryRun = []interface{}{ - 1, -} +type P2POrderConfirmRespP2POrderConfirmStatus string // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderConfirmRespP2POrderConfirmDryRun) UnmarshalJSON(b []byte) error { @@ -91,11 +65,9 @@ func (j *P2POrderConfirmRespP2POrderConfirmDryRun) UnmarshalJSON(b []byte) error return nil } -type P2POrderConfirmRespP2POrderConfirmStatus string - -const P2POrderConfirmRespP2POrderConfirmStatusBuyerConfirmed P2POrderConfirmRespP2POrderConfirmStatus = "buyer-confirmed" -const P2POrderConfirmRespP2POrderConfirmStatusCompleted P2POrderConfirmRespP2POrderConfirmStatus = "completed" - +var enumValues_P2POrderConfirmRespP2POrderConfirmDryRun = []interface{}{ + 1, +} var enumValues_P2POrderConfirmRespP2POrderConfirmStatus = []interface{}{ "buyer-confirmed", "completed", @@ -121,13 +93,36 @@ func (j *P2POrderConfirmRespP2POrderConfirmStatus) UnmarshalJSON(b []byte) error return nil } +const P2POrderConfirmRespP2POrderConfirmStatusBuyerConfirmed P2POrderConfirmRespP2POrderConfirmStatus = "buyer-confirmed" +const P2POrderConfirmRespP2POrderConfirmStatusCompleted P2POrderConfirmRespP2POrderConfirmStatus = "completed" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderConfirmRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderConfirmRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderConfirmRespMsgType, v) + } + *j = P2POrderConfirmRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderConfirmRespP2POrderConfirm) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderConfirmRespP2POrderConfirm: required") } type Plain P2POrderConfirmRespP2POrderConfirm @@ -139,16 +134,20 @@ func (j *P2POrderConfirmRespP2POrderConfirm) UnmarshalJSON(b []byte) error { return nil } +var enumValues_P2POrderConfirmRespMsgType = []interface{}{ + "p2p_order_confirm", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderConfirmResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2POrderConfirmResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2POrderConfirmResp: required") } type Plain P2POrderConfirmResp diff --git a/schema/p2p_order_create.go b/schema/p2p_order_create.go index ac87dab..b06692b 100644 --- a/schema/p2p_order_create.go +++ b/schema/p2p_order_create.go @@ -6,46 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Creates a P2P order for the specified advert. -type P2POrderCreate struct { - // The unique identifier for the advert to create an order against. - AdvertId string `json:"advert_id"` - - // The amount of currency to be bought or sold. - Amount float64 `json:"amount"` - - // [Optional] Seller contact information. Only applicable for 'sell orders'. - ContactInfo *string `json:"contact_info,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2POrderCreate P2POrderCreateP2POrderCreate `json:"p2p_order_create"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2POrderCreatePassthrough `json:"passthrough,omitempty"` - - // [Optional] Payment instructions, only applicable for sell orders. - PaymentInfo *string `json:"payment_info,omitempty"` - - // IDs of payment methods, only applicable for sell orders. - PaymentMethodIds []int `json:"payment_method_ids,omitempty"` - - // [Optional] Conversion rate from account currency to local currency, only - // applicable for floating rate adverts. - Rate *float64 `json:"rate,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to 1, will send updates whenever there is an update to the - // order. - Subscribe *P2POrderCreateSubscribe `json:"subscribe,omitempty"` -} - type P2POrderCreateP2POrderCreate int var enumValues_P2POrderCreateP2POrderCreate = []interface{}{ @@ -102,19 +62,59 @@ func (j *P2POrderCreateSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Creates a P2P order for the specified advert. +type P2POrderCreate struct { + // The unique identifier for the advert to create an order against. + AdvertId string `json:"advert_id"` + + // The amount of currency to be bought or sold. + Amount float64 `json:"amount"` + + // [Optional] Seller contact information. Only applicable for 'sell orders'. + ContactInfo *string `json:"contact_info,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2POrderCreate P2POrderCreateP2POrderCreate `json:"p2p_order_create"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2POrderCreatePassthrough `json:"passthrough,omitempty"` + + // [Optional] Payment instructions, only applicable for sell orders. + PaymentInfo *string `json:"payment_info,omitempty"` + + // IDs of payment methods, only applicable for sell orders. + PaymentMethodIds []int `json:"payment_method_ids,omitempty"` + + // [Optional] Conversion rate from account currency to local currency, only + // applicable for floating rate adverts. + Rate *float64 `json:"rate,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to 1, will send updates whenever there is an update to the + // order. + Subscribe *P2POrderCreateSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderCreate) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["advert_id"]; raw != nil && !ok { + if v, ok := raw["advert_id"]; !ok || v == nil { return fmt.Errorf("field advert_id in P2POrderCreate: required") } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in P2POrderCreate: required") } - if _, ok := raw["p2p_order_create"]; raw != nil && !ok { + if v, ok := raw["p2p_order_create"]; !ok || v == nil { return fmt.Errorf("field p2p_order_create in P2POrderCreate: required") } type Plain P2POrderCreate diff --git a/schema/p2p_order_create_resp.go b/schema/p2p_order_create_resp.go index 4a6e944..ff6d417 100644 --- a/schema/p2p_order_create_resp.go +++ b/schema/p2p_order_create_resp.go @@ -6,6 +6,53 @@ import "encoding/json" import "fmt" import "reflect" +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderCreateRespP2POrderCreateDisputeDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["dispute_reason"]; !ok || v == nil { + return fmt.Errorf("field dispute_reason in P2POrderCreateRespP2POrderCreateDisputeDetails: required") + } + if v, ok := raw["disputer_loginid"]; !ok || v == nil { + return fmt.Errorf("field disputer_loginid in P2POrderCreateRespP2POrderCreateDisputeDetails: required") + } + type Plain P2POrderCreateRespP2POrderCreateDisputeDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderCreateRespP2POrderCreateDisputeDetails(plain) + return nil +} + +const P2POrderCreateRespP2POrderCreateAdvertDetailsTypeSell P2POrderCreateRespP2POrderCreateAdvertDetailsType = "sell" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderCreateResp) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["echo_req"]; !ok || v == nil { + return fmt.Errorf("field echo_req in P2POrderCreateResp: required") + } + if v, ok := raw["msg_type"]; !ok || v == nil { + return fmt.Errorf("field msg_type in P2POrderCreateResp: required") + } + type Plain P2POrderCreateResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderCreateResp(plain) + return nil +} + +// Echo of the request made. +type P2POrderCreateRespEchoReq map[string]interface{} + // The information about the created P2P order. type P2POrderCreateResp struct { // Echo of the request made. @@ -25,34 +72,213 @@ type P2POrderCreateResp struct { Subscription *P2POrderCreateRespSubscription `json:"subscription,omitempty"` } -// Echo of the request made. -type P2POrderCreateRespEchoReq map[string]interface{} +type P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade int -type P2POrderCreateRespMsgType string +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderCreateRespP2POrderCreateClientDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderCreateRespP2POrderCreateClientDetails: required") + } + if v, ok := raw["is_online"]; !ok || v == nil { + return fmt.Errorf("field is_online in P2POrderCreateRespP2POrderCreateClientDetails: required") + } + if v, ok := raw["last_online_time"]; !ok || v == nil { + return fmt.Errorf("field last_online_time in P2POrderCreateRespP2POrderCreateClientDetails: required") + } + if v, ok := raw["loginid"]; !ok || v == nil { + return fmt.Errorf("field loginid in P2POrderCreateRespP2POrderCreateClientDetails: required") + } + if v, ok := raw["name"]; !ok || v == nil { + return fmt.Errorf("field name in P2POrderCreateRespP2POrderCreateClientDetails: required") + } + type Plain P2POrderCreateRespP2POrderCreateClientDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderCreateRespP2POrderCreateClientDetails(plain) + return nil +} -const P2POrderCreateRespMsgTypeP2POrderCreate P2POrderCreateRespMsgType = "p2p_order_create" +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade, v) + } + *j = P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade(v) + return nil +} -var enumValues_P2POrderCreateRespMsgType = []interface{}{ - "p2p_order_create", +type P2POrderCreateRespP2POrderCreateAdvertDetailsType string + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderCreateRespP2POrderCreate) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["account_currency"]; !ok || v == nil { + return fmt.Errorf("field account_currency in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["advert_details"]; !ok || v == nil { + return fmt.Errorf("field advert_details in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["advertiser_details"]; !ok || v == nil { + return fmt.Errorf("field advertiser_details in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["amount"]; !ok || v == nil { + return fmt.Errorf("field amount in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["amount_display"]; !ok || v == nil { + return fmt.Errorf("field amount_display in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["chat_channel_url"]; !ok || v == nil { + return fmt.Errorf("field chat_channel_url in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["client_details"]; !ok || v == nil { + return fmt.Errorf("field client_details in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["contact_info"]; !ok || v == nil { + return fmt.Errorf("field contact_info in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["created_time"]; !ok || v == nil { + return fmt.Errorf("field created_time in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["dispute_details"]; !ok || v == nil { + return fmt.Errorf("field dispute_details in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["expiry_time"]; !ok || v == nil { + return fmt.Errorf("field expiry_time in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["is_incoming"]; !ok || v == nil { + return fmt.Errorf("field is_incoming in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["is_reviewable"]; !ok || v == nil { + return fmt.Errorf("field is_reviewable in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["is_seen"]; !ok || v == nil { + return fmt.Errorf("field is_seen in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["local_currency"]; !ok || v == nil { + return fmt.Errorf("field local_currency in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["payment_info"]; !ok || v == nil { + return fmt.Errorf("field payment_info in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["price"]; !ok || v == nil { + return fmt.Errorf("field price in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["price_display"]; !ok || v == nil { + return fmt.Errorf("field price_display in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["rate"]; !ok || v == nil { + return fmt.Errorf("field rate in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["rate_display"]; !ok || v == nil { + return fmt.Errorf("field rate_display in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["status"]; !ok || v == nil { + return fmt.Errorf("field status in P2POrderCreateRespP2POrderCreate: required") + } + if v, ok := raw["type"]; !ok || v == nil { + return fmt.Errorf("field type in P2POrderCreateRespP2POrderCreate: required") + } + type Plain P2POrderCreateRespP2POrderCreate + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderCreateRespP2POrderCreate(plain) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespMsgType) UnmarshalJSON(b []byte) error { +func (j *P2POrderCreateRespP2POrderCreateAdvertDetailsType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespMsgType { + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsType, v) } - *j = P2POrderCreateRespMsgType(v) + *j = P2POrderCreateRespP2POrderCreateAdvertDetailsType(v) + return nil +} + +const P2POrderCreateRespP2POrderCreateAdvertDetailsTypeBuy P2POrderCreateRespP2POrderCreateAdvertDetailsType = "buy" + +type P2POrderCreateRespMsgType string + +// Details of the advert for this order. +type P2POrderCreateRespP2POrderCreateAdvertDetails struct { + // Indicates if this is block trade advert or not. + BlockTrade P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade `json:"block_trade"` + + // General information about the advert. + Description string `json:"description"` + + // The unique identifier for the advert. + Id string `json:"id"` + + // The payment method. + PaymentMethod *string `json:"payment_method"` + + // Type of the advert. + Type P2POrderCreateRespP2POrderCreateAdvertDetailsType `json:"type"` +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderCreateRespP2POrderCreateAdvertDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["block_trade"]; !ok || v == nil { + return fmt.Errorf("field block_trade in P2POrderCreateRespP2POrderCreateAdvertDetails: required") + } + if v, ok := raw["description"]; !ok || v == nil { + return fmt.Errorf("field description in P2POrderCreateRespP2POrderCreateAdvertDetails: required") + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderCreateRespP2POrderCreateAdvertDetails: required") + } + if v, ok := raw["payment_method"]; !ok || v == nil { + return fmt.Errorf("field payment_method in P2POrderCreateRespP2POrderCreateAdvertDetails: required") + } + if v, ok := raw["type"]; !ok || v == nil { + return fmt.Errorf("field type in P2POrderCreateRespP2POrderCreateAdvertDetails: required") + } + type Plain P2POrderCreateRespP2POrderCreateAdvertDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderCreateRespP2POrderCreateAdvertDetails(plain) return nil } @@ -136,159 +362,63 @@ type P2POrderCreateRespP2POrderCreate struct { Type P2POrderCreateRespP2POrderCreateType `json:"type"` } -// Details of the advert for this order. -type P2POrderCreateRespP2POrderCreateAdvertDetails struct { - // Indicates if this is block trade advert or not. - BlockTrade P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade `json:"block_trade"` - - // General information about the advert. - Description string `json:"description"` - - // The unique identifier for the advert. - Id string `json:"id"` - - // The payment method. - PaymentMethod *string `json:"payment_method"` - - // Type of the advert. - Type P2POrderCreateRespP2POrderCreateAdvertDetailsType `json:"type"` -} - -type P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade int - -var enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { - var v int +func (j *P2POrderCreateRespP2POrderCreateType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade { + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateType, v) } - *j = P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade(v) + *j = P2POrderCreateRespP2POrderCreateType(v) return nil } -type P2POrderCreateRespP2POrderCreateAdvertDetailsType string - -const P2POrderCreateRespP2POrderCreateAdvertDetailsTypeBuy P2POrderCreateRespP2POrderCreateAdvertDetailsType = "buy" -const P2POrderCreateRespP2POrderCreateAdvertDetailsTypeSell P2POrderCreateRespP2POrderCreateAdvertDetailsType = "sell" - -var enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsType = []interface{}{ - "buy", - "sell", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateAdvertDetailsType) UnmarshalJSON(b []byte) error { - var v string +func (j *P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsType { + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline, v) } - *j = P2POrderCreateRespP2POrderCreateAdvertDetailsType(v) + *j = P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline(v) return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateAdvertDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["block_trade"]; raw != nil && !ok { - return fmt.Errorf("field block_trade in P2POrderCreateRespP2POrderCreateAdvertDetails: required") - } - if _, ok := raw["description"]; raw != nil && !ok { - return fmt.Errorf("field description in P2POrderCreateRespP2POrderCreateAdvertDetails: required") - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderCreateRespP2POrderCreateAdvertDetails: required") - } - if _, ok := raw["payment_method"]; raw != nil && !ok { - return fmt.Errorf("field payment_method in P2POrderCreateRespP2POrderCreateAdvertDetails: required") - } - if _, ok := raw["type"]; raw != nil && !ok { - return fmt.Errorf("field type in P2POrderCreateRespP2POrderCreateAdvertDetails: required") - } - type Plain P2POrderCreateRespP2POrderCreateAdvertDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderCreateRespP2POrderCreateAdvertDetails(plain) - return nil -} - -// Details of the advertiser for this order. -type P2POrderCreateRespP2POrderCreateAdvertiserDetails struct { - // The advertiser's first name. - FirstName *string `json:"first_name,omitempty"` - - // The advertiser's unique identifier. - Id string `json:"id"` - - // Indicates if the advertiser is currently online. - IsOnline P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline `json:"is_online"` - - // The advertiser's last name. - LastName *string `json:"last_name,omitempty"` - - // Epoch of the latest time the advertiser was online, up to 6 months. - LastOnlineTime *int `json:"last_online_time"` - - // The advertiser's account identifier. - Loginid string `json:"loginid"` - - // The advertiser's displayed name. - Name string `json:"name"` -} - -type P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline int - -var enumValues_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int +func (j *P2POrderCreateRespP2POrderCreateStatus) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline { + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateStatus, v) } - *j = P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline(v) + *j = P2POrderCreateRespP2POrderCreateStatus(v) return nil } @@ -298,19 +428,19 @@ func (j *P2POrderCreateRespP2POrderCreateAdvertiserDetails) UnmarshalJSON(b []by if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } - if _, ok := raw["loginid"]; raw != nil && !ok { + if v, ok := raw["loginid"]; !ok || v == nil { return fmt.Errorf("field loginid in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } type Plain P2POrderCreateRespP2POrderCreateAdvertiserDetails @@ -322,341 +452,204 @@ func (j *P2POrderCreateRespP2POrderCreateAdvertiserDetails) UnmarshalJSON(b []by return nil } -// Details of the client who created the order. -type P2POrderCreateRespP2POrderCreateClientDetails struct { - // The client's first name. - FirstName *string `json:"first_name,omitempty"` - - // The client's unique P2P identifier. - Id string `json:"id"` - - // Indicates if the advertiser is currently online. - IsOnline P2POrderCreateRespP2POrderCreateClientDetailsIsOnline `json:"is_online"` - - // The client's last name. - LastName *string `json:"last_name,omitempty"` - - // Epoch of the latest time the advertiser was online, up to 6 months. - LastOnlineTime *int `json:"last_online_time"` - - // The client's account identifier. - Loginid string `json:"loginid"` - - // The client's displayed name. - Name string `json:"name"` -} - -type P2POrderCreateRespP2POrderCreateClientDetailsIsOnline int - -var enumValues_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateClientDetailsIsOnline) UnmarshalJSON(b []byte) error { +func (j *P2POrderCreateRespP2POrderCreateIsSeen) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline { + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateIsSeen { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline, v) - } - *j = P2POrderCreateRespP2POrderCreateClientDetailsIsOnline(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateClientDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderCreateRespP2POrderCreateClientDetails: required") - } - if _, ok := raw["is_online"]; raw != nil && !ok { - return fmt.Errorf("field is_online in P2POrderCreateRespP2POrderCreateClientDetails: required") - } - if _, ok := raw["last_online_time"]; raw != nil && !ok { - return fmt.Errorf("field last_online_time in P2POrderCreateRespP2POrderCreateClientDetails: required") - } - if _, ok := raw["loginid"]; raw != nil && !ok { - return fmt.Errorf("field loginid in P2POrderCreateRespP2POrderCreateClientDetails: required") - } - if _, ok := raw["name"]; raw != nil && !ok { - return fmt.Errorf("field name in P2POrderCreateRespP2POrderCreateClientDetails: required") - } - type Plain P2POrderCreateRespP2POrderCreateClientDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderCreateRespP2POrderCreateClientDetails(plain) - return nil -} - -// Details of the order dispute. -type P2POrderCreateRespP2POrderCreateDisputeDetails struct { - // The dispute reason - DisputeReason *string `json:"dispute_reason"` - - // The loginid of the client who's raising the dispute - DisputerLoginid *string `json:"disputer_loginid"` -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateDisputeDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["dispute_reason"]; raw != nil && !ok { - return fmt.Errorf("field dispute_reason in P2POrderCreateRespP2POrderCreateDisputeDetails: required") - } - if _, ok := raw["disputer_loginid"]; raw != nil && !ok { - return fmt.Errorf("field disputer_loginid in P2POrderCreateRespP2POrderCreateDisputeDetails: required") - } - type Plain P2POrderCreateRespP2POrderCreateDisputeDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsSeen, v) } - *j = P2POrderCreateRespP2POrderCreateDisputeDetails(plain) + *j = P2POrderCreateRespP2POrderCreateIsSeen(v) return nil } -type P2POrderCreateRespP2POrderCreateIsIncoming int - -var enumValues_P2POrderCreateRespP2POrderCreateIsIncoming = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateIsIncoming) UnmarshalJSON(b []byte) error { +func (j *P2POrderCreateRespP2POrderCreateIsReviewable) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateIsIncoming { + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateIsReviewable { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsIncoming, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsReviewable, v) } - *j = P2POrderCreateRespP2POrderCreateIsIncoming(v) + *j = P2POrderCreateRespP2POrderCreateIsReviewable(v) return nil } -type P2POrderCreateRespP2POrderCreateIsReviewable int - -var enumValues_P2POrderCreateRespP2POrderCreateIsReviewable = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateIsReviewable) UnmarshalJSON(b []byte) error { +func (j *P2POrderCreateRespP2POrderCreateClientDetailsIsOnline) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateIsReviewable { + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsReviewable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline, v) } - *j = P2POrderCreateRespP2POrderCreateIsReviewable(v) + *j = P2POrderCreateRespP2POrderCreateClientDetailsIsOnline(v) return nil } -type P2POrderCreateRespP2POrderCreateIsSeen int - -var enumValues_P2POrderCreateRespP2POrderCreateIsSeen = []interface{}{ - 1, - 0, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateIsSeen) UnmarshalJSON(b []byte) error { +func (j *P2POrderCreateRespP2POrderCreateIsIncoming) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateIsSeen { + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateIsIncoming { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsSeen, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsIncoming, v) } - *j = P2POrderCreateRespP2POrderCreateIsSeen(v) + *j = P2POrderCreateRespP2POrderCreateIsIncoming(v) return nil } -// Details of available payment methods. -type P2POrderCreateRespP2POrderCreatePaymentMethodDetails map[string]interface{} - -type P2POrderCreateRespP2POrderCreateStatus string - -const P2POrderCreateRespP2POrderCreateStatusPending P2POrderCreateRespP2POrderCreateStatus = "pending" - -var enumValues_P2POrderCreateRespP2POrderCreateStatus = []interface{}{ - "pending", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateStatus) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { +func (j *P2POrderCreateRespSubscription) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { return err } - var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateStatus { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderCreateRespSubscription: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateStatus, v) + type Plain P2POrderCreateRespSubscription + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err } - *j = P2POrderCreateRespP2POrderCreateStatus(v) + *j = P2POrderCreateRespSubscription(plain) return nil } -type P2POrderCreateRespP2POrderCreateType string - -const P2POrderCreateRespP2POrderCreateTypeBuy P2POrderCreateRespP2POrderCreateType = "buy" -const P2POrderCreateRespP2POrderCreateTypeSell P2POrderCreateRespP2POrderCreateType = "sell" - -var enumValues_P2POrderCreateRespP2POrderCreateType = []interface{}{ - "buy", - "sell", -} +const P2POrderCreateRespMsgTypeP2POrderCreate P2POrderCreateRespMsgType = "p2p_order_create" // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateType) UnmarshalJSON(b []byte) error { +func (j *P2POrderCreateRespMsgType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateType { + for _, expected := range enumValues_P2POrderCreateRespMsgType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespMsgType, v) } - *j = P2POrderCreateRespP2POrderCreateType(v) + *j = P2POrderCreateRespMsgType(v) return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreate) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["account_currency"]; raw != nil && !ok { - return fmt.Errorf("field account_currency in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["advert_details"]; raw != nil && !ok { - return fmt.Errorf("field advert_details in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["advertiser_details"]; raw != nil && !ok { - return fmt.Errorf("field advertiser_details in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["amount"]; raw != nil && !ok { - return fmt.Errorf("field amount in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["amount_display"]; raw != nil && !ok { - return fmt.Errorf("field amount_display in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["chat_channel_url"]; raw != nil && !ok { - return fmt.Errorf("field chat_channel_url in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["client_details"]; raw != nil && !ok { - return fmt.Errorf("field client_details in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["contact_info"]; raw != nil && !ok { - return fmt.Errorf("field contact_info in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["created_time"]; raw != nil && !ok { - return fmt.Errorf("field created_time in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["dispute_details"]; raw != nil && !ok { - return fmt.Errorf("field dispute_details in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["expiry_time"]; raw != nil && !ok { - return fmt.Errorf("field expiry_time in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["is_incoming"]; raw != nil && !ok { - return fmt.Errorf("field is_incoming in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["is_reviewable"]; raw != nil && !ok { - return fmt.Errorf("field is_reviewable in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["is_seen"]; raw != nil && !ok { - return fmt.Errorf("field is_seen in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["local_currency"]; raw != nil && !ok { - return fmt.Errorf("field local_currency in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["payment_info"]; raw != nil && !ok { - return fmt.Errorf("field payment_info in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["price"]; raw != nil && !ok { - return fmt.Errorf("field price in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["price_display"]; raw != nil && !ok { - return fmt.Errorf("field price_display in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["rate"]; raw != nil && !ok { - return fmt.Errorf("field rate in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["rate_display"]; raw != nil && !ok { - return fmt.Errorf("field rate_display in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["status"]; raw != nil && !ok { - return fmt.Errorf("field status in P2POrderCreateRespP2POrderCreate: required") - } - if _, ok := raw["type"]; raw != nil && !ok { - return fmt.Errorf("field type in P2POrderCreateRespP2POrderCreate: required") - } - type Plain P2POrderCreateRespP2POrderCreate - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderCreateRespP2POrderCreate(plain) - return nil +const P2POrderCreateRespP2POrderCreateTypeSell P2POrderCreateRespP2POrderCreateType = "sell" + +// Details of the advertiser for this order. +type P2POrderCreateRespP2POrderCreateAdvertiserDetails struct { + // The advertiser's first name. + FirstName *string `json:"first_name,omitempty"` + + // The advertiser's unique identifier. + Id string `json:"id"` + + // Indicates if the advertiser is currently online. + IsOnline P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline `json:"is_online"` + + // The advertiser's last name. + LastName *string `json:"last_name,omitempty"` + + // Epoch of the latest time the advertiser was online, up to 6 months. + LastOnlineTime *int `json:"last_online_time"` + + // The advertiser's account identifier. + Loginid string `json:"loginid"` + + // The advertiser's displayed name. + Name string `json:"name"` +} + +const P2POrderCreateRespP2POrderCreateStatusPending P2POrderCreateRespP2POrderCreateStatus = "pending" + +type P2POrderCreateRespP2POrderCreateIsReviewable int + +// Details of the order dispute. +type P2POrderCreateRespP2POrderCreateDisputeDetails struct { + // The dispute reason + DisputeReason *string `json:"dispute_reason"` + + // The loginid of the client who's raising the dispute + DisputerLoginid *string `json:"disputer_loginid"` +} + +type P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline int + +type P2POrderCreateRespP2POrderCreateIsSeen int + +type P2POrderCreateRespP2POrderCreateIsIncoming int + +type P2POrderCreateRespP2POrderCreateClientDetailsIsOnline int + +// Details of available payment methods. +type P2POrderCreateRespP2POrderCreatePaymentMethodDetails map[string]interface{} + +type P2POrderCreateRespP2POrderCreateStatus string + +const P2POrderCreateRespP2POrderCreateTypeBuy P2POrderCreateRespP2POrderCreateType = "buy" + +type P2POrderCreateRespP2POrderCreateType string + +// Details of the client who created the order. +type P2POrderCreateRespP2POrderCreateClientDetails struct { + // The client's first name. + FirstName *string `json:"first_name,omitempty"` + + // The client's unique P2P identifier. + Id string `json:"id"` + + // Indicates if the advertiser is currently online. + IsOnline P2POrderCreateRespP2POrderCreateClientDetailsIsOnline `json:"is_online"` + + // The client's last name. + LastName *string `json:"last_name,omitempty"` + + // Epoch of the latest time the advertiser was online, up to 6 months. + LastOnlineTime *int `json:"last_online_time"` + + // The client's account identifier. + Loginid string `json:"loginid"` + + // The client's displayed name. + Name string `json:"name"` } // For subscription requests only. @@ -666,41 +659,41 @@ type P2POrderCreateRespSubscription struct { Id string `json:"id"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespSubscription) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderCreateRespSubscription: required") - } - type Plain P2POrderCreateRespSubscription - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderCreateRespSubscription(plain) - return nil +var enumValues_P2POrderCreateRespMsgType = []interface{}{ + "p2p_order_create", } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateResp) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["echo_req"]; raw != nil && !ok { - return fmt.Errorf("field echo_req in P2POrderCreateResp: required") - } - if _, ok := raw["msg_type"]; raw != nil && !ok { - return fmt.Errorf("field msg_type in P2POrderCreateResp: required") - } - type Plain P2POrderCreateResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderCreateResp(plain) - return nil +var enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade = []interface{}{ + 0, + 1, +} +var enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsType = []interface{}{ + "buy", + "sell", +} +var enumValues_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, +} +var enumValues_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline = []interface{}{ + 0, + 1, +} +var enumValues_P2POrderCreateRespP2POrderCreateIsIncoming = []interface{}{ + 0, + 1, +} +var enumValues_P2POrderCreateRespP2POrderCreateIsReviewable = []interface{}{ + 0, + 1, +} +var enumValues_P2POrderCreateRespP2POrderCreateIsSeen = []interface{}{ + 1, + 0, +} +var enumValues_P2POrderCreateRespP2POrderCreateStatus = []interface{}{ + "pending", +} +var enumValues_P2POrderCreateRespP2POrderCreateType = []interface{}{ + "buy", + "sell", } diff --git a/schema/p2p_order_dispute.go b/schema/p2p_order_dispute.go index 1f9f767..f9c1445 100644 --- a/schema/p2p_order_dispute.go +++ b/schema/p2p_order_dispute.go @@ -37,14 +37,6 @@ const P2POrderDisputeDisputeReasonBuyerThirdPartyPaymentMethod P2POrderDisputeDi const P2POrderDisputeDisputeReasonBuyerUnderpaid P2POrderDisputeDisputeReason = "buyer_underpaid" const P2POrderDisputeDisputeReasonSellerNotReleased P2POrderDisputeDisputeReason = "seller_not_released" -var enumValues_P2POrderDisputeDisputeReason = []interface{}{ - "seller_not_released", - "buyer_underpaid", - "buyer_overpaid", - "buyer_not_paid", - "buyer_third_party_payment_method", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderDisputeDisputeReason) UnmarshalJSON(b []byte) error { var v string @@ -95,19 +87,27 @@ func (j *P2POrderDisputeP2POrderDispute) UnmarshalJSON(b []byte) error { // the `echo_req` output field. type P2POrderDisputePassthrough map[string]interface{} +var enumValues_P2POrderDisputeDisputeReason = []interface{}{ + "seller_not_released", + "buyer_underpaid", + "buyer_overpaid", + "buyer_not_paid", + "buyer_third_party_payment_method", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderDispute) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["dispute_reason"]; raw != nil && !ok { + if v, ok := raw["dispute_reason"]; !ok || v == nil { return fmt.Errorf("field dispute_reason in P2POrderDispute: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderDispute: required") } - if _, ok := raw["p2p_order_dispute"]; raw != nil && !ok { + if v, ok := raw["p2p_order_dispute"]; !ok || v == nil { return fmt.Errorf("field p2p_order_dispute in P2POrderDispute: required") } type Plain P2POrderDispute diff --git a/schema/p2p_order_dispute_resp.go b/schema/p2p_order_dispute_resp.go index 95d36ca..40ebe90 100644 --- a/schema/p2p_order_dispute_resp.go +++ b/schema/p2p_order_dispute_resp.go @@ -29,30 +29,6 @@ type P2POrderDisputeRespMsgType string const P2POrderDisputeRespMsgTypeP2POrderDispute P2POrderDisputeRespMsgType = "p2p_order_dispute" -var enumValues_P2POrderDisputeRespMsgType = []interface{}{ - "p2p_order_dispute", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderDisputeRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespMsgType, v) - } - *j = P2POrderDisputeRespMsgType(v) - return nil -} - // Details of the disputed order. type P2POrderDisputeRespP2POrderDispute struct { // The currency of order. @@ -161,91 +137,11 @@ type P2POrderDisputeRespP2POrderDisputeAdvertDetails struct { type P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade int -var enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade, v) - } - *j = P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade(v) - return nil -} - type P2POrderDisputeRespP2POrderDisputeAdvertDetailsType string const P2POrderDisputeRespP2POrderDisputeAdvertDetailsTypeBuy P2POrderDisputeRespP2POrderDisputeAdvertDetailsType = "buy" const P2POrderDisputeRespP2POrderDisputeAdvertDetailsTypeSell P2POrderDisputeRespP2POrderDisputeAdvertDetailsType = "sell" -var enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsType = []interface{}{ - "buy", - "sell", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeAdvertDetailsType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsType, v) - } - *j = P2POrderDisputeRespP2POrderDisputeAdvertDetailsType(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeAdvertDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["block_trade"]; raw != nil && !ok { - return fmt.Errorf("field block_trade in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") - } - if _, ok := raw["description"]; raw != nil && !ok { - return fmt.Errorf("field description in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") - } - if _, ok := raw["payment_method"]; raw != nil && !ok { - return fmt.Errorf("field payment_method in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") - } - if _, ok := raw["type"]; raw != nil && !ok { - return fmt.Errorf("field type in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") - } - type Plain P2POrderDisputeRespP2POrderDisputeAdvertDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderDisputeRespP2POrderDisputeAdvertDetails(plain) - return nil -} - // Details of the advertiser for this order. type P2POrderDisputeRespP2POrderDisputeAdvertiserDetails struct { // The client's first name. @@ -272,61 +168,6 @@ type P2POrderDisputeRespP2POrderDisputeAdvertiserDetails struct { type P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline int -var enumValues_P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline, v) - } - *j = P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeAdvertiserDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") - } - if _, ok := raw["is_online"]; raw != nil && !ok { - return fmt.Errorf("field is_online in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") - } - if _, ok := raw["last_online_time"]; raw != nil && !ok { - return fmt.Errorf("field last_online_time in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") - } - if _, ok := raw["loginid"]; raw != nil && !ok { - return fmt.Errorf("field loginid in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") - } - if _, ok := raw["name"]; raw != nil && !ok { - return fmt.Errorf("field name in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") - } - type Plain P2POrderDisputeRespP2POrderDisputeAdvertiserDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderDisputeRespP2POrderDisputeAdvertiserDetails(plain) - return nil -} - // Details of the client who created the order. type P2POrderDisputeRespP2POrderDisputeClientDetails struct { // The client's first name. @@ -353,29 +194,63 @@ type P2POrderDisputeRespP2POrderDisputeClientDetails struct { type P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline int +// Details of the order dispute. +type P2POrderDisputeRespP2POrderDisputeDisputeDetails struct { + // The dispute reason + DisputeReason string `json:"dispute_reason"` + + // The loginid of the client who's raising the dispute + DisputerLoginid string `json:"disputer_loginid"` +} + +type P2POrderDisputeRespP2POrderDisputeIsIncoming int + +type P2POrderDisputeRespP2POrderDisputeIsReviewable int + +type P2POrderDisputeRespP2POrderDisputeIsSeen int + +type P2POrderDisputeRespP2POrderDisputeStatus string + +const P2POrderDisputeRespP2POrderDisputeStatusBlocked P2POrderDisputeRespP2POrderDisputeStatus = "blocked" +const P2POrderDisputeRespP2POrderDisputeStatusBuyerConfirmed P2POrderDisputeRespP2POrderDisputeStatus = "buyer-confirmed" +const P2POrderDisputeRespP2POrderDisputeStatusCancelled P2POrderDisputeRespP2POrderDisputeStatus = "cancelled" +const P2POrderDisputeRespP2POrderDisputeStatusCompleted P2POrderDisputeRespP2POrderDisputeStatus = "completed" +const P2POrderDisputeRespP2POrderDisputeStatusDisputeCompleted P2POrderDisputeRespP2POrderDisputeStatus = "dispute-completed" +const P2POrderDisputeRespP2POrderDisputeStatusDisputeRefunded P2POrderDisputeRespP2POrderDisputeStatus = "dispute-refunded" +const P2POrderDisputeRespP2POrderDisputeStatusDisputed P2POrderDisputeRespP2POrderDisputeStatus = "disputed" +const P2POrderDisputeRespP2POrderDisputeStatusPending P2POrderDisputeRespP2POrderDisputeStatus = "pending" +const P2POrderDisputeRespP2POrderDisputeStatusRefunded P2POrderDisputeRespP2POrderDisputeStatus = "refunded" +const P2POrderDisputeRespP2POrderDisputeStatusTimedOut P2POrderDisputeRespP2POrderDisputeStatus = "timed-out" + +type P2POrderDisputeRespP2POrderDisputeType string + +const P2POrderDisputeRespP2POrderDisputeTypeBuy P2POrderDisputeRespP2POrderDisputeType = "buy" +const P2POrderDisputeRespP2POrderDisputeTypeSell P2POrderDisputeRespP2POrderDisputeType = "sell" + +type P2POrderDisputeRespP2POrderDisputeVerificationPending int + +var enumValues_P2POrderDisputeRespMsgType = []interface{}{ + "p2p_order_dispute", +} +var enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade = []interface{}{ + 0, + 1, +} +var enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsType = []interface{}{ + "buy", + "sell", +} +var enumValues_P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, +} var enumValues_P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline = []interface{}{ 0, 1, } - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline, v) - } - *j = P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline(v) - return nil +var enumValues_P2POrderDisputeRespP2POrderDisputeIsIncoming = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -384,19 +259,19 @@ func (j *P2POrderDisputeRespP2POrderDisputeClientDetails) UnmarshalJSON(b []byte if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } - if _, ok := raw["is_online"]; raw != nil && !ok { + if v, ok := raw["is_online"]; !ok || v == nil { return fmt.Errorf("field is_online in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } - if _, ok := raw["last_online_time"]; raw != nil && !ok { + if v, ok := raw["last_online_time"]; !ok || v == nil { return fmt.Errorf("field last_online_time in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } - if _, ok := raw["loginid"]; raw != nil && !ok { + if v, ok := raw["loginid"]; !ok || v == nil { return fmt.Errorf("field loginid in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } type Plain P2POrderDisputeRespP2POrderDisputeClientDetails @@ -408,141 +283,148 @@ func (j *P2POrderDisputeRespP2POrderDisputeClientDetails) UnmarshalJSON(b []byte return nil } -// Details of the order dispute. -type P2POrderDisputeRespP2POrderDisputeDisputeDetails struct { - // The dispute reason - DisputeReason string `json:"dispute_reason"` - - // The loginid of the client who's raising the dispute - DisputerLoginid string `json:"disputer_loginid"` +var enumValues_P2POrderDisputeRespP2POrderDisputeStatus = []interface{}{ + "pending", + "buyer-confirmed", + "cancelled", + "timed-out", + "blocked", + "refunded", + "completed", + "disputed", + "dispute-refunded", + "dispute-completed", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeDisputeDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *P2POrderDisputeRespP2POrderDisputeIsSeen) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - if _, ok := raw["dispute_reason"]; raw != nil && !ok { - return fmt.Errorf("field dispute_reason in P2POrderDisputeRespP2POrderDisputeDisputeDetails: required") - } - if _, ok := raw["disputer_loginid"]; raw != nil && !ok { - return fmt.Errorf("field disputer_loginid in P2POrderDisputeRespP2POrderDisputeDisputeDetails: required") + var ok bool + for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain P2POrderDisputeRespP2POrderDisputeDisputeDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen, v) } - *j = P2POrderDisputeRespP2POrderDisputeDisputeDetails(plain) + *j = P2POrderDisputeRespP2POrderDisputeIsSeen(v) return nil } -type P2POrderDisputeRespP2POrderDisputeIsIncoming int - -var enumValues_P2POrderDisputeRespP2POrderDisputeIsIncoming = []interface{}{ - 0, +var enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen = []interface{}{ 1, + 0, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeIsIncoming) UnmarshalJSON(b []byte) error { +func (j *P2POrderDisputeRespP2POrderDisputeIsReviewable) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeIsIncoming { + for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeIsReviewable { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsIncoming, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsReviewable, v) } - *j = P2POrderDisputeRespP2POrderDisputeIsIncoming(v) + *j = P2POrderDisputeRespP2POrderDisputeIsReviewable(v) return nil } -type P2POrderDisputeRespP2POrderDisputeIsReviewable int - var enumValues_P2POrderDisputeRespP2POrderDisputeIsReviewable = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeIsReviewable) UnmarshalJSON(b []byte) error { +func (j *P2POrderDisputeRespP2POrderDisputeIsIncoming) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeIsReviewable { + for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeIsIncoming { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsReviewable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsIncoming, v) } - *j = P2POrderDisputeRespP2POrderDisputeIsReviewable(v) + *j = P2POrderDisputeRespP2POrderDisputeIsIncoming(v) return nil } -type P2POrderDisputeRespP2POrderDisputeIsSeen int - -var enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen = []interface{}{ - 1, - 0, +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline, v) + } + *j = P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeIsSeen) UnmarshalJSON(b []byte) error { +func (j *P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen { + for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade, v) } - *j = P2POrderDisputeRespP2POrderDisputeIsSeen(v) + *j = P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade(v) return nil } -type P2POrderDisputeRespP2POrderDisputeStatus string - -const P2POrderDisputeRespP2POrderDisputeStatusBlocked P2POrderDisputeRespP2POrderDisputeStatus = "blocked" -const P2POrderDisputeRespP2POrderDisputeStatusBuyerConfirmed P2POrderDisputeRespP2POrderDisputeStatus = "buyer-confirmed" -const P2POrderDisputeRespP2POrderDisputeStatusCancelled P2POrderDisputeRespP2POrderDisputeStatus = "cancelled" -const P2POrderDisputeRespP2POrderDisputeStatusCompleted P2POrderDisputeRespP2POrderDisputeStatus = "completed" -const P2POrderDisputeRespP2POrderDisputeStatusDisputeCompleted P2POrderDisputeRespP2POrderDisputeStatus = "dispute-completed" -const P2POrderDisputeRespP2POrderDisputeStatusDisputeRefunded P2POrderDisputeRespP2POrderDisputeStatus = "dispute-refunded" -const P2POrderDisputeRespP2POrderDisputeStatusDisputed P2POrderDisputeRespP2POrderDisputeStatus = "disputed" -const P2POrderDisputeRespP2POrderDisputeStatusPending P2POrderDisputeRespP2POrderDisputeStatus = "pending" -const P2POrderDisputeRespP2POrderDisputeStatusRefunded P2POrderDisputeRespP2POrderDisputeStatus = "refunded" -const P2POrderDisputeRespP2POrderDisputeStatusTimedOut P2POrderDisputeRespP2POrderDisputeStatus = "timed-out" - -var enumValues_P2POrderDisputeRespP2POrderDisputeStatus = []interface{}{ - "pending", - "buyer-confirmed", - "cancelled", - "timed-out", - "blocked", - "refunded", - "completed", - "disputed", - "dispute-refunded", - "dispute-completed", +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderDisputeRespP2POrderDisputeDisputeDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["dispute_reason"]; !ok || v == nil { + return fmt.Errorf("field dispute_reason in P2POrderDisputeRespP2POrderDisputeDisputeDetails: required") + } + if v, ok := raw["disputer_loginid"]; !ok || v == nil { + return fmt.Errorf("field disputer_loginid in P2POrderDisputeRespP2POrderDisputeDisputeDetails: required") + } + type Plain P2POrderDisputeRespP2POrderDisputeDisputeDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderDisputeRespP2POrderDisputeDisputeDetails(plain) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -565,11 +447,6 @@ func (j *P2POrderDisputeRespP2POrderDisputeStatus) UnmarshalJSON(b []byte) error return nil } -type P2POrderDisputeRespP2POrderDisputeType string - -const P2POrderDisputeRespP2POrderDisputeTypeBuy P2POrderDisputeRespP2POrderDisputeType = "buy" -const P2POrderDisputeRespP2POrderDisputeTypeSell P2POrderDisputeRespP2POrderDisputeType = "sell" - var enumValues_P2POrderDisputeRespP2POrderDisputeType = []interface{}{ "buy", "sell", @@ -595,7 +472,75 @@ func (j *P2POrderDisputeRespP2POrderDisputeType) UnmarshalJSON(b []byte) error { return nil } -type P2POrderDisputeRespP2POrderDisputeVerificationPending int +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderDisputeRespP2POrderDisputeAdvertDetailsType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsType, v) + } + *j = P2POrderDisputeRespP2POrderDisputeAdvertDetailsType(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline, v) + } + *j = P2POrderDisputeRespP2POrderDisputeClientDetailsIsOnline(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderDisputeRespP2POrderDisputeAdvertDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["block_trade"]; !ok || v == nil { + return fmt.Errorf("field block_trade in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") + } + if v, ok := raw["description"]; !ok || v == nil { + return fmt.Errorf("field description in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") + } + if v, ok := raw["payment_method"]; !ok || v == nil { + return fmt.Errorf("field payment_method in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") + } + if v, ok := raw["type"]; !ok || v == nil { + return fmt.Errorf("field type in P2POrderDisputeRespP2POrderDisputeAdvertDetails: required") + } + type Plain P2POrderDisputeRespP2POrderDisputeAdvertDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderDisputeRespP2POrderDisputeAdvertDetails(plain) + return nil +} var enumValues_P2POrderDisputeRespP2POrderDisputeVerificationPending = []interface{}{ 0, @@ -622,79 +567,99 @@ func (j *P2POrderDisputeRespP2POrderDisputeVerificationPending) UnmarshalJSON(b return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderDisputeRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderDisputeRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespMsgType, v) + } + *j = P2POrderDisputeRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderDisputeRespP2POrderDispute) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_currency"]; raw != nil && !ok { + if v, ok := raw["account_currency"]; !ok || v == nil { return fmt.Errorf("field account_currency in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["advert_details"]; raw != nil && !ok { + if v, ok := raw["advert_details"]; !ok || v == nil { return fmt.Errorf("field advert_details in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["advertiser_details"]; raw != nil && !ok { + if v, ok := raw["advertiser_details"]; !ok || v == nil { return fmt.Errorf("field advertiser_details in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["amount_display"]; raw != nil && !ok { + if v, ok := raw["amount_display"]; !ok || v == nil { return fmt.Errorf("field amount_display in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["chat_channel_url"]; raw != nil && !ok { + if v, ok := raw["chat_channel_url"]; !ok || v == nil { return fmt.Errorf("field chat_channel_url in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["client_details"]; raw != nil && !ok { + if v, ok := raw["client_details"]; !ok || v == nil { return fmt.Errorf("field client_details in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["contact_info"]; raw != nil && !ok { + if v, ok := raw["contact_info"]; !ok || v == nil { return fmt.Errorf("field contact_info in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["dispute_details"]; raw != nil && !ok { + if v, ok := raw["dispute_details"]; !ok || v == nil { return fmt.Errorf("field dispute_details in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["expiry_time"]; raw != nil && !ok { + if v, ok := raw["expiry_time"]; !ok || v == nil { return fmt.Errorf("field expiry_time in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["is_incoming"]; raw != nil && !ok { + if v, ok := raw["is_incoming"]; !ok || v == nil { return fmt.Errorf("field is_incoming in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["is_reviewable"]; raw != nil && !ok { + if v, ok := raw["is_reviewable"]; !ok || v == nil { return fmt.Errorf("field is_reviewable in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["is_seen"]; raw != nil && !ok { + if v, ok := raw["is_seen"]; !ok || v == nil { return fmt.Errorf("field is_seen in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["local_currency"]; raw != nil && !ok { + if v, ok := raw["local_currency"]; !ok || v == nil { return fmt.Errorf("field local_currency in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["payment_info"]; raw != nil && !ok { + if v, ok := raw["payment_info"]; !ok || v == nil { return fmt.Errorf("field payment_info in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["price_display"]; raw != nil && !ok { + if v, ok := raw["price_display"]; !ok || v == nil { return fmt.Errorf("field price_display in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["rate"]; raw != nil && !ok { + if v, ok := raw["rate"]; !ok || v == nil { return fmt.Errorf("field rate in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["rate_display"]; raw != nil && !ok { + if v, ok := raw["rate_display"]; !ok || v == nil { return fmt.Errorf("field rate_display in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["status"]; raw != nil && !ok { + if v, ok := raw["status"]; !ok || v == nil { return fmt.Errorf("field status in P2POrderDisputeRespP2POrderDispute: required") } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in P2POrderDisputeRespP2POrderDispute: required") } type Plain P2POrderDisputeRespP2POrderDispute @@ -706,16 +671,46 @@ func (j *P2POrderDisputeRespP2POrderDispute) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderDisputeRespP2POrderDisputeAdvertiserDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") + } + if v, ok := raw["is_online"]; !ok || v == nil { + return fmt.Errorf("field is_online in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") + } + if v, ok := raw["last_online_time"]; !ok || v == nil { + return fmt.Errorf("field last_online_time in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") + } + if v, ok := raw["loginid"]; !ok || v == nil { + return fmt.Errorf("field loginid in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") + } + if v, ok := raw["name"]; !ok || v == nil { + return fmt.Errorf("field name in P2POrderDisputeRespP2POrderDisputeAdvertiserDetails: required") + } + type Plain P2POrderDisputeRespP2POrderDisputeAdvertiserDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderDisputeRespP2POrderDisputeAdvertiserDetails(plain) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderDisputeResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2POrderDisputeResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2POrderDisputeResp: required") } type Plain P2POrderDisputeResp diff --git a/schema/p2p_order_info.go b/schema/p2p_order_info.go index 8c19488..246845e 100644 --- a/schema/p2p_order_info.go +++ b/schema/p2p_order_info.go @@ -6,29 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieves the information about a P2P order. -type P2POrderInfo struct { - // The unique identifier for the order. - Id string `json:"id"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2POrderInfo P2POrderInfoP2POrderInfo `json:"p2p_order_info"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2POrderInfoPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to 1, will send updates whenever there is an update to order - Subscribe *P2POrderInfoSubscribe `json:"subscribe,omitempty"` -} - type P2POrderInfoP2POrderInfo int var enumValues_P2POrderInfoP2POrderInfo = []interface{}{ @@ -85,16 +62,39 @@ func (j *P2POrderInfoSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Retrieves the information about a P2P order. +type P2POrderInfo struct { + // The unique identifier for the order. + Id string `json:"id"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2POrderInfo P2POrderInfoP2POrderInfo `json:"p2p_order_info"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2POrderInfoPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to 1, will send updates whenever there is an update to order + Subscribe *P2POrderInfoSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderInfo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderInfo: required") } - if _, ok := raw["p2p_order_info"]; raw != nil && !ok { + if v, ok := raw["p2p_order_info"]; !ok || v == nil { return fmt.Errorf("field p2p_order_info in P2POrderInfo: required") } type Plain P2POrderInfo diff --git a/schema/p2p_order_info_resp.go b/schema/p2p_order_info_resp.go index c9dab4e..66a1854 100644 --- a/schema/p2p_order_info_resp.go +++ b/schema/p2p_order_info_resp.go @@ -32,30 +32,6 @@ type P2POrderInfoRespMsgType string const P2POrderInfoRespMsgTypeP2POrderInfo P2POrderInfoRespMsgType = "p2p_order_info" -var enumValues_P2POrderInfoRespMsgType = []interface{}{ - "p2p_order_info", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderInfoRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespMsgType, v) - } - *j = P2POrderInfoRespMsgType(v) - return nil -} - // The information of P2P order. type P2POrderInfoRespP2POrderInfo struct { // The currency of order. @@ -179,91 +155,11 @@ type P2POrderInfoRespP2POrderInfoAdvertDetails struct { type P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade int -var enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade, v) - } - *j = P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade(v) - return nil -} - type P2POrderInfoRespP2POrderInfoAdvertDetailsType string const P2POrderInfoRespP2POrderInfoAdvertDetailsTypeBuy P2POrderInfoRespP2POrderInfoAdvertDetailsType = "buy" const P2POrderInfoRespP2POrderInfoAdvertDetailsTypeSell P2POrderInfoRespP2POrderInfoAdvertDetailsType = "sell" -var enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsType = []interface{}{ - "buy", - "sell", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertDetailsType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsType, v) - } - *j = P2POrderInfoRespP2POrderInfoAdvertDetailsType(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["block_trade"]; raw != nil && !ok { - return fmt.Errorf("field block_trade in P2POrderInfoRespP2POrderInfoAdvertDetails: required") - } - if _, ok := raw["description"]; raw != nil && !ok { - return fmt.Errorf("field description in P2POrderInfoRespP2POrderInfoAdvertDetails: required") - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderInfoRespP2POrderInfoAdvertDetails: required") - } - if _, ok := raw["payment_method"]; raw != nil && !ok { - return fmt.Errorf("field payment_method in P2POrderInfoRespP2POrderInfoAdvertDetails: required") - } - if _, ok := raw["type"]; raw != nil && !ok { - return fmt.Errorf("field type in P2POrderInfoRespP2POrderInfoAdvertDetails: required") - } - type Plain P2POrderInfoRespP2POrderInfoAdvertDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderInfoRespP2POrderInfoAdvertDetails(plain) - return nil -} - // Details of the advertiser for this order. type P2POrderInfoRespP2POrderInfoAdvertiserDetails struct { // The advertiser's first name. @@ -294,98 +190,10 @@ type P2POrderInfoRespP2POrderInfoAdvertiserDetails struct { type P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline int -var enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline, v) - } - *j = P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline(v) - return nil -} - type P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended struct { Value interface{} } -// MarshalJSON implements json.Marshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - -var enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { - var v struct { - Value interface{} - } - if err := json.Unmarshal(b, &v.Value); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended { - if reflect.DeepEqual(v.Value, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended, v.Value) - } - *j = P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") - } - if _, ok := raw["is_online"]; raw != nil && !ok { - return fmt.Errorf("field is_online in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") - } - if _, ok := raw["last_online_time"]; raw != nil && !ok { - return fmt.Errorf("field last_online_time in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") - } - if _, ok := raw["loginid"]; raw != nil && !ok { - return fmt.Errorf("field loginid in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") - } - if _, ok := raw["name"]; raw != nil && !ok { - return fmt.Errorf("field name in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") - } - type Plain P2POrderInfoRespP2POrderInfoAdvertiserDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderInfoRespP2POrderInfoAdvertiserDetails(plain) - return nil -} - // Details of the client who created the order. type P2POrderInfoRespP2POrderInfoClientDetails struct { // The client's first name. @@ -416,33 +224,74 @@ type P2POrderInfoRespP2POrderInfoClientDetails struct { type P2POrderInfoRespP2POrderInfoClientDetailsIsOnline int -var enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsOnline = []interface{}{ - 0, - 1, +type P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended struct { + Value interface{} +} + +// Details of the order dispute. +type P2POrderInfoRespP2POrderInfoDisputeDetails struct { + // The dispute reason + DisputeReason *string `json:"dispute_reason"` + + // The loginid of the client who's raising the dispute + DisputerLoginid *string `json:"disputer_loginid"` } +type P2POrderInfoRespP2POrderInfoIsIncoming int + +type P2POrderInfoRespP2POrderInfoIsReviewable int + +type P2POrderInfoRespP2POrderInfoIsSeen int + +// Details of available payment methods. +type P2POrderInfoRespP2POrderInfoPaymentMethodDetails map[string]interface{} + +// Details of the review you gave for this order, if any. +type P2POrderInfoRespP2POrderInfoReviewDetails struct { + // The epoch time of the review. + CreatedTime int `json:"created_time"` + + // Rating for the transaction, 1 to 5. + Rating int `json:"rating"` + + // `1` if the advertiser is recommended, `0` if not recommended. + Recommended P2POrderInfoRespP2POrderInfoReviewDetailsRecommended `json:"recommended"` +} + +type P2POrderInfoRespP2POrderInfoReviewDetailsRecommended struct { + Value interface{} +} + +type P2POrderInfoRespP2POrderInfoStatus string + +const P2POrderInfoRespP2POrderInfoStatusBlocked P2POrderInfoRespP2POrderInfoStatus = "blocked" +const P2POrderInfoRespP2POrderInfoStatusBuyerConfirmed P2POrderInfoRespP2POrderInfoStatus = "buyer-confirmed" +const P2POrderInfoRespP2POrderInfoStatusCancelled P2POrderInfoRespP2POrderInfoStatus = "cancelled" + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespP2POrderInfoClientDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int +func (j *P2POrderInfoRespP2POrderInfoAdvertDetailsType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsOnline { + for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsType, v) } - *j = P2POrderInfoRespP2POrderInfoClientDetailsIsOnline(v) + *j = P2POrderInfoRespP2POrderInfoAdvertDetailsType(v) return nil } -type P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended struct { - Value interface{} +var enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended = []interface{}{ + nil, + 0.0, + 1.0, } // MarshalJSON implements json.Marshaler. @@ -450,12 +299,6 @@ func (j *P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended) MarshalJSON() ( return json.Marshal(j.Value) } -var enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, -} - // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -478,19 +321,24 @@ func (j *P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended) UnmarshalJSON(b return nil } +var enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsOnline = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderInfoRespP2POrderInfoClientDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderInfoRespP2POrderInfoClientDetails: required") } - if _, ok := raw["loginid"]; raw != nil && !ok { + if v, ok := raw["loginid"]; !ok || v == nil { return fmt.Errorf("field loginid in P2POrderInfoRespP2POrderInfoClientDetails: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in P2POrderInfoRespP2POrderInfoClientDetails: required") } type Plain P2POrderInfoRespP2POrderInfoClientDetails @@ -502,13 +350,34 @@ func (j *P2POrderInfoRespP2POrderInfoClientDetails) UnmarshalJSON(b []byte) erro return nil } -// Details of the order dispute. -type P2POrderInfoRespP2POrderInfoDisputeDetails struct { - // The dispute reason - DisputeReason *string `json:"dispute_reason"` - - // The loginid of the client who's raising the dispute - DisputerLoginid *string `json:"disputer_loginid"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") + } + if v, ok := raw["is_online"]; !ok || v == nil { + return fmt.Errorf("field is_online in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") + } + if v, ok := raw["last_online_time"]; !ok || v == nil { + return fmt.Errorf("field last_online_time in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") + } + if v, ok := raw["loginid"]; !ok || v == nil { + return fmt.Errorf("field loginid in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") + } + if v, ok := raw["name"]; !ok || v == nil { + return fmt.Errorf("field name in P2POrderInfoRespP2POrderInfoAdvertiserDetails: required") + } + type Plain P2POrderInfoRespP2POrderInfoAdvertiserDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderInfoRespP2POrderInfoAdvertiserDetails(plain) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -517,10 +386,10 @@ func (j *P2POrderInfoRespP2POrderInfoDisputeDetails) UnmarshalJSON(b []byte) err if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["dispute_reason"]; raw != nil && !ok { + if v, ok := raw["dispute_reason"]; !ok || v == nil { return fmt.Errorf("field dispute_reason in P2POrderInfoRespP2POrderInfoDisputeDetails: required") } - if _, ok := raw["disputer_loginid"]; raw != nil && !ok { + if v, ok := raw["disputer_loginid"]; !ok || v == nil { return fmt.Errorf("field disputer_loginid in P2POrderInfoRespP2POrderInfoDisputeDetails: required") } type Plain P2POrderInfoRespP2POrderInfoDisputeDetails @@ -532,7 +401,27 @@ func (j *P2POrderInfoRespP2POrderInfoDisputeDetails) UnmarshalJSON(b []byte) err return nil } -type P2POrderInfoRespP2POrderInfoIsIncoming int +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { + var v struct { + Value interface{} + } + if err := json.Unmarshal(b, &v.Value); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended { + if reflect.DeepEqual(v.Value, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended, v.Value) + } + *j = P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended(v) + return nil +} var enumValues_P2POrderInfoRespP2POrderInfoIsIncoming = []interface{}{ 0, @@ -559,7 +448,10 @@ func (j *P2POrderInfoRespP2POrderInfoIsIncoming) UnmarshalJSON(b []byte) error { return nil } -type P2POrderInfoRespP2POrderInfoIsReviewable int +// MarshalJSON implements json.Marshaler. +func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} var enumValues_P2POrderInfoRespP2POrderInfoIsReviewable = []interface{}{ 0, @@ -586,8 +478,11 @@ func (j *P2POrderInfoRespP2POrderInfoIsReviewable) UnmarshalJSON(b []byte) error return nil } -type P2POrderInfoRespP2POrderInfoIsSeen int - +var enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended = []interface{}{ + nil, + 0.0, + 1.0, +} var enumValues_P2POrderInfoRespP2POrderInfoIsSeen = []interface{}{ 1, 0, @@ -613,36 +508,41 @@ func (j *P2POrderInfoRespP2POrderInfoIsSeen) UnmarshalJSON(b []byte) error { return nil } -// Details of available payment methods. -type P2POrderInfoRespP2POrderInfoPaymentMethodDetails map[string]interface{} - -// Details of the review you gave for this order, if any. -type P2POrderInfoRespP2POrderInfoReviewDetails struct { - // The epoch time of the review. - CreatedTime int `json:"created_time"` - - // Rating for the transaction, 1 to 5. - Rating int `json:"rating"` - - // `1` if the advertiser is recommended, `0` if not recommended. - Recommended P2POrderInfoRespP2POrderInfoReviewDetailsRecommended `json:"recommended"` -} - -type P2POrderInfoRespP2POrderInfoReviewDetailsRecommended struct { - Value interface{} +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline, v) + } + *j = P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline(v) + return nil } -// MarshalJSON implements json.Marshaler. -func (j *P2POrderInfoRespP2POrderInfoReviewDetailsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) +var enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, } - var enumValues_P2POrderInfoRespP2POrderInfoReviewDetailsRecommended = []interface{}{ nil, 0.0, 1.0, } +// MarshalJSON implements json.Marshaler. +func (j *P2POrderInfoRespP2POrderInfoReviewDetailsRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderInfoRespP2POrderInfoReviewDetailsRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -665,19 +565,49 @@ func (j *P2POrderInfoRespP2POrderInfoReviewDetailsRecommended) UnmarshalJSON(b [ return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderInfoRespP2POrderInfoAdvertDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["block_trade"]; !ok || v == nil { + return fmt.Errorf("field block_trade in P2POrderInfoRespP2POrderInfoAdvertDetails: required") + } + if v, ok := raw["description"]; !ok || v == nil { + return fmt.Errorf("field description in P2POrderInfoRespP2POrderInfoAdvertDetails: required") + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderInfoRespP2POrderInfoAdvertDetails: required") + } + if v, ok := raw["payment_method"]; !ok || v == nil { + return fmt.Errorf("field payment_method in P2POrderInfoRespP2POrderInfoAdvertDetails: required") + } + if v, ok := raw["type"]; !ok || v == nil { + return fmt.Errorf("field type in P2POrderInfoRespP2POrderInfoAdvertDetails: required") + } + type Plain P2POrderInfoRespP2POrderInfoAdvertDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderInfoRespP2POrderInfoAdvertDetails(plain) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderInfoRespP2POrderInfoReviewDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2POrderInfoRespP2POrderInfoReviewDetails: required") } - if _, ok := raw["rating"]; raw != nil && !ok { + if v, ok := raw["rating"]; !ok || v == nil { return fmt.Errorf("field rating in P2POrderInfoRespP2POrderInfoReviewDetails: required") } - if _, ok := raw["recommended"]; raw != nil && !ok { + if v, ok := raw["recommended"]; !ok || v == nil { return fmt.Errorf("field recommended in P2POrderInfoRespP2POrderInfoReviewDetails: required") } type Plain P2POrderInfoRespP2POrderInfoReviewDetails @@ -689,18 +619,25 @@ func (j *P2POrderInfoRespP2POrderInfoReviewDetails) UnmarshalJSON(b []byte) erro return nil } -type P2POrderInfoRespP2POrderInfoStatus string - -const P2POrderInfoRespP2POrderInfoStatusBlocked P2POrderInfoRespP2POrderInfoStatus = "blocked" -const P2POrderInfoRespP2POrderInfoStatusBuyerConfirmed P2POrderInfoRespP2POrderInfoStatus = "buyer-confirmed" -const P2POrderInfoRespP2POrderInfoStatusCancelled P2POrderInfoRespP2POrderInfoStatus = "cancelled" -const P2POrderInfoRespP2POrderInfoStatusCompleted P2POrderInfoRespP2POrderInfoStatus = "completed" -const P2POrderInfoRespP2POrderInfoStatusDisputeCompleted P2POrderInfoRespP2POrderInfoStatus = "dispute-completed" -const P2POrderInfoRespP2POrderInfoStatusDisputeRefunded P2POrderInfoRespP2POrderInfoStatus = "dispute-refunded" -const P2POrderInfoRespP2POrderInfoStatusDisputed P2POrderInfoRespP2POrderInfoStatus = "disputed" -const P2POrderInfoRespP2POrderInfoStatusPending P2POrderInfoRespP2POrderInfoStatus = "pending" -const P2POrderInfoRespP2POrderInfoStatusRefunded P2POrderInfoRespP2POrderInfoStatus = "refunded" -const P2POrderInfoRespP2POrderInfoStatusTimedOut P2POrderInfoRespP2POrderInfoStatus = "timed-out" +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderInfoRespP2POrderInfoClientDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsOnline { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsOnline, v) + } + *j = P2POrderInfoRespP2POrderInfoClientDetailsIsOnline(v) + return nil +} var enumValues_P2POrderInfoRespP2POrderInfoStatus = []interface{}{ "pending", @@ -735,10 +672,47 @@ func (j *P2POrderInfoRespP2POrderInfoStatus) UnmarshalJSON(b []byte) error { return nil } -type P2POrderInfoRespP2POrderInfoType string +const P2POrderInfoRespP2POrderInfoStatusPending P2POrderInfoRespP2POrderInfoStatus = "pending" -const P2POrderInfoRespP2POrderInfoTypeBuy P2POrderInfoRespP2POrderInfoType = "buy" -const P2POrderInfoRespP2POrderInfoTypeSell P2POrderInfoRespP2POrderInfoType = "sell" +var enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsType = []interface{}{ + "buy", + "sell", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade, v) + } + *j = P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade(v) + return nil +} + +const P2POrderInfoRespP2POrderInfoStatusTimedOut P2POrderInfoRespP2POrderInfoStatus = "timed-out" + +var enumValues_P2POrderInfoRespP2POrderInfoAdvertDetailsBlockTrade = []interface{}{ + 0, + 1, +} + +const P2POrderInfoRespP2POrderInfoStatusRefunded P2POrderInfoRespP2POrderInfoStatus = "refunded" +const P2POrderInfoRespP2POrderInfoStatusCompleted P2POrderInfoRespP2POrderInfoStatus = "completed" +const P2POrderInfoRespP2POrderInfoStatusDisputed P2POrderInfoRespP2POrderInfoStatus = "disputed" +const P2POrderInfoRespP2POrderInfoStatusDisputeRefunded P2POrderInfoRespP2POrderInfoStatus = "dispute-refunded" +const P2POrderInfoRespP2POrderInfoStatusDisputeCompleted P2POrderInfoRespP2POrderInfoStatus = "dispute-completed" + +type P2POrderInfoRespP2POrderInfoType string var enumValues_P2POrderInfoRespP2POrderInfoType = []interface{}{ "buy", @@ -765,6 +739,9 @@ func (j *P2POrderInfoRespP2POrderInfoType) UnmarshalJSON(b []byte) error { return nil } +const P2POrderInfoRespP2POrderInfoTypeBuy P2POrderInfoRespP2POrderInfoType = "buy" +const P2POrderInfoRespP2POrderInfoTypeSell P2POrderInfoRespP2POrderInfoType = "sell" + type P2POrderInfoRespP2POrderInfoVerificationPending int var enumValues_P2POrderInfoRespP2POrderInfoVerificationPending = []interface{}{ @@ -792,76 +769,96 @@ func (j *P2POrderInfoRespP2POrderInfoVerificationPending) UnmarshalJSON(b []byte return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderInfoRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderInfoRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespMsgType, v) + } + *j = P2POrderInfoRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderInfoRespP2POrderInfo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_currency"]; raw != nil && !ok { + if v, ok := raw["account_currency"]; !ok || v == nil { return fmt.Errorf("field account_currency in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["advert_details"]; raw != nil && !ok { + if v, ok := raw["advert_details"]; !ok || v == nil { return fmt.Errorf("field advert_details in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["advertiser_details"]; raw != nil && !ok { + if v, ok := raw["advertiser_details"]; !ok || v == nil { return fmt.Errorf("field advertiser_details in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["amount_display"]; raw != nil && !ok { + if v, ok := raw["amount_display"]; !ok || v == nil { return fmt.Errorf("field amount_display in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["chat_channel_url"]; raw != nil && !ok { + if v, ok := raw["chat_channel_url"]; !ok || v == nil { return fmt.Errorf("field chat_channel_url in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["client_details"]; raw != nil && !ok { + if v, ok := raw["client_details"]; !ok || v == nil { return fmt.Errorf("field client_details in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["contact_info"]; raw != nil && !ok { + if v, ok := raw["contact_info"]; !ok || v == nil { return fmt.Errorf("field contact_info in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["dispute_details"]; raw != nil && !ok { + if v, ok := raw["dispute_details"]; !ok || v == nil { return fmt.Errorf("field dispute_details in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["expiry_time"]; raw != nil && !ok { + if v, ok := raw["expiry_time"]; !ok || v == nil { return fmt.Errorf("field expiry_time in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["is_incoming"]; raw != nil && !ok { + if v, ok := raw["is_incoming"]; !ok || v == nil { return fmt.Errorf("field is_incoming in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["is_reviewable"]; raw != nil && !ok { + if v, ok := raw["is_reviewable"]; !ok || v == nil { return fmt.Errorf("field is_reviewable in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["local_currency"]; raw != nil && !ok { + if v, ok := raw["local_currency"]; !ok || v == nil { return fmt.Errorf("field local_currency in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["payment_info"]; raw != nil && !ok { + if v, ok := raw["payment_info"]; !ok || v == nil { return fmt.Errorf("field payment_info in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["price_display"]; raw != nil && !ok { + if v, ok := raw["price_display"]; !ok || v == nil { return fmt.Errorf("field price_display in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["rate"]; raw != nil && !ok { + if v, ok := raw["rate"]; !ok || v == nil { return fmt.Errorf("field rate in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["rate_display"]; raw != nil && !ok { + if v, ok := raw["rate_display"]; !ok || v == nil { return fmt.Errorf("field rate_display in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["status"]; raw != nil && !ok { + if v, ok := raw["status"]; !ok || v == nil { return fmt.Errorf("field status in P2POrderInfoRespP2POrderInfo: required") } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in P2POrderInfoRespP2POrderInfo: required") } type Plain P2POrderInfoRespP2POrderInfo @@ -886,7 +883,7 @@ func (j *P2POrderInfoRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderInfoRespSubscription: required") } type Plain P2POrderInfoRespSubscription @@ -898,16 +895,20 @@ func (j *P2POrderInfoRespSubscription) UnmarshalJSON(b []byte) error { return nil } +var enumValues_P2POrderInfoRespMsgType = []interface{}{ + "p2p_order_info", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderInfoResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2POrderInfoResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2POrderInfoResp: required") } type Plain P2POrderInfoResp diff --git a/schema/p2p_order_list.go b/schema/p2p_order_list.go index 816e2d3..05323e0 100644 --- a/schema/p2p_order_list.go +++ b/schema/p2p_order_list.go @@ -6,47 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// List active orders. -type P2POrderList struct { - // [Optional] Should be 1 to list active, 0 to list inactive (historical). - Active *P2POrderListActive `json:"active,omitempty"` - - // [Optional] If present, lists orders applying to a specific advert. - AdvertId *string `json:"advert_id,omitempty"` - - // [Optional] Filter the orders created after this date(included) format(epoch or - // YYYY-MM-DD) - DateFrom *string `json:"date_from,omitempty"` - - // [Optional] Filter the orders created before this date(included) format(epoch or - // YYYY-MM-DD) - DateTo *string `json:"date_to,omitempty"` - - // [Optional] Used for paging. - Limit int `json:"limit,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used for paging. - Offset int `json:"offset,omitempty"` - - // Must be 1 - P2POrderList P2POrderListP2POrderList `json:"p2p_order_list"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2POrderListPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to 1, will send updates whenever there is a change to any - // order belonging to you. - Subscribe *P2POrderListSubscribe `json:"subscribe,omitempty"` -} - type P2POrderListActive float64 var enumValues_P2POrderListActive = []interface{}{ @@ -130,13 +89,54 @@ func (j *P2POrderListSubscribe) UnmarshalJSON(b []byte) error { return nil } +// List active orders. +type P2POrderList struct { + // [Optional] Should be 1 to list active, 0 to list inactive (historical). + Active *P2POrderListActive `json:"active,omitempty"` + + // [Optional] If present, lists orders applying to a specific advert. + AdvertId *string `json:"advert_id,omitempty"` + + // [Optional] Filter the orders created after this date(included) format(epoch or + // YYYY-MM-DD) + DateFrom *string `json:"date_from,omitempty"` + + // [Optional] Filter the orders created before this date(included) format(epoch or + // YYYY-MM-DD) + DateTo *string `json:"date_to,omitempty"` + + // [Optional] Used for paging. + Limit int `json:"limit,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used for paging. + Offset int `json:"offset,omitempty"` + + // Must be 1 + P2POrderList P2POrderListP2POrderList `json:"p2p_order_list"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2POrderListPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to 1, will send updates whenever there is a change to any + // order belonging to you. + Subscribe *P2POrderListSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderList) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_order_list"]; raw != nil && !ok { + if v, ok := raw["p2p_order_list"]; !ok || v == nil { return fmt.Errorf("field p2p_order_list in P2POrderList: required") } type Plain P2POrderList diff --git a/schema/p2p_order_list_resp.go b/schema/p2p_order_list_resp.go index 63da3d0..5a73e30 100644 --- a/schema/p2p_order_list_resp.go +++ b/schema/p2p_order_list_resp.go @@ -32,30 +32,6 @@ type P2POrderListRespMsgType string const P2POrderListRespMsgTypeP2POrderList P2POrderListRespMsgType = "p2p_order_list" -var enumValues_P2POrderListRespMsgType = []interface{}{ - "p2p_order_list", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderListRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespMsgType, v) - } - *j = P2POrderListRespMsgType(v) - return nil -} - // List of P2P orders. type P2POrderListRespP2POrderList struct { // List of orders. @@ -181,91 +157,11 @@ type P2POrderListRespP2POrderListListElemAdvertDetails struct { type P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade int -var enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade, v) - } - *j = P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade(v) - return nil -} - type P2POrderListRespP2POrderListListElemAdvertDetailsType string const P2POrderListRespP2POrderListListElemAdvertDetailsTypeBuy P2POrderListRespP2POrderListListElemAdvertDetailsType = "buy" const P2POrderListRespP2POrderListListElemAdvertDetailsTypeSell P2POrderListRespP2POrderListListElemAdvertDetailsType = "sell" -var enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsType = []interface{}{ - "buy", - "sell", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertDetailsType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsType, v) - } - *j = P2POrderListRespP2POrderListListElemAdvertDetailsType(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["block_trade"]; raw != nil && !ok { - return fmt.Errorf("field block_trade in P2POrderListRespP2POrderListListElemAdvertDetails: required") - } - if _, ok := raw["description"]; raw != nil && !ok { - return fmt.Errorf("field description in P2POrderListRespP2POrderListListElemAdvertDetails: required") - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemAdvertDetails: required") - } - if _, ok := raw["payment_method"]; raw != nil && !ok { - return fmt.Errorf("field payment_method in P2POrderListRespP2POrderListListElemAdvertDetails: required") - } - if _, ok := raw["type"]; raw != nil && !ok { - return fmt.Errorf("field type in P2POrderListRespP2POrderListListElemAdvertDetails: required") - } - type Plain P2POrderListRespP2POrderListListElemAdvertDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderListRespP2POrderListListElemAdvertDetails(plain) - return nil -} - // Details of the advertiser for this order. type P2POrderListRespP2POrderListListElemAdvertiserDetails struct { // The advertiser's first name. @@ -296,98 +192,10 @@ type P2POrderListRespP2POrderListListElemAdvertiserDetails struct { type P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline int -var enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline, v) - } - *j = P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline(v) - return nil -} - type P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended struct { Value interface{} } -// MarshalJSON implements json.Marshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - -var enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { - var v struct { - Value interface{} - } - if err := json.Unmarshal(b, &v.Value); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended { - if reflect.DeepEqual(v.Value, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended, v.Value) - } - *j = P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertiserDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") - } - if _, ok := raw["is_online"]; raw != nil && !ok { - return fmt.Errorf("field is_online in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") - } - if _, ok := raw["last_online_time"]; raw != nil && !ok { - return fmt.Errorf("field last_online_time in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") - } - if _, ok := raw["loginid"]; raw != nil && !ok { - return fmt.Errorf("field loginid in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") - } - if _, ok := raw["name"]; raw != nil && !ok { - return fmt.Errorf("field name in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") - } - type Plain P2POrderListRespP2POrderListListElemAdvertiserDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2POrderListRespP2POrderListListElemAdvertiserDetails(plain) - return nil -} - // Details of the client who created the order. type P2POrderListRespP2POrderListListElemClientDetails struct { // The client's first name. @@ -418,46 +226,83 @@ type P2POrderListRespP2POrderListListElemClientDetails struct { type P2POrderListRespP2POrderListListElemClientDetailsIsOnline int -var enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsOnline = []interface{}{ - 0, - 1, +type P2POrderListRespP2POrderListListElemClientDetailsIsRecommended struct { + Value interface{} +} + +// Details of the order dispute. +type P2POrderListRespP2POrderListListElemDisputeDetails struct { + // The dispute reason + DisputeReason *string `json:"dispute_reason"` + + // The loginid of the client who's raising the dispute + DisputerLoginid *string `json:"disputer_loginid"` +} + +type P2POrderListRespP2POrderListListElemIsIncoming int + +type P2POrderListRespP2POrderListListElemIsReviewable int + +type P2POrderListRespP2POrderListListElemIsSeen int + +// Details of the review you gave for this order, if any. +type P2POrderListRespP2POrderListListElemReviewDetails struct { + // The epoch time of the review. + CreatedTime int `json:"created_time"` + + // Rating for the transaction, 1 to 5. + Rating int `json:"rating"` + + // `1` if the advertiser is recommended, `0` if not recommended. + Recommended P2POrderListRespP2POrderListListElemReviewDetailsRecommended `json:"recommended"` +} + +type P2POrderListRespP2POrderListListElemReviewDetailsRecommended struct { + Value interface{} +} + +type P2POrderListRespP2POrderListListElemStatus string + +const P2POrderListRespP2POrderListListElemStatusBlocked P2POrderListRespP2POrderListListElemStatus = "blocked" +const P2POrderListRespP2POrderListListElemStatusBuyerConfirmed P2POrderListRespP2POrderListListElemStatus = "buyer-confirmed" +const P2POrderListRespP2POrderListListElemStatusCancelled P2POrderListRespP2POrderListListElemStatus = "cancelled" +const P2POrderListRespP2POrderListListElemStatusCompleted P2POrderListRespP2POrderListListElemStatus = "completed" +const P2POrderListRespP2POrderListListElemStatusDisputeCompleted P2POrderListRespP2POrderListListElemStatus = "dispute-completed" +const P2POrderListRespP2POrderListListElemStatusDisputeRefunded P2POrderListRespP2POrderListListElemStatus = "dispute-refunded" +const P2POrderListRespP2POrderListListElemStatusDisputed P2POrderListRespP2POrderListListElemStatus = "disputed" +const P2POrderListRespP2POrderListListElemStatusPending P2POrderListRespP2POrderListListElemStatus = "pending" +const P2POrderListRespP2POrderListListElemStatusRefunded P2POrderListRespP2POrderListListElemStatus = "refunded" +const P2POrderListRespP2POrderListListElemStatusTimedOut P2POrderListRespP2POrderListListElemStatus = "timed-out" + +type P2POrderListRespP2POrderListListElemType string + +const P2POrderListRespP2POrderListListElemTypeBuy P2POrderListRespP2POrderListListElemType = "buy" + +// MarshalJSON implements json.Marshaler. +func (j *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemClientDetailsIsOnline) UnmarshalJSON(b []byte) error { +func (j *P2POrderListRespP2POrderListListElemIsIncoming) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsOnline { + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsIncoming { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsIncoming, v) } - *j = P2POrderListRespP2POrderListListElemClientDetailsIsOnline(v) + *j = P2POrderListRespP2POrderListListElemIsIncoming(v) return nil } -type P2POrderListRespP2POrderListListElemClientDetailsIsRecommended struct { - Value interface{} -} - -// MarshalJSON implements json.Marshaler. -func (j *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - -var enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, -} - // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -480,165 +325,228 @@ func (j *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended) Unmarsh return nil } +var enumValues_P2POrderListRespP2POrderListListElemIsReviewable = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemClientDetails) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *P2POrderListRespP2POrderListListElemIsReviewable) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemClientDetails: required") + var ok bool + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsReviewable { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - if _, ok := raw["is_online"]; raw != nil && !ok { - return fmt.Errorf("field is_online in P2POrderListRespP2POrderListListElemClientDetails: required") + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsReviewable, v) } - if _, ok := raw["last_online_time"]; raw != nil && !ok { - return fmt.Errorf("field last_online_time in P2POrderListRespP2POrderListListElemClientDetails: required") + *j = P2POrderListRespP2POrderListListElemIsReviewable(v) + return nil +} + +var enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsRecommended = []interface{}{ + nil, + 0.0, + 1.0, +} +var enumValues_P2POrderListRespP2POrderListListElemIsSeen = []interface{}{ + 1, + 0, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderListRespP2POrderListListElemIsSeen) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err } - if _, ok := raw["loginid"]; raw != nil && !ok { - return fmt.Errorf("field loginid in P2POrderListRespP2POrderListListElemClientDetails: required") + var ok bool + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsSeen { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - if _, ok := raw["name"]; raw != nil && !ok { - return fmt.Errorf("field name in P2POrderListRespP2POrderListListElemClientDetails: required") + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsSeen, v) } - type Plain P2POrderListRespP2POrderListListElemClientDetails - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { + *j = P2POrderListRespP2POrderListListElemIsSeen(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderListRespP2POrderListListElemClientDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - *j = P2POrderListRespP2POrderListListElemClientDetails(plain) + var ok bool + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsOnline { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsOnline, v) + } + *j = P2POrderListRespP2POrderListListElemClientDetailsIsOnline(v) return nil } -// Details of the order dispute. -type P2POrderListRespP2POrderListListElemDisputeDetails struct { - // The dispute reason - DisputeReason *string `json:"dispute_reason"` +var enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended = []interface{}{ + nil, + 0.0, + 1.0, +} - // The loginid of the client who's raising the dispute - DisputerLoginid *string `json:"disputer_loginid"` +// MarshalJSON implements json.Marshaler. +func (j *P2POrderListRespP2POrderListListElemReviewDetailsRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemDisputeDetails) UnmarshalJSON(b []byte) error { +func (j *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline, v) + } + *j = P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline(v) + return nil +} + +var enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsOnline = []interface{}{ + 0, + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderListRespP2POrderListListElemReviewDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["dispute_reason"]; raw != nil && !ok { - return fmt.Errorf("field dispute_reason in P2POrderListRespP2POrderListListElemDisputeDetails: required") + if v, ok := raw["created_time"]; !ok || v == nil { + return fmt.Errorf("field created_time in P2POrderListRespP2POrderListListElemReviewDetails: required") } - if _, ok := raw["disputer_loginid"]; raw != nil && !ok { - return fmt.Errorf("field disputer_loginid in P2POrderListRespP2POrderListListElemDisputeDetails: required") + if v, ok := raw["rating"]; !ok || v == nil { + return fmt.Errorf("field rating in P2POrderListRespP2POrderListListElemReviewDetails: required") } - type Plain P2POrderListRespP2POrderListListElemDisputeDetails + if v, ok := raw["recommended"]; !ok || v == nil { + return fmt.Errorf("field recommended in P2POrderListRespP2POrderListListElemReviewDetails: required") + } + type Plain P2POrderListRespP2POrderListListElemReviewDetails var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = P2POrderListRespP2POrderListListElemDisputeDetails(plain) - return nil -} - -type P2POrderListRespP2POrderListListElemIsIncoming int - -var enumValues_P2POrderListRespP2POrderListListElemIsIncoming = []interface{}{ - 0, - 1, + *j = P2POrderListRespP2POrderListListElemReviewDetails(plain) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemIsIncoming) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *P2POrderListRespP2POrderListListElemAdvertiserDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { return err } - var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsIncoming { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsIncoming, v) + if v, ok := raw["is_online"]; !ok || v == nil { + return fmt.Errorf("field is_online in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") } - *j = P2POrderListRespP2POrderListListElemIsIncoming(v) + if v, ok := raw["last_online_time"]; !ok || v == nil { + return fmt.Errorf("field last_online_time in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") + } + if v, ok := raw["loginid"]; !ok || v == nil { + return fmt.Errorf("field loginid in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") + } + if v, ok := raw["name"]; !ok || v == nil { + return fmt.Errorf("field name in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") + } + type Plain P2POrderListRespP2POrderListListElemAdvertiserDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderListRespP2POrderListListElemAdvertiserDetails(plain) return nil } -type P2POrderListRespP2POrderListListElemIsReviewable int - -var enumValues_P2POrderListRespP2POrderListListElemIsReviewable = []interface{}{ - 0, - 1, +var enumValues_P2POrderListRespP2POrderListListElemStatus = []interface{}{ + "pending", + "buyer-confirmed", + "cancelled", + "timed-out", + "blocked", + "refunded", + "completed", + "disputed", + "dispute-refunded", + "dispute-completed", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemIsReviewable) UnmarshalJSON(b []byte) error { - var v int +func (j *P2POrderListRespP2POrderListListElemStatus) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsReviewable { + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsReviewable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemStatus, v) } - *j = P2POrderListRespP2POrderListListElemIsReviewable(v) + *j = P2POrderListRespP2POrderListListElemStatus(v) return nil } -type P2POrderListRespP2POrderListListElemIsSeen int - -var enumValues_P2POrderListRespP2POrderListListElemIsSeen = []interface{}{ - 1, - 0, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemIsSeen) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { + var v struct { + Value interface{} + } + if err := json.Unmarshal(b, &v.Value); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsSeen { - if reflect.DeepEqual(v, expected) { + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended { + if reflect.DeepEqual(v.Value, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsSeen, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended, v.Value) } - *j = P2POrderListRespP2POrderListListElemIsSeen(v) + *j = P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended(v) return nil } -// Details of the review you gave for this order, if any. -type P2POrderListRespP2POrderListListElemReviewDetails struct { - // The epoch time of the review. - CreatedTime int `json:"created_time"` - - // Rating for the transaction, 1 to 5. - Rating int `json:"rating"` - - // `1` if the advertiser is recommended, `0` if not recommended. - Recommended P2POrderListRespP2POrderListListElemReviewDetailsRecommended `json:"recommended"` -} - -type P2POrderListRespP2POrderListListElemReviewDetailsRecommended struct { - Value interface{} -} - // MarshalJSON implements json.Marshaler. -func (j *P2POrderListRespP2POrderListListElemReviewDetailsRecommended) MarshalJSON() ([]byte, error) { +func (j *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { return json.Marshal(j.Value) } @@ -647,6 +555,10 @@ var enumValues_P2POrderListRespP2POrderListListElemReviewDetailsRecommended = [] 0.0, 1.0, } +var enumValues_P2POrderListRespP2POrderListListElemIsIncoming = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderListRespP2POrderListListElemReviewDetailsRecommended) UnmarshalJSON(b []byte) error { @@ -670,80 +582,106 @@ func (j *P2POrderListRespP2POrderListListElemReviewDetailsRecommended) Unmarshal return nil } +var enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemReviewDetails) UnmarshalJSON(b []byte) error { +func (j *P2POrderListRespP2POrderListListElemAdvertDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["created_time"]; raw != nil && !ok { - return fmt.Errorf("field created_time in P2POrderListRespP2POrderListListElemReviewDetails: required") + if v, ok := raw["block_trade"]; !ok || v == nil { + return fmt.Errorf("field block_trade in P2POrderListRespP2POrderListListElemAdvertDetails: required") } - if _, ok := raw["rating"]; raw != nil && !ok { - return fmt.Errorf("field rating in P2POrderListRespP2POrderListListElemReviewDetails: required") + if v, ok := raw["description"]; !ok || v == nil { + return fmt.Errorf("field description in P2POrderListRespP2POrderListListElemAdvertDetails: required") } - if _, ok := raw["recommended"]; raw != nil && !ok { - return fmt.Errorf("field recommended in P2POrderListRespP2POrderListListElemReviewDetails: required") + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemAdvertDetails: required") } - type Plain P2POrderListRespP2POrderListListElemReviewDetails + if v, ok := raw["payment_method"]; !ok || v == nil { + return fmt.Errorf("field payment_method in P2POrderListRespP2POrderListListElemAdvertDetails: required") + } + if v, ok := raw["type"]; !ok || v == nil { + return fmt.Errorf("field type in P2POrderListRespP2POrderListListElemAdvertDetails: required") + } + type Plain P2POrderListRespP2POrderListListElemAdvertDetails var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = P2POrderListRespP2POrderListListElemReviewDetails(plain) + *j = P2POrderListRespP2POrderListListElemAdvertDetails(plain) return nil } -type P2POrderListRespP2POrderListListElemStatus string - -const P2POrderListRespP2POrderListListElemStatusBlocked P2POrderListRespP2POrderListListElemStatus = "blocked" -const P2POrderListRespP2POrderListListElemStatusBuyerConfirmed P2POrderListRespP2POrderListListElemStatus = "buyer-confirmed" -const P2POrderListRespP2POrderListListElemStatusCancelled P2POrderListRespP2POrderListListElemStatus = "cancelled" -const P2POrderListRespP2POrderListListElemStatusCompleted P2POrderListRespP2POrderListListElemStatus = "completed" -const P2POrderListRespP2POrderListListElemStatusDisputeCompleted P2POrderListRespP2POrderListListElemStatus = "dispute-completed" -const P2POrderListRespP2POrderListListElemStatusDisputeRefunded P2POrderListRespP2POrderListListElemStatus = "dispute-refunded" -const P2POrderListRespP2POrderListListElemStatusDisputed P2POrderListRespP2POrderListListElemStatus = "disputed" -const P2POrderListRespP2POrderListListElemStatusPending P2POrderListRespP2POrderListListElemStatus = "pending" -const P2POrderListRespP2POrderListListElemStatusRefunded P2POrderListRespP2POrderListListElemStatus = "refunded" -const P2POrderListRespP2POrderListListElemStatusTimedOut P2POrderListRespP2POrderListListElemStatus = "timed-out" +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderListRespP2POrderListListElemAdvertDetailsType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsType, v) + } + *j = P2POrderListRespP2POrderListListElemAdvertDetailsType(v) + return nil +} -var enumValues_P2POrderListRespP2POrderListListElemStatus = []interface{}{ - "pending", - "buyer-confirmed", - "cancelled", - "timed-out", - "blocked", - "refunded", - "completed", - "disputed", - "dispute-refunded", - "dispute-completed", +var enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsType = []interface{}{ + "buy", + "sell", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemStatus) UnmarshalJSON(b []byte) error { - var v string +func (j *P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemStatus { + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade, v) } - *j = P2POrderListRespP2POrderListListElemStatus(v) + *j = P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade(v) return nil } -type P2POrderListRespP2POrderListListElemType string - -const P2POrderListRespP2POrderListListElemTypeBuy P2POrderListRespP2POrderListListElemType = "buy" -const P2POrderListRespP2POrderListListElemTypeSell P2POrderListRespP2POrderListListElemType = "sell" +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderListRespP2POrderListListElemDisputeDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["dispute_reason"]; !ok || v == nil { + return fmt.Errorf("field dispute_reason in P2POrderListRespP2POrderListListElemDisputeDetails: required") + } + if v, ok := raw["disputer_loginid"]; !ok || v == nil { + return fmt.Errorf("field disputer_loginid in P2POrderListRespP2POrderListListElemDisputeDetails: required") + } + type Plain P2POrderListRespP2POrderListListElemDisputeDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderListRespP2POrderListListElemDisputeDetails(plain) + return nil +} var enumValues_P2POrderListRespP2POrderListListElemType = []interface{}{ "buy", @@ -770,6 +708,38 @@ func (j *P2POrderListRespP2POrderListListElemType) UnmarshalJSON(b []byte) error return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderListRespP2POrderListListElemClientDetails) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemClientDetails: required") + } + if v, ok := raw["is_online"]; !ok || v == nil { + return fmt.Errorf("field is_online in P2POrderListRespP2POrderListListElemClientDetails: required") + } + if v, ok := raw["last_online_time"]; !ok || v == nil { + return fmt.Errorf("field last_online_time in P2POrderListRespP2POrderListListElemClientDetails: required") + } + if v, ok := raw["loginid"]; !ok || v == nil { + return fmt.Errorf("field loginid in P2POrderListRespP2POrderListListElemClientDetails: required") + } + if v, ok := raw["name"]; !ok || v == nil { + return fmt.Errorf("field name in P2POrderListRespP2POrderListListElemClientDetails: required") + } + type Plain P2POrderListRespP2POrderListListElemClientDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2POrderListRespP2POrderListListElemClientDetails(plain) + return nil +} + +const P2POrderListRespP2POrderListListElemTypeSell P2POrderListRespP2POrderListListElemType = "sell" + type P2POrderListRespP2POrderListListElemVerificationPending int var enumValues_P2POrderListRespP2POrderListListElemVerificationPending = []interface{}{ @@ -797,73 +767,78 @@ func (j *P2POrderListRespP2POrderListListElemVerificationPending) UnmarshalJSON( return nil } +var enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderListRespP2POrderListListElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_currency"]; raw != nil && !ok { + if v, ok := raw["account_currency"]; !ok || v == nil { return fmt.Errorf("field account_currency in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["advert_details"]; raw != nil && !ok { + if v, ok := raw["advert_details"]; !ok || v == nil { return fmt.Errorf("field advert_details in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["advertiser_details"]; raw != nil && !ok { + if v, ok := raw["advertiser_details"]; !ok || v == nil { return fmt.Errorf("field advertiser_details in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["amount_display"]; raw != nil && !ok { + if v, ok := raw["amount_display"]; !ok || v == nil { return fmt.Errorf("field amount_display in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["chat_channel_url"]; raw != nil && !ok { + if v, ok := raw["chat_channel_url"]; !ok || v == nil { return fmt.Errorf("field chat_channel_url in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["contact_info"]; raw != nil && !ok { + if v, ok := raw["contact_info"]; !ok || v == nil { return fmt.Errorf("field contact_info in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["dispute_details"]; raw != nil && !ok { + if v, ok := raw["dispute_details"]; !ok || v == nil { return fmt.Errorf("field dispute_details in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["expiry_time"]; raw != nil && !ok { + if v, ok := raw["expiry_time"]; !ok || v == nil { return fmt.Errorf("field expiry_time in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["is_incoming"]; raw != nil && !ok { + if v, ok := raw["is_incoming"]; !ok || v == nil { return fmt.Errorf("field is_incoming in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["is_reviewable"]; raw != nil && !ok { + if v, ok := raw["is_reviewable"]; !ok || v == nil { return fmt.Errorf("field is_reviewable in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["local_currency"]; raw != nil && !ok { + if v, ok := raw["local_currency"]; !ok || v == nil { return fmt.Errorf("field local_currency in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["payment_info"]; raw != nil && !ok { + if v, ok := raw["payment_info"]; !ok || v == nil { return fmt.Errorf("field payment_info in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["price_display"]; raw != nil && !ok { + if v, ok := raw["price_display"]; !ok || v == nil { return fmt.Errorf("field price_display in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["rate"]; raw != nil && !ok { + if v, ok := raw["rate"]; !ok || v == nil { return fmt.Errorf("field rate in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["rate_display"]; raw != nil && !ok { + if v, ok := raw["rate_display"]; !ok || v == nil { return fmt.Errorf("field rate_display in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["status"]; raw != nil && !ok { + if v, ok := raw["status"]; !ok || v == nil { return fmt.Errorf("field status in P2POrderListRespP2POrderListListElem: required") } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in P2POrderListRespP2POrderListListElem: required") } type Plain P2POrderListRespP2POrderListListElem @@ -875,13 +850,33 @@ func (j *P2POrderListRespP2POrderListListElem) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderListRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderListRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespMsgType, v) + } + *j = P2POrderListRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderListRespP2POrderList) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["list"]; raw != nil && !ok { + if v, ok := raw["list"]; !ok || v == nil { return fmt.Errorf("field list in P2POrderListRespP2POrderList: required") } type Plain P2POrderListRespP2POrderList @@ -906,7 +901,7 @@ func (j *P2POrderListRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2POrderListRespSubscription: required") } type Plain P2POrderListRespSubscription @@ -918,16 +913,20 @@ func (j *P2POrderListRespSubscription) UnmarshalJSON(b []byte) error { return nil } +var enumValues_P2POrderListRespMsgType = []interface{}{ + "p2p_order_list", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2POrderListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2POrderListResp: required") } type Plain P2POrderListResp diff --git a/schema/p2p_order_review.go b/schema/p2p_order_review.go index bd6cb47..ef5b314 100644 --- a/schema/p2p_order_review.go +++ b/schema/p2p_order_review.go @@ -6,32 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Creates a review for the specified order. -type P2POrderReview struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // The order identification number. - OrderId string `json:"order_id"` - - // Must be 1 - P2POrderReview P2POrderReviewP2POrderReview `json:"p2p_order_review"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2POrderReviewPassthrough `json:"passthrough,omitempty"` - - // Rating for the transaction, 1 to 5. - Rating int `json:"rating"` - - // [Optional] `1` if the counterparty is recommendable to others, otherwise `0`. - Recommended *P2POrderReviewRecommended `json:"recommended,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type P2POrderReviewP2POrderReview int var enumValues_P2POrderReviewP2POrderReview = []interface{}{ @@ -66,17 +40,17 @@ type P2POrderReviewRecommended struct { Value interface{} } -// MarshalJSON implements json.Marshaler. -func (j *P2POrderReviewRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - var enumValues_P2POrderReviewRecommended = []interface{}{ nil, 0.0, 1.0, } +// MarshalJSON implements json.Marshaler. +func (j *P2POrderReviewRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderReviewRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -99,19 +73,45 @@ func (j *P2POrderReviewRecommended) UnmarshalJSON(b []byte) error { return nil } +// Creates a review for the specified order. +type P2POrderReview struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // The order identification number. + OrderId string `json:"order_id"` + + // Must be 1 + P2POrderReview P2POrderReviewP2POrderReview `json:"p2p_order_review"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2POrderReviewPassthrough `json:"passthrough,omitempty"` + + // Rating for the transaction, 1 to 5. + Rating int `json:"rating"` + + // [Optional] `1` if the counterparty is recommendable to others, otherwise `0`. + Recommended *P2POrderReviewRecommended `json:"recommended,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderReview) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["order_id"]; raw != nil && !ok { + if v, ok := raw["order_id"]; !ok || v == nil { return fmt.Errorf("field order_id in P2POrderReview: required") } - if _, ok := raw["p2p_order_review"]; raw != nil && !ok { + if v, ok := raw["p2p_order_review"]; !ok || v == nil { return fmt.Errorf("field p2p_order_review in P2POrderReview: required") } - if _, ok := raw["rating"]; raw != nil && !ok { + if v, ok := raw["rating"]; !ok || v == nil { return fmt.Errorf("field rating in P2POrderReview: required") } type Plain P2POrderReview diff --git a/schema/p2p_order_review_resp.go b/schema/p2p_order_review_resp.go index 86bf043..2a86337 100644 --- a/schema/p2p_order_review_resp.go +++ b/schema/p2p_order_review_resp.go @@ -29,30 +29,6 @@ type P2POrderReviewRespMsgType string const P2POrderReviewRespMsgTypeP2POrderReview P2POrderReviewRespMsgType = "p2p_order_review" -var enumValues_P2POrderReviewRespMsgType = []interface{}{ - "p2p_order_review", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderReviewRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderReviewRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderReviewRespMsgType, v) - } - *j = P2POrderReviewRespMsgType(v) - return nil -} - // Details of the created order review. type P2POrderReviewRespP2POrderReview struct { // The reviewed advertiser's identification number. @@ -75,17 +51,17 @@ type P2POrderReviewRespP2POrderReviewRecommended struct { Value interface{} } -// MarshalJSON implements json.Marshaler. -func (j *P2POrderReviewRespP2POrderReviewRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - var enumValues_P2POrderReviewRespP2POrderReviewRecommended = []interface{}{ nil, 0.0, 1.0, } +// MarshalJSON implements json.Marshaler. +func (j *P2POrderReviewRespP2POrderReviewRecommended) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderReviewRespP2POrderReviewRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -108,25 +84,45 @@ func (j *P2POrderReviewRespP2POrderReviewRecommended) UnmarshalJSON(b []byte) er return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2POrderReviewRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2POrderReviewRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderReviewRespMsgType, v) + } + *j = P2POrderReviewRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderReviewRespP2POrderReview) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["advertiser_id"]; raw != nil && !ok { + if v, ok := raw["advertiser_id"]; !ok || v == nil { return fmt.Errorf("field advertiser_id in P2POrderReviewRespP2POrderReview: required") } - if _, ok := raw["created_time"]; raw != nil && !ok { + if v, ok := raw["created_time"]; !ok || v == nil { return fmt.Errorf("field created_time in P2POrderReviewRespP2POrderReview: required") } - if _, ok := raw["order_id"]; raw != nil && !ok { + if v, ok := raw["order_id"]; !ok || v == nil { return fmt.Errorf("field order_id in P2POrderReviewRespP2POrderReview: required") } - if _, ok := raw["rating"]; raw != nil && !ok { + if v, ok := raw["rating"]; !ok || v == nil { return fmt.Errorf("field rating in P2POrderReviewRespP2POrderReview: required") } - if _, ok := raw["recommended"]; raw != nil && !ok { + if v, ok := raw["recommended"]; !ok || v == nil { return fmt.Errorf("field recommended in P2POrderReviewRespP2POrderReview: required") } type Plain P2POrderReviewRespP2POrderReview @@ -138,16 +134,20 @@ func (j *P2POrderReviewRespP2POrderReview) UnmarshalJSON(b []byte) error { return nil } +var enumValues_P2POrderReviewRespMsgType = []interface{}{ + "p2p_order_review", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderReviewResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2POrderReviewResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2POrderReviewResp: required") } type Plain P2POrderReviewResp diff --git a/schema/p2p_payment_methods.go b/schema/p2p_payment_methods.go index c9bc450..0653d13 100644 --- a/schema/p2p_payment_methods.go +++ b/schema/p2p_payment_methods.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// List all P2P payment methods. -type P2PPaymentMethods struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be 1 - P2PPaymentMethods P2PPaymentMethodsP2PPaymentMethods `json:"p2p_payment_methods"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PPaymentMethodsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type P2PPaymentMethodsP2PPaymentMethods int var enumValues_P2PPaymentMethodsP2PPaymentMethods = []interface{}{ @@ -49,6 +32,23 @@ func (j *P2PPaymentMethodsP2PPaymentMethods) UnmarshalJSON(b []byte) error { return nil } +// List all P2P payment methods. +type P2PPaymentMethods struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be 1 + P2PPaymentMethods P2PPaymentMethodsP2PPaymentMethods `json:"p2p_payment_methods"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PPaymentMethodsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2PPaymentMethodsPassthrough map[string]interface{} @@ -59,7 +59,7 @@ func (j *P2PPaymentMethods) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_payment_methods"]; raw != nil && !ok { + if v, ok := raw["p2p_payment_methods"]; !ok || v == nil { return fmt.Errorf("field p2p_payment_methods in P2PPaymentMethods: required") } type Plain P2PPaymentMethods diff --git a/schema/p2p_payment_methods_resp.go b/schema/p2p_payment_methods_resp.go index 6a74d2c..3784c3b 100644 --- a/schema/p2p_payment_methods_resp.go +++ b/schema/p2p_payment_methods_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// List all P2P payment methods. -type P2PPaymentMethodsResp struct { - // Echo of the request made. - EchoReq P2PPaymentMethodsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PPaymentMethodsRespMsgType `json:"msg_type"` - - // Payment methods keyed by identifier. - P2PPaymentMethods P2PPaymentMethodsRespP2PPaymentMethods `json:"p2p_payment_methods,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PPaymentMethodsRespEchoReq map[string]interface{} type P2PPaymentMethodsRespMsgType string -const P2PPaymentMethodsRespMsgTypeP2PPaymentMethods P2PPaymentMethodsRespMsgType = "p2p_payment_methods" - var enumValues_P2PPaymentMethodsRespMsgType = []interface{}{ "p2p_payment_methods", } @@ -53,6 +35,24 @@ func (j *P2PPaymentMethodsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// List all P2P payment methods. +type P2PPaymentMethodsResp struct { + // Echo of the request made. + EchoReq P2PPaymentMethodsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PPaymentMethodsRespMsgType `json:"msg_type"` + + // Payment methods keyed by identifier. + P2PPaymentMethods P2PPaymentMethodsRespP2PPaymentMethods `json:"p2p_payment_methods,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const P2PPaymentMethodsRespMsgTypeP2PPaymentMethods P2PPaymentMethodsRespMsgType = "p2p_payment_methods" + // Payment methods keyed by identifier. type P2PPaymentMethodsRespP2PPaymentMethods map[string]interface{} @@ -62,10 +62,10 @@ func (j *P2PPaymentMethodsResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PPaymentMethodsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PPaymentMethodsResp: required") } type Plain P2PPaymentMethodsResp diff --git a/schema/p2p_ping.go b/schema/p2p_ping.go index f8baddd..96c156d 100644 --- a/schema/p2p_ping.go +++ b/schema/p2p_ping.go @@ -6,24 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Keeps the connection alive and updates the P2P advertiser's online status. The -// advertiser will be considered offline 60 seconds after a call is made. -type P2PPing struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - P2PPing P2PPingP2PPing `json:"p2p_ping"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PPingPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - type P2PPingP2PPing int var enumValues_P2PPingP2PPing = []interface{}{ @@ -50,6 +32,24 @@ func (j *P2PPingP2PPing) UnmarshalJSON(b []byte) error { return nil } +// Keeps the connection alive and updates the P2P advertiser's online status. The +// advertiser will be considered offline 60 seconds after a call is made. +type P2PPing struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + P2PPing P2PPingP2PPing `json:"p2p_ping"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PPingPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type P2PPingPassthrough map[string]interface{} @@ -60,7 +60,7 @@ func (j *P2PPing) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_ping"]; raw != nil && !ok { + if v, ok := raw["p2p_ping"]; !ok || v == nil { return fmt.Errorf("field p2p_ping in P2PPing: required") } type Plain P2PPing diff --git a/schema/p2p_ping_resp.go b/schema/p2p_ping_resp.go index 6238da6..8aa81ab 100644 --- a/schema/p2p_ping_resp.go +++ b/schema/p2p_ping_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The response of P2P ping request. -type P2PPingResp struct { - // Echo of the request made. - EchoReq P2PPingRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PPingRespMsgType `json:"msg_type"` - - // Will return 'pong' - P2PPing *P2PPingRespP2PPing `json:"p2p_ping,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type P2PPingRespEchoReq map[string]interface{} type P2PPingRespMsgType string -const P2PPingRespMsgTypeP2PPing P2PPingRespMsgType = "p2p_ping" - var enumValues_P2PPingRespMsgType = []interface{}{ "p2p_ping", } @@ -53,9 +35,9 @@ func (j *P2PPingRespMsgType) UnmarshalJSON(b []byte) error { return nil } -type P2PPingRespP2PPing string +const P2PPingRespMsgTypeP2PPing P2PPingRespMsgType = "p2p_ping" -const P2PPingRespP2PPingPong P2PPingRespP2PPing = "pong" +type P2PPingRespP2PPing string var enumValues_P2PPingRespP2PPing = []interface{}{ "pong", @@ -81,16 +63,34 @@ func (j *P2PPingRespP2PPing) UnmarshalJSON(b []byte) error { return nil } +// The response of P2P ping request. +type P2PPingResp struct { + // Echo of the request made. + EchoReq P2PPingRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PPingRespMsgType `json:"msg_type"` + + // Will return 'pong' + P2PPing *P2PPingRespP2PPing `json:"p2p_ping,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const P2PPingRespP2PPingPong P2PPingRespP2PPing = "pong" + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PPingResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PPingResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PPingResp: required") } type Plain P2PPingResp diff --git a/schema/p2p_settings.go b/schema/p2p_settings.go index 9989583..941f584 100644 --- a/schema/p2p_settings.go +++ b/schema/p2p_settings.go @@ -6,27 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Request P2P Settings information. -type P2PSettings struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Must be `1` - P2PSettings P2PSettingsP2PSettings `json:"p2p_settings"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough P2PSettingsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to `1`, will send updates whenever there is an update to P2P - // settings. - Subscribe *P2PSettingsSubscribe `json:"subscribe,omitempty"` -} - type P2PSettingsP2PSettings int var enumValues_P2PSettingsP2PSettings = []interface{}{ @@ -83,13 +62,34 @@ func (j *P2PSettingsSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Request P2P Settings information. +type P2PSettings struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Must be `1` + P2PSettings P2PSettingsP2PSettings `json:"p2p_settings"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough P2PSettingsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to `1`, will send updates whenever there is an update to P2P + // settings. + Subscribe *P2PSettingsSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PSettings) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["p2p_settings"]; raw != nil && !ok { + if v, ok := raw["p2p_settings"]; !ok || v == nil { return fmt.Errorf("field p2p_settings in P2PSettings: required") } type Plain P2PSettings diff --git a/schema/p2p_settings_resp.go b/schema/p2p_settings_resp.go index bcf64c5..ab70dd1 100644 --- a/schema/p2p_settings_resp.go +++ b/schema/p2p_settings_resp.go @@ -6,32 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Information of the P2P settings. -type P2PSettingsResp struct { - // Echo of the request made. - EchoReq P2PSettingsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PSettingsRespMsgType `json:"msg_type"` - - // Peer-to-peer payment system settings. - P2PSettings *P2PSettingsRespP2PSettings `json:"p2p_settings,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *P2PSettingsRespSubscription `json:"subscription,omitempty"` -} - // Echo of the request made. type P2PSettingsRespEchoReq map[string]interface{} type P2PSettingsRespMsgType string -const P2PSettingsRespMsgTypeP2PSettings P2PSettingsRespMsgType = "p2p_settings" - var enumValues_P2PSettingsRespMsgType = []interface{}{ "p2p_settings", } @@ -56,102 +35,7 @@ func (j *P2PSettingsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// Peer-to-peer payment system settings. -type P2PSettingsRespP2PSettings struct { - // Maximum number of active ads allowed by an advertiser per currency pair and - // advert type (buy or sell). - AdvertsActiveLimit int `json:"adverts_active_limit"` - - // Adverts will be deactivated if no activity occurs within this period, in days. - AdvertsArchivePeriod *int `json:"adverts_archive_period,omitempty"` - - // Block trading settings - BlockTrade P2PSettingsRespP2PSettingsBlockTrade `json:"block_trade"` - - // Advertiser schedule start and end times must be exact multiples of this value, - // unless it is zero. - BusinessHoursMinutesInterval int `json:"business_hours_minutes_interval"` - - // A buyer will be blocked for this duration after exceeding the cancellation - // limit, in hours. - CancellationBlockDuration int `json:"cancellation_block_duration"` - - // The period within which to count buyer cancellations, in hours. - CancellationCountPeriod int `json:"cancellation_count_period"` - - // A buyer may cancel an order within this period without negative consequences, - // in minutes after order creation. - CancellationGracePeriod int `json:"cancellation_grace_period"` - - // A buyer will be temporarily barred after marking this number of cancellations - // within cancellation_period. - CancellationLimit int `json:"cancellation_limit"` - - // Recommended step values for choosing advert counterparty terms. - CounterpartyTermSteps *P2PSettingsRespP2PSettingsCounterpartyTermSteps `json:"counterparty_term_steps,omitempty"` - - // When 0, only exchanges in local currency are allowed for P2P advertiser. - CrossBorderAdsEnabled P2PSettingsRespP2PSettingsCrossBorderAdsEnabled `json:"cross_border_ads_enabled"` - - // When 1, the P2P service is unavailable. - Disabled P2PSettingsRespP2PSettingsDisabled `json:"disabled"` - - // Indicates the availbility of certain backend features. - FeatureLevel int `json:"feature_level"` - - // Availability of fixed rate adverts. - FixedRateAdverts P2PSettingsRespP2PSettingsFixedRateAdverts `json:"fixed_rate_adverts"` - - // Date on which fixed rate adverts will be deactivated. - FixedRateAdvertsEndDate *string `json:"fixed_rate_adverts_end_date,omitempty"` - - // Availability of floating rate adverts. - FloatRateAdverts P2PSettingsRespP2PSettingsFloatRateAdverts `json:"float_rate_adverts"` - - // Maximum rate offset for floating rate adverts. - FloatRateOffsetLimit float64 `json:"float_rate_offset_limit"` - - // Available local currencies for p2p_advert_list request. - LocalCurrencies []P2PSettingsRespP2PSettingsLocalCurrenciesElem `json:"local_currencies"` - - // Maximum amount of an advert, in USD. - MaximumAdvertAmount float64 `json:"maximum_advert_amount"` - - // Maximum amount of an order, in USD. - MaximumOrderAmount float64 `json:"maximum_order_amount"` - - // Maximum number of orders a user may create per day. - OrderDailyLimit int `json:"order_daily_limit"` - - // List of order expiry values available for adverts, in seconds. - OrderExpiryOptions []int `json:"order_expiry_options"` - - // Time allowed for order payment, in minutes after order creation. - OrderPaymentPeriod int `json:"order_payment_period"` - - // Local P2P exchange rate which should be used instead of those obtained from the - // `exchange_rates` call. - OverrideExchangeRate *string `json:"override_exchange_rate,omitempty"` - - // Indicates if the payment methods feature is enabled. - PaymentMethodsEnabled P2PSettingsRespP2PSettingsPaymentMethodsEnabled `json:"payment_methods_enabled"` - - // Time after successful order completion during which reviews can be created, in - // hours. - ReviewPeriod float64 `json:"review_period"` - - // List of currencies for which P2P is available - SupportedCurrencies []string `json:"supported_currencies"` -} - -// Block trading settings -type P2PSettingsRespP2PSettingsBlockTrade struct { - // When 1, Block trading is unavailable. - Disabled *P2PSettingsRespP2PSettingsBlockTradeDisabled `json:"disabled,omitempty"` - - // Maximum amount of a block trade advert, in USD. - MaximumAdvertAmount *float64 `json:"maximum_advert_amount,omitempty"` -} +const P2PSettingsRespMsgTypeP2PSettings P2PSettingsRespMsgType = "p2p_settings" type P2PSettingsRespP2PSettingsBlockTradeDisabled int @@ -180,6 +64,15 @@ func (j *P2PSettingsRespP2PSettingsBlockTradeDisabled) UnmarshalJSON(b []byte) e return nil } +// Block trading settings +type P2PSettingsRespP2PSettingsBlockTrade struct { + // When 1, Block trading is unavailable. + Disabled *P2PSettingsRespP2PSettingsBlockTradeDisabled `json:"disabled,omitempty"` + + // Maximum amount of a block trade advert, in USD. + MaximumAdvertAmount *float64 `json:"maximum_advert_amount,omitempty"` +} + // Recommended step values for choosing advert counterparty terms. type P2PSettingsRespP2PSettingsCounterpartyTermSteps struct { // Values for minimum 30 day completion rate. @@ -198,13 +91,13 @@ func (j *P2PSettingsRespP2PSettingsCounterpartyTermSteps) UnmarshalJSON(b []byte if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["completion_rate"]; raw != nil && !ok { + if v, ok := raw["completion_rate"]; !ok || v == nil { return fmt.Errorf("field completion_rate in P2PSettingsRespP2PSettingsCounterpartyTermSteps: required") } - if _, ok := raw["join_days"]; raw != nil && !ok { + if v, ok := raw["join_days"]; !ok || v == nil { return fmt.Errorf("field join_days in P2PSettingsRespP2PSettingsCounterpartyTermSteps: required") } - if _, ok := raw["rating"]; raw != nil && !ok { + if v, ok := raw["rating"]; !ok || v == nil { return fmt.Errorf("field rating in P2PSettingsRespP2PSettingsCounterpartyTermSteps: required") } type Plain P2PSettingsRespP2PSettingsCounterpartyTermSteps @@ -272,10 +165,6 @@ func (j *P2PSettingsRespP2PSettingsDisabled) UnmarshalJSON(b []byte) error { type P2PSettingsRespP2PSettingsFixedRateAdverts string -const P2PSettingsRespP2PSettingsFixedRateAdvertsDisabled P2PSettingsRespP2PSettingsFixedRateAdverts = "disabled" -const P2PSettingsRespP2PSettingsFixedRateAdvertsEnabled P2PSettingsRespP2PSettingsFixedRateAdverts = "enabled" -const P2PSettingsRespP2PSettingsFixedRateAdvertsListOnly P2PSettingsRespP2PSettingsFixedRateAdverts = "list_only" - var enumValues_P2PSettingsRespP2PSettingsFixedRateAdverts = []interface{}{ "disabled", "enabled", @@ -302,11 +191,11 @@ func (j *P2PSettingsRespP2PSettingsFixedRateAdverts) UnmarshalJSON(b []byte) err return nil } -type P2PSettingsRespP2PSettingsFloatRateAdverts string +const P2PSettingsRespP2PSettingsFixedRateAdvertsDisabled P2PSettingsRespP2PSettingsFixedRateAdverts = "disabled" +const P2PSettingsRespP2PSettingsFixedRateAdvertsEnabled P2PSettingsRespP2PSettingsFixedRateAdverts = "enabled" +const P2PSettingsRespP2PSettingsFixedRateAdvertsListOnly P2PSettingsRespP2PSettingsFixedRateAdverts = "list_only" -const P2PSettingsRespP2PSettingsFloatRateAdvertsDisabled P2PSettingsRespP2PSettingsFloatRateAdverts = "disabled" -const P2PSettingsRespP2PSettingsFloatRateAdvertsEnabled P2PSettingsRespP2PSettingsFloatRateAdverts = "enabled" -const P2PSettingsRespP2PSettingsFloatRateAdvertsListOnly P2PSettingsRespP2PSettingsFloatRateAdverts = "list_only" +type P2PSettingsRespP2PSettingsFloatRateAdverts string var enumValues_P2PSettingsRespP2PSettingsFloatRateAdverts = []interface{}{ "disabled", @@ -334,20 +223,9 @@ func (j *P2PSettingsRespP2PSettingsFloatRateAdverts) UnmarshalJSON(b []byte) err return nil } -// Local currency details. -type P2PSettingsRespP2PSettingsLocalCurrenciesElem struct { - // Local currency name - DisplayName string `json:"display_name"` - - // Indicates that there are adverts available for this currency. - HasAdverts P2PSettingsRespP2PSettingsLocalCurrenciesElemHasAdverts `json:"has_adverts"` - - // Indicates that this is local currency for the current country. - IsDefault *P2PSettingsRespP2PSettingsLocalCurrenciesElemIsDefault `json:"is_default,omitempty"` - - // Local currency symbol - Symbol string `json:"symbol"` -} +const P2PSettingsRespP2PSettingsFloatRateAdvertsDisabled P2PSettingsRespP2PSettingsFloatRateAdverts = "disabled" +const P2PSettingsRespP2PSettingsFloatRateAdvertsEnabled P2PSettingsRespP2PSettingsFloatRateAdverts = "enabled" +const P2PSettingsRespP2PSettingsFloatRateAdvertsListOnly P2PSettingsRespP2PSettingsFloatRateAdverts = "list_only" type P2PSettingsRespP2PSettingsLocalCurrenciesElemHasAdverts int @@ -402,19 +280,34 @@ func (j *P2PSettingsRespP2PSettingsLocalCurrenciesElemIsDefault) UnmarshalJSON(b return nil } +// Local currency details. +type P2PSettingsRespP2PSettingsLocalCurrenciesElem struct { + // Local currency name + DisplayName string `json:"display_name"` + + // Indicates that there are adverts available for this currency. + HasAdverts P2PSettingsRespP2PSettingsLocalCurrenciesElemHasAdverts `json:"has_adverts"` + + // Indicates that this is local currency for the current country. + IsDefault *P2PSettingsRespP2PSettingsLocalCurrenciesElemIsDefault `json:"is_default,omitempty"` + + // Local currency symbol + Symbol string `json:"symbol"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PSettingsRespP2PSettingsLocalCurrenciesElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["display_name"]; raw != nil && !ok { + if v, ok := raw["display_name"]; !ok || v == nil { return fmt.Errorf("field display_name in P2PSettingsRespP2PSettingsLocalCurrenciesElem: required") } - if _, ok := raw["has_adverts"]; raw != nil && !ok { + if v, ok := raw["has_adverts"]; !ok || v == nil { return fmt.Errorf("field has_adverts in P2PSettingsRespP2PSettingsLocalCurrenciesElem: required") } - if _, ok := raw["symbol"]; raw != nil && !ok { + if v, ok := raw["symbol"]; !ok || v == nil { return fmt.Errorf("field symbol in P2PSettingsRespP2PSettingsLocalCurrenciesElem: required") } type Plain P2PSettingsRespP2PSettingsLocalCurrenciesElem @@ -453,76 +346,164 @@ func (j *P2PSettingsRespP2PSettingsPaymentMethodsEnabled) UnmarshalJSON(b []byte return nil } +// Peer-to-peer payment system settings. +type P2PSettingsRespP2PSettings struct { + // Maximum number of active ads allowed by an advertiser per currency pair and + // advert type (buy or sell). + AdvertsActiveLimit int `json:"adverts_active_limit"` + + // Adverts will be deactivated if no activity occurs within this period, in days. + AdvertsArchivePeriod *int `json:"adverts_archive_period,omitempty"` + + // Block trading settings + BlockTrade P2PSettingsRespP2PSettingsBlockTrade `json:"block_trade"` + + // Advertiser schedule start and end times must be exact multiples of this value, + // unless it is zero. + BusinessHoursMinutesInterval int `json:"business_hours_minutes_interval"` + + // A buyer will be blocked for this duration after exceeding the cancellation + // limit, in hours. + CancellationBlockDuration int `json:"cancellation_block_duration"` + + // The period within which to count buyer cancellations, in hours. + CancellationCountPeriod int `json:"cancellation_count_period"` + + // A buyer may cancel an order within this period without negative consequences, + // in minutes after order creation. + CancellationGracePeriod int `json:"cancellation_grace_period"` + + // A buyer will be temporarily barred after marking this number of cancellations + // within cancellation_period. + CancellationLimit int `json:"cancellation_limit"` + + // Recommended step values for choosing advert counterparty terms. + CounterpartyTermSteps *P2PSettingsRespP2PSettingsCounterpartyTermSteps `json:"counterparty_term_steps,omitempty"` + + // When 0, only exchanges in local currency are allowed for P2P advertiser. + CrossBorderAdsEnabled P2PSettingsRespP2PSettingsCrossBorderAdsEnabled `json:"cross_border_ads_enabled"` + + // When 1, the P2P service is unavailable. + Disabled P2PSettingsRespP2PSettingsDisabled `json:"disabled"` + + // Indicates the availbility of certain backend features. + FeatureLevel int `json:"feature_level"` + + // Availability of fixed rate adverts. + FixedRateAdverts P2PSettingsRespP2PSettingsFixedRateAdverts `json:"fixed_rate_adverts"` + + // Date on which fixed rate adverts will be deactivated. + FixedRateAdvertsEndDate *string `json:"fixed_rate_adverts_end_date,omitempty"` + + // Availability of floating rate adverts. + FloatRateAdverts P2PSettingsRespP2PSettingsFloatRateAdverts `json:"float_rate_adverts"` + + // Maximum rate offset for floating rate adverts. + FloatRateOffsetLimit float64 `json:"float_rate_offset_limit"` + + // Available local currencies for p2p_advert_list request. + LocalCurrencies []P2PSettingsRespP2PSettingsLocalCurrenciesElem `json:"local_currencies"` + + // Maximum amount of an advert, in USD. + MaximumAdvertAmount float64 `json:"maximum_advert_amount"` + + // Maximum amount of an order, in USD. + MaximumOrderAmount float64 `json:"maximum_order_amount"` + + // Maximum number of orders a user may create per day. + OrderDailyLimit int `json:"order_daily_limit"` + + // List of order expiry values available for adverts, in seconds. + OrderExpiryOptions []int `json:"order_expiry_options"` + + // Time allowed for order payment, in minutes after order creation. + OrderPaymentPeriod int `json:"order_payment_period"` + + // Local P2P exchange rate which should be used instead of those obtained from the + // `exchange_rates` call. + OverrideExchangeRate *string `json:"override_exchange_rate,omitempty"` + + // Indicates if the payment methods feature is enabled. + PaymentMethodsEnabled P2PSettingsRespP2PSettingsPaymentMethodsEnabled `json:"payment_methods_enabled"` + + // Time after successful order completion during which reviews can be created, in + // hours. + ReviewPeriod float64 `json:"review_period"` + + // List of currencies for which P2P is available + SupportedCurrencies []string `json:"supported_currencies"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PSettingsRespP2PSettings) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["adverts_active_limit"]; raw != nil && !ok { + if v, ok := raw["adverts_active_limit"]; !ok || v == nil { return fmt.Errorf("field adverts_active_limit in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["block_trade"]; raw != nil && !ok { + if v, ok := raw["block_trade"]; !ok || v == nil { return fmt.Errorf("field block_trade in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["business_hours_minutes_interval"]; raw != nil && !ok { + if v, ok := raw["business_hours_minutes_interval"]; !ok || v == nil { return fmt.Errorf("field business_hours_minutes_interval in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["cancellation_block_duration"]; raw != nil && !ok { + if v, ok := raw["cancellation_block_duration"]; !ok || v == nil { return fmt.Errorf("field cancellation_block_duration in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["cancellation_count_period"]; raw != nil && !ok { + if v, ok := raw["cancellation_count_period"]; !ok || v == nil { return fmt.Errorf("field cancellation_count_period in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["cancellation_grace_period"]; raw != nil && !ok { + if v, ok := raw["cancellation_grace_period"]; !ok || v == nil { return fmt.Errorf("field cancellation_grace_period in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["cancellation_limit"]; raw != nil && !ok { + if v, ok := raw["cancellation_limit"]; !ok || v == nil { return fmt.Errorf("field cancellation_limit in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["cross_border_ads_enabled"]; raw != nil && !ok { + if v, ok := raw["cross_border_ads_enabled"]; !ok || v == nil { return fmt.Errorf("field cross_border_ads_enabled in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["disabled"]; raw != nil && !ok { + if v, ok := raw["disabled"]; !ok || v == nil { return fmt.Errorf("field disabled in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["feature_level"]; raw != nil && !ok { + if v, ok := raw["feature_level"]; !ok || v == nil { return fmt.Errorf("field feature_level in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["fixed_rate_adverts"]; raw != nil && !ok { + if v, ok := raw["fixed_rate_adverts"]; !ok || v == nil { return fmt.Errorf("field fixed_rate_adverts in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["float_rate_adverts"]; raw != nil && !ok { + if v, ok := raw["float_rate_adverts"]; !ok || v == nil { return fmt.Errorf("field float_rate_adverts in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["float_rate_offset_limit"]; raw != nil && !ok { + if v, ok := raw["float_rate_offset_limit"]; !ok || v == nil { return fmt.Errorf("field float_rate_offset_limit in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["local_currencies"]; raw != nil && !ok { + if v, ok := raw["local_currencies"]; !ok || v == nil { return fmt.Errorf("field local_currencies in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["maximum_advert_amount"]; raw != nil && !ok { + if v, ok := raw["maximum_advert_amount"]; !ok || v == nil { return fmt.Errorf("field maximum_advert_amount in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["maximum_order_amount"]; raw != nil && !ok { + if v, ok := raw["maximum_order_amount"]; !ok || v == nil { return fmt.Errorf("field maximum_order_amount in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["order_daily_limit"]; raw != nil && !ok { + if v, ok := raw["order_daily_limit"]; !ok || v == nil { return fmt.Errorf("field order_daily_limit in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["order_expiry_options"]; raw != nil && !ok { + if v, ok := raw["order_expiry_options"]; !ok || v == nil { return fmt.Errorf("field order_expiry_options in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["order_payment_period"]; raw != nil && !ok { + if v, ok := raw["order_payment_period"]; !ok || v == nil { return fmt.Errorf("field order_payment_period in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["payment_methods_enabled"]; raw != nil && !ok { + if v, ok := raw["payment_methods_enabled"]; !ok || v == nil { return fmt.Errorf("field payment_methods_enabled in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["review_period"]; raw != nil && !ok { + if v, ok := raw["review_period"]; !ok || v == nil { return fmt.Errorf("field review_period in P2PSettingsRespP2PSettings: required") } - if _, ok := raw["supported_currencies"]; raw != nil && !ok { + if v, ok := raw["supported_currencies"]; !ok || v == nil { return fmt.Errorf("field supported_currencies in P2PSettingsRespP2PSettings: required") } type Plain P2PSettingsRespP2PSettings @@ -547,7 +528,7 @@ func (j *P2PSettingsRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in P2PSettingsRespSubscription: required") } type Plain P2PSettingsRespSubscription @@ -559,16 +540,35 @@ func (j *P2PSettingsRespSubscription) UnmarshalJSON(b []byte) error { return nil } +// Information of the P2P settings. +type P2PSettingsResp struct { + // Echo of the request made. + EchoReq P2PSettingsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PSettingsRespMsgType `json:"msg_type"` + + // Peer-to-peer payment system settings. + P2PSettings *P2PSettingsRespP2PSettings `json:"p2p_settings,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *P2PSettingsRespSubscription `json:"subscription,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PSettingsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in P2PSettingsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in P2PSettingsResp: required") } type Plain P2PSettingsResp diff --git a/schema/payment_methods.go b/schema/payment_methods.go index 9b238c1..1f54500 100644 --- a/schema/payment_methods.go +++ b/schema/payment_methods.go @@ -6,27 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Will return a list payment methods available for the given country. If the -// request is authenticated the client's residence country will be used. -type PaymentMethods struct { - // [Optional] 2-letter country code (ISO standard). - Country *string `json:"country,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough PaymentMethodsPassthrough `json:"passthrough,omitempty"` - - // Must be `1` - PaymentMethods PaymentMethodsPaymentMethods `json:"payment_methods"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type PaymentMethodsPassthrough map[string]interface{} @@ -57,13 +36,34 @@ func (j *PaymentMethodsPaymentMethods) UnmarshalJSON(b []byte) error { return nil } +// Will return a list payment methods available for the given country. If the +// request is authenticated the client's residence country will be used. +type PaymentMethods struct { + // [Optional] 2-letter country code (ISO standard). + Country *string `json:"country,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough PaymentMethodsPassthrough `json:"passthrough,omitempty"` + + // Must be `1` + PaymentMethods PaymentMethodsPaymentMethods `json:"payment_methods"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentMethods) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["payment_methods"]; raw != nil && !ok { + if v, ok := raw["payment_methods"]; !ok || v == nil { return fmt.Errorf("field payment_methods in PaymentMethods: required") } type Plain PaymentMethods diff --git a/schema/payment_methods_resp.go b/schema/payment_methods_resp.go index 8a25d75..c72d6e3 100644 --- a/schema/payment_methods_resp.go +++ b/schema/payment_methods_resp.go @@ -6,30 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// List of available payment methods for a given country. -type PaymentMethodsResp struct { - // Echo of the request made. - EchoReq PaymentMethodsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType PaymentMethodsRespMsgType `json:"msg_type"` - - // Available payment methods for a given country. Note: if a user is logged in, - // the residence country will be considered. - PaymentMethods []PaymentMethodsRespPaymentMethodsElem `json:"payment_methods,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type PaymentMethodsRespEchoReq map[string]interface{} type PaymentMethodsRespMsgType string -const PaymentMethodsRespMsgTypePaymentMethods PaymentMethodsRespMsgType = "payment_methods" - var enumValues_PaymentMethodsRespMsgType = []interface{}{ "payment_methods", } @@ -54,6 +35,8 @@ func (j *PaymentMethodsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const PaymentMethodsRespMsgTypePaymentMethods PaymentMethodsRespMsgType = "payment_methods" + // A payment method suported for the given country type PaymentMethodsRespPaymentMethodsElem struct { // The min and max values for deposits. @@ -108,43 +91,43 @@ func (j *PaymentMethodsRespPaymentMethodsElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["deposit_limits"]; raw != nil && !ok { + if v, ok := raw["deposit_limits"]; !ok || v == nil { return fmt.Errorf("field deposit_limits in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["deposit_time"]; raw != nil && !ok { + if v, ok := raw["deposit_time"]; !ok || v == nil { return fmt.Errorf("field deposit_time in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["description"]; raw != nil && !ok { + if v, ok := raw["description"]; !ok || v == nil { return fmt.Errorf("field description in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["display_name"]; raw != nil && !ok { + if v, ok := raw["display_name"]; !ok || v == nil { return fmt.Errorf("field display_name in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["payment_processor"]; raw != nil && !ok { + if v, ok := raw["payment_processor"]; !ok || v == nil { return fmt.Errorf("field payment_processor in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["predefined_amounts"]; raw != nil && !ok { + if v, ok := raw["predefined_amounts"]; !ok || v == nil { return fmt.Errorf("field predefined_amounts in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["signup_link"]; raw != nil && !ok { + if v, ok := raw["signup_link"]; !ok || v == nil { return fmt.Errorf("field signup_link in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["supported_currencies"]; raw != nil && !ok { + if v, ok := raw["supported_currencies"]; !ok || v == nil { return fmt.Errorf("field supported_currencies in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["type_display_name"]; raw != nil && !ok { + if v, ok := raw["type_display_name"]; !ok || v == nil { return fmt.Errorf("field type_display_name in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["withdraw_limits"]; raw != nil && !ok { + if v, ok := raw["withdraw_limits"]; !ok || v == nil { return fmt.Errorf("field withdraw_limits in PaymentMethodsRespPaymentMethodsElem: required") } - if _, ok := raw["withdrawal_time"]; raw != nil && !ok { + if v, ok := raw["withdrawal_time"]; !ok || v == nil { return fmt.Errorf("field withdrawal_time in PaymentMethodsRespPaymentMethodsElem: required") } type Plain PaymentMethodsRespPaymentMethodsElem @@ -156,16 +139,33 @@ func (j *PaymentMethodsRespPaymentMethodsElem) UnmarshalJSON(b []byte) error { return nil } +// List of available payment methods for a given country. +type PaymentMethodsResp struct { + // Echo of the request made. + EchoReq PaymentMethodsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType PaymentMethodsRespMsgType `json:"msg_type"` + + // Available payment methods for a given country. Note: if a user is logged in, + // the residence country will be considered. + PaymentMethods []PaymentMethodsRespPaymentMethodsElem `json:"payment_methods,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentMethodsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PaymentMethodsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PaymentMethodsResp: required") } type Plain PaymentMethodsResp diff --git a/schema/paymentagent_create.go b/schema/paymentagent_create.go index e0f66c8..211913d 100644 --- a/schema/paymentagent_create.go +++ b/schema/paymentagent_create.go @@ -6,53 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Saves client's payment agent details. -type PaymentagentCreate struct { - // [Optional] Client's My Affiliate id, if exists. - AffiliateId *string `json:"affiliate_id,omitempty"` - - // Indicates client's agreement with the Code of Conduct. - CodeOfConductApproval PaymentagentCreateCodeOfConductApproval `json:"code_of_conduct_approval"` - - // Commission (%) the agent wants to take on deposits - CommissionDeposit float64 `json:"commission_deposit"` - - // Commission (%) the agent wants to take on withdrawals - CommissionWithdrawal float64 `json:"commission_withdrawal"` - - // Payment agent's email address. - Email string `json:"email"` - - // [Optional] Information about payment agent and their proposed service. - Information string `json:"information"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough PaymentagentCreatePassthrough `json:"passthrough,omitempty"` - - // The name with which the payment agent is going to be identified. - PaymentAgentName string `json:"payment_agent_name"` - - // Must be 1 - PaymentagentCreate PaymentagentCreatePaymentagentCreate `json:"paymentagent_create"` - - // Payment agent's phone number(s) with country code. - PhoneNumbers []PaymentagentCreatePhoneNumbersElem `json:"phone_numbers,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // A list of supported payment methods. - SupportedPaymentMethods []PaymentagentCreateSupportedPaymentMethodsElem `json:"supported_payment_methods"` - - // The URL(s) of payment agent's website(s). - Urls []PaymentagentCreateUrlsElem `json:"urls"` -} - type PaymentagentCreateCodeOfConductApproval int var enumValues_PaymentagentCreateCodeOfConductApproval = []interface{}{ @@ -120,7 +73,7 @@ func (j *PaymentagentCreatePhoneNumbersElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["phone_number"]; raw != nil && !ok { + if v, ok := raw["phone_number"]; !ok || v == nil { return fmt.Errorf("field phone_number in PaymentagentCreatePhoneNumbersElem: required") } type Plain PaymentagentCreatePhoneNumbersElem @@ -143,7 +96,7 @@ func (j *PaymentagentCreateSupportedPaymentMethodsElem) UnmarshalJSON(b []byte) if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["payment_method"]; raw != nil && !ok { + if v, ok := raw["payment_method"]; !ok || v == nil { return fmt.Errorf("field payment_method in PaymentagentCreateSupportedPaymentMethodsElem: required") } type Plain PaymentagentCreateSupportedPaymentMethodsElem @@ -166,7 +119,7 @@ func (j *PaymentagentCreateUrlsElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["url"]; raw != nil && !ok { + if v, ok := raw["url"]; !ok || v == nil { return fmt.Errorf("field url in PaymentagentCreateUrlsElem: required") } type Plain PaymentagentCreateUrlsElem @@ -178,37 +131,84 @@ func (j *PaymentagentCreateUrlsElem) UnmarshalJSON(b []byte) error { return nil } +// Saves client's payment agent details. +type PaymentagentCreate struct { + // [Optional] Client's My Affiliate id, if exists. + AffiliateId *string `json:"affiliate_id,omitempty"` + + // Indicates client's agreement with the Code of Conduct. + CodeOfConductApproval PaymentagentCreateCodeOfConductApproval `json:"code_of_conduct_approval"` + + // Commission (%) the agent wants to take on deposits + CommissionDeposit float64 `json:"commission_deposit"` + + // Commission (%) the agent wants to take on withdrawals + CommissionWithdrawal float64 `json:"commission_withdrawal"` + + // Payment agent's email address. + Email string `json:"email"` + + // [Optional] Information about payment agent and their proposed service. + Information string `json:"information"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough PaymentagentCreatePassthrough `json:"passthrough,omitempty"` + + // The name with which the payment agent is going to be identified. + PaymentAgentName string `json:"payment_agent_name"` + + // Must be 1 + PaymentagentCreate PaymentagentCreatePaymentagentCreate `json:"paymentagent_create"` + + // Payment agent's phone number(s) with country code. + PhoneNumbers []PaymentagentCreatePhoneNumbersElem `json:"phone_numbers,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // A list of supported payment methods. + SupportedPaymentMethods []PaymentagentCreateSupportedPaymentMethodsElem `json:"supported_payment_methods"` + + // The URL(s) of payment agent's website(s). + Urls []PaymentagentCreateUrlsElem `json:"urls"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentCreate) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["code_of_conduct_approval"]; raw != nil && !ok { + if v, ok := raw["code_of_conduct_approval"]; !ok || v == nil { return fmt.Errorf("field code_of_conduct_approval in PaymentagentCreate: required") } - if _, ok := raw["commission_deposit"]; raw != nil && !ok { + if v, ok := raw["commission_deposit"]; !ok || v == nil { return fmt.Errorf("field commission_deposit in PaymentagentCreate: required") } - if _, ok := raw["commission_withdrawal"]; raw != nil && !ok { + if v, ok := raw["commission_withdrawal"]; !ok || v == nil { return fmt.Errorf("field commission_withdrawal in PaymentagentCreate: required") } - if _, ok := raw["email"]; raw != nil && !ok { + if v, ok := raw["email"]; !ok || v == nil { return fmt.Errorf("field email in PaymentagentCreate: required") } - if _, ok := raw["information"]; raw != nil && !ok { + if v, ok := raw["information"]; !ok || v == nil { return fmt.Errorf("field information in PaymentagentCreate: required") } - if _, ok := raw["payment_agent_name"]; raw != nil && !ok { + if v, ok := raw["payment_agent_name"]; !ok || v == nil { return fmt.Errorf("field payment_agent_name in PaymentagentCreate: required") } - if _, ok := raw["paymentagent_create"]; raw != nil && !ok { + if v, ok := raw["paymentagent_create"]; !ok || v == nil { return fmt.Errorf("field paymentagent_create in PaymentagentCreate: required") } - if _, ok := raw["supported_payment_methods"]; raw != nil && !ok { + if v, ok := raw["supported_payment_methods"]; !ok || v == nil { return fmt.Errorf("field supported_payment_methods in PaymentagentCreate: required") } - if _, ok := raw["urls"]; raw != nil && !ok { + if v, ok := raw["urls"]; !ok || v == nil { return fmt.Errorf("field urls in PaymentagentCreate: required") } type Plain PaymentagentCreate diff --git a/schema/paymentagent_create_resp.go b/schema/paymentagent_create_resp.go index 307727e..6a24eea 100644 --- a/schema/paymentagent_create_resp.go +++ b/schema/paymentagent_create_resp.go @@ -6,26 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Sets client's payment agent details. -type PaymentagentCreateResp struct { - // Echo of the request made. - EchoReq PaymentagentCreateRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType PaymentagentCreateRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type PaymentagentCreateRespEchoReq map[string]interface{} type PaymentagentCreateRespMsgType string -const PaymentagentCreateRespMsgTypePaymentagentCreate PaymentagentCreateRespMsgType = "paymentagent_create" - var enumValues_PaymentagentCreateRespMsgType = []interface{}{ "paymentagent_create", } @@ -50,16 +35,31 @@ func (j *PaymentagentCreateRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Sets client's payment agent details. +type PaymentagentCreateResp struct { + // Echo of the request made. + EchoReq PaymentagentCreateRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType PaymentagentCreateRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const PaymentagentCreateRespMsgTypePaymentagentCreate PaymentagentCreateRespMsgType = "paymentagent_create" + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentCreateResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PaymentagentCreateResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PaymentagentCreateResp: required") } type Plain PaymentagentCreateResp diff --git a/schema/paymentagent_details.go b/schema/paymentagent_details.go index 70cf9bb..576a3b6 100644 --- a/schema/paymentagent_details.go +++ b/schema/paymentagent_details.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Gets client's payment agent details. -type PaymentagentDetails struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough PaymentagentDetailsPassthrough `json:"passthrough,omitempty"` - - // Must be 1 - PaymentagentDetails PaymentagentDetailsPaymentagentDetails `json:"paymentagent_details"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type PaymentagentDetailsPassthrough map[string]interface{} @@ -53,13 +36,30 @@ func (j *PaymentagentDetailsPaymentagentDetails) UnmarshalJSON(b []byte) error { return nil } +// Gets client's payment agent details. +type PaymentagentDetails struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough PaymentagentDetailsPassthrough `json:"passthrough,omitempty"` + + // Must be 1 + PaymentagentDetails PaymentagentDetailsPaymentagentDetails `json:"paymentagent_details"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["paymentagent_details"]; raw != nil && !ok { + if v, ok := raw["paymentagent_details"]; !ok || v == nil { return fmt.Errorf("field paymentagent_details in PaymentagentDetails: required") } type Plain PaymentagentDetails diff --git a/schema/paymentagent_details_resp.go b/schema/paymentagent_details_resp.go index df811af..bc0c87f 100644 --- a/schema/paymentagent_details_resp.go +++ b/schema/paymentagent_details_resp.go @@ -33,30 +33,6 @@ type PaymentagentDetailsRespMsgType string const PaymentagentDetailsRespMsgTypePaymentagentDetails PaymentagentDetailsRespMsgType = "paymentagent_details" -var enumValues_PaymentagentDetailsRespMsgType = []interface{}{ - "paymentagent_details", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *PaymentagentDetailsRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_PaymentagentDetailsRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PaymentagentDetailsRespMsgType, v) - } - *j = PaymentagentDetailsRespMsgType(v) - return nil -} - // Used to pass data through the websocket, which may be retrieved via the // `echo_req` output field. type PaymentagentDetailsRespPassthrough map[string]interface{} @@ -122,60 +98,60 @@ type PaymentagentDetailsRespPaymentagentDetails struct { type PaymentagentDetailsRespPaymentagentDetailsCanApply int -var enumValues_PaymentagentDetailsRespPaymentagentDetailsCanApply = []interface{}{ +type PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval int + +type PaymentagentDetailsRespPaymentagentDetailsNewlyAuthorized int + +type PaymentagentDetailsRespPaymentagentDetailsPhoneNumbersElem struct { + // A phone number. + PhoneNumber *string `json:"phone_number,omitempty"` +} + +var enumValues_PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *PaymentagentDetailsRespPaymentagentDetailsCanApply) UnmarshalJSON(b []byte) error { +func (j *PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_PaymentagentDetailsRespPaymentagentDetailsCanApply { + for _, expected := range enumValues_PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PaymentagentDetailsRespPaymentagentDetailsCanApply, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval, v) } - *j = PaymentagentDetailsRespPaymentagentDetailsCanApply(v) + *j = PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval(v) return nil } -type PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval int - -var enumValues_PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval) UnmarshalJSON(b []byte) error { +func (j *PaymentagentDetailsRespPaymentagentDetailsCanApply) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval { + for _, expected := range enumValues_PaymentagentDetailsRespPaymentagentDetailsCanApply { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PaymentagentDetailsRespPaymentagentDetailsCanApply, v) } - *j = PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval(v) + *j = PaymentagentDetailsRespPaymentagentDetailsCanApply(v) return nil } -type PaymentagentDetailsRespPaymentagentDetailsNewlyAuthorized int - var enumValues_PaymentagentDetailsRespPaymentagentDetailsNewlyAuthorized = []interface{}{ 0, 1, @@ -201,11 +177,6 @@ func (j *PaymentagentDetailsRespPaymentagentDetailsNewlyAuthorized) UnmarshalJSO return nil } -type PaymentagentDetailsRespPaymentagentDetailsPhoneNumbersElem struct { - // A phone number. - PhoneNumber *string `json:"phone_number,omitempty"` -} - type PaymentagentDetailsRespPaymentagentDetailsSupportedPaymentMethodsElem struct { // A payment method's name PaymentMethod *string `json:"payment_method,omitempty"` @@ -216,13 +187,38 @@ type PaymentagentDetailsRespPaymentagentDetailsUrlsElem struct { Url *string `json:"url,omitempty"` } +var enumValues_PaymentagentDetailsRespPaymentagentDetailsCanApply = []interface{}{ + 0, + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *PaymentagentDetailsRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_PaymentagentDetailsRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PaymentagentDetailsRespMsgType, v) + } + *j = PaymentagentDetailsRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentDetailsRespPaymentagentDetails) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["can_apply"]; raw != nil && !ok { + if v, ok := raw["can_apply"]; !ok || v == nil { return fmt.Errorf("field can_apply in PaymentagentDetailsRespPaymentagentDetails: required") } type Plain PaymentagentDetailsRespPaymentagentDetails @@ -234,16 +230,20 @@ func (j *PaymentagentDetailsRespPaymentagentDetails) UnmarshalJSON(b []byte) err return nil } +var enumValues_PaymentagentDetailsRespMsgType = []interface{}{ + "paymentagent_details", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentDetailsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PaymentagentDetailsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PaymentagentDetailsResp: required") } type Plain PaymentagentDetailsResp diff --git a/schema/paymentagent_list.go b/schema/paymentagent_list.go index 2915b7e..c3c728d 100644 --- a/schema/paymentagent_list.go +++ b/schema/paymentagent_list.go @@ -38,7 +38,7 @@ func (j *PaymentagentList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["paymentagent_list"]; raw != nil && !ok { + if v, ok := raw["paymentagent_list"]; !ok || v == nil { return fmt.Errorf("field paymentagent_list in PaymentagentList: required") } type Plain PaymentagentList diff --git a/schema/paymentagent_list_resp.go b/schema/paymentagent_list_resp.go index beab941..d42eea2 100644 --- a/schema/paymentagent_list_resp.go +++ b/schema/paymentagent_list_resp.go @@ -29,30 +29,6 @@ type PaymentagentListRespMsgType string const PaymentagentListRespMsgTypePaymentagentList PaymentagentListRespMsgType = "paymentagent_list" -var enumValues_PaymentagentListRespMsgType = []interface{}{ - "paymentagent_list", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *PaymentagentListRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_PaymentagentListRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PaymentagentListRespMsgType, v) - } - *j = PaymentagentListRespMsgType(v) - return nil -} - // Payment Agent List type PaymentagentListRespPaymentagentList struct { // The list of countries in which payment agent is available. @@ -124,43 +100,43 @@ func (j *PaymentagentListRespPaymentagentListListElem) UnmarshalJSON(b []byte) e if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["currencies"]; raw != nil && !ok { + if v, ok := raw["currencies"]; !ok || v == nil { return fmt.Errorf("field currencies in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["deposit_commission"]; raw != nil && !ok { + if v, ok := raw["deposit_commission"]; !ok || v == nil { return fmt.Errorf("field deposit_commission in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["email"]; raw != nil && !ok { + if v, ok := raw["email"]; !ok || v == nil { return fmt.Errorf("field email in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["further_information"]; raw != nil && !ok { + if v, ok := raw["further_information"]; !ok || v == nil { return fmt.Errorf("field further_information in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["max_withdrawal"]; raw != nil && !ok { + if v, ok := raw["max_withdrawal"]; !ok || v == nil { return fmt.Errorf("field max_withdrawal in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["min_withdrawal"]; raw != nil && !ok { + if v, ok := raw["min_withdrawal"]; !ok || v == nil { return fmt.Errorf("field min_withdrawal in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["paymentagent_loginid"]; raw != nil && !ok { + if v, ok := raw["paymentagent_loginid"]; !ok || v == nil { return fmt.Errorf("field paymentagent_loginid in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["phone_numbers"]; raw != nil && !ok { + if v, ok := raw["phone_numbers"]; !ok || v == nil { return fmt.Errorf("field phone_numbers in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["summary"]; raw != nil && !ok { + if v, ok := raw["summary"]; !ok || v == nil { return fmt.Errorf("field summary in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["supported_payment_methods"]; raw != nil && !ok { + if v, ok := raw["supported_payment_methods"]; !ok || v == nil { return fmt.Errorf("field supported_payment_methods in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["urls"]; raw != nil && !ok { + if v, ok := raw["urls"]; !ok || v == nil { return fmt.Errorf("field urls in PaymentagentListRespPaymentagentListListElem: required") } - if _, ok := raw["withdrawal_commission"]; raw != nil && !ok { + if v, ok := raw["withdrawal_commission"]; !ok || v == nil { return fmt.Errorf("field withdrawal_commission in PaymentagentListRespPaymentagentListListElem: required") } type Plain PaymentagentListRespPaymentagentListListElem @@ -172,13 +148,33 @@ func (j *PaymentagentListRespPaymentagentListListElem) UnmarshalJSON(b []byte) e return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *PaymentagentListRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_PaymentagentListRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_PaymentagentListRespMsgType, v) + } + *j = PaymentagentListRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentListRespPaymentagentList) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["list"]; raw != nil && !ok { + if v, ok := raw["list"]; !ok || v == nil { return fmt.Errorf("field list in PaymentagentListRespPaymentagentList: required") } type Plain PaymentagentListRespPaymentagentList @@ -190,16 +186,20 @@ func (j *PaymentagentListRespPaymentagentList) UnmarshalJSON(b []byte) error { return nil } +var enumValues_PaymentagentListRespMsgType = []interface{}{ + "paymentagent_list", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PaymentagentListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PaymentagentListResp: required") } type Plain PaymentagentListResp diff --git a/schema/paymentagent_transfer.go b/schema/paymentagent_transfer.go index 53785ea..bd7a73d 100644 --- a/schema/paymentagent_transfer.go +++ b/schema/paymentagent_transfer.go @@ -6,39 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Payment Agent Transfer - this call is available only to accounts that are -// approved Payment Agents. -type PaymentagentTransfer struct { - // The amount to transfer. - Amount float64 `json:"amount"` - - // Currency code. - Currency string `json:"currency"` - - // [Optional] Remarks about the transfer. - Description *string `json:"description,omitempty"` - - // [Optional] If set to `1`, just do validation. - DryRun *PaymentagentTransferDryRun `json:"dry_run,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough PaymentagentTransferPassthrough `json:"passthrough,omitempty"` - - // Must be `1` - PaymentagentTransfer PaymentagentTransferPaymentagentTransfer `json:"paymentagent_transfer"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // The loginid of the recipient account. - TransferTo string `json:"transfer_to"` -} - type PaymentagentTransferDryRun int var enumValues_PaymentagentTransferDryRun = []interface{}{ @@ -96,22 +63,55 @@ func (j *PaymentagentTransferPaymentagentTransfer) UnmarshalJSON(b []byte) error return nil } +// Payment Agent Transfer - this call is available only to accounts that are +// approved Payment Agents. +type PaymentagentTransfer struct { + // The amount to transfer. + Amount float64 `json:"amount"` + + // Currency code. + Currency string `json:"currency"` + + // [Optional] Remarks about the transfer. + Description *string `json:"description,omitempty"` + + // [Optional] If set to `1`, just do validation. + DryRun *PaymentagentTransferDryRun `json:"dry_run,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough PaymentagentTransferPassthrough `json:"passthrough,omitempty"` + + // Must be `1` + PaymentagentTransfer PaymentagentTransferPaymentagentTransfer `json:"paymentagent_transfer"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // The loginid of the recipient account. + TransferTo string `json:"transfer_to"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentTransfer) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in PaymentagentTransfer: required") } - if _, ok := raw["currency"]; raw != nil && !ok { + if v, ok := raw["currency"]; !ok || v == nil { return fmt.Errorf("field currency in PaymentagentTransfer: required") } - if _, ok := raw["paymentagent_transfer"]; raw != nil && !ok { + if v, ok := raw["paymentagent_transfer"]; !ok || v == nil { return fmt.Errorf("field paymentagent_transfer in PaymentagentTransfer: required") } - if _, ok := raw["transfer_to"]; raw != nil && !ok { + if v, ok := raw["transfer_to"]; !ok || v == nil { return fmt.Errorf("field transfer_to in PaymentagentTransfer: required") } type Plain PaymentagentTransfer diff --git a/schema/paymentagent_transfer_resp.go b/schema/paymentagent_transfer_resp.go index 49cca71..c667655 100644 --- a/schema/paymentagent_transfer_resp.go +++ b/schema/paymentagent_transfer_resp.go @@ -6,38 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of transfer request made. -type PaymentagentTransferResp struct { - // The `transfer_to` client full name - ClientToFullName *string `json:"client_to_full_name,omitempty"` - - // The `transfer_to` client loginid - ClientToLoginid *string `json:"client_to_loginid,omitempty"` - - // Echo of the request made. - EchoReq PaymentagentTransferRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType PaymentagentTransferRespMsgType `json:"msg_type"` - - // If set to `1`, transfer success. If set to `2`, dry-run success. - PaymentagentTransfer *PaymentagentTransferRespPaymentagentTransfer `json:"paymentagent_transfer,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Reference ID of transfer performed - TransactionId *int `json:"transaction_id,omitempty"` -} - // Echo of the request made. type PaymentagentTransferRespEchoReq map[string]interface{} type PaymentagentTransferRespMsgType string -const PaymentagentTransferRespMsgTypePaymentagentTransfer PaymentagentTransferRespMsgType = "paymentagent_transfer" - var enumValues_PaymentagentTransferRespMsgType = []interface{}{ "paymentagent_transfer", } @@ -62,6 +35,8 @@ func (j *PaymentagentTransferRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const PaymentagentTransferRespMsgTypePaymentagentTransfer PaymentagentTransferRespMsgType = "paymentagent_transfer" + type PaymentagentTransferRespPaymentagentTransfer int var enumValues_PaymentagentTransferRespPaymentagentTransfer = []interface{}{ @@ -89,16 +64,41 @@ func (j *PaymentagentTransferRespPaymentagentTransfer) UnmarshalJSON(b []byte) e return nil } +// The result of transfer request made. +type PaymentagentTransferResp struct { + // The `transfer_to` client full name + ClientToFullName *string `json:"client_to_full_name,omitempty"` + + // The `transfer_to` client loginid + ClientToLoginid *string `json:"client_to_loginid,omitempty"` + + // Echo of the request made. + EchoReq PaymentagentTransferRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType PaymentagentTransferRespMsgType `json:"msg_type"` + + // If set to `1`, transfer success. If set to `2`, dry-run success. + PaymentagentTransfer *PaymentagentTransferRespPaymentagentTransfer `json:"paymentagent_transfer,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Reference ID of transfer performed + TransactionId *int `json:"transaction_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentTransferResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PaymentagentTransferResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PaymentagentTransferResp: required") } type Plain PaymentagentTransferResp diff --git a/schema/paymentagent_withdraw.go b/schema/paymentagent_withdraw.go index 5836149..04633b1 100644 --- a/schema/paymentagent_withdraw.go +++ b/schema/paymentagent_withdraw.go @@ -6,43 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Initiate a withdrawal to an approved Payment Agent. -type PaymentagentWithdraw struct { - // The amount to withdraw to the payment agent. - Amount float64 `json:"amount"` - - // The currency code. - Currency string `json:"currency"` - - // [Optional] Remarks about the withdraw. Only letters, numbers, space, period, - // comma, - ' are allowed. - Description *string `json:"description,omitempty"` - - // [Optional] If set to 1, just do validation. - DryRun *PaymentagentWithdrawDryRun `json:"dry_run,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough PaymentagentWithdrawPassthrough `json:"passthrough,omitempty"` - - // The payment agent loginid received from the `paymentagent_list` call. - PaymentagentLoginid string `json:"paymentagent_loginid"` - - // Must be `1` - PaymentagentWithdraw PaymentagentWithdrawPaymentagentWithdraw `json:"paymentagent_withdraw"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Email verification code (received from a `verify_email` call, which must be - // done first) - VerificationCode string `json:"verification_code"` -} - type PaymentagentWithdrawDryRun int var enumValues_PaymentagentWithdrawDryRun = []interface{}{ @@ -100,25 +63,62 @@ func (j *PaymentagentWithdrawPaymentagentWithdraw) UnmarshalJSON(b []byte) error return nil } +// Initiate a withdrawal to an approved Payment Agent. +type PaymentagentWithdraw struct { + // The amount to withdraw to the payment agent. + Amount float64 `json:"amount"` + + // The currency code. + Currency string `json:"currency"` + + // [Optional] Remarks about the withdraw. Only letters, numbers, space, period, + // comma, - ' are allowed. + Description *string `json:"description,omitempty"` + + // [Optional] If set to 1, just do validation. + DryRun *PaymentagentWithdrawDryRun `json:"dry_run,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough PaymentagentWithdrawPassthrough `json:"passthrough,omitempty"` + + // The payment agent loginid received from the `paymentagent_list` call. + PaymentagentLoginid string `json:"paymentagent_loginid"` + + // Must be `1` + PaymentagentWithdraw PaymentagentWithdrawPaymentagentWithdraw `json:"paymentagent_withdraw"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Email verification code (received from a `verify_email` call, which must be + // done first) + VerificationCode string `json:"verification_code"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentWithdraw) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["amount"]; raw != nil && !ok { + if v, ok := raw["amount"]; !ok || v == nil { return fmt.Errorf("field amount in PaymentagentWithdraw: required") } - if _, ok := raw["currency"]; raw != nil && !ok { + if v, ok := raw["currency"]; !ok || v == nil { return fmt.Errorf("field currency in PaymentagentWithdraw: required") } - if _, ok := raw["paymentagent_loginid"]; raw != nil && !ok { + if v, ok := raw["paymentagent_loginid"]; !ok || v == nil { return fmt.Errorf("field paymentagent_loginid in PaymentagentWithdraw: required") } - if _, ok := raw["paymentagent_withdraw"]; raw != nil && !ok { + if v, ok := raw["paymentagent_withdraw"]; !ok || v == nil { return fmt.Errorf("field paymentagent_withdraw in PaymentagentWithdraw: required") } - if _, ok := raw["verification_code"]; raw != nil && !ok { + if v, ok := raw["verification_code"]; !ok || v == nil { return fmt.Errorf("field verification_code in PaymentagentWithdraw: required") } type Plain PaymentagentWithdraw diff --git a/schema/paymentagent_withdraw_justification.go b/schema/paymentagent_withdraw_justification.go index d701f20..619c08d 100644 --- a/schema/paymentagent_withdraw_justification.go +++ b/schema/paymentagent_withdraw_justification.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Provide justification to perform withdrawal using a Payment Agent. -type PaymentagentWithdrawJustification struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // Reasons for needing to withdraw using a Payment Agent. - Message *string `json:"message,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough PaymentagentWithdrawJustificationPassthrough `json:"passthrough,omitempty"` - - // Must be `1` - PaymentagentWithdrawJustification PaymentagentWithdrawJustificationPaymentagentWithdrawJustification `json:"paymentagent_withdraw_justification"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type PaymentagentWithdrawJustificationPassthrough map[string]interface{} @@ -56,13 +36,33 @@ func (j *PaymentagentWithdrawJustificationPaymentagentWithdrawJustification) Unm return nil } +// Provide justification to perform withdrawal using a Payment Agent. +type PaymentagentWithdrawJustification struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // Reasons for needing to withdraw using a Payment Agent. + Message *string `json:"message,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough PaymentagentWithdrawJustificationPassthrough `json:"passthrough,omitempty"` + + // Must be `1` + PaymentagentWithdrawJustification PaymentagentWithdrawJustificationPaymentagentWithdrawJustification `json:"paymentagent_withdraw_justification"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentWithdrawJustification) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["paymentagent_withdraw_justification"]; raw != nil && !ok { + if v, ok := raw["paymentagent_withdraw_justification"]; !ok || v == nil { return fmt.Errorf("field paymentagent_withdraw_justification in PaymentagentWithdrawJustification: required") } type Plain PaymentagentWithdrawJustification diff --git a/schema/paymentagent_withdraw_justification_resp.go b/schema/paymentagent_withdraw_justification_resp.go index 2e237d5..2c498a1 100644 --- a/schema/paymentagent_withdraw_justification_resp.go +++ b/schema/paymentagent_withdraw_justification_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of payment agent withdrawal justification request made. -type PaymentagentWithdrawJustificationResp struct { - // Echo of the request made. - EchoReq PaymentagentWithdrawJustificationRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType PaymentagentWithdrawJustificationRespMsgType `json:"msg_type"` - - // 1 on success - PaymentagentWithdrawJustification *int `json:"paymentagent_withdraw_justification,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type PaymentagentWithdrawJustificationRespEchoReq map[string]interface{} type PaymentagentWithdrawJustificationRespMsgType string -const PaymentagentWithdrawJustificationRespMsgTypePaymentagentWithdrawJustification PaymentagentWithdrawJustificationRespMsgType = "paymentagent_withdraw_justification" - var enumValues_PaymentagentWithdrawJustificationRespMsgType = []interface{}{ "paymentagent_withdraw_justification", } @@ -53,16 +35,34 @@ func (j *PaymentagentWithdrawJustificationRespMsgType) UnmarshalJSON(b []byte) e return nil } +// The result of payment agent withdrawal justification request made. +type PaymentagentWithdrawJustificationResp struct { + // Echo of the request made. + EchoReq PaymentagentWithdrawJustificationRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType PaymentagentWithdrawJustificationRespMsgType `json:"msg_type"` + + // 1 on success + PaymentagentWithdrawJustification *int `json:"paymentagent_withdraw_justification,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const PaymentagentWithdrawJustificationRespMsgTypePaymentagentWithdrawJustification PaymentagentWithdrawJustificationRespMsgType = "paymentagent_withdraw_justification" + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentWithdrawJustificationResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PaymentagentWithdrawJustificationResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PaymentagentWithdrawJustificationResp: required") } type Plain PaymentagentWithdrawJustificationResp diff --git a/schema/paymentagent_withdraw_resp.go b/schema/paymentagent_withdraw_resp.go index 8639d12..d2af56e 100644 --- a/schema/paymentagent_withdraw_resp.go +++ b/schema/paymentagent_withdraw_resp.go @@ -6,35 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of payment agent withdrawal request made. -type PaymentagentWithdrawResp struct { - // Echo of the request made. - EchoReq PaymentagentWithdrawRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType PaymentagentWithdrawRespMsgType `json:"msg_type"` - - // Payment agent name. - PaymentagentName *string `json:"paymentagent_name,omitempty"` - - // If set to `1`, withdrawal success. If set to `2`, dry-run success. - PaymentagentWithdraw *PaymentagentWithdrawRespPaymentagentWithdraw `json:"paymentagent_withdraw,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Reference ID of withdrawal performed. - TransactionId *int `json:"transaction_id,omitempty"` -} - // Echo of the request made. type PaymentagentWithdrawRespEchoReq map[string]interface{} type PaymentagentWithdrawRespMsgType string -const PaymentagentWithdrawRespMsgTypePaymentagentWithdraw PaymentagentWithdrawRespMsgType = "paymentagent_withdraw" - var enumValues_PaymentagentWithdrawRespMsgType = []interface{}{ "paymentagent_withdraw", } @@ -59,6 +35,8 @@ func (j *PaymentagentWithdrawRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const PaymentagentWithdrawRespMsgTypePaymentagentWithdraw PaymentagentWithdrawRespMsgType = "paymentagent_withdraw" + type PaymentagentWithdrawRespPaymentagentWithdraw int var enumValues_PaymentagentWithdrawRespPaymentagentWithdraw = []interface{}{ @@ -86,16 +64,38 @@ func (j *PaymentagentWithdrawRespPaymentagentWithdraw) UnmarshalJSON(b []byte) e return nil } +// The result of payment agent withdrawal request made. +type PaymentagentWithdrawResp struct { + // Echo of the request made. + EchoReq PaymentagentWithdrawRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType PaymentagentWithdrawRespMsgType `json:"msg_type"` + + // Payment agent name. + PaymentagentName *string `json:"paymentagent_name,omitempty"` + + // If set to `1`, withdrawal success. If set to `2`, dry-run success. + PaymentagentWithdraw *PaymentagentWithdrawRespPaymentagentWithdraw `json:"paymentagent_withdraw,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Reference ID of withdrawal performed. + TransactionId *int `json:"transaction_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PaymentagentWithdrawResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PaymentagentWithdrawResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PaymentagentWithdrawResp: required") } type Plain PaymentagentWithdrawResp diff --git a/schema/payout_currencies.go b/schema/payout_currencies.go index 940affd..e2de1ab 100644 --- a/schema/payout_currencies.go +++ b/schema/payout_currencies.go @@ -6,24 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieve a list of available option payout currencies. If a user is logged in, -// only the currencies available for the account will be returned. -type PayoutCurrencies struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough PayoutCurrenciesPassthrough `json:"passthrough,omitempty"` - - // Must be `1` - PayoutCurrencies PayoutCurrenciesPayoutCurrencies `json:"payout_currencies"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type PayoutCurrenciesPassthrough map[string]interface{} @@ -54,13 +36,31 @@ func (j *PayoutCurrenciesPayoutCurrencies) UnmarshalJSON(b []byte) error { return nil } +// Retrieve a list of available option payout currencies. If a user is logged in, +// only the currencies available for the account will be returned. +type PayoutCurrencies struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough PayoutCurrenciesPassthrough `json:"passthrough,omitempty"` + + // Must be `1` + PayoutCurrencies PayoutCurrenciesPayoutCurrencies `json:"payout_currencies"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PayoutCurrencies) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["payout_currencies"]; raw != nil && !ok { + if v, ok := raw["payout_currencies"]; !ok || v == nil { return fmt.Errorf("field payout_currencies in PayoutCurrencies: required") } type Plain PayoutCurrencies diff --git a/schema/payout_currencies_resp.go b/schema/payout_currencies_resp.go index 0cc0c3e..fc7e191 100644 --- a/schema/payout_currencies_resp.go +++ b/schema/payout_currencies_resp.go @@ -6,30 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// List of available payout currencies. -type PayoutCurrenciesResp struct { - // Echo of the request made. - EchoReq PayoutCurrenciesRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType PayoutCurrenciesRespMsgType `json:"msg_type"` - - // Available payout currencies. Note: if a user is logged in, only the currency - // available for the account will be returned. - PayoutCurrencies []string `json:"payout_currencies,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type PayoutCurrenciesRespEchoReq map[string]interface{} type PayoutCurrenciesRespMsgType string -const PayoutCurrenciesRespMsgTypePayoutCurrencies PayoutCurrenciesRespMsgType = "payout_currencies" - var enumValues_PayoutCurrenciesRespMsgType = []interface{}{ "payout_currencies", } @@ -54,16 +35,35 @@ func (j *PayoutCurrenciesRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// List of available payout currencies. +type PayoutCurrenciesResp struct { + // Echo of the request made. + EchoReq PayoutCurrenciesRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType PayoutCurrenciesRespMsgType `json:"msg_type"` + + // Available payout currencies. Note: if a user is logged in, only the currency + // available for the account will be returned. + PayoutCurrencies []string `json:"payout_currencies,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const PayoutCurrenciesRespMsgTypePayoutCurrencies PayoutCurrenciesRespMsgType = "payout_currencies" + // UnmarshalJSON implements json.Unmarshaler. func (j *PayoutCurrenciesResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PayoutCurrenciesResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PayoutCurrenciesResp: required") } type Plain PayoutCurrenciesResp diff --git a/schema/ping.go b/schema/ping.go index def60e7..8f81fdb 100644 --- a/schema/ping.go +++ b/schema/ping.go @@ -6,20 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// To send the ping request to the server. Mostly used to test the connection or to -// keep it alive. -type Ping struct { - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough PingPassthrough `json:"passthrough,omitempty"` - - // Must be `1` - Ping PingPing `json:"ping"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type PingPassthrough map[string]interface{} @@ -50,13 +36,27 @@ func (j *PingPing) UnmarshalJSON(b []byte) error { return nil } +// To send the ping request to the server. Mostly used to test the connection or to +// keep it alive. +type Ping struct { + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough PingPassthrough `json:"passthrough,omitempty"` + + // Must be `1` + Ping PingPing `json:"ping"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Ping) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["ping"]; raw != nil && !ok { + if v, ok := raw["ping"]; !ok || v == nil { return fmt.Errorf("field ping in Ping: required") } type Plain Ping diff --git a/schema/ping_resp.go b/schema/ping_resp.go index 08740dc..8b383ab 100644 --- a/schema/ping_resp.go +++ b/schema/ping_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The response of ping request. -type PingResp struct { - // Echo of the request made. - EchoReq PingRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType PingRespMsgType `json:"msg_type"` - - // Will return 'pong' - Ping *PingRespPing `json:"ping,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type PingRespEchoReq map[string]interface{} type PingRespMsgType string -const PingRespMsgTypePing PingRespMsgType = "ping" - var enumValues_PingRespMsgType = []interface{}{ "ping", } @@ -53,9 +35,9 @@ func (j *PingRespMsgType) UnmarshalJSON(b []byte) error { return nil } -type PingRespPing string +const PingRespMsgTypePing PingRespMsgType = "ping" -const PingRespPingPong PingRespPing = "pong" +type PingRespPing string var enumValues_PingRespPing = []interface{}{ "pong", @@ -81,16 +63,34 @@ func (j *PingRespPing) UnmarshalJSON(b []byte) error { return nil } +// The response of ping request. +type PingResp struct { + // Echo of the request made. + EchoReq PingRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType PingRespMsgType `json:"msg_type"` + + // Will return 'pong' + Ping *PingRespPing `json:"ping,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const PingRespPingPong PingRespPing = "pong" + // UnmarshalJSON implements json.Unmarshaler. func (j *PingResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PingResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PingResp: required") } type Plain PingResp diff --git a/schema/portfolio.go b/schema/portfolio.go index 371a924..2ae7c2b 100644 --- a/schema/portfolio.go +++ b/schema/portfolio.go @@ -67,47 +67,6 @@ const PortfolioContractTypeElemUPORDOWN PortfolioContractTypeElem = "UPORDOWN" const PortfolioContractTypeElemVANILLALONGCALL PortfolioContractTypeElem = "VANILLALONGCALL" const PortfolioContractTypeElemVANILLALONGPUT PortfolioContractTypeElem = "VANILLALONGPUT" -var enumValues_PortfolioContractTypeElem = []interface{}{ - "ACCU", - "ASIAND", - "ASIANU", - "CALL", - "CALLE", - "CALLSPREAD", - "DIGITDIFF", - "DIGITEVEN", - "DIGITMATCH", - "DIGITODD", - "DIGITOVER", - "DIGITUNDER", - "EXPIRYMISSE", - "EXPIRYMISS", - "EXPIRYRANGE", - "EXPIRYRANGEE", - "LBFLOATCALL", - "LBFLOATPUT", - "LBHIGHLOW", - "MULTDOWN", - "MULTUP", - "NOTOUCH", - "ONETOUCH", - "PUT", - "PUTE", - "PUTSPREAD", - "RANGE", - "RESETCALL", - "RESETPUT", - "RUNHIGH", - "RUNLOW", - "TICKHIGH", - "TICKLOW", - "UPORDOWN", - "VANILLALONGCALL", - "VANILLALONGPUT", - "TURBOSLONG", - "TURBOSSHORT", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *PortfolioContractTypeElem) UnmarshalJSON(b []byte) error { var v string @@ -158,13 +117,54 @@ func (j *PortfolioPortfolio) UnmarshalJSON(b []byte) error { return nil } +var enumValues_PortfolioContractTypeElem = []interface{}{ + "ACCU", + "ASIAND", + "ASIANU", + "CALL", + "CALLE", + "CALLSPREAD", + "DIGITDIFF", + "DIGITEVEN", + "DIGITMATCH", + "DIGITODD", + "DIGITOVER", + "DIGITUNDER", + "EXPIRYMISSE", + "EXPIRYMISS", + "EXPIRYRANGE", + "EXPIRYRANGEE", + "LBFLOATCALL", + "LBFLOATPUT", + "LBHIGHLOW", + "MULTDOWN", + "MULTUP", + "NOTOUCH", + "ONETOUCH", + "PUT", + "PUTE", + "PUTSPREAD", + "RANGE", + "RESETCALL", + "RESETPUT", + "RUNHIGH", + "RUNLOW", + "TICKHIGH", + "TICKLOW", + "UPORDOWN", + "VANILLALONGCALL", + "VANILLALONGPUT", + "TURBOSLONG", + "TURBOSSHORT", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Portfolio) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["portfolio"]; raw != nil && !ok { + if v, ok := raw["portfolio"]; !ok || v == nil { return fmt.Errorf("field portfolio in Portfolio: required") } type Plain Portfolio diff --git a/schema/portfolio_resp.go b/schema/portfolio_resp.go index 9e0a159..2d8e5bd 100644 --- a/schema/portfolio_resp.go +++ b/schema/portfolio_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Receive a list of outstanding options in the user's portfolio -type PortfolioResp struct { - // Echo of the request made. - EchoReq PortfolioRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType PortfolioRespMsgType `json:"msg_type"` - - // Current account's open positions. - Portfolio *PortfolioRespPortfolio `json:"portfolio,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type PortfolioRespEchoReq map[string]interface{} type PortfolioRespMsgType string -const PortfolioRespMsgTypePortfolio PortfolioRespMsgType = "portfolio" - var enumValues_PortfolioRespMsgType = []interface{}{ "portfolio", } @@ -53,6 +35,8 @@ func (j *PortfolioRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const PortfolioRespMsgTypePortfolio PortfolioRespMsgType = "portfolio" + // Current account's open positions. type PortfolioRespPortfolio struct { // List of open positions. @@ -109,7 +93,7 @@ func (j *PortfolioRespPortfolio) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["contracts"]; raw != nil && !ok { + if v, ok := raw["contracts"]; !ok || v == nil { return fmt.Errorf("field contracts in PortfolioRespPortfolio: required") } type Plain PortfolioRespPortfolio @@ -121,16 +105,32 @@ func (j *PortfolioRespPortfolio) UnmarshalJSON(b []byte) error { return nil } +// Receive a list of outstanding options in the user's portfolio +type PortfolioResp struct { + // Echo of the request made. + EchoReq PortfolioRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType PortfolioRespMsgType `json:"msg_type"` + + // Current account's open positions. + Portfolio *PortfolioRespPortfolio `json:"portfolio,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *PortfolioResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in PortfolioResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in PortfolioResp: required") } type Plain PortfolioResp diff --git a/schema/profit_table.go b/schema/profit_table.go index 2e83908..de933e8 100644 --- a/schema/profit_table.go +++ b/schema/profit_table.go @@ -85,100 +85,59 @@ const ProfitTableContractTypeElemUPORDOWN ProfitTableContractTypeElem = "UPORDOW const ProfitTableContractTypeElemVANILLALONGCALL ProfitTableContractTypeElem = "VANILLALONGCALL" const ProfitTableContractTypeElemVANILLALONGPUT ProfitTableContractTypeElem = "VANILLALONGPUT" -var enumValues_ProfitTableContractTypeElem = []interface{}{ - "ACCU", - "ASIAND", - "ASIANU", - "CALL", - "CALLE", - "CALLSPREAD", - "DIGITDIFF", - "DIGITEVEN", - "DIGITMATCH", - "DIGITODD", - "DIGITOVER", - "DIGITUNDER", - "EXPIRYMISSE", - "EXPIRYMISS", - "EXPIRYRANGE", - "EXPIRYRANGEE", - "LBFLOATCALL", - "LBFLOATPUT", - "LBHIGHLOW", - "MULTDOWN", - "MULTUP", - "NOTOUCH", - "ONETOUCH", - "PUT", - "PUTE", - "PUTSPREAD", - "RANGE", - "RESETCALL", - "RESETPUT", - "RUNHIGH", - "RUNLOW", - "TICKHIGH", - "TICKLOW", - "UPORDOWN", - "VANILLALONGCALL", - "VANILLALONGPUT", - "TURBOSLONG", - "TURBOSSHORT", -} +type ProfitTableDescription int + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type ProfitTablePassthrough map[string]interface{} + +type ProfitTableProfitTable int // UnmarshalJSON implements json.Unmarshaler. -func (j *ProfitTableContractTypeElem) UnmarshalJSON(b []byte) error { - var v string +func (j *ProfitTableDescription) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProfitTableContractTypeElem { + for _, expected := range enumValues_ProfitTableDescription { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProfitTableContractTypeElem, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProfitTableDescription, v) } - *j = ProfitTableContractTypeElem(v) + *j = ProfitTableDescription(v) return nil } -type ProfitTableDescription int - var enumValues_ProfitTableDescription = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProfitTableDescription) UnmarshalJSON(b []byte) error { - var v int +func (j *ProfitTableContractTypeElem) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProfitTableDescription { + for _, expected := range enumValues_ProfitTableContractTypeElem { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProfitTableDescription, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProfitTableContractTypeElem, v) } - *j = ProfitTableDescription(v) + *j = ProfitTableContractTypeElem(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type ProfitTablePassthrough map[string]interface{} - -type ProfitTableProfitTable int - var enumValues_ProfitTableProfitTable = []interface{}{ 1, } @@ -205,9 +164,6 @@ func (j *ProfitTableProfitTable) UnmarshalJSON(b []byte) error { type ProfitTableSort string -const ProfitTableSortASC ProfitTableSort = "ASC" -const ProfitTableSortDESC ProfitTableSort = "DESC" - var enumValues_ProfitTableSort = []interface{}{ "ASC", "DESC", @@ -233,13 +189,57 @@ func (j *ProfitTableSort) UnmarshalJSON(b []byte) error { return nil } +const ProfitTableSortASC ProfitTableSort = "ASC" +const ProfitTableSortDESC ProfitTableSort = "DESC" + +var enumValues_ProfitTableContractTypeElem = []interface{}{ + "ACCU", + "ASIAND", + "ASIANU", + "CALL", + "CALLE", + "CALLSPREAD", + "DIGITDIFF", + "DIGITEVEN", + "DIGITMATCH", + "DIGITODD", + "DIGITOVER", + "DIGITUNDER", + "EXPIRYMISSE", + "EXPIRYMISS", + "EXPIRYRANGE", + "EXPIRYRANGEE", + "LBFLOATCALL", + "LBFLOATPUT", + "LBHIGHLOW", + "MULTDOWN", + "MULTUP", + "NOTOUCH", + "ONETOUCH", + "PUT", + "PUTE", + "PUTSPREAD", + "RANGE", + "RESETCALL", + "RESETPUT", + "RUNHIGH", + "RUNLOW", + "TICKHIGH", + "TICKLOW", + "UPORDOWN", + "VANILLALONGCALL", + "VANILLALONGPUT", + "TURBOSLONG", + "TURBOSSHORT", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ProfitTable) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["profit_table"]; raw != nil && !ok { + if v, ok := raw["profit_table"]; !ok || v == nil { return fmt.Errorf("field profit_table in ProfitTable: required") } type Plain ProfitTable diff --git a/schema/profit_table_resp.go b/schema/profit_table_resp.go index 1ff400a..30b4156 100644 --- a/schema/profit_table_resp.go +++ b/schema/profit_table_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A summary of account profit table is received -type ProfitTableResp struct { - // Echo of the request made. - EchoReq ProfitTableRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType ProfitTableRespMsgType `json:"msg_type"` - - // Account Profit Table. - ProfitTable *ProfitTableRespProfitTable `json:"profit_table,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type ProfitTableRespEchoReq map[string]interface{} type ProfitTableRespMsgType string -const ProfitTableRespMsgTypeProfitTable ProfitTableRespMsgType = "profit_table" - var enumValues_ProfitTableRespMsgType = []interface{}{ "profit_table", } @@ -53,6 +35,24 @@ func (j *ProfitTableRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A summary of account profit table is received +type ProfitTableResp struct { + // Echo of the request made. + EchoReq ProfitTableRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType ProfitTableRespMsgType `json:"msg_type"` + + // Account Profit Table. + ProfitTable *ProfitTableRespProfitTable `json:"profit_table,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const ProfitTableRespMsgTypeProfitTable ProfitTableRespMsgType = "profit_table" + // Account Profit Table. type ProfitTableRespProfitTable struct { // Number of transactions returned in this call @@ -122,10 +122,10 @@ func (j *ProfitTableResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ProfitTableResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ProfitTableResp: required") } type Plain ProfitTableResp diff --git a/schema/proposal.go b/schema/proposal.go index 7d1863c..6d28be3 100644 --- a/schema/proposal.go +++ b/schema/proposal.go @@ -113,62 +113,11 @@ const ProposalBarrierRangeMiddle ProposalBarrierRange = "middle" const ProposalBarrierRangeTight ProposalBarrierRange = "tight" const ProposalBarrierRangeWide ProposalBarrierRange = "wide" -var enumValues_ProposalBarrierRange = []interface{}{ - "tight", - "middle", - "wide", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalBarrierRange) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ProposalBarrierRange { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalBarrierRange, v) - } - *j = ProposalBarrierRange(v) - return nil -} - type ProposalBasis string const ProposalBasisPayout ProposalBasis = "payout" const ProposalBasisStake ProposalBasis = "stake" -var enumValues_ProposalBasis = []interface{}{ - "payout", - "stake", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalBasis) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ProposalBasis { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalBasis, v) - } - *j = ProposalBasis(v) - return nil -} - type ProposalContractType string const ProposalContractTypeACCU ProposalContractType = "ACCU" @@ -210,6 +159,48 @@ const ProposalContractTypeUPORDOWN ProposalContractType = "UPORDOWN" const ProposalContractTypeVANILLALONGCALL ProposalContractType = "VANILLALONGCALL" const ProposalContractTypeVANILLALONGPUT ProposalContractType = "VANILLALONGPUT" +type ProposalDurationUnit string + +const ProposalDurationUnitD ProposalDurationUnit = "d" +const ProposalDurationUnitH ProposalDurationUnit = "h" +const ProposalDurationUnitM ProposalDurationUnit = "m" +const ProposalDurationUnitS ProposalDurationUnit = "s" +const ProposalDurationUnitT ProposalDurationUnit = "t" + +// Add an order to close the contract once the order condition is met (only for +// `MULTUP` and `MULTDOWN` and 'ACCU' contracts). Supported orders: `take_profit`, +// `stop_loss`. +type ProposalLimitOrder struct { + // Contract will be automatically closed when the value of the contract reaches a + // specific loss. + StopLoss *float64 `json:"stop_loss,omitempty"` + + // Contract will be automatically closed when the value of the contract reaches a + // specific profit. + TakeProfit *float64 `json:"take_profit,omitempty"` +} + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type ProposalPassthrough map[string]interface{} + +type ProposalProductType string + +const ProposalProductTypeBasic ProposalProductType = "basic" + +type ProposalProposal int + +type ProposalSubscribe int + +var enumValues_ProposalBarrierRange = []interface{}{ + "tight", + "middle", + "wide", +} +var enumValues_ProposalBasis = []interface{}{ + "payout", + "stake", +} var enumValues_ProposalContractType = []interface{}{ "MULTUP", "MULTDOWN", @@ -250,43 +241,37 @@ var enumValues_ProposalContractType = []interface{}{ "TURBOSLONG", "TURBOSSHORT", } +var enumValues_ProposalDurationUnit = []interface{}{ + "d", + "m", + "s", + "h", + "t", +} +var enumValues_ProposalProductType = []interface{}{ + "basic", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalContractType) UnmarshalJSON(b []byte) error { +func (j *ProposalProductType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalContractType { + for _, expected := range enumValues_ProposalProductType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalContractType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalProductType, v) } - *j = ProposalContractType(v) + *j = ProposalProductType(v) return nil } -type ProposalDurationUnit string - -const ProposalDurationUnitD ProposalDurationUnit = "d" -const ProposalDurationUnitH ProposalDurationUnit = "h" -const ProposalDurationUnitM ProposalDurationUnit = "m" -const ProposalDurationUnitS ProposalDurationUnit = "s" -const ProposalDurationUnitT ProposalDurationUnit = "t" - -var enumValues_ProposalDurationUnit = []interface{}{ - "d", - "m", - "s", - "h", - "t", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *ProposalDurationUnit) UnmarshalJSON(b []byte) error { var v string @@ -307,53 +292,26 @@ func (j *ProposalDurationUnit) UnmarshalJSON(b []byte) error { return nil } -// Add an order to close the contract once the order condition is met (only for -// `MULTUP` and `MULTDOWN` and 'ACCU' contracts). Supported orders: `take_profit`, -// `stop_loss`. -type ProposalLimitOrder struct { - // Contract will be automatically closed when the value of the contract reaches a - // specific loss. - StopLoss *float64 `json:"stop_loss,omitempty"` - - // Contract will be automatically closed when the value of the contract reaches a - // specific profit. - TakeProfit *float64 `json:"take_profit,omitempty"` -} - -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type ProposalPassthrough map[string]interface{} - -type ProposalProductType string - -const ProposalProductTypeBasic ProposalProductType = "basic" - -var enumValues_ProposalProductType = []interface{}{ - "basic", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalProductType) UnmarshalJSON(b []byte) error { +func (j *ProposalContractType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalProductType { + for _, expected := range enumValues_ProposalContractType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalProductType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalContractType, v) } - *j = ProposalProductType(v) + *j = ProposalContractType(v) return nil } -type ProposalProposal int - var enumValues_ProposalProposal = []interface{}{ 1, } @@ -378,7 +336,25 @@ func (j *ProposalProposal) UnmarshalJSON(b []byte) error { return nil } -type ProposalSubscribe int +// UnmarshalJSON implements json.Unmarshaler. +func (j *ProposalBasis) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ProposalBasis { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalBasis, v) + } + *j = ProposalBasis(v) + return nil +} var enumValues_ProposalSubscribe = []interface{}{ 1, @@ -404,22 +380,42 @@ func (j *ProposalSubscribe) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *ProposalBarrierRange) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ProposalBarrierRange { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalBarrierRange, v) + } + *j = ProposalBarrierRange(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Proposal) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["contract_type"]; raw != nil && !ok { + if v, ok := raw["contract_type"]; !ok || v == nil { return fmt.Errorf("field contract_type in Proposal: required") } - if _, ok := raw["currency"]; raw != nil && !ok { + if v, ok := raw["currency"]; !ok || v == nil { return fmt.Errorf("field currency in Proposal: required") } - if _, ok := raw["proposal"]; raw != nil && !ok { + if v, ok := raw["proposal"]; !ok || v == nil { return fmt.Errorf("field proposal in Proposal: required") } - if _, ok := raw["symbol"]; raw != nil && !ok { + if v, ok := raw["symbol"]; !ok || v == nil { return fmt.Errorf("field symbol in Proposal: required") } type Plain Proposal diff --git a/schema/proposal_open_contract.go b/schema/proposal_open_contract.go index 01c7225..aac61f5 100644 --- a/schema/proposal_open_contract.go +++ b/schema/proposal_open_contract.go @@ -6,30 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get latest price (and other information) for a contract in the user's portfolio -type ProposalOpenContract struct { - // [Optional] Contract ID received from a `portfolio` request. If not set, you - // will receive stream of all open contracts. - ContractId *int `json:"contract_id,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough ProposalOpenContractPassthrough `json:"passthrough,omitempty"` - - // Must be `1` - ProposalOpenContract ProposalOpenContractProposalOpenContract `json:"proposal_open_contract"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] `1` to stream. - Subscribe *ProposalOpenContractSubscribe `json:"subscribe,omitempty"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type ProposalOpenContractPassthrough map[string]interface{} @@ -86,13 +62,37 @@ func (j *ProposalOpenContractSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Get latest price (and other information) for a contract in the user's portfolio +type ProposalOpenContract struct { + // [Optional] Contract ID received from a `portfolio` request. If not set, you + // will receive stream of all open contracts. + ContractId *int `json:"contract_id,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough ProposalOpenContractPassthrough `json:"passthrough,omitempty"` + + // Must be `1` + ProposalOpenContract ProposalOpenContractProposalOpenContract `json:"proposal_open_contract"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] `1` to stream. + Subscribe *ProposalOpenContractSubscribe `json:"subscribe,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ProposalOpenContract) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["proposal_open_contract"]; raw != nil && !ok { + if v, ok := raw["proposal_open_contract"]; !ok || v == nil { return fmt.Errorf("field proposal_open_contract in ProposalOpenContract: required") } type Plain ProposalOpenContract diff --git a/schema/proposal_open_contract_resp.go b/schema/proposal_open_contract_resp.go index 31da701..86336b1 100644 --- a/schema/proposal_open_contract_resp.go +++ b/schema/proposal_open_contract_resp.go @@ -6,32 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Latest price and other details for an open contract in the user's portfolio -type ProposalOpenContractResp struct { - // Echo of the request made. - EchoReq ProposalOpenContractRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType *ProposalOpenContractRespMsgType `json:"msg_type,omitempty"` - - // Latest price and other details for an open contract - ProposalOpenContract *ProposalOpenContractRespProposalOpenContract `json:"proposal_open_contract,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *ProposalOpenContractRespSubscription `json:"subscription,omitempty"` -} - // Echo of the request made. type ProposalOpenContractRespEchoReq map[string]interface{} type ProposalOpenContractRespMsgType string -const ProposalOpenContractRespMsgTypeProposalOpenContract ProposalOpenContractRespMsgType = "proposal_open_contract" - var enumValues_ProposalOpenContractRespMsgType = []interface{}{ "proposal_open_contract", } @@ -56,752 +35,754 @@ func (j *ProposalOpenContractRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// Latest price and other details for an open contract -type ProposalOpenContractRespProposalOpenContract struct { - // Account Id - AccountId *float64 `json:"account_id,omitempty"` +const ProposalOpenContractRespMsgTypeProposalOpenContract ProposalOpenContractRespMsgType = "proposal_open_contract" - // The markup amount charged on a client's stake amount - AppMarkupAmount *string `json:"app_markup_amount,omitempty"` +// Tick details around contract start and end time. +type ProposalOpenContractRespProposalOpenContractAuditDetails struct { + // Ticks for tick expiry contract from start time till expiry. + AllTicks []ProposalOpenContractRespProposalOpenContractAuditDetailsAllTicksElem `json:"all_ticks,omitempty"` - // Tick details around contract start and end time. - AuditDetails *ProposalOpenContractRespProposalOpenContractAuditDetails `json:"audit_details,omitempty"` + // Ticks around contract end time. + ContractEnd []ProposalOpenContractRespProposalOpenContractAuditDetailsContractEndElem `json:"contract_end,omitempty"` - // Barrier of the contract (if any). - Barrier *string `json:"barrier,omitempty"` + // Ticks around contract start time. + ContractStart []ProposalOpenContractRespProposalOpenContractAuditDetailsContractStartElem `json:"contract_start,omitempty"` +} - // The number of barriers a contract has. - BarrierCount *float64 `json:"barrier_count,omitempty"` +type ProposalOpenContractRespProposalOpenContractAuditDetailsAllTicksElem struct { + // Epoch time of a tick or the contract start or end time. + Epoch *int `json:"epoch,omitempty"` - // [Only for accumulator] Absolute difference between high/low barrier and spot - BarrierSpotDistance *string `json:"barrier_spot_distance,omitempty"` + // A flag used to highlight the record in front-end applications. + Flag *string `json:"flag,omitempty"` - // Price at which the contract could be sold back to the company. - BidPrice *float64 `json:"bid_price,omitempty"` + // A short description of the data. It could be a tick or a time associated with + // the contract. + Name *string `json:"name,omitempty"` - // Price at which contract was purchased - BuyPrice *float64 `json:"buy_price,omitempty"` + // The spot value at the given epoch. + Tick *float64 `json:"tick,omitempty"` - // Contains information about contract cancellation option. - Cancellation *ProposalOpenContractRespProposalOpenContractCancellation `json:"cancellation,omitempty"` + // The spot value with the correct precision at the given epoch. + TickDisplayValue *string `json:"tick_display_value,omitempty"` +} - // Commission in payout currency amount. - Commision *float64 `json:"commision,omitempty"` +type ProposalOpenContractRespProposalOpenContractAuditDetailsContractEndElem struct { + // Epoch time of a tick or the contract start or end time. + Epoch *int `json:"epoch,omitempty"` - // Commission in payout currency amount. - Commission *float64 `json:"commission,omitempty"` + // A flag used to highlight the record in front-end applications. + Flag *string `json:"flag,omitempty"` - // The internal contract identifier - ContractId *int `json:"contract_id,omitempty"` + // A short description of the data. It could be a tick or a time associated with + // the contract. + Name *string `json:"name,omitempty"` - // Contract type. - ContractType *string `json:"contract_type,omitempty"` + // The spot value at the given epoch. + Tick *float64 `json:"tick,omitempty"` - // The currency code of the contract. - Currency *string `json:"currency,omitempty"` + // The spot value with the correct precision at the given epoch. + TickDisplayValue *string `json:"tick_display_value,omitempty"` +} - // Spot value if we have license to stream this symbol. - CurrentSpot *float64 `json:"current_spot,omitempty"` +type ProposalOpenContractRespProposalOpenContractAuditDetailsContractStartElem struct { + // Epoch time of a tick or the contract start or end time. + Epoch *int `json:"epoch,omitempty"` - // Spot value with the correct precision if we have license to stream this symbol. - CurrentSpotDisplayValue *string `json:"current_spot_display_value,omitempty"` + // A flag used to highlight the record in front-end applications. + Flag *string `json:"flag,omitempty"` - // [Applicable for accumulator] High barrier based on current spot. - CurrentSpotHighBarrier *string `json:"current_spot_high_barrier,omitempty"` + // A short description of the data. It could be a tick or a time associated with + // the contract. + Name *string `json:"name,omitempty"` - // [Applicable for accumulator] Low barrier based on current spot. - CurrentSpotLowBarrier *string `json:"current_spot_low_barrier,omitempty"` + // The spot value at the given epoch. + Tick *float64 `json:"tick,omitempty"` - // The corresponding time of the current spot. - CurrentSpotTime *int `json:"current_spot_time,omitempty"` + // The spot value with the correct precision at the given epoch. + TickDisplayValue *string `json:"tick_display_value,omitempty"` +} - // Expiry date (epoch) of the Contract. Please note that it is not applicable for - // tick trade contracts. +// Contains information about contract cancellation option. +type ProposalOpenContractRespProposalOpenContractCancellation struct { + // Ask price of contract cancellation option. + AskPrice *float64 `json:"ask_price,omitempty"` + + // Expiry time in epoch for contract cancellation option. DateExpiry *int `json:"date_expiry,omitempty"` +} - // Settlement date (epoch) of the contract. - DateSettlement *int `json:"date_settlement,omitempty"` +type ProposalOpenContractRespProposalOpenContractIsExpired int - // Start date (epoch) of the contract. - DateStart *int `json:"date_start,omitempty"` +var enumValues_ProposalOpenContractRespProposalOpenContractIsExpired = []interface{}{ + 0, + 1, +} - // Display name of underlying - DisplayName *string `json:"display_name,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *ProposalOpenContractRespProposalOpenContractIsExpired) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsExpired { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsExpired, v) + } + *j = ProposalOpenContractRespProposalOpenContractIsExpired(v) + return nil +} - // [Only for vanilla or turbos options] The implied number of contracts - DisplayNumberOfContracts *string `json:"display_number_of_contracts,omitempty"` +type ProposalOpenContractRespProposalOpenContractIsForwardStarting int - // The `bid_price` with the correct precision - DisplayValue *string `json:"display_value,omitempty"` +var enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting = []interface{}{ + 0, + 1, +} - // Same as `entry_tick`. For backwards compatibility. - EntrySpot *float64 `json:"entry_spot,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *ProposalOpenContractRespProposalOpenContractIsForwardStarting) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting, v) + } + *j = ProposalOpenContractRespProposalOpenContractIsForwardStarting(v) + return nil +} - // Same as `entry_tick_display_value`. For backwards compatibility. - EntrySpotDisplayValue *string `json:"entry_spot_display_value,omitempty"` +type ProposalOpenContractRespProposalOpenContractIsIntraday int - // This is the entry spot of the contract. For contracts starting immediately it - // is the next tick after the start time. For forward-starting contracts it is the - // spot at the start time. - EntryTick *float64 `json:"entry_tick,omitempty"` +var enumValues_ProposalOpenContractRespProposalOpenContractIsIntraday = []interface{}{ + 0, + 1, +} - // This is the entry spot with the correct precision of the contract. For - // contracts starting immediately it is the next tick after the start time. For - // forward-starting contracts it is the spot at the start time. - EntryTickDisplayValue *string `json:"entry_tick_display_value,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *ProposalOpenContractRespProposalOpenContractIsIntraday) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsIntraday { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsIntraday, v) + } + *j = ProposalOpenContractRespProposalOpenContractIsIntraday(v) + return nil +} - // This is the epoch time of the entry tick. - EntryTickTime *int `json:"entry_tick_time,omitempty"` +type ProposalOpenContractRespProposalOpenContractIsPathDependent int - // Exit tick can refer to the latest tick at the end time, the tick that fulfils - // the contract's winning or losing condition for path dependent contracts - // (Touch/No Touch and Stays Between/Goes Outside) or the tick at which the - // contract is sold before expiry. - ExitTick *float64 `json:"exit_tick,omitempty"` +var enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent = []interface{}{ + 0, + 1, +} - // Exit tick can refer to the latest tick at the end time, the tick that fulfils - // the contract's winning or losing condition for path dependent contracts - // (Touch/No Touch and Stays Between/Goes Outside) or the tick at which the - // contract is sold before expiry. - ExitTickDisplayValue *string `json:"exit_tick_display_value,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *ProposalOpenContractRespProposalOpenContractIsPathDependent) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent, v) + } + *j = ProposalOpenContractRespProposalOpenContractIsPathDependent(v) + return nil +} - // This is the epoch time of the exit tick. Note that since certain instruments - // don't tick every second, the exit tick time may be a few seconds before the end - // time. - ExitTickTime *int `json:"exit_tick_time,omitempty"` +type ProposalOpenContractRespProposalOpenContractIsSettleable int - // This is the expiry time. - ExpiryTime *int `json:"expiry_time,omitempty"` - - // [Only for accumulator] Growth rate of an accumulator contract. - GrowthRate *float64 `json:"growth_rate,omitempty"` - - // High barrier of the contract (if any). - HighBarrier *string `json:"high_barrier,omitempty"` - - // A per-connection unique identifier. Can be passed to the `forget` API call to - // unsubscribe. - Id *string `json:"id,omitempty"` - - // Whether the contract is expired or not. - IsExpired *ProposalOpenContractRespProposalOpenContractIsExpired `json:"is_expired,omitempty"` - - // Whether the contract is forward-starting or not. - IsForwardStarting *ProposalOpenContractRespProposalOpenContractIsForwardStarting `json:"is_forward_starting,omitempty"` - - // Whether the contract is an intraday contract. - IsIntraday *ProposalOpenContractRespProposalOpenContractIsIntraday `json:"is_intraday,omitempty"` - - // Whether the contract expiry price will depend on the path of the market (e.g. - // One Touch contract). - IsPathDependent *ProposalOpenContractRespProposalOpenContractIsPathDependent `json:"is_path_dependent,omitempty"` - - // Whether the contract is settleable or not. - IsSettleable *ProposalOpenContractRespProposalOpenContractIsSettleable `json:"is_settleable,omitempty"` - - // Whether the contract is sold or not. - IsSold *ProposalOpenContractRespProposalOpenContractIsSold `json:"is_sold,omitempty"` - - // Whether the contract can be cancelled. - IsValidToCancel *ProposalOpenContractRespProposalOpenContractIsValidToCancel `json:"is_valid_to_cancel,omitempty"` - - // Whether the contract can be sold back to the company. - IsValidToSell *ProposalOpenContractRespProposalOpenContractIsValidToSell `json:"is_valid_to_sell,omitempty"` - - // [Optional] Indicator whether take profit, stop loss, and/or stop out is allowed - // to be updated. - IsValidToUpdate *ProposalOpenContractRespProposalOpenContractIsValidToUpdate `json:"is_valid_to_update,omitempty"` - - // Orders are applicable to `MULTUP` and `MULTDOWN` contracts only. - LimitOrder *ProposalOpenContractRespProposalOpenContractLimitOrder `json:"limit_order,omitempty"` - - // Text description of the contract purchased, Example: Win payout if Volatility - // 100 Index is strictly higher than entry spot at 10 minutes after contract start - // time. - Longcode *string `json:"longcode,omitempty"` - - // Low barrier of the contract (if any). - LowBarrier *string `json:"low_barrier,omitempty"` - - // [Only for lookback trades] Multiplier applies when calculating the final payoff - // for each type of lookback. e.g. (Exit spot - Lowest historical price) * - // multiplier = Payout - Multiplier *float64 `json:"multiplier,omitempty"` - - // Payout value of the contract. - Payout *float64 `json:"payout,omitempty"` - - // The latest bid price minus buy price. - Profit *float64 `json:"profit,omitempty"` - - // Profit in percentage. - ProfitPercentage *float64 `json:"profit_percentage,omitempty"` - - // Epoch of purchase time, will be same as `date_start` for all contracts except - // forward starting contracts. - PurchaseTime *int `json:"purchase_time,omitempty"` - - // [Only for reset trades i.e. RESETCALL and RESETPUT] Reset barrier of the - // contract. - ResetBarrier *string `json:"reset_barrier,omitempty"` - - // [Only for reset trades i.e. RESETCALL and RESETPUT] The epoch time of a barrier - // reset. - ResetTime *int `json:"reset_time,omitempty"` - - // Spot value at the selected tick for the contract. - SelectedSpot *float64 `json:"selected_spot,omitempty"` - - // [Only for highlowticks trades i.e. TICKHIGH and TICKLOW] Selected tick for the - // contract. - SelectedTick *int `json:"selected_tick,omitempty"` - - // Price at which contract was sold, only available when contract has been sold. - SellPrice *float64 `json:"sell_price,omitempty"` - - // Latest spot value at the sell time. (only present for contracts already sold). - // Will no longer be supported in the next API release. - SellSpot *float64 `json:"sell_spot,omitempty"` - - // Latest spot value with the correct precision at the sell time. (only present - // for contracts already sold). Will no longer be supported in the next API - // release. - SellSpotDisplayValue *string `json:"sell_spot_display_value,omitempty"` - - // Epoch time of the sell spot. Note that since certain underlyings don't tick - // every second, the sell spot time may be a few seconds before the sell time. - // (only present for contracts already sold). Will no longer be supported in the - // next API release. - SellSpotTime *int `json:"sell_spot_time,omitempty"` - - // Epoch time of when the contract was sold (only present for contracts already - // sold) - SellTime *int `json:"sell_time,omitempty"` - - // Coded description of the contract purchased. - Shortcode *string `json:"shortcode,omitempty"` - - // Contract status. Will be `sold` if the contract was sold back before expiry, - // `won` if won and `lost` if lost at expiry. Otherwise will be `open` - Status *ProposalOpenContractRespProposalOpenContractStatus `json:"status,omitempty"` - - // Only for tick trades, number of ticks - TickCount *int `json:"tick_count,omitempty"` - - // [Only for accumulator] Number of ticks passed since entry_tick - TickPassed *int `json:"tick_passed,omitempty"` - - // Tick stream from entry to end time. - TickStream []ProposalOpenContractRespProposalOpenContractTickStreamElem `json:"tick_stream,omitempty"` - - // Every contract has buy and sell transaction ids, i.e. when you purchase a - // contract we associate it with buy transaction id, and if contract is already - // sold we associate that with sell transaction id. - TransactionIds *ProposalOpenContractRespProposalOpenContractTransactionIds `json:"transaction_ids,omitempty"` - - // The underlying symbol code. - Underlying *string `json:"underlying,omitempty"` - - // Error message if validation fails - ValidationError *string `json:"validation_error,omitempty"` - - // Error code if validation fails - ValidationErrorCode *string `json:"validation_error_code,omitempty"` - - // Contains contract validation information. - ValidationParams *ProposalOpenContractRespProposalOpenContractValidationParams `json:"validation_params,omitempty"` -} - -// Tick details around contract start and end time. -type ProposalOpenContractRespProposalOpenContractAuditDetails struct { - // Ticks for tick expiry contract from start time till expiry. - AllTicks []ProposalOpenContractRespProposalOpenContractAuditDetailsAllTicksElem `json:"all_ticks,omitempty"` - - // Ticks around contract end time. - ContractEnd []ProposalOpenContractRespProposalOpenContractAuditDetailsContractEndElem `json:"contract_end,omitempty"` - - // Ticks around contract start time. - ContractStart []ProposalOpenContractRespProposalOpenContractAuditDetailsContractStartElem `json:"contract_start,omitempty"` -} - -type ProposalOpenContractRespProposalOpenContractAuditDetailsAllTicksElem struct { - // Epoch time of a tick or the contract start or end time. - Epoch *int `json:"epoch,omitempty"` - - // A flag used to highlight the record in front-end applications. - Flag *string `json:"flag,omitempty"` - - // A short description of the data. It could be a tick or a time associated with - // the contract. - Name *string `json:"name,omitempty"` - - // The spot value at the given epoch. - Tick *float64 `json:"tick,omitempty"` - - // The spot value with the correct precision at the given epoch. - TickDisplayValue *string `json:"tick_display_value,omitempty"` -} - -type ProposalOpenContractRespProposalOpenContractAuditDetailsContractEndElem struct { - // Epoch time of a tick or the contract start or end time. - Epoch *int `json:"epoch,omitempty"` - - // A flag used to highlight the record in front-end applications. - Flag *string `json:"flag,omitempty"` - - // A short description of the data. It could be a tick or a time associated with - // the contract. - Name *string `json:"name,omitempty"` - - // The spot value at the given epoch. - Tick *float64 `json:"tick,omitempty"` - - // The spot value with the correct precision at the given epoch. - TickDisplayValue *string `json:"tick_display_value,omitempty"` -} - -type ProposalOpenContractRespProposalOpenContractAuditDetailsContractStartElem struct { - // Epoch time of a tick or the contract start or end time. - Epoch *int `json:"epoch,omitempty"` - - // A flag used to highlight the record in front-end applications. - Flag *string `json:"flag,omitempty"` - - // A short description of the data. It could be a tick or a time associated with - // the contract. - Name *string `json:"name,omitempty"` - - // The spot value at the given epoch. - Tick *float64 `json:"tick,omitempty"` - - // The spot value with the correct precision at the given epoch. - TickDisplayValue *string `json:"tick_display_value,omitempty"` -} - -// Contains information about contract cancellation option. -type ProposalOpenContractRespProposalOpenContractCancellation struct { - // Ask price of contract cancellation option. - AskPrice *float64 `json:"ask_price,omitempty"` - - // Expiry time in epoch for contract cancellation option. - DateExpiry *int `json:"date_expiry,omitempty"` -} - -type ProposalOpenContractRespProposalOpenContractIsExpired int - -var enumValues_ProposalOpenContractRespProposalOpenContractIsExpired = []interface{}{ +var enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsExpired) UnmarshalJSON(b []byte) error { +func (j *ProposalOpenContractRespProposalOpenContractIsSettleable) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsExpired { + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsExpired, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable, v) } - *j = ProposalOpenContractRespProposalOpenContractIsExpired(v) + *j = ProposalOpenContractRespProposalOpenContractIsSettleable(v) return nil } -type ProposalOpenContractRespProposalOpenContractIsForwardStarting int +type ProposalOpenContractRespProposalOpenContractIsSold int -var enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting = []interface{}{ +var enumValues_ProposalOpenContractRespProposalOpenContractIsSold = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsForwardStarting) UnmarshalJSON(b []byte) error { +func (j *ProposalOpenContractRespProposalOpenContractIsSold) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting { + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsSold { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsSold, v) } - *j = ProposalOpenContractRespProposalOpenContractIsForwardStarting(v) + *j = ProposalOpenContractRespProposalOpenContractIsSold(v) return nil } -type ProposalOpenContractRespProposalOpenContractIsIntraday int +type ProposalOpenContractRespProposalOpenContractIsValidToCancel int -var enumValues_ProposalOpenContractRespProposalOpenContractIsIntraday = []interface{}{ +var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsIntraday) UnmarshalJSON(b []byte) error { +func (j *ProposalOpenContractRespProposalOpenContractIsValidToCancel) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsIntraday { + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsIntraday, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel, v) } - *j = ProposalOpenContractRespProposalOpenContractIsIntraday(v) + *j = ProposalOpenContractRespProposalOpenContractIsValidToCancel(v) return nil } -type ProposalOpenContractRespProposalOpenContractIsPathDependent int +type ProposalOpenContractRespProposalOpenContractIsValidToSell int -var enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent = []interface{}{ +var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsPathDependent) UnmarshalJSON(b []byte) error { +func (j *ProposalOpenContractRespProposalOpenContractIsValidToSell) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent { + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell, v) } - *j = ProposalOpenContractRespProposalOpenContractIsPathDependent(v) + *j = ProposalOpenContractRespProposalOpenContractIsValidToSell(v) return nil } -type ProposalOpenContractRespProposalOpenContractIsSettleable int +type ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss float64 -var enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable = []interface{}{ - 0, - 1, +var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss = []interface{}{ + 0.0, + 1.0, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsSettleable) UnmarshalJSON(b []byte) error { - var v int +func (j *ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss) UnmarshalJSON(b []byte) error { + var v float64 if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable { + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss, v) } - *j = ProposalOpenContractRespProposalOpenContractIsSettleable(v) + *j = ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss(v) return nil } -type ProposalOpenContractRespProposalOpenContractIsSold int +type ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut float64 -var enumValues_ProposalOpenContractRespProposalOpenContractIsSold = []interface{}{ - 0, - 1, +var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut = []interface{}{ + 0.0, + 1.0, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsSold) UnmarshalJSON(b []byte) error { - var v int +func (j *ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut) UnmarshalJSON(b []byte) error { + var v float64 if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsSold { + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsSold, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut, v) } - *j = ProposalOpenContractRespProposalOpenContractIsSold(v) + *j = ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut(v) return nil } -type ProposalOpenContractRespProposalOpenContractIsValidToCancel int +type ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit float64 -var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel = []interface{}{ - 0, - 1, +var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit = []interface{}{ + 0.0, + 1.0, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsValidToCancel) UnmarshalJSON(b []byte) error { - var v int +func (j *ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit) UnmarshalJSON(b []byte) error { + var v float64 if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel { + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit, v) } - *j = ProposalOpenContractRespProposalOpenContractIsValidToCancel(v) + *j = ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit(v) return nil } -type ProposalOpenContractRespProposalOpenContractIsValidToSell int +// [Optional] Indicator whether take profit, stop loss, and/or stop out is allowed +// to be updated. +type ProposalOpenContractRespProposalOpenContractIsValidToUpdate struct { + // [Optional] 1 if stop loss is allowed to be updated and 0 if otherwise. This + // field is undefined if stop loss functionality is not supported by the contract. + StopLoss *ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss `json:"stop_loss,omitempty"` -var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell = []interface{}{ - 0, - 1, + // [Optional] 1 if stop out is allowed to be updated and 0 if otherwise. This + // field is undefined if stop out functionality is not supported by the contract. + StopOut *ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut `json:"stop_out,omitempty"` + + // [Optional] 1 if take profit is allowed to be updated and 0 if otherwise. This + // field is undefined if take profit functionality is not supported by the + // contract. + TakeProfit *ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit `json:"take_profit,omitempty"` +} + +// Orders are applicable to `MULTUP` and `MULTDOWN` contracts only. +type ProposalOpenContractRespProposalOpenContractLimitOrder struct { + // Contains information where the contract will be closed automatically at the + // loss specified by the user. + StopLoss *ProposalOpenContractRespProposalOpenContractLimitOrderStopLoss `json:"stop_loss,omitempty"` + + // Contains information where the contract will be closed automatically when the + // value of the contract is close to zero. This is set by the us. + StopOut *ProposalOpenContractRespProposalOpenContractLimitOrderStopOut `json:"stop_out,omitempty"` + + // Contain information where the contract will be closed automatically at the + // profit specified by the user. + TakeProfit *ProposalOpenContractRespProposalOpenContractLimitOrderTakeProfit `json:"take_profit,omitempty"` +} + +// Contains information where the contract will be closed automatically at the loss +// specified by the user. +type ProposalOpenContractRespProposalOpenContractLimitOrderStopLoss struct { + // Localized display name + DisplayName *string `json:"display_name,omitempty"` + + // Stop loss amount + OrderAmount *float64 `json:"order_amount,omitempty"` + + // Stop loss order epoch + OrderDate *int `json:"order_date,omitempty"` + + // Pip-sized barrier value + Value *string `json:"value,omitempty"` +} + +// Contains information where the contract will be closed automatically when the +// value of the contract is close to zero. This is set by the us. +type ProposalOpenContractRespProposalOpenContractLimitOrderStopOut struct { + // Localized display name + DisplayName *string `json:"display_name,omitempty"` + + // Stop out amount + OrderAmount *float64 `json:"order_amount,omitempty"` + + // Stop out order epoch + OrderDate *int `json:"order_date,omitempty"` + + // Pip-sized barrier value + Value *string `json:"value,omitempty"` +} + +// Contain information where the contract will be closed automatically at the +// profit specified by the user. +type ProposalOpenContractRespProposalOpenContractLimitOrderTakeProfit struct { + // Localized display name + DisplayName *string `json:"display_name,omitempty"` + + // Take profit amount + OrderAmount *float64 `json:"order_amount,omitempty"` + + // Take profit order epoch + OrderDate *int `json:"order_date,omitempty"` + + // Pip-sized barrier value + Value *string `json:"value,omitempty"` +} + +type ProposalOpenContractRespProposalOpenContractStatus struct { + Value interface{} +} + +var enumValues_ProposalOpenContractRespProposalOpenContractStatus = []interface{}{ + "open", + "sold", + "won", + "lost", + "cancelled", + nil, +} + +// MarshalJSON implements json.Marshaler. +func (j *ProposalOpenContractRespProposalOpenContractStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsValidToSell) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *ProposalOpenContractRespProposalOpenContractStatus) UnmarshalJSON(b []byte) error { + var v struct { + Value interface{} + } + if err := json.Unmarshal(b, &v.Value); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell { - if reflect.DeepEqual(v, expected) { + for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractStatus { + if reflect.DeepEqual(v.Value, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractStatus, v.Value) } - *j = ProposalOpenContractRespProposalOpenContractIsValidToSell(v) + *j = ProposalOpenContractRespProposalOpenContractStatus(v) return nil } -// [Optional] Indicator whether take profit, stop loss, and/or stop out is allowed -// to be updated. -type ProposalOpenContractRespProposalOpenContractIsValidToUpdate struct { - // [Optional] 1 if stop loss is allowed to be updated and 0 if otherwise. This - // field is undefined if stop loss functionality is not supported by the contract. - StopLoss *ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss `json:"stop_loss,omitempty"` +// Latest price and other details for an open contract +type ProposalOpenContractRespProposalOpenContract struct { + // Account Id + AccountId *float64 `json:"account_id,omitempty"` - // [Optional] 1 if stop out is allowed to be updated and 0 if otherwise. This - // field is undefined if stop out functionality is not supported by the contract. - StopOut *ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut `json:"stop_out,omitempty"` + // The markup amount charged on a client's stake amount + AppMarkupAmount *string `json:"app_markup_amount,omitempty"` + + // Tick details around contract start and end time. + AuditDetails *ProposalOpenContractRespProposalOpenContractAuditDetails `json:"audit_details,omitempty"` + + // Barrier of the contract (if any). + Barrier *string `json:"barrier,omitempty"` + + // The number of barriers a contract has. + BarrierCount *float64 `json:"barrier_count,omitempty"` + + // [Only for accumulator] Absolute difference between high/low barrier and spot + BarrierSpotDistance *string `json:"barrier_spot_distance,omitempty"` + + // Price at which the contract could be sold back to the company. + BidPrice *float64 `json:"bid_price,omitempty"` + + // Price at which contract was purchased + BuyPrice *float64 `json:"buy_price,omitempty"` + + // Contains information about contract cancellation option. + Cancellation *ProposalOpenContractRespProposalOpenContractCancellation `json:"cancellation,omitempty"` + + // Commission in payout currency amount. + Commision *float64 `json:"commision,omitempty"` + + // Commission in payout currency amount. + Commission *float64 `json:"commission,omitempty"` + + // The internal contract identifier + ContractId *int `json:"contract_id,omitempty"` + + // Contract type. + ContractType *string `json:"contract_type,omitempty"` + + // The currency code of the contract. + Currency *string `json:"currency,omitempty"` + + // Spot value if we have license to stream this symbol. + CurrentSpot *float64 `json:"current_spot,omitempty"` + + // Spot value with the correct precision if we have license to stream this symbol. + CurrentSpotDisplayValue *string `json:"current_spot_display_value,omitempty"` + + // [Applicable for accumulator] High barrier based on current spot. + CurrentSpotHighBarrier *string `json:"current_spot_high_barrier,omitempty"` + + // [Applicable for accumulator] Low barrier based on current spot. + CurrentSpotLowBarrier *string `json:"current_spot_low_barrier,omitempty"` + + // The corresponding time of the current spot. + CurrentSpotTime *int `json:"current_spot_time,omitempty"` + + // Expiry date (epoch) of the Contract. Please note that it is not applicable for + // tick trade contracts. + DateExpiry *int `json:"date_expiry,omitempty"` + + // Settlement date (epoch) of the contract. + DateSettlement *int `json:"date_settlement,omitempty"` + + // Start date (epoch) of the contract. + DateStart *int `json:"date_start,omitempty"` + + // Display name of underlying + DisplayName *string `json:"display_name,omitempty"` + + // [Only for vanilla or turbos options] The implied number of contracts + DisplayNumberOfContracts *string `json:"display_number_of_contracts,omitempty"` + + // The `bid_price` with the correct precision + DisplayValue *string `json:"display_value,omitempty"` + + // Same as `entry_tick`. For backwards compatibility. + EntrySpot *float64 `json:"entry_spot,omitempty"` + + // Same as `entry_tick_display_value`. For backwards compatibility. + EntrySpotDisplayValue *string `json:"entry_spot_display_value,omitempty"` + + // This is the entry spot of the contract. For contracts starting immediately it + // is the next tick after the start time. For forward-starting contracts it is the + // spot at the start time. + EntryTick *float64 `json:"entry_tick,omitempty"` + + // This is the entry spot with the correct precision of the contract. For + // contracts starting immediately it is the next tick after the start time. For + // forward-starting contracts it is the spot at the start time. + EntryTickDisplayValue *string `json:"entry_tick_display_value,omitempty"` + + // This is the epoch time of the entry tick. + EntryTickTime *int `json:"entry_tick_time,omitempty"` + + // Exit tick can refer to the latest tick at the end time, the tick that fulfils + // the contract's winning or losing condition for path dependent contracts + // (Touch/No Touch and Stays Between/Goes Outside) or the tick at which the + // contract is sold before expiry. + ExitTick *float64 `json:"exit_tick,omitempty"` + + // Exit tick can refer to the latest tick at the end time, the tick that fulfils + // the contract's winning or losing condition for path dependent contracts + // (Touch/No Touch and Stays Between/Goes Outside) or the tick at which the + // contract is sold before expiry. + ExitTickDisplayValue *string `json:"exit_tick_display_value,omitempty"` + + // This is the epoch time of the exit tick. Note that since certain instruments + // don't tick every second, the exit tick time may be a few seconds before the end + // time. + ExitTickTime *int `json:"exit_tick_time,omitempty"` + + // This is the expiry time. + ExpiryTime *int `json:"expiry_time,omitempty"` + + // [Only for accumulator] Growth rate of an accumulator contract. + GrowthRate *float64 `json:"growth_rate,omitempty"` + + // High barrier of the contract (if any). + HighBarrier *string `json:"high_barrier,omitempty"` + + // A per-connection unique identifier. Can be passed to the `forget` API call to + // unsubscribe. + Id *string `json:"id,omitempty"` + + // Whether the contract is expired or not. + IsExpired *ProposalOpenContractRespProposalOpenContractIsExpired `json:"is_expired,omitempty"` + + // Whether the contract is forward-starting or not. + IsForwardStarting *ProposalOpenContractRespProposalOpenContractIsForwardStarting `json:"is_forward_starting,omitempty"` + + // Whether the contract is an intraday contract. + IsIntraday *ProposalOpenContractRespProposalOpenContractIsIntraday `json:"is_intraday,omitempty"` + + // Whether the contract expiry price will depend on the path of the market (e.g. + // One Touch contract). + IsPathDependent *ProposalOpenContractRespProposalOpenContractIsPathDependent `json:"is_path_dependent,omitempty"` + + // Whether the contract is settleable or not. + IsSettleable *ProposalOpenContractRespProposalOpenContractIsSettleable `json:"is_settleable,omitempty"` + + // Whether the contract is sold or not. + IsSold *ProposalOpenContractRespProposalOpenContractIsSold `json:"is_sold,omitempty"` + + // Whether the contract can be cancelled. + IsValidToCancel *ProposalOpenContractRespProposalOpenContractIsValidToCancel `json:"is_valid_to_cancel,omitempty"` - // [Optional] 1 if take profit is allowed to be updated and 0 if otherwise. This - // field is undefined if take profit functionality is not supported by the - // contract. - TakeProfit *ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit `json:"take_profit,omitempty"` -} + // Whether the contract can be sold back to the company. + IsValidToSell *ProposalOpenContractRespProposalOpenContractIsValidToSell `json:"is_valid_to_sell,omitempty"` -type ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss float64 + // [Optional] Indicator whether take profit, stop loss, and/or stop out is allowed + // to be updated. + IsValidToUpdate *ProposalOpenContractRespProposalOpenContractIsValidToUpdate `json:"is_valid_to_update,omitempty"` -var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss = []interface{}{ - 0.0, - 1.0, -} + // Orders are applicable to `MULTUP` and `MULTDOWN` contracts only. + LimitOrder *ProposalOpenContractRespProposalOpenContractLimitOrder `json:"limit_order,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss) UnmarshalJSON(b []byte) error { - var v float64 - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss, v) - } - *j = ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopLoss(v) - return nil -} + // Text description of the contract purchased, Example: Win payout if Volatility + // 100 Index is strictly higher than entry spot at 10 minutes after contract start + // time. + Longcode *string `json:"longcode,omitempty"` -type ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut float64 + // Low barrier of the contract (if any). + LowBarrier *string `json:"low_barrier,omitempty"` -var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut = []interface{}{ - 0.0, - 1.0, -} + // [Only for lookback trades] Multiplier applies when calculating the final payoff + // for each type of lookback. e.g. (Exit spot - Lowest historical price) * + // multiplier = Payout + Multiplier *float64 `json:"multiplier,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut) UnmarshalJSON(b []byte) error { - var v float64 - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut, v) - } - *j = ProposalOpenContractRespProposalOpenContractIsValidToUpdateStopOut(v) - return nil -} + // Payout value of the contract. + Payout *float64 `json:"payout,omitempty"` -type ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit float64 + // The latest bid price minus buy price. + Profit *float64 `json:"profit,omitempty"` -var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit = []interface{}{ - 0.0, - 1.0, -} + // Profit in percentage. + ProfitPercentage *float64 `json:"profit_percentage,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit) UnmarshalJSON(b []byte) error { - var v float64 - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit, v) - } - *j = ProposalOpenContractRespProposalOpenContractIsValidToUpdateTakeProfit(v) - return nil -} + // Epoch of purchase time, will be same as `date_start` for all contracts except + // forward starting contracts. + PurchaseTime *int `json:"purchase_time,omitempty"` -// Orders are applicable to `MULTUP` and `MULTDOWN` contracts only. -type ProposalOpenContractRespProposalOpenContractLimitOrder struct { - // Contains information where the contract will be closed automatically at the - // loss specified by the user. - StopLoss *ProposalOpenContractRespProposalOpenContractLimitOrderStopLoss `json:"stop_loss,omitempty"` + // [Only for reset trades i.e. RESETCALL and RESETPUT] Reset barrier of the + // contract. + ResetBarrier *string `json:"reset_barrier,omitempty"` - // Contains information where the contract will be closed automatically when the - // value of the contract is close to zero. This is set by the us. - StopOut *ProposalOpenContractRespProposalOpenContractLimitOrderStopOut `json:"stop_out,omitempty"` + // [Only for reset trades i.e. RESETCALL and RESETPUT] The epoch time of a barrier + // reset. + ResetTime *int `json:"reset_time,omitempty"` - // Contain information where the contract will be closed automatically at the - // profit specified by the user. - TakeProfit *ProposalOpenContractRespProposalOpenContractLimitOrderTakeProfit `json:"take_profit,omitempty"` -} + // Spot value at the selected tick for the contract. + SelectedSpot *float64 `json:"selected_spot,omitempty"` -// Contains information where the contract will be closed automatically at the loss -// specified by the user. -type ProposalOpenContractRespProposalOpenContractLimitOrderStopLoss struct { - // Localized display name - DisplayName *string `json:"display_name,omitempty"` + // [Only for highlowticks trades i.e. TICKHIGH and TICKLOW] Selected tick for the + // contract. + SelectedTick *int `json:"selected_tick,omitempty"` - // Stop loss amount - OrderAmount *float64 `json:"order_amount,omitempty"` + // Price at which contract was sold, only available when contract has been sold. + SellPrice *float64 `json:"sell_price,omitempty"` - // Stop loss order epoch - OrderDate *int `json:"order_date,omitempty"` + // Latest spot value at the sell time. (only present for contracts already sold). + // Will no longer be supported in the next API release. + SellSpot *float64 `json:"sell_spot,omitempty"` - // Pip-sized barrier value - Value *string `json:"value,omitempty"` -} + // Latest spot value with the correct precision at the sell time. (only present + // for contracts already sold). Will no longer be supported in the next API + // release. + SellSpotDisplayValue *string `json:"sell_spot_display_value,omitempty"` -// Contains information where the contract will be closed automatically when the -// value of the contract is close to zero. This is set by the us. -type ProposalOpenContractRespProposalOpenContractLimitOrderStopOut struct { - // Localized display name - DisplayName *string `json:"display_name,omitempty"` + // Epoch time of the sell spot. Note that since certain underlyings don't tick + // every second, the sell spot time may be a few seconds before the sell time. + // (only present for contracts already sold). Will no longer be supported in the + // next API release. + SellSpotTime *int `json:"sell_spot_time,omitempty"` - // Stop out amount - OrderAmount *float64 `json:"order_amount,omitempty"` + // Epoch time of when the contract was sold (only present for contracts already + // sold) + SellTime *int `json:"sell_time,omitempty"` - // Stop out order epoch - OrderDate *int `json:"order_date,omitempty"` + // Coded description of the contract purchased. + Shortcode *string `json:"shortcode,omitempty"` - // Pip-sized barrier value - Value *string `json:"value,omitempty"` -} + // Contract status. Will be `sold` if the contract was sold back before expiry, + // `won` if won and `lost` if lost at expiry. Otherwise will be `open` + Status *ProposalOpenContractRespProposalOpenContractStatus `json:"status,omitempty"` -// Contain information where the contract will be closed automatically at the -// profit specified by the user. -type ProposalOpenContractRespProposalOpenContractLimitOrderTakeProfit struct { - // Localized display name - DisplayName *string `json:"display_name,omitempty"` + // Only for tick trades, number of ticks + TickCount *int `json:"tick_count,omitempty"` - // Take profit amount - OrderAmount *float64 `json:"order_amount,omitempty"` + // [Only for accumulator] Number of ticks passed since entry_tick + TickPassed *int `json:"tick_passed,omitempty"` - // Take profit order epoch - OrderDate *int `json:"order_date,omitempty"` + // Tick stream from entry to end time. + TickStream []ProposalOpenContractRespProposalOpenContractTickStreamElem `json:"tick_stream,omitempty"` - // Pip-sized barrier value - Value *string `json:"value,omitempty"` -} + // Every contract has buy and sell transaction ids, i.e. when you purchase a + // contract we associate it with buy transaction id, and if contract is already + // sold we associate that with sell transaction id. + TransactionIds *ProposalOpenContractRespProposalOpenContractTransactionIds `json:"transaction_ids,omitempty"` -type ProposalOpenContractRespProposalOpenContractStatus struct { - Value interface{} -} + // The underlying symbol code. + Underlying *string `json:"underlying,omitempty"` -// MarshalJSON implements json.Marshaler. -func (j *ProposalOpenContractRespProposalOpenContractStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} + // Error message if validation fails + ValidationError *string `json:"validation_error,omitempty"` -var enumValues_ProposalOpenContractRespProposalOpenContractStatus = []interface{}{ - "open", - "sold", - "won", - "lost", - "cancelled", - nil, -} + // Error code if validation fails + ValidationErrorCode *string `json:"validation_error_code,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractStatus) UnmarshalJSON(b []byte) error { - var v struct { - Value interface{} - } - if err := json.Unmarshal(b, &v.Value); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractStatus { - if reflect.DeepEqual(v.Value, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractStatus, v.Value) - } - *j = ProposalOpenContractRespProposalOpenContractStatus(v) - return nil + // Contains contract validation information. + ValidationParams *ProposalOpenContractRespProposalOpenContractValidationParams `json:"validation_params,omitempty"` } type ProposalOpenContractRespProposalOpenContractTickStreamElem struct { @@ -889,7 +870,7 @@ func (j *ProposalOpenContractRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in ProposalOpenContractRespSubscription: required") } type Plain ProposalOpenContractRespSubscription @@ -901,13 +882,32 @@ func (j *ProposalOpenContractRespSubscription) UnmarshalJSON(b []byte) error { return nil } +// Latest price and other details for an open contract in the user's portfolio +type ProposalOpenContractResp struct { + // Echo of the request made. + EchoReq ProposalOpenContractRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType *ProposalOpenContractRespMsgType `json:"msg_type,omitempty"` + + // Latest price and other details for an open contract + ProposalOpenContract *ProposalOpenContractRespProposalOpenContract `json:"proposal_open_contract,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *ProposalOpenContractRespSubscription `json:"subscription,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ProposalOpenContractResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ProposalOpenContractResp: required") } type Plain ProposalOpenContractResp diff --git a/schema/proposal_resp.go b/schema/proposal_resp.go index 1de6858..8ccb89e 100644 --- a/schema/proposal_resp.go +++ b/schema/proposal_resp.go @@ -32,30 +32,6 @@ type ProposalRespMsgType string const ProposalRespMsgTypeProposal ProposalRespMsgType = "proposal" -var enumValues_ProposalRespMsgType = []interface{}{ - "proposal", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ProposalRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalRespMsgType, v) - } - *j = ProposalRespMsgType(v) - return nil -} - // Latest price and other details for a given contract type ProposalRespProposal struct { // The ask price. @@ -290,34 +266,54 @@ type ProposalRespProposalValidationParamsTakeProfit struct { Min *string `json:"min,omitempty"` } +// UnmarshalJSON implements json.Unmarshaler. +func (j *ProposalRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ProposalRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalRespMsgType, v) + } + *j = ProposalRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ProposalRespProposal) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["ask_price"]; raw != nil && !ok { + if v, ok := raw["ask_price"]; !ok || v == nil { return fmt.Errorf("field ask_price in ProposalRespProposal: required") } - if _, ok := raw["date_start"]; raw != nil && !ok { + if v, ok := raw["date_start"]; !ok || v == nil { return fmt.Errorf("field date_start in ProposalRespProposal: required") } - if _, ok := raw["display_value"]; raw != nil && !ok { + if v, ok := raw["display_value"]; !ok || v == nil { return fmt.Errorf("field display_value in ProposalRespProposal: required") } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in ProposalRespProposal: required") } - if _, ok := raw["longcode"]; raw != nil && !ok { + if v, ok := raw["longcode"]; !ok || v == nil { return fmt.Errorf("field longcode in ProposalRespProposal: required") } - if _, ok := raw["payout"]; raw != nil && !ok { + if v, ok := raw["payout"]; !ok || v == nil { return fmt.Errorf("field payout in ProposalRespProposal: required") } - if _, ok := raw["spot"]; raw != nil && !ok { + if v, ok := raw["spot"]; !ok || v == nil { return fmt.Errorf("field spot in ProposalRespProposal: required") } - if _, ok := raw["spot_time"]; raw != nil && !ok { + if v, ok := raw["spot_time"]; !ok || v == nil { return fmt.Errorf("field spot_time in ProposalRespProposal: required") } type Plain ProposalRespProposal @@ -342,7 +338,7 @@ func (j *ProposalRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in ProposalRespSubscription: required") } type Plain ProposalRespSubscription @@ -354,16 +350,20 @@ func (j *ProposalRespSubscription) UnmarshalJSON(b []byte) error { return nil } +var enumValues_ProposalRespMsgType = []interface{}{ + "proposal", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ProposalResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ProposalResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ProposalResp: required") } type Plain ProposalResp diff --git a/schema/reality_check.go b/schema/reality_check.go index 453e0cd..a5a7be7 100644 --- a/schema/reality_check.go +++ b/schema/reality_check.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Retrieve summary of client's trades and account for the Reality Check facility. -// A 'reality check' means a display of time elapsed since the session began, and -// associated client profit/loss. The Reality Check facility is a regulatory -// requirement for certain landing companies. -type RealityCheck struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough RealityCheckPassthrough `json:"passthrough,omitempty"` - - // Must be `1` - RealityCheck RealityCheckRealityCheck `json:"reality_check"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type RealityCheckPassthrough map[string]interface{} @@ -56,13 +36,33 @@ func (j *RealityCheckRealityCheck) UnmarshalJSON(b []byte) error { return nil } +// Retrieve summary of client's trades and account for the Reality Check facility. +// A 'reality check' means a display of time elapsed since the session began, and +// associated client profit/loss. The Reality Check facility is a regulatory +// requirement for certain landing companies. +type RealityCheck struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough RealityCheckPassthrough `json:"passthrough,omitempty"` + + // Must be `1` + RealityCheck RealityCheckRealityCheck `json:"reality_check"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *RealityCheck) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["reality_check"]; raw != nil && !ok { + if v, ok := raw["reality_check"]; !ok || v == nil { return fmt.Errorf("field reality_check in RealityCheck: required") } type Plain RealityCheck diff --git a/schema/reality_check_resp.go b/schema/reality_check_resp.go index f7b9148..595ad5e 100644 --- a/schema/reality_check_resp.go +++ b/schema/reality_check_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// This gives summary of client's trades and account for reality check -type RealityCheckResp struct { - // Echo of the request made. - EchoReq RealityCheckRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType RealityCheckRespMsgType `json:"msg_type"` - - // Reality check summary of trades. - RealityCheck *RealityCheckRespRealityCheck `json:"reality_check,omitempty"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type RealityCheckRespEchoReq map[string]interface{} type RealityCheckRespMsgType string -const RealityCheckRespMsgTypeRealityCheck RealityCheckRespMsgType = "reality_check" - var enumValues_RealityCheckRespMsgType = []interface{}{ "reality_check", } @@ -53,6 +35,24 @@ func (j *RealityCheckRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// This gives summary of client's trades and account for reality check +type RealityCheckResp struct { + // Echo of the request made. + EchoReq RealityCheckRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType RealityCheckRespMsgType `json:"msg_type"` + + // Reality check summary of trades. + RealityCheck *RealityCheckRespRealityCheck `json:"reality_check,omitempty"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const RealityCheckRespMsgTypeRealityCheck RealityCheckRespMsgType = "reality_check" + // Reality check summary of trades. type RealityCheckRespRealityCheck struct { // Total amount of contract purchased. @@ -89,10 +89,10 @@ func (j *RealityCheckResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in RealityCheckResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in RealityCheckResp: required") } type Plain RealityCheckResp diff --git a/schema/residence_list.go b/schema/residence_list.go index d757cc8..6da90ab 100644 --- a/schema/residence_list.go +++ b/schema/residence_list.go @@ -6,42 +6,12 @@ import "encoding/json" import "fmt" import "reflect" -// This call returns a list of countries and 2-letter country codes, suitable for -// populating the account opening form. -type ResidenceList struct { - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough ResidenceListPassthrough `json:"passthrough,omitempty"` - - // [Optional] Specific keys from the response that you want. If not passed, it - // will return all the keys. - Query []ResidenceListQueryElem `json:"query,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - ResidenceList ResidenceListResidenceList `json:"residence_list"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type ResidenceListPassthrough map[string]interface{} type ResidenceListQueryElem string -const ResidenceListQueryElemAccountOpeningSelfDeclarationRequired ResidenceListQueryElem = "account_opening_self_declaration_required" -const ResidenceListQueryElemCommonReportingStandard ResidenceListQueryElem = "common_reporting_standard" -const ResidenceListQueryElemDisabled ResidenceListQueryElem = "disabled" -const ResidenceListQueryElemIdentity ResidenceListQueryElem = "identity" -const ResidenceListQueryElemJurisdictionRiskAssessment ResidenceListQueryElem = "jurisdiction_risk_assessment" -const ResidenceListQueryElemPhoneIdd ResidenceListQueryElem = "phone_idd" -const ResidenceListQueryElemSelected ResidenceListQueryElem = "selected" -const ResidenceListQueryElemText ResidenceListQueryElem = "text" -const ResidenceListQueryElemTinFormat ResidenceListQueryElem = "tin_format" -const ResidenceListQueryElemValue ResidenceListQueryElem = "value" -const ResidenceListQueryElemWalletSignup ResidenceListQueryElem = "wallet_signup" - var enumValues_ResidenceListQueryElem = []interface{}{ "account_opening_self_declaration_required", "common_reporting_standard", @@ -76,6 +46,18 @@ func (j *ResidenceListQueryElem) UnmarshalJSON(b []byte) error { return nil } +const ResidenceListQueryElemAccountOpeningSelfDeclarationRequired ResidenceListQueryElem = "account_opening_self_declaration_required" +const ResidenceListQueryElemCommonReportingStandard ResidenceListQueryElem = "common_reporting_standard" +const ResidenceListQueryElemDisabled ResidenceListQueryElem = "disabled" +const ResidenceListQueryElemIdentity ResidenceListQueryElem = "identity" +const ResidenceListQueryElemJurisdictionRiskAssessment ResidenceListQueryElem = "jurisdiction_risk_assessment" +const ResidenceListQueryElemPhoneIdd ResidenceListQueryElem = "phone_idd" +const ResidenceListQueryElemSelected ResidenceListQueryElem = "selected" +const ResidenceListQueryElemText ResidenceListQueryElem = "text" +const ResidenceListQueryElemTinFormat ResidenceListQueryElem = "tin_format" +const ResidenceListQueryElemValue ResidenceListQueryElem = "value" +const ResidenceListQueryElemWalletSignup ResidenceListQueryElem = "wallet_signup" + type ResidenceListResidenceList int var enumValues_ResidenceListResidenceList = []interface{}{ @@ -102,13 +84,31 @@ func (j *ResidenceListResidenceList) UnmarshalJSON(b []byte) error { return nil } +// This call returns a list of countries and 2-letter country codes, suitable for +// populating the account opening form. +type ResidenceList struct { + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough ResidenceListPassthrough `json:"passthrough,omitempty"` + + // [Optional] Specific keys from the response that you want. If not passed, it + // will return all the keys. + Query []ResidenceListQueryElem `json:"query,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + ResidenceList ResidenceListResidenceList `json:"residence_list"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ResidenceList) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["residence_list"]; raw != nil && !ok { + if v, ok := raw["residence_list"]; !ok || v == nil { return fmt.Errorf("field residence_list in ResidenceList: required") } type Plain ResidenceList diff --git a/schema/residence_list_resp.go b/schema/residence_list_resp.go index 462a3dc..a9612c7 100644 --- a/schema/residence_list_resp.go +++ b/schema/residence_list_resp.go @@ -29,30 +29,6 @@ type ResidenceListRespMsgType string const ResidenceListRespMsgTypeResidenceList ResidenceListRespMsgType = "residence_list" -var enumValues_ResidenceListRespMsgType = []interface{}{ - "residence_list", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ResidenceListRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ResidenceListRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespMsgType, v) - } - *j = ResidenceListRespMsgType(v) - return nil -} - type ResidenceListRespResidenceListElem struct { // Flag which indicates whether self declaration is required for account opening AccountOpeningSelfDeclarationRequired *ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired `json:"account_opening_self_declaration_required,omitempty"` @@ -93,31 +69,6 @@ type ResidenceListRespResidenceListElem struct { type ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired int -var enumValues_ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired = []interface{}{ - 0, - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired, v) - } - *j = ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired(v) - return nil -} - // Common Reporting Standard type ResidenceListRespResidenceListElemCommonReportingStandard struct { // NPJ configuration @@ -195,6 +146,72 @@ type ResidenceListRespResidenceListElemIdentityServicesIdvDocumentsSupported map type ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample int +type ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported int + +// Onfido configuration +type ResidenceListRespResidenceListElemIdentityServicesOnfido struct { + // Documents supported by the IDV service in this country + DocumentsSupported ResidenceListRespResidenceListElemIdentityServicesOnfidoDocumentsSupported `json:"documents_supported,omitempty"` + + // Flag which indicates whether Onfido is available in this country + IsCountrySupported *ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported `json:"is_country_supported,omitempty"` +} + +// Documents supported by the IDV service in this country +type ResidenceListRespResidenceListElemIdentityServicesOnfidoDocumentsSupported map[string]interface{} + +type ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported int + +// Jurisdiction Risk Assessment +type ResidenceListRespResidenceListElemJurisdictionRiskAssessment struct { + // Disclaimer configuration + Disclaimer *ResidenceListRespResidenceListElemJurisdictionRiskAssessmentDisclaimer `json:"disclaimer,omitempty"` + + // Risk level configuration + RiskLevel *ResidenceListRespResidenceListElemJurisdictionRiskAssessmentRiskLevel `json:"risk_level,omitempty"` + + // Turnover configuration + Turnover *ResidenceListRespResidenceListElemJurisdictionRiskAssessmentTurnover `json:"turnover,omitempty"` +} + +// Disclaimer configuration +type ResidenceListRespResidenceListElemJurisdictionRiskAssessmentDisclaimer struct { + // Disclaimer flag + Accept *bool `json:"accept,omitempty"` + + // Disclaimer message + Message *string `json:"message,omitempty"` +} + +// Risk level configuration +type ResidenceListRespResidenceListElemJurisdictionRiskAssessmentRiskLevel struct { + // Default risk level flag + Default *string `json:"default,omitempty"` + + // Flags for specific landing companies + LandingCompany ResidenceListRespResidenceListElemJurisdictionRiskAssessmentRiskLevelLandingCompany `json:"landing_company,omitempty"` +} + +// Flags for specific landing companies +type ResidenceListRespResidenceListElemJurisdictionRiskAssessmentRiskLevelLandingCompany map[string]interface{} + +// Turnover configuration +type ResidenceListRespResidenceListElemJurisdictionRiskAssessmentTurnover struct { + // Max limit + MaxLimit *bool `json:"max_limit,omitempty"` +} + +type ResidenceListRespResidenceListElemPartnerSignup int + +type ResidenceListRespResidenceListElemWalletSignup int + +var enumValues_ResidenceListRespMsgType = []interface{}{ + "residence_list", +} +var enumValues_ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired = []interface{}{ + 0, + 1, +} var enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample = []interface{}{ 0, 1, @@ -220,113 +237,50 @@ func (j *ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample) U return nil } -type ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported int - -var enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported) UnmarshalJSON(b []byte) error { +func (j *ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported { + for _, expected := range enumValues_ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired, v) } - *j = ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported(v) + *j = ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired(v) return nil } -// Onfido configuration -type ResidenceListRespResidenceListElemIdentityServicesOnfido struct { - // Documents supported by the IDV service in this country - DocumentsSupported ResidenceListRespResidenceListElemIdentityServicesOnfidoDocumentsSupported `json:"documents_supported,omitempty"` - - // Flag which indicates whether Onfido is available in this country - IsCountrySupported *ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported `json:"is_country_supported,omitempty"` -} - -// Documents supported by the IDV service in this country -type ResidenceListRespResidenceListElemIdentityServicesOnfidoDocumentsSupported map[string]interface{} - -type ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported int - -var enumValues_ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported) UnmarshalJSON(b []byte) error { +func (j *ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported { + for _, expected := range enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported, v) } - *j = ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported(v) + *j = ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported(v) return nil } -// Jurisdiction Risk Assessment -type ResidenceListRespResidenceListElemJurisdictionRiskAssessment struct { - // Disclaimer configuration - Disclaimer *ResidenceListRespResidenceListElemJurisdictionRiskAssessmentDisclaimer `json:"disclaimer,omitempty"` - - // Risk level configuration - RiskLevel *ResidenceListRespResidenceListElemJurisdictionRiskAssessmentRiskLevel `json:"risk_level,omitempty"` - - // Turnover configuration - Turnover *ResidenceListRespResidenceListElemJurisdictionRiskAssessmentTurnover `json:"turnover,omitempty"` -} - -// Disclaimer configuration -type ResidenceListRespResidenceListElemJurisdictionRiskAssessmentDisclaimer struct { - // Disclaimer flag - Accept *bool `json:"accept,omitempty"` - - // Disclaimer message - Message *string `json:"message,omitempty"` -} - -// Risk level configuration -type ResidenceListRespResidenceListElemJurisdictionRiskAssessmentRiskLevel struct { - // Default risk level flag - Default *string `json:"default,omitempty"` - - // Flags for specific landing companies - LandingCompany ResidenceListRespResidenceListElemJurisdictionRiskAssessmentRiskLevelLandingCompany `json:"landing_company,omitempty"` -} - -// Flags for specific landing companies -type ResidenceListRespResidenceListElemJurisdictionRiskAssessmentRiskLevelLandingCompany map[string]interface{} - -// Turnover configuration -type ResidenceListRespResidenceListElemJurisdictionRiskAssessmentTurnover struct { - // Max limit - MaxLimit *bool `json:"max_limit,omitempty"` +var enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported = []interface{}{ + 0, + 1, } - -type ResidenceListRespResidenceListElemPartnerSignup int - var enumValues_ResidenceListRespResidenceListElemPartnerSignup = []interface{}{ 0, 1, @@ -352,7 +306,25 @@ func (j *ResidenceListRespResidenceListElemPartnerSignup) UnmarshalJSON(b []byte return nil } -type ResidenceListRespResidenceListElemWalletSignup int +// UnmarshalJSON implements json.Unmarshaler. +func (j *ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported, v) + } + *j = ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported(v) + return nil +} var enumValues_ResidenceListRespResidenceListElemWalletSignup = []interface{}{ 1, @@ -378,16 +350,41 @@ func (j *ResidenceListRespResidenceListElemWalletSignup) UnmarshalJSON(b []byte) return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *ResidenceListRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ResidenceListRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespMsgType, v) + } + *j = ResidenceListRespMsgType(v) + return nil +} + +var enumValues_ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *ResidenceListResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in ResidenceListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in ResidenceListResp: required") } type Plain ResidenceListResp diff --git a/schema/revoke_oauth_app.go b/schema/revoke_oauth_app.go index be0f169..f357303 100644 --- a/schema/revoke_oauth_app.go +++ b/schema/revoke_oauth_app.go @@ -32,7 +32,7 @@ func (j *RevokeOauthApp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["revoke_oauth_app"]; raw != nil && !ok { + if v, ok := raw["revoke_oauth_app"]; !ok || v == nil { return fmt.Errorf("field revoke_oauth_app in RevokeOauthApp: required") } type Plain RevokeOauthApp diff --git a/schema/revoke_oauth_app_resp.go b/schema/revoke_oauth_app_resp.go index e6cd89c..c273e07 100644 --- a/schema/revoke_oauth_app_resp.go +++ b/schema/revoke_oauth_app_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with revoking a used application -type RevokeOauthAppResp struct { - // Echo of the request made. - EchoReq RevokeOauthAppRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType RevokeOauthAppRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // `1` on success - RevokeOauthApp *int `json:"revoke_oauth_app,omitempty"` -} - // Echo of the request made. type RevokeOauthAppRespEchoReq map[string]interface{} type RevokeOauthAppRespMsgType string -const RevokeOauthAppRespMsgTypeRevokeOauthApp RevokeOauthAppRespMsgType = "revoke_oauth_app" - var enumValues_RevokeOauthAppRespMsgType = []interface{}{ "revoke_oauth_app", } @@ -53,16 +35,34 @@ func (j *RevokeOauthAppRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with revoking a used application +type RevokeOauthAppResp struct { + // Echo of the request made. + EchoReq RevokeOauthAppRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType RevokeOauthAppRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // `1` on success + RevokeOauthApp *int `json:"revoke_oauth_app,omitempty"` +} + +const RevokeOauthAppRespMsgTypeRevokeOauthApp RevokeOauthAppRespMsgType = "revoke_oauth_app" + // UnmarshalJSON implements json.Unmarshaler. func (j *RevokeOauthAppResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in RevokeOauthAppResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in RevokeOauthAppResp: required") } type Plain RevokeOauthAppResp diff --git a/schema/sell.go b/schema/sell.go index 8faea2b..a747beb 100644 --- a/schema/sell.go +++ b/schema/sell.go @@ -35,10 +35,10 @@ func (j *Sell) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in Sell: required") } - if _, ok := raw["sell"]; raw != nil && !ok { + if v, ok := raw["sell"]; !ok || v == nil { return fmt.Errorf("field sell in Sell: required") } type Plain Sell diff --git a/schema/sell_contract_for_multiple_accounts.go b/schema/sell_contract_for_multiple_accounts.go index 594f367..485776f 100644 --- a/schema/sell_contract_for_multiple_accounts.go +++ b/schema/sell_contract_for_multiple_accounts.go @@ -6,6 +6,36 @@ import "encoding/json" import "fmt" import "reflect" +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type SellContractForMultipleAccountsPassthrough map[string]interface{} + +type SellContractForMultipleAccountsSellContractForMultipleAccounts int + +var enumValues_SellContractForMultipleAccountsSellContractForMultipleAccounts = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *SellContractForMultipleAccountsSellContractForMultipleAccounts) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SellContractForMultipleAccountsSellContractForMultipleAccounts { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SellContractForMultipleAccountsSellContractForMultipleAccounts, v) + } + *j = SellContractForMultipleAccountsSellContractForMultipleAccounts(v) + return nil +} + // Sell contracts for multiple accounts simultaneously. Uses the shortcode response // from `buy_contract_for_multiple_accounts` to identify the contract, and // authorisation tokens to select which accounts to sell those contracts on. Note @@ -39,52 +69,22 @@ type SellContractForMultipleAccounts struct { Tokens []string `json:"tokens"` } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type SellContractForMultipleAccountsPassthrough map[string]interface{} - -type SellContractForMultipleAccountsSellContractForMultipleAccounts int - -var enumValues_SellContractForMultipleAccountsSellContractForMultipleAccounts = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SellContractForMultipleAccountsSellContractForMultipleAccounts) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SellContractForMultipleAccountsSellContractForMultipleAccounts { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SellContractForMultipleAccountsSellContractForMultipleAccounts, v) - } - *j = SellContractForMultipleAccountsSellContractForMultipleAccounts(v) - return nil -} - // UnmarshalJSON implements json.Unmarshaler. func (j *SellContractForMultipleAccounts) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["price"]; raw != nil && !ok { + if v, ok := raw["price"]; !ok || v == nil { return fmt.Errorf("field price in SellContractForMultipleAccounts: required") } - if _, ok := raw["sell_contract_for_multiple_accounts"]; raw != nil && !ok { + if v, ok := raw["sell_contract_for_multiple_accounts"]; !ok || v == nil { return fmt.Errorf("field sell_contract_for_multiple_accounts in SellContractForMultipleAccounts: required") } - if _, ok := raw["shortcode"]; raw != nil && !ok { + if v, ok := raw["shortcode"]; !ok || v == nil { return fmt.Errorf("field shortcode in SellContractForMultipleAccounts: required") } - if _, ok := raw["tokens"]; raw != nil && !ok { + if v, ok := raw["tokens"]; !ok || v == nil { return fmt.Errorf("field tokens in SellContractForMultipleAccounts: required") } type Plain SellContractForMultipleAccounts diff --git a/schema/sell_contract_for_multiple_accounts_resp.go b/schema/sell_contract_for_multiple_accounts_resp.go index ce41141..3820c7f 100644 --- a/schema/sell_contract_for_multiple_accounts_resp.go +++ b/schema/sell_contract_for_multiple_accounts_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Confirmation of the sale status for the selected contracts and accounts. -type SellContractForMultipleAccountsResp struct { - // Echo of the request made. - EchoReq SellContractForMultipleAccountsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType SellContractForMultipleAccountsRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Status information for each affected account. - SellContractForMultipleAccounts *SellContractForMultipleAccountsRespSellContractForMultipleAccounts `json:"sell_contract_for_multiple_accounts,omitempty"` -} - // Echo of the request made. type SellContractForMultipleAccountsRespEchoReq map[string]interface{} type SellContractForMultipleAccountsRespMsgType string -const SellContractForMultipleAccountsRespMsgTypeSellContractForMultipleAccounts SellContractForMultipleAccountsRespMsgType = "sell_contract_for_multiple_accounts" - var enumValues_SellContractForMultipleAccountsRespMsgType = []interface{}{ "sell_contract_for_multiple_accounts", } @@ -53,6 +35,24 @@ func (j *SellContractForMultipleAccountsRespMsgType) UnmarshalJSON(b []byte) err return nil } +// Confirmation of the sale status for the selected contracts and accounts. +type SellContractForMultipleAccountsResp struct { + // Echo of the request made. + EchoReq SellContractForMultipleAccountsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType SellContractForMultipleAccountsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Status information for each affected account. + SellContractForMultipleAccounts *SellContractForMultipleAccountsRespSellContractForMultipleAccounts `json:"sell_contract_for_multiple_accounts,omitempty"` +} + +const SellContractForMultipleAccountsRespMsgTypeSellContractForMultipleAccounts SellContractForMultipleAccountsRespMsgType = "sell_contract_for_multiple_accounts" + // Status information for each affected account. type SellContractForMultipleAccountsRespSellContractForMultipleAccounts struct { // The result of sell for multiple accounts request. @@ -65,10 +65,10 @@ func (j *SellContractForMultipleAccountsResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in SellContractForMultipleAccountsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in SellContractForMultipleAccountsResp: required") } type Plain SellContractForMultipleAccountsResp diff --git a/schema/sell_expired.go b/schema/sell_expired.go index b84d94b..83ff2be 100644 --- a/schema/sell_expired.go +++ b/schema/sell_expired.go @@ -6,24 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// This call will try to sell any expired contracts and return the number of sold -// contracts. -type SellExpired struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough SellExpiredPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - SellExpired SellExpiredSellExpired `json:"sell_expired"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type SellExpiredPassthrough map[string]interface{} @@ -54,13 +36,31 @@ func (j *SellExpiredSellExpired) UnmarshalJSON(b []byte) error { return nil } +// This call will try to sell any expired contracts and return the number of sold +// contracts. +type SellExpired struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough SellExpiredPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + SellExpired SellExpiredSellExpired `json:"sell_expired"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *SellExpired) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["sell_expired"]; raw != nil && !ok { + if v, ok := raw["sell_expired"]; !ok || v == nil { return fmt.Errorf("field sell_expired in SellExpired: required") } type Plain SellExpired diff --git a/schema/sell_expired_resp.go b/schema/sell_expired_resp.go index 4204c4f..2ca7cb1 100644 --- a/schema/sell_expired_resp.go +++ b/schema/sell_expired_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of sell expired contract -type SellExpiredResp struct { - // Echo of the request made. - EchoReq SellExpiredRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType SellExpiredRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Sell expired contract object containing count of contracts sold - SellExpired *SellExpiredRespSellExpired `json:"sell_expired,omitempty"` -} - // Echo of the request made. type SellExpiredRespEchoReq map[string]interface{} type SellExpiredRespMsgType string -const SellExpiredRespMsgTypeSellExpired SellExpiredRespMsgType = "sell_expired" - var enumValues_SellExpiredRespMsgType = []interface{}{ "sell_expired", } @@ -53,6 +35,24 @@ func (j *SellExpiredRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of sell expired contract +type SellExpiredResp struct { + // Echo of the request made. + EchoReq SellExpiredRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType SellExpiredRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Sell expired contract object containing count of contracts sold + SellExpired *SellExpiredRespSellExpired `json:"sell_expired,omitempty"` +} + +const SellExpiredRespMsgTypeSellExpired SellExpiredRespMsgType = "sell_expired" + // Sell expired contract object containing count of contracts sold type SellExpiredRespSellExpired struct { // The number of contracts that has been sold. @@ -65,10 +65,10 @@ func (j *SellExpiredResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in SellExpiredResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in SellExpiredResp: required") } type Plain SellExpiredResp diff --git a/schema/sell_resp.go b/schema/sell_resp.go index 3bff59e..76bf6c6 100644 --- a/schema/sell_resp.go +++ b/schema/sell_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with transaction results is received -type SellResp struct { - // Echo of the request made. - EchoReq SellRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType SellRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Receipt for the transaction - Sell *SellRespSell `json:"sell,omitempty"` -} - // Echo of the request made. type SellRespEchoReq map[string]interface{} type SellRespMsgType string -const SellRespMsgTypeSell SellRespMsgType = "sell" - var enumValues_SellRespMsgType = []interface{}{ "sell", } @@ -53,6 +35,24 @@ func (j *SellRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with transaction results is received +type SellResp struct { + // Echo of the request made. + EchoReq SellRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType SellRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Receipt for the transaction + Sell *SellRespSell `json:"sell,omitempty"` +} + +const SellRespMsgTypeSell SellRespMsgType = "sell" + // Receipt for the transaction type SellRespSell struct { // New account balance after completion of the sale @@ -77,10 +77,10 @@ func (j *SellResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in SellResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in SellResp: required") } type Plain SellResp diff --git a/schema/set_account_currency.go b/schema/set_account_currency.go index 3242039..197b8e1 100644 --- a/schema/set_account_currency.go +++ b/schema/set_account_currency.go @@ -35,7 +35,7 @@ func (j *SetAccountCurrency) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["set_account_currency"]; raw != nil && !ok { + if v, ok := raw["set_account_currency"]; !ok || v == nil { return fmt.Errorf("field set_account_currency in SetAccountCurrency: required") } type Plain SetAccountCurrency diff --git a/schema/set_account_currency_resp.go b/schema/set_account_currency_resp.go index 4e5b302..4dd255f 100644 --- a/schema/set_account_currency_resp.go +++ b/schema/set_account_currency_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Status of set account currency call -type SetAccountCurrencyResp struct { - // Echo of the request made. - EchoReq SetAccountCurrencyRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType SetAccountCurrencyRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // `1`: success, `0`: no change - SetAccountCurrency *SetAccountCurrencyRespSetAccountCurrency `json:"set_account_currency,omitempty"` -} - // Echo of the request made. type SetAccountCurrencyRespEchoReq map[string]interface{} type SetAccountCurrencyRespMsgType string -const SetAccountCurrencyRespMsgTypeSetAccountCurrency SetAccountCurrencyRespMsgType = "set_account_currency" - var enumValues_SetAccountCurrencyRespMsgType = []interface{}{ "set_account_currency", } @@ -53,6 +35,8 @@ func (j *SetAccountCurrencyRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const SetAccountCurrencyRespMsgTypeSetAccountCurrency SetAccountCurrencyRespMsgType = "set_account_currency" + type SetAccountCurrencyRespSetAccountCurrency int var enumValues_SetAccountCurrencyRespSetAccountCurrency = []interface{}{ @@ -80,16 +64,32 @@ func (j *SetAccountCurrencyRespSetAccountCurrency) UnmarshalJSON(b []byte) error return nil } +// Status of set account currency call +type SetAccountCurrencyResp struct { + // Echo of the request made. + EchoReq SetAccountCurrencyRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType SetAccountCurrencyRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // `1`: success, `0`: no change + SetAccountCurrency *SetAccountCurrencyRespSetAccountCurrency `json:"set_account_currency,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *SetAccountCurrencyResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in SetAccountCurrencyResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in SetAccountCurrencyResp: required") } type Plain SetAccountCurrencyResp diff --git a/schema/set_financial_assessment.go b/schema/set_financial_assessment.go index 373078c..c7b455b 100644 --- a/schema/set_financial_assessment.go +++ b/schema/set_financial_assessment.go @@ -93,66 +93,12 @@ const SetFinancialAssessmentAccountTurnoverA50001100000 SetFinancialAssessmentAc const SetFinancialAssessmentAccountTurnoverLessThan25000 SetFinancialAssessmentAccountTurnover = "Less than $25,000" const SetFinancialAssessmentAccountTurnoverOver500000 SetFinancialAssessmentAccountTurnover = "Over $500,000" -var enumValues_SetFinancialAssessmentAccountTurnover = []interface{}{ - "Less than $25,000", - "$25,000 - $50,000", - "$50,001 - $100,000", - "$100,001 - $500,000", - "Over $500,000", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentAccountTurnover) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentAccountTurnover { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentAccountTurnover, v) - } - *j = SetFinancialAssessmentAccountTurnover(v) - return nil -} - type SetFinancialAssessmentBinaryOptionsTradingExperience string const SetFinancialAssessmentBinaryOptionsTradingExperienceA01Year SetFinancialAssessmentBinaryOptionsTradingExperience = "0-1 year" const SetFinancialAssessmentBinaryOptionsTradingExperienceA12Years SetFinancialAssessmentBinaryOptionsTradingExperience = "1-2 years" const SetFinancialAssessmentBinaryOptionsTradingExperienceOver3Years SetFinancialAssessmentBinaryOptionsTradingExperience = "Over 3 years" -var enumValues_SetFinancialAssessmentBinaryOptionsTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentBinaryOptionsTradingExperience) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentBinaryOptionsTradingExperience { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentBinaryOptionsTradingExperience, v) - } - *j = SetFinancialAssessmentBinaryOptionsTradingExperience(v) - return nil -} - type SetFinancialAssessmentBinaryOptionsTradingFrequency string const SetFinancialAssessmentBinaryOptionsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "0-5 transactions in the past 12 months" @@ -160,65 +106,12 @@ const SetFinancialAssessmentBinaryOptionsTradingFrequencyA1139TransactionsInTheP const SetFinancialAssessmentBinaryOptionsTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "40 transactions or more in the past 12 months" const SetFinancialAssessmentBinaryOptionsTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "6-10 transactions in the past 12 months" -var enumValues_SetFinancialAssessmentBinaryOptionsTradingFrequency = []interface{}{ - "0-5 transactions in the past 12 months", - "6-10 transactions in the past 12 months", - "11-39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentBinaryOptionsTradingFrequency) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentBinaryOptionsTradingFrequency { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentBinaryOptionsTradingFrequency, v) - } - *j = SetFinancialAssessmentBinaryOptionsTradingFrequency(v) - return nil -} - type SetFinancialAssessmentCfdTradingExperience string const SetFinancialAssessmentCfdTradingExperienceA01Year SetFinancialAssessmentCfdTradingExperience = "0-1 year" const SetFinancialAssessmentCfdTradingExperienceA12Years SetFinancialAssessmentCfdTradingExperience = "1-2 years" const SetFinancialAssessmentCfdTradingExperienceOver3Years SetFinancialAssessmentCfdTradingExperience = "Over 3 years" -var enumValues_SetFinancialAssessmentCfdTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentCfdTradingExperience) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentCfdTradingExperience { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentCfdTradingExperience, v) - } - *j = SetFinancialAssessmentCfdTradingExperience(v) - return nil -} - type SetFinancialAssessmentCfdTradingFrequency string const SetFinancialAssessmentCfdTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentCfdTradingFrequency = "0-5 transactions in the past 12 months" @@ -226,65 +119,12 @@ const SetFinancialAssessmentCfdTradingFrequencyA1139TransactionsInThePast12Month const SetFinancialAssessmentCfdTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentCfdTradingFrequency = "40 transactions or more in the past 12 months" const SetFinancialAssessmentCfdTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentCfdTradingFrequency = "6-10 transactions in the past 12 months" -var enumValues_SetFinancialAssessmentCfdTradingFrequency = []interface{}{ - "0-5 transactions in the past 12 months", - "6-10 transactions in the past 12 months", - "11-39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentCfdTradingFrequency) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentCfdTradingFrequency { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentCfdTradingFrequency, v) - } - *j = SetFinancialAssessmentCfdTradingFrequency(v) - return nil -} - type SetFinancialAssessmentEducationLevel string const SetFinancialAssessmentEducationLevelPrimary SetFinancialAssessmentEducationLevel = "Primary" const SetFinancialAssessmentEducationLevelSecondary SetFinancialAssessmentEducationLevel = "Secondary" const SetFinancialAssessmentEducationLevelTertiary SetFinancialAssessmentEducationLevel = "Tertiary" -var enumValues_SetFinancialAssessmentEducationLevel = []interface{}{ - "Primary", - "Secondary", - "Tertiary", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentEducationLevel) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentEducationLevel { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEducationLevel, v) - } - *j = SetFinancialAssessmentEducationLevel(v) - return nil -} - type SetFinancialAssessmentEmploymentIndustry string const SetFinancialAssessmentEmploymentIndustryAgriculture SetFinancialAssessmentEmploymentIndustry = "Agriculture" @@ -302,43 +142,6 @@ const SetFinancialAssessmentEmploymentIndustrySocialCultural SetFinancialAssessm const SetFinancialAssessmentEmploymentIndustryTourism SetFinancialAssessmentEmploymentIndustry = "Tourism" const SetFinancialAssessmentEmploymentIndustryUnemployed SetFinancialAssessmentEmploymentIndustry = "Unemployed" -var enumValues_SetFinancialAssessmentEmploymentIndustry = []interface{}{ - "Construction", - "Education", - "Finance", - "Health", - "Tourism", - "Information & Communications Technology", - "Science & Engineering", - "Legal", - "Social & Cultural", - "Agriculture", - "Real Estate", - "Food Services", - "Manufacturing", - "Unemployed", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentEmploymentIndustry) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentEmploymentIndustry { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEmploymentIndustry, v) - } - *j = SetFinancialAssessmentEmploymentIndustry(v) - return nil -} - type SetFinancialAssessmentEmploymentStatus string const SetFinancialAssessmentEmploymentStatusEmployed SetFinancialAssessmentEmploymentStatus = "Employed" @@ -347,34 +150,6 @@ const SetFinancialAssessmentEmploymentStatusSelfEmployed SetFinancialAssessmentE const SetFinancialAssessmentEmploymentStatusStudent SetFinancialAssessmentEmploymentStatus = "Student" const SetFinancialAssessmentEmploymentStatusUnemployed SetFinancialAssessmentEmploymentStatus = "Unemployed" -var enumValues_SetFinancialAssessmentEmploymentStatus = []interface{}{ - "Employed", - "Pensioner", - "Self-Employed", - "Student", - "Unemployed", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentEmploymentStatus) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentEmploymentStatus { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEmploymentStatus, v) - } - *j = SetFinancialAssessmentEmploymentStatus(v) - return nil -} - type SetFinancialAssessmentEstimatedWorth string const SetFinancialAssessmentEstimatedWorthA100000250000 SetFinancialAssessmentEstimatedWorth = "$100,000 - $250,000" @@ -383,34 +158,6 @@ const SetFinancialAssessmentEstimatedWorthA5000011000000 SetFinancialAssessmentE const SetFinancialAssessmentEstimatedWorthLessThan100000 SetFinancialAssessmentEstimatedWorth = "Less than $100,000" const SetFinancialAssessmentEstimatedWorthOver1000000 SetFinancialAssessmentEstimatedWorth = "Over $1,000,000" -var enumValues_SetFinancialAssessmentEstimatedWorth = []interface{}{ - "Less than $100,000", - "$100,000 - $250,000", - "$250,001 - $500,000", - "$500,001 - $1,000,000", - "Over $1,000,000", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentEstimatedWorth) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetFinancialAssessmentEstimatedWorth { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEstimatedWorth, v) - } - *j = SetFinancialAssessmentEstimatedWorth(v) - return nil -} - // [Optional] The financial information of a client type SetFinancialAssessmentFinancialInformation struct { // [Optional] The anticipated account turnover. @@ -449,298 +196,864 @@ const SetFinancialAssessmentFinancialInformationAccountTurnoverA50001100000 SetF const SetFinancialAssessmentFinancialInformationAccountTurnoverLessThan25000 SetFinancialAssessmentFinancialInformationAccountTurnover = "Less than $25,000" const SetFinancialAssessmentFinancialInformationAccountTurnoverOver500000 SetFinancialAssessmentFinancialInformationAccountTurnover = "Over $500,000" -var enumValues_SetFinancialAssessmentFinancialInformationAccountTurnover = []interface{}{ - "Less than $25,000", - "$25,000 - $50,000", +type SetFinancialAssessmentFinancialInformationEducationLevel string + +const SetFinancialAssessmentFinancialInformationEducationLevelPrimary SetFinancialAssessmentFinancialInformationEducationLevel = "Primary" +const SetFinancialAssessmentFinancialInformationEducationLevelSecondary SetFinancialAssessmentFinancialInformationEducationLevel = "Secondary" +const SetFinancialAssessmentFinancialInformationEducationLevelTertiary SetFinancialAssessmentFinancialInformationEducationLevel = "Tertiary" + +type SetFinancialAssessmentFinancialInformationEmploymentIndustry string + +const SetFinancialAssessmentFinancialInformationEmploymentIndustryAgriculture SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Agriculture" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryConstruction SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Construction" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryEducation SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Education" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryFinance SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Finance" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryFoodServices SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Food Services" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryHealth SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Health" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryInformationCommunicationsTechnology SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Information & Communications Technology" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryLegal SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Legal" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryManufacturing SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Manufacturing" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryRealEstate SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Real Estate" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryScienceEngineering SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Science & Engineering" +const SetFinancialAssessmentFinancialInformationEmploymentIndustrySocialCultural SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Social & Cultural" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryTourism SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Tourism" +const SetFinancialAssessmentFinancialInformationEmploymentIndustryUnemployed SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Unemployed" + +type SetFinancialAssessmentFinancialInformationEmploymentStatus string + +const SetFinancialAssessmentFinancialInformationEmploymentStatusEmployed SetFinancialAssessmentFinancialInformationEmploymentStatus = "Employed" +const SetFinancialAssessmentFinancialInformationEmploymentStatusPensioner SetFinancialAssessmentFinancialInformationEmploymentStatus = "Pensioner" +const SetFinancialAssessmentFinancialInformationEmploymentStatusSelfEmployed SetFinancialAssessmentFinancialInformationEmploymentStatus = "Self-Employed" +const SetFinancialAssessmentFinancialInformationEmploymentStatusStudent SetFinancialAssessmentFinancialInformationEmploymentStatus = "Student" +const SetFinancialAssessmentFinancialInformationEmploymentStatusUnemployed SetFinancialAssessmentFinancialInformationEmploymentStatus = "Unemployed" + +type SetFinancialAssessmentFinancialInformationEstimatedWorth string + +const SetFinancialAssessmentFinancialInformationEstimatedWorthA100000250000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "$100,000 - $250,000" +const SetFinancialAssessmentFinancialInformationEstimatedWorthA250001500000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "$250,001 - $500,000" +const SetFinancialAssessmentFinancialInformationEstimatedWorthA5000011000000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "$500,001 - $1,000,000" +const SetFinancialAssessmentFinancialInformationEstimatedWorthLessThan100000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "Less than $100,000" +const SetFinancialAssessmentFinancialInformationEstimatedWorthOver1000000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "Over $1,000,000" + +type SetFinancialAssessmentFinancialInformationIncomeSource string + +const SetFinancialAssessmentFinancialInformationIncomeSourceInvestmentsDividends SetFinancialAssessmentFinancialInformationIncomeSource = "Investments & Dividends" +const SetFinancialAssessmentFinancialInformationIncomeSourcePension SetFinancialAssessmentFinancialInformationIncomeSource = "Pension" +const SetFinancialAssessmentFinancialInformationIncomeSourceSalariedEmployee SetFinancialAssessmentFinancialInformationIncomeSource = "Salaried Employee" +const SetFinancialAssessmentFinancialInformationIncomeSourceSavingsInheritance SetFinancialAssessmentFinancialInformationIncomeSource = "Savings & Inheritance" +const SetFinancialAssessmentFinancialInformationIncomeSourceSelfEmployed SetFinancialAssessmentFinancialInformationIncomeSource = "Self-Employed" +const SetFinancialAssessmentFinancialInformationIncomeSourceStateBenefits SetFinancialAssessmentFinancialInformationIncomeSource = "State Benefits" + +type SetFinancialAssessmentFinancialInformationNetIncome string + +const SetFinancialAssessmentFinancialInformationNetIncomeA100001500000 SetFinancialAssessmentFinancialInformationNetIncome = "$100,001 - $500,000" +const SetFinancialAssessmentFinancialInformationNetIncomeA2500050000 SetFinancialAssessmentFinancialInformationNetIncome = "$25,000 - $50,000" +const SetFinancialAssessmentFinancialInformationNetIncomeA50001100000 SetFinancialAssessmentFinancialInformationNetIncome = "$50,001 - $100,000" +const SetFinancialAssessmentFinancialInformationNetIncomeLessThan25000 SetFinancialAssessmentFinancialInformationNetIncome = "Less than $25,000" +const SetFinancialAssessmentFinancialInformationNetIncomeOver500000 SetFinancialAssessmentFinancialInformationNetIncome = "Over $500,000" + +type SetFinancialAssessmentFinancialInformationOccupation string + +const SetFinancialAssessmentFinancialInformationOccupationAgriculturalForestryAndFisheryWorkers SetFinancialAssessmentFinancialInformationOccupation = "Agricultural, Forestry and Fishery Workers" +const SetFinancialAssessmentFinancialInformationOccupationArmedForces SetFinancialAssessmentFinancialInformationOccupation = "Armed Forces" +const SetFinancialAssessmentFinancialInformationOccupationChiefExecutivesSeniorOfficialsAndLegislators SetFinancialAssessmentFinancialInformationOccupation = "Chief Executives, Senior Officials and Legislators" +const SetFinancialAssessmentFinancialInformationOccupationCleanersAndHelpers SetFinancialAssessmentFinancialInformationOccupation = "Cleaners and Helpers" +const SetFinancialAssessmentFinancialInformationOccupationClerks SetFinancialAssessmentFinancialInformationOccupation = "Clerks" +const SetFinancialAssessmentFinancialInformationOccupationCraftMetalElectricalAndElectronicsWorkers SetFinancialAssessmentFinancialInformationOccupation = "Craft, Metal, Electrical and Electronics Workers" +const SetFinancialAssessmentFinancialInformationOccupationGovernmentOfficers SetFinancialAssessmentFinancialInformationOccupation = "Government Officers" +const SetFinancialAssessmentFinancialInformationOccupationManagers SetFinancialAssessmentFinancialInformationOccupation = "Managers" +const SetFinancialAssessmentFinancialInformationOccupationMiningConstructionManufacturingAndTransportWorkers SetFinancialAssessmentFinancialInformationOccupation = "Mining, Construction, Manufacturing and Transport Workers" +const SetFinancialAssessmentFinancialInformationOccupationPersonalCareSalesAndServiceWorkers SetFinancialAssessmentFinancialInformationOccupation = "Personal Care, Sales and Service Workers" +const SetFinancialAssessmentFinancialInformationOccupationPlantAndMachineOperatorsAndAssemblers SetFinancialAssessmentFinancialInformationOccupation = "Plant and Machine Operators and Assemblers" +const SetFinancialAssessmentFinancialInformationOccupationProfessionals SetFinancialAssessmentFinancialInformationOccupation = "Professionals" +const SetFinancialAssessmentFinancialInformationOccupationStudents SetFinancialAssessmentFinancialInformationOccupation = "Students" +const SetFinancialAssessmentFinancialInformationOccupationUnemployed SetFinancialAssessmentFinancialInformationOccupation = "Unemployed" + +type SetFinancialAssessmentFinancialInformationSourceOfWealth string + +const SetFinancialAssessmentFinancialInformationSourceOfWealthAccumulationOfIncomeSavings SetFinancialAssessmentFinancialInformationSourceOfWealth = "Accumulation of Income/Savings" +const SetFinancialAssessmentFinancialInformationSourceOfWealthCashBusiness SetFinancialAssessmentFinancialInformationSourceOfWealth = "Cash Business" +const SetFinancialAssessmentFinancialInformationSourceOfWealthCompanyOwnership SetFinancialAssessmentFinancialInformationSourceOfWealth = "Company Ownership" +const SetFinancialAssessmentFinancialInformationSourceOfWealthDivorceSettlement SetFinancialAssessmentFinancialInformationSourceOfWealth = "Divorce Settlement" +const SetFinancialAssessmentFinancialInformationSourceOfWealthInheritance SetFinancialAssessmentFinancialInformationSourceOfWealth = "Inheritance" +const SetFinancialAssessmentFinancialInformationSourceOfWealthInvestmentIncome SetFinancialAssessmentFinancialInformationSourceOfWealth = "Investment Income" +const SetFinancialAssessmentFinancialInformationSourceOfWealthSaleOfProperty SetFinancialAssessmentFinancialInformationSourceOfWealth = "Sale of Property" + +type SetFinancialAssessmentForexTradingExperience string + +const SetFinancialAssessmentForexTradingExperienceA01Year SetFinancialAssessmentForexTradingExperience = "0-1 year" +const SetFinancialAssessmentForexTradingExperienceA12Years SetFinancialAssessmentForexTradingExperience = "1-2 years" +const SetFinancialAssessmentForexTradingExperienceOver3Years SetFinancialAssessmentForexTradingExperience = "Over 3 years" + +type SetFinancialAssessmentForexTradingFrequency string + +const SetFinancialAssessmentForexTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentForexTradingFrequency = "0-5 transactions in the past 12 months" +const SetFinancialAssessmentForexTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentForexTradingFrequency = "11-39 transactions in the past 12 months" +const SetFinancialAssessmentForexTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentForexTradingFrequency = "40 transactions or more in the past 12 months" +const SetFinancialAssessmentForexTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentForexTradingFrequency = "6-10 transactions in the past 12 months" + +type SetFinancialAssessmentIncomeSource string + +const SetFinancialAssessmentIncomeSourceInvestmentsDividends SetFinancialAssessmentIncomeSource = "Investments & Dividends" +const SetFinancialAssessmentIncomeSourcePension SetFinancialAssessmentIncomeSource = "Pension" +const SetFinancialAssessmentIncomeSourceSalariedEmployee SetFinancialAssessmentIncomeSource = "Salaried Employee" +const SetFinancialAssessmentIncomeSourceSavingsInheritance SetFinancialAssessmentIncomeSource = "Savings & Inheritance" +const SetFinancialAssessmentIncomeSourceSelfEmployed SetFinancialAssessmentIncomeSource = "Self-Employed" +const SetFinancialAssessmentIncomeSourceStateBenefits SetFinancialAssessmentIncomeSource = "State Benefits" + +type SetFinancialAssessmentNetIncome string + +const SetFinancialAssessmentNetIncomeA100001500000 SetFinancialAssessmentNetIncome = "$100,001 - $500,000" +const SetFinancialAssessmentNetIncomeA2500050000 SetFinancialAssessmentNetIncome = "$25,000 - $50,000" +const SetFinancialAssessmentNetIncomeA50001100000 SetFinancialAssessmentNetIncome = "$50,001 - $100,000" +const SetFinancialAssessmentNetIncomeLessThan25000 SetFinancialAssessmentNetIncome = "Less than $25,000" +const SetFinancialAssessmentNetIncomeOver500000 SetFinancialAssessmentNetIncome = "Over $500,000" + +type SetFinancialAssessmentOccupation string + +const SetFinancialAssessmentOccupationAgriculturalForestryAndFisheryWorkers SetFinancialAssessmentOccupation = "Agricultural, Forestry and Fishery Workers" +const SetFinancialAssessmentOccupationArmedForces SetFinancialAssessmentOccupation = "Armed Forces" +const SetFinancialAssessmentOccupationChiefExecutivesSeniorOfficialsAndLegislators SetFinancialAssessmentOccupation = "Chief Executives, Senior Officials and Legislators" +const SetFinancialAssessmentOccupationCleanersAndHelpers SetFinancialAssessmentOccupation = "Cleaners and Helpers" +const SetFinancialAssessmentOccupationClerks SetFinancialAssessmentOccupation = "Clerks" +const SetFinancialAssessmentOccupationCraftMetalElectricalAndElectronicsWorkers SetFinancialAssessmentOccupation = "Craft, Metal, Electrical and Electronics Workers" +const SetFinancialAssessmentOccupationGovernmentOfficers SetFinancialAssessmentOccupation = "Government Officers" +const SetFinancialAssessmentOccupationManagers SetFinancialAssessmentOccupation = "Managers" +const SetFinancialAssessmentOccupationMiningConstructionManufacturingAndTransportWorkers SetFinancialAssessmentOccupation = "Mining, Construction, Manufacturing and Transport Workers" +const SetFinancialAssessmentOccupationPersonalCareSalesAndServiceWorkers SetFinancialAssessmentOccupation = "Personal Care, Sales and Service Workers" +const SetFinancialAssessmentOccupationPlantAndMachineOperatorsAndAssemblers SetFinancialAssessmentOccupation = "Plant and Machine Operators and Assemblers" +const SetFinancialAssessmentOccupationProfessionals SetFinancialAssessmentOccupation = "Professionals" +const SetFinancialAssessmentOccupationStudents SetFinancialAssessmentOccupation = "Students" +const SetFinancialAssessmentOccupationUnemployed SetFinancialAssessmentOccupation = "Unemployed" + +type SetFinancialAssessmentOtherInstrumentsTradingExperience string + +const SetFinancialAssessmentOtherInstrumentsTradingExperienceA01Year SetFinancialAssessmentOtherInstrumentsTradingExperience = "0-1 year" +const SetFinancialAssessmentOtherInstrumentsTradingExperienceA12Years SetFinancialAssessmentOtherInstrumentsTradingExperience = "1-2 years" +const SetFinancialAssessmentOtherInstrumentsTradingExperienceOver3Years SetFinancialAssessmentOtherInstrumentsTradingExperience = "Over 3 years" + +type SetFinancialAssessmentOtherInstrumentsTradingFrequency string + +const SetFinancialAssessmentOtherInstrumentsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentOtherInstrumentsTradingFrequency = "0-5 transactions in the past 12 months" +const SetFinancialAssessmentOtherInstrumentsTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentOtherInstrumentsTradingFrequency = "11-39 transactions in the past 12 months" +const SetFinancialAssessmentOtherInstrumentsTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentOtherInstrumentsTradingFrequency = "40 transactions or more in the past 12 months" +const SetFinancialAssessmentOtherInstrumentsTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentOtherInstrumentsTradingFrequency = "6-10 transactions in the past 12 months" + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type SetFinancialAssessmentPassthrough map[string]interface{} + +type SetFinancialAssessmentSetFinancialAssessment int + +type SetFinancialAssessmentSourceOfWealth string + +const SetFinancialAssessmentSourceOfWealthAccumulationOfIncomeSavings SetFinancialAssessmentSourceOfWealth = "Accumulation of Income/Savings" +const SetFinancialAssessmentSourceOfWealthCashBusiness SetFinancialAssessmentSourceOfWealth = "Cash Business" +const SetFinancialAssessmentSourceOfWealthCompanyOwnership SetFinancialAssessmentSourceOfWealth = "Company Ownership" +const SetFinancialAssessmentSourceOfWealthDivorceSettlement SetFinancialAssessmentSourceOfWealth = "Divorce Settlement" +const SetFinancialAssessmentSourceOfWealthInheritance SetFinancialAssessmentSourceOfWealth = "Inheritance" +const SetFinancialAssessmentSourceOfWealthInvestmentIncome SetFinancialAssessmentSourceOfWealth = "Investment Income" +const SetFinancialAssessmentSourceOfWealthSaleOfProperty SetFinancialAssessmentSourceOfWealth = "Sale of Property" + +// [Optional] The trading experience of a client +type SetFinancialAssessmentTradingExperience struct { + // [Optional] Binary options trading experience. + BinaryOptionsTradingExperience *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience `json:"binary_options_trading_experience,omitempty"` + + // [Optional] Binary options trading frequency. + BinaryOptionsTradingFrequency *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency `json:"binary_options_trading_frequency,omitempty"` + + // [Optional] CFDs trading experience. + CfdTradingExperience *SetFinancialAssessmentTradingExperienceCfdTradingExperience `json:"cfd_trading_experience,omitempty"` + + // [Optional] CFDs trading frequency. + CfdTradingFrequency *SetFinancialAssessmentTradingExperienceCfdTradingFrequency `json:"cfd_trading_frequency,omitempty"` + + // [Optional] Forex trading experience. + ForexTradingExperience *SetFinancialAssessmentTradingExperienceForexTradingExperience `json:"forex_trading_experience,omitempty"` + + // [Optional] Forex trading frequency. + ForexTradingFrequency *SetFinancialAssessmentTradingExperienceForexTradingFrequency `json:"forex_trading_frequency,omitempty"` + + // [Optional] Trading experience in other financial instruments. + OtherInstrumentsTradingExperience *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience `json:"other_instruments_trading_experience,omitempty"` + + // [Optional] Trading frequency in other financial instruments. + OtherInstrumentsTradingFrequency *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency `json:"other_instruments_trading_frequency,omitempty"` +} + +type SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience string + +const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperienceA01Year SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = "0-1 year" +const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperienceA12Years SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = "1-2 years" +const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperienceOver3Years SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = "Over 3 years" + +type SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency string + +const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = "0-5 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = "11-39 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = "40 transactions or more in the past 12 months" +const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = "6-10 transactions in the past 12 months" + +type SetFinancialAssessmentTradingExperienceCfdTradingExperience string + +const SetFinancialAssessmentTradingExperienceCfdTradingExperienceA01Year SetFinancialAssessmentTradingExperienceCfdTradingExperience = "0-1 year" +const SetFinancialAssessmentTradingExperienceCfdTradingExperienceA12Years SetFinancialAssessmentTradingExperienceCfdTradingExperience = "1-2 years" +const SetFinancialAssessmentTradingExperienceCfdTradingExperienceOver3Years SetFinancialAssessmentTradingExperienceCfdTradingExperience = "Over 3 years" + +type SetFinancialAssessmentTradingExperienceCfdTradingFrequency string + +const SetFinancialAssessmentTradingExperienceCfdTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceCfdTradingFrequency = "0-5 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceCfdTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceCfdTradingFrequency = "11-39 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceCfdTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceCfdTradingFrequency = "40 transactions or more in the past 12 months" +const SetFinancialAssessmentTradingExperienceCfdTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceCfdTradingFrequency = "6-10 transactions in the past 12 months" + +type SetFinancialAssessmentTradingExperienceForexTradingExperience string + +const SetFinancialAssessmentTradingExperienceForexTradingExperienceA01Year SetFinancialAssessmentTradingExperienceForexTradingExperience = "0-1 year" +const SetFinancialAssessmentTradingExperienceForexTradingExperienceA12Years SetFinancialAssessmentTradingExperienceForexTradingExperience = "1-2 years" +const SetFinancialAssessmentTradingExperienceForexTradingExperienceOver3Years SetFinancialAssessmentTradingExperienceForexTradingExperience = "Over 3 years" + +type SetFinancialAssessmentTradingExperienceForexTradingFrequency string + +const SetFinancialAssessmentTradingExperienceForexTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceForexTradingFrequency = "0-5 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceForexTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceForexTradingFrequency = "11-39 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceForexTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceForexTradingFrequency = "40 transactions or more in the past 12 months" +const SetFinancialAssessmentTradingExperienceForexTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceForexTradingFrequency = "6-10 transactions in the past 12 months" + +type SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience string + +const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperienceA01Year SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = "0-1 year" +const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperienceA12Years SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = "1-2 years" +const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperienceOver3Years SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = "Over 3 years" + +type SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency string + +const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = "0-5 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = "11-39 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = "40 transactions or more in the past 12 months" +const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = "6-10 transactions in the past 12 months" + +// [Optional] The trading experience of a `maltainvest` client +type SetFinancialAssessmentTradingExperienceRegulated struct { + // How much experience do you have in CFD trading? + CfdExperience SetFinancialAssessmentTradingExperienceRegulatedCfdExperience `json:"cfd_experience"` + + // How many CFD trades have you placed in the past 12 months? + CfdFrequency SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency `json:"cfd_frequency"` + + // In your understanding, CFD trading allows you to: + CfdTradingDefinition SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition `json:"cfd_trading_definition"` + + // How does leverage affect CFD trading? + LeverageImpactTrading SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading `json:"leverage_impact_trading"` + + // Leverage trading is high-risk, so it's a good idea to use risk management + // features such as stop loss. Stop loss allows you to + LeverageTradingHighRiskStopLoss SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss `json:"leverage_trading_high_risk_stop_loss"` + + // When would you be required to pay an initial margin? + RequiredInitialMargin SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin `json:"required_initial_margin"` + + // Do you understand that you could potentially lose 100% of the money you use to + // trade? + RiskTolerance SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance `json:"risk_tolerance"` + + // How much knowledge and experience do you have in relation to online trading? + SourceOfExperience SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience `json:"source_of_experience"` + + // How much experience do you have with other financial instruments? + TradingExperienceFinancialInstruments SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments `json:"trading_experience_financial_instruments"` + + // How many trades have you placed with other financial instruments in the past 12 + // months? + TradingFrequencyFinancialInstruments SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments `json:"trading_frequency_financial_instruments"` +} + +type SetFinancialAssessmentTradingExperienceRegulatedCfdExperience string + +const SetFinancialAssessmentTradingExperienceRegulatedCfdExperienceA12Years SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = "1 - 2 years" +const SetFinancialAssessmentTradingExperienceRegulatedCfdExperienceLessThanAYear SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = "Less than a year" +const SetFinancialAssessmentTradingExperienceRegulatedCfdExperienceNoExperience SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = "No experience" +const SetFinancialAssessmentTradingExperienceRegulatedCfdExperienceOver3Years SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = "Over 3 years" + +type SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency string + +const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "11 - 39 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyA15TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "1 - 5 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "40 transactions or more in the past 12 months" +const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "6 - 10 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyNoTransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "No transactions in the past 12 months" + +type SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition string + +const SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinitionMakeALongTermInvestment SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = "Make a long-term investment." +const SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinitionPlaceABetOnThePriceMovement SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = "Place a bet on the price movement." +const SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinitionPurchaseSharesOfACompanyOrPhysicalCommodities SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = "Purchase shares of a company or physical commodities." +const SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinitionSpeculateOnThePriceMovement SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = "Speculate on the price movement." + +type SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading string + +const SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTradingLeverageGuaranteesProfits SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = "Leverage guarantees profits." +const SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTradingLeverageIsARiskMitigationTechnique SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = "Leverage is a risk mitigation technique." +const SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTradingLeverageLetsYouOpenLargerPositionsForAFractionOfTheTradeSValue SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = "Leverage lets you open larger positions for a fraction of the trade's value." +const SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTradingLeveragePreventsYouFromOpeningLargePositions SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = "Leverage prevents you from opening large positions." + +type SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss string + +const SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLossCancelYourTradeAtAnyTimeWithinAChosenTimeframe SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = "Cancel your trade at any time within a chosen timeframe." +const SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLossCloseYourTradeAutomaticallyWhenTheLossIsMoreThanOrEqualToASpecificAmount SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = "Close your trade automatically when the loss is more than or equal to a specific amount." +const SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLossCloseYourTradeAutomaticallyWhenTheProfitIsMoreThanOrEqualToASpecificAmount SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = "Close your trade automatically when the profit is more than or equal to a specific amount." +const SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLossMakeAGuaranteedProfitOnYourTrade SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = "Make a guaranteed profit on your trade." + +type SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin string + +const SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMarginAllOfTheAbove SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = "All of the above." +const SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMarginWhenBuyingSharesOfACompany SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = "When buying shares of a company." +const SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMarginWhenOpeningALeveragedCFDTrade SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = "When opening a Leveraged CFD trade." +const SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMarginWhenTradingMultipliers SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = "When trading Multipliers." + +type SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance string + +const SetFinancialAssessmentTradingExperienceRegulatedRiskToleranceNo SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance = "No" +const SetFinancialAssessmentTradingExperienceRegulatedRiskToleranceYes SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance = "Yes" + +type SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience string + +const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceIHaveAnAcademicDegreeProfessionalCertificationAndOrWorkExperience SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I have an academic degree, professional certification, and/or work experience." +const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceIHaveAttendedSeminarsTrainingAndOrWorkshops SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I have attended seminars, training, and/or workshops." +const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceIHaveLittleExperience SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I have little experience." +const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceIHaveNoKnowledge SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I have no knowledge." +const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceITradeForexCFDsAndOtherComplexFinancialInstruments SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I trade forex CFDs and other complex financial instruments." + +type SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments string + +const SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstrumentsA12Years SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = "1 - 2 years" +const SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstrumentsLessThanAYear SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = "Less than a year" +const SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstrumentsNoExperience SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = "No experience" +const SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstrumentsOver3Years SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = "Over 3 years" + +type SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments string + +const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "11 - 39 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsA15TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "1 - 5 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "40 transactions or more in the past 12 months" +const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "6 - 10 transactions in the past 12 months" +const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsNoTransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "No transactions in the past 12 months" + +var enumValues_SetFinancialAssessmentAccountTurnover = []interface{}{ + "Less than $25,000", + "$25,000 - $50,000", + "$50,001 - $100,000", + "$100,001 - $500,000", + "Over $500,000", +} +var enumValues_SetFinancialAssessmentBinaryOptionsTradingExperience = []interface{}{ + "0-1 year", + "1-2 years", + "Over 3 years", +} +var enumValues_SetFinancialAssessmentBinaryOptionsTradingFrequency = []interface{}{ + "0-5 transactions in the past 12 months", + "6-10 transactions in the past 12 months", + "11-39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} +var enumValues_SetFinancialAssessmentCfdTradingExperience = []interface{}{ + "0-1 year", + "1-2 years", + "Over 3 years", +} +var enumValues_SetFinancialAssessmentCfdTradingFrequency = []interface{}{ + "0-5 transactions in the past 12 months", + "6-10 transactions in the past 12 months", + "11-39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} +var enumValues_SetFinancialAssessmentEducationLevel = []interface{}{ + "Primary", + "Secondary", + "Tertiary", +} +var enumValues_SetFinancialAssessmentEmploymentIndustry = []interface{}{ + "Construction", + "Education", + "Finance", + "Health", + "Tourism", + "Information & Communications Technology", + "Science & Engineering", + "Legal", + "Social & Cultural", + "Agriculture", + "Real Estate", + "Food Services", + "Manufacturing", + "Unemployed", +} +var enumValues_SetFinancialAssessmentEmploymentStatus = []interface{}{ + "Employed", + "Pensioner", + "Self-Employed", + "Student", + "Unemployed", +} +var enumValues_SetFinancialAssessmentEstimatedWorth = []interface{}{ + "Less than $100,000", + "$100,000 - $250,000", + "$250,001 - $500,000", + "$500,001 - $1,000,000", + "Over $1,000,000", +} +var enumValues_SetFinancialAssessmentFinancialInformationAccountTurnover = []interface{}{ + "Less than $25,000", + "$25,000 - $50,000", + "$50,001 - $100,000", + "$100,001 - $500,000", + "Over $500,000", +} +var enumValues_SetFinancialAssessmentFinancialInformationEducationLevel = []interface{}{ + "Primary", + "Secondary", + "Tertiary", +} +var enumValues_SetFinancialAssessmentFinancialInformationEmploymentIndustry = []interface{}{ + "Construction", + "Education", + "Finance", + "Health", + "Tourism", + "Information & Communications Technology", + "Science & Engineering", + "Legal", + "Social & Cultural", + "Agriculture", + "Real Estate", + "Food Services", + "Manufacturing", + "Unemployed", +} +var enumValues_SetFinancialAssessmentFinancialInformationEmploymentStatus = []interface{}{ + "Employed", + "Pensioner", + "Self-Employed", + "Student", + "Unemployed", +} +var enumValues_SetFinancialAssessmentFinancialInformationEstimatedWorth = []interface{}{ + "Less than $100,000", + "$100,000 - $250,000", + "$250,001 - $500,000", + "$500,001 - $1,000,000", + "Over $1,000,000", +} +var enumValues_SetFinancialAssessmentFinancialInformationIncomeSource = []interface{}{ + "Salaried Employee", + "Self-Employed", + "Investments & Dividends", + "Pension", + "State Benefits", + "Savings & Inheritance", +} +var enumValues_SetFinancialAssessmentFinancialInformationNetIncome = []interface{}{ + "Less than $25,000", + "$25,000 - $50,000", + "$50,001 - $100,000", + "$100,001 - $500,000", + "Over $500,000", +} +var enumValues_SetFinancialAssessmentFinancialInformationOccupation = []interface{}{ + "Chief Executives, Senior Officials and Legislators", + "Managers", + "Professionals", + "Clerks", + "Personal Care, Sales and Service Workers", + "Agricultural, Forestry and Fishery Workers", + "Craft, Metal, Electrical and Electronics Workers", + "Plant and Machine Operators and Assemblers", + "Cleaners and Helpers", + "Mining, Construction, Manufacturing and Transport Workers", + "Armed Forces", + "Government Officers", + "Students", + "Unemployed", +} +var enumValues_SetFinancialAssessmentFinancialInformationSourceOfWealth = []interface{}{ + "Accumulation of Income/Savings", + "Cash Business", + "Company Ownership", + "Divorce Settlement", + "Inheritance", + "Investment Income", + "Sale of Property", +} +var enumValues_SetFinancialAssessmentForexTradingExperience = []interface{}{ + "0-1 year", + "1-2 years", + "Over 3 years", +} +var enumValues_SetFinancialAssessmentForexTradingFrequency = []interface{}{ + "0-5 transactions in the past 12 months", + "6-10 transactions in the past 12 months", + "11-39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} +var enumValues_SetFinancialAssessmentIncomeSource = []interface{}{ + "Salaried Employee", + "Self-Employed", + "Investments & Dividends", + "Pension", + "State Benefits", + "Savings & Inheritance", +} +var enumValues_SetFinancialAssessmentNetIncome = []interface{}{ + "Less than $25,000", + "$25,000 - $50,000", "$50,001 - $100,000", "$100,001 - $500,000", "Over $500,000", } +var enumValues_SetFinancialAssessmentOccupation = []interface{}{ + "Chief Executives, Senior Officials and Legislators", + "Managers", + "Professionals", + "Clerks", + "Personal Care, Sales and Service Workers", + "Agricultural, Forestry and Fishery Workers", + "Craft, Metal, Electrical and Electronics Workers", + "Plant and Machine Operators and Assemblers", + "Cleaners and Helpers", + "Mining, Construction, Manufacturing and Transport Workers", + "Armed Forces", + "Government Officers", + "Students", + "Unemployed", +} +var enumValues_SetFinancialAssessmentOtherInstrumentsTradingExperience = []interface{}{ + "0-1 year", + "1-2 years", + "Over 3 years", +} +var enumValues_SetFinancialAssessmentOtherInstrumentsTradingFrequency = []interface{}{ + "0-5 transactions in the past 12 months", + "6-10 transactions in the past 12 months", + "11-39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} +var enumValues_SetFinancialAssessmentSetFinancialAssessment = []interface{}{ + 1, +} +var enumValues_SetFinancialAssessmentSourceOfWealth = []interface{}{ + "Accumulation of Income/Savings", + "Cash Business", + "Company Ownership", + "Divorce Settlement", + "Inheritance", + "Investment Income", + "Sale of Property", +} +var enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = []interface{}{ + "0-1 year", + "1-2 years", + "Over 3 years", +} +var enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = []interface{}{ + "0-5 transactions in the past 12 months", + "6-10 transactions in the past 12 months", + "11-39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} +var enumValues_SetFinancialAssessmentTradingExperienceCfdTradingExperience = []interface{}{ + "0-1 year", + "1-2 years", + "Over 3 years", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationAccountTurnover) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationAccountTurnover { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationAccountTurnover, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency, v) } - *j = SetFinancialAssessmentFinancialInformationAccountTurnover(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency(v) return nil } -type SetFinancialAssessmentFinancialInformationEducationLevel string +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = []interface{}{ + "No transactions in the past 12 months", + "1 - 5 transactions in the past 12 months", + "6 - 10 transactions in the past 12 months", + "11 - 39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} -const SetFinancialAssessmentFinancialInformationEducationLevelPrimary SetFinancialAssessmentFinancialInformationEducationLevel = "Primary" -const SetFinancialAssessmentFinancialInformationEducationLevelSecondary SetFinancialAssessmentFinancialInformationEducationLevel = "Secondary" -const SetFinancialAssessmentFinancialInformationEducationLevelTertiary SetFinancialAssessmentFinancialInformationEducationLevel = "Tertiary" +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentTradingExperienceRegulatedCfdExperience) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience, v) + } + *j = SetFinancialAssessmentTradingExperienceRegulatedCfdExperience(v) + return nil +} -var enumValues_SetFinancialAssessmentFinancialInformationEducationLevel = []interface{}{ - "Primary", - "Secondary", - "Tertiary", +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = []interface{}{ + "No experience", + "Less than a year", + "1 - 2 years", + "Over 3 years", +} +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = []interface{}{ + "Purchase shares of a company or physical commodities.", + "Place a bet on the price movement.", + "Speculate on the price movement.", + "Make a long-term investment.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationEducationLevel) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationEducationLevel { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEducationLevel, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition, v) } - *j = SetFinancialAssessmentFinancialInformationEducationLevel(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition(v) return nil } -type SetFinancialAssessmentFinancialInformationEmploymentIndustry string +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency, v) + } + *j = SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency(v) + return nil +} -const SetFinancialAssessmentFinancialInformationEmploymentIndustryAgriculture SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Agriculture" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryConstruction SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Construction" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryEducation SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Education" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryFinance SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Finance" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryFoodServices SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Food Services" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryHealth SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Health" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryInformationCommunicationsTechnology SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Information & Communications Technology" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryLegal SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Legal" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryManufacturing SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Manufacturing" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryRealEstate SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Real Estate" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryScienceEngineering SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Science & Engineering" -const SetFinancialAssessmentFinancialInformationEmploymentIndustrySocialCultural SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Social & Cultural" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryTourism SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Tourism" -const SetFinancialAssessmentFinancialInformationEmploymentIndustryUnemployed SetFinancialAssessmentFinancialInformationEmploymentIndustry = "Unemployed" +var enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = []interface{}{ + "0-5 transactions in the past 12 months", + "6-10 transactions in the past 12 months", + "11-39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} -var enumValues_SetFinancialAssessmentFinancialInformationEmploymentIndustry = []interface{}{ - "Construction", - "Education", - "Finance", - "Health", - "Tourism", - "Information & Communications Technology", - "Science & Engineering", - "Legal", - "Social & Cultural", - "Agriculture", - "Real Estate", - "Food Services", - "Manufacturing", - "Unemployed", +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience, v) + } + *j = SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience(v) + return nil +} + +var enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = []interface{}{ + "0-1 year", + "1-2 years", + "Over 3 years", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationEmploymentIndustry) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceForexTradingFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationEmploymentIndustry { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceForexTradingFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEmploymentIndustry, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceForexTradingFrequency, v) } - *j = SetFinancialAssessmentFinancialInformationEmploymentIndustry(v) + *j = SetFinancialAssessmentTradingExperienceForexTradingFrequency(v) return nil } -type SetFinancialAssessmentFinancialInformationEmploymentStatus string - -const SetFinancialAssessmentFinancialInformationEmploymentStatusEmployed SetFinancialAssessmentFinancialInformationEmploymentStatus = "Employed" -const SetFinancialAssessmentFinancialInformationEmploymentStatusPensioner SetFinancialAssessmentFinancialInformationEmploymentStatus = "Pensioner" -const SetFinancialAssessmentFinancialInformationEmploymentStatusSelfEmployed SetFinancialAssessmentFinancialInformationEmploymentStatus = "Self-Employed" -const SetFinancialAssessmentFinancialInformationEmploymentStatusStudent SetFinancialAssessmentFinancialInformationEmploymentStatus = "Student" -const SetFinancialAssessmentFinancialInformationEmploymentStatusUnemployed SetFinancialAssessmentFinancialInformationEmploymentStatus = "Unemployed" - -var enumValues_SetFinancialAssessmentFinancialInformationEmploymentStatus = []interface{}{ - "Employed", - "Pensioner", - "Self-Employed", - "Student", - "Unemployed", +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = []interface{}{ + "Leverage is a risk mitigation technique.", + "Leverage prevents you from opening large positions.", + "Leverage guarantees profits.", + "Leverage lets you open larger positions for a fraction of the trade's value.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationEmploymentStatus) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationEmploymentStatus { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEmploymentStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading, v) } - *j = SetFinancialAssessmentFinancialInformationEmploymentStatus(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading(v) return nil } -type SetFinancialAssessmentFinancialInformationEstimatedWorth string - -const SetFinancialAssessmentFinancialInformationEstimatedWorthA100000250000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "$100,000 - $250,000" -const SetFinancialAssessmentFinancialInformationEstimatedWorthA250001500000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "$250,001 - $500,000" -const SetFinancialAssessmentFinancialInformationEstimatedWorthA5000011000000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "$500,001 - $1,000,000" -const SetFinancialAssessmentFinancialInformationEstimatedWorthLessThan100000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "Less than $100,000" -const SetFinancialAssessmentFinancialInformationEstimatedWorthOver1000000 SetFinancialAssessmentFinancialInformationEstimatedWorth = "Over $1,000,000" - -var enumValues_SetFinancialAssessmentFinancialInformationEstimatedWorth = []interface{}{ - "Less than $100,000", - "$100,000 - $250,000", - "$250,001 - $500,000", - "$500,001 - $1,000,000", - "Over $1,000,000", +var enumValues_SetFinancialAssessmentTradingExperienceForexTradingFrequency = []interface{}{ + "0-5 transactions in the past 12 months", + "6-10 transactions in the past 12 months", + "11-39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationEstimatedWorth) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceForexTradingExperience) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationEstimatedWorth { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceForexTradingExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEstimatedWorth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceForexTradingExperience, v) } - *j = SetFinancialAssessmentFinancialInformationEstimatedWorth(v) + *j = SetFinancialAssessmentTradingExperienceForexTradingExperience(v) return nil } -type SetFinancialAssessmentFinancialInformationIncomeSource string - -const SetFinancialAssessmentFinancialInformationIncomeSourceInvestmentsDividends SetFinancialAssessmentFinancialInformationIncomeSource = "Investments & Dividends" -const SetFinancialAssessmentFinancialInformationIncomeSourcePension SetFinancialAssessmentFinancialInformationIncomeSource = "Pension" -const SetFinancialAssessmentFinancialInformationIncomeSourceSalariedEmployee SetFinancialAssessmentFinancialInformationIncomeSource = "Salaried Employee" -const SetFinancialAssessmentFinancialInformationIncomeSourceSavingsInheritance SetFinancialAssessmentFinancialInformationIncomeSource = "Savings & Inheritance" -const SetFinancialAssessmentFinancialInformationIncomeSourceSelfEmployed SetFinancialAssessmentFinancialInformationIncomeSource = "Self-Employed" -const SetFinancialAssessmentFinancialInformationIncomeSourceStateBenefits SetFinancialAssessmentFinancialInformationIncomeSource = "State Benefits" - -var enumValues_SetFinancialAssessmentFinancialInformationIncomeSource = []interface{}{ - "Salaried Employee", - "Self-Employed", - "Investments & Dividends", - "Pension", - "State Benefits", - "Savings & Inheritance", +var enumValues_SetFinancialAssessmentTradingExperienceForexTradingExperience = []interface{}{ + "0-1 year", + "1-2 years", + "Over 3 years", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationIncomeSource) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceCfdTradingFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationIncomeSource { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceCfdTradingFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationIncomeSource, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceCfdTradingFrequency, v) } - *j = SetFinancialAssessmentFinancialInformationIncomeSource(v) + *j = SetFinancialAssessmentTradingExperienceCfdTradingFrequency(v) return nil } -type SetFinancialAssessmentFinancialInformationNetIncome string - -const SetFinancialAssessmentFinancialInformationNetIncomeA100001500000 SetFinancialAssessmentFinancialInformationNetIncome = "$100,001 - $500,000" -const SetFinancialAssessmentFinancialInformationNetIncomeA2500050000 SetFinancialAssessmentFinancialInformationNetIncome = "$25,000 - $50,000" -const SetFinancialAssessmentFinancialInformationNetIncomeA50001100000 SetFinancialAssessmentFinancialInformationNetIncome = "$50,001 - $100,000" -const SetFinancialAssessmentFinancialInformationNetIncomeLessThan25000 SetFinancialAssessmentFinancialInformationNetIncome = "Less than $25,000" -const SetFinancialAssessmentFinancialInformationNetIncomeOver500000 SetFinancialAssessmentFinancialInformationNetIncome = "Over $500,000" - -var enumValues_SetFinancialAssessmentFinancialInformationNetIncome = []interface{}{ - "Less than $25,000", - "$25,000 - $50,000", - "$50,001 - $100,000", - "$100,001 - $500,000", - "Over $500,000", +var enumValues_SetFinancialAssessmentTradingExperienceCfdTradingFrequency = []interface{}{ + "0-5 transactions in the past 12 months", + "6-10 transactions in the past 12 months", + "11-39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", +} +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = []interface{}{ + "Cancel your trade at any time within a chosen timeframe.", + "Close your trade automatically when the loss is more than or equal to a specific amount.", + "Close your trade automatically when the profit is more than or equal to a specific amount.", + "Make a guaranteed profit on your trade.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationNetIncome) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationNetIncome { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationNetIncome, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss, v) } - *j = SetFinancialAssessmentFinancialInformationNetIncome(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss(v) return nil } -type SetFinancialAssessmentFinancialInformationOccupation string - -const SetFinancialAssessmentFinancialInformationOccupationAgriculturalForestryAndFisheryWorkers SetFinancialAssessmentFinancialInformationOccupation = "Agricultural, Forestry and Fishery Workers" -const SetFinancialAssessmentFinancialInformationOccupationArmedForces SetFinancialAssessmentFinancialInformationOccupation = "Armed Forces" -const SetFinancialAssessmentFinancialInformationOccupationChiefExecutivesSeniorOfficialsAndLegislators SetFinancialAssessmentFinancialInformationOccupation = "Chief Executives, Senior Officials and Legislators" -const SetFinancialAssessmentFinancialInformationOccupationCleanersAndHelpers SetFinancialAssessmentFinancialInformationOccupation = "Cleaners and Helpers" -const SetFinancialAssessmentFinancialInformationOccupationClerks SetFinancialAssessmentFinancialInformationOccupation = "Clerks" -const SetFinancialAssessmentFinancialInformationOccupationCraftMetalElectricalAndElectronicsWorkers SetFinancialAssessmentFinancialInformationOccupation = "Craft, Metal, Electrical and Electronics Workers" -const SetFinancialAssessmentFinancialInformationOccupationGovernmentOfficers SetFinancialAssessmentFinancialInformationOccupation = "Government Officers" -const SetFinancialAssessmentFinancialInformationOccupationManagers SetFinancialAssessmentFinancialInformationOccupation = "Managers" -const SetFinancialAssessmentFinancialInformationOccupationMiningConstructionManufacturingAndTransportWorkers SetFinancialAssessmentFinancialInformationOccupation = "Mining, Construction, Manufacturing and Transport Workers" -const SetFinancialAssessmentFinancialInformationOccupationPersonalCareSalesAndServiceWorkers SetFinancialAssessmentFinancialInformationOccupation = "Personal Care, Sales and Service Workers" -const SetFinancialAssessmentFinancialInformationOccupationPlantAndMachineOperatorsAndAssemblers SetFinancialAssessmentFinancialInformationOccupation = "Plant and Machine Operators and Assemblers" -const SetFinancialAssessmentFinancialInformationOccupationProfessionals SetFinancialAssessmentFinancialInformationOccupation = "Professionals" -const SetFinancialAssessmentFinancialInformationOccupationStudents SetFinancialAssessmentFinancialInformationOccupation = "Students" -const SetFinancialAssessmentFinancialInformationOccupationUnemployed SetFinancialAssessmentFinancialInformationOccupation = "Unemployed" - -var enumValues_SetFinancialAssessmentFinancialInformationOccupation = []interface{}{ - "Chief Executives, Senior Officials and Legislators", - "Managers", - "Professionals", - "Clerks", - "Personal Care, Sales and Service Workers", - "Agricultural, Forestry and Fishery Workers", - "Craft, Metal, Electrical and Electronics Workers", - "Plant and Machine Operators and Assemblers", - "Cleaners and Helpers", - "Mining, Construction, Manufacturing and Transport Workers", - "Armed Forces", - "Government Officers", - "Students", - "Unemployed", +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentTradingExperienceCfdTradingExperience) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceCfdTradingExperience { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceCfdTradingExperience, v) + } + *j = SetFinancialAssessmentTradingExperienceCfdTradingExperience(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -763,741 +1076,427 @@ func (j *SetFinancialAssessmentFinancialInformationOccupation) UnmarshalJSON(b [ return nil } -type SetFinancialAssessmentFinancialInformationSourceOfWealth string - -const SetFinancialAssessmentFinancialInformationSourceOfWealthAccumulationOfIncomeSavings SetFinancialAssessmentFinancialInformationSourceOfWealth = "Accumulation of Income/Savings" -const SetFinancialAssessmentFinancialInformationSourceOfWealthCashBusiness SetFinancialAssessmentFinancialInformationSourceOfWealth = "Cash Business" -const SetFinancialAssessmentFinancialInformationSourceOfWealthCompanyOwnership SetFinancialAssessmentFinancialInformationSourceOfWealth = "Company Ownership" -const SetFinancialAssessmentFinancialInformationSourceOfWealthDivorceSettlement SetFinancialAssessmentFinancialInformationSourceOfWealth = "Divorce Settlement" -const SetFinancialAssessmentFinancialInformationSourceOfWealthInheritance SetFinancialAssessmentFinancialInformationSourceOfWealth = "Inheritance" -const SetFinancialAssessmentFinancialInformationSourceOfWealthInvestmentIncome SetFinancialAssessmentFinancialInformationSourceOfWealth = "Investment Income" -const SetFinancialAssessmentFinancialInformationSourceOfWealthSaleOfProperty SetFinancialAssessmentFinancialInformationSourceOfWealth = "Sale of Property" - -var enumValues_SetFinancialAssessmentFinancialInformationSourceOfWealth = []interface{}{ - "Accumulation of Income/Savings", - "Cash Business", - "Company Ownership", - "Divorce Settlement", - "Inheritance", - "Investment Income", - "Sale of Property", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationSourceOfWealth) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationSourceOfWealth { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationSourceOfWealth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency, v) } - *j = SetFinancialAssessmentFinancialInformationSourceOfWealth(v) + *j = SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency(v) return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformation) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { return err } - if _, ok := raw["education_level"]; raw != nil && !ok { - return fmt.Errorf("field education_level in SetFinancialAssessmentFinancialInformation: required") - } - if _, ok := raw["employment_industry"]; raw != nil && !ok { - return fmt.Errorf("field employment_industry in SetFinancialAssessmentFinancialInformation: required") - } - if _, ok := raw["estimated_worth"]; raw != nil && !ok { - return fmt.Errorf("field estimated_worth in SetFinancialAssessmentFinancialInformation: required") - } - if _, ok := raw["income_source"]; raw != nil && !ok { - return fmt.Errorf("field income_source in SetFinancialAssessmentFinancialInformation: required") - } - if _, ok := raw["net_income"]; raw != nil && !ok { - return fmt.Errorf("field net_income in SetFinancialAssessmentFinancialInformation: required") + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain SetFinancialAssessmentFinancialInformation - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience, v) } - *j = SetFinancialAssessmentFinancialInformation(plain) + *j = SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience(v) return nil } -type SetFinancialAssessmentForexTradingExperience string - -const SetFinancialAssessmentForexTradingExperienceA01Year SetFinancialAssessmentForexTradingExperience = "0-1 year" -const SetFinancialAssessmentForexTradingExperienceA12Years SetFinancialAssessmentForexTradingExperience = "1-2 years" -const SetFinancialAssessmentForexTradingExperienceOver3Years SetFinancialAssessmentForexTradingExperience = "Over 3 years" - -var enumValues_SetFinancialAssessmentForexTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentForexTradingExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentSourceOfWealth) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentForexTradingExperience { + for _, expected := range enumValues_SetFinancialAssessmentSourceOfWealth { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentForexTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentSourceOfWealth, v) } - *j = SetFinancialAssessmentForexTradingExperience(v) + *j = SetFinancialAssessmentSourceOfWealth(v) return nil } -type SetFinancialAssessmentForexTradingFrequency string - -const SetFinancialAssessmentForexTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentForexTradingFrequency = "0-5 transactions in the past 12 months" -const SetFinancialAssessmentForexTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentForexTradingFrequency = "11-39 transactions in the past 12 months" -const SetFinancialAssessmentForexTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentForexTradingFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentForexTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentForexTradingFrequency = "6-10 transactions in the past 12 months" - -var enumValues_SetFinancialAssessmentForexTradingFrequency = []interface{}{ - "0-5 transactions in the past 12 months", - "6-10 transactions in the past 12 months", - "11-39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = []interface{}{ + "When opening a Leveraged CFD trade.", + "When trading Multipliers.", + "When buying shares of a company.", + "All of the above.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentForexTradingFrequency) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentForexTradingFrequency { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentForexTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin, v) } - *j = SetFinancialAssessmentForexTradingFrequency(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin(v) return nil } -type SetFinancialAssessmentIncomeSource string - -const SetFinancialAssessmentIncomeSourceInvestmentsDividends SetFinancialAssessmentIncomeSource = "Investments & Dividends" -const SetFinancialAssessmentIncomeSourcePension SetFinancialAssessmentIncomeSource = "Pension" -const SetFinancialAssessmentIncomeSourceSalariedEmployee SetFinancialAssessmentIncomeSource = "Salaried Employee" -const SetFinancialAssessmentIncomeSourceSavingsInheritance SetFinancialAssessmentIncomeSource = "Savings & Inheritance" -const SetFinancialAssessmentIncomeSourceSelfEmployed SetFinancialAssessmentIncomeSource = "Self-Employed" -const SetFinancialAssessmentIncomeSourceStateBenefits SetFinancialAssessmentIncomeSource = "State Benefits" - -var enumValues_SetFinancialAssessmentIncomeSource = []interface{}{ - "Salaried Employee", - "Self-Employed", - "Investments & Dividends", - "Pension", - "State Benefits", - "Savings & Inheritance", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentIncomeSource) UnmarshalJSON(b []byte) error { - var v string +func (j *SetFinancialAssessmentSetFinancialAssessment) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentIncomeSource { + for _, expected := range enumValues_SetFinancialAssessmentSetFinancialAssessment { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentIncomeSource, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentSetFinancialAssessment, v) } - *j = SetFinancialAssessmentIncomeSource(v) + *j = SetFinancialAssessmentSetFinancialAssessment(v) return nil } -type SetFinancialAssessmentNetIncome string - -const SetFinancialAssessmentNetIncomeA100001500000 SetFinancialAssessmentNetIncome = "$100,001 - $500,000" -const SetFinancialAssessmentNetIncomeA2500050000 SetFinancialAssessmentNetIncome = "$25,000 - $50,000" -const SetFinancialAssessmentNetIncomeA50001100000 SetFinancialAssessmentNetIncome = "$50,001 - $100,000" -const SetFinancialAssessmentNetIncomeLessThan25000 SetFinancialAssessmentNetIncome = "Less than $25,000" -const SetFinancialAssessmentNetIncomeOver500000 SetFinancialAssessmentNetIncome = "Over $500,000" - -var enumValues_SetFinancialAssessmentNetIncome = []interface{}{ - "Less than $25,000", - "$25,000 - $50,000", - "$50,001 - $100,000", - "$100,001 - $500,000", - "Over $500,000", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentNetIncome) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentOtherInstrumentsTradingFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentNetIncome { + for _, expected := range enumValues_SetFinancialAssessmentOtherInstrumentsTradingFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentNetIncome, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentOtherInstrumentsTradingFrequency, v) } - *j = SetFinancialAssessmentNetIncome(v) + *j = SetFinancialAssessmentOtherInstrumentsTradingFrequency(v) return nil } -type SetFinancialAssessmentOccupation string - -const SetFinancialAssessmentOccupationAgriculturalForestryAndFisheryWorkers SetFinancialAssessmentOccupation = "Agricultural, Forestry and Fishery Workers" -const SetFinancialAssessmentOccupationArmedForces SetFinancialAssessmentOccupation = "Armed Forces" -const SetFinancialAssessmentOccupationChiefExecutivesSeniorOfficialsAndLegislators SetFinancialAssessmentOccupation = "Chief Executives, Senior Officials and Legislators" -const SetFinancialAssessmentOccupationCleanersAndHelpers SetFinancialAssessmentOccupation = "Cleaners and Helpers" -const SetFinancialAssessmentOccupationClerks SetFinancialAssessmentOccupation = "Clerks" -const SetFinancialAssessmentOccupationCraftMetalElectricalAndElectronicsWorkers SetFinancialAssessmentOccupation = "Craft, Metal, Electrical and Electronics Workers" -const SetFinancialAssessmentOccupationGovernmentOfficers SetFinancialAssessmentOccupation = "Government Officers" -const SetFinancialAssessmentOccupationManagers SetFinancialAssessmentOccupation = "Managers" -const SetFinancialAssessmentOccupationMiningConstructionManufacturingAndTransportWorkers SetFinancialAssessmentOccupation = "Mining, Construction, Manufacturing and Transport Workers" -const SetFinancialAssessmentOccupationPersonalCareSalesAndServiceWorkers SetFinancialAssessmentOccupation = "Personal Care, Sales and Service Workers" -const SetFinancialAssessmentOccupationPlantAndMachineOperatorsAndAssemblers SetFinancialAssessmentOccupation = "Plant and Machine Operators and Assemblers" -const SetFinancialAssessmentOccupationProfessionals SetFinancialAssessmentOccupation = "Professionals" -const SetFinancialAssessmentOccupationStudents SetFinancialAssessmentOccupation = "Students" -const SetFinancialAssessmentOccupationUnemployed SetFinancialAssessmentOccupation = "Unemployed" - -var enumValues_SetFinancialAssessmentOccupation = []interface{}{ - "Chief Executives, Senior Officials and Legislators", - "Managers", - "Professionals", - "Clerks", - "Personal Care, Sales and Service Workers", - "Agricultural, Forestry and Fishery Workers", - "Craft, Metal, Electrical and Electronics Workers", - "Plant and Machine Operators and Assemblers", - "Cleaners and Helpers", - "Mining, Construction, Manufacturing and Transport Workers", - "Armed Forces", - "Government Officers", - "Students", - "Unemployed", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentOccupation) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentOtherInstrumentsTradingExperience) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentOccupation { + for _, expected := range enumValues_SetFinancialAssessmentOtherInstrumentsTradingExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentOccupation, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentOtherInstrumentsTradingExperience, v) } - *j = SetFinancialAssessmentOccupation(v) + *j = SetFinancialAssessmentOtherInstrumentsTradingExperience(v) return nil } -type SetFinancialAssessmentOtherInstrumentsTradingExperience string - -const SetFinancialAssessmentOtherInstrumentsTradingExperienceA01Year SetFinancialAssessmentOtherInstrumentsTradingExperience = "0-1 year" -const SetFinancialAssessmentOtherInstrumentsTradingExperienceA12Years SetFinancialAssessmentOtherInstrumentsTradingExperience = "1-2 years" -const SetFinancialAssessmentOtherInstrumentsTradingExperienceOver3Years SetFinancialAssessmentOtherInstrumentsTradingExperience = "Over 3 years" - -var enumValues_SetFinancialAssessmentOtherInstrumentsTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentOtherInstrumentsTradingExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentOccupation) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentOtherInstrumentsTradingExperience { + for _, expected := range enumValues_SetFinancialAssessmentOccupation { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentOtherInstrumentsTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentOccupation, v) } - *j = SetFinancialAssessmentOtherInstrumentsTradingExperience(v) + *j = SetFinancialAssessmentOccupation(v) return nil } -type SetFinancialAssessmentOtherInstrumentsTradingFrequency string - -const SetFinancialAssessmentOtherInstrumentsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentOtherInstrumentsTradingFrequency = "0-5 transactions in the past 12 months" -const SetFinancialAssessmentOtherInstrumentsTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentOtherInstrumentsTradingFrequency = "11-39 transactions in the past 12 months" -const SetFinancialAssessmentOtherInstrumentsTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentOtherInstrumentsTradingFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentOtherInstrumentsTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentOtherInstrumentsTradingFrequency = "6-10 transactions in the past 12 months" - -var enumValues_SetFinancialAssessmentOtherInstrumentsTradingFrequency = []interface{}{ - "0-5 transactions in the past 12 months", - "6-10 transactions in the past 12 months", - "11-39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentOtherInstrumentsTradingFrequency) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentNetIncome) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentOtherInstrumentsTradingFrequency { + for _, expected := range enumValues_SetFinancialAssessmentNetIncome { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentOtherInstrumentsTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentNetIncome, v) } - *j = SetFinancialAssessmentOtherInstrumentsTradingFrequency(v) + *j = SetFinancialAssessmentNetIncome(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type SetFinancialAssessmentPassthrough map[string]interface{} - -type SetFinancialAssessmentSetFinancialAssessment int - -var enumValues_SetFinancialAssessmentSetFinancialAssessment = []interface{}{ - 1, +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance = []interface{}{ + "Yes", + "No", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentSetFinancialAssessment) UnmarshalJSON(b []byte) error { - var v int +func (j *SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentSetFinancialAssessment { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentSetFinancialAssessment, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance, v) } - *j = SetFinancialAssessmentSetFinancialAssessment(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance(v) return nil } -type SetFinancialAssessmentSourceOfWealth string - -const SetFinancialAssessmentSourceOfWealthAccumulationOfIncomeSavings SetFinancialAssessmentSourceOfWealth = "Accumulation of Income/Savings" -const SetFinancialAssessmentSourceOfWealthCashBusiness SetFinancialAssessmentSourceOfWealth = "Cash Business" -const SetFinancialAssessmentSourceOfWealthCompanyOwnership SetFinancialAssessmentSourceOfWealth = "Company Ownership" -const SetFinancialAssessmentSourceOfWealthDivorceSettlement SetFinancialAssessmentSourceOfWealth = "Divorce Settlement" -const SetFinancialAssessmentSourceOfWealthInheritance SetFinancialAssessmentSourceOfWealth = "Inheritance" -const SetFinancialAssessmentSourceOfWealthInvestmentIncome SetFinancialAssessmentSourceOfWealth = "Investment Income" -const SetFinancialAssessmentSourceOfWealthSaleOfProperty SetFinancialAssessmentSourceOfWealth = "Sale of Property" - -var enumValues_SetFinancialAssessmentSourceOfWealth = []interface{}{ - "Accumulation of Income/Savings", - "Cash Business", - "Company Ownership", - "Divorce Settlement", - "Inheritance", - "Investment Income", - "Sale of Property", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentSourceOfWealth) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentAccountTurnover) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentSourceOfWealth { + for _, expected := range enumValues_SetFinancialAssessmentAccountTurnover { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentSourceOfWealth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentAccountTurnover, v) } - *j = SetFinancialAssessmentSourceOfWealth(v) + *j = SetFinancialAssessmentAccountTurnover(v) return nil } -// [Optional] The trading experience of a client -type SetFinancialAssessmentTradingExperience struct { - // [Optional] Binary options trading experience. - BinaryOptionsTradingExperience *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience `json:"binary_options_trading_experience,omitempty"` - - // [Optional] Binary options trading frequency. - BinaryOptionsTradingFrequency *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency `json:"binary_options_trading_frequency,omitempty"` - - // [Optional] CFDs trading experience. - CfdTradingExperience *SetFinancialAssessmentTradingExperienceCfdTradingExperience `json:"cfd_trading_experience,omitempty"` - - // [Optional] CFDs trading frequency. - CfdTradingFrequency *SetFinancialAssessmentTradingExperienceCfdTradingFrequency `json:"cfd_trading_frequency,omitempty"` - - // [Optional] Forex trading experience. - ForexTradingExperience *SetFinancialAssessmentTradingExperienceForexTradingExperience `json:"forex_trading_experience,omitempty"` - - // [Optional] Forex trading frequency. - ForexTradingFrequency *SetFinancialAssessmentTradingExperienceForexTradingFrequency `json:"forex_trading_frequency,omitempty"` - - // [Optional] Trading experience in other financial instruments. - OtherInstrumentsTradingExperience *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience `json:"other_instruments_trading_experience,omitempty"` - - // [Optional] Trading frequency in other financial instruments. - OtherInstrumentsTradingFrequency *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency `json:"other_instruments_trading_frequency,omitempty"` -} - -type SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience string - -const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperienceA01Year SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = "0-1 year" -const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperienceA12Years SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = "1-2 years" -const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperienceOver3Years SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = "Over 3 years" - -var enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentIncomeSource) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentIncomeSource { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentIncomeSource, v) + } + *j = SetFinancialAssessmentIncomeSource(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentBinaryOptionsTradingExperience) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience { + for _, expected := range enumValues_SetFinancialAssessmentBinaryOptionsTradingExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentBinaryOptionsTradingExperience, v) } - *j = SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience(v) + *j = SetFinancialAssessmentBinaryOptionsTradingExperience(v) return nil } -type SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency string - -const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = "0-5 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = "11-39 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = "6-10 transactions in the past 12 months" - -var enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = []interface{}{ - "0-5 transactions in the past 12 months", - "6-10 transactions in the past 12 months", - "11-39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = []interface{}{ + "I have an academic degree, professional certification, and/or work experience.", + "I trade forex CFDs and other complex financial instruments.", + "I have attended seminars, training, and/or workshops.", + "I have little experience.", + "I have no knowledge.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience, v) } - *j = SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience(v) return nil } -type SetFinancialAssessmentTradingExperienceCfdTradingExperience string - -const SetFinancialAssessmentTradingExperienceCfdTradingExperienceA01Year SetFinancialAssessmentTradingExperienceCfdTradingExperience = "0-1 year" -const SetFinancialAssessmentTradingExperienceCfdTradingExperienceA12Years SetFinancialAssessmentTradingExperienceCfdTradingExperience = "1-2 years" -const SetFinancialAssessmentTradingExperienceCfdTradingExperienceOver3Years SetFinancialAssessmentTradingExperienceCfdTradingExperience = "Over 3 years" - -var enumValues_SetFinancialAssessmentTradingExperienceCfdTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceCfdTradingExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentBinaryOptionsTradingFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceCfdTradingExperience { + for _, expected := range enumValues_SetFinancialAssessmentBinaryOptionsTradingFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceCfdTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentBinaryOptionsTradingFrequency, v) } - *j = SetFinancialAssessmentTradingExperienceCfdTradingExperience(v) + *j = SetFinancialAssessmentBinaryOptionsTradingFrequency(v) return nil } -type SetFinancialAssessmentTradingExperienceCfdTradingFrequency string - -const SetFinancialAssessmentTradingExperienceCfdTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceCfdTradingFrequency = "0-5 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceCfdTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceCfdTradingFrequency = "11-39 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceCfdTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceCfdTradingFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentTradingExperienceCfdTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceCfdTradingFrequency = "6-10 transactions in the past 12 months" - -var enumValues_SetFinancialAssessmentTradingExperienceCfdTradingFrequency = []interface{}{ - "0-5 transactions in the past 12 months", - "6-10 transactions in the past 12 months", - "11-39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceCfdTradingFrequency) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentCfdTradingExperience) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceCfdTradingFrequency { + for _, expected := range enumValues_SetFinancialAssessmentCfdTradingExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceCfdTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentCfdTradingExperience, v) } - *j = SetFinancialAssessmentTradingExperienceCfdTradingFrequency(v) + *j = SetFinancialAssessmentCfdTradingExperience(v) return nil } -type SetFinancialAssessmentTradingExperienceForexTradingExperience string - -const SetFinancialAssessmentTradingExperienceForexTradingExperienceA01Year SetFinancialAssessmentTradingExperienceForexTradingExperience = "0-1 year" -const SetFinancialAssessmentTradingExperienceForexTradingExperienceA12Years SetFinancialAssessmentTradingExperienceForexTradingExperience = "1-2 years" -const SetFinancialAssessmentTradingExperienceForexTradingExperienceOver3Years SetFinancialAssessmentTradingExperienceForexTradingExperience = "Over 3 years" - -var enumValues_SetFinancialAssessmentTradingExperienceForexTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceForexTradingExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentForexTradingFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceForexTradingExperience { + for _, expected := range enumValues_SetFinancialAssessmentForexTradingFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceForexTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentForexTradingFrequency, v) } - *j = SetFinancialAssessmentTradingExperienceForexTradingExperience(v) + *j = SetFinancialAssessmentForexTradingFrequency(v) return nil } -type SetFinancialAssessmentTradingExperienceForexTradingFrequency string - -const SetFinancialAssessmentTradingExperienceForexTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceForexTradingFrequency = "0-5 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceForexTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceForexTradingFrequency = "11-39 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceForexTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceForexTradingFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentTradingExperienceForexTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceForexTradingFrequency = "6-10 transactions in the past 12 months" - -var enumValues_SetFinancialAssessmentTradingExperienceForexTradingFrequency = []interface{}{ - "0-5 transactions in the past 12 months", - "6-10 transactions in the past 12 months", - "11-39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceForexTradingFrequency) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentCfdTradingFrequency) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceForexTradingFrequency { + for _, expected := range enumValues_SetFinancialAssessmentCfdTradingFrequency { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceForexTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentCfdTradingFrequency, v) } - *j = SetFinancialAssessmentTradingExperienceForexTradingFrequency(v) + *j = SetFinancialAssessmentCfdTradingFrequency(v) return nil } -type SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience string - -const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperienceA01Year SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = "0-1 year" -const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperienceA12Years SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = "1-2 years" -const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperienceOver3Years SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = "Over 3 years" - -var enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentEducationLevel) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience { + for _, expected := range enumValues_SetFinancialAssessmentEducationLevel { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEducationLevel, v) } - *j = SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience(v) + *j = SetFinancialAssessmentEducationLevel(v) return nil } -type SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency string - -const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = "0-5 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = "11-39 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = "6-10 transactions in the past 12 months" - -var enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency = []interface{}{ - "0-5 transactions in the past 12 months", - "6-10 transactions in the past 12 months", - "11-39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentForexTradingExperience) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency { + for _, expected := range enumValues_SetFinancialAssessmentForexTradingExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentForexTradingExperience, v) } - *j = SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency(v) + *j = SetFinancialAssessmentForexTradingExperience(v) return nil } -// [Optional] The trading experience of a `maltainvest` client -type SetFinancialAssessmentTradingExperienceRegulated struct { - // How much experience do you have in CFD trading? - CfdExperience SetFinancialAssessmentTradingExperienceRegulatedCfdExperience `json:"cfd_experience"` - - // How many CFD trades have you placed in the past 12 months? - CfdFrequency SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency `json:"cfd_frequency"` - - // In your understanding, CFD trading allows you to: - CfdTradingDefinition SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition `json:"cfd_trading_definition"` - - // How does leverage affect CFD trading? - LeverageImpactTrading SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading `json:"leverage_impact_trading"` - - // Leverage trading is high-risk, so it's a good idea to use risk management - // features such as stop loss. Stop loss allows you to - LeverageTradingHighRiskStopLoss SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss `json:"leverage_trading_high_risk_stop_loss"` - - // When would you be required to pay an initial margin? - RequiredInitialMargin SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin `json:"required_initial_margin"` - - // Do you understand that you could potentially lose 100% of the money you use to - // trade? - RiskTolerance SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance `json:"risk_tolerance"` - - // How much knowledge and experience do you have in relation to online trading? - SourceOfExperience SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience `json:"source_of_experience"` - - // How much experience do you have with other financial instruments? - TradingExperienceFinancialInstruments SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments `json:"trading_experience_financial_instruments"` - - // How many trades have you placed with other financial instruments in the past 12 - // months? - TradingFrequencyFinancialInstruments SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments `json:"trading_frequency_financial_instruments"` -} - -type SetFinancialAssessmentTradingExperienceRegulatedCfdExperience string - -const SetFinancialAssessmentTradingExperienceRegulatedCfdExperienceA12Years SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = "1 - 2 years" -const SetFinancialAssessmentTradingExperienceRegulatedCfdExperienceLessThanAYear SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = "Less than a year" -const SetFinancialAssessmentTradingExperienceRegulatedCfdExperienceNoExperience SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = "No experience" -const SetFinancialAssessmentTradingExperienceRegulatedCfdExperienceOver3Years SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = "Over 3 years" - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = []interface{}{ +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = []interface{}{ "No experience", "Less than a year", "1 - 2 years", @@ -1505,330 +1504,280 @@ var enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience = [ } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedCfdExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments, v) + } + *j = SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments(v) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentFinancialInformation) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["education_level"]; !ok || v == nil { + return fmt.Errorf("field education_level in SetFinancialAssessmentFinancialInformation: required") + } + if v, ok := raw["employment_industry"]; !ok || v == nil { + return fmt.Errorf("field employment_industry in SetFinancialAssessmentFinancialInformation: required") + } + if v, ok := raw["estimated_worth"]; !ok || v == nil { + return fmt.Errorf("field estimated_worth in SetFinancialAssessmentFinancialInformation: required") + } + if v, ok := raw["income_source"]; !ok || v == nil { + return fmt.Errorf("field income_source in SetFinancialAssessmentFinancialInformation: required") + } + if v, ok := raw["net_income"]; !ok || v == nil { + return fmt.Errorf("field net_income in SetFinancialAssessmentFinancialInformation: required") + } + type Plain SetFinancialAssessmentFinancialInformation + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = SetFinancialAssessmentFinancialInformation(plain) + return nil +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentEmploymentIndustry) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience { + for _, expected := range enumValues_SetFinancialAssessmentEmploymentIndustry { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEmploymentIndustry, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedCfdExperience(v) + *j = SetFinancialAssessmentEmploymentIndustry(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency string - -const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "11 - 39 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyA15TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "1 - 5 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "6 - 10 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceRegulatedCfdFrequencyNoTransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = "No transactions in the past 12 months" - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency = []interface{}{ - "No transactions in the past 12 months", - "1 - 5 transactions in the past 12 months", - "6 - 10 transactions in the past 12 months", - "11 - 39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentEmploymentStatus) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency { + for _, expected := range enumValues_SetFinancialAssessmentEmploymentStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEmploymentStatus, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency(v) + *j = SetFinancialAssessmentEmploymentStatus(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition string - -const SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinitionMakeALongTermInvestment SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = "Make a long-term investment." -const SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinitionPlaceABetOnThePriceMovement SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = "Place a bet on the price movement." -const SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinitionPurchaseSharesOfACompanyOrPhysicalCommodities SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = "Purchase shares of a company or physical commodities." -const SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinitionSpeculateOnThePriceMovement SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = "Speculate on the price movement." - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition = []interface{}{ - "Purchase shares of a company or physical commodities.", - "Place a bet on the price movement.", - "Speculate on the price movement.", - "Make a long-term investment.", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentEstimatedWorth) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition { + for _, expected := range enumValues_SetFinancialAssessmentEstimatedWorth { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEstimatedWorth, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition(v) + *j = SetFinancialAssessmentEstimatedWorth(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading string - -const SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTradingLeverageGuaranteesProfits SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = "Leverage guarantees profits." -const SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTradingLeverageIsARiskMitigationTechnique SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = "Leverage is a risk mitigation technique." -const SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTradingLeverageLetsYouOpenLargerPositionsForAFractionOfTheTradeSValue SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = "Leverage lets you open larger positions for a fraction of the trade's value." -const SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTradingLeveragePreventsYouFromOpeningLargePositions SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = "Leverage prevents you from opening large positions." - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading = []interface{}{ - "Leverage is a risk mitigation technique.", - "Leverage prevents you from opening large positions.", - "Leverage guarantees profits.", - "Leverage lets you open larger positions for a fraction of the trade's value.", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentFinancialInformationAccountTurnover) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading { + for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationAccountTurnover { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationAccountTurnover, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading(v) + *j = SetFinancialAssessmentFinancialInformationAccountTurnover(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss string - -const SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLossCancelYourTradeAtAnyTimeWithinAChosenTimeframe SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = "Cancel your trade at any time within a chosen timeframe." -const SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLossCloseYourTradeAutomaticallyWhenTheLossIsMoreThanOrEqualToASpecificAmount SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = "Close your trade automatically when the loss is more than or equal to a specific amount." -const SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLossCloseYourTradeAutomaticallyWhenTheProfitIsMoreThanOrEqualToASpecificAmount SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = "Close your trade automatically when the profit is more than or equal to a specific amount." -const SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLossMakeAGuaranteedProfitOnYourTrade SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = "Make a guaranteed profit on your trade." - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss = []interface{}{ - "Cancel your trade at any time within a chosen timeframe.", - "Close your trade automatically when the loss is more than or equal to a specific amount.", - "Close your trade automatically when the profit is more than or equal to a specific amount.", - "Make a guaranteed profit on your trade.", +var enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = []interface{}{ + "No transactions in the past 12 months", + "1 - 5 transactions in the past 12 months", + "6 - 10 transactions in the past 12 months", + "11 - 39 transactions in the past 12 months", + "40 transactions or more in the past 12 months", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin string - -const SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMarginAllOfTheAbove SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = "All of the above." -const SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMarginWhenBuyingSharesOfACompany SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = "When buying shares of a company." -const SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMarginWhenOpeningALeveragedCFDTrade SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = "When opening a Leveraged CFD trade." -const SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMarginWhenTradingMultipliers SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = "When trading Multipliers." - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = []interface{}{ - "When opening a Leveraged CFD trade.", - "When trading Multipliers.", - "When buying shares of a company.", - "All of the above.", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentFinancialInformationSourceOfWealth) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin { + for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationSourceOfWealth { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationSourceOfWealth, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin(v) + *j = SetFinancialAssessmentFinancialInformationSourceOfWealth(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance string - -const SetFinancialAssessmentTradingExperienceRegulatedRiskToleranceNo SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance = "No" -const SetFinancialAssessmentTradingExperienceRegulatedRiskToleranceYes SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance = "Yes" - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance = []interface{}{ - "Yes", - "No", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentFinancialInformationEducationLevel) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance { + for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationEducationLevel { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEducationLevel, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance(v) + *j = SetFinancialAssessmentFinancialInformationEducationLevel(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience string - -const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceIHaveAnAcademicDegreeProfessionalCertificationAndOrWorkExperience SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I have an academic degree, professional certification, and/or work experience." -const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceIHaveAttendedSeminarsTrainingAndOrWorkshops SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I have attended seminars, training, and/or workshops." -const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceIHaveLittleExperience SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I have little experience." -const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceIHaveNoKnowledge SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I have no knowledge." -const SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperienceITradeForexCFDsAndOtherComplexFinancialInstruments SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = "I trade forex CFDs and other complex financial instruments." - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience = []interface{}{ - "I have an academic degree, professional certification, and/or work experience.", - "I trade forex CFDs and other complex financial instruments.", - "I have attended seminars, training, and/or workshops.", - "I have little experience.", - "I have no knowledge.", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentFinancialInformationEmploymentIndustry) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience { + for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationEmploymentIndustry { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEmploymentIndustry, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience(v) + *j = SetFinancialAssessmentFinancialInformationEmploymentIndustry(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments string - -const SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstrumentsA12Years SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = "1 - 2 years" -const SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstrumentsLessThanAYear SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = "Less than a year" -const SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstrumentsNoExperience SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = "No experience" -const SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstrumentsOver3Years SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = "Over 3 years" - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = []interface{}{ - "No experience", - "Less than a year", - "1 - 2 years", - "Over 3 years", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentFinancialInformationEmploymentStatus) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments { + for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationEmploymentStatus { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEmploymentStatus, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments(v) + *j = SetFinancialAssessmentFinancialInformationEmploymentStatus(v) return nil } -type SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments string - -const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsA1139TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "11 - 39 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsA15TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "1 - 5 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsA610TransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "6 - 10 transactions in the past 12 months" -const SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstrumentsNoTransactionsInThePast12Months SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = "No transactions in the past 12 months" - -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments = []interface{}{ - "No transactions in the past 12 months", - "1 - 5 transactions in the past 12 months", - "6 - 10 transactions in the past 12 months", - "11 - 39 transactions in the past 12 months", - "40 transactions or more in the past 12 months", +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentFinancialInformationEstimatedWorth) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationEstimatedWorth { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEstimatedWorth, v) + } + *j = SetFinancialAssessmentFinancialInformationEstimatedWorth(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentFinancialInformationIncomeSource) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments { + for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationIncomeSource { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationIncomeSource, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments(v) + *j = SetFinancialAssessmentFinancialInformationIncomeSource(v) return nil } @@ -1838,34 +1787,34 @@ func (j *SetFinancialAssessmentTradingExperienceRegulated) UnmarshalJSON(b []byt if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["cfd_experience"]; raw != nil && !ok { + if v, ok := raw["cfd_experience"]; !ok || v == nil { return fmt.Errorf("field cfd_experience in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["cfd_frequency"]; raw != nil && !ok { + if v, ok := raw["cfd_frequency"]; !ok || v == nil { return fmt.Errorf("field cfd_frequency in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["cfd_trading_definition"]; raw != nil && !ok { + if v, ok := raw["cfd_trading_definition"]; !ok || v == nil { return fmt.Errorf("field cfd_trading_definition in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["leverage_impact_trading"]; raw != nil && !ok { + if v, ok := raw["leverage_impact_trading"]; !ok || v == nil { return fmt.Errorf("field leverage_impact_trading in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["leverage_trading_high_risk_stop_loss"]; raw != nil && !ok { + if v, ok := raw["leverage_trading_high_risk_stop_loss"]; !ok || v == nil { return fmt.Errorf("field leverage_trading_high_risk_stop_loss in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["required_initial_margin"]; raw != nil && !ok { + if v, ok := raw["required_initial_margin"]; !ok || v == nil { return fmt.Errorf("field required_initial_margin in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["risk_tolerance"]; raw != nil && !ok { + if v, ok := raw["risk_tolerance"]; !ok || v == nil { return fmt.Errorf("field risk_tolerance in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["source_of_experience"]; raw != nil && !ok { + if v, ok := raw["source_of_experience"]; !ok || v == nil { return fmt.Errorf("field source_of_experience in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["trading_experience_financial_instruments"]; raw != nil && !ok { + if v, ok := raw["trading_experience_financial_instruments"]; !ok || v == nil { return fmt.Errorf("field trading_experience_financial_instruments in SetFinancialAssessmentTradingExperienceRegulated: required") } - if _, ok := raw["trading_frequency_financial_instruments"]; raw != nil && !ok { + if v, ok := raw["trading_frequency_financial_instruments"]; !ok || v == nil { return fmt.Errorf("field trading_frequency_financial_instruments in SetFinancialAssessmentTradingExperienceRegulated: required") } type Plain SetFinancialAssessmentTradingExperienceRegulated @@ -1877,13 +1826,33 @@ func (j *SetFinancialAssessmentTradingExperienceRegulated) UnmarshalJSON(b []byt return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetFinancialAssessmentFinancialInformationNetIncome) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetFinancialAssessmentFinancialInformationNetIncome { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationNetIncome, v) + } + *j = SetFinancialAssessmentFinancialInformationNetIncome(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *SetFinancialAssessment) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["set_financial_assessment"]; raw != nil && !ok { + if v, ok := raw["set_financial_assessment"]; !ok || v == nil { return fmt.Errorf("field set_financial_assessment in SetFinancialAssessment: required") } type Plain SetFinancialAssessment diff --git a/schema/set_financial_assessment_resp.go b/schema/set_financial_assessment_resp.go index 3f5074d..ada1526 100644 --- a/schema/set_financial_assessment_resp.go +++ b/schema/set_financial_assessment_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Set Financial Assessment Receive -type SetFinancialAssessmentResp struct { - // Echo of the request made. - EchoReq SetFinancialAssessmentRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType SetFinancialAssessmentRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // The financial assessment score assigned to the submitted financial assessment - SetFinancialAssessment *SetFinancialAssessmentRespSetFinancialAssessment `json:"set_financial_assessment,omitempty"` -} - // Echo of the request made. type SetFinancialAssessmentRespEchoReq map[string]interface{} type SetFinancialAssessmentRespMsgType string -const SetFinancialAssessmentRespMsgTypeSetFinancialAssessment SetFinancialAssessmentRespMsgType = "set_financial_assessment" - var enumValues_SetFinancialAssessmentRespMsgType = []interface{}{ "set_financial_assessment", } @@ -53,6 +35,24 @@ func (j *SetFinancialAssessmentRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Set Financial Assessment Receive +type SetFinancialAssessmentResp struct { + // Echo of the request made. + EchoReq SetFinancialAssessmentRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType SetFinancialAssessmentRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // The financial assessment score assigned to the submitted financial assessment + SetFinancialAssessment *SetFinancialAssessmentRespSetFinancialAssessment `json:"set_financial_assessment,omitempty"` +} + +const SetFinancialAssessmentRespMsgTypeSetFinancialAssessment SetFinancialAssessmentRespMsgType = "set_financial_assessment" + // The financial assessment score assigned to the submitted financial assessment type SetFinancialAssessmentRespSetFinancialAssessment struct { // CFD score based on answers @@ -74,10 +74,10 @@ func (j *SetFinancialAssessmentResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in SetFinancialAssessmentResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in SetFinancialAssessmentResp: required") } type Plain SetFinancialAssessmentResp diff --git a/schema/set_self_exclusion.go b/schema/set_self_exclusion.go index 1ac7361..8e3545c 100644 --- a/schema/set_self_exclusion.go +++ b/schema/set_self_exclusion.go @@ -6,6 +6,36 @@ import "encoding/json" import "fmt" import "reflect" +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type SetSelfExclusionPassthrough map[string]interface{} + +type SetSelfExclusionSetSelfExclusion int + +var enumValues_SetSelfExclusionSetSelfExclusion = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetSelfExclusionSetSelfExclusion) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetSelfExclusionSetSelfExclusion { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetSelfExclusionSetSelfExclusion, v) + } + *j = SetSelfExclusionSetSelfExclusion(v) + return nil +} + // Set Self-Exclusion (this call should be used in conjunction with // `get_self_exclusion`) type SetSelfExclusion struct { @@ -70,43 +100,13 @@ type SetSelfExclusion struct { TimeoutUntil *int `json:"timeout_until,omitempty"` } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type SetSelfExclusionPassthrough map[string]interface{} - -type SetSelfExclusionSetSelfExclusion int - -var enumValues_SetSelfExclusionSetSelfExclusion = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetSelfExclusionSetSelfExclusion) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetSelfExclusionSetSelfExclusion { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetSelfExclusionSetSelfExclusion, v) - } - *j = SetSelfExclusionSetSelfExclusion(v) - return nil -} - // UnmarshalJSON implements json.Unmarshaler. func (j *SetSelfExclusion) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["set_self_exclusion"]; raw != nil && !ok { + if v, ok := raw["set_self_exclusion"]; !ok || v == nil { return fmt.Errorf("field set_self_exclusion in SetSelfExclusion: required") } type Plain SetSelfExclusion diff --git a/schema/set_self_exclusion_resp.go b/schema/set_self_exclusion_resp.go index efb0659..9ae9027 100644 --- a/schema/set_self_exclusion_resp.go +++ b/schema/set_self_exclusion_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with User Self-Exclusion -type SetSelfExclusionResp struct { - // Echo of the request made. - EchoReq SetSelfExclusionRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType SetSelfExclusionRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // `1` on success - SetSelfExclusion *int `json:"set_self_exclusion,omitempty"` -} - // Echo of the request made. type SetSelfExclusionRespEchoReq map[string]interface{} type SetSelfExclusionRespMsgType string -const SetSelfExclusionRespMsgTypeSetSelfExclusion SetSelfExclusionRespMsgType = "set_self_exclusion" - var enumValues_SetSelfExclusionRespMsgType = []interface{}{ "set_self_exclusion", } @@ -53,16 +35,34 @@ func (j *SetSelfExclusionRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with User Self-Exclusion +type SetSelfExclusionResp struct { + // Echo of the request made. + EchoReq SetSelfExclusionRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType SetSelfExclusionRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // `1` on success + SetSelfExclusion *int `json:"set_self_exclusion,omitempty"` +} + +const SetSelfExclusionRespMsgTypeSetSelfExclusion SetSelfExclusionRespMsgType = "set_self_exclusion" + // UnmarshalJSON implements json.Unmarshaler. func (j *SetSelfExclusionResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in SetSelfExclusionResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in SetSelfExclusionResp: required") } type Plain SetSelfExclusionResp diff --git a/schema/set_settings.go b/schema/set_settings.go index 2c92eb0..32ace86 100644 --- a/schema/set_settings.go +++ b/schema/set_settings.go @@ -6,144 +6,44 @@ import "encoding/json" import "fmt" import "reflect" -// Set User Settings (this call should be used in conjunction with `get_settings`) -type SetSettings struct { - // [Optional] Purpose and reason for requesting the account opening. Only - // applicable for real money account. Required for clients that have not set it - // yet. Can only be set once. - AccountOpeningReason *SetSettingsAccountOpeningReason `json:"account_opening_reason,omitempty"` - - // [Optional] Note: not applicable for virtual account. Required field for real - // money account. - AddressCity *string `json:"address_city,omitempty"` - - // [Optional] Note: not applicable for virtual account. Required field for real - // money account. - AddressLine1 *string `json:"address_line_1,omitempty"` - - // [Optional] Note: not applicable for virtual account. Optional field for real - // money account. - AddressLine2 *string `json:"address_line_2,omitempty"` - - // [Optional] Note: not applicable for virtual account. Optional field for real - // money account. - AddressPostcode *string `json:"address_postcode,omitempty"` - - // [Optional] Note: not applicable for virtual account. Optional field for real - // money account. - AddressState *string `json:"address_state,omitempty"` - - // [Optional] Boolean value 1 or 0, indicating permission to allow others to - // follow your trades. Note: not applicable for Virtual account. Only allow for - // real money account. - AllowCopiers *SetSettingsAllowCopiers `json:"allow_copiers,omitempty"` - - // [Optional] Country of legal citizenship, 2-letter country code. - Citizen *string `json:"citizen,omitempty"` - - // [Optional] Date of birth format: yyyy-mm-dd (can only be changed on - // unauthenticated svg accounts). - DateOfBirth *string `json:"date_of_birth,omitempty"` - - // Boolean value 1 or 0, indicating if user email belong to dxtrade exception - // list. - DxtradeUserException *SetSettingsDxtradeUserException `json:"dxtrade_user_exception,omitempty"` - - // [Optional] Boolean value 1 or 0, indicating permission to use email address for - // any contact which may include marketing - EmailConsent *SetSettingsEmailConsent `json:"email_consent,omitempty"` - - // [Optional] Employment Status. - EmploymentStatus *SetSettingsEmploymentStatus `json:"employment_status,omitempty"` - - // [Optional] Enable or disable one or multiple features. - FeatureFlag *SetSettingsFeatureFlag `json:"feature_flag,omitempty"` - - // [Optional] Within 1-50 characters, use only letters, spaces, hyphens, - // full-stops or apostrophes (can only be changed on unauthenticated svg - // accounts). - FirstName *string `json:"first_name,omitempty"` - - // [Optional] Within 1-50 characters, use only letters, spaces, hyphens, - // full-stops or apostrophes (can only be changed on unauthenticated svg - // accounts). - LastName *string `json:"last_name,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Indicates client's self-declaration of not being a PEP/RCA - // (Politically Exposed Person/Relatives and Close Associates). Effective for real - // accounts only. - NonPepDeclaration *SetSettingsNonPepDeclaration `json:"non_pep_declaration,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough SetSettingsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Note: not applicable for virtual account. Starting with `+` followed - // by 9-35 digits, hyphens or space. - Phone *string `json:"phone,omitempty"` - - // [Optional] Place of birth, 2-letter country code. - PlaceOfBirth *string `json:"place_of_birth,omitempty"` - - // [Optional] User's preferred language, ISO standard language code - PreferredLanguage *string `json:"preferred_language,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] Required when client wants to be treated as professional. Applicable - // for financial accounts only. - RequestProfessionalStatus *SetSettingsRequestProfessionalStatus `json:"request_professional_status,omitempty"` - - // [Optional] 2-letter country code. Note: not applicable for real money account. - // Only allow for Virtual account without residence set. - Residence *string `json:"residence,omitempty"` - - // [Optional] Accept any value in enum list (can only be changed on - // unauthenticated svg accounts). - Salutation *SetSettingsSalutation `json:"salutation,omitempty"` - - // [Optional] Answer to secret question, within 4-50 characters. Required for new - // account and existing client details will be used if client opens another - // account. - SecretAnswer *string `json:"secret_answer,omitempty"` - - // [Optional] Accept any value in enum list. Required for new account and existing - // client details will be used if client opens another account. - SecretQuestion *SetSettingsSecretQuestion `json:"secret_question,omitempty"` - - // Must be `1` - SetSettings SetSettingsSetSettings `json:"set_settings"` - - // [Optional] Tax identification number. Only applicable for real money account. - // Required for maltainvest landing company. - TaxIdentificationNumber *string `json:"tax_identification_number,omitempty"` - - // [Optional] Residence for tax purpose. Comma separated iso country code if - // multiple jurisdictions. Only applicable for real money account. Required for - // maltainvest landing company. - TaxResidence *string `json:"tax_residence,omitempty"` - - // [Optional] Enable/Disable Trading Hub dashboard - TradingHub *SetSettingsTradingHub `json:"trading_hub,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetSettingsNonPepDeclaration) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetSettingsNonPepDeclaration { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetSettingsNonPepDeclaration, v) + } + *j = SetSettingsNonPepDeclaration(v) + return nil } -type SetSettingsAccountOpeningReason string - -const SetSettingsAccountOpeningReasonHedging SetSettingsAccountOpeningReason = "Hedging" -const SetSettingsAccountOpeningReasonIncomeEarning SetSettingsAccountOpeningReason = "Income Earning" -const SetSettingsAccountOpeningReasonPeerToPeerExchange SetSettingsAccountOpeningReason = "Peer-to-peer exchange" -const SetSettingsAccountOpeningReasonSpeculative SetSettingsAccountOpeningReason = "Speculative" - -var enumValues_SetSettingsAccountOpeningReason = []interface{}{ - "Speculative", - "Income Earning", - "Hedging", - "Peer-to-peer exchange", +// UnmarshalJSON implements json.Unmarshaler. +func (j *SetSettingsTradingHub) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_SetSettingsTradingHub { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetSettingsTradingHub, v) + } + *j = SetSettingsTradingHub(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -166,7 +66,12 @@ func (j *SetSettingsAccountOpeningReason) UnmarshalJSON(b []byte) error { return nil } -type SetSettingsAllowCopiers int +const SetSettingsAccountOpeningReasonHedging SetSettingsAccountOpeningReason = "Hedging" +const SetSettingsAccountOpeningReasonIncomeEarning SetSettingsAccountOpeningReason = "Income Earning" +const SetSettingsAccountOpeningReasonPeerToPeerExchange SetSettingsAccountOpeningReason = "Peer-to-peer exchange" +const SetSettingsAccountOpeningReasonSpeculative SetSettingsAccountOpeningReason = "Speculative" + +type SetSettingsAccountOpeningReason string var enumValues_SetSettingsAllowCopiers = []interface{}{ 0, @@ -249,12 +154,6 @@ func (j *SetSettingsEmailConsent) UnmarshalJSON(b []byte) error { type SetSettingsEmploymentStatus string -const SetSettingsEmploymentStatusEmployed SetSettingsEmploymentStatus = "Employed" -const SetSettingsEmploymentStatusPensioner SetSettingsEmploymentStatus = "Pensioner" -const SetSettingsEmploymentStatusSelfEmployed SetSettingsEmploymentStatus = "Self-Employed" -const SetSettingsEmploymentStatusStudent SetSettingsEmploymentStatus = "Student" -const SetSettingsEmploymentStatusUnemployed SetSettingsEmploymentStatus = "Unemployed" - var enumValues_SetSettingsEmploymentStatus = []interface{}{ "Employed", "Pensioner", @@ -283,12 +182,11 @@ func (j *SetSettingsEmploymentStatus) UnmarshalJSON(b []byte) error { return nil } -// [Optional] Enable or disable one or multiple features. -type SetSettingsFeatureFlag struct { - // [Optional] Boolean value 1 or 0 indicating whether to enable/disable this - // feature - Wallet *SetSettingsFeatureFlagWallet `json:"wallet,omitempty"` -} +const SetSettingsEmploymentStatusEmployed SetSettingsEmploymentStatus = "Employed" +const SetSettingsEmploymentStatusPensioner SetSettingsEmploymentStatus = "Pensioner" +const SetSettingsEmploymentStatusSelfEmployed SetSettingsEmploymentStatus = "Self-Employed" +const SetSettingsEmploymentStatusStudent SetSettingsEmploymentStatus = "Student" +const SetSettingsEmploymentStatusUnemployed SetSettingsEmploymentStatus = "Unemployed" type SetSettingsFeatureFlagWallet int @@ -317,37 +215,29 @@ func (j *SetSettingsFeatureFlagWallet) UnmarshalJSON(b []byte) error { return nil } +// [Optional] Enable or disable one or multiple features. +type SetSettingsFeatureFlag struct { + // [Optional] Boolean value 1 or 0 indicating whether to enable/disable this + // feature + Wallet *SetSettingsFeatureFlagWallet `json:"wallet,omitempty"` +} + type SetSettingsNonPepDeclaration int var enumValues_SetSettingsNonPepDeclaration = []interface{}{ 1, } -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetSettingsNonPepDeclaration) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetSettingsNonPepDeclaration { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetSettingsNonPepDeclaration, v) - } - *j = SetSettingsNonPepDeclaration(v) - return nil -} +type SetSettingsRequestProfessionalStatus int -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type SetSettingsPassthrough map[string]interface{} +var enumValues_SetSettingsAccountOpeningReason = []interface{}{ + "Speculative", + "Income Earning", + "Hedging", + "Peer-to-peer exchange", +} -type SetSettingsRequestProfessionalStatus int +type SetSettingsAllowCopiers int var enumValues_SetSettingsRequestProfessionalStatus = []interface{}{ 1, @@ -375,11 +265,6 @@ func (j *SetSettingsRequestProfessionalStatus) UnmarshalJSON(b []byte) error { type SetSettingsSalutation string -const SetSettingsSalutationMiss SetSettingsSalutation = "Miss" -const SetSettingsSalutationMr SetSettingsSalutation = "Mr" -const SetSettingsSalutationMrs SetSettingsSalutation = "Mrs" -const SetSettingsSalutationMs SetSettingsSalutation = "Ms" - var enumValues_SetSettingsSalutation = []interface{}{ "Mr", "Ms", @@ -407,16 +292,12 @@ func (j *SetSettingsSalutation) UnmarshalJSON(b []byte) error { return nil } -type SetSettingsSecretQuestion string +const SetSettingsSalutationMiss SetSettingsSalutation = "Miss" +const SetSettingsSalutationMr SetSettingsSalutation = "Mr" +const SetSettingsSalutationMrs SetSettingsSalutation = "Mrs" +const SetSettingsSalutationMs SetSettingsSalutation = "Ms" -const SetSettingsSecretQuestionBrandOfFirstCar SetSettingsSecretQuestion = "Brand of first car" -const SetSettingsSecretQuestionFavouriteArtist SetSettingsSecretQuestion = "Favourite artist" -const SetSettingsSecretQuestionFavouriteDish SetSettingsSecretQuestion = "Favourite dish" -const SetSettingsSecretQuestionMemorableDate SetSettingsSecretQuestion = "Memorable date" -const SetSettingsSecretQuestionMemorableTownCity SetSettingsSecretQuestion = "Memorable town/city" -const SetSettingsSecretQuestionMotherSMaidenName SetSettingsSecretQuestion = "Mother's maiden name" -const SetSettingsSecretQuestionNameOfFirstLove SetSettingsSecretQuestion = "Name of first love" -const SetSettingsSecretQuestionNameOfYourPet SetSettingsSecretQuestion = "Name of your pet" +type SetSettingsSecretQuestion string var enumValues_SetSettingsSecretQuestion = []interface{}{ "Mother's maiden name", @@ -449,6 +330,15 @@ func (j *SetSettingsSecretQuestion) UnmarshalJSON(b []byte) error { return nil } +const SetSettingsSecretQuestionMemorableTownCity SetSettingsSecretQuestion = "Memorable town/city" +const SetSettingsSecretQuestionMotherSMaidenName SetSettingsSecretQuestion = "Mother's maiden name" +const SetSettingsSecretQuestionMemorableDate SetSettingsSecretQuestion = "Memorable date" +const SetSettingsSecretQuestionFavouriteDish SetSettingsSecretQuestion = "Favourite dish" +const SetSettingsSecretQuestionBrandOfFirstCar SetSettingsSecretQuestion = "Brand of first car" +const SetSettingsSecretQuestionFavouriteArtist SetSettingsSecretQuestion = "Favourite artist" +const SetSettingsSecretQuestionNameOfFirstLove SetSettingsSecretQuestion = "Name of first love" +const SetSettingsSecretQuestionNameOfYourPet SetSettingsSecretQuestion = "Name of your pet" + type SetSettingsSetSettings int var enumValues_SetSettingsSetSettings = []interface{}{ @@ -482,24 +372,134 @@ var enumValues_SetSettingsTradingHub = []interface{}{ 1, } -// UnmarshalJSON implements json.Unmarshaler. -func (j *SetSettingsTradingHub) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_SetSettingsTradingHub { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetSettingsTradingHub, v) - } - *j = SetSettingsTradingHub(v) - return nil +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type SetSettingsPassthrough map[string]interface{} + +// Set User Settings (this call should be used in conjunction with `get_settings`) +type SetSettings struct { + // [Optional] Purpose and reason for requesting the account opening. Only + // applicable for real money account. Required for clients that have not set it + // yet. Can only be set once. + AccountOpeningReason *SetSettingsAccountOpeningReason `json:"account_opening_reason,omitempty"` + + // [Optional] Note: not applicable for virtual account. Required field for real + // money account. + AddressCity *string `json:"address_city,omitempty"` + + // [Optional] Note: not applicable for virtual account. Required field for real + // money account. + AddressLine1 *string `json:"address_line_1,omitempty"` + + // [Optional] Note: not applicable for virtual account. Optional field for real + // money account. + AddressLine2 *string `json:"address_line_2,omitempty"` + + // [Optional] Note: not applicable for virtual account. Optional field for real + // money account. + AddressPostcode *string `json:"address_postcode,omitempty"` + + // [Optional] Note: not applicable for virtual account. Optional field for real + // money account. + AddressState *string `json:"address_state,omitempty"` + + // [Optional] Boolean value 1 or 0, indicating permission to allow others to + // follow your trades. Note: not applicable for Virtual account. Only allow for + // real money account. + AllowCopiers *SetSettingsAllowCopiers `json:"allow_copiers,omitempty"` + + // [Optional] Country of legal citizenship, 2-letter country code. + Citizen *string `json:"citizen,omitempty"` + + // [Optional] Date of birth format: yyyy-mm-dd (can only be changed on + // unauthenticated svg accounts). + DateOfBirth *string `json:"date_of_birth,omitempty"` + + // Boolean value 1 or 0, indicating if user email belong to dxtrade exception + // list. + DxtradeUserException *SetSettingsDxtradeUserException `json:"dxtrade_user_exception,omitempty"` + + // [Optional] Boolean value 1 or 0, indicating permission to use email address for + // any contact which may include marketing + EmailConsent *SetSettingsEmailConsent `json:"email_consent,omitempty"` + + // [Optional] Employment Status. + EmploymentStatus *SetSettingsEmploymentStatus `json:"employment_status,omitempty"` + + // [Optional] Enable or disable one or multiple features. + FeatureFlag *SetSettingsFeatureFlag `json:"feature_flag,omitempty"` + + // [Optional] Within 1-50 characters, use only letters, spaces, hyphens, + // full-stops or apostrophes (can only be changed on unauthenticated svg + // accounts). + FirstName *string `json:"first_name,omitempty"` + + // [Optional] Within 1-50 characters, use only letters, spaces, hyphens, + // full-stops or apostrophes (can only be changed on unauthenticated svg + // accounts). + LastName *string `json:"last_name,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Indicates client's self-declaration of not being a PEP/RCA + // (Politically Exposed Person/Relatives and Close Associates). Effective for real + // accounts only. + NonPepDeclaration *SetSettingsNonPepDeclaration `json:"non_pep_declaration,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough SetSettingsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Note: not applicable for virtual account. Starting with `+` followed + // by 9-35 digits, hyphens or space. + Phone *string `json:"phone,omitempty"` + + // [Optional] Place of birth, 2-letter country code. + PlaceOfBirth *string `json:"place_of_birth,omitempty"` + + // [Optional] User's preferred language, ISO standard language code + PreferredLanguage *string `json:"preferred_language,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] Required when client wants to be treated as professional. Applicable + // for financial accounts only. + RequestProfessionalStatus *SetSettingsRequestProfessionalStatus `json:"request_professional_status,omitempty"` + + // [Optional] 2-letter country code. Note: not applicable for real money account. + // Only allow for Virtual account without residence set. + Residence *string `json:"residence,omitempty"` + + // [Optional] Accept any value in enum list (can only be changed on + // unauthenticated svg accounts). + Salutation *SetSettingsSalutation `json:"salutation,omitempty"` + + // [Optional] Answer to secret question, within 4-50 characters. Required for new + // account and existing client details will be used if client opens another + // account. + SecretAnswer *string `json:"secret_answer,omitempty"` + + // [Optional] Accept any value in enum list. Required for new account and existing + // client details will be used if client opens another account. + SecretQuestion *SetSettingsSecretQuestion `json:"secret_question,omitempty"` + + // Must be `1` + SetSettings SetSettingsSetSettings `json:"set_settings"` + + // [Optional] Tax identification number. Only applicable for real money account. + // Required for maltainvest landing company. + TaxIdentificationNumber *string `json:"tax_identification_number,omitempty"` + + // [Optional] Residence for tax purpose. Comma separated iso country code if + // multiple jurisdictions. Only applicable for real money account. Required for + // maltainvest landing company. + TaxResidence *string `json:"tax_residence,omitempty"` + + // [Optional] Enable/Disable Trading Hub dashboard + TradingHub *SetSettingsTradingHub `json:"trading_hub,omitempty"` } // UnmarshalJSON implements json.Unmarshaler. @@ -508,7 +508,7 @@ func (j *SetSettings) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["set_settings"]; raw != nil && !ok { + if v, ok := raw["set_settings"]; !ok || v == nil { return fmt.Errorf("field set_settings in SetSettings: required") } type Plain SetSettings diff --git a/schema/set_settings_resp.go b/schema/set_settings_resp.go index fe17abd..1fc82ec 100644 --- a/schema/set_settings_resp.go +++ b/schema/set_settings_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with User Settings -type SetSettingsResp struct { - // Echo of the request made. - EchoReq SetSettingsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType SetSettingsRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // 1 on success - SetSettings *int `json:"set_settings,omitempty"` -} - // Echo of the request made. type SetSettingsRespEchoReq map[string]interface{} type SetSettingsRespMsgType string -const SetSettingsRespMsgTypeSetSettings SetSettingsRespMsgType = "set_settings" - var enumValues_SetSettingsRespMsgType = []interface{}{ "set_settings", } @@ -53,16 +35,34 @@ func (j *SetSettingsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with User Settings +type SetSettingsResp struct { + // Echo of the request made. + EchoReq SetSettingsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType SetSettingsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // 1 on success + SetSettings *int `json:"set_settings,omitempty"` +} + +const SetSettingsRespMsgTypeSetSettings SetSettingsRespMsgType = "set_settings" + // UnmarshalJSON implements json.Unmarshaler. func (j *SetSettingsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in SetSettingsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in SetSettingsResp: required") } type Plain SetSettingsResp diff --git a/schema/statement.go b/schema/statement.go index 40ec4a9..b60f360 100644 --- a/schema/statement.go +++ b/schema/statement.go @@ -52,17 +52,6 @@ const StatementActionTypeTransfer StatementActionType = "transfer" const StatementActionTypeVirtualCredit StatementActionType = "virtual_credit" const StatementActionTypeWithdrawal StatementActionType = "withdrawal" -var enumValues_StatementActionType = []interface{}{ - "buy", - "sell", - "deposit", - "withdrawal", - "escrow", - "adjustment", - "virtual_credit", - "transfer", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *StatementActionType) UnmarshalJSON(b []byte) error { var v string @@ -140,13 +129,24 @@ func (j *StatementStatement) UnmarshalJSON(b []byte) error { return nil } +var enumValues_StatementActionType = []interface{}{ + "buy", + "sell", + "deposit", + "withdrawal", + "escrow", + "adjustment", + "virtual_credit", + "transfer", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Statement) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["statement"]; raw != nil && !ok { + if v, ok := raw["statement"]; !ok || v == nil { return fmt.Errorf("field statement in Statement: required") } type Plain Statement diff --git a/schema/statement_resp.go b/schema/statement_resp.go index 0924d94..149d95e 100644 --- a/schema/statement_resp.go +++ b/schema/statement_resp.go @@ -29,30 +29,6 @@ type StatementRespMsgType string const StatementRespMsgTypeStatement StatementRespMsgType = "statement" -var enumValues_StatementRespMsgType = []interface{}{ - "statement", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *StatementRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_StatementRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_StatementRespMsgType, v) - } - *j = StatementRespMsgType(v) - return nil -} - // Account statement. type StatementRespStatement struct { // Number of transactions returned in this call @@ -130,38 +106,6 @@ const StatementRespStatementTransactionsElemActionTypeTransfer StatementRespStat const StatementRespStatementTransactionsElemActionTypeVirtualCredit StatementRespStatementTransactionsElemActionType = "virtual_credit" const StatementRespStatementTransactionsElemActionTypeWithdrawal StatementRespStatementTransactionsElemActionType = "withdrawal" -var enumValues_StatementRespStatementTransactionsElemActionType = []interface{}{ - "buy", - "sell", - "deposit", - "withdrawal", - "hold", - "release", - "adjustment", - "virtual_credit", - "transfer", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *StatementRespStatementTransactionsElemActionType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_StatementRespStatementTransactionsElemActionType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_StatementRespStatementTransactionsElemActionType, v) - } - *j = StatementRespStatementTransactionsElemActionType(v) - return nil -} - // Contains details about fees used for transfer. It is present only when action // type is transfer. type StatementRespStatementTransactionsElemFees struct { @@ -185,6 +129,26 @@ type StatementRespStatementTransactionsElemFrom struct { Loginid *string `json:"loginid,omitempty"` } +// UnmarshalJSON implements json.Unmarshaler. +func (j *StatementRespStatementTransactionsElemActionType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_StatementRespStatementTransactionsElemActionType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_StatementRespStatementTransactionsElemActionType, v) + } + *j = StatementRespStatementTransactionsElemActionType(v) + return nil +} + // Contains details of account to which amount was transferred. It is present only // when action type is transfer. type StatementRespStatementTransactionsElemTo struct { @@ -192,16 +156,52 @@ type StatementRespStatementTransactionsElemTo struct { Loginid *string `json:"loginid,omitempty"` } +var enumValues_StatementRespStatementTransactionsElemActionType = []interface{}{ + "buy", + "sell", + "deposit", + "withdrawal", + "hold", + "release", + "adjustment", + "virtual_credit", + "transfer", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *StatementRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_StatementRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_StatementRespMsgType, v) + } + *j = StatementRespMsgType(v) + return nil +} + +var enumValues_StatementRespMsgType = []interface{}{ + "statement", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *StatementResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in StatementResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in StatementResp: required") } type Plain StatementResp diff --git a/schema/states_list.go b/schema/states_list.go index 05499c3..b4dd9c2 100644 --- a/schema/states_list.go +++ b/schema/states_list.go @@ -29,7 +29,7 @@ func (j *StatesList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["states_list"]; raw != nil && !ok { + if v, ok := raw["states_list"]; !ok || v == nil { return fmt.Errorf("field states_list in StatesList: required") } type Plain StatesList diff --git a/schema/states_list_resp.go b/schema/states_list_resp.go index 11f1f65..075a37e 100644 --- a/schema/states_list_resp.go +++ b/schema/states_list_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with States List -type StatesListResp struct { - // Echo of the request made. - EchoReq StatesListRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType StatesListRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // List of states. - StatesList []StatesListRespStatesListElem `json:"states_list,omitempty"` -} - // Echo of the request made. type StatesListRespEchoReq map[string]interface{} type StatesListRespMsgType string -const StatesListRespMsgTypeStatesList StatesListRespMsgType = "states_list" - var enumValues_StatesListRespMsgType = []interface{}{ "states_list", } @@ -53,6 +35,24 @@ func (j *StatesListRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// A message with States List +type StatesListResp struct { + // Echo of the request made. + EchoReq StatesListRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType StatesListRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // List of states. + StatesList []StatesListRespStatesListElem `json:"states_list,omitempty"` +} + +const StatesListRespMsgTypeStatesList StatesListRespMsgType = "states_list" + type StatesListRespStatesListElem struct { // The state name. Text *string `json:"text,omitempty"` @@ -67,10 +67,10 @@ func (j *StatesListResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in StatesListResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in StatesListResp: required") } type Plain StatesListResp diff --git a/schema/ticks.go b/schema/ticks.go index e0f3cf9..003d1ff 100644 --- a/schema/ticks.go +++ b/schema/ticks.go @@ -6,23 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Initiate a continuous stream of spot price updates for a given symbol. -type Ticks struct { - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TicksPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] If set to 1, will send updates whenever a new tick is received. - Subscribe *TicksSubscribe `json:"subscribe,omitempty"` - - // The short symbol name or array of symbols (obtained from `active_symbols` - // call). - Ticks interface{} `json:"ticks"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TicksPassthrough map[string]interface{} @@ -53,13 +36,30 @@ func (j *TicksSubscribe) UnmarshalJSON(b []byte) error { return nil } +// Initiate a continuous stream of spot price updates for a given symbol. +type Ticks struct { + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TicksPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] If set to 1, will send updates whenever a new tick is received. + Subscribe *TicksSubscribe `json:"subscribe,omitempty"` + + // The short symbol name or array of symbols (obtained from `active_symbols` + // call). + Ticks interface{} `json:"ticks"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Ticks) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["ticks"]; raw != nil && !ok { + if v, ok := raw["ticks"]; !ok || v == nil { return fmt.Errorf("field ticks in Ticks: required") } type Plain Ticks diff --git a/schema/ticks_history.go b/schema/ticks_history.go index b138400..ee85c73 100644 --- a/schema/ticks_history.go +++ b/schema/ticks_history.go @@ -49,32 +49,22 @@ type TicksHistory struct { type TicksHistoryAdjustStartTime int -var enumValues_TicksHistoryAdjustStartTime = []interface{}{ - 1, -} +type TicksHistoryGranularity int -// UnmarshalJSON implements json.Unmarshaler. -func (j *TicksHistoryAdjustStartTime) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_TicksHistoryAdjustStartTime { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TicksHistoryAdjustStartTime, v) - } - *j = TicksHistoryAdjustStartTime(v) - return nil -} +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type TicksHistoryPassthrough map[string]interface{} -type TicksHistoryGranularity int +type TicksHistoryStyle string + +const TicksHistoryStyleCandles TicksHistoryStyle = "candles" +const TicksHistoryStyleTicks TicksHistoryStyle = "ticks" + +type TicksHistorySubscribe int +var enumValues_TicksHistoryAdjustStartTime = []interface{}{ + 1, +} var enumValues_TicksHistoryGranularity = []interface{}{ 60, 120, @@ -91,61 +81,50 @@ var enumValues_TicksHistoryGranularity = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *TicksHistoryGranularity) UnmarshalJSON(b []byte) error { - var v int +func (j *TicksHistoryStyle) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TicksHistoryGranularity { + for _, expected := range enumValues_TicksHistoryStyle { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TicksHistoryGranularity, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TicksHistoryStyle, v) } - *j = TicksHistoryGranularity(v) + *j = TicksHistoryStyle(v) return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type TicksHistoryPassthrough map[string]interface{} - -type TicksHistoryStyle string - -const TicksHistoryStyleCandles TicksHistoryStyle = "candles" -const TicksHistoryStyleTicks TicksHistoryStyle = "ticks" - var enumValues_TicksHistoryStyle = []interface{}{ "candles", "ticks", } // UnmarshalJSON implements json.Unmarshaler. -func (j *TicksHistoryStyle) UnmarshalJSON(b []byte) error { - var v string +func (j *TicksHistoryGranularity) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TicksHistoryStyle { + for _, expected := range enumValues_TicksHistoryGranularity { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TicksHistoryStyle, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TicksHistoryGranularity, v) } - *j = TicksHistoryStyle(v) + *j = TicksHistoryGranularity(v) return nil } -type TicksHistorySubscribe int - var enumValues_TicksHistorySubscribe = []interface{}{ 1, } @@ -170,16 +149,36 @@ func (j *TicksHistorySubscribe) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *TicksHistoryAdjustStartTime) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_TicksHistoryAdjustStartTime { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TicksHistoryAdjustStartTime, v) + } + *j = TicksHistoryAdjustStartTime(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TicksHistory) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["end"]; raw != nil && !ok { + if v, ok := raw["end"]; !ok || v == nil { return fmt.Errorf("field end in TicksHistory: required") } - if _, ok := raw["ticks_history"]; raw != nil && !ok { + if v, ok := raw["ticks_history"]; !ok || v == nil { return fmt.Errorf("field ticks_history in TicksHistory: required") } type Plain TicksHistory diff --git a/schema/ticks_history_resp.go b/schema/ticks_history_resp.go index cf51a74..b9ba8e6 100644 --- a/schema/ticks_history_resp.go +++ b/schema/ticks_history_resp.go @@ -76,16 +76,8 @@ type TicksHistoryRespMsgType string const TicksHistoryRespMsgTypeCandles TicksHistoryRespMsgType = "candles" const TicksHistoryRespMsgTypeHistory TicksHistoryRespMsgType = "history" -const TicksHistoryRespMsgTypeOhlc TicksHistoryRespMsgType = "ohlc" const TicksHistoryRespMsgTypeTick TicksHistoryRespMsgType = "tick" -var enumValues_TicksHistoryRespMsgType = []interface{}{ - "history", - "tick", - "candles", - "ohlc", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *TicksHistoryRespMsgType) UnmarshalJSON(b []byte) error { var v string @@ -106,6 +98,8 @@ func (j *TicksHistoryRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const TicksHistoryRespMsgTypeOhlc TicksHistoryRespMsgType = "ohlc" + // Historic tick data for a given symbol. Note: this will always return the latest // possible set of ticks with accordance to the parameters specified. type TicksHistoryRespOhlc struct { @@ -154,7 +148,7 @@ func (j *TicksHistoryRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in TicksHistoryRespSubscription: required") } type Plain TicksHistoryRespSubscription @@ -166,16 +160,23 @@ func (j *TicksHistoryRespSubscription) UnmarshalJSON(b []byte) error { return nil } +var enumValues_TicksHistoryRespMsgType = []interface{}{ + "history", + "tick", + "candles", + "ohlc", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TicksHistoryResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TicksHistoryResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TicksHistoryResp: required") } type Plain TicksHistoryResp diff --git a/schema/ticks_resp.go b/schema/ticks_resp.go index 2fc0c22..7f047b5 100644 --- a/schema/ticks_resp.go +++ b/schema/ticks_resp.go @@ -6,33 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Latest spot price for a given symbol. Continuous responses with a frequency of -// up to one second. -type TicksResp struct { - // Echo of the request made. - EchoReq TicksRespEchoReq `json:"echo_req"` - - // Type of the response. - MsgType TicksRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *TicksRespSubscription `json:"subscription,omitempty"` - - // Tick by tick list of streamed data - Tick *TicksRespTick `json:"tick,omitempty"` -} - // Echo of the request made. type TicksRespEchoReq map[string]interface{} type TicksRespMsgType string -const TicksRespMsgTypeTick TicksRespMsgType = "tick" - var enumValues_TicksRespMsgType = []interface{}{ "tick", } @@ -57,6 +35,8 @@ func (j *TicksRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const TicksRespMsgTypeTick TicksRespMsgType = "tick" + // For subscription requests only. type TicksRespSubscription struct { // A per-connection unique identifier. Can be passed to the `forget` API call to @@ -70,7 +50,7 @@ func (j *TicksRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in TicksRespSubscription: required") } type Plain TicksRespSubscription @@ -114,7 +94,7 @@ func (j *TicksRespTick) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["pip_size"]; raw != nil && !ok { + if v, ok := raw["pip_size"]; !ok || v == nil { return fmt.Errorf("field pip_size in TicksRespTick: required") } type Plain TicksRespTick @@ -126,16 +106,36 @@ func (j *TicksRespTick) UnmarshalJSON(b []byte) error { return nil } +// Latest spot price for a given symbol. Continuous responses with a frequency of +// up to one second. +type TicksResp struct { + // Echo of the request made. + EchoReq TicksRespEchoReq `json:"echo_req"` + + // Type of the response. + MsgType TicksRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *TicksRespSubscription `json:"subscription,omitempty"` + + // Tick by tick list of streamed data + Tick *TicksRespTick `json:"tick,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TicksResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TicksResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TicksResp: required") } type Plain TicksResp diff --git a/schema/time.go b/schema/time.go index ec0d9ef..dfa2268 100644 --- a/schema/time.go +++ b/schema/time.go @@ -6,19 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Request back-end server epoch time. -type Time struct { - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TimePassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - Time TimeTime `json:"time"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TimePassthrough map[string]interface{} @@ -49,13 +36,26 @@ func (j *TimeTime) UnmarshalJSON(b []byte) error { return nil } +// Request back-end server epoch time. +type Time struct { + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TimePassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + Time TimeTime `json:"time"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Time) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["time"]; raw != nil && !ok { + if v, ok := raw["time"]; !ok || v == nil { return fmt.Errorf("field time in Time: required") } type Plain Time diff --git a/schema/time_resp.go b/schema/time_resp.go index b4ae53c..9bface3 100644 --- a/schema/time_resp.go +++ b/schema/time_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of server time request. -type TimeResp struct { - // Echo of the request made. - EchoReq TimeRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType TimeRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Epoch of server time. - Time *int `json:"time,omitempty"` -} - // Echo of the request made. type TimeRespEchoReq map[string]interface{} type TimeRespMsgType string -const TimeRespMsgTypeTime TimeRespMsgType = "time" - var enumValues_TimeRespMsgType = []interface{}{ "time", } @@ -53,16 +35,34 @@ func (j *TimeRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of server time request. +type TimeResp struct { + // Echo of the request made. + EchoReq TimeRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType TimeRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Epoch of server time. + Time *int `json:"time,omitempty"` +} + +const TimeRespMsgTypeTime TimeRespMsgType = "time" + // UnmarshalJSON implements json.Unmarshaler. func (j *TimeResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TimeResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TimeResp: required") } type Plain TimeResp diff --git a/schema/tin_validations.go b/schema/tin_validations.go index b1153af..b95fce4 100644 --- a/schema/tin_validations.go +++ b/schema/tin_validations.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Get the validations for Tax Identification Numbers (TIN) -type TinValidations struct { - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TinValidationsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // The tax residence selected by the client. - TaxResidence string `json:"tax_residence"` - - // Must be `1` - TinValidations TinValidationsTinValidations `json:"tin_validations"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TinValidationsPassthrough map[string]interface{} @@ -52,16 +36,32 @@ func (j *TinValidationsTinValidations) UnmarshalJSON(b []byte) error { return nil } +// Get the validations for Tax Identification Numbers (TIN) +type TinValidations struct { + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TinValidationsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // The tax residence selected by the client. + TaxResidence string `json:"tax_residence"` + + // Must be `1` + TinValidations TinValidationsTinValidations `json:"tin_validations"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TinValidations) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["tax_residence"]; raw != nil && !ok { + if v, ok := raw["tax_residence"]; !ok || v == nil { return fmt.Errorf("field tax_residence in TinValidations: required") } - if _, ok := raw["tin_validations"]; raw != nil && !ok { + if v, ok := raw["tin_validations"]; !ok || v == nil { return fmt.Errorf("field tin_validations in TinValidations: required") } type Plain TinValidations diff --git a/schema/tin_validations_resp.go b/schema/tin_validations_resp.go index dd83ef4..402cdf2 100644 --- a/schema/tin_validations_resp.go +++ b/schema/tin_validations_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// A message with validations for Tax Identification Numbers (TIN) -type TinValidationsResp struct { - // Echo of the request made. - EchoReq TinValidationsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType TinValidationsRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Validations for Tax Identification Numbers (TIN) - TinValidations *TinValidationsRespTinValidations `json:"tin_validations,omitempty"` -} - // Echo of the request made. type TinValidationsRespEchoReq map[string]interface{} type TinValidationsRespMsgType string -const TinValidationsRespMsgTypeTinValidations TinValidationsRespMsgType = "tin_validations" - var enumValues_TinValidationsRespMsgType = []interface{}{ "tin_validations", } @@ -53,21 +35,7 @@ func (j *TinValidationsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -// Validations for Tax Identification Numbers (TIN) -type TinValidationsRespTinValidations struct { - // Invalid regex patterns for tin validation - InvalidPatterns []string `json:"invalid_patterns,omitempty"` - - // Whether the TIN is mandatory for the selected country - IsTinMandatory *TinValidationsRespTinValidationsIsTinMandatory `json:"is_tin_mandatory,omitempty"` - - // List of employment statuses that bypass TIN requirements for the selected - // country - TinEmploymentStatusBypass []string `json:"tin_employment_status_bypass,omitempty"` - - // Country tax identifier formats. - TinFormat []string `json:"tin_format,omitempty"` -} +const TinValidationsRespMsgTypeTinValidations TinValidationsRespMsgType = "tin_validations" type TinValidationsRespTinValidationsIsTinMandatory int @@ -96,16 +64,48 @@ func (j *TinValidationsRespTinValidationsIsTinMandatory) UnmarshalJSON(b []byte) return nil } +// A message with validations for Tax Identification Numbers (TIN) +type TinValidationsResp struct { + // Echo of the request made. + EchoReq TinValidationsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType TinValidationsRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Validations for Tax Identification Numbers (TIN) + TinValidations *TinValidationsRespTinValidations `json:"tin_validations,omitempty"` +} + +// Validations for Tax Identification Numbers (TIN) +type TinValidationsRespTinValidations struct { + // Invalid regex patterns for tin validation + InvalidPatterns []string `json:"invalid_patterns,omitempty"` + + // Whether the TIN is mandatory for the selected country + IsTinMandatory *TinValidationsRespTinValidationsIsTinMandatory `json:"is_tin_mandatory,omitempty"` + + // List of employment statuses that bypass TIN requirements for the selected + // country + TinEmploymentStatusBypass []string `json:"tin_employment_status_bypass,omitempty"` + + // Country tax identifier formats. + TinFormat []string `json:"tin_format,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TinValidationsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TinValidationsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TinValidationsResp: required") } type Plain TinValidationsResp diff --git a/schema/tnc_approval.go b/schema/tnc_approval.go index 2c80932..1a9484e 100644 --- a/schema/tnc_approval.go +++ b/schema/tnc_approval.go @@ -6,29 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// To approve the latest version of terms and conditions. -type TncApproval struct { - // [Optional] For Affiliate's Code of Conduct Agreement. - AffiliateCocAgreement *TncApprovalAffiliateCocAgreement `json:"affiliate_coc_agreement,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TncApprovalPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - TncApproval TncApprovalTncApproval `json:"tnc_approval"` - - // [Optional] For `ASK_UK_FUNDS_PROTECTION` in `cashier`. - UkgcFundsProtection *TncApprovalUkgcFundsProtection `json:"ukgc_funds_protection,omitempty"` -} - type TncApprovalAffiliateCocAgreement int var enumValues_TncApprovalAffiliateCocAgreement = []interface{}{ @@ -111,13 +88,36 @@ func (j *TncApprovalUkgcFundsProtection) UnmarshalJSON(b []byte) error { return nil } +// To approve the latest version of terms and conditions. +type TncApproval struct { + // [Optional] For Affiliate's Code of Conduct Agreement. + AffiliateCocAgreement *TncApprovalAffiliateCocAgreement `json:"affiliate_coc_agreement,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TncApprovalPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + TncApproval TncApprovalTncApproval `json:"tnc_approval"` + + // [Optional] For `ASK_UK_FUNDS_PROTECTION` in `cashier`. + UkgcFundsProtection *TncApprovalUkgcFundsProtection `json:"ukgc_funds_protection,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TncApproval) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["tnc_approval"]; raw != nil && !ok { + if v, ok := raw["tnc_approval"]; !ok || v == nil { return fmt.Errorf("field tnc_approval in TncApproval: required") } type Plain TncApproval diff --git a/schema/tnc_approval_resp.go b/schema/tnc_approval_resp.go index 549f713..c67600b 100644 --- a/schema/tnc_approval_resp.go +++ b/schema/tnc_approval_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of T&C approval request. -type TncApprovalResp struct { - // Echo of the request made. - EchoReq TncApprovalRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType TncApprovalRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Set terms and conditions 1: success - TncApproval *TncApprovalRespTncApproval `json:"tnc_approval,omitempty"` -} - // Echo of the request made. type TncApprovalRespEchoReq map[string]interface{} type TncApprovalRespMsgType string -const TncApprovalRespMsgTypeTncApproval TncApprovalRespMsgType = "tnc_approval" - var enumValues_TncApprovalRespMsgType = []interface{}{ "tnc_approval", } @@ -53,6 +35,8 @@ func (j *TncApprovalRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const TncApprovalRespMsgTypeTncApproval TncApprovalRespMsgType = "tnc_approval" + type TncApprovalRespTncApproval int var enumValues_TncApprovalRespTncApproval = []interface{}{ @@ -79,16 +63,32 @@ func (j *TncApprovalRespTncApproval) UnmarshalJSON(b []byte) error { return nil } +// The result of T&C approval request. +type TncApprovalResp struct { + // Echo of the request made. + EchoReq TncApprovalRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType TncApprovalRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Set terms and conditions 1: success + TncApproval *TncApprovalRespTncApproval `json:"tnc_approval,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TncApprovalResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TncApprovalResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TncApprovalResp: required") } type Plain TncApprovalResp diff --git a/schema/topup_virtual.go b/schema/topup_virtual.go index 92ede10..1a4f788 100644 --- a/schema/topup_virtual.go +++ b/schema/topup_virtual.go @@ -6,24 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// When a virtual-money's account balance becomes low, it can be topped up using -// this call. -type TopupVirtual struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TopupVirtualPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - TopupVirtual TopupVirtualTopupVirtual `json:"topup_virtual"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TopupVirtualPassthrough map[string]interface{} @@ -54,13 +36,31 @@ func (j *TopupVirtualTopupVirtual) UnmarshalJSON(b []byte) error { return nil } +// When a virtual-money's account balance becomes low, it can be topped up using +// this call. +type TopupVirtual struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TopupVirtualPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + TopupVirtual TopupVirtualTopupVirtual `json:"topup_virtual"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TopupVirtual) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["topup_virtual"]; raw != nil && !ok { + if v, ok := raw["topup_virtual"]; !ok || v == nil { return fmt.Errorf("field topup_virtual in TopupVirtual: required") } type Plain TopupVirtual diff --git a/schema/topup_virtual_resp.go b/schema/topup_virtual_resp.go index 0239315..84e8b82 100644 --- a/schema/topup_virtual_resp.go +++ b/schema/topup_virtual_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of virtual money top up -type TopupVirtualResp struct { - // Echo of the request made. - EchoReq TopupVirtualRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType TopupVirtualRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // The information regarding a successful top up for a virtual money account - TopupVirtual *TopupVirtualRespTopupVirtual `json:"topup_virtual,omitempty"` -} - // Echo of the request made. type TopupVirtualRespEchoReq map[string]interface{} type TopupVirtualRespMsgType string -const TopupVirtualRespMsgTypeTopupVirtual TopupVirtualRespMsgType = "topup_virtual" - var enumValues_TopupVirtualRespMsgType = []interface{}{ "topup_virtual", } @@ -53,6 +35,24 @@ func (j *TopupVirtualRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of virtual money top up +type TopupVirtualResp struct { + // Echo of the request made. + EchoReq TopupVirtualRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType TopupVirtualRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // The information regarding a successful top up for a virtual money account + TopupVirtual *TopupVirtualRespTopupVirtual `json:"topup_virtual,omitempty"` +} + +const TopupVirtualRespMsgTypeTopupVirtual TopupVirtualRespMsgType = "topup_virtual" + // The information regarding a successful top up for a virtual money account type TopupVirtualRespTopupVirtual struct { // Top up amount @@ -68,10 +68,10 @@ func (j *TopupVirtualResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TopupVirtualResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TopupVirtualResp: required") } type Plain TopupVirtualResp diff --git a/schema/trading_durations.go b/schema/trading_durations.go index 955241b..7f55914 100644 --- a/schema/trading_durations.go +++ b/schema/trading_durations.go @@ -46,15 +46,7 @@ const TradingDurationsLandingCompanyShortMaltainvest TradingDurationsLandingComp const TradingDurationsLandingCompanyShortSvg TradingDurationsLandingCompanyShort = "svg" const TradingDurationsLandingCompanyShortVanuatu TradingDurationsLandingCompanyShort = "vanuatu" const TradingDurationsLandingCompanyShortVirtual TradingDurationsLandingCompanyShort = "virtual" - -var enumValues_TradingDurationsLandingCompanyShort = []interface{}{ - "iom", - "malta", - "maltainvest", - "svg", - "virtual", - "vanuatu", -} +const TradingDurationsLandingCompanySvg TradingDurationsLandingCompany = "svg" // UnmarshalJSON implements json.Unmarshaler. func (j *TradingDurationsLandingCompanyShort) UnmarshalJSON(b []byte) error { @@ -76,11 +68,10 @@ func (j *TradingDurationsLandingCompanyShort) UnmarshalJSON(b []byte) error { return nil } -const TradingDurationsLandingCompanySvg TradingDurationsLandingCompany = "svg" const TradingDurationsLandingCompanyVanuatu TradingDurationsLandingCompany = "vanuatu" const TradingDurationsLandingCompanyVirtual TradingDurationsLandingCompany = "virtual" -var enumValues_TradingDurationsLandingCompany = []interface{}{ +var enumValues_TradingDurationsLandingCompanyShort = []interface{}{ "iom", "malta", "maltainvest", @@ -139,13 +130,22 @@ func (j *TradingDurationsTradingDurations) UnmarshalJSON(b []byte) error { return nil } +var enumValues_TradingDurationsLandingCompany = []interface{}{ + "iom", + "malta", + "maltainvest", + "svg", + "virtual", + "vanuatu", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingDurations) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["trading_durations"]; raw != nil && !ok { + if v, ok := raw["trading_durations"]; !ok || v == nil { return fmt.Errorf("field trading_durations in TradingDurations: required") } type Plain TradingDurations diff --git a/schema/trading_durations_resp.go b/schema/trading_durations_resp.go index eec5cda..e84344d 100644 --- a/schema/trading_durations_resp.go +++ b/schema/trading_durations_resp.go @@ -31,30 +31,6 @@ type TradingDurationsRespMsgType string const TradingDurationsRespMsgTypeTradingDurations TradingDurationsRespMsgType = "trading_durations" -var enumValues_TradingDurationsRespMsgType = []interface{}{ - "trading_durations", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *TradingDurationsRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_TradingDurationsRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingDurationsRespMsgType, v) - } - *j = TradingDurationsRespMsgType(v) - return nil -} - type TradingDurationsRespTradingDurationsElem struct { // Available contract types and trading duration boundaries Data []TradingDurationsRespTradingDurationsElemDataElem `json:"data,omitempty"` @@ -155,16 +131,40 @@ type TradingDurationsRespTradingDurationsElemSubmarket struct { Name *string `json:"name,omitempty"` } +// UnmarshalJSON implements json.Unmarshaler. +func (j *TradingDurationsRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_TradingDurationsRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingDurationsRespMsgType, v) + } + *j = TradingDurationsRespMsgType(v) + return nil +} + +var enumValues_TradingDurationsRespMsgType = []interface{}{ + "trading_durations", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingDurationsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TradingDurationsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TradingDurationsResp: required") } type Plain TradingDurationsResp diff --git a/schema/trading_platform_investor_password_reset.go b/schema/trading_platform_investor_password_reset.go index 70374f5..c5bd1e5 100644 --- a/schema/trading_platform_investor_password_reset.go +++ b/schema/trading_platform_investor_password_reset.go @@ -6,47 +6,12 @@ import "encoding/json" import "fmt" import "reflect" -// Reset the investor password of a Trading Platform Account -type TradingPlatformInvestorPasswordReset struct { - // Trading account ID. - AccountId string `json:"account_id"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // New password of the account. For validation (Accepts any printable ASCII - // character. Must be within 8-16 characters, include numbers, lowercase, - // uppercase letters and special characters. Must not be the same as the user's - // email address). - NewPassword string `json:"new_password"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TradingPlatformInvestorPasswordResetPassthrough `json:"passthrough,omitempty"` - - // Name of trading platform. - Platform TradingPlatformInvestorPasswordResetPlatform `json:"platform"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - TradingPlatformInvestorPasswordReset TradingPlatformInvestorPasswordResetTradingPlatformInvestorPasswordReset `json:"trading_platform_investor_password_reset"` - - // Email verification code (received from a `verify_email` call, which must be - // done first) - VerificationCode string `json:"verification_code"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TradingPlatformInvestorPasswordResetPassthrough map[string]interface{} type TradingPlatformInvestorPasswordResetPlatform string -const TradingPlatformInvestorPasswordResetPlatformMt5 TradingPlatformInvestorPasswordResetPlatform = "mt5" - var enumValues_TradingPlatformInvestorPasswordResetPlatform = []interface{}{ "mt5", } @@ -71,6 +36,8 @@ func (j *TradingPlatformInvestorPasswordResetPlatform) UnmarshalJSON(b []byte) e return nil } +const TradingPlatformInvestorPasswordResetPlatformMt5 TradingPlatformInvestorPasswordResetPlatform = "mt5" + type TradingPlatformInvestorPasswordResetTradingPlatformInvestorPasswordReset int var enumValues_TradingPlatformInvestorPasswordResetTradingPlatformInvestorPasswordReset = []interface{}{ @@ -97,25 +64,58 @@ func (j *TradingPlatformInvestorPasswordResetTradingPlatformInvestorPasswordRese return nil } +// Reset the investor password of a Trading Platform Account +type TradingPlatformInvestorPasswordReset struct { + // Trading account ID. + AccountId string `json:"account_id"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // New password of the account. For validation (Accepts any printable ASCII + // character. Must be within 8-16 characters, include numbers, lowercase, + // uppercase letters and special characters. Must not be the same as the user's + // email address). + NewPassword string `json:"new_password"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TradingPlatformInvestorPasswordResetPassthrough `json:"passthrough,omitempty"` + + // Name of trading platform. + Platform TradingPlatformInvestorPasswordResetPlatform `json:"platform"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + TradingPlatformInvestorPasswordReset TradingPlatformInvestorPasswordResetTradingPlatformInvestorPasswordReset `json:"trading_platform_investor_password_reset"` + + // Email verification code (received from a `verify_email` call, which must be + // done first) + VerificationCode string `json:"verification_code"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingPlatformInvestorPasswordReset) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["account_id"]; raw != nil && !ok { + if v, ok := raw["account_id"]; !ok || v == nil { return fmt.Errorf("field account_id in TradingPlatformInvestorPasswordReset: required") } - if _, ok := raw["new_password"]; raw != nil && !ok { + if v, ok := raw["new_password"]; !ok || v == nil { return fmt.Errorf("field new_password in TradingPlatformInvestorPasswordReset: required") } - if _, ok := raw["platform"]; raw != nil && !ok { + if v, ok := raw["platform"]; !ok || v == nil { return fmt.Errorf("field platform in TradingPlatformInvestorPasswordReset: required") } - if _, ok := raw["trading_platform_investor_password_reset"]; raw != nil && !ok { + if v, ok := raw["trading_platform_investor_password_reset"]; !ok || v == nil { return fmt.Errorf("field trading_platform_investor_password_reset in TradingPlatformInvestorPasswordReset: required") } - if _, ok := raw["verification_code"]; raw != nil && !ok { + if v, ok := raw["verification_code"]; !ok || v == nil { return fmt.Errorf("field verification_code in TradingPlatformInvestorPasswordReset: required") } type Plain TradingPlatformInvestorPasswordReset diff --git a/schema/trading_platform_investor_password_reset_resp.go b/schema/trading_platform_investor_password_reset_resp.go index 56519d1..7998d0b 100644 --- a/schema/trading_platform_investor_password_reset_resp.go +++ b/schema/trading_platform_investor_password_reset_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of the Trading Platform investor password reset. -type TradingPlatformInvestorPasswordResetResp struct { - // Echo of the request made. - EchoReq TradingPlatformInvestorPasswordResetRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType TradingPlatformInvestorPasswordResetRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // If set to 1, the investor password has been reset. - TradingPlatformPasswordReset *TradingPlatformInvestorPasswordResetRespTradingPlatformPasswordReset `json:"trading_platform_password_reset,omitempty"` -} - // Echo of the request made. type TradingPlatformInvestorPasswordResetRespEchoReq map[string]interface{} type TradingPlatformInvestorPasswordResetRespMsgType string -const TradingPlatformInvestorPasswordResetRespMsgTypeTradingPlatformInvestorPasswordReset TradingPlatformInvestorPasswordResetRespMsgType = "trading_platform_investor_password_reset" - var enumValues_TradingPlatformInvestorPasswordResetRespMsgType = []interface{}{ "trading_platform_investor_password_reset", } @@ -53,6 +35,8 @@ func (j *TradingPlatformInvestorPasswordResetRespMsgType) UnmarshalJSON(b []byte return nil } +const TradingPlatformInvestorPasswordResetRespMsgTypeTradingPlatformInvestorPasswordReset TradingPlatformInvestorPasswordResetRespMsgType = "trading_platform_investor_password_reset" + type TradingPlatformInvestorPasswordResetRespTradingPlatformPasswordReset int var enumValues_TradingPlatformInvestorPasswordResetRespTradingPlatformPasswordReset = []interface{}{ @@ -80,16 +64,32 @@ func (j *TradingPlatformInvestorPasswordResetRespTradingPlatformPasswordReset) U return nil } +// The result of the Trading Platform investor password reset. +type TradingPlatformInvestorPasswordResetResp struct { + // Echo of the request made. + EchoReq TradingPlatformInvestorPasswordResetRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType TradingPlatformInvestorPasswordResetRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // If set to 1, the investor password has been reset. + TradingPlatformPasswordReset *TradingPlatformInvestorPasswordResetRespTradingPlatformPasswordReset `json:"trading_platform_password_reset,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingPlatformInvestorPasswordResetResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TradingPlatformInvestorPasswordResetResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TradingPlatformInvestorPasswordResetResp: required") } type Plain TradingPlatformInvestorPasswordResetResp diff --git a/schema/trading_platform_password_reset.go b/schema/trading_platform_password_reset.go index 1355439..0339356 100644 --- a/schema/trading_platform_password_reset.go +++ b/schema/trading_platform_password_reset.go @@ -6,47 +6,12 @@ import "encoding/json" import "fmt" import "reflect" -// Reset the password of a Trading Platform Account -type TradingPlatformPasswordReset struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // New password of the account. For validation (Accepts any printable ASCII - // character. DerivX: Must be within 8-25 characters, include numbers, lowercase, - // uppercase letters. Must not be the same as the user's email address). Accepts - // any printable ASCII character. MT5: Must be within 8-16 characters, include - // numbers, lowercase, uppercase letters and special characters. Must not be the - // same as the user's email address. - NewPassword string `json:"new_password"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TradingPlatformPasswordResetPassthrough `json:"passthrough,omitempty"` - - // Name of trading platform. - Platform TradingPlatformPasswordResetPlatform `json:"platform"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - TradingPlatformPasswordReset TradingPlatformPasswordResetTradingPlatformPasswordReset `json:"trading_platform_password_reset"` - - // Email verification code (received from a `verify_email` call, which must be - // done first) - VerificationCode string `json:"verification_code"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TradingPlatformPasswordResetPassthrough map[string]interface{} type TradingPlatformPasswordResetPlatform string -const TradingPlatformPasswordResetPlatformDxtrade TradingPlatformPasswordResetPlatform = "dxtrade" -const TradingPlatformPasswordResetPlatformMt5 TradingPlatformPasswordResetPlatform = "mt5" - var enumValues_TradingPlatformPasswordResetPlatform = []interface{}{ "dxtrade", "mt5", @@ -72,6 +37,9 @@ func (j *TradingPlatformPasswordResetPlatform) UnmarshalJSON(b []byte) error { return nil } +const TradingPlatformPasswordResetPlatformDxtrade TradingPlatformPasswordResetPlatform = "dxtrade" +const TradingPlatformPasswordResetPlatformMt5 TradingPlatformPasswordResetPlatform = "mt5" + type TradingPlatformPasswordResetTradingPlatformPasswordReset int var enumValues_TradingPlatformPasswordResetTradingPlatformPasswordReset = []interface{}{ @@ -98,22 +66,54 @@ func (j *TradingPlatformPasswordResetTradingPlatformPasswordReset) UnmarshalJSON return nil } +// Reset the password of a Trading Platform Account +type TradingPlatformPasswordReset struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // New password of the account. For validation (Accepts any printable ASCII + // character. DerivX: Must be within 8-25 characters, include numbers, lowercase, + // uppercase letters. Must not be the same as the user's email address). Accepts + // any printable ASCII character. MT5: Must be within 8-16 characters, include + // numbers, lowercase, uppercase letters and special characters. Must not be the + // same as the user's email address. + NewPassword string `json:"new_password"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TradingPlatformPasswordResetPassthrough `json:"passthrough,omitempty"` + + // Name of trading platform. + Platform TradingPlatformPasswordResetPlatform `json:"platform"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + TradingPlatformPasswordReset TradingPlatformPasswordResetTradingPlatformPasswordReset `json:"trading_platform_password_reset"` + + // Email verification code (received from a `verify_email` call, which must be + // done first) + VerificationCode string `json:"verification_code"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingPlatformPasswordReset) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["new_password"]; raw != nil && !ok { + if v, ok := raw["new_password"]; !ok || v == nil { return fmt.Errorf("field new_password in TradingPlatformPasswordReset: required") } - if _, ok := raw["platform"]; raw != nil && !ok { + if v, ok := raw["platform"]; !ok || v == nil { return fmt.Errorf("field platform in TradingPlatformPasswordReset: required") } - if _, ok := raw["trading_platform_password_reset"]; raw != nil && !ok { + if v, ok := raw["trading_platform_password_reset"]; !ok || v == nil { return fmt.Errorf("field trading_platform_password_reset in TradingPlatformPasswordReset: required") } - if _, ok := raw["verification_code"]; raw != nil && !ok { + if v, ok := raw["verification_code"]; !ok || v == nil { return fmt.Errorf("field verification_code in TradingPlatformPasswordReset: required") } type Plain TradingPlatformPasswordReset diff --git a/schema/trading_platform_password_reset_resp.go b/schema/trading_platform_password_reset_resp.go index 2df600a..1c8c757 100644 --- a/schema/trading_platform_password_reset_resp.go +++ b/schema/trading_platform_password_reset_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// The result of the Trading Platform password reset. -type TradingPlatformPasswordResetResp struct { - // Echo of the request made. - EchoReq TradingPlatformPasswordResetRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType TradingPlatformPasswordResetRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // If set to 1, the password has been reset. - TradingPlatformPasswordReset *TradingPlatformPasswordResetRespTradingPlatformPasswordReset `json:"trading_platform_password_reset,omitempty"` -} - // Echo of the request made. type TradingPlatformPasswordResetRespEchoReq map[string]interface{} type TradingPlatformPasswordResetRespMsgType string -const TradingPlatformPasswordResetRespMsgTypeTradingPlatformPasswordReset TradingPlatformPasswordResetRespMsgType = "trading_platform_password_reset" - var enumValues_TradingPlatformPasswordResetRespMsgType = []interface{}{ "trading_platform_password_reset", } @@ -53,6 +35,8 @@ func (j *TradingPlatformPasswordResetRespMsgType) UnmarshalJSON(b []byte) error return nil } +const TradingPlatformPasswordResetRespMsgTypeTradingPlatformPasswordReset TradingPlatformPasswordResetRespMsgType = "trading_platform_password_reset" + type TradingPlatformPasswordResetRespTradingPlatformPasswordReset int var enumValues_TradingPlatformPasswordResetRespTradingPlatformPasswordReset = []interface{}{ @@ -80,16 +64,32 @@ func (j *TradingPlatformPasswordResetRespTradingPlatformPasswordReset) Unmarshal return nil } +// The result of the Trading Platform password reset. +type TradingPlatformPasswordResetResp struct { + // Echo of the request made. + EchoReq TradingPlatformPasswordResetRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType TradingPlatformPasswordResetRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // If set to 1, the password has been reset. + TradingPlatformPasswordReset *TradingPlatformPasswordResetRespTradingPlatformPasswordReset `json:"trading_platform_password_reset,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingPlatformPasswordResetResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TradingPlatformPasswordResetResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TradingPlatformPasswordResetResp: required") } type Plain TradingPlatformPasswordResetResp diff --git a/schema/trading_platform_status.go b/schema/trading_platform_status.go index 52ed0bd..01b7510 100644 --- a/schema/trading_platform_status.go +++ b/schema/trading_platform_status.go @@ -6,19 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Request trading platform status -type TradingPlatformStatus struct { - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TradingPlatformStatusPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - TradingPlatformStatus TradingPlatformStatusTradingPlatformStatus `json:"trading_platform_status"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TradingPlatformStatusPassthrough map[string]interface{} @@ -49,13 +36,26 @@ func (j *TradingPlatformStatusTradingPlatformStatus) UnmarshalJSON(b []byte) err return nil } +// Request trading platform status +type TradingPlatformStatus struct { + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TradingPlatformStatusPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + TradingPlatformStatus TradingPlatformStatusTradingPlatformStatus `json:"trading_platform_status"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingPlatformStatus) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["trading_platform_status"]; raw != nil && !ok { + if v, ok := raw["trading_platform_status"]; !ok || v == nil { return fmt.Errorf("field trading_platform_status in TradingPlatformStatus: required") } type Plain TradingPlatformStatus diff --git a/schema/trading_platform_status_resp.go b/schema/trading_platform_status_resp.go index 39bf383..d8c045c 100644 --- a/schema/trading_platform_status_resp.go +++ b/schema/trading_platform_status_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Provides current suspension status of trading platforms -type TradingPlatformStatusResp struct { - // Echo of the request made. - EchoReq TradingPlatformStatusRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType TradingPlatformStatusRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // Availability status of the trading platforms - TradingPlatformStatus []interface{} `json:"trading_platform_status"` -} - // Echo of the request made. type TradingPlatformStatusRespEchoReq map[string]interface{} type TradingPlatformStatusRespMsgType string -const TradingPlatformStatusRespMsgTypeTradingPlatformStatus TradingPlatformStatusRespMsgType = "trading_platform_status" - var enumValues_TradingPlatformStatusRespMsgType = []interface{}{ "trading_platform_status", } @@ -53,19 +35,37 @@ func (j *TradingPlatformStatusRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// Provides current suspension status of trading platforms +type TradingPlatformStatusResp struct { + // Echo of the request made. + EchoReq TradingPlatformStatusRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType TradingPlatformStatusRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // Availability status of the trading platforms + TradingPlatformStatus []interface{} `json:"trading_platform_status"` +} + +const TradingPlatformStatusRespMsgTypeTradingPlatformStatus TradingPlatformStatusRespMsgType = "trading_platform_status" + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingPlatformStatusResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TradingPlatformStatusResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TradingPlatformStatusResp: required") } - if _, ok := raw["trading_platform_status"]; raw != nil && !ok { + if v, ok := raw["trading_platform_status"]; !ok || v == nil { return fmt.Errorf("field trading_platform_status in TradingPlatformStatusResp: required") } type Plain TradingPlatformStatusResp diff --git a/schema/trading_servers.go b/schema/trading_servers.go index e8a364a..798be9d 100644 --- a/schema/trading_servers.go +++ b/schema/trading_servers.go @@ -41,31 +41,6 @@ type TradingServersAccountType string const TradingServersAccountTypeDemo TradingServersAccountType = "demo" const TradingServersAccountTypeReal TradingServersAccountType = "real" -var enumValues_TradingServersAccountType = []interface{}{ - "demo", - "real", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersAccountType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_TradingServersAccountType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersAccountType, v) - } - *j = TradingServersAccountType(v) - return nil -} - type TradingServersEnvironment string const TradingServersEnvironmentAll TradingServersEnvironment = "all" @@ -74,6 +49,27 @@ const TradingServersEnvironmentDerivServer TradingServersEnvironment = "Deriv-Se const TradingServersEnvironmentDerivServer02 TradingServersEnvironment = "Deriv-Server-02" const TradingServersEnvironmentDerivServer03 TradingServersEnvironment = "Deriv-Server-03" +type TradingServersMarketType string + +const TradingServersMarketTypeAll TradingServersMarketType = "all" +const TradingServersMarketTypeFinancial TradingServersMarketType = "financial" +const TradingServersMarketTypeSynthetic TradingServersMarketType = "synthetic" + +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type TradingServersPassthrough map[string]interface{} + +type TradingServersPlatform string + +const TradingServersPlatformDxtrade TradingServersPlatform = "dxtrade" +const TradingServersPlatformMt5 TradingServersPlatform = "mt5" + +type TradingServersTradingServers int + +var enumValues_TradingServersAccountType = []interface{}{ + "demo", + "real", +} var enumValues_TradingServersEnvironment = []interface{}{ "all", "Deriv-Demo", @@ -81,37 +77,35 @@ var enumValues_TradingServersEnvironment = []interface{}{ "Deriv-Server-02", "Deriv-Server-03", } +var enumValues_TradingServersMarketType = []interface{}{ + "all", + "financial", + "synthetic", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersEnvironment) UnmarshalJSON(b []byte) error { +func (j *TradingServersPlatform) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TradingServersEnvironment { + for _, expected := range enumValues_TradingServersPlatform { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersEnvironment, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersPlatform, v) } - *j = TradingServersEnvironment(v) + *j = TradingServersPlatform(v) return nil } -type TradingServersMarketType string - -const TradingServersMarketTypeAll TradingServersMarketType = "all" -const TradingServersMarketTypeFinancial TradingServersMarketType = "financial" -const TradingServersMarketTypeSynthetic TradingServersMarketType = "synthetic" - -var enumValues_TradingServersMarketType = []interface{}{ - "all", - "financial", - "synthetic", +var enumValues_TradingServersPlatform = []interface{}{ + "mt5", + "dxtrade", } // UnmarshalJSON implements json.Unmarshaler. @@ -134,42 +128,26 @@ func (j *TradingServersMarketType) UnmarshalJSON(b []byte) error { return nil } -// [Optional] Used to pass data through the websocket, which may be retrieved via -// the `echo_req` output field. -type TradingServersPassthrough map[string]interface{} - -type TradingServersPlatform string - -const TradingServersPlatformDxtrade TradingServersPlatform = "dxtrade" -const TradingServersPlatformMt5 TradingServersPlatform = "mt5" - -var enumValues_TradingServersPlatform = []interface{}{ - "mt5", - "dxtrade", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersPlatform) UnmarshalJSON(b []byte) error { +func (j *TradingServersEnvironment) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TradingServersPlatform { + for _, expected := range enumValues_TradingServersEnvironment { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersPlatform, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersEnvironment, v) } - *j = TradingServersPlatform(v) + *j = TradingServersEnvironment(v) return nil } -type TradingServersTradingServers int - var enumValues_TradingServersTradingServers = []interface{}{ 1, } @@ -194,13 +172,33 @@ func (j *TradingServersTradingServers) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *TradingServersAccountType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_TradingServersAccountType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersAccountType, v) + } + *j = TradingServersAccountType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingServers) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["trading_servers"]; raw != nil && !ok { + if v, ok := raw["trading_servers"]; !ok || v == nil { return fmt.Errorf("field trading_servers in TradingServers: required") } type Plain TradingServers diff --git a/schema/trading_servers_resp.go b/schema/trading_servers_resp.go index 4fd687e..3604915 100644 --- a/schema/trading_servers_resp.go +++ b/schema/trading_servers_resp.go @@ -29,30 +29,6 @@ type TradingServersRespMsgType string const TradingServersRespMsgTypeTradingServers TradingServersRespMsgType = "trading_servers" -var enumValues_TradingServersRespMsgType = []interface{}{ - "trading_servers", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_TradingServersRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespMsgType, v) - } - *j = TradingServersRespMsgType(v) - return nil -} - type TradingServersRespTradingServersElem struct { // Supported trading account type. AccountType *TradingServersRespTradingServersElemAccountType `json:"account_type,omitempty"` @@ -89,92 +65,93 @@ type TradingServersRespTradingServersElemAccountType string const TradingServersRespTradingServersElemAccountTypeDemo TradingServersRespTradingServersElemAccountType = "demo" const TradingServersRespTradingServersElemAccountTypeReal TradingServersRespTradingServersElemAccountType = "real" -var enumValues_TradingServersRespTradingServersElemAccountType = []interface{}{ - "demo", - "real", -} +type TradingServersRespTradingServersElemDisabled int + +type TradingServersRespTradingServersElemEnvironment string + +const TradingServersRespTradingServersElemEnvironmentDerivDemo TradingServersRespTradingServersElemEnvironment = "Deriv-Demo" +const TradingServersRespTradingServersElemEnvironmentDerivServer TradingServersRespTradingServersElemEnvironment = "Deriv-Server" +const TradingServersRespTradingServersElemEnvironmentDerivServer02 TradingServersRespTradingServersElemEnvironment = "Deriv-Server-02" // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespTradingServersElemAccountType) UnmarshalJSON(b []byte) error { +func (j *TradingServersRespTradingServersElemId) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TradingServersRespTradingServersElemAccountType { + for _, expected := range enumValues_TradingServersRespTradingServersElemId { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemAccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemId, v) } - *j = TradingServersRespTradingServersElemAccountType(v) + *j = TradingServersRespTradingServersElemId(v) return nil } -type TradingServersRespTradingServersElemDisabled int - -var enumValues_TradingServersRespTradingServersElemDisabled = []interface{}{ - 0, - 1, +var enumValues_TradingServersRespTradingServersElemEnvironment = []interface{}{ + "Deriv-Demo", + "Deriv-Server", + "Deriv-Server-02", + "Deriv-Server-03", } // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespTradingServersElemDisabled) UnmarshalJSON(b []byte) error { - var v int +func (j *TradingServersRespTradingServersElemEnvironment) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TradingServersRespTradingServersElemDisabled { + for _, expected := range enumValues_TradingServersRespTradingServersElemEnvironment { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemDisabled, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemEnvironment, v) } - *j = TradingServersRespTradingServersElemDisabled(v) + *j = TradingServersRespTradingServersElemEnvironment(v) return nil } -type TradingServersRespTradingServersElemEnvironment string - -const TradingServersRespTradingServersElemEnvironmentDerivDemo TradingServersRespTradingServersElemEnvironment = "Deriv-Demo" -const TradingServersRespTradingServersElemEnvironmentDerivServer TradingServersRespTradingServersElemEnvironment = "Deriv-Server" -const TradingServersRespTradingServersElemEnvironmentDerivServer02 TradingServersRespTradingServersElemEnvironment = "Deriv-Server-02" -const TradingServersRespTradingServersElemEnvironmentDerivServer03 TradingServersRespTradingServersElemEnvironment = "Deriv-Server-03" - -var enumValues_TradingServersRespTradingServersElemEnvironment = []interface{}{ - "Deriv-Demo", - "Deriv-Server", - "Deriv-Server-02", - "Deriv-Server-03", +var enumValues_TradingServersRespTradingServersElemDisabled = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespTradingServersElemEnvironment) UnmarshalJSON(b []byte) error { +func (j *TradingServersRespTradingServersElemAccountType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TradingServersRespTradingServersElemEnvironment { + for _, expected := range enumValues_TradingServersRespTradingServersElemAccountType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemEnvironment, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemAccountType, v) } - *j = TradingServersRespTradingServersElemEnvironment(v) + *j = TradingServersRespTradingServersElemAccountType(v) return nil } +var enumValues_TradingServersRespTradingServersElemAccountType = []interface{}{ + "demo", + "real", +} + +const TradingServersRespTradingServersElemEnvironmentDerivServer03 TradingServersRespTradingServersElemEnvironment = "Deriv-Server-03" + // Object containing geolocation information of the server. type TradingServersRespTradingServersElemGeolocation struct { // Internal server grouping. @@ -192,13 +169,6 @@ type TradingServersRespTradingServersElemGeolocation struct { type TradingServersRespTradingServersElemId string -const TradingServersRespTradingServersElemIdP01Ts01 TradingServersRespTradingServersElemId = "p01_ts01" -const TradingServersRespTradingServersElemIdP01Ts02 TradingServersRespTradingServersElemId = "p01_ts02" -const TradingServersRespTradingServersElemIdP01Ts03 TradingServersRespTradingServersElemId = "p01_ts03" -const TradingServersRespTradingServersElemIdP01Ts04 TradingServersRespTradingServersElemId = "p01_ts04" -const TradingServersRespTradingServersElemIdP02Ts02 TradingServersRespTradingServersElemId = "p02_ts02" -const TradingServersRespTradingServersElemIdP03Ts01 TradingServersRespTradingServersElemId = "p03_ts01" - var enumValues_TradingServersRespTradingServersElemId = []interface{}{ "p01_ts01", "p01_ts02", @@ -209,25 +179,32 @@ var enumValues_TradingServersRespTradingServersElemId = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespTradingServersElemId) UnmarshalJSON(b []byte) error { - var v string +func (j *TradingServersRespTradingServersElemDisabled) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TradingServersRespTradingServersElemId { + for _, expected := range enumValues_TradingServersRespTradingServersElemDisabled { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemId, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemDisabled, v) } - *j = TradingServersRespTradingServersElemId(v) + *j = TradingServersRespTradingServersElemDisabled(v) return nil } +const TradingServersRespTradingServersElemIdP01Ts01 TradingServersRespTradingServersElemId = "p01_ts01" +const TradingServersRespTradingServersElemIdP01Ts02 TradingServersRespTradingServersElemId = "p01_ts02" +const TradingServersRespTradingServersElemIdP01Ts03 TradingServersRespTradingServersElemId = "p01_ts03" +const TradingServersRespTradingServersElemIdP01Ts04 TradingServersRespTradingServersElemId = "p01_ts04" +const TradingServersRespTradingServersElemIdP02Ts02 TradingServersRespTradingServersElemId = "p02_ts02" +const TradingServersRespTradingServersElemIdP03Ts01 TradingServersRespTradingServersElemId = "p03_ts01" + type TradingServersRespTradingServersElemRecommended int var enumValues_TradingServersRespTradingServersElemRecommended = []interface{}{ @@ -255,16 +232,40 @@ func (j *TradingServersRespTradingServersElemRecommended) UnmarshalJSON(b []byte return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *TradingServersRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_TradingServersRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespMsgType, v) + } + *j = TradingServersRespMsgType(v) + return nil +} + +var enumValues_TradingServersRespMsgType = []interface{}{ + "trading_servers", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingServersResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TradingServersResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TradingServersResp: required") } type Plain TradingServersResp diff --git a/schema/trading_times.go b/schema/trading_times.go index 7764c53..f563441 100644 --- a/schema/trading_times.go +++ b/schema/trading_times.go @@ -29,7 +29,7 @@ func (j *TradingTimes) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["trading_times"]; raw != nil && !ok { + if v, ok := raw["trading_times"]; !ok || v == nil { return fmt.Errorf("field trading_times in TradingTimes: required") } type Plain TradingTimes diff --git a/schema/trading_times_resp.go b/schema/trading_times_resp.go index 80ac7ad..83cfc66 100644 --- a/schema/trading_times_resp.go +++ b/schema/trading_times_resp.go @@ -30,30 +30,6 @@ type TradingTimesRespMsgType string const TradingTimesRespMsgTypeTradingTimes TradingTimesRespMsgType = "trading_times" -var enumValues_TradingTimesRespMsgType = []interface{}{ - "trading_times", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *TradingTimesRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_TradingTimesRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingTimesRespMsgType, v) - } - *j = TradingTimesRespMsgType(v) - return nil -} - // The trading times structure is a hierarchy as follows: Market -> SubMarket -> // Underlyings type TradingTimesRespTradingTimes struct { @@ -99,24 +75,6 @@ type TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTimes map[s type TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem string -const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemFri TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Fri" -const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemMon TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Mon" -const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemSat TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Sat" -const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemSun TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Sun" -const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemThu TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Thu" -const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemTue TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Tue" -const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemWed TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Wed" - -var enumValues_TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = []interface{}{ - "Sun", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem) UnmarshalJSON(b []byte) error { var v string @@ -137,16 +95,23 @@ func (j *TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTrading return nil } +const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemTue TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Tue" +const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemWed TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Wed" +const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemThu TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Thu" +const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemFri TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Fri" +const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemSat TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Sat" +const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemSun TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Sun" + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElem: required") } - if _, ok := raw["symbol"]; raw != nil && !ok { + if v, ok := raw["symbol"]; !ok || v == nil { return fmt.Errorf("field symbol in TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElem: required") } type Plain TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElem @@ -158,16 +123,18 @@ func (j *TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElem) Unmar return nil } +const TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElemMon TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = "Mon" + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingTimesRespTradingTimesMarketsElemSubmarketsElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in TradingTimesRespTradingTimesMarketsElemSubmarketsElem: required") } - if _, ok := raw["symbols"]; raw != nil && !ok { + if v, ok := raw["symbols"]; !ok || v == nil { return fmt.Errorf("field symbols in TradingTimesRespTradingTimesMarketsElemSubmarketsElem: required") } type Plain TradingTimesRespTradingTimesMarketsElemSubmarketsElem @@ -179,13 +146,23 @@ func (j *TradingTimesRespTradingTimesMarketsElemSubmarketsElem) UnmarshalJSON(b return nil } +var enumValues_TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElemTradingDaysElem = []interface{}{ + "Sun", + "Mon", + "Tue", + "Wed", + "Thu", + "Fri", + "Sat", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingTimesRespTradingTimesMarketsElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["name"]; raw != nil && !ok { + if v, ok := raw["name"]; !ok || v == nil { return fmt.Errorf("field name in TradingTimesRespTradingTimesMarketsElem: required") } type Plain TradingTimesRespTradingTimesMarketsElem @@ -197,13 +174,33 @@ func (j *TradingTimesRespTradingTimesMarketsElem) UnmarshalJSON(b []byte) error return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *TradingTimesRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_TradingTimesRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingTimesRespMsgType, v) + } + *j = TradingTimesRespMsgType(v) + return nil +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingTimesRespTradingTimes) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["markets"]; raw != nil && !ok { + if v, ok := raw["markets"]; !ok || v == nil { return fmt.Errorf("field markets in TradingTimesRespTradingTimes: required") } type Plain TradingTimesRespTradingTimes @@ -215,16 +212,20 @@ func (j *TradingTimesRespTradingTimes) UnmarshalJSON(b []byte) error { return nil } +var enumValues_TradingTimesRespMsgType = []interface{}{ + "trading_times", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TradingTimesResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TradingTimesResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TradingTimesResp: required") } type Plain TradingTimesResp diff --git a/schema/transaction.go b/schema/transaction.go index 006da7a..811ec3f 100644 --- a/schema/transaction.go +++ b/schema/transaction.go @@ -6,27 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Subscribe to transaction notifications -type Transaction struct { - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TransactionPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // If set to 1, will send updates whenever there is an update to transactions. If - // not to 1 then it will not return any records. - Subscribe TransactionSubscribe `json:"subscribe"` - - // Must be `1` - Transaction TransactionTransaction `json:"transaction"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TransactionPassthrough map[string]interface{} @@ -83,16 +62,37 @@ func (j *TransactionTransaction) UnmarshalJSON(b []byte) error { return nil } +// Subscribe to transaction notifications +type Transaction struct { + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TransactionPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // If set to 1, will send updates whenever there is an update to transactions. If + // not to 1 then it will not return any records. + Subscribe TransactionSubscribe `json:"subscribe"` + + // Must be `1` + Transaction TransactionTransaction `json:"transaction"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *Transaction) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["subscribe"]; raw != nil && !ok { + if v, ok := raw["subscribe"]; !ok || v == nil { return fmt.Errorf("field subscribe in Transaction: required") } - if _, ok := raw["transaction"]; raw != nil && !ok { + if v, ok := raw["transaction"]; !ok || v == nil { return fmt.Errorf("field transaction in Transaction: required") } type Plain Transaction diff --git a/schema/transaction_resp.go b/schema/transaction_resp.go index b392394..8403d46 100644 --- a/schema/transaction_resp.go +++ b/schema/transaction_resp.go @@ -32,30 +32,6 @@ type TransactionRespMsgType string const TransactionRespMsgTypeTransaction TransactionRespMsgType = "transaction" -var enumValues_TransactionRespMsgType = []interface{}{ - "transaction", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *TransactionRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_TransactionRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransactionRespMsgType, v) - } - *j = TransactionRespMsgType(v) - return nil -} - // For subscription requests only. type TransactionRespSubscription struct { // A per-connection unique identifier. Can be passed to the `forget` API call to @@ -63,24 +39,6 @@ type TransactionRespSubscription struct { Id string `json:"id"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *TransactionRespSubscription) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in TransactionRespSubscription: required") - } - type Plain TransactionRespSubscription - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = TransactionRespSubscription(plain) - return nil -} - // Realtime stream of user transaction updates. type TransactionRespTransaction struct { // The transaction type. @@ -110,7 +68,7 @@ type TransactionRespTransaction struct { DisplayName *string `json:"display_name,omitempty"` // The high barrier of a contract. Only applicable to double barrier contracts. - HighBarrier interface{} `json:"high_barrier,omitempty"` + HighBarrier *string `json:"high_barrier,omitempty"` // A per-connection unique identifier. Can be passed to the `forget` API call to // unsubscribe. @@ -156,8 +114,6 @@ const TransactionRespTransactionActionBuy TransactionRespTransactionAction = "bu const TransactionRespTransactionActionDeposit TransactionRespTransactionAction = "deposit" const TransactionRespTransactionActionEscrow TransactionRespTransactionAction = "escrow" const TransactionRespTransactionActionSell TransactionRespTransactionAction = "sell" -const TransactionRespTransactionActionTransfer TransactionRespTransactionAction = "transfer" -const TransactionRespTransactionActionVirtualCredit TransactionRespTransactionAction = "virtual_credit" const TransactionRespTransactionActionWithdrawal TransactionRespTransactionAction = "withdrawal" var enumValues_TransactionRespTransactionAction = []interface{}{ @@ -191,16 +147,61 @@ func (j *TransactionRespTransactionAction) UnmarshalJSON(b []byte) error { return nil } +// UnmarshalJSON implements json.Unmarshaler. +func (j *TransactionRespSubscription) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in TransactionRespSubscription: required") + } + type Plain TransactionRespSubscription + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = TransactionRespSubscription(plain) + return nil +} + +const TransactionRespTransactionActionTransfer TransactionRespTransactionAction = "transfer" +const TransactionRespTransactionActionVirtualCredit TransactionRespTransactionAction = "virtual_credit" + +// UnmarshalJSON implements json.Unmarshaler. +func (j *TransactionRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_TransactionRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransactionRespMsgType, v) + } + *j = TransactionRespMsgType(v) + return nil +} + +var enumValues_TransactionRespMsgType = []interface{}{ + "transaction", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TransactionResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TransactionResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TransactionResp: required") } type Plain TransactionResp diff --git a/schema/transfer_between_accounts.go b/schema/transfer_between_accounts.go index dc2b470..2159eff 100644 --- a/schema/transfer_between_accounts.go +++ b/schema/transfer_between_accounts.go @@ -6,49 +6,8 @@ import "encoding/json" import "fmt" import "reflect" -// This call allows transfers between accounts held by a given user. Transfer funds -// between your fiat and cryptocurrency accounts (for a fee). Please note that -// account_from should be same as current authorized account. -type TransferBetweenAccounts struct { - // [Optional] The loginid of the account to transfer funds from. - AccountFrom *string `json:"account_from,omitempty"` - - // [Optional] The loginid of the account to transfer funds to. - AccountTo *string `json:"account_to,omitempty"` - - // [Optional] To control the list of accounts returned when `account_from` or - // `account_to` is not provided. `brief` (default value) means that accounts with - // `mt5` account_type will be excluded; it will run faster. `all` means that all - // accounts with any account_type (including `mt5`) will be returned. - Accounts TransferBetweenAccountsAccounts `json:"accounts,omitempty"` - - // [Optional] The amount to transfer. - Amount *float64 `json:"amount,omitempty"` - - // [Optional] Currency code. - Currency *string `json:"currency,omitempty"` - - // [Optional] The login id of the user. Mandatory when multiple tokens were - // provided during authorize. - Loginid *string `json:"loginid,omitempty"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough TransferBetweenAccountsPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // If `account_from` or `account_to` is not provided, it just returns the - // available accounts. - TransferBetweenAccounts TransferBetweenAccountsTransferBetweenAccounts `json:"transfer_between_accounts"` -} - type TransferBetweenAccountsAccounts string -const TransferBetweenAccountsAccountsAll TransferBetweenAccountsAccounts = "all" -const TransferBetweenAccountsAccountsBrief TransferBetweenAccountsAccounts = "brief" - var enumValues_TransferBetweenAccountsAccounts = []interface{}{ "all", "brief", @@ -74,6 +33,9 @@ func (j *TransferBetweenAccountsAccounts) UnmarshalJSON(b []byte) error { return nil } +const TransferBetweenAccountsAccountsAll TransferBetweenAccountsAccounts = "all" +const TransferBetweenAccountsAccountsBrief TransferBetweenAccountsAccounts = "brief" + // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type TransferBetweenAccountsPassthrough map[string]interface{} @@ -104,13 +66,51 @@ func (j *TransferBetweenAccountsTransferBetweenAccounts) UnmarshalJSON(b []byte) return nil } +// This call allows transfers between accounts held by a given user. Transfer funds +// between your fiat and cryptocurrency accounts (for a fee). Please note that +// account_from should be same as current authorized account. +type TransferBetweenAccounts struct { + // [Optional] The loginid of the account to transfer funds from. + AccountFrom *string `json:"account_from,omitempty"` + + // [Optional] The loginid of the account to transfer funds to. + AccountTo *string `json:"account_to,omitempty"` + + // [Optional] To control the list of accounts returned when `account_from` or + // `account_to` is not provided. `brief` (default value) means that accounts with + // `mt5` account_type will be excluded; it will run faster. `all` means that all + // accounts with any account_type (including `mt5`) will be returned. + Accounts TransferBetweenAccountsAccounts `json:"accounts,omitempty"` + + // [Optional] The amount to transfer. + Amount *float64 `json:"amount,omitempty"` + + // [Optional] Currency code. + Currency *string `json:"currency,omitempty"` + + // [Optional] The login id of the user. Mandatory when multiple tokens were + // provided during authorize. + Loginid *string `json:"loginid,omitempty"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough TransferBetweenAccountsPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // If `account_from` or `account_to` is not provided, it just returns the + // available accounts. + TransferBetweenAccounts TransferBetweenAccountsTransferBetweenAccounts `json:"transfer_between_accounts"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TransferBetweenAccounts) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["transfer_between_accounts"]; raw != nil && !ok { + if v, ok := raw["transfer_between_accounts"]; !ok || v == nil { return fmt.Errorf("field transfer_between_accounts in TransferBetweenAccounts: required") } type Plain TransferBetweenAccounts diff --git a/schema/transfer_between_accounts_resp.go b/schema/transfer_between_accounts_resp.go index c522b66..c2648cc 100644 --- a/schema/transfer_between_accounts_resp.go +++ b/schema/transfer_between_accounts_resp.go @@ -85,10 +85,45 @@ type TransferBetweenAccountsRespAccountsElemAccountCategory string const TransferBetweenAccountsRespAccountsElemAccountCategoryTrading TransferBetweenAccountsRespAccountsElemAccountCategory = "trading" const TransferBetweenAccountsRespAccountsElemAccountCategoryWallet TransferBetweenAccountsRespAccountsElemAccountCategory = "wallet" -var enumValues_TransferBetweenAccountsRespAccountsElemAccountCategory = []interface{}{ - "trading", - "wallet", -} +type TransferBetweenAccountsRespAccountsElemAccountType string + +const TransferBetweenAccountsRespAccountsElemAccountTypeBinary TransferBetweenAccountsRespAccountsElemAccountType = "binary" +const TransferBetweenAccountsRespAccountsElemAccountTypeCrypto TransferBetweenAccountsRespAccountsElemAccountType = "crypto" +const TransferBetweenAccountsRespAccountsElemAccountTypeCtrader TransferBetweenAccountsRespAccountsElemAccountType = "ctrader" +const TransferBetweenAccountsRespAccountsElemAccountTypeDerivez TransferBetweenAccountsRespAccountsElemAccountType = "derivez" +const TransferBetweenAccountsRespAccountsElemAccountTypeDoughflow TransferBetweenAccountsRespAccountsElemAccountType = "doughflow" +const TransferBetweenAccountsRespAccountsElemAccountTypeDxtrade TransferBetweenAccountsRespAccountsElemAccountType = "dxtrade" +const TransferBetweenAccountsRespAccountsElemAccountTypeMt5 TransferBetweenAccountsRespAccountsElemAccountType = "mt5" +const TransferBetweenAccountsRespAccountsElemAccountTypeP2P TransferBetweenAccountsRespAccountsElemAccountType = "p2p" +const TransferBetweenAccountsRespAccountsElemAccountTypePaymentagent TransferBetweenAccountsRespAccountsElemAccountType = "paymentagent" +const TransferBetweenAccountsRespAccountsElemAccountTypePaymentagentClient TransferBetweenAccountsRespAccountsElemAccountType = "paymentagent_client" +const TransferBetweenAccountsRespAccountsElemAccountTypeStandard TransferBetweenAccountsRespAccountsElemAccountType = "standard" +const TransferBetweenAccountsRespAccountsElemAccountTypeVirtual TransferBetweenAccountsRespAccountsElemAccountType = "virtual" + +type TransferBetweenAccountsRespAccountsElemDemoAccount int + +type TransferBetweenAccountsRespAccountsElemMarketType string + +const TransferBetweenAccountsRespAccountsElemMarketTypeAll TransferBetweenAccountsRespAccountsElemMarketType = "all" +const TransferBetweenAccountsRespAccountsElemMarketTypeFinancial TransferBetweenAccountsRespAccountsElemMarketType = "financial" +const TransferBetweenAccountsRespAccountsElemMarketTypeSynthetic TransferBetweenAccountsRespAccountsElemMarketType = "synthetic" + +type TransferBetweenAccountsRespAccountsElemProduct string + +const TransferBetweenAccountsRespAccountsElemProductBlank TransferBetweenAccountsRespAccountsElemProduct = "" +const TransferBetweenAccountsRespAccountsElemProductFinancial TransferBetweenAccountsRespAccountsElemProduct = "financial" +const TransferBetweenAccountsRespAccountsElemProductStandard TransferBetweenAccountsRespAccountsElemProduct = "standard" +const TransferBetweenAccountsRespAccountsElemProductStp TransferBetweenAccountsRespAccountsElemProduct = "stp" +const TransferBetweenAccountsRespAccountsElemProductSwapFree TransferBetweenAccountsRespAccountsElemProduct = "swap_free" +const TransferBetweenAccountsRespAccountsElemProductSynthetic TransferBetweenAccountsRespAccountsElemProduct = "synthetic" +const TransferBetweenAccountsRespAccountsElemProductZeroSpread TransferBetweenAccountsRespAccountsElemProduct = "zero_spread" + +type TransferBetweenAccountsRespAccountsElemSubAccountType string + +const TransferBetweenAccountsRespAccountsElemSubAccountTypeFinancial TransferBetweenAccountsRespAccountsElemSubAccountType = "financial" +const TransferBetweenAccountsRespAccountsElemSubAccountTypeFinancialStp TransferBetweenAccountsRespAccountsElemSubAccountType = "financial_stp" +const TransferBetweenAccountsRespAccountsElemSubAccountTypeStandard TransferBetweenAccountsRespAccountsElemSubAccountType = "standard" +const TransferBetweenAccountsRespAccountsElemSubAccountTypeSwapFree TransferBetweenAccountsRespAccountsElemSubAccountType = "swap_free" // UnmarshalJSON implements json.Unmarshaler. func (j *TransferBetweenAccountsRespAccountsElemAccountCategory) UnmarshalJSON(b []byte) error { @@ -110,197 +145,138 @@ func (j *TransferBetweenAccountsRespAccountsElemAccountCategory) UnmarshalJSON(b return nil } -type TransferBetweenAccountsRespAccountsElemAccountType string - -const TransferBetweenAccountsRespAccountsElemAccountTypeBinary TransferBetweenAccountsRespAccountsElemAccountType = "binary" -const TransferBetweenAccountsRespAccountsElemAccountTypeCrypto TransferBetweenAccountsRespAccountsElemAccountType = "crypto" -const TransferBetweenAccountsRespAccountsElemAccountTypeCtrader TransferBetweenAccountsRespAccountsElemAccountType = "ctrader" -const TransferBetweenAccountsRespAccountsElemAccountTypeDerivez TransferBetweenAccountsRespAccountsElemAccountType = "derivez" -const TransferBetweenAccountsRespAccountsElemAccountTypeDoughflow TransferBetweenAccountsRespAccountsElemAccountType = "doughflow" -const TransferBetweenAccountsRespAccountsElemAccountTypeDxtrade TransferBetweenAccountsRespAccountsElemAccountType = "dxtrade" -const TransferBetweenAccountsRespAccountsElemAccountTypeMt5 TransferBetweenAccountsRespAccountsElemAccountType = "mt5" -const TransferBetweenAccountsRespAccountsElemAccountTypeP2P TransferBetweenAccountsRespAccountsElemAccountType = "p2p" -const TransferBetweenAccountsRespAccountsElemAccountTypePaymentagent TransferBetweenAccountsRespAccountsElemAccountType = "paymentagent" -const TransferBetweenAccountsRespAccountsElemAccountTypePaymentagentClient TransferBetweenAccountsRespAccountsElemAccountType = "paymentagent_client" -const TransferBetweenAccountsRespAccountsElemAccountTypeStandard TransferBetweenAccountsRespAccountsElemAccountType = "standard" -const TransferBetweenAccountsRespAccountsElemAccountTypeVirtual TransferBetweenAccountsRespAccountsElemAccountType = "virtual" - -var enumValues_TransferBetweenAccountsRespAccountsElemAccountType = []interface{}{ - "binary", - "crypto", - "ctrader", - "doughflow", - "dxtrade", - "derivez", - "mt5", - "p2p", - "paymentagent", - "paymentagent_client", - "standard", - "virtual", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemAccountType) UnmarshalJSON(b []byte) error { +func (j *TransferBetweenAccountsRespAccountsElemProduct) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemAccountType { + for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemProduct { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemAccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemProduct, v) } - *j = TransferBetweenAccountsRespAccountsElemAccountType(v) + *j = TransferBetweenAccountsRespAccountsElemProduct(v) return nil } -type TransferBetweenAccountsRespAccountsElemDemoAccount int - -var enumValues_TransferBetweenAccountsRespAccountsElemDemoAccount = []interface{}{ - 0, - 1, +var enumValues_TransferBetweenAccountsRespAccountsElemProduct = []interface{}{ + "", + "synthetic", + "financial", + "swap_free", + "zero_spread", + "standard", + "stp", } // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemDemoAccount) UnmarshalJSON(b []byte) error { - var v int +func (j *TransferBetweenAccountsRespAccountsElemAccountType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemDemoAccount { + for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemAccountType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemDemoAccount, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemAccountType, v) } - *j = TransferBetweenAccountsRespAccountsElemDemoAccount(v) + *j = TransferBetweenAccountsRespAccountsElemAccountType(v) return nil } -type TransferBetweenAccountsRespAccountsElemMarketType string - -const TransferBetweenAccountsRespAccountsElemMarketTypeAll TransferBetweenAccountsRespAccountsElemMarketType = "all" -const TransferBetweenAccountsRespAccountsElemMarketTypeFinancial TransferBetweenAccountsRespAccountsElemMarketType = "financial" -const TransferBetweenAccountsRespAccountsElemMarketTypeSynthetic TransferBetweenAccountsRespAccountsElemMarketType = "synthetic" - -var enumValues_TransferBetweenAccountsRespAccountsElemMarketType = []interface{}{ - "all", +var enumValues_TransferBetweenAccountsRespAccountsElemSubAccountType = []interface{}{ "financial", - "synthetic", + "financial_stp", + "standard", + "swap_free", + "zero_spread", } // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemMarketType) UnmarshalJSON(b []byte) error { +func (j *TransferBetweenAccountsRespAccountsElemSubAccountType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemMarketType { + for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemSubAccountType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemMarketType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemSubAccountType, v) } - *j = TransferBetweenAccountsRespAccountsElemMarketType(v) + *j = TransferBetweenAccountsRespAccountsElemSubAccountType(v) return nil } -type TransferBetweenAccountsRespAccountsElemProduct string - -const TransferBetweenAccountsRespAccountsElemProductBlank TransferBetweenAccountsRespAccountsElemProduct = "" -const TransferBetweenAccountsRespAccountsElemProductFinancial TransferBetweenAccountsRespAccountsElemProduct = "financial" -const TransferBetweenAccountsRespAccountsElemProductStandard TransferBetweenAccountsRespAccountsElemProduct = "standard" -const TransferBetweenAccountsRespAccountsElemProductStp TransferBetweenAccountsRespAccountsElemProduct = "stp" -const TransferBetweenAccountsRespAccountsElemProductSwapFree TransferBetweenAccountsRespAccountsElemProduct = "swap_free" -const TransferBetweenAccountsRespAccountsElemProductSynthetic TransferBetweenAccountsRespAccountsElemProduct = "synthetic" -const TransferBetweenAccountsRespAccountsElemProductZeroSpread TransferBetweenAccountsRespAccountsElemProduct = "zero_spread" - -var enumValues_TransferBetweenAccountsRespAccountsElemProduct = []interface{}{ - "", - "synthetic", - "financial", - "swap_free", - "zero_spread", - "standard", - "stp", +var enumValues_TransferBetweenAccountsRespAccountsElemDemoAccount = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemProduct) UnmarshalJSON(b []byte) error { - var v string +func (j *TransferBetweenAccountsRespAccountsElemDemoAccount) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemProduct { + for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemDemoAccount { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemProduct, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemDemoAccount, v) } - *j = TransferBetweenAccountsRespAccountsElemProduct(v) + *j = TransferBetweenAccountsRespAccountsElemDemoAccount(v) return nil } -type TransferBetweenAccountsRespAccountsElemSubAccountType string - -const TransferBetweenAccountsRespAccountsElemSubAccountTypeFinancial TransferBetweenAccountsRespAccountsElemSubAccountType = "financial" -const TransferBetweenAccountsRespAccountsElemSubAccountTypeFinancialStp TransferBetweenAccountsRespAccountsElemSubAccountType = "financial_stp" -const TransferBetweenAccountsRespAccountsElemSubAccountTypeStandard TransferBetweenAccountsRespAccountsElemSubAccountType = "standard" -const TransferBetweenAccountsRespAccountsElemSubAccountTypeSwapFree TransferBetweenAccountsRespAccountsElemSubAccountType = "swap_free" -const TransferBetweenAccountsRespAccountsElemSubAccountTypeZeroSpread TransferBetweenAccountsRespAccountsElemSubAccountType = "zero_spread" - -var enumValues_TransferBetweenAccountsRespAccountsElemSubAccountType = []interface{}{ +var enumValues_TransferBetweenAccountsRespAccountsElemMarketType = []interface{}{ + "all", "financial", - "financial_stp", - "standard", - "swap_free", - "zero_spread", + "synthetic", } // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemSubAccountType) UnmarshalJSON(b []byte) error { +func (j *TransferBetweenAccountsRespAccountsElemMarketType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemSubAccountType { + for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemMarketType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemSubAccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemMarketType, v) } - *j = TransferBetweenAccountsRespAccountsElemSubAccountType(v) + *j = TransferBetweenAccountsRespAccountsElemMarketType(v) return nil } -type TransferBetweenAccountsRespAccountsElemTransfers string +const TransferBetweenAccountsRespAccountsElemSubAccountTypeZeroSpread TransferBetweenAccountsRespAccountsElemSubAccountType = "zero_spread" -const TransferBetweenAccountsRespAccountsElemTransfersAll TransferBetweenAccountsRespAccountsElemTransfers = "all" -const TransferBetweenAccountsRespAccountsElemTransfersDeposit TransferBetweenAccountsRespAccountsElemTransfers = "deposit" -const TransferBetweenAccountsRespAccountsElemTransfersNone TransferBetweenAccountsRespAccountsElemTransfers = "none" -const TransferBetweenAccountsRespAccountsElemTransfersWithdrawal TransferBetweenAccountsRespAccountsElemTransfers = "withdrawal" +type TransferBetweenAccountsRespAccountsElemTransfers string var enumValues_TransferBetweenAccountsRespAccountsElemTransfers = []interface{}{ "all", @@ -329,13 +305,31 @@ func (j *TransferBetweenAccountsRespAccountsElemTransfers) UnmarshalJSON(b []byt return nil } +var enumValues_TransferBetweenAccountsRespAccountsElemAccountType = []interface{}{ + "binary", + "crypto", + "ctrader", + "doughflow", + "dxtrade", + "derivez", + "mt5", + "p2p", + "paymentagent", + "paymentagent_client", + "standard", + "virtual", +} + +const TransferBetweenAccountsRespAccountsElemTransfersAll TransferBetweenAccountsRespAccountsElemTransfers = "all" +const TransferBetweenAccountsRespAccountsElemTransfersDeposit TransferBetweenAccountsRespAccountsElemTransfers = "deposit" +const TransferBetweenAccountsRespAccountsElemTransfersNone TransferBetweenAccountsRespAccountsElemTransfers = "none" +const TransferBetweenAccountsRespAccountsElemTransfersWithdrawal TransferBetweenAccountsRespAccountsElemTransfers = "withdrawal" + // Echo of the request made. type TransferBetweenAccountsRespEchoReq map[string]interface{} type TransferBetweenAccountsRespMsgType string -const TransferBetweenAccountsRespMsgTypeTransferBetweenAccounts TransferBetweenAccountsRespMsgType = "transfer_between_accounts" - var enumValues_TransferBetweenAccountsRespMsgType = []interface{}{ "transfer_between_accounts", } @@ -360,6 +354,8 @@ func (j *TransferBetweenAccountsRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const TransferBetweenAccountsRespMsgTypeTransferBetweenAccounts TransferBetweenAccountsRespMsgType = "transfer_between_accounts" + type TransferBetweenAccountsRespTransferBetweenAccounts int var enumValues_TransferBetweenAccountsRespTransferBetweenAccounts = []interface{}{ @@ -387,16 +383,21 @@ func (j *TransferBetweenAccountsRespTransferBetweenAccounts) UnmarshalJSON(b []b return nil } +var enumValues_TransferBetweenAccountsRespAccountsElemAccountCategory = []interface{}{ + "trading", + "wallet", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *TransferBetweenAccountsResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in TransferBetweenAccountsResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in TransferBetweenAccountsResp: required") } type Plain TransferBetweenAccountsResp diff --git a/schema/unsubscribe_email.go b/schema/unsubscribe_email.go index 6f4d7c2..5ce63c5 100644 --- a/schema/unsubscribe_email.go +++ b/schema/unsubscribe_email.go @@ -6,25 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// It unsubscribe user from the email subscription. -type UnsubscribeEmail struct { - // Customer User ID. - BinaryUserId float64 `json:"binary_user_id"` - - // The generated checksum for the customer. - Checksum string `json:"checksum"` - - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough UnsubscribeEmailPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - UnsubscribeEmail UnsubscribeEmailUnsubscribeEmail `json:"unsubscribe_email"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type UnsubscribeEmailPassthrough map[string]interface{} @@ -55,19 +36,38 @@ func (j *UnsubscribeEmailUnsubscribeEmail) UnmarshalJSON(b []byte) error { return nil } +// It unsubscribe user from the email subscription. +type UnsubscribeEmail struct { + // Customer User ID. + BinaryUserId float64 `json:"binary_user_id"` + + // The generated checksum for the customer. + Checksum string `json:"checksum"` + + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough UnsubscribeEmailPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + UnsubscribeEmail UnsubscribeEmailUnsubscribeEmail `json:"unsubscribe_email"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *UnsubscribeEmail) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["binary_user_id"]; raw != nil && !ok { + if v, ok := raw["binary_user_id"]; !ok || v == nil { return fmt.Errorf("field binary_user_id in UnsubscribeEmail: required") } - if _, ok := raw["checksum"]; raw != nil && !ok { + if v, ok := raw["checksum"]; !ok || v == nil { return fmt.Errorf("field checksum in UnsubscribeEmail: required") } - if _, ok := raw["unsubscribe_email"]; raw != nil && !ok { + if v, ok := raw["unsubscribe_email"]; !ok || v == nil { return fmt.Errorf("field unsubscribe_email in UnsubscribeEmail: required") } type Plain UnsubscribeEmail diff --git a/schema/unsubscribe_email_resp.go b/schema/unsubscribe_email_resp.go index fc6fa94..c489c5f 100644 --- a/schema/unsubscribe_email_resp.go +++ b/schema/unsubscribe_email_resp.go @@ -6,26 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// The result of the unsubscribe email request. -type UnsubscribeEmailResp struct { - // Customer User ID. - BinaryUserId *float64 `json:"binary_user_id,omitempty"` - - // Echo of the request made. - EchoReq UnsubscribeEmailRespEchoReq `json:"echo_req"` - - // `1`: email notification unsubscribed sucssesfully, `0`: failed to unsubscribed - // email notification - EmailUnsubscribeStatus *UnsubscribeEmailRespEmailUnsubscribeStatus `json:"email_unsubscribe_status,omitempty"` - - // Action name of the request made. - MsgType UnsubscribeEmailRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` -} - // Echo of the request made. type UnsubscribeEmailRespEchoReq map[string]interface{} @@ -58,8 +38,6 @@ func (j *UnsubscribeEmailRespEmailUnsubscribeStatus) UnmarshalJSON(b []byte) err type UnsubscribeEmailRespMsgType string -const UnsubscribeEmailRespMsgTypeUnsubscribeEmail UnsubscribeEmailRespMsgType = "unsubscribe_email" - var enumValues_UnsubscribeEmailRespMsgType = []interface{}{ "unsubscribe_email", } @@ -84,16 +62,38 @@ func (j *UnsubscribeEmailRespMsgType) UnmarshalJSON(b []byte) error { return nil } +// The result of the unsubscribe email request. +type UnsubscribeEmailResp struct { + // Customer User ID. + BinaryUserId *float64 `json:"binary_user_id,omitempty"` + + // Echo of the request made. + EchoReq UnsubscribeEmailRespEchoReq `json:"echo_req"` + + // `1`: email notification unsubscribed sucssesfully, `0`: failed to unsubscribed + // email notification + EmailUnsubscribeStatus *UnsubscribeEmailRespEmailUnsubscribeStatus `json:"email_unsubscribe_status,omitempty"` + + // Action name of the request made. + MsgType UnsubscribeEmailRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` +} + +const UnsubscribeEmailRespMsgTypeUnsubscribeEmail UnsubscribeEmailRespMsgType = "unsubscribe_email" + // UnmarshalJSON implements json.Unmarshaler. func (j *UnsubscribeEmailResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in UnsubscribeEmailResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in UnsubscribeEmailResp: required") } type Plain UnsubscribeEmailResp diff --git a/schema/verify_email.go b/schema/verify_email.go index f6799a9..228e2df 100644 --- a/schema/verify_email.go +++ b/schema/verify_email.go @@ -48,19 +48,6 @@ const VerifyEmailTypeTradingPlatformDxtradePasswordReset VerifyEmailType = "trad const VerifyEmailTypeTradingPlatformInvestorPasswordReset VerifyEmailType = "trading_platform_investor_password_reset" const VerifyEmailTypeTradingPlatformMt5PasswordReset VerifyEmailType = "trading_platform_mt5_password_reset" -var enumValues_VerifyEmailType = []interface{}{ - "account_opening", - "account_verification", - "reset_password", - "paymentagent_withdraw", - "payment_withdraw", - "trading_platform_dxtrade_password_reset", - "trading_platform_mt5_password_reset", - "trading_platform_investor_password_reset", - "request_email", - "phone_number_verification", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *VerifyEmailType) UnmarshalJSON(b []byte) error { var v string @@ -81,6 +68,33 @@ func (j *VerifyEmailType) UnmarshalJSON(b []byte) error { return nil } +type VerifyEmailUrlParametersSignupDevice string + +var enumValues_VerifyEmailUrlParametersSignupDevice = []interface{}{ + "desktop", + "mobile", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *VerifyEmailUrlParametersSignupDevice) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_VerifyEmailUrlParametersSignupDevice { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_VerifyEmailUrlParametersSignupDevice, v) + } + *j = VerifyEmailUrlParametersSignupDevice(v) + return nil +} + // [Optional] Extra parameters that can be attached to the verify email link URL. type VerifyEmailUrlParameters struct { // [Optional] Affiliate token, within 32 characters. @@ -163,34 +177,20 @@ type VerifyEmailUrlParameters struct { UtmTerm interface{} `json:"utm_term,omitempty"` } -type VerifyEmailUrlParametersSignupDevice string - const VerifyEmailUrlParametersSignupDeviceDesktop VerifyEmailUrlParametersSignupDevice = "desktop" const VerifyEmailUrlParametersSignupDeviceMobile VerifyEmailUrlParametersSignupDevice = "mobile" -var enumValues_VerifyEmailUrlParametersSignupDevice = []interface{}{ - "desktop", - "mobile", -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *VerifyEmailUrlParametersSignupDevice) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_VerifyEmailUrlParametersSignupDevice { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_VerifyEmailUrlParametersSignupDevice, v) - } - *j = VerifyEmailUrlParametersSignupDevice(v) - return nil +var enumValues_VerifyEmailType = []interface{}{ + "account_opening", + "account_verification", + "reset_password", + "paymentagent_withdraw", + "payment_withdraw", + "trading_platform_dxtrade_password_reset", + "trading_platform_mt5_password_reset", + "trading_platform_investor_password_reset", + "request_email", + "phone_number_verification", } // UnmarshalJSON implements json.Unmarshaler. @@ -199,10 +199,10 @@ func (j *VerifyEmail) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["type"]; raw != nil && !ok { + if v, ok := raw["type"]; !ok || v == nil { return fmt.Errorf("field type in VerifyEmail: required") } - if _, ok := raw["verify_email"]; raw != nil && !ok { + if v, ok := raw["verify_email"]; !ok || v == nil { return fmt.Errorf("field verify_email in VerifyEmail: required") } type Plain VerifyEmail diff --git a/schema/verify_email_resp.go b/schema/verify_email_resp.go index fc18fc8..680bc9b 100644 --- a/schema/verify_email_resp.go +++ b/schema/verify_email_resp.go @@ -6,29 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Verify Email Receive -type VerifyEmailResp struct { - // Echo of the request made. - EchoReq VerifyEmailRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType VerifyEmailRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // 1 for success (secure code has been sent to the email address) - VerifyEmail *VerifyEmailRespVerifyEmail `json:"verify_email,omitempty"` -} - // Echo of the request made. type VerifyEmailRespEchoReq map[string]interface{} type VerifyEmailRespMsgType string -const VerifyEmailRespMsgTypeVerifyEmail VerifyEmailRespMsgType = "verify_email" - var enumValues_VerifyEmailRespMsgType = []interface{}{ "verify_email", } @@ -53,6 +35,8 @@ func (j *VerifyEmailRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const VerifyEmailRespMsgTypeVerifyEmail VerifyEmailRespMsgType = "verify_email" + type VerifyEmailRespVerifyEmail int var enumValues_VerifyEmailRespVerifyEmail = []interface{}{ @@ -80,16 +64,32 @@ func (j *VerifyEmailRespVerifyEmail) UnmarshalJSON(b []byte) error { return nil } +// Verify Email Receive +type VerifyEmailResp struct { + // Echo of the request made. + EchoReq VerifyEmailRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType VerifyEmailRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // 1 for success (secure code has been sent to the email address) + VerifyEmail *VerifyEmailRespVerifyEmail `json:"verify_email,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *VerifyEmailResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in VerifyEmailResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in VerifyEmailResp: required") } type Plain VerifyEmailResp diff --git a/schema/website_config.go b/schema/website_config.go index d060fb3..9cc07a1 100644 --- a/schema/website_config.go +++ b/schema/website_config.go @@ -6,19 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Request server config. -type WebsiteConfig struct { - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough WebsiteConfigPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // Must be `1` - WebsiteConfig WebsiteConfigWebsiteConfig `json:"website_config"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type WebsiteConfigPassthrough map[string]interface{} @@ -49,13 +36,26 @@ func (j *WebsiteConfigWebsiteConfig) UnmarshalJSON(b []byte) error { return nil } +// Request server config. +type WebsiteConfig struct { + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough WebsiteConfigPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // Must be `1` + WebsiteConfig WebsiteConfigWebsiteConfig `json:"website_config"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *WebsiteConfig) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["website_config"]; raw != nil && !ok { + if v, ok := raw["website_config"]; !ok || v == nil { return fmt.Errorf("field website_config in WebsiteConfig: required") } type Plain WebsiteConfig diff --git a/schema/website_config_resp.go b/schema/website_config_resp.go index caae9a6..ab39453 100644 --- a/schema/website_config_resp.go +++ b/schema/website_config_resp.go @@ -6,34 +6,46 @@ import "encoding/json" import "fmt" import "reflect" -// All config related settings. -type WebsiteConfigResp struct { - // Echo of the request made. - EchoReq WebsiteConfigRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType WebsiteConfigRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *WebsiteConfigRespSubscription `json:"subscription,omitempty"` - - // Server status and other information regarding general settings - WebsiteConfig *WebsiteConfigRespWebsiteConfig `json:"website_config,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *WebsiteConfigRespSubscription) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["id"]; !ok || v == nil { + return fmt.Errorf("field id in WebsiteConfigRespSubscription: required") + } + type Plain WebsiteConfigRespSubscription + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = WebsiteConfigRespSubscription(plain) + return nil } -// Echo of the request made. -type WebsiteConfigRespEchoReq map[string]interface{} - -type WebsiteConfigRespMsgType string - -const WebsiteConfigRespMsgTypeWebsiteConfig WebsiteConfigRespMsgType = "website_config" +// Initial deposit requirement per country. +type WebsiteConfigRespWebsiteConfigPaymentAgentsInitialDepositPerCountry map[string]interface{} -var enumValues_WebsiteConfigRespMsgType = []interface{}{ - "website_config", +// UnmarshalJSON implements json.Unmarshaler. +func (j *WebsiteConfigResp) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["echo_req"]; !ok || v == nil { + return fmt.Errorf("field echo_req in WebsiteConfigResp: required") + } + if v, ok := raw["msg_type"]; !ok || v == nil { + return fmt.Errorf("field msg_type in WebsiteConfigResp: required") + } + type Plain WebsiteConfigResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = WebsiteConfigResp(plain) + return nil } // UnmarshalJSON implements json.Unmarshaler. @@ -56,6 +68,8 @@ func (j *WebsiteConfigRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const WebsiteConfigRespMsgTypeWebsiteConfig WebsiteConfigRespMsgType = "website_config" + // For subscription requests only. type WebsiteConfigRespSubscription struct { // A per-connection unique identifier. Can be passed to the `forget` API call to @@ -63,21 +77,35 @@ type WebsiteConfigRespSubscription struct { Id string `json:"id"` } +type WebsiteConfigRespMsgType string + +// Available currencies and their information +type WebsiteConfigRespWebsiteConfigCurrenciesConfig map[string]interface{} + +// Echo of the request made. +type WebsiteConfigRespEchoReq map[string]interface{} + +// Payments Agents system settings. +type WebsiteConfigRespWebsiteConfigPaymentAgents struct { + // Initial deposit requirement per country. + InitialDepositPerCountry WebsiteConfigRespWebsiteConfigPaymentAgentsInitialDepositPerCountry `json:"initial_deposit_per_country"` +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *WebsiteConfigRespSubscription) UnmarshalJSON(b []byte) error { +func (j *WebsiteConfigRespWebsiteConfigPaymentAgents) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { - return fmt.Errorf("field id in WebsiteConfigRespSubscription: required") + if v, ok := raw["initial_deposit_per_country"]; !ok || v == nil { + return fmt.Errorf("field initial_deposit_per_country in WebsiteConfigRespWebsiteConfigPaymentAgents: required") } - type Plain WebsiteConfigRespSubscription + type Plain WebsiteConfigRespWebsiteConfigPaymentAgents var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = WebsiteConfigRespSubscription(plain) + *j = WebsiteConfigRespWebsiteConfigPaymentAgents(plain) return nil } @@ -101,43 +129,13 @@ type WebsiteConfigRespWebsiteConfig struct { TermsConditionsVersion *string `json:"terms_conditions_version,omitempty"` } -// Available currencies and their information -type WebsiteConfigRespWebsiteConfigCurrenciesConfig map[string]interface{} - -// Payments Agents system settings. -type WebsiteConfigRespWebsiteConfigPaymentAgents struct { - // Initial deposit requirement per country. - InitialDepositPerCountry WebsiteConfigRespWebsiteConfigPaymentAgentsInitialDepositPerCountry `json:"initial_deposit_per_country"` -} - -// Initial deposit requirement per country. -type WebsiteConfigRespWebsiteConfigPaymentAgentsInitialDepositPerCountry map[string]interface{} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *WebsiteConfigRespWebsiteConfigPaymentAgents) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["initial_deposit_per_country"]; raw != nil && !ok { - return fmt.Errorf("field initial_deposit_per_country in WebsiteConfigRespWebsiteConfigPaymentAgents: required") - } - type Plain WebsiteConfigRespWebsiteConfigPaymentAgents - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = WebsiteConfigRespWebsiteConfigPaymentAgents(plain) - return nil -} - // UnmarshalJSON implements json.Unmarshaler. func (j *WebsiteConfigRespWebsiteConfig) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["currencies_config"]; raw != nil && !ok { + if v, ok := raw["currencies_config"]; !ok || v == nil { return fmt.Errorf("field currencies_config in WebsiteConfigRespWebsiteConfig: required") } type Plain WebsiteConfigRespWebsiteConfig @@ -149,23 +147,25 @@ func (j *WebsiteConfigRespWebsiteConfig) UnmarshalJSON(b []byte) error { return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *WebsiteConfigResp) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if _, ok := raw["echo_req"]; raw != nil && !ok { - return fmt.Errorf("field echo_req in WebsiteConfigResp: required") - } - if _, ok := raw["msg_type"]; raw != nil && !ok { - return fmt.Errorf("field msg_type in WebsiteConfigResp: required") - } - type Plain WebsiteConfigResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = WebsiteConfigResp(plain) - return nil +// All config related settings. +type WebsiteConfigResp struct { + // Echo of the request made. + EchoReq WebsiteConfigRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType WebsiteConfigRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *WebsiteConfigRespSubscription `json:"subscription,omitempty"` + + // Server status and other information regarding general settings + WebsiteConfig *WebsiteConfigRespWebsiteConfig `json:"website_config,omitempty"` +} + +var enumValues_WebsiteConfigRespMsgType = []interface{}{ + "website_config", } diff --git a/schema/website_status.go b/schema/website_status.go index 526ed98..7eaab0d 100644 --- a/schema/website_status.go +++ b/schema/website_status.go @@ -6,22 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// Request server status. -type WebsiteStatus struct { - // [Optional] Used to pass data through the websocket, which may be retrieved via - // the `echo_req` output field. - Passthrough WebsiteStatusPassthrough `json:"passthrough,omitempty"` - - // [Optional] Used to map request to response. - ReqId *int `json:"req_id,omitempty"` - - // [Optional] `1` to stream the server/website status updates. - Subscribe *WebsiteStatusSubscribe `json:"subscribe,omitempty"` - - // Must be `1` - WebsiteStatus WebsiteStatusWebsiteStatus `json:"website_status"` -} - // [Optional] Used to pass data through the websocket, which may be retrieved via // the `echo_req` output field. type WebsiteStatusPassthrough map[string]interface{} @@ -79,13 +63,29 @@ func (j *WebsiteStatusWebsiteStatus) UnmarshalJSON(b []byte) error { return nil } +// Request server status. +type WebsiteStatus struct { + // [Optional] Used to pass data through the websocket, which may be retrieved via + // the `echo_req` output field. + Passthrough WebsiteStatusPassthrough `json:"passthrough,omitempty"` + + // [Optional] Used to map request to response. + ReqId *int `json:"req_id,omitempty"` + + // [Optional] `1` to stream the server/website status updates. + Subscribe *WebsiteStatusSubscribe `json:"subscribe,omitempty"` + + // Must be `1` + WebsiteStatus WebsiteStatusWebsiteStatus `json:"website_status"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *WebsiteStatus) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["website_status"]; raw != nil && !ok { + if v, ok := raw["website_status"]; !ok || v == nil { return fmt.Errorf("field website_status in WebsiteStatus: required") } type Plain WebsiteStatus diff --git a/schema/website_status_resp.go b/schema/website_status_resp.go index de2968b..56669dc 100644 --- a/schema/website_status_resp.go +++ b/schema/website_status_resp.go @@ -6,33 +6,11 @@ import "encoding/json" import "fmt" import "reflect" -// Server status alongside general settings like call limits, currencies -// information, supported languages, etc. -type WebsiteStatusResp struct { - // Echo of the request made. - EchoReq WebsiteStatusRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType WebsiteStatusRespMsgType `json:"msg_type"` - - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` - - // For subscription requests only. - Subscription *WebsiteStatusRespSubscription `json:"subscription,omitempty"` - - // Server status and other information regarding general settings - WebsiteStatus *WebsiteStatusRespWebsiteStatus `json:"website_status,omitempty"` -} - // Echo of the request made. type WebsiteStatusRespEchoReq map[string]interface{} type WebsiteStatusRespMsgType string -const WebsiteStatusRespMsgTypeWebsiteStatus WebsiteStatusRespMsgType = "website_status" - var enumValues_WebsiteStatusRespMsgType = []interface{}{ "website_status", } @@ -57,6 +35,8 @@ func (j *WebsiteStatusRespMsgType) UnmarshalJSON(b []byte) error { return nil } +const WebsiteStatusRespMsgTypeWebsiteStatus WebsiteStatusRespMsgType = "website_status" + // For subscription requests only. type WebsiteStatusRespSubscription struct { // A per-connection unique identifier. Can be passed to the `forget` API call to @@ -70,7 +50,7 @@ func (j *WebsiteStatusRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["id"]; raw != nil && !ok { + if v, ok := raw["id"]; !ok || v == nil { return fmt.Errorf("field id in WebsiteStatusRespSubscription: required") } type Plain WebsiteStatusRespSubscription @@ -82,61 +62,6 @@ func (j *WebsiteStatusRespSubscription) UnmarshalJSON(b []byte) error { return nil } -// Server status and other information regarding general settings -type WebsiteStatusRespWebsiteStatus struct { - // Maximum number of API calls during specified period of time. - ApiCallLimits WebsiteStatusRespWebsiteStatusApiCallLimits `json:"api_call_limits"` - - // List of all available broker codes. - BrokerCodes []string `json:"broker_codes,omitempty"` - - // Country code of connected IP - ClientsCountry *string `json:"clients_country,omitempty"` - - // Available currencies and their information - CurrenciesConfig WebsiteStatusRespWebsiteStatusCurrenciesConfig `json:"currencies_config"` - - // Suspension status of Dxtrade/DerivX API calls - DxtradeStatus *WebsiteStatusRespWebsiteStatusDxtradeStatus `json:"dxtrade_status,omitempty"` - - // Text for site status banner, contains problem description. shown only if set by - // the system. - Message *string `json:"message,omitempty"` - - // Suspension status of MT5 API calls - Mt5Status *WebsiteStatusRespWebsiteStatusMt5Status `json:"mt5_status,omitempty"` - - // Peer-to-peer payment system settings. - P2PConfig *WebsiteStatusRespWebsiteStatusP2PConfig `json:"p2p_config,omitempty"` - - // Payments Agents system settings. - PaymentAgents *WebsiteStatusRespWebsiteStatusPaymentAgents `json:"payment_agents,omitempty"` - - // The current status of the website. - SiteStatus *WebsiteStatusRespWebsiteStatusSiteStatus `json:"site_status,omitempty"` - - // Provides codes for languages supported. - SupportedLanguages []string `json:"supported_languages,omitempty"` - - // Latest terms and conditions version. - TermsConditionsVersion *string `json:"terms_conditions_version,omitempty"` -} - -// Maximum number of API calls during specified period of time. -type WebsiteStatusRespWebsiteStatusApiCallLimits struct { - // Maximum subscription to proposal calls. - MaxProposalSubscription WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription `json:"max_proposal_subscription"` - - // Maximum number of general requests allowed during specified period of time. - MaxRequestesGeneral WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral `json:"max_requestes_general"` - - // Maximum number of outcome requests allowed during specified period of time. - MaxRequestsOutcome WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome `json:"max_requests_outcome"` - - // Maximum number of pricing requests allowed during specified period of time. - MaxRequestsPricing WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing `json:"max_requests_pricing"` -} - // Maximum subscription to proposal calls. type WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription struct { // Describes which calls this limit applies to. @@ -152,10 +77,10 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription) Unm if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["applies_to"]; raw != nil && !ok { + if v, ok := raw["applies_to"]; !ok || v == nil { return fmt.Errorf("field applies_to in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription: required") } - if _, ok := raw["max"]; raw != nil && !ok { + if v, ok := raw["max"]; !ok || v == nil { return fmt.Errorf("field max in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription @@ -185,13 +110,13 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral) Unmarsh if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["applies_to"]; raw != nil && !ok { + if v, ok := raw["applies_to"]; !ok || v == nil { return fmt.Errorf("field applies_to in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral: required") } - if _, ok := raw["hourly"]; raw != nil && !ok { + if v, ok := raw["hourly"]; !ok || v == nil { return fmt.Errorf("field hourly in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral: required") } - if _, ok := raw["minutely"]; raw != nil && !ok { + if v, ok := raw["minutely"]; !ok || v == nil { return fmt.Errorf("field minutely in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral @@ -221,13 +146,13 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome) Unmarsha if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["applies_to"]; raw != nil && !ok { + if v, ok := raw["applies_to"]; !ok || v == nil { return fmt.Errorf("field applies_to in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome: required") } - if _, ok := raw["hourly"]; raw != nil && !ok { + if v, ok := raw["hourly"]; !ok || v == nil { return fmt.Errorf("field hourly in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome: required") } - if _, ok := raw["minutely"]; raw != nil && !ok { + if v, ok := raw["minutely"]; !ok || v == nil { return fmt.Errorf("field minutely in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome @@ -257,13 +182,13 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing) Unmarsha if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["applies_to"]; raw != nil && !ok { + if v, ok := raw["applies_to"]; !ok || v == nil { return fmt.Errorf("field applies_to in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing: required") } - if _, ok := raw["hourly"]; raw != nil && !ok { + if v, ok := raw["hourly"]; !ok || v == nil { return fmt.Errorf("field hourly in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing: required") } - if _, ok := raw["minutely"]; raw != nil && !ok { + if v, ok := raw["minutely"]; !ok || v == nil { return fmt.Errorf("field minutely in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing @@ -275,22 +200,37 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing) Unmarsha return nil } +// Maximum number of API calls during specified period of time. +type WebsiteStatusRespWebsiteStatusApiCallLimits struct { + // Maximum subscription to proposal calls. + MaxProposalSubscription WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription `json:"max_proposal_subscription"` + + // Maximum number of general requests allowed during specified period of time. + MaxRequestesGeneral WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral `json:"max_requestes_general"` + + // Maximum number of outcome requests allowed during specified period of time. + MaxRequestsOutcome WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome `json:"max_requests_outcome"` + + // Maximum number of pricing requests allowed during specified period of time. + MaxRequestsPricing WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing `json:"max_requests_pricing"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *WebsiteStatusRespWebsiteStatusApiCallLimits) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["max_proposal_subscription"]; raw != nil && !ok { + if v, ok := raw["max_proposal_subscription"]; !ok || v == nil { return fmt.Errorf("field max_proposal_subscription in WebsiteStatusRespWebsiteStatusApiCallLimits: required") } - if _, ok := raw["max_requestes_general"]; raw != nil && !ok { + if v, ok := raw["max_requestes_general"]; !ok || v == nil { return fmt.Errorf("field max_requestes_general in WebsiteStatusRespWebsiteStatusApiCallLimits: required") } - if _, ok := raw["max_requests_outcome"]; raw != nil && !ok { + if v, ok := raw["max_requests_outcome"]; !ok || v == nil { return fmt.Errorf("field max_requests_outcome in WebsiteStatusRespWebsiteStatusApiCallLimits: required") } - if _, ok := raw["max_requests_pricing"]; raw != nil && !ok { + if v, ok := raw["max_requests_pricing"]; !ok || v == nil { return fmt.Errorf("field max_requests_pricing in WebsiteStatusRespWebsiteStatusApiCallLimits: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimits @@ -326,93 +266,6 @@ type WebsiteStatusRespWebsiteStatusMt5Status struct { Real []interface{} `json:"real,omitempty"` } -// Peer-to-peer payment system settings. -type WebsiteStatusRespWebsiteStatusP2PConfig struct { - // Maximum number of active ads allowed by an advertiser per currency pair and - // advert type (buy or sell). - AdvertsActiveLimit int `json:"adverts_active_limit"` - - // Adverts will be deactivated if no activity occurs within this period, in days. - AdvertsArchivePeriod *int `json:"adverts_archive_period,omitempty"` - - // Block trading settings - BlockTrade WebsiteStatusRespWebsiteStatusP2PConfigBlockTrade `json:"block_trade"` - - // A buyer will be blocked for this duration after exceeding the cancellation - // limit, in hours. - CancellationBlockDuration int `json:"cancellation_block_duration"` - - // The period within which to count buyer cancellations, in hours. - CancellationCountPeriod int `json:"cancellation_count_period"` - - // A buyer may cancel an order within this period without negative consequences, - // in minutes after order creation. - CancellationGracePeriod int `json:"cancellation_grace_period"` - - // A buyer will be temporarily barred after marking this number of cancellations - // within cancellation_period. - CancellationLimit int `json:"cancellation_limit"` - - // When 0, only exchanges in local currency are allowed for P2P advertiser. - CrossBorderAdsEnabled WebsiteStatusRespWebsiteStatusP2PConfigCrossBorderAdsEnabled `json:"cross_border_ads_enabled"` - - // When 1, the P2P service is unavailable. - Disabled WebsiteStatusRespWebsiteStatusP2PConfigDisabled `json:"disabled"` - - // Indicates the availbility of certain backend features. - FeatureLevel int `json:"feature_level"` - - // Availability of fixed rate adverts. - FixedRateAdverts WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts `json:"fixed_rate_adverts"` - - // Date on which fixed rate adverts will be deactivated. - FixedRateAdvertsEndDate *string `json:"fixed_rate_adverts_end_date,omitempty"` - - // Availability of floating rate adverts. - FloatRateAdverts WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts `json:"float_rate_adverts"` - - // Maximum rate offset for floating rate adverts. - FloatRateOffsetLimit float64 `json:"float_rate_offset_limit"` - - // Available local currencies for p2p_advert_list request. - LocalCurrencies []WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem `json:"local_currencies"` - - // Maximum amount of an advert, in USD. - MaximumAdvertAmount float64 `json:"maximum_advert_amount"` - - // Maximum amount of an order, in USD. - MaximumOrderAmount float64 `json:"maximum_order_amount"` - - // Maximum number of orders a user may create per day. - OrderDailyLimit int `json:"order_daily_limit"` - - // Time allowed for order payment, in minutes after order creation. - OrderPaymentPeriod int `json:"order_payment_period"` - - // Local P2P exchange rate which should be used instead of those obtained from the - // `exchange_rates` call. - OverrideExchangeRate *string `json:"override_exchange_rate,omitempty"` - - // Indicates if the payment methods feature is enabled. - PaymentMethodsEnabled WebsiteStatusRespWebsiteStatusP2PConfigPaymentMethodsEnabled `json:"payment_methods_enabled"` - - // Time after successful order completion during which reviews can be created, in - // hours. - ReviewPeriod float64 `json:"review_period"` - - // List of currencies for which P2P is available - SupportedCurrencies []string `json:"supported_currencies"` -} - -// Block trading settings -type WebsiteStatusRespWebsiteStatusP2PConfigBlockTrade struct { - // When 1, Block trading is unavailable. - Disabled *WebsiteStatusRespWebsiteStatusP2PConfigBlockTradeDisabled `json:"disabled,omitempty"` - - // Maximum amount of a block trade advert, in USD. - MaximumAdvertAmount *float64 `json:"maximum_advert_amount,omitempty"` -} - type WebsiteStatusRespWebsiteStatusP2PConfigBlockTradeDisabled int var enumValues_WebsiteStatusRespWebsiteStatusP2PConfigBlockTradeDisabled = []interface{}{ @@ -440,6 +293,15 @@ func (j *WebsiteStatusRespWebsiteStatusP2PConfigBlockTradeDisabled) UnmarshalJSO return nil } +// Block trading settings +type WebsiteStatusRespWebsiteStatusP2PConfigBlockTrade struct { + // When 1, Block trading is unavailable. + Disabled *WebsiteStatusRespWebsiteStatusP2PConfigBlockTradeDisabled `json:"disabled,omitempty"` + + // Maximum amount of a block trade advert, in USD. + MaximumAdvertAmount *float64 `json:"maximum_advert_amount,omitempty"` +} + type WebsiteStatusRespWebsiteStatusP2PConfigCrossBorderAdsEnabled int var enumValues_WebsiteStatusRespWebsiteStatusP2PConfigCrossBorderAdsEnabled = []interface{}{ @@ -496,10 +358,6 @@ func (j *WebsiteStatusRespWebsiteStatusP2PConfigDisabled) UnmarshalJSON(b []byte type WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts string -const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsDisabled WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "disabled" -const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsEnabled WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "enabled" -const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsListOnly WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "list_only" - var enumValues_WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = []interface{}{ "disabled", "enabled", @@ -526,11 +384,11 @@ func (j *WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts) UnmarshalJSON( return nil } -type WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts string +const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsDisabled WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "disabled" +const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsEnabled WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "enabled" +const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsListOnly WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "list_only" -const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsDisabled WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "disabled" -const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsEnabled WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "enabled" -const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsListOnly WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "list_only" +type WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts string var enumValues_WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = []interface{}{ "disabled", @@ -558,20 +416,9 @@ func (j *WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts) UnmarshalJSON( return nil } -// Local currency details. -type WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem struct { - // Local currency name - DisplayName string `json:"display_name"` - - // Indicates that there are adverts available for this currency. - HasAdverts WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElemHasAdverts `json:"has_adverts"` - - // Indicates that this is local currency for the current country. - IsDefault *WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElemIsDefault `json:"is_default,omitempty"` - - // Local currency symbol - Symbol string `json:"symbol"` -} +const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsDisabled WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "disabled" +const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsEnabled WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "enabled" +const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsListOnly WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "list_only" type WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElemHasAdverts int @@ -626,19 +473,34 @@ func (j *WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElemIsDefault) Un return nil } +// Local currency details. +type WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem struct { + // Local currency name + DisplayName string `json:"display_name"` + + // Indicates that there are adverts available for this currency. + HasAdverts WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElemHasAdverts `json:"has_adverts"` + + // Indicates that this is local currency for the current country. + IsDefault *WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElemIsDefault `json:"is_default,omitempty"` + + // Local currency symbol + Symbol string `json:"symbol"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["display_name"]; raw != nil && !ok { + if v, ok := raw["display_name"]; !ok || v == nil { return fmt.Errorf("field display_name in WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem: required") } - if _, ok := raw["has_adverts"]; raw != nil && !ok { + if v, ok := raw["has_adverts"]; !ok || v == nil { return fmt.Errorf("field has_adverts in WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem: required") } - if _, ok := raw["symbol"]; raw != nil && !ok { + if v, ok := raw["symbol"]; !ok || v == nil { return fmt.Errorf("field symbol in WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem: required") } type Plain WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem @@ -677,70 +539,148 @@ func (j *WebsiteStatusRespWebsiteStatusP2PConfigPaymentMethodsEnabled) Unmarshal return nil } +// Peer-to-peer payment system settings. +type WebsiteStatusRespWebsiteStatusP2PConfig struct { + // Maximum number of active ads allowed by an advertiser per currency pair and + // advert type (buy or sell). + AdvertsActiveLimit int `json:"adverts_active_limit"` + + // Adverts will be deactivated if no activity occurs within this period, in days. + AdvertsArchivePeriod *int `json:"adverts_archive_period,omitempty"` + + // Block trading settings + BlockTrade WebsiteStatusRespWebsiteStatusP2PConfigBlockTrade `json:"block_trade"` + + // A buyer will be blocked for this duration after exceeding the cancellation + // limit, in hours. + CancellationBlockDuration int `json:"cancellation_block_duration"` + + // The period within which to count buyer cancellations, in hours. + CancellationCountPeriod int `json:"cancellation_count_period"` + + // A buyer may cancel an order within this period without negative consequences, + // in minutes after order creation. + CancellationGracePeriod int `json:"cancellation_grace_period"` + + // A buyer will be temporarily barred after marking this number of cancellations + // within cancellation_period. + CancellationLimit int `json:"cancellation_limit"` + + // When 0, only exchanges in local currency are allowed for P2P advertiser. + CrossBorderAdsEnabled WebsiteStatusRespWebsiteStatusP2PConfigCrossBorderAdsEnabled `json:"cross_border_ads_enabled"` + + // When 1, the P2P service is unavailable. + Disabled WebsiteStatusRespWebsiteStatusP2PConfigDisabled `json:"disabled"` + + // Indicates the availbility of certain backend features. + FeatureLevel int `json:"feature_level"` + + // Availability of fixed rate adverts. + FixedRateAdverts WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts `json:"fixed_rate_adverts"` + + // Date on which fixed rate adverts will be deactivated. + FixedRateAdvertsEndDate *string `json:"fixed_rate_adverts_end_date,omitempty"` + + // Availability of floating rate adverts. + FloatRateAdverts WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts `json:"float_rate_adverts"` + + // Maximum rate offset for floating rate adverts. + FloatRateOffsetLimit float64 `json:"float_rate_offset_limit"` + + // Available local currencies for p2p_advert_list request. + LocalCurrencies []WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem `json:"local_currencies"` + + // Maximum amount of an advert, in USD. + MaximumAdvertAmount float64 `json:"maximum_advert_amount"` + + // Maximum amount of an order, in USD. + MaximumOrderAmount float64 `json:"maximum_order_amount"` + + // Maximum number of orders a user may create per day. + OrderDailyLimit int `json:"order_daily_limit"` + + // Time allowed for order payment, in minutes after order creation. + OrderPaymentPeriod int `json:"order_payment_period"` + + // Local P2P exchange rate which should be used instead of those obtained from the + // `exchange_rates` call. + OverrideExchangeRate *string `json:"override_exchange_rate,omitempty"` + + // Indicates if the payment methods feature is enabled. + PaymentMethodsEnabled WebsiteStatusRespWebsiteStatusP2PConfigPaymentMethodsEnabled `json:"payment_methods_enabled"` + + // Time after successful order completion during which reviews can be created, in + // hours. + ReviewPeriod float64 `json:"review_period"` + + // List of currencies for which P2P is available + SupportedCurrencies []string `json:"supported_currencies"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *WebsiteStatusRespWebsiteStatusP2PConfig) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["adverts_active_limit"]; raw != nil && !ok { + if v, ok := raw["adverts_active_limit"]; !ok || v == nil { return fmt.Errorf("field adverts_active_limit in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["block_trade"]; raw != nil && !ok { + if v, ok := raw["block_trade"]; !ok || v == nil { return fmt.Errorf("field block_trade in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["cancellation_block_duration"]; raw != nil && !ok { + if v, ok := raw["cancellation_block_duration"]; !ok || v == nil { return fmt.Errorf("field cancellation_block_duration in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["cancellation_count_period"]; raw != nil && !ok { + if v, ok := raw["cancellation_count_period"]; !ok || v == nil { return fmt.Errorf("field cancellation_count_period in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["cancellation_grace_period"]; raw != nil && !ok { + if v, ok := raw["cancellation_grace_period"]; !ok || v == nil { return fmt.Errorf("field cancellation_grace_period in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["cancellation_limit"]; raw != nil && !ok { + if v, ok := raw["cancellation_limit"]; !ok || v == nil { return fmt.Errorf("field cancellation_limit in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["cross_border_ads_enabled"]; raw != nil && !ok { + if v, ok := raw["cross_border_ads_enabled"]; !ok || v == nil { return fmt.Errorf("field cross_border_ads_enabled in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["disabled"]; raw != nil && !ok { + if v, ok := raw["disabled"]; !ok || v == nil { return fmt.Errorf("field disabled in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["feature_level"]; raw != nil && !ok { + if v, ok := raw["feature_level"]; !ok || v == nil { return fmt.Errorf("field feature_level in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["fixed_rate_adverts"]; raw != nil && !ok { + if v, ok := raw["fixed_rate_adverts"]; !ok || v == nil { return fmt.Errorf("field fixed_rate_adverts in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["float_rate_adverts"]; raw != nil && !ok { + if v, ok := raw["float_rate_adverts"]; !ok || v == nil { return fmt.Errorf("field float_rate_adverts in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["float_rate_offset_limit"]; raw != nil && !ok { + if v, ok := raw["float_rate_offset_limit"]; !ok || v == nil { return fmt.Errorf("field float_rate_offset_limit in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["local_currencies"]; raw != nil && !ok { + if v, ok := raw["local_currencies"]; !ok || v == nil { return fmt.Errorf("field local_currencies in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["maximum_advert_amount"]; raw != nil && !ok { + if v, ok := raw["maximum_advert_amount"]; !ok || v == nil { return fmt.Errorf("field maximum_advert_amount in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["maximum_order_amount"]; raw != nil && !ok { + if v, ok := raw["maximum_order_amount"]; !ok || v == nil { return fmt.Errorf("field maximum_order_amount in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["order_daily_limit"]; raw != nil && !ok { + if v, ok := raw["order_daily_limit"]; !ok || v == nil { return fmt.Errorf("field order_daily_limit in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["order_payment_period"]; raw != nil && !ok { + if v, ok := raw["order_payment_period"]; !ok || v == nil { return fmt.Errorf("field order_payment_period in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["payment_methods_enabled"]; raw != nil && !ok { + if v, ok := raw["payment_methods_enabled"]; !ok || v == nil { return fmt.Errorf("field payment_methods_enabled in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["review_period"]; raw != nil && !ok { + if v, ok := raw["review_period"]; !ok || v == nil { return fmt.Errorf("field review_period in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if _, ok := raw["supported_currencies"]; raw != nil && !ok { + if v, ok := raw["supported_currencies"]; !ok || v == nil { return fmt.Errorf("field supported_currencies in WebsiteStatusRespWebsiteStatusP2PConfig: required") } type Plain WebsiteStatusRespWebsiteStatusP2PConfig @@ -767,7 +707,7 @@ func (j *WebsiteStatusRespWebsiteStatusPaymentAgents) UnmarshalJSON(b []byte) er if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["initial_deposit_per_country"]; raw != nil && !ok { + if v, ok := raw["initial_deposit_per_country"]; !ok || v == nil { return fmt.Errorf("field initial_deposit_per_country in WebsiteStatusRespWebsiteStatusPaymentAgents: required") } type Plain WebsiteStatusRespWebsiteStatusPaymentAgents @@ -781,10 +721,6 @@ func (j *WebsiteStatusRespWebsiteStatusPaymentAgents) UnmarshalJSON(b []byte) er type WebsiteStatusRespWebsiteStatusSiteStatus string -const WebsiteStatusRespWebsiteStatusSiteStatusDown WebsiteStatusRespWebsiteStatusSiteStatus = "down" -const WebsiteStatusRespWebsiteStatusSiteStatusUp WebsiteStatusRespWebsiteStatusSiteStatus = "up" -const WebsiteStatusRespWebsiteStatusSiteStatusUpdating WebsiteStatusRespWebsiteStatusSiteStatus = "updating" - var enumValues_WebsiteStatusRespWebsiteStatusSiteStatus = []interface{}{ "up", "down", @@ -811,16 +747,60 @@ func (j *WebsiteStatusRespWebsiteStatusSiteStatus) UnmarshalJSON(b []byte) error return nil } +// Server status and other information regarding general settings +type WebsiteStatusRespWebsiteStatus struct { + // Maximum number of API calls during specified period of time. + ApiCallLimits WebsiteStatusRespWebsiteStatusApiCallLimits `json:"api_call_limits"` + + // List of all available broker codes. + BrokerCodes []string `json:"broker_codes,omitempty"` + + // Country code of connected IP + ClientsCountry *string `json:"clients_country,omitempty"` + + // Available currencies and their information + CurrenciesConfig WebsiteStatusRespWebsiteStatusCurrenciesConfig `json:"currencies_config"` + + // Suspension status of Dxtrade/DerivX API calls + DxtradeStatus *WebsiteStatusRespWebsiteStatusDxtradeStatus `json:"dxtrade_status,omitempty"` + + // Text for site status banner, contains problem description. shown only if set by + // the system. + Message *string `json:"message,omitempty"` + + // Suspension status of MT5 API calls + Mt5Status *WebsiteStatusRespWebsiteStatusMt5Status `json:"mt5_status,omitempty"` + + // Peer-to-peer payment system settings. + P2PConfig *WebsiteStatusRespWebsiteStatusP2PConfig `json:"p2p_config,omitempty"` + + // Payments Agents system settings. + PaymentAgents *WebsiteStatusRespWebsiteStatusPaymentAgents `json:"payment_agents,omitempty"` + + // The current status of the website. + SiteStatus *WebsiteStatusRespWebsiteStatusSiteStatus `json:"site_status,omitempty"` + + // Provides codes for languages supported. + SupportedLanguages []string `json:"supported_languages,omitempty"` + + // Latest terms and conditions version. + TermsConditionsVersion *string `json:"terms_conditions_version,omitempty"` +} + +const WebsiteStatusRespWebsiteStatusSiteStatusDown WebsiteStatusRespWebsiteStatusSiteStatus = "down" +const WebsiteStatusRespWebsiteStatusSiteStatusUp WebsiteStatusRespWebsiteStatusSiteStatus = "up" +const WebsiteStatusRespWebsiteStatusSiteStatusUpdating WebsiteStatusRespWebsiteStatusSiteStatus = "updating" + // UnmarshalJSON implements json.Unmarshaler. func (j *WebsiteStatusRespWebsiteStatus) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["api_call_limits"]; raw != nil && !ok { + if v, ok := raw["api_call_limits"]; !ok || v == nil { return fmt.Errorf("field api_call_limits in WebsiteStatusRespWebsiteStatus: required") } - if _, ok := raw["currencies_config"]; raw != nil && !ok { + if v, ok := raw["currencies_config"]; !ok || v == nil { return fmt.Errorf("field currencies_config in WebsiteStatusRespWebsiteStatus: required") } type Plain WebsiteStatusRespWebsiteStatus @@ -832,16 +812,36 @@ func (j *WebsiteStatusRespWebsiteStatus) UnmarshalJSON(b []byte) error { return nil } +// Server status alongside general settings like call limits, currencies +// information, supported languages, etc. +type WebsiteStatusResp struct { + // Echo of the request made. + EchoReq WebsiteStatusRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType WebsiteStatusRespMsgType `json:"msg_type"` + + // Optional field sent in request to map to response, present only when request + // contains `req_id`. + ReqId *int `json:"req_id,omitempty"` + + // For subscription requests only. + Subscription *WebsiteStatusRespSubscription `json:"subscription,omitempty"` + + // Server status and other information regarding general settings + WebsiteStatus *WebsiteStatusRespWebsiteStatus `json:"website_status,omitempty"` +} + // UnmarshalJSON implements json.Unmarshaler. func (j *WebsiteStatusResp) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if _, ok := raw["echo_req"]; raw != nil && !ok { + if v, ok := raw["echo_req"]; !ok || v == nil { return fmt.Errorf("field echo_req in WebsiteStatusResp: required") } - if _, ok := raw["msg_type"]; raw != nil && !ok { + if v, ok := raw["msg_type"]; !ok || v == nil { return fmt.Errorf("field msg_type in WebsiteStatusResp: required") } type Plain WebsiteStatusResp diff --git a/subscription_calls.go b/subscription_calls.go index dc05394..71cb91f 100644 --- a/subscription_calls.go +++ b/subscription_calls.go @@ -5,166 +5,166 @@ package deriv import "github.com/ksysoev/deriv-api/schema" // SubscribeBalance Get user account balance -func (a *DerivAPI) SubscribeBalance(r schema.Balance) (rsp schema.BalanceResp, s *Subsciption[schema.BalanceResp, schema.BalanceResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeBalance(r schema.Balance) (rsp schema.BalanceResp, s *Subsciption[schema.BalanceResp, schema.BalanceResp], err error) { + id := api.getNextRequestID() var f schema.BalanceSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.BalanceResp, schema.BalanceResp](a) + s = NewSubcription[schema.BalanceResp, schema.BalanceResp](api) rsp, err = s.Start(id, r) return } // SubscribeBuy Buy a Contract -func (a *DerivAPI) SubscribeBuy(r schema.Buy) (rsp schema.BuyResp, s *Subsciption[schema.BuyResp, schema.ProposalOpenContractResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeBuy(r schema.Buy) (rsp schema.BuyResp, s *Subsciption[schema.BuyResp, schema.ProposalOpenContractResp], err error) { + id := api.getNextRequestID() var f schema.BuySubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.BuyResp, schema.ProposalOpenContractResp](a) + s = NewSubcription[schema.BuyResp, schema.ProposalOpenContractResp](api) rsp, err = s.Start(id, r) return } // SubscribeCryptoEstimations Get the current estimations for cryptocurrencies. E.g. Withdrawal fee. -func (a *DerivAPI) SubscribeCryptoEstimations(r schema.CryptoEstimations) (rsp schema.CryptoEstimationsResp, s *Subsciption[schema.CryptoEstimationsResp, schema.CryptoEstimationsResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeCryptoEstimations(r schema.CryptoEstimations) (rsp schema.CryptoEstimationsResp, s *Subsciption[schema.CryptoEstimationsResp, schema.CryptoEstimationsResp], err error) { + id := api.getNextRequestID() var f schema.CryptoEstimationsSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.CryptoEstimationsResp, schema.CryptoEstimationsResp](a) + s = NewSubcription[schema.CryptoEstimationsResp, schema.CryptoEstimationsResp](api) rsp, err = s.Start(id, r) return } // SubscribeExchangeRates Retrieves the exchange rate from a base currency to a target currency supported by the system. -func (a *DerivAPI) SubscribeExchangeRates(r schema.ExchangeRates) (rsp schema.ExchangeRatesResp, s *Subsciption[schema.ExchangeRatesResp, schema.ExchangeRatesResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeExchangeRates(r schema.ExchangeRates) (rsp schema.ExchangeRatesResp, s *Subsciption[schema.ExchangeRatesResp, schema.ExchangeRatesResp], err error) { + id := api.getNextRequestID() var f schema.ExchangeRatesSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.ExchangeRatesResp, schema.ExchangeRatesResp](a) + s = NewSubcription[schema.ExchangeRatesResp, schema.ExchangeRatesResp](api) rsp, err = s.Start(id, r) return } // SubscribeP2PAdvertInfo Retrieve information about a P2P advert. -func (a *DerivAPI) SubscribeP2PAdvertInfo(r schema.P2PAdvertInfo) (rsp schema.P2PAdvertInfoResp, s *Subsciption[schema.P2PAdvertInfoResp, schema.P2PAdvertInfoResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeP2PAdvertInfo(r schema.P2PAdvertInfo) (rsp schema.P2PAdvertInfoResp, s *Subsciption[schema.P2PAdvertInfoResp, schema.P2PAdvertInfoResp], err error) { + id := api.getNextRequestID() var f schema.P2PAdvertInfoSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.P2PAdvertInfoResp, schema.P2PAdvertInfoResp](a) + s = NewSubcription[schema.P2PAdvertInfoResp, schema.P2PAdvertInfoResp](api) rsp, err = s.Start(id, r) return } // SubscribeP2PAdvertiserCreate Registers the client as a P2P advertiser. -func (a *DerivAPI) SubscribeP2PAdvertiserCreate(r schema.P2PAdvertiserCreate) (rsp schema.P2PAdvertiserCreateResp, s *Subsciption[schema.P2PAdvertiserCreateResp, schema.P2PAdvertInfoResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeP2PAdvertiserCreate(r schema.P2PAdvertiserCreate) (rsp schema.P2PAdvertiserCreateResp, s *Subsciption[schema.P2PAdvertiserCreateResp, schema.P2PAdvertInfoResp], err error) { + id := api.getNextRequestID() var f schema.P2PAdvertiserCreateSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.P2PAdvertiserCreateResp, schema.P2PAdvertInfoResp](a) + s = NewSubcription[schema.P2PAdvertiserCreateResp, schema.P2PAdvertInfoResp](api) rsp, err = s.Start(id, r) return } // SubscribeP2PAdvertiserInfo Retrieve information about a P2P advertiser. -func (a *DerivAPI) SubscribeP2PAdvertiserInfo(r schema.P2PAdvertiserInfo) (rsp schema.P2PAdvertiserInfoResp, s *Subsciption[schema.P2PAdvertiserInfoResp, schema.P2PAdvertiserInfoResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeP2PAdvertiserInfo(r schema.P2PAdvertiserInfo) (rsp schema.P2PAdvertiserInfoResp, s *Subsciption[schema.P2PAdvertiserInfoResp, schema.P2PAdvertiserInfoResp], err error) { + id := api.getNextRequestID() var f schema.P2PAdvertiserInfoSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.P2PAdvertiserInfoResp, schema.P2PAdvertiserInfoResp](a) + s = NewSubcription[schema.P2PAdvertiserInfoResp, schema.P2PAdvertiserInfoResp](api) rsp, err = s.Start(id, r) return } // SubscribeP2POrderCreate Creates a P2P order for the specified advert. -func (a *DerivAPI) SubscribeP2POrderCreate(r schema.P2POrderCreate) (rsp schema.P2POrderCreateResp, s *Subsciption[schema.P2POrderCreateResp, schema.P2POrderInfoResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeP2POrderCreate(r schema.P2POrderCreate) (rsp schema.P2POrderCreateResp, s *Subsciption[schema.P2POrderCreateResp, schema.P2POrderInfoResp], err error) { + id := api.getNextRequestID() var f schema.P2POrderCreateSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.P2POrderCreateResp, schema.P2POrderInfoResp](a) + s = NewSubcription[schema.P2POrderCreateResp, schema.P2POrderInfoResp](api) rsp, err = s.Start(id, r) return } // SubscribeP2POrderInfo Retrieves the information about a P2P order. -func (a *DerivAPI) SubscribeP2POrderInfo(r schema.P2POrderInfo) (rsp schema.P2POrderInfoResp, s *Subsciption[schema.P2POrderInfoResp, schema.P2POrderInfoResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeP2POrderInfo(r schema.P2POrderInfo) (rsp schema.P2POrderInfoResp, s *Subsciption[schema.P2POrderInfoResp, schema.P2POrderInfoResp], err error) { + id := api.getNextRequestID() var f schema.P2POrderInfoSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.P2POrderInfoResp, schema.P2POrderInfoResp](a) + s = NewSubcription[schema.P2POrderInfoResp, schema.P2POrderInfoResp](api) rsp, err = s.Start(id, r) return } // SubscribeP2POrderList List active orders. -func (a *DerivAPI) SubscribeP2POrderList(r schema.P2POrderList) (rsp schema.P2POrderListResp, s *Subsciption[schema.P2POrderListResp, schema.P2POrderInfoResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeP2POrderList(r schema.P2POrderList) (rsp schema.P2POrderListResp, s *Subsciption[schema.P2POrderListResp, schema.P2POrderInfoResp], err error) { + id := api.getNextRequestID() var f schema.P2POrderListSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.P2POrderListResp, schema.P2POrderInfoResp](a) + s = NewSubcription[schema.P2POrderListResp, schema.P2POrderInfoResp](api) rsp, err = s.Start(id, r) return } // SubscribeP2PSettings Request P2P Settings information. -func (a *DerivAPI) SubscribeP2PSettings(r schema.P2PSettings) (rsp schema.P2PSettingsResp, s *Subsciption[schema.P2PSettingsResp, schema.P2PSettingsResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeP2PSettings(r schema.P2PSettings) (rsp schema.P2PSettingsResp, s *Subsciption[schema.P2PSettingsResp, schema.P2PSettingsResp], err error) { + id := api.getNextRequestID() var f schema.P2PSettingsSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.P2PSettingsResp, schema.P2PSettingsResp](a) + s = NewSubcription[schema.P2PSettingsResp, schema.P2PSettingsResp](api) rsp, err = s.Start(id, r) return } // SubscribeProposal Gets latest price for a specific contract. -func (a *DerivAPI) SubscribeProposal(r schema.Proposal) (rsp schema.ProposalResp, s *Subsciption[schema.ProposalResp, schema.ProposalResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeProposal(r schema.Proposal) (rsp schema.ProposalResp, s *Subsciption[schema.ProposalResp, schema.ProposalResp], err error) { + id := api.getNextRequestID() var f schema.ProposalSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.ProposalResp, schema.ProposalResp](a) + s = NewSubcription[schema.ProposalResp, schema.ProposalResp](api) rsp, err = s.Start(id, r) return } // SubscribeProposalOpenContract Get latest price (and other information) for a contract in the user's portfolio -func (a *DerivAPI) SubscribeProposalOpenContract(r schema.ProposalOpenContract) (rsp schema.ProposalOpenContractResp, s *Subsciption[schema.ProposalOpenContractResp, schema.ProposalOpenContractResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeProposalOpenContract(r schema.ProposalOpenContract) (rsp schema.ProposalOpenContractResp, s *Subsciption[schema.ProposalOpenContractResp, schema.ProposalOpenContractResp], err error) { + id := api.getNextRequestID() var f schema.ProposalOpenContractSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.ProposalOpenContractResp, schema.ProposalOpenContractResp](a) + s = NewSubcription[schema.ProposalOpenContractResp, schema.ProposalOpenContractResp](api) rsp, err = s.Start(id, r) return } // SubscribeTicks Initiate a continuous stream of spot price updates for a given symbol. -func (a *DerivAPI) SubscribeTicks(r schema.Ticks) (rsp schema.TicksResp, s *Subsciption[schema.TicksResp, schema.TicksResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeTicks(r schema.Ticks) (rsp schema.TicksResp, s *Subsciption[schema.TicksResp, schema.TicksResp], err error) { + id := api.getNextRequestID() var f schema.TicksSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.TicksResp, schema.TicksResp](a) + s = NewSubcription[schema.TicksResp, schema.TicksResp](api) rsp, err = s.Start(id, r) return } // SubscribeWebsiteStatus Request server status. -func (a *DerivAPI) SubscribeWebsiteStatus(r schema.WebsiteStatus) (rsp schema.WebsiteStatusResp, s *Subsciption[schema.WebsiteStatusResp, schema.WebsiteStatusResp], err error) { - id := a.getNextRequestID() +func (api *DerivAPI) SubscribeWebsiteStatus(r schema.WebsiteStatus) (rsp schema.WebsiteStatusResp, s *Subsciption[schema.WebsiteStatusResp, schema.WebsiteStatusResp], err error) { + id := api.getNextRequestID() var f schema.WebsiteStatusSubscribe = 1 r.ReqId = &id r.Subscribe = &f - s = NewSubcription[schema.WebsiteStatusResp, schema.WebsiteStatusResp](a) + s = NewSubcription[schema.WebsiteStatusResp, schema.WebsiteStatusResp](api) rsp, err = s.Start(id, r) return } From 5f5a2fb39a2ad93ffa1d1bd06ec00213d9ff8595 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 17:15:29 +0800 Subject: [PATCH 03/11] fix typo --- custom_subscription_calls.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_subscription_calls.go b/custom_subscription_calls.go index 5a01e98..40c6e63 100644 --- a/custom_subscription_calls.go +++ b/custom_subscription_calls.go @@ -16,7 +16,7 @@ func (api *DerivAPI) SubscribeTicksHistory(r schema.TicksHistory) (rsp schema.Ti // SubscribeTicksHistory Get historic candles data for a given symbol. func (api *DerivAPI) SubscribeCandlesHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksHistoryResp], err error) { - id := a.getNextRequestID() + id := api.getNextRequestID() var f schema.TicksHistorySubscribe = 1 r.ReqId = &id r.Subscribe = &f From 106b3c8097842271b2ab7a59661681537e02df32 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 17:19:35 +0800 Subject: [PATCH 04/11] Fix linter complains in tests --- api.go | 2 +- subscriptions_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api.go b/api.go index dba1354..4582147 100644 --- a/api.go +++ b/api.go @@ -91,7 +91,7 @@ func NewDerivAPI(endpoint string, appID int, lang string, origin string, opts .. } if lang == "" || len(lang) != 2 { - return nil, fmt.Errorf("Invalid language") + return nil, fmt.Errorf("invalid language") } query := urlEnpoint.Query() diff --git a/subscriptions_test.go b/subscriptions_test.go index 047b5cb..f54b884 100644 --- a/subscriptions_test.go +++ b/subscriptions_test.go @@ -213,7 +213,7 @@ func TestForget(t *testing.T) { sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) if sub == nil { - t.Errorf("Expected a subscription, but got nil") + t.Fatal("Expected a subscription, but got nil") } reqID := api.getNextRequestID() @@ -226,7 +226,7 @@ func TestForget(t *testing.T) { } if sub.Stream == nil { - t.Errorf("Expected a stream, but got nil") + t.Fatal("Expected a stream, but got nil") } if sub.IsActive() != true { @@ -302,7 +302,7 @@ func TestForgetFailed(t *testing.T) { sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) if sub == nil { - t.Errorf("Expected a subscription, but got nil") + t.Fatal("Expected a subscription, but got nil") } reqID := api.getNextRequestID() @@ -315,7 +315,7 @@ func TestForgetFailed(t *testing.T) { } if sub.Stream == nil { - t.Errorf("Expected a stream, but got nil") + t.Fatal("Expected a stream, but got nil") } if sub.IsActive() != true { From 77bfe8bc309b851a6866fbcb28c095c99a5592ce Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 17:20:45 +0800 Subject: [PATCH 05/11] Fix field alignment --- api.go | 32 ++++++++++++++++---------------- errors.go | 7 ++----- subscriptions.go | 4 ++-- 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/api.go b/api.go index 4582147..08c4e82 100644 --- a/api.go +++ b/api.go @@ -18,27 +18,27 @@ import ( // DerivAPI is the main struct for the DerivAPI client. type DerivAPI struct { - Origin *url.URL // The origin URL for the DerivAPI server - Endpoint *url.URL // The WebSocket endpoint URL for the DerivAPI server - AppID int // The app ID for the DerivAPI server - Lang string // The language code (ISO 639-1) for the DerivAPI server - ws *websocket.Conn // The WebSocket connection to the DerivAPI server - lastRequestID int64 // The last request ID used for the DerivAPI server - TimeOut time.Duration // The timeout duration for the DerivAPI server api calls - connectionLock sync.Mutex // A lock for the DerivAPI server connection - reqChan chan ApiReqest // A channel for sending requests to the DerivAPI server - closingChan chan int // A channel for closing the DerivAPI server connection - keepAlive bool // A flag to keep the connection alive - keepAliveOnDisconnect chan bool // A channel to keep the connection alive - keepAliveInterval time.Duration // The interval to send ping requests - debugEnabled bool // A flag to print debug messages + reqChan chan ApiReqest + Endpoint *url.URL + keepAliveOnDisconnect chan bool + Origin *url.URL + ws *websocket.Conn + closingChan chan int + Lang string + TimeOut time.Duration + lastRequestID int64 + AppID int + keepAliveInterval time.Duration + connectionLock sync.Mutex + keepAlive bool + debugEnabled bool } // ApiReqest is an interface for all API requests. type ApiReqest struct { - id int - msg []byte respChan chan []byte + msg []byte + id int } type APIResponseReqID struct { diff --git a/errors.go b/errors.go index 3d3e3f7..f3b16d7 100644 --- a/errors.go +++ b/errors.go @@ -6,12 +6,9 @@ import ( // APIError represents an error returned by the Deriv API service. type APIError struct { - // Code is a string representing the error code returned by the Deriv API service. - Code string `json:"code"` - // Message is a human-readable string describing the error. - Message string `json:"message"` - // Details is a map of additional error details. Details map[string]interface{} `json:"details"` + Code string `json:"code"` + Message string `json:"message"` } // Error returns the error message associated with the APIError. diff --git a/subscriptions.go b/subscriptions.go index cd1d0f4..5da9e9c 100644 --- a/subscriptions.go +++ b/subscriptions.go @@ -15,10 +15,10 @@ import ( type Subsciption[initResp any, Resp any] struct { API *DerivAPI Stream chan Resp - reqID int - isActive bool SubsciptionID string + reqID int statusLock sync.Mutex + isActive bool } type SubscriptionResponse struct { From 3124df6f213df7484569837b7fd5743659405b63 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 17:31:10 +0800 Subject: [PATCH 06/11] Moves magic numbers to constants --- api.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/api.go b/api.go index 08c4e82..a343ba3 100644 --- a/api.go +++ b/api.go @@ -16,6 +16,12 @@ import ( "github.com/ksysoev/deriv-api/schema" ) +const ( + // DefaultKeepAliveInterval is the default interval for sending ping requests to keep the connection alive. + keepAliveInterval = 25 * time.Second + defaultTimeout = 30 * time.Second +) + // DerivAPI is the main struct for the DerivAPI client. type DerivAPI struct { reqChan chan ApiReqest @@ -106,10 +112,10 @@ func NewDerivAPI(endpoint string, appID int, lang string, origin string, opts .. AppID: appID, Lang: lang, lastRequestID: 0, - TimeOut: 30 * time.Second, + TimeOut: defaultTimeout, connectionLock: sync.Mutex{}, closingChan: make(chan int), - keepAliveInterval: 25 * time.Second, + keepAliveInterval: keepAliveInterval, } for _, opt := range opts { From 4b554c3f1a7897226feaa516b4b33a8b83f6fe05 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 18:06:05 +0800 Subject: [PATCH 07/11] fix vertical spacing --- api.go | 34 +++++------ api_test.go | 45 ++++++++++----- custom_subscription_calls.go | 12 +++- errors.go | 2 +- helpers_test.go | 17 +++--- subscriptions.go | 15 +++-- subscriptions_test.go | 107 ++++++++++++++++++++++------------- 7 files changed, 144 insertions(+), 88 deletions(-) diff --git a/api.go b/api.go index a343ba3..4173435 100644 --- a/api.go +++ b/api.go @@ -24,7 +24,7 @@ const ( // DerivAPI is the main struct for the DerivAPI client. type DerivAPI struct { - reqChan chan ApiReqest + reqChan chan APIReqest Endpoint *url.URL keepAliveOnDisconnect chan bool Origin *url.URL @@ -40,8 +40,8 @@ type DerivAPI struct { debugEnabled bool } -// ApiReqest is an interface for all API requests. -type ApiReqest struct { +// APIReqest is an interface for all API requests. +type APIReqest struct { respChan chan []byte msg []byte id int @@ -173,7 +173,7 @@ func (api *DerivAPI) Connect() error { api.ws = ws - api.reqChan = make(chan ApiReqest) + api.reqChan = make(chan APIReqest) respChan := make(chan []byte) outputChan := make(chan []byte) @@ -195,7 +195,6 @@ func (api *DerivAPI) Connect() error { case <-onDisconnect: return } - } }(api.keepAliveInterval, api.keepAliveOnDisconnect) } @@ -235,11 +234,10 @@ func (api *DerivAPI) requestSender(wsConn *websocket.Conn, reqChan chan []byte) for req := range reqChan { api.logDebugf("Sending request: %s", req) - err := wsConn.Write(context.TODO(), websocket.MessageText, req) - - if err != nil { + if err := wsConn.Write(context.TODO(), websocket.MessageText, req); err != nil { api.logDebugf("Failed to send request: %s", err.Error()) api.Disconnect() + return } } @@ -283,7 +281,7 @@ func (api *DerivAPI) handleResponses(wsConn *websocket.Conn, respChan chan []byt // requestMapper forward requests to the Deriv API server and // responses from the WebSocket server to the appropriate channels. -func (api *DerivAPI) requestMapper(respChan chan []byte, outputChan chan []byte, reqChan chan ApiReqest, closingChan chan int) { +func (api *DerivAPI) requestMapper(respChan chan []byte, outputChan chan []byte, reqChan chan APIReqest, closingChan chan int) { responseMap := make(map[int]chan []byte) defer func() { @@ -297,29 +295,26 @@ func (api *DerivAPI) requestMapper(respChan chan []byte, outputChan chan []byte, select { case rawResp := <-respChan: var response APIResponseReqID - err := json.Unmarshal(rawResp, &response) - if err != nil { + + if err := json.Unmarshal(rawResp, &response); err != nil { continue } - channel, ok := responseMap[response.ReqID] - if ok { + if channel, ok := responseMap[response.ReqID]; ok { channel <- rawResp } case req, ok := <-reqChan: if !ok { return } + responseMap[req.id] = req.respChan outputChan <- req.msg case reqID := <-closingChan: - channel, okGet := responseMap[reqID] - - if okGet { + if channel, ok := responseMap[reqID]; ok { close(channel) delete(responseMap, reqID) } - } } } @@ -339,13 +334,13 @@ func (api *DerivAPI) Send(reqID int, request any) (chan []byte, error) { respChan := make(chan []byte) - ApiReqest := ApiReqest{ + req := APIReqest{ id: reqID, msg: msg, respChan: respChan, } - api.reqChan <- ApiReqest + api.reqChan <- req return respChan, nil } @@ -381,7 +376,6 @@ func (api *DerivAPI) SendRequest(reqID int, request any, response any) (err erro } return nil - } } diff --git a/api_test.go b/api_test.go index 6885ba0..cdfe94a 100644 --- a/api_test.go +++ b/api_test.go @@ -19,19 +19,24 @@ func TestNewDerivAPI(t *testing.T) { origin := "https://example.com" appID := 123 lang := "en" + api, err := NewDerivAPI(endpoint, appID, lang, origin) if err != nil { t.Errorf("Unexpected error: %v", err) } + if api.Endpoint.String() != endpoint+"?app_id=123&l=en" { t.Errorf("Unexpected endpoint: got %v, want %v", api.Endpoint.String(), endpoint) } + if api.Origin.String() != origin { t.Errorf("Unexpected origin: got %v, want %v", api.Origin.String(), origin) } + if api.AppID != appID { t.Errorf("Unexpected app ID: got %v, want %v", api.AppID, appID) } + if api.Lang != lang { t.Errorf("Unexpected language: got %v, want %v", api.Lang, lang) } @@ -41,8 +46,8 @@ func TestNewDerivAPI(t *testing.T) { origin = "https://example.com" appID = 123 lang = "en" - _, err = NewDerivAPI(endpoint, appID, lang, origin) - if err == nil { + + if _, err = NewDerivAPI(endpoint, appID, lang, origin); err == nil { t.Errorf("Expected error, got nil") } @@ -51,8 +56,8 @@ func TestNewDerivAPI(t *testing.T) { origin = "https://example.com" appID = -1 lang = "en" - _, err = NewDerivAPI(endpoint, appID, lang, origin) - if err == nil { + + if _, err = NewDerivAPI(endpoint, appID, lang, origin); err == nil { t.Errorf("Expected error, got nil") } @@ -61,8 +66,8 @@ func TestNewDerivAPI(t *testing.T) { origin = "https://example.com" appID = 123 lang = "eng" - _, err = NewDerivAPI(endpoint, appID, lang, origin) - if err == nil { + + if _, err = NewDerivAPI(endpoint, appID, lang, origin); err == nil { t.Errorf("Expected error, got nil") } @@ -71,8 +76,8 @@ func TestNewDerivAPI(t *testing.T) { origin = "https://example.com" appID = 123 lang = "en" - _, err = NewDerivAPI(endpoint, appID, lang, origin) - if err == nil { + + if _, err = NewDerivAPI(endpoint, appID, lang, origin); err == nil { t.Errorf("Expected error, got nil") } @@ -81,8 +86,8 @@ func TestNewDerivAPI(t *testing.T) { origin = ":invalid:" appID = 123 lang = "en" - _, err = NewDerivAPI(endpoint, appID, lang, origin) - if err == nil { + + if _, err = NewDerivAPI(endpoint, appID, lang, origin); err == nil { t.Errorf("Expected error, got nil") } } @@ -95,10 +100,13 @@ func TestGetNextRequestID(t *testing.T) { for i := 0; i < numRequests; i++ { requestID := api.getNextRequestID() + if _, ok := requestIDs[requestID]; ok { t.Errorf("Request ID %d already used", requestID) } + requestIDs[requestID] = true + orderedRequestIDs = append(orderedRequestIDs, requestID) } @@ -111,6 +119,7 @@ func TestGetNextRequestID(t *testing.T) { if id <= lastID { t.Errorf("Request IDs not increasing, lastID=%d currentID=%d", lastID, id) } + lastID = id } } @@ -215,6 +224,7 @@ func TestSend(t *testing.T) { } msg := <-respChan + testMsg := "{\"req_id\":1}" if string(msg) != testMsg { t.Errorf("Expected message to be %s, but got %s", testMsg, msg) @@ -275,7 +285,9 @@ func TestSendRequestTimeout(t *testing.T) { reqID := 1 req := schema.Ping{Ping: 1, ReqId: &reqID} + var resp schema.PingResp + err := api.SendRequest(reqID, req, &resp) if err != nil && err.Error() != "timeout" { @@ -293,9 +305,10 @@ func TestSendRequestAndGotInvalidJSON(t *testing.T) { } time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() + defer server.Close() + url := "ws://" + server.Listener.Addr().String() api, _ := NewDerivAPI(url, 123, "en", "http://example.com") _ = api.Connect() @@ -334,6 +347,7 @@ func TestSendRequest(t *testing.T) { } time.Sleep(time.Second) // to keep the connection open })) + defer server.Close() url := "ws://" + server.Listener.Addr().String() @@ -348,7 +362,9 @@ func TestSendRequest(t *testing.T) { reqID := 1 req := schema.Ping{Ping: 1, ReqId: &reqID} + var resp schema.PingResp + err = api.SendRequest(reqID, req, &resp) if err != nil { @@ -376,7 +392,9 @@ func TestSendRequestFailed(t *testing.T) { reqID := 1 req := schema.Ping{Ping: 1, ReqId: &reqID} + var resp schema.PingResp + err := api.SendRequest(reqID, req, &resp) if err == nil { @@ -440,13 +458,14 @@ func TestDebugLogs(t *testing.T) { if err != nil { t.Errorf("Failed to create pipe: %v", err) } + defer reader.Close() + log.SetOutput(writer) - scanner := bufio.NewScanner(reader) + scanner := bufio.NewScanner(reader) server := newMockWSServer(echoHandler) url := "ws://" + server.Listener.Addr().String() - api, _ := NewDerivAPI(url, 123, "en", "http://example.com", Debug) _ = api.Connect() diff --git a/custom_subscription_calls.go b/custom_subscription_calls.go index 40c6e63..fd25b39 100644 --- a/custom_subscription_calls.go +++ b/custom_subscription_calls.go @@ -4,35 +4,41 @@ import "github.com/ksysoev/deriv-api/schema" // SubscribeTicksHistory Get historic tick data for a given symbol. func (api *DerivAPI) SubscribeTicksHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksResp], err error) { - id := api.getNextRequestID() var f schema.TicksHistorySubscribe = 1 + + id := api.getNextRequestID() r.ReqId = &id r.Subscribe = &f r.Style = schema.TicksHistoryStyleTicks s = NewSubcription[schema.TicksHistoryResp, schema.TicksResp](api) rsp, err = s.Start(id, r) + return } // SubscribeTicksHistory Get historic candles data for a given symbol. func (api *DerivAPI) SubscribeCandlesHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksHistoryResp], err error) { - id := api.getNextRequestID() var f schema.TicksHistorySubscribe = 1 + + id := api.getNextRequestID() r.ReqId = &id r.Subscribe = &f r.Style = schema.TicksHistoryStyleCandles s = NewSubcription[schema.TicksHistoryResp, schema.TicksHistoryResp](api) rsp, err = s.Start(id, r) + return } // SubscribeTransaction Subscribe to transaction notifications func (api *DerivAPI) SubscribeTransaction(r schema.Transaction) (rsp schema.TransactionResp, s *Subsciption[schema.TransactionResp, schema.TransactionResp], err error) { - id := api.getNextRequestID() var f schema.TransactionSubscribe = 1 + + id := api.getNextRequestID() r.ReqId = &id r.Subscribe = f s = NewSubcription[schema.TransactionResp, schema.TransactionResp](api) rsp, err = s.Start(id, r) + return } diff --git a/errors.go b/errors.go index f3b16d7..d8d6703 100644 --- a/errors.go +++ b/errors.go @@ -29,7 +29,7 @@ type APIErrorResponse struct { func parseError(rawResponse []byte) error { var errorResponse APIErrorResponse - err := json.Unmarshal([]byte(rawResponse), &errorResponse) + err := json.Unmarshal(rawResponse, &errorResponse) if err != nil { return err } diff --git a/helpers_test.go b/helpers_test.go index 51f0535..30e9d37 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -42,13 +42,12 @@ func echoHandler(ws *websocket.Conn) { } buffer := bytes.NewBuffer(make([]byte, 0)) - _, err = buffer.ReadFrom(reader) - if err != nil { + + if _, err = buffer.ReadFrom(reader); err != nil { return } - err = ws.Write(context.Background(), msgType, buffer.Bytes()) - if err != nil { + if err = ws.Write(context.Background(), msgType, buffer.Bytes()); err != nil { return } } @@ -66,18 +65,20 @@ func onMessageHanler(cb func(ws *websocket.Conn, msgType websocket.MessageType, } buffer := bytes.NewBuffer(make([]byte, 0)) - _, err = buffer.ReadFrom(reader) - if err != nil { + + if _, err = buffer.ReadFrom(reader); err != nil { return } msg := buffer.Bytes() + wg.Add(1) + go func() { + defer wg.Done() + cb(ws, msgType, msg) - wg.Done() }() } - } } diff --git a/subscriptions.go b/subscriptions.go index 5da9e9c..ff7cac5 100644 --- a/subscriptions.go +++ b/subscriptions.go @@ -116,23 +116,29 @@ func (s *Subsciption[initResp, Resp]) Start(reqID int, request any) (initResp, e select { case <-time.After(s.API.TimeOut): s.API.logDebugf("Timeout waiting for response for request %d", reqID) + return resp, fmt.Errorf("timeout") case initResponse, ok := <-inChan: if !ok { s.API.logDebugf("Connection closed while waiting for response for request %d", reqID) + return resp, fmt.Errorf("connection closed") } + subResp, err := parseSubsciption(initResponse) if err != nil { s.API.closeRequestChannel(reqID) + return resp, err } + s.SubsciptionID = subResp.Subscription.ID err = json.Unmarshal(initResponse, &resp) if err != nil { s.API.logDebugf("Failed to parse response for request %d: %s", reqID, err.Error()) s.API.closeRequestChannel(reqID) + return resp, err } @@ -155,20 +161,20 @@ func (s *Subsciption[initResp, Resp]) messageHandler(inChan chan []byte) { } s.statusLock.Unlock() }() + for rawResponse := range inChan { - err := parseError(rawResponse) - if err != nil { + if err := parseError(rawResponse); err != nil { s.API.logDebugf("Error in subsciption message: %v", err) continue } var response Resp - err = json.Unmarshal(rawResponse, &response) - if err != nil { + if err := json.Unmarshal(rawResponse, &response); err != nil { s.API.logDebugf("Failed to parse response in subscription: %s", err.Error()) continue } + s.statusLock.Lock() s.Stream <- response s.statusLock.Unlock() @@ -184,5 +190,6 @@ func (s *Subsciption[initResp, Resp]) GetStream() chan Resp { func (s *Subsciption[initResp, Resp]) IsActive() bool { s.statusLock.Lock() defer s.statusLock.Unlock() + return s.isActive } diff --git a/subscriptions_test.go b/subscriptions_test.go index f54b884..04e39ee 100644 --- a/subscriptions_test.go +++ b/subscriptions_test.go @@ -16,9 +16,11 @@ func TestParseSubscription_ValidInput(t *testing.T) { input := []byte(`{"subscription": {"id": "123"}}`) expected := SubscriptionResponse{Subscription: SubscriptionIDResponse{ID: "123"}} result, err := parseSubsciption(input) + if err != nil { t.Errorf("Unexpected error: %v", err) } + if !reflect.DeepEqual(result, expected) { t.Errorf("Expected %+v, but got %+v", expected, result) } @@ -26,8 +28,8 @@ func TestParseSubscription_ValidInput(t *testing.T) { func TestParseSubscription_InvalidJSONInput(t *testing.T) { input := []byte(`{"subscription": {"id": "123", "status": "active"`) - _, err := parseSubsciption(input) - if err == nil { + + if _, err := parseSubsciption(input); err == nil { t.Errorf("Expected an error, but got nil") } } @@ -36,9 +38,11 @@ func TestParseSubscription_InvalidSubscriptionData(t *testing.T) { input := []byte(`{"subscription": {"id": "123", "status": "active"}, "error": {"code": "invalid_subscription"}}`) expectedErr := &APIError{Code: "invalid_subscription"} _, err := parseSubsciption(input) + if err == nil { t.Errorf("Expected an error, but got nil") } + if !reflect.DeepEqual(err, expectedErr) { t.Errorf("Expected %+v, but got %+v", expectedErr, err) } @@ -54,10 +58,12 @@ func TestParseSubscription_EmptyInput(t *testing.T) { func TestParseSubscription_EmptySubscriptionData(t *testing.T) { input := []byte(`{}`) expectedErr := fmt.Errorf("subscription ID is empty") + _, err := parseSubsciption(input) if err == nil { t.Errorf("Expected an error, but got nil") } + if errors.Is(err, expectedErr) { t.Errorf("Expected %+v, but got %+v", expectedErr, err) } @@ -66,6 +72,7 @@ func TestParseSubscription_EmptySubscriptionData(t *testing.T) { func TestNewNewSubcription(t *testing.T) { api, _ := NewDerivAPI("ws://example.com", 123, "en", "http://example.com") sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) + if sub == nil { t.Errorf("Expected a subscription, but got nil") } @@ -98,12 +105,13 @@ func TestStart(t *testing.T) { ws.Write(context.Background(), websocket.MessageText, []byte(testResp)) time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() defer server.Close() + + url := "ws://" + server.Listener.Addr().String() api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - err := api.Connect() - if err != nil { + + if err := api.Connect(); err != nil { t.Errorf("Unexpected error: %v", err) } @@ -114,7 +122,9 @@ func TestStart(t *testing.T) { } reqID := 1 + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} initResp, err := sub.Start(reqID, req) @@ -141,6 +151,7 @@ func TestStart(t *testing.T) { } sub.Start(reqID, req) + if sub.IsActive() == false { t.Errorf("Expected subscription to be active, but got inactive") } @@ -152,14 +163,18 @@ func TestStartFailed(t *testing.T) { ws.Write(context.Background(), websocket.MessageText, []byte("")) time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() + server.Close() + + url := "ws://" + server.Listener.Addr().String() api, _ := NewDerivAPI(url, 123, "en", "http://example.com") sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) reqID := 1 + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} _, err := sub.Start(reqID, req) @@ -194,19 +209,20 @@ func TestForget(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - for resp := range responses { ws.Write(context.Background(), websocket.MessageText, []byte(resp)) } time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() + defer server.Close() + url := "ws://" + server.Listener.Addr().String() + api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - err := api.Connect() - if err != nil { + + if err := api.Connect(); err != nil { t.Errorf("Unexpected error: %v", err) } @@ -217,11 +233,12 @@ func TestForget(t *testing.T) { } reqID := api.getNextRequestID() + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} - _, err = sub.Start(reqID, req) - if err != nil { + if _, err := sub.Start(reqID, req); err != nil { t.Errorf("Unexpected error: %v", err) } @@ -283,19 +300,19 @@ func TestForgetFailed(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - for resp := range responses { ws.Write(context.Background(), websocket.MessageText, []byte(resp)) } time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() + defer server.Close() + url := "ws://" + server.Listener.Addr().String() api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - err := api.Connect() - if err != nil { + + if err := api.Connect(); err != nil { t.Errorf("Unexpected error: %v", err) } @@ -306,9 +323,11 @@ func TestForgetFailed(t *testing.T) { } reqID := api.getNextRequestID() + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} - _, err = sub.Start(reqID, req) + _, err := sub.Start(reqID, req) if err != nil { t.Errorf("Unexpected error: %v", err) @@ -336,9 +355,8 @@ func TestForgetFailed(t *testing.T) { } }` }() - err = sub.Forget() - if err == nil { + if err = sub.Forget(); err == nil { t.Errorf("Expected error, but got nil") } @@ -366,11 +384,13 @@ func TestStartAPIError(t *testing.T) { ws.Write(context.Background(), websocket.MessageText, []byte(testResp)) time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() + defer server.Close() + + url := "ws://" + server.Listener.Addr().String() api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - err := api.Connect() - if err != nil { + + if err := api.Connect(); err != nil { t.Errorf("Unexpected error: %v", err) } @@ -381,11 +401,12 @@ func TestStartAPIError(t *testing.T) { } reqID := 1 + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} - _, err = sub.Start(reqID, req) - if err == nil { + if _, err := sub.Start(reqID, req); err == nil { t.Errorf("Expected an error, but got nil") } } @@ -405,11 +426,12 @@ func TestStartInvalidResponse(t *testing.T) { time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() defer server.Close() + + url := "ws://" + server.Listener.Addr().String() api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - err := api.Connect() - if err != nil { + + if err := api.Connect(); err != nil { t.Errorf("Unexpected error: %v", err) } @@ -420,11 +442,12 @@ func TestStartInvalidResponse(t *testing.T) { } reqID := 1 + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} - _, err = sub.Start(reqID, req) - if err == nil { + if _, err := sub.Start(reqID, req); err == nil { t.Errorf("Expected an error, but got nil") } } @@ -454,18 +477,19 @@ func TestStartInvalidResponseInSubscription(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - for _, resp := range responses { ws.Write(context.Background(), websocket.MessageText, []byte(resp)) } time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() + defer server.Close() + + url := "ws://" + server.Listener.Addr().String() api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - err := api.Connect() - if err != nil { + + if err := api.Connect(); err != nil { t.Errorf("Unexpected error: %v", err) } @@ -476,7 +500,9 @@ func TestStartInvalidResponseInSubscription(t *testing.T) { } reqID := 1 + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} initResp, err := sub.Start(reqID, req) @@ -497,7 +523,6 @@ func TestStartInvalidResponseInSubscription(t *testing.T) { } case <-time.After(time.Millisecond): } - } func TestStartAPIErrorInSubscription(t *testing.T) { @@ -536,18 +561,19 @@ func TestStartAPIErrorInSubscription(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - for _, resp := range responses { ws.Write(context.Background(), websocket.MessageText, []byte(resp)) } time.Sleep(time.Second) // to keep the connection open })) - url := "ws://" + server.Listener.Addr().String() + defer server.Close() + + url := "ws://" + server.Listener.Addr().String() api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - err := api.Connect() - if err != nil { + + if err := api.Connect(); err != nil { t.Errorf("Unexpected error: %v", err) } @@ -558,7 +584,9 @@ func TestStartAPIErrorInSubscription(t *testing.T) { } reqID := 1 + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} initResp, err := sub.Start(reqID, req) @@ -579,7 +607,6 @@ func TestStartAPIErrorInSubscription(t *testing.T) { } case <-time.After(time.Millisecond): } - } func TestStartTimeout(t *testing.T) { @@ -596,7 +623,9 @@ func TestStartTimeout(t *testing.T) { sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) reqID := 1 + var f schema.TicksSubscribe = 1 + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} _, err := sub.Start(reqID, req) From 35f0c6f6a36e1939f0c0b16226ff2773d6b573a0 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 18:15:42 +0800 Subject: [PATCH 08/11] Address linter complains --- bin/generate_calls.go | 34 ++++++++++++++++++++-------------- go.mod | 2 ++ go.sum | 2 ++ 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/bin/generate_calls.go b/bin/generate_calls.go index 023a372..008b8aa 100644 --- a/bin/generate_calls.go +++ b/bin/generate_calls.go @@ -3,25 +3,27 @@ package main import ( "encoding/json" "fmt" - "io/ioutil" "log" "os" "strings" + + "golang.org/x/text/cases" + "golang.org/x/text/language" ) const ( // API_CALLS is the file name for the api calls - API_CALLS = "./calls.go" + APICalls = "./calls.go" // SUBSCRIPTION_CALLS is the file name for the subscription calls - SUBSCRIPTION_CALLS = "./subscription_calls.go" + SubscriptionCalls = "./subscription_calls.go" // SCHEMA_PATH is the path to the schema files - SCHEMA_PATH = "./deriv-api-docs/config/v3/" + SchemaPath = "./deriv-api-docs/config/v3/" ) func main() { - files, err := ioutil.ReadDir(SCHEMA_PATH) + files, err := os.ReadDir(SchemaPath) if err != nil { log.Fatal(err) } @@ -32,6 +34,7 @@ func main() { for _, file := range files { name := file.Name() request, err := os.ReadFile("deriv-api-docs/config/v3/" + name + "/send.json") + if err != nil { log.Fatal(err) } @@ -47,15 +50,15 @@ func main() { description, _ := requestSchema["description"].(string) - apiCalls += CreateApiCallFunction(title, description) + apiCalls += CreateAPICallFunction(title, description) if HasSubscribe(requestSchema) { subcriptionCalls += CreateSubscriptionCallFunction(title, description) } } - os.WriteFile(API_CALLS, []byte(apiCalls), 0644) - os.WriteFile(SUBSCRIPTION_CALLS, []byte(subcriptionCalls), 0644) + os.WriteFile(APICalls, []byte(apiCalls), 0644) + os.WriteFile(SubscriptionCalls, []byte(subcriptionCalls), 0644) } func HasSubscribe(r map[string]any) bool { @@ -68,6 +71,7 @@ func HasSubscribe(r map[string]any) bool { if !ok { return false } + _, ok = properties["subscribe"] return ok @@ -75,30 +79,32 @@ func HasSubscribe(r map[string]any) bool { func CreateTitle(name string) string { var title string + for _, s := range strings.Split(name, "_") { if s == "p2p" { s = "P2P" } - title = title + strings.Title(s) + + title += cases.Title(language.Tag{}).String(s) } return title } -func CreateApiCallFunction(title string, description string) string { +func CreateAPICallFunction(title, description string) string { signature := fmt.Sprintf("// %s %s\nfunc (api *DerivAPI) %s(r schema.%s) (resp schema.%sResp, err error)", title, description, title, title, title) - body := fmt.Sprintf( - `id := api.getNextRequestID() + body := `id := api.getNextRequestID() r.ReqId = &id err = api.SendRequest(id, r, &resp) - return`) + return` return fmt.Sprintf("%s {\n\t%s\n}\n\n", signature, body) } -func CreateSubscriptionCallFunction(title string, description string) string { +func CreateSubscriptionCallFunction(title, description string) string { initResp := title + "Resp" + var Resp string switch title { diff --git a/go.mod b/go.mod index 08c876b..4c4bd72 100644 --- a/go.mod +++ b/go.mod @@ -3,3 +3,5 @@ module github.com/ksysoev/deriv-api go 1.20 require github.com/coder/websocket v1.8.12 + +require golang.org/x/text v0.17.0 // indirect diff --git a/go.sum b/go.sum index 029cf47..b64e844 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo= github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= From 8301bd09644d2cd0952a65adda05a166c60706d2 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 18:46:10 +0800 Subject: [PATCH 09/11] Address linter complains --- api.go | 19 ++++++++-------- api_test.go | 11 +++++++-- bin/generate_calls.go | 14 +++++++++--- errors_test.go | 10 ++++----- helpers_test.go | 4 +--- subscriptions_test.go | 52 +++++++++++++++++++++++++++++++++---------- 6 files changed, 74 insertions(+), 36 deletions(-) diff --git a/api.go b/api.go index 4173435..15fbf6a 100644 --- a/api.go +++ b/api.go @@ -51,7 +51,7 @@ type APIResponseReqID struct { ReqID int `json:"req_id"` } -type DerivApiOption func(api *DerivAPI) +type APIOption func(api *DerivAPI) // NewDerivAPI creates a new instance of DerivAPI by parsing and validating the given // endpoint URL, appID, language, and origin URL. It returns a pointer to a DerivAPI object @@ -62,9 +62,9 @@ type DerivApiOption func(api *DerivAPI) // - appID: int - The app ID for the DerivAPI server // - lang: string - The language code (ISO 639-1) for the DerivAPI server // - origin: string - The origin URL for the DerivAPI server -// - opts: DerivApiOption - A variadic list of DerivApiOption functions to configure the DerivAPI object (optional) -// - KeepAlive: A DerivApiOption function to keep the connection alive by sending ping requests. -// - Debug: A DerivApiOption function to enable debug messages. +// - opts: APIOption - A variadic list of APIOption functions to configure the DerivAPI object (optional) +// - KeepAlive: A APIOption function to keep the connection alive by sending ping requests. +// - Debug: A APIOption function to enable debug messages. // // Returns: // - *DerivAPI: A pointer to a new instance of DerivAPI with the validated endpoint, appID, @@ -77,7 +77,7 @@ type DerivApiOption func(api *DerivAPI) // if err != nil { // log.Fatal(err) // } -func NewDerivAPI(endpoint string, appID int, lang string, origin string, opts ...DerivApiOption) (*DerivAPI, error) { +func NewDerivAPI(endpoint string, appID int, lang, origin string, opts ...APIOption) (*DerivAPI, error) { urlEnpoint, err := url.Parse(endpoint) if err != nil { return nil, err @@ -281,7 +281,7 @@ func (api *DerivAPI) handleResponses(wsConn *websocket.Conn, respChan chan []byt // requestMapper forward requests to the Deriv API server and // responses from the WebSocket server to the appropriate channels. -func (api *DerivAPI) requestMapper(respChan chan []byte, outputChan chan []byte, reqChan chan APIReqest, closingChan chan int) { +func (api *DerivAPI) requestMapper(respChan, outputChan chan []byte, reqChan chan APIReqest, closingChan chan int) { responseMap := make(map[int]chan []byte) defer func() { @@ -346,7 +346,7 @@ func (api *DerivAPI) Send(reqID int, request any) (chan []byte, error) { } // SendRequest sends a request to the Deriv API and returns the response -func (api *DerivAPI) SendRequest(reqID int, request any, response any) (err error) { +func (api *DerivAPI) SendRequest(reqID int, request, response any) error { respChan, err := api.Send(reqID, request) if err != nil { @@ -365,12 +365,11 @@ func (api *DerivAPI) SendRequest(reqID int, request any, response any) (err erro return fmt.Errorf("connection closed") } - if err = parseError(responseJSON); err != nil { + if err := parseError(responseJSON); err != nil { return err } - err = json.Unmarshal(responseJSON, response) - if err != nil { + if err := json.Unmarshal(responseJSON, response); err != nil { api.logDebugf("Failed to parse response for request %d: %s", reqID, err.Error()) return err } diff --git a/api_test.go b/api_test.go index cdfe94a..fb6885d 100644 --- a/api_test.go +++ b/api_test.go @@ -430,7 +430,11 @@ func TestKeepConnectionAlive(t *testing.T) { api, _ := NewDerivAPI(url, 123, "en", "http://example.com", KeepAlive) api.keepAliveInterval = time.Millisecond - api.Connect() + + if err := api.Connect(); err != nil { + t.Errorf("Failed to connect to mocked WebSocket server: %v", err) + } + select { case msg := <-resChan: if msg == "" { @@ -442,7 +446,10 @@ func TestKeepConnectionAlive(t *testing.T) { api.Disconnect() api.keepAlive = false - api.Connect() + + if err := api.Connect(); err != nil { + t.Errorf("Failed to connect to mocked WebSocket server: %v", err) + } select { case msg, ok := <-resChan: diff --git a/bin/generate_calls.go b/bin/generate_calls.go index 008b8aa..2915d08 100644 --- a/bin/generate_calls.go +++ b/bin/generate_calls.go @@ -20,6 +20,8 @@ const ( // SCHEMA_PATH is the path to the schema files SchemaPath = "./deriv-api-docs/config/v3/" + + fileMode = 0o600 ) func main() { @@ -57,8 +59,13 @@ func main() { } } - os.WriteFile(APICalls, []byte(apiCalls), 0644) - os.WriteFile(SubscriptionCalls, []byte(subcriptionCalls), 0644) + if err := os.WriteFile(APICalls, []byte(apiCalls), fileMode); err != nil { + log.Fatal(err) + } + + if err := os.WriteFile(SubscriptionCalls, []byte(subcriptionCalls), fileMode); err != nil { + log.Fatal(err) + } } func HasSubscribe(r map[string]any) bool { @@ -82,7 +89,8 @@ func CreateTitle(name string) string { for _, s := range strings.Split(name, "_") { if s == "p2p" { - s = "P2P" + title += "P2P" + continue } title += cases.Title(language.Tag{}).String(s) diff --git a/errors_test.go b/errors_test.go index f781e87..0ad96a3 100644 --- a/errors_test.go +++ b/errors_test.go @@ -57,11 +57,10 @@ func TestParseError_InvalidResponse(t *testing.T) { func TestParseError_EmptyErrorResponse(t *testing.T) { rawResponse := []byte("{}") - expected := (error)(nil) actual := parseError(rawResponse) - if actual != expected { - t.Errorf("parseError() returned %v, expected %v", actual, expected) + if actual != nil { + t.Errorf("parseError() returned %v, expected %v", actual, nil) } } @@ -75,10 +74,9 @@ func TestParseError_EmptyAPIError(t *testing.T) { t.Errorf("Unexpected error: %v", err) } - expected := (error)(nil) actual := parseError(rawResponse) - if actual != expected { - t.Errorf("parseError() returned %v, expected %v", actual, expected) + if actual != nil { + t.Errorf("parseError() returned %v, expected %v", actual, nil) } } diff --git a/helpers_test.go b/helpers_test.go index 30e9d37..cf7cac6 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -18,7 +18,7 @@ func newMockWSServer(cb func(ws *websocket.Conn)) *httptest.Server { if err != nil { return } - defer c.CloseNow() + defer func() { _ = c.CloseNow() }() cb(c) @@ -29,8 +29,6 @@ func newMockWSServer(cb func(ws *websocket.Conn)) *httptest.Server { } func echoHandler(ws *websocket.Conn) { - defer ws.CloseNow() - for { msgType, reader, err := ws.Reader(context.TODO()) if err != nil { diff --git a/subscriptions_test.go b/subscriptions_test.go index 04e39ee..0027806 100644 --- a/subscriptions_test.go +++ b/subscriptions_test.go @@ -101,8 +101,13 @@ func TestStart(t *testing.T) { }` server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - ws.Write(context.Background(), websocket.MessageText, []byte(testResp)) - ws.Write(context.Background(), websocket.MessageText, []byte(testResp)) + if err := ws.Write(context.Background(), websocket.MessageText, []byte(testResp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } + + if err := ws.Write(context.Background(), websocket.MessageText, []byte(testResp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } time.Sleep(time.Second) // to keep the connection open })) @@ -150,7 +155,9 @@ func TestStart(t *testing.T) { t.Errorf("Expected to get a response, but got nothing") } - sub.Start(reqID, req) + if _, err := sub.Start(reqID, req); err != nil { + t.Errorf("Unexpected error: %v", err) + } if sub.IsActive() == false { t.Errorf("Expected subscription to be active, but got inactive") @@ -160,7 +167,9 @@ func TestStart(t *testing.T) { func TestStartFailed(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - ws.Write(context.Background(), websocket.MessageText, []byte("")) + if err := ws.Write(context.Background(), websocket.MessageText, []byte("")); err != nil { + t.Errorf("Unexpected error: %v", err) + } time.Sleep(time.Second) // to keep the connection open })) @@ -210,7 +219,9 @@ func TestForget(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { for resp := range responses { - ws.Write(context.Background(), websocket.MessageText, []byte(resp)) + if err := ws.Write(context.Background(), websocket.MessageText, []byte(resp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } } time.Sleep(time.Second) // to keep the connection open @@ -261,13 +272,18 @@ func TestForget(t *testing.T) { "msg_type": "forget" }` }() - sub.Forget() + + if err := sub.Forget(); err != nil { + t.Errorf("Unexpected error: %v", err) + } if sub.IsActive() == true { t.Errorf("Expected subscription to be deactivated, but got true") } - sub.Forget() + if err := sub.Forget(); err != nil { + t.Errorf("Unexpected error: %v", err) + } if sub.IsActive() == true { t.Errorf("Expected subscription to be deactivated, but got true") @@ -301,7 +317,9 @@ func TestForgetFailed(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { for resp := range responses { - ws.Write(context.Background(), websocket.MessageText, []byte(resp)) + if err := ws.Write(context.Background(), websocket.MessageText, []byte(resp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } } time.Sleep(time.Second) // to keep the connection open @@ -381,7 +399,10 @@ func TestStartAPIError(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - ws.Write(context.Background(), websocket.MessageText, []byte(testResp)) + if err := ws.Write(context.Background(), websocket.MessageText, []byte(testResp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } + time.Sleep(time.Second) // to keep the connection open })) @@ -422,7 +443,10 @@ func TestStartInvalidResponse(t *testing.T) { }` server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - ws.Write(context.Background(), websocket.MessageText, []byte(testResp)) + if err := ws.Write(context.Background(), websocket.MessageText, []byte(testResp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } + time.Sleep(time.Second) // to keep the connection open })) @@ -478,7 +502,9 @@ func TestStartInvalidResponseInSubscription(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { for _, resp := range responses { - ws.Write(context.Background(), websocket.MessageText, []byte(resp)) + if err := ws.Write(context.Background(), websocket.MessageText, []byte(resp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } } time.Sleep(time.Second) // to keep the connection open @@ -562,7 +588,9 @@ func TestStartAPIErrorInSubscription(t *testing.T) { server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { for _, resp := range responses { - ws.Write(context.Background(), websocket.MessageText, []byte(resp)) + if err := ws.Write(context.Background(), websocket.MessageText, []byte(resp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } } time.Sleep(time.Second) // to keep the connection open From c610fc3e71e1142c074ab615b18e8ae7cab7891f Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 19:03:42 +0800 Subject: [PATCH 10/11] Address linter complains --- api.go | 2 +- custom_subscription_calls.go | 4 + subscriptions_test.go | 202 +++++++++-------------------------- 3 files changed, 57 insertions(+), 151 deletions(-) diff --git a/api.go b/api.go index 15fbf6a..fb66544 100644 --- a/api.go +++ b/api.go @@ -23,7 +23,7 @@ const ( ) // DerivAPI is the main struct for the DerivAPI client. -type DerivAPI struct { +type DerivAPI struct { //nolint:revive // don't want to change the name for now reqChan chan APIReqest Endpoint *url.URL keepAliveOnDisconnect chan bool diff --git a/custom_subscription_calls.go b/custom_subscription_calls.go index fd25b39..019ed9d 100644 --- a/custom_subscription_calls.go +++ b/custom_subscription_calls.go @@ -3,6 +3,8 @@ package deriv import "github.com/ksysoev/deriv-api/schema" // SubscribeTicksHistory Get historic tick data for a given symbol. +// +//nolint:gocritic // don't want to break backward compatibility for now func (api *DerivAPI) SubscribeTicksHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksResp], err error) { var f schema.TicksHistorySubscribe = 1 @@ -17,6 +19,8 @@ func (api *DerivAPI) SubscribeTicksHistory(r schema.TicksHistory) (rsp schema.Ti } // SubscribeTicksHistory Get historic candles data for a given symbol. +// +//nolint:gocritic // don't want to break backward compatibility for now func (api *DerivAPI) SubscribeCandlesHistory(r schema.TicksHistory) (rsp schema.TicksHistoryResp, s *Subsciption[schema.TicksHistoryResp, schema.TicksHistoryResp], err error) { var f schema.TicksHistorySubscribe = 1 diff --git a/subscriptions_test.go b/subscriptions_test.go index 0027806..81300ec 100644 --- a/subscriptions_test.go +++ b/subscriptions_test.go @@ -383,171 +383,72 @@ func TestForgetFailed(t *testing.T) { } } -func TestStartAPIError(t *testing.T) { - testResp := `{ - "echo_req": { - "subscribe": 1, - "ticks": "R_50" +func TestStartInvalidResponses(t *testing.T) { + tests := []struct{ name, resp string }{ + { + name: "InvalidResponse", + resp: `{ + "req_id": 1, + "msg_type": "tick", + "subscription": { + "id": "9ed45a5e-8f87-c735-2b63-36108719eadd" + }, + "tick": 1 + }`, + }, + { + name: "APIError", + resp: `{ + "echo_req": { + "subscribe": 1, + "ticks": "R_50" + }, + "req_id": 1, + "msg_type": "tick", + "error": { + "code": "WrongRequest", + "message": "Invalid request" + } + }`, }, - "req_id": 1, - "msg_type": "tick", - "error": { - "code": "WrongRequest", - "message": "Invalid request" - } - }` - - server := newMockWSServer( - onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - if err := ws.Write(context.Background(), websocket.MessageText, []byte(testResp)); err != nil { - t.Errorf("Unexpected error: %v", err) - } - - time.Sleep(time.Second) // to keep the connection open - })) - - defer server.Close() - - url := "ws://" + server.Listener.Addr().String() - api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - - if err := api.Connect(); err != nil { - t.Errorf("Unexpected error: %v", err) - } - - sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) - - if sub == nil { - t.Errorf("Expected a subscription, but got nil") } - reqID := 1 + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + server := newMockWSServer( + onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { + if err := ws.Write(context.Background(), websocket.MessageText, []byte(test.resp)); err != nil { + t.Errorf("Unexpected error: %v", err) + } - var f schema.TicksSubscribe = 1 + time.Sleep(time.Second) // to keep the connection open + })) - req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} + defer server.Close() - if _, err := sub.Start(reqID, req); err == nil { - t.Errorf("Expected an error, but got nil") - } -} + url := "ws://" + server.Listener.Addr().String() + api, _ := NewDerivAPI(url, 123, "en", "http://example.com") -func TestStartInvalidResponse(t *testing.T) { - testResp := `{ - "req_id": 1, - "msg_type": "tick", - "subscription": { - "id": "9ed45a5e-8f87-c735-2b63-36108719eadd" - }, - "tick": 1 - }` - server := newMockWSServer( - onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - if err := ws.Write(context.Background(), websocket.MessageText, []byte(testResp)); err != nil { + if err := api.Connect(); err != nil { t.Errorf("Unexpected error: %v", err) } - time.Sleep(time.Second) // to keep the connection open - })) - - defer server.Close() - - url := "ws://" + server.Listener.Addr().String() - api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - - if err := api.Connect(); err != nil { - t.Errorf("Unexpected error: %v", err) - } - - sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) - - if sub == nil { - t.Errorf("Expected a subscription, but got nil") - } - - reqID := 1 - - var f schema.TicksSubscribe = 1 - - req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} - - if _, err := sub.Start(reqID, req); err == nil { - t.Errorf("Expected an error, but got nil") - } -} - -func TestStartInvalidResponseInSubscription(t *testing.T) { - responses := []string{`{ - "echo_req": { - "subscribe": 1, - "ticks": "R_50" - }, - "req_id": 1, - "msg_type": "tick", - "subscription": { - "id": "9ed45a5e-8f87-c735-2b63-36108719eadd" - }, - "tick": { - "ask": 186.9688, - "bid": 186.9488, - "epoch": 1679722832, - "id": "9ed45a5e-8f87-c735-2b63-36108719eadd", - "pip_size": 4, - "quote": 186.9588, - "symbol": "R_50" - } - }`, - `{ "req_id": 1 }`} + sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) - server := newMockWSServer( - onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { - for _, resp := range responses { - if err := ws.Write(context.Background(), websocket.MessageText, []byte(resp)); err != nil { - t.Errorf("Unexpected error: %v", err) - } + if sub == nil { + t.Errorf("Expected a subscription, but got nil") } - time.Sleep(time.Second) // to keep the connection open - })) - - defer server.Close() - - url := "ws://" + server.Listener.Addr().String() - api, _ := NewDerivAPI(url, 123, "en", "http://example.com") - - if err := api.Connect(); err != nil { - t.Errorf("Unexpected error: %v", err) - } - - sub := NewSubcription[schema.TicksResp, schema.TicksResp](api) - - if sub == nil { - t.Errorf("Expected a subscription, but got nil") - } - - reqID := 1 - - var f schema.TicksSubscribe = 1 - - req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} - initResp, err := sub.Start(reqID, req) + reqID := 1 - if err != nil { - t.Errorf("Expected no error, but got %v", err) - } + var f schema.TicksSubscribe = 1 - // First message - if *initResp.Tick.Quote != 186.9588 { - t.Errorf("Expected message to be %v, but got %v", 186.9588, *initResp.Tick.Quote) - } + req := schema.Ticks{Ticks: "R50", Subscribe: &f, ReqId: &reqID} - // Second message - select { - case tick, ok := <-sub.GetStream(): - if ok { - t.Errorf("Expected to get noting, but got response: %v", tick) - } - case <-time.After(time.Millisecond): + if _, err := sub.Start(reqID, req); err == nil { + t.Errorf("Expected an error, but got nil") + } + }) } } @@ -583,7 +484,8 @@ func TestStartAPIErrorInSubscription(t *testing.T) { "code": "InvalidSymbol", "message": "Invalid symbol" } - }`} + }`, + `{ "req_id": 1 }`} server := newMockWSServer( onMessageHanler(func(ws *websocket.Conn, _ websocket.MessageType, _ []byte) { From b3ea2b21ac140c16699970ec477444811ea1bdd0 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Sat, 17 Aug 2024 19:05:32 +0800 Subject: [PATCH 11/11] Adds golangci-lint to github actions --- .github/workflows/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 29f16b3..2469ba7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,10 @@ jobs: - name: Display Go version run: go version - + - name: Code Lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.55.2 - name: Build run: go build -v . - name: Test