diff --git a/schema/account_list.go b/schema/account_list.go index 9a0f7c0..2267a08 100644 --- a/schema/account_list.go +++ b/schema/account_list.go @@ -6,6 +6,19 @@ 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{}{ @@ -32,19 +45,6 @@ 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 v, ok := raw["account_list"]; !ok || v == nil { + if _, ok := raw["account_list"]; raw != nil && !ok { 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 53db515..d4801c4 100644 --- a/schema/account_list_resp.go +++ b/schema/account_list_resp.go @@ -62,129 +62,109 @@ type AccountListRespAccountListElemAccountCategory string const AccountListRespAccountListElemAccountCategoryTrading AccountListRespAccountListElemAccountCategory = "trading" const AccountListRespAccountListElemAccountCategoryWallet AccountListRespAccountListElemAccountCategory = "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"` +var enumValues_AccountListRespAccountListElemAccountCategory = []interface{}{ + "trading", + "wallet", } -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 *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 v, ok := raw["account_category"]; !ok || v == nil { - return fmt.Errorf("field account_category in AccountListRespAccountListElem: required") - } - if v, ok := raw["account_type"]; !ok || v == nil { - return fmt.Errorf("field account_type in AccountListRespAccountListElem: required") - } - 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") + 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 } -var enumValues_AccountListRespAccountListElemLinkedToElemPlatform = []interface{}{ - "ctrader", - "derivez", - "dtrade", - "dwallet", - "dxtrade", - "mt5", +type AccountListRespAccountListElemIsDisabled int + +var enumValues_AccountListRespAccountListElemIsDisabled = []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 AccountListRespAccountListElemIsVirtual int + var enumValues_AccountListRespAccountListElemIsVirtual = []interface{}{ 1, 0, } // 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 } -var enumValues_AccountListRespAccountListElemIsDisabled = []interface{}{ - 1, - 0, +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", } // UnmarshalJSON implements json.Unmarshaler. @@ -208,27 +188,54 @@ func (j *AccountListRespAccountListElemLinkedToElemPlatform) UnmarshalJSON(b []b } // 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 _, ok := raw["account_category"]; raw != nil && !ok { + 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 _, ok := raw["account_type"]; raw != nil && !ok { + return fmt.Errorf("field account_type in AccountListRespAccountListElem: required") } - *j = AccountListRespAccountListElemAccountCategory(v) + 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") + } + type Plain AccountListRespAccountListElem + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = AccountListRespAccountListElem(plain) 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", } @@ -253,23 +260,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AccountListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 efd6fb4..778153f 100644 --- a/schema/active_symbols.go +++ b/schema/active_symbols.go @@ -45,6 +45,31 @@ 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 ActiveSymbolsContractTypeElem string const ActiveSymbolsContractTypeElemACCU ActiveSymbolsContractTypeElem = "ACCU" @@ -86,36 +111,6 @@ 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_ActiveSymbolsContractTypeElem = []interface{}{ "MULTUP", "MULTDOWN", @@ -177,27 +172,22 @@ func (j *ActiveSymbolsContractTypeElem) UnmarshalJSON(b []byte) error { return nil } -// 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 ActiveSymbolsLandingCompany string -var enumValues_ActiveSymbolsLandingCompany = []interface{}{ +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", @@ -226,56 +216,68 @@ func (j *ActiveSymbolsLandingCompanyShort) UnmarshalJSON(b []byte) error { return nil } -var enumValues_ActiveSymbolsProductType = []interface{}{ - "basic", +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 *ActiveSymbolsProductType) UnmarshalJSON(b []byte) error { +func (j *ActiveSymbolsLandingCompany) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ActiveSymbolsProductType { + for _, expected := range enumValues_ActiveSymbolsLandingCompany { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsProductType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsLandingCompany, v) } - *j = ActiveSymbolsProductType(v) + *j = ActiveSymbolsLandingCompany(v) return nil } -var enumValues_ActiveSymbolsLandingCompanyShort = []interface{}{ - "iom", - "malta", - "maltainvest", - "svg", - "virtual", - "vanuatu", +// [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_ActiveSymbolsProductType = []interface{}{ + "basic", } // UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsLandingCompany) UnmarshalJSON(b []byte) error { +func (j *ActiveSymbolsProductType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ActiveSymbolsLandingCompany { + for _, expected := range enumValues_ActiveSymbolsProductType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsLandingCompany, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ActiveSymbolsProductType, v) } - *j = ActiveSymbolsLandingCompany(v) + *j = ActiveSymbolsProductType(v) return nil } @@ -285,7 +287,7 @@ func (j *ActiveSymbols) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["active_symbols"]; !ok || v == nil { + if _, ok := raw["active_symbols"]; raw != nil && !ok { 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 21787ab..886b95b 100644 --- a/schema/active_symbols_resp.go +++ b/schema/active_symbols_resp.go @@ -6,44 +6,20 @@ import "encoding/json" import "fmt" import "reflect" -// 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 -} +// A message containing the list of active symbols. +type ActiveSymbolsResp struct { + // List of active symbols. + ActiveSymbols []ActiveSymbolsRespActiveSymbolsElem `json:"active_symbols,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 + // 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"` } // The information about each symbol. @@ -120,60 +96,35 @@ type ActiveSymbolsRespActiveSymbolsElem struct { SymbolType string `json:"symbol_type"` } +type ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting int + +var enumValues_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsRespActiveSymbolsElem) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - if v, ok := raw["display_name"]; !ok || v == nil { - return fmt.Errorf("field display_name in ActiveSymbolsRespActiveSymbolsElem: required") - } - if v, ok := raw["display_order"]; !ok || v == nil { - return fmt.Errorf("field display_order in ActiveSymbolsRespActiveSymbolsElem: required") - } - 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") + var ok bool + for _, expected := range enumValues_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain ActiveSymbolsRespActiveSymbolsElem - 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_ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting, v) } - *j = ActiveSymbolsRespActiveSymbolsElem(plain) + *j = ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting(v) return nil } +type ActiveSymbolsRespActiveSymbolsElemExchangeIsOpen int + var enumValues_ActiveSymbolsRespActiveSymbolsElemExchangeIsOpen = []interface{}{ 0, 1, @@ -207,38 +158,86 @@ var enumValues_ActiveSymbolsRespActiveSymbolsElemIsTradingSuspended = []interfac } // UnmarshalJSON implements json.Unmarshaler. -func (j *ActiveSymbolsResp) UnmarshalJSON(b []byte) error { +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 { 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 ActiveSymbolsResp: required") + if _, ok := raw["display_name"]; raw != nil && !ok { + return fmt.Errorf("field display_name in ActiveSymbolsRespActiveSymbolsElem: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { - return fmt.Errorf("field msg_type in ActiveSymbolsResp: required") + if _, ok := raw["display_order"]; raw != nil && !ok { + return fmt.Errorf("field display_order in ActiveSymbolsRespActiveSymbolsElem: required") } - type Plain ActiveSymbolsResp + 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 _, ok := raw["symbol_type"]; raw != nil && !ok { + 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 = ActiveSymbolsResp(plain) + *j = ActiveSymbolsRespActiveSymbolsElem(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", } @@ -263,22 +262,23 @@ func (j *ActiveSymbolsRespMsgType) UnmarshalJSON(b []byte) error { 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"` +// 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 } - -type ActiveSymbolsRespActiveSymbolsElemAllowForwardStarting int diff --git a/schema/api_token.go b/schema/api_token.go index 6edf38a..b47f811 100644 --- a/schema/api_token.go +++ b/schema/api_token.go @@ -38,40 +38,38 @@ type ApiToken struct { type ApiTokenApiToken int -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 +var enumValues_ApiTokenApiToken = []interface{}{ + 1, +} // 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 } +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", @@ -81,25 +79,31 @@ var enumValues_ApiTokenNewTokenScopesElem = []interface{}{ } // 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 } +// [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, @@ -125,17 +129,13 @@ 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 v, ok := raw["api_token"]; !ok || v == nil { + if _, ok := raw["api_token"]; raw != nil && !ok { 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 5900159..e208724 100644 --- a/schema/api_token_resp.go +++ b/schema/api_token_resp.go @@ -36,86 +36,34 @@ type ApiTokenRespApiToken struct { type ApiTokenRespApiTokenDeleteToken int -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 *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 +var enumValues_ApiTokenRespApiTokenDeleteToken = []interface{}{ + 1, } // 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 } -var enumValues_ApiTokenRespApiTokenTokensElemScopesElem = []interface{}{ - "read", - "trade", - "trading_information", - "payments", - "admin", +type ApiTokenRespApiTokenNewToken int + +var enumValues_ApiTokenRespApiTokenNewToken = []interface{}{ + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -138,26 +86,67 @@ 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 *ApiTokenRespApiTokenDeleteToken) UnmarshalJSON(b []byte) error { - var v int +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 } +// Echo of the request made. +type ApiTokenRespEchoReq map[string]interface{} + +type ApiTokenRespMsgType string + +const ApiTokenRespMsgTypeApiToken ApiTokenRespMsgType = "api_token" + var enumValues_ApiTokenRespMsgType = []interface{}{ "api_token", } @@ -182,11 +171,23 @@ func (j *ApiTokenRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const ApiTokenRespMsgTypeApiToken ApiTokenRespMsgType = "api_token" - -var enumValues_ApiTokenRespApiTokenDeleteToken = []interface{}{ - 1, -} -var enumValues_ApiTokenRespApiTokenNewToken = []interface{}{ - 1, +// 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 } diff --git a/schema/app_delete.go b/schema/app_delete.go index 0669fda..ec9359e 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 v, ok := raw["app_delete"]; !ok || v == nil { + if _, ok := raw["app_delete"]; raw != nil && !ok { 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 d242d6a..d8407e7 100644 --- a/schema/app_delete_resp.go +++ b/schema/app_delete_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AppDeleteResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 368dfad..32cb403 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 v, ok := raw["app_get"]; !ok || v == nil { + if _, ok := raw["app_get"]; raw != nil && !ok { 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 bb4352f..1660c2f 100644 --- a/schema/app_get_resp.go +++ b/schema/app_get_resp.go @@ -6,6 +6,22 @@ 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. @@ -50,31 +66,31 @@ func (j *AppGetRespAppGet) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["app_id"]; !ok || v == nil { + if _, ok := raw["app_id"]; raw != nil && !ok { return fmt.Errorf("field app_id in AppGetRespAppGet: required") } - if v, ok := raw["app_markup_percentage"]; !ok || v == nil { + if _, ok := raw["app_markup_percentage"]; raw != nil && !ok { return fmt.Errorf("field app_markup_percentage in AppGetRespAppGet: required") } - if v, ok := raw["appstore"]; !ok || v == nil { + if _, ok := raw["appstore"]; raw != nil && !ok { return fmt.Errorf("field appstore in AppGetRespAppGet: required") } - if v, ok := raw["github"]; !ok || v == nil { + if _, ok := raw["github"]; raw != nil && !ok { return fmt.Errorf("field github in AppGetRespAppGet: required") } - if v, ok := raw["googleplay"]; !ok || v == nil { + if _, ok := raw["googleplay"]; raw != nil && !ok { return fmt.Errorf("field googleplay in AppGetRespAppGet: required") } - if v, ok := raw["homepage"]; !ok || v == nil { + if _, ok := raw["homepage"]; raw != nil && !ok { return fmt.Errorf("field homepage in AppGetRespAppGet: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in AppGetRespAppGet: required") } - if v, ok := raw["redirect_uri"]; !ok || v == nil { + if _, ok := raw["redirect_uri"]; raw != nil && !ok { return fmt.Errorf("field redirect_uri in AppGetRespAppGet: required") } - if v, ok := raw["verification_uri"]; !ok || v == nil { + if _, ok := raw["verification_uri"]; raw != nil && !ok { return fmt.Errorf("field verification_uri in AppGetRespAppGet: required") } type Plain AppGetRespAppGet @@ -91,6 +107,8 @@ type AppGetRespEchoReq map[string]interface{} type AppGetRespMsgType string +const AppGetRespMsgTypeAppGet AppGetRespMsgType = "app_get" + var enumValues_AppGetRespMsgType = []interface{}{ "app_get", } @@ -115,34 +133,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AppGetResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 1d30d4f..beb9e29 100644 --- a/schema/app_list.go +++ b/schema/app_list.go @@ -6,6 +6,23 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["app_list"]; !ok || v == nil { + if _, ok := raw["app_list"]; raw != nil && !ok { 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 bb10c00..c90f5d2 100644 --- a/schema/app_list_resp.go +++ b/schema/app_list_resp.go @@ -6,6 +6,22 @@ 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"` @@ -49,31 +65,31 @@ func (j *AppListRespAppListElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["app_id"]; !ok || v == nil { + if _, ok := raw["app_id"]; raw != nil && !ok { return fmt.Errorf("field app_id in AppListRespAppListElem: required") } - if v, ok := raw["app_markup_percentage"]; !ok || v == nil { + if _, ok := raw["app_markup_percentage"]; raw != nil && !ok { return fmt.Errorf("field app_markup_percentage in AppListRespAppListElem: required") } - if v, ok := raw["appstore"]; !ok || v == nil { + if _, ok := raw["appstore"]; raw != nil && !ok { return fmt.Errorf("field appstore in AppListRespAppListElem: required") } - if v, ok := raw["github"]; !ok || v == nil { + if _, ok := raw["github"]; raw != nil && !ok { return fmt.Errorf("field github in AppListRespAppListElem: required") } - if v, ok := raw["googleplay"]; !ok || v == nil { + if _, ok := raw["googleplay"]; raw != nil && !ok { return fmt.Errorf("field googleplay in AppListRespAppListElem: required") } - if v, ok := raw["homepage"]; !ok || v == nil { + if _, ok := raw["homepage"]; raw != nil && !ok { return fmt.Errorf("field homepage in AppListRespAppListElem: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in AppListRespAppListElem: required") } - if v, ok := raw["redirect_uri"]; !ok || v == nil { + if _, ok := raw["redirect_uri"]; raw != nil && !ok { return fmt.Errorf("field redirect_uri in AppListRespAppListElem: required") } - if v, ok := raw["verification_uri"]; !ok || v == nil { + if _, ok := raw["verification_uri"]; raw != nil && !ok { return fmt.Errorf("field verification_uri in AppListRespAppListElem: required") } type Plain AppListRespAppListElem @@ -90,6 +106,8 @@ type AppListRespEchoReq map[string]interface{} type AppListRespMsgType string +const AppListRespMsgTypeAppList AppListRespMsgType = "app_list" + var enumValues_AppListRespMsgType = []interface{}{ "app_list", } @@ -114,34 +132,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AppListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 250900d..c07ef08 100644 --- a/schema/app_markup_details.go +++ b/schema/app_markup_details.go @@ -54,42 +54,8 @@ type AppMarkupDetails struct { type AppMarkupDetailsAppMarkupDetails int -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 +var enumValues_AppMarkupDetailsAppMarkupDetails = []interface{}{ + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -112,6 +78,8 @@ func (j *AppMarkupDetailsAppMarkupDetails) UnmarshalJSON(b []byte) error { return nil } +type AppMarkupDetailsDescription int + var enumValues_AppMarkupDetailsDescription = []interface{}{ 0, 1, @@ -137,6 +105,21 @@ 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", @@ -163,12 +146,29 @@ func (j *AppMarkupDetailsSortFieldsElem) UnmarshalJSON(b []byte) error { return nil } -const AppMarkupDetailsSortFieldsElemAppId AppMarkupDetailsSortFieldsElem = "app_id" -const AppMarkupDetailsSortFieldsElemClientLoginid AppMarkupDetailsSortFieldsElem = "client_loginid" -const AppMarkupDetailsSortFieldsElemTransactionTime AppMarkupDetailsSortFieldsElem = "transaction_time" +var enumValues_AppMarkupDetailsSort = []interface{}{ + "ASC", + "DESC", +} -var enumValues_AppMarkupDetailsAppMarkupDetails = []interface{}{ - 1, +// 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. @@ -177,13 +177,13 @@ func (j *AppMarkupDetails) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["app_markup_details"]; !ok || v == nil { + if _, ok := raw["app_markup_details"]; raw != nil && !ok { return fmt.Errorf("field app_markup_details in AppMarkupDetails: required") } - if v, ok := raw["date_from"]; !ok || v == nil { + if _, ok := raw["date_from"]; raw != nil && !ok { return fmt.Errorf("field date_from in AppMarkupDetails: required") } - if v, ok := raw["date_to"]; !ok || v == nil { + if _, ok := raw["date_to"]; raw != nil && !ok { 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 9ca3e10..5b44e0f 100644 --- a/schema/app_markup_details_resp.go +++ b/schema/app_markup_details_resp.go @@ -6,6 +6,22 @@ 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 @@ -50,6 +66,8 @@ type AppMarkupDetailsRespEchoReq map[string]interface{} type AppMarkupDetailsRespMsgType string +const AppMarkupDetailsRespMsgTypeAppMarkupDetails AppMarkupDetailsRespMsgType = "app_markup_details" + var enumValues_AppMarkupDetailsRespMsgType = []interface{}{ "app_markup_details", } @@ -74,34 +92,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AppMarkupDetailsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 3fdfe04..b12d20d 100644 --- a/schema/app_markup_statistics.go +++ b/schema/app_markup_statistics.go @@ -6,6 +6,29 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,29 +55,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["app_markup_statistics"]; !ok || v == nil { + if _, ok := raw["app_markup_statistics"]; raw != nil && !ok { return fmt.Errorf("field app_markup_statistics in AppMarkupStatistics: required") } - if v, ok := raw["date_from"]; !ok || v == nil { + if _, ok := raw["date_from"]; raw != nil && !ok { return fmt.Errorf("field date_from in AppMarkupStatistics: required") } - if v, ok := raw["date_to"]; !ok || v == nil { + if _, ok := raw["date_to"]; raw != nil && !ok { 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 eae2923..1c887b2 100644 --- a/schema/app_markup_statistics_resp.go +++ b/schema/app_markup_statistics_resp.go @@ -6,6 +6,22 @@ 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 @@ -40,6 +56,8 @@ type AppMarkupStatisticsRespEchoReq map[string]interface{} type AppMarkupStatisticsRespMsgType string +const AppMarkupStatisticsRespMsgTypeAppMarkupStatistics AppMarkupStatisticsRespMsgType = "app_markup_statistics" + var enumValues_AppMarkupStatisticsRespMsgType = []interface{}{ "app_markup_statistics", } @@ -64,34 +82,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AppMarkupStatisticsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 d6e820f..50f4f42 100644 --- a/schema/app_register.go +++ b/schema/app_register.go @@ -6,76 +6,6 @@ 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 @@ -126,15 +56,42 @@ 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", @@ -142,3 +99,47 @@ 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 8cff39a..76e7bb5 100644 --- a/schema/app_register_resp.go +++ b/schema/app_register_resp.go @@ -6,6 +6,22 @@ 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. @@ -50,31 +66,31 @@ func (j *AppRegisterRespAppRegister) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["app_id"]; !ok || v == nil { + if _, ok := raw["app_id"]; raw != nil && !ok { return fmt.Errorf("field app_id in AppRegisterRespAppRegister: required") } - if v, ok := raw["app_markup_percentage"]; !ok || v == nil { + if _, ok := raw["app_markup_percentage"]; raw != nil && !ok { return fmt.Errorf("field app_markup_percentage in AppRegisterRespAppRegister: required") } - if v, ok := raw["appstore"]; !ok || v == nil { + if _, ok := raw["appstore"]; raw != nil && !ok { return fmt.Errorf("field appstore in AppRegisterRespAppRegister: required") } - if v, ok := raw["github"]; !ok || v == nil { + if _, ok := raw["github"]; raw != nil && !ok { return fmt.Errorf("field github in AppRegisterRespAppRegister: required") } - if v, ok := raw["googleplay"]; !ok || v == nil { + if _, ok := raw["googleplay"]; raw != nil && !ok { return fmt.Errorf("field googleplay in AppRegisterRespAppRegister: required") } - if v, ok := raw["homepage"]; !ok || v == nil { + if _, ok := raw["homepage"]; raw != nil && !ok { return fmt.Errorf("field homepage in AppRegisterRespAppRegister: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in AppRegisterRespAppRegister: required") } - if v, ok := raw["redirect_uri"]; !ok || v == nil { + if _, ok := raw["redirect_uri"]; raw != nil && !ok { return fmt.Errorf("field redirect_uri in AppRegisterRespAppRegister: required") } - if v, ok := raw["verification_uri"]; !ok || v == nil { + if _, ok := raw["verification_uri"]; raw != nil && !ok { return fmt.Errorf("field verification_uri in AppRegisterRespAppRegister: required") } type Plain AppRegisterRespAppRegister @@ -91,6 +107,8 @@ type AppRegisterRespEchoReq map[string]interface{} type AppRegisterRespMsgType string +const AppRegisterRespMsgTypeAppRegister AppRegisterRespMsgType = "app_register" + var enumValues_AppRegisterRespMsgType = []interface{}{ "app_register", } @@ -115,34 +133,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AppRegisterResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 f510801..6c29332 100644 --- a/schema/app_update.go +++ b/schema/app_update.go @@ -6,40 +6,6 @@ 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 @@ -88,25 +54,59 @@ 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 v, ok := raw["app_update"]; !ok || v == nil { + if _, ok := raw["app_update"]; raw != nil && !ok { return fmt.Errorf("field app_update in AppUpdate: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in AppUpdate: required") } - if v, ok := raw["scopes"]; !ok || v == nil { + if _, ok := raw["scopes"]; raw != nil && !ok { 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 f0eb654..d228998 100644 --- a/schema/app_update_resp.go +++ b/schema/app_update_resp.go @@ -6,6 +6,22 @@ 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. @@ -49,6 +65,8 @@ type AppUpdateRespEchoReq map[string]interface{} type AppUpdateRespMsgType string +const AppUpdateRespMsgTypeAppUpdate AppUpdateRespMsgType = "app_update" + var enumValues_AppUpdateRespMsgType = []interface{}{ "app_update", } @@ -73,34 +91,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AppUpdateResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 ca0a626..2403756 100644 --- a/schema/asset_index.go +++ b/schema/asset_index.go @@ -34,6 +34,30 @@ 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" @@ -78,30 +102,19 @@ 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 @@ -126,25 +139,13 @@ 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 v, ok := raw["asset_index"]; !ok || v == nil { + if _, ok := raw["asset_index"]; raw != nil && !ok { 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 d10debb..b99fd86 100644 --- a/schema/asset_index_resp.go +++ b/schema/asset_index_resp.go @@ -6,11 +6,30 @@ 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", } @@ -35,35 +54,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AssetIndexResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in AssetIndexResp: required") } type Plain AssetIndexResp diff --git a/schema/authorize.go b/schema/authorize.go index c205284..a0d5ec1 100644 --- a/schema/authorize.go +++ b/schema/authorize.go @@ -6,6 +6,30 @@ 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 + 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 10 tokens. + Tokens []string `json:"tokens,omitempty"` +} + type AuthorizeAddToLoginHistory int var enumValues_AuthorizeAddToLoginHistory = []interface{}{ @@ -33,30 +57,6 @@ 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 - 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 10 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{} @@ -67,7 +67,7 @@ func (j *Authorize) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["authorize"]; !ok || v == nil { + if _, ok := raw["authorize"]; raw != nil && !ok { return fmt.Errorf("field authorize in Authorize: required") } type Plain Authorize diff --git a/schema/authorize_resp.go b/schema/authorize_resp.go index 720606a..803c4cc 100644 --- a/schema/authorize_resp.go +++ b/schema/authorize_resp.go @@ -121,108 +121,10 @@ 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 { @@ -244,6 +146,13 @@ 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 @@ -264,6 +173,13 @@ 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 @@ -284,30 +200,59 @@ func (j *AuthorizeRespAuthorizeAccountListElemIsVirtual) UnmarshalJSON(b []byte) return nil } -var enumValues_AuthorizeRespMsgType = []interface{}{ - "authorize", +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *AuthorizeRespMsgType) UnmarshalJSON(b []byte) error { +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_AuthorizeRespMsgType { + 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_AuthorizeRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform, v) } - *j = AuthorizeRespMsgType(v) + *j = AuthorizeRespAuthorizeAccountListElemLinkedToElemPlatform(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 @@ -328,6 +273,32 @@ 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 @@ -348,16 +319,50 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in AuthorizeResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in AuthorizeResp: required") } type Plain AuthorizeResp diff --git a/schema/balance.go b/schema/balance.go index 9770e0c..a13c299 100644 --- a/schema/balance.go +++ b/schema/balance.go @@ -6,6 +6,31 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -63,38 +88,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["balance"]; !ok || v == nil { + if _, ok := raw["balance"]; raw != nil && !ok { return fmt.Errorf("field balance in Balance: required") } type Plain Balance diff --git a/schema/balance_resp.go b/schema/balance_resp.go index 98b3ddd..72a1081 100644 --- a/schema/balance_resp.go +++ b/schema/balance_resp.go @@ -83,39 +83,16 @@ 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 v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in BalanceRespBalanceTotalDerivDemo: required") } - if v, ok := raw["currency"]; !ok || v == nil { + if _, ok := raw["currency"]; raw != nil && !ok { return fmt.Errorf("field currency in BalanceRespBalanceTotalDerivDemo: required") } type Plain BalanceRespBalanceTotalDerivDemo @@ -128,26 +105,62 @@ func (j *BalanceRespBalanceTotalDerivDemo) UnmarshalJSON(b []byte) error { } // UnmarshalJSON implements json.Unmarshaler. -func (j *BalanceRespBalance) UnmarshalJSON(b []byte) error { +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["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 BalanceRespBalanceTotalDeriv: 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 BalanceRespBalanceTotalDeriv: required") } - if v, ok := raw["loginid"]; !ok || v == nil { - return fmt.Errorf("field loginid in BalanceRespBalance: required") + type Plain BalanceRespBalanceTotalDeriv + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err } - type Plain BalanceRespBalance + *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 _, ok := raw["amount"]; raw != nil && !ok { + return fmt.Errorf("field amount in BalanceRespBalanceTotalMt5Demo: required") + } + if _, ok := raw["currency"]; raw != nil && !ok { + return fmt.Errorf("field currency in BalanceRespBalanceTotalMt5Demo: required") + } + type Plain BalanceRespBalanceTotalMt5Demo var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = BalanceRespBalance(plain) + *j = BalanceRespBalanceTotalMt5Demo(plain) return nil } @@ -157,10 +170,10 @@ func (j *BalanceRespBalanceTotalMt5) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in BalanceRespBalanceTotalMt5: required") } - if v, ok := raw["currency"]; !ok || v == nil { + if _, ok := raw["currency"]; raw != nil && !ok { return fmt.Errorf("field currency in BalanceRespBalanceTotalMt5: required") } type Plain BalanceRespBalanceTotalMt5 @@ -173,26 +186,36 @@ func (j *BalanceRespBalanceTotalMt5) UnmarshalJSON(b []byte) error { } // UnmarshalJSON implements json.Unmarshaler. -func (j *BalanceRespBalanceTotalMt5Demo) 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 v, ok := raw["amount"]; !ok || v == nil { - return fmt.Errorf("field amount in BalanceRespBalanceTotalMt5Demo: required") + if _, ok := raw["balance"]; raw != nil && !ok { + return fmt.Errorf("field balance in BalanceRespBalance: required") } - if v, ok := raw["currency"]; !ok || v == nil { - return fmt.Errorf("field currency in BalanceRespBalanceTotalMt5Demo: required") + if _, ok := raw["currency"]; raw != nil && !ok { + return fmt.Errorf("field currency in BalanceRespBalance: required") } - type Plain BalanceRespBalanceTotalMt5Demo + if _, ok := raw["loginid"]; raw != nil && !ok { + return fmt.Errorf("field loginid in BalanceRespBalance: required") + } + type Plain BalanceRespBalance var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = BalanceRespBalanceTotalMt5Demo(plain) + *j = BalanceRespBalance(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", } @@ -217,8 +240,6 @@ 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 @@ -232,7 +253,7 @@ func (j *BalanceRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in BalanceRespSubscription: required") } type Plain BalanceRespSubscription @@ -244,37 +265,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in BalanceResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in BalanceResp: required") } type Plain BalanceResp diff --git a/schema/buy.go b/schema/buy.go index 3c16389..4bb518d 100644 --- a/schema/buy.go +++ b/schema/buy.go @@ -115,11 +115,62 @@ 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" @@ -161,74 +212,6 @@ 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", @@ -271,34 +254,39 @@ var enumValues_BuyParametersContractType = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *BuyParametersBasis) UnmarshalJSON(b []byte) error { +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_BuyParametersBasis { + 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_BuyParametersBasis, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersContractType, v) } - *j = BuyParametersBasis(v) + *j = BuyParametersContractType(v) return nil } -var enumValues_BuyParametersBasis = []interface{}{ - "payout", - "stake", -} +type BuyParametersDurationUnit string -type BuyParametersProductType string +const BuyParametersDurationUnitD BuyParametersDurationUnit = "d" +const BuyParametersDurationUnitH BuyParametersDurationUnit = "h" +const BuyParametersDurationUnitM BuyParametersDurationUnit = "m" +const BuyParametersDurationUnitS BuyParametersDurationUnit = "s" +const BuyParametersDurationUnitT BuyParametersDurationUnit = "t" -var enumValues_BuyParametersProductType = []interface{}{ - "basic", +var enumValues_BuyParametersDurationUnit = []interface{}{ + "d", + "m", + "s", + "h", + "t", } // UnmarshalJSON implements json.Unmarshaler. @@ -321,25 +309,43 @@ 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 *BuyParametersBarrierRange) UnmarshalJSON(b []byte) error { +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_BuyParametersBarrierRange { + 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_BuyParametersBarrierRange, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyParametersProductType, v) } - *j = BuyParametersBarrierRange(v) + *j = BuyParametersProductType(v) return nil } @@ -349,13 +355,13 @@ func (j *BuyParameters) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["contract_type"]; !ok || v == nil { + if _, ok := raw["contract_type"]; raw != nil && !ok { return fmt.Errorf("field contract_type in BuyParameters: required") } - if v, ok := raw["currency"]; !ok || v == nil { + if _, ok := raw["currency"]; raw != nil && !ok { return fmt.Errorf("field currency in BuyParameters: required") } - if v, ok := raw["symbol"]; !ok || v == nil { + if _, ok := raw["symbol"]; raw != nil && !ok { return fmt.Errorf("field symbol in BuyParameters: required") } type Plain BuyParameters @@ -400,22 +406,16 @@ 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 v, ok := raw["buy"]; !ok || v == nil { + if _, ok := raw["buy"]; raw != nil && !ok { return fmt.Errorf("field buy in Buy: required") } - if v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { 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 7657a95..02ba181 100644 --- a/schema/buy_contract_for_multiple_accounts.go +++ b/schema/buy_contract_for_multiple_accounts.go @@ -99,6 +99,31 @@ 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" @@ -139,63 +164,6 @@ 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", @@ -237,22 +205,58 @@ var enumValues_BuyContractForMultipleAccountsParametersContractType = []interfac } // UnmarshalJSON implements json.Unmarshaler. -func (j *BuyContractForMultipleAccountsParametersBasis) UnmarshalJSON(b []byte) error { +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_BuyContractForMultipleAccountsParametersBasis { + 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_BuyContractForMultipleAccountsParametersBasis, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_BuyContractForMultipleAccountsParametersContractType, v) } - *j = BuyContractForMultipleAccountsParametersBasis(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 { + 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 } @@ -262,13 +266,13 @@ func (j *BuyContractForMultipleAccountsParameters) UnmarshalJSON(b []byte) error if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["contract_type"]; !ok || v == nil { + if _, ok := raw["contract_type"]; raw != nil && !ok { return fmt.Errorf("field contract_type in BuyContractForMultipleAccountsParameters: required") } - if v, ok := raw["currency"]; !ok || v == nil { + if _, ok := raw["currency"]; raw != nil && !ok { return fmt.Errorf("field currency in BuyContractForMultipleAccountsParameters: required") } - if v, ok := raw["symbol"]; !ok || v == nil { + if _, ok := raw["symbol"]; raw != nil && !ok { return fmt.Errorf("field symbol in BuyContractForMultipleAccountsParameters: required") } type Plain BuyContractForMultipleAccountsParameters @@ -284,24 +288,19 @@ 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 v, ok := raw["buy_contract_for_multiple_accounts"]; !ok || v == nil { + if _, ok := raw["buy_contract_for_multiple_accounts"]; raw != nil && !ok { return fmt.Errorf("field buy_contract_for_multiple_accounts in BuyContractForMultipleAccounts: required") } - if v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in BuyContractForMultipleAccounts: required") } - if v, ok := raw["tokens"]; !ok || v == nil { + if _, ok := raw["tokens"]; raw != nil && !ok { 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 95c67d2..3355c29 100644 --- a/schema/buy_contract_for_multiple_accounts_resp.go +++ b/schema/buy_contract_for_multiple_accounts_resp.go @@ -6,6 +6,22 @@ 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. @@ -18,7 +34,7 @@ func (j *BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts) Unmar if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["result"]; !ok || v == nil { + if _, ok := raw["result"]; raw != nil && !ok { return fmt.Errorf("field result in BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts: required") } type Plain BuyContractForMultipleAccountsRespBuyContractForMultipleAccounts @@ -35,6 +51,8 @@ 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", } @@ -59,34 +77,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in BuyContractForMultipleAccountsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 0ee9a71..1ccb577 100644 --- a/schema/buy_resp.go +++ b/schema/buy_resp.go @@ -6,6 +6,25 @@ 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 @@ -42,31 +61,31 @@ func (j *BuyRespBuy) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["balance_after"]; !ok || v == nil { + if _, ok := raw["balance_after"]; raw != nil && !ok { return fmt.Errorf("field balance_after in BuyRespBuy: required") } - if v, ok := raw["buy_price"]; !ok || v == nil { + if _, ok := raw["buy_price"]; raw != nil && !ok { return fmt.Errorf("field buy_price in BuyRespBuy: required") } - if v, ok := raw["contract_id"]; !ok || v == nil { + if _, ok := raw["contract_id"]; raw != nil && !ok { return fmt.Errorf("field contract_id in BuyRespBuy: required") } - if v, ok := raw["longcode"]; !ok || v == nil { + if _, ok := raw["longcode"]; raw != nil && !ok { return fmt.Errorf("field longcode in BuyRespBuy: required") } - if v, ok := raw["payout"]; !ok || v == nil { + if _, ok := raw["payout"]; raw != nil && !ok { return fmt.Errorf("field payout in BuyRespBuy: required") } - if v, ok := raw["purchase_time"]; !ok || v == nil { + if _, ok := raw["purchase_time"]; raw != nil && !ok { return fmt.Errorf("field purchase_time in BuyRespBuy: required") } - if v, ok := raw["shortcode"]; !ok || v == nil { + if _, ok := raw["shortcode"]; raw != nil && !ok { return fmt.Errorf("field shortcode in BuyRespBuy: required") } - if v, ok := raw["start_time"]; !ok || v == nil { + if _, ok := raw["start_time"]; raw != nil && !ok { return fmt.Errorf("field start_time in BuyRespBuy: required") } - if v, ok := raw["transaction_id"]; !ok || v == nil { + if _, ok := raw["transaction_id"]; raw != nil && !ok { return fmt.Errorf("field transaction_id in BuyRespBuy: required") } type Plain BuyRespBuy @@ -83,6 +102,8 @@ type BuyRespEchoReq map[string]interface{} type BuyRespMsgType string +const BuyRespMsgTypeBuy BuyRespMsgType = "buy" + var enumValues_BuyRespMsgType = []interface{}{ "buy", } @@ -107,8 +128,6 @@ 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 @@ -122,7 +141,7 @@ func (j *BuyRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in BuyRespSubscription: required") } type Plain BuyRespSubscription @@ -134,35 +153,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in BuyResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in BuyResp: required") } type Plain BuyResp diff --git a/schema/cancel.go b/schema/cancel.go index ae2ca11..a732f9d 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 v, ok := raw["cancel"]; !ok || v == nil { + if _, ok := raw["cancel"]; raw != nil && !ok { return fmt.Errorf("field cancel in Cancel: required") } type Plain Cancel diff --git a/schema/cancel_resp.go b/schema/cancel_resp.go index 7665564..39335b4 100644 --- a/schema/cancel_resp.go +++ b/schema/cancel_resp.go @@ -6,6 +6,22 @@ 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 @@ -29,6 +45,8 @@ type CancelRespEchoReq map[string]interface{} type CancelRespMsgType string +const CancelRespMsgTypeCancel CancelRespMsgType = "cancel" + var enumValues_CancelRespMsgType = []interface{}{ "cancel", } @@ -53,34 +71,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in CancelResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in CancelResp: required") } type Plain CancelResp diff --git a/schema/cashier.go b/schema/cashier.go index 59e1b8d..02f6892 100644 --- a/schema/cashier.go +++ b/schema/cashier.go @@ -55,116 +55,119 @@ 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 *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 } +type CashierDryRun int + +var enumValues_CashierDryRun = []interface{}{ + 0, + 1, +} + // 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 } +// [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 *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 } +type CashierType string + +const CashierTypeApi CashierType = "api" +const CashierTypeUrl CashierType = "url" + +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 } diff --git a/schema/cashier_resp.go b/schema/cashier_resp.go index ca72b64..e30e298 100644 --- a/schema/cashier_resp.go +++ b/schema/cashier_resp.go @@ -6,11 +6,35 @@ 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", } @@ -35,40 +59,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in CashierResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 f2bd1d5..9fc9701 100644 --- a/schema/confirm_email.go +++ b/schema/confirm_email.go @@ -6,6 +6,28 @@ 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{}{ @@ -59,28 +81,6 @@ 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 v, ok := raw["confirm_email"]; !ok || v == nil { + if _, ok := raw["confirm_email"]; raw != nil && !ok { return fmt.Errorf("field confirm_email in ConfirmEmail: required") } - if v, ok := raw["email_consent"]; !ok || v == nil { + if _, ok := raw["email_consent"]; raw != nil && !ok { return fmt.Errorf("field email_consent in ConfirmEmail: required") } - if v, ok := raw["verification_code"]; !ok || v == nil { + if _, ok := raw["verification_code"]; raw != nil && !ok { 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 8f857b4..86af5fb 100644 --- a/schema/confirm_email_resp.go +++ b/schema/confirm_email_resp.go @@ -6,6 +6,22 @@ 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{}{ @@ -38,6 +54,8 @@ type ConfirmEmailRespEchoReq map[string]interface{} type ConfirmEmailRespMsgType string +const ConfirmEmailRespMsgTypeConfirmEmail ConfirmEmailRespMsgType = "confirm_email" + var enumValues_ConfirmEmailRespMsgType = []interface{}{ "confirm_email", } @@ -62,34 +80,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ConfirmEmailResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 59c06b6..c9de157 100644 --- a/schema/contract_update.go +++ b/schema/contract_update.go @@ -6,6 +6,29 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,29 +55,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["contract_id"]; !ok || v == nil { + if _, ok := raw["contract_id"]; raw != nil && !ok { return fmt.Errorf("field contract_id in ContractUpdate: required") } - if v, ok := raw["contract_update"]; !ok || v == nil { + if _, ok := raw["contract_update"]; raw != nil && !ok { return fmt.Errorf("field contract_update in ContractUpdate: required") } - if v, ok := raw["limit_order"]; !ok || v == nil { + if _, ok := raw["limit_order"]; raw != nil && !ok { 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 ed15ca4..05e4380 100644 --- a/schema/contract_update_history.go +++ b/schema/contract_update_history.go @@ -6,6 +6,29 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,29 +55,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["contract_id"]; !ok || v == nil { + if _, ok := raw["contract_id"]; raw != nil && !ok { return fmt.Errorf("field contract_id in ContractUpdateHistory: required") } - if v, ok := raw["contract_update_history"]; !ok || v == nil { + if _, ok := raw["contract_update_history"]; raw != nil && !ok { 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 9f76871..4f878ce 100644 --- a/schema/contract_update_history_resp.go +++ b/schema/contract_update_history_resp.go @@ -6,6 +6,22 @@ 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. @@ -29,6 +45,8 @@ type ContractUpdateHistoryRespEchoReq map[string]interface{} type ContractUpdateHistoryRespMsgType string +const ContractUpdateHistoryRespMsgTypeContractUpdateHistory ContractUpdateHistoryRespMsgType = "contract_update_history" + var enumValues_ContractUpdateHistoryRespMsgType = []interface{}{ "contract_update_history", } @@ -53,34 +71,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ContractUpdateHistoryResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 e6f4891..7818198 100644 --- a/schema/contract_update_resp.go +++ b/schema/contract_update_resp.go @@ -6,6 +6,22 @@ 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 @@ -54,6 +70,8 @@ type ContractUpdateRespEchoReq map[string]interface{} type ContractUpdateRespMsgType string +const ContractUpdateRespMsgTypeContractUpdate ContractUpdateRespMsgType = "contract_update" + var enumValues_ContractUpdateRespMsgType = []interface{}{ "contract_update", } @@ -78,34 +96,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ContractUpdateResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 c689f5b..8f56130 100644 --- a/schema/contracts_for.go +++ b/schema/contracts_for.go @@ -55,7 +55,15 @@ const ContractsForLandingCompanyShortMaltainvest ContractsForLandingCompanyShort const ContractsForLandingCompanyShortSvg ContractsForLandingCompanyShort = "svg" const ContractsForLandingCompanyShortVanuatu ContractsForLandingCompanyShort = "vanuatu" const ContractsForLandingCompanyShortVirtual ContractsForLandingCompanyShort = "virtual" -const ContractsForLandingCompanySvg ContractsForLandingCompany = "svg" + +var enumValues_ContractsForLandingCompanyShort = []interface{}{ + "iom", + "malta", + "maltainvest", + "svg", + "virtual", + "vanuatu", +} // UnmarshalJSON implements json.Unmarshaler. func (j *ContractsForLandingCompanyShort) UnmarshalJSON(b []byte) error { @@ -77,10 +85,11 @@ func (j *ContractsForLandingCompanyShort) UnmarshalJSON(b []byte) error { return nil } +const ContractsForLandingCompanySvg ContractsForLandingCompany = "svg" const ContractsForLandingCompanyVanuatu ContractsForLandingCompany = "vanuatu" const ContractsForLandingCompanyVirtual ContractsForLandingCompany = "virtual" -var enumValues_ContractsForLandingCompanyShort = []interface{}{ +var enumValues_ContractsForLandingCompany = []interface{}{ "iom", "malta", "maltainvest", @@ -115,6 +124,8 @@ type ContractsForPassthrough map[string]interface{} type ContractsForProductType string +const ContractsForProductTypeBasic ContractsForProductType = "basic" + var enumValues_ContractsForProductType = []interface{}{ "basic", } @@ -139,24 +150,13 @@ 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 v, ok := raw["contracts_for"]; !ok || v == nil { + if _, ok := raw["contracts_for"]; raw != nil && !ok { return fmt.Errorf("field contracts_for in ContractsFor: required") } type Plain ContractsFor diff --git a/schema/contracts_for_resp.go b/schema/contracts_for_resp.go index 5270a19..059c0ae 100644 --- a/schema/contracts_for_resp.go +++ b/schema/contracts_for_resp.go @@ -158,104 +158,52 @@ 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 v, ok := raw["barrier_category"]; !ok || v == nil { + if _, ok := raw["barrier_category"]; raw != nil && !ok { return fmt.Errorf("field barrier_category in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["barriers"]; !ok || v == nil { + if _, ok := raw["barriers"]; raw != nil && !ok { return fmt.Errorf("field barriers in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["contract_category"]; !ok || v == nil { + if _, ok := raw["contract_category"]; raw != nil && !ok { return fmt.Errorf("field contract_category in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["contract_category_display"]; !ok || v == nil { + if _, ok := raw["contract_category_display"]; raw != nil && !ok { return fmt.Errorf("field contract_category_display in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["contract_type"]; !ok || v == nil { + if _, ok := raw["contract_type"]; raw != nil && !ok { return fmt.Errorf("field contract_type in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["exchange_name"]; !ok || v == nil { + if _, ok := raw["exchange_name"]; raw != nil && !ok { return fmt.Errorf("field exchange_name in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["expiry_type"]; !ok || v == nil { + if _, ok := raw["expiry_type"]; raw != nil && !ok { return fmt.Errorf("field expiry_type in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["market"]; !ok || v == nil { + if _, ok := raw["market"]; raw != nil && !ok { return fmt.Errorf("field market in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["max_contract_duration"]; !ok || v == nil { + if _, ok := raw["max_contract_duration"]; raw != nil && !ok { return fmt.Errorf("field max_contract_duration in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["min_contract_duration"]; !ok || v == nil { + if _, ok := raw["min_contract_duration"]; raw != nil && !ok { return fmt.Errorf("field min_contract_duration in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["sentiment"]; !ok || v == nil { + if _, ok := raw["sentiment"]; raw != nil && !ok { return fmt.Errorf("field sentiment in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["start_type"]; !ok || v == nil { + if _, ok := raw["start_type"]; raw != nil && !ok { return fmt.Errorf("field start_type in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["submarket"]; !ok || v == nil { + if _, ok := raw["submarket"]; raw != nil && !ok { return fmt.Errorf("field submarket in ContractsForRespContractsForAvailableElem: required") } - if v, ok := raw["underlying_symbol"]; !ok || v == nil { + if _, ok := raw["underlying_symbol"]; raw != nil && !ok { return fmt.Errorf("field underlying_symbol in ContractsForRespContractsForAvailableElem: required") } type Plain ContractsForRespContractsForAvailableElem @@ -273,16 +221,68 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ContractsForResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 d07bbe4..3f9755b 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 v, ok := raw["copy_start"]; !ok || v == nil { + if _, ok := raw["copy_start"]; raw != nil && !ok { 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 2b94da2..203fc35 100644 --- a/schema/copy_start_resp.go +++ b/schema/copy_start_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in CopyStartResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 25a4e5b..c65e66c 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 v, ok := raw["copy_stop"]; !ok || v == nil { + if _, ok := raw["copy_stop"]; raw != nil && !ok { 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 716a6fd..3cd7479 100644 --- a/schema/copy_stop_resp.go +++ b/schema/copy_stop_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in CopyStopResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 7998a7d..c9ac998 100644 --- a/schema/copytrading_list.go +++ b/schema/copytrading_list.go @@ -6,6 +6,23 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["copytrading_list"]; !ok || v == nil { + if _, ok := raw["copytrading_list"]; raw != nil && !ok { 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 fb28dad..c274fa3 100644 --- a/schema/copytrading_list_resp.go +++ b/schema/copytrading_list_resp.go @@ -6,6 +6,31 @@ 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"` @@ -17,7 +42,7 @@ func (j *CopytradingListRespCopytradingListCopiersElem) UnmarshalJSON(b []byte) if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["loginid"]; !ok || v == nil { + if _, ok := raw["loginid"]; raw != nil && !ok { return fmt.Errorf("field loginid in CopytradingListRespCopytradingListCopiersElem: required") } type Plain CopytradingListRespCopytradingListCopiersElem @@ -29,15 +54,6 @@ 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"` @@ -64,10 +80,10 @@ func (j *CopytradingListRespCopytradingList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["copiers"]; !ok || v == nil { + if _, ok := raw["copiers"]; raw != nil && !ok { return fmt.Errorf("field copiers in CopytradingListRespCopytradingList: required") } - if v, ok := raw["traders"]; !ok || v == nil { + if _, ok := raw["traders"]; raw != nil && !ok { return fmt.Errorf("field traders in CopytradingListRespCopytradingList: required") } type Plain CopytradingListRespCopytradingList @@ -84,6 +100,8 @@ type CopytradingListRespEchoReq map[string]interface{} type CopytradingListRespMsgType string +const CopytradingListRespMsgTypeCopytradingList CopytradingListRespMsgType = "copytrading_list" + var enumValues_CopytradingListRespMsgType = []interface{}{ "copytrading_list", } @@ -108,34 +126,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in CopytradingListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 60db136..70cad92 100644 --- a/schema/copytrading_statistics.go +++ b/schema/copytrading_statistics.go @@ -6,6 +6,22 @@ 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{}{ @@ -32,22 +48,6 @@ 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 v, ok := raw["copytrading_statistics"]; !ok || v == nil { + if _, ok := raw["copytrading_statistics"]; raw != nil && !ok { return fmt.Errorf("field copytrading_statistics in CopytradingStatistics: required") } - if v, ok := raw["trader_id"]; !ok || v == nil { + if _, ok := raw["trader_id"]; raw != nil && !ok { 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 a83f2dc..55433b8 100644 --- a/schema/copytrading_statistics_resp.go +++ b/schema/copytrading_statistics_resp.go @@ -6,6 +6,22 @@ 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. @@ -60,37 +76,37 @@ func (j *CopytradingStatisticsRespCopytradingStatistics) UnmarshalJSON(b []byte) if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["active_since"]; !ok || v == nil { + if _, ok := raw["active_since"]; raw != nil && !ok { return fmt.Errorf("field active_since in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["avg_duration"]; !ok || v == nil { + if _, ok := raw["avg_duration"]; raw != nil && !ok { return fmt.Errorf("field avg_duration in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["avg_loss"]; !ok || v == nil { + if _, ok := raw["avg_loss"]; raw != nil && !ok { return fmt.Errorf("field avg_loss in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["avg_profit"]; !ok || v == nil { + if _, ok := raw["avg_profit"]; raw != nil && !ok { return fmt.Errorf("field avg_profit in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["copiers"]; !ok || v == nil { + if _, ok := raw["copiers"]; raw != nil && !ok { return fmt.Errorf("field copiers in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["last_12months_profitable_trades"]; !ok || v == nil { + if _, ok := raw["last_12months_profitable_trades"]; raw != nil && !ok { return fmt.Errorf("field last_12months_profitable_trades in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["monthly_profitable_trades"]; !ok || v == nil { + if _, ok := raw["monthly_profitable_trades"]; raw != nil && !ok { return fmt.Errorf("field monthly_profitable_trades in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["performance_probability"]; !ok || v == nil { + if _, ok := raw["performance_probability"]; raw != nil && !ok { return fmt.Errorf("field performance_probability in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["total_trades"]; !ok || v == nil { + if _, ok := raw["total_trades"]; raw != nil && !ok { return fmt.Errorf("field total_trades in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["trades_breakdown"]; !ok || v == nil { + if _, ok := raw["trades_breakdown"]; raw != nil && !ok { return fmt.Errorf("field trades_breakdown in CopytradingStatisticsRespCopytradingStatistics: required") } - if v, ok := raw["trades_profitable"]; !ok || v == nil { + if _, ok := raw["trades_profitable"]; raw != nil && !ok { return fmt.Errorf("field trades_profitable in CopytradingStatisticsRespCopytradingStatistics: required") } type Plain CopytradingStatisticsRespCopytradingStatistics @@ -107,6 +123,8 @@ type CopytradingStatisticsRespEchoReq map[string]interface{} type CopytradingStatisticsRespMsgType string +const CopytradingStatisticsRespMsgTypeCopytradingStatistics CopytradingStatisticsRespMsgType = "copytrading_statistics" + var enumValues_CopytradingStatisticsRespMsgType = []interface{}{ "copytrading_statistics", } @@ -131,34 +149,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in CopytradingStatisticsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 4732fd2..da6a6d0 100644 --- a/schema/crypto_config.go +++ b/schema/crypto_config.go @@ -6,6 +6,27 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,27 +53,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["crypto_config"]; !ok || v == nil { + if _, ok := raw["crypto_config"]; raw != nil && !ok { 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 bfffe74..58f4270 100644 --- a/schema/crypto_config_resp.go +++ b/schema/crypto_config_resp.go @@ -6,6 +6,22 @@ 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. @@ -21,7 +37,7 @@ func (j *CryptoConfigRespCryptoConfig) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["currencies_config"]; !ok || v == nil { + if _, ok := raw["currencies_config"]; raw != nil && !ok { return fmt.Errorf("field currencies_config in CryptoConfigRespCryptoConfig: required") } type Plain CryptoConfigRespCryptoConfig @@ -38,6 +54,8 @@ type CryptoConfigRespEchoReq map[string]interface{} type CryptoConfigRespMsgType string +const CryptoConfigRespMsgTypeCryptoConfig CryptoConfigRespMsgType = "crypto_config" + var enumValues_CryptoConfigRespMsgType = []interface{}{ "crypto_config", } @@ -62,34 +80,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in CryptoConfigResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 8797440..045ccc7 100644 --- a/schema/crypto_estimations.go +++ b/schema/crypto_estimations.go @@ -6,6 +6,30 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -62,40 +86,16 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["crypto_estimations"]; !ok || v == nil { + if _, ok := raw["crypto_estimations"]; raw != nil && !ok { return fmt.Errorf("field crypto_estimations in CryptoEstimations: required") } - if v, ok := raw["currency_code"]; !ok || v == nil { + if _, ok := raw["currency_code"]; raw != nil && !ok { 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 7f31776..0664ba9 100644 --- a/schema/crypto_estimations_resp.go +++ b/schema/crypto_estimations_resp.go @@ -6,6 +6,25 @@ 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{} @@ -14,6 +33,8 @@ type CryptoEstimationsRespEchoReq map[string]interface{} type CryptoEstimationsRespMsgType string +const CryptoEstimationsRespMsgTypeCryptoEstimations CryptoEstimationsRespMsgType = "crypto_estimations" + var enumValues_CryptoEstimationsRespMsgType = []interface{}{ "crypto_estimations", } @@ -38,8 +59,6 @@ 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 @@ -53,7 +72,7 @@ func (j *CryptoEstimationsRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in CryptoEstimationsRespSubscription: required") } type Plain CryptoEstimationsRespSubscription @@ -65,35 +84,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in CryptoEstimationsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 1f51dd0..998d4a7 100644 --- a/schema/document_upload.go +++ b/schema/document_upload.go @@ -66,6 +66,34 @@ 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" @@ -96,57 +124,17 @@ 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 DocumentUploadDocumentTypeTaxReturn DocumentUploadDocumentType = "tax_return" -const DocumentUploadDocumentTypeSelfieWithId DocumentUploadDocumentType = "selfie_with_id" -const DocumentUploadDocumentTypeTaxPhotoId DocumentUploadDocumentType = "tax_photo_id" -const DocumentUploadDocumentTypeStudentCard DocumentUploadDocumentType = "student_card" -const DocumentUploadDocumentTypeVoterCard DocumentUploadDocumentType = "voter_card" const DocumentUploadDocumentTypeProofaddress DocumentUploadDocumentType = "proofaddress" const DocumentUploadDocumentTypeProofid DocumentUploadDocumentType = "proofid" -const DocumentUploadDocumentTypeUtilityBill DocumentUploadDocumentType = "utility_bill" +const DocumentUploadDocumentTypeSelfieWithId DocumentUploadDocumentType = "selfie_with_id" 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 -} +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 DocumentUploadDocumentTypeVoterCard DocumentUploadDocumentType = "voter_card" var enumValues_DocumentUploadDocumentType = []interface{}{ "passport", @@ -191,22 +179,22 @@ var enumValues_DocumentUploadDocumentType = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *DocumentUploadDocumentFormat) UnmarshalJSON(b []byte) error { +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_DocumentUploadDocumentFormat { + 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_DocumentUploadDocumentFormat, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_DocumentUploadDocumentType, v) } - *j = DocumentUploadDocumentFormat(v) + *j = DocumentUploadDocumentType(v) return nil } @@ -216,7 +204,25 @@ var enumValues_DocumentUploadDocumentUpload = []interface{}{ 1, } -const DocumentUploadDocumentTypeTaxReceipt DocumentUploadDocumentType = "tax_receipt" +// 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 +} type DocumentUploadLifetimeValid int @@ -247,6 +253,10 @@ 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", @@ -273,18 +283,10 @@ 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 { @@ -297,16 +299,20 @@ 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 v, ok := raw["details"]; !ok || v == nil { + if _, ok := raw["details"]; raw != nil && !ok { return fmt.Errorf("field details in DocumentUploadProofOfOwnership: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in DocumentUploadProofOfOwnership: required") } type Plain DocumentUploadProofOfOwnership @@ -318,33 +324,25 @@ 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 v, ok := raw["document_format"]; !ok || v == nil { + if _, ok := raw["document_format"]; raw != nil && !ok { return fmt.Errorf("field document_format in DocumentUpload: required") } - if v, ok := raw["document_type"]; !ok || v == nil { + if _, ok := raw["document_type"]; raw != nil && !ok { return fmt.Errorf("field document_type in DocumentUpload: required") } - if v, ok := raw["document_upload"]; !ok || v == nil { + if _, ok := raw["document_upload"]; raw != nil && !ok { return fmt.Errorf("field document_upload in DocumentUpload: required") } - if v, ok := raw["expected_checksum"]; !ok || v == nil { + if _, ok := raw["expected_checksum"]; raw != nil && !ok { return fmt.Errorf("field expected_checksum in DocumentUpload: required") } - if v, ok := raw["file_size"]; !ok || v == nil { + if _, ok := raw["file_size"]; raw != nil && !ok { 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 ae7a745..a8206e5 100644 --- a/schema/document_upload_resp.go +++ b/schema/document_upload_resp.go @@ -6,6 +6,22 @@ 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 @@ -33,10 +49,10 @@ func (j *DocumentUploadRespDocumentUpload) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["call_type"]; !ok || v == nil { + if _, ok := raw["call_type"]; raw != nil && !ok { return fmt.Errorf("field call_type in DocumentUploadRespDocumentUpload: required") } - if v, ok := raw["upload_id"]; !ok || v == nil { + if _, ok := raw["upload_id"]; raw != nil && !ok { return fmt.Errorf("field upload_id in DocumentUploadRespDocumentUpload: required") } type Plain DocumentUploadRespDocumentUpload @@ -53,6 +69,8 @@ type DocumentUploadRespEchoReq map[string]interface{} type DocumentUploadRespMsgType string +const DocumentUploadRespMsgTypeDocumentUpload DocumentUploadRespMsgType = "document_upload" + var enumValues_DocumentUploadRespMsgType = []interface{}{ "document_upload", } @@ -77,34 +95,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in DocumentUploadResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 e3c86ff..3fe5fb9 100644 --- a/schema/economic_calendar.go +++ b/schema/economic_calendar.go @@ -6,6 +6,30 @@ 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{}{ @@ -32,30 +56,6 @@ 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 v, ok := raw["economic_calendar"]; !ok || v == nil { + if _, ok := raw["economic_calendar"]; raw != nil && !ok { 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 a90319f..bffc04b 100644 --- a/schema/economic_calendar_resp.go +++ b/schema/economic_calendar_resp.go @@ -6,6 +6,22 @@ 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{} @@ -58,6 +74,8 @@ type EconomicCalendarRespEconomicCalendarEventsElemPrevious struct { type EconomicCalendarRespMsgType string +const EconomicCalendarRespMsgTypeEconomicCalendar EconomicCalendarRespMsgType = "economic_calendar" + var enumValues_EconomicCalendarRespMsgType = []interface{}{ "economic_calendar", } @@ -82,34 +100,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in EconomicCalendarResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 bdbfb2c..d4612f4 100644 --- a/schema/exchange_rates.go +++ b/schema/exchange_rates.go @@ -6,6 +6,39 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -88,49 +121,16 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["base_currency"]; !ok || v == nil { + if _, ok := raw["base_currency"]; raw != nil && !ok { return fmt.Errorf("field base_currency in ExchangeRates: required") } - if v, ok := raw["exchange_rates"]; !ok || v == nil { + if _, ok := raw["exchange_rates"]; raw != nil && !ok { 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 3d2a6b3..2669424 100644 --- a/schema/exchange_rates_resp.go +++ b/schema/exchange_rates_resp.go @@ -6,6 +6,26 @@ 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{} @@ -26,6 +46,8 @@ type ExchangeRatesRespExchangeRatesRates map[string]interface{} type ExchangeRatesRespMsgType string +const ExchangeRatesRespMsgTypeExchangeRates ExchangeRatesRespMsgType = "exchange_rates" + var enumValues_ExchangeRatesRespMsgType = []interface{}{ "exchange_rates", } @@ -50,8 +72,6 @@ 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 @@ -65,7 +85,7 @@ func (j *ExchangeRatesRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in ExchangeRatesRespSubscription: required") } type Plain ExchangeRatesRespSubscription @@ -77,36 +97,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ExchangeRatesResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in ExchangeRatesResp: required") } type Plain ExchangeRatesResp diff --git a/schema/forget.go b/schema/forget.go index 03c664f..8706f46 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 v, ok := raw["forget"]; !ok || v == nil { + if _, ok := raw["forget"]; raw != nil && !ok { return fmt.Errorf("field forget in Forget: required") } type Plain Forget diff --git a/schema/forget_all.go b/schema/forget_all.go index fbdf3ea..5daab7e 100644 --- a/schema/forget_all.go +++ b/schema/forget_all.go @@ -24,6 +24,24 @@ 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" @@ -41,26 +59,6 @@ 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", @@ -79,19 +77,21 @@ var enumValues_StreamTypes = []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 { +func (j *StreamTypes) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { return err } - if v, ok := raw["forget_all"]; !ok || v == nil { - return fmt.Errorf("field forget_all in ForgetAll: required") + var ok bool + for _, expected := range enumValues_StreamTypes { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain ForgetAll - 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_StreamTypes, v) } - *j = ForgetAll(plain) + *j = StreamTypes(v) return nil } diff --git a/schema/forget_all_resp.go b/schema/forget_all_resp.go index 72d82b5..a16aa5d 100644 --- a/schema/forget_all_resp.go +++ b/schema/forget_all_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ForgetAllResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 e350704..d9ce6ac 100644 --- a/schema/forget_resp.go +++ b/schema/forget_resp.go @@ -6,6 +6,22 @@ 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{} @@ -38,6 +54,8 @@ func (j *ForgetRespForget) UnmarshalJSON(b []byte) error { type ForgetRespMsgType string +const ForgetRespMsgTypeForget ForgetRespMsgType = "forget" + var enumValues_ForgetRespMsgType = []interface{}{ "forget", } @@ -62,34 +80,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ForgetResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 dd0c569..90052c8 100644 --- a/schema/get_account_status.go +++ b/schema/get_account_status.go @@ -6,6 +6,23 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["get_account_status"]; !ok || v == nil { + if _, ok := raw["get_account_status"]; raw != nil && !ok { 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 be123e7..41b449f 100644 --- a/schema/get_account_status_resp.go +++ b/schema/get_account_status_resp.go @@ -6,60 +6,146 @@ import "encoding/json" import "fmt" import "reflect" -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable(v) - return nil -} +// A message with Account Status +type GetAccountStatusResp struct { + // Echo of the request made. + EchoReq GetAccountStatusRespEchoReq `json:"echo_req"` -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", - "suspected", + // Account status details + GetAccountStatus *GetAccountStatusRespGetAccountStatus `json:"get_account_status,omitempty"` + + // Action name of the request made. + MsgType GetAccountStatusRespMsgType `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"` } -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus = []interface{}{ - "verified", - "rejected", - "pending", - "expired", - "none", + +// Echo of the request made. +type GetAccountStatusRespEchoReq map[string]interface{} + +// Account status details +type GetAccountStatusRespGetAccountStatus struct { + // This represents the authentication status of the user and it includes what + // authentication is needed. + Authentication *GetAccountStatusRespGetAccountStatusAuthentication `json:"authentication,omitempty"` + + // Contains missing profile fields required for cashier access. + CashierMissingFields []string `json:"cashier_missing_fields,omitempty"` + + // If the cashier is unavailble, this array contains one or more error codes for + // each reason. + CashierValidation []string `json:"cashier_validation,omitempty"` + + // Provides cashier details for client currency. + CurrencyConfig GetAccountStatusRespGetAccountStatusCurrencyConfig `json:"currency_config"` + + // P2P requires proof of address. + P2PPoaRequired GetAccountStatusRespGetAccountStatusP2PPoaRequired `json:"p2p_poa_required"` + + // Current P2P status of client. + P2PStatus GetAccountStatusRespGetAccountStatusP2PStatus `json:"p2p_status"` + + // Indicates whether the client should be prompted to authenticate their account. + PromptClientToAuthenticate GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate `json:"prompt_client_to_authenticate"` + + // Client risk classification: `low`, `standard`, `high`. + RiskClassification string `json:"risk_classification"` + + // Social identity provider a user signed up with. + SocialIdentityProvider *GetAccountStatusRespGetAccountStatusSocialIdentityProvider `json:"social_identity_provider,omitempty"` + + // Account status. Possible status: + // - `address_verified`: client's address is verified by third party services. + // - `allow_document_upload`: client is allowed to upload documents. + // - `age_verification`: client is age-verified. + // - `authenticated`: client is fully authenticated. + // - `cashier_locked`: cashier is locked. + // - `crs_tin_information`: client has updated tax related information. + // - `deposit_locked`: deposit is not allowed. + // - `disabled`: account is disabled. + // - `document_expired`: client's submitted proof-of-identity documents have + // expired. + // - `document_expiring_soon`: client's submitted proof-of-identity documents are + // expiring within a month. + // - `dxtrade_password_not_set`: Deriv X password is not set. + // - `financial_assessment_not_complete`: client should complete their financial + // assessment. + // - `financial_information_not_complete`: client has not completed financial + // assessment. + // - `financial_risk_approval`: client has accepted financial risk disclosure. + // - `max_turnover_limit_not_set`: client has not set financial limits on their + // account. Applies to UK and Malta clients. + // - `mt5_password_not_set`: MT5 password is not set. + // - `mt5_withdrawal_locked`: MT5 deposits allowed, but withdrawal is not allowed. + // - `needs_affiliate_coc_approval`: user must approve the Affiliate's Code of + // Conduct Agreement. + // - `no_trading`: trading is disabled. + // - `no_withdrawal_or_trading`: client cannot trade or withdraw but can deposit. + // - `p2p_blocked_for_pa`: p2p is blocked for the current payment agent client. + // - `pa_withdrawal_explicitly_allowed`: withdrawal through payment agent is + // allowed. + // - `password_reset_required`: this client must reset their password. + // - `professional`: this client has opted for a professional account. + // - `professional_requested`: this client has requested for a professional + // account. + // - `professional_rejected`: this client's request for a professional account has + // been rejected. + // - `social_signup`: this client is using social signup. + // - `trading_experience_not_complete`: client has not completed the trading + // experience questionnaire. + // - `ukgc_funds_protection`: client has acknowledged UKGC funds protection + // notice. + // - `unwelcome`: client cannot deposit or buy contracts, but can withdraw or sell + // contracts. + // - `withdrawal_locked`: deposits allowed but withdrawals are not allowed. + // - `deposit_attempt`: this prevent a client from changing the account currency + // after deposit attempt. + // - `poi_name_mismatch`: client POI documents name mismatch. + // - `allow_poa_resubmission`: the client can resubmit POA documents. + // - `allow_poi_resubmission`: the client can resubmit POI documents. + // - `shared_payment_method`: the client has been sharing payment methods. + // - `personal_details_locked`: client is not allowed to edit personal profile + // details. + // - `transfers_blocked`: it block any transfer between two accounts. + // - `df_deposit_requires_poi`: the DF deposit will be blocked until the client + // gets age verified. + // - `authenticated_with_idv_photoid`: the client has been fully authenticated by + // IDV. + // - `idv_revoked`: the client used to be fully authenticated by IDV but it was + // taken away due to compliance criteria. + // - `mt5_additional_kyc_required`: client tax information, place of birth and + // account opening reason is missing. + // - `poi_expiring_soon`: the POI documents of the client will get expired soon, + // allow them to reupload POI documents. + // - `poa_expiring_soon`: the POA documents of the client will get outdated soon, + // allow them to reupload POA documents. + // - `tin_manually_approved`: the client's tax_identification_number has been + // manually approved as client is not applicable for tax_identification_number + Status []string `json:"status"` } -// 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 +// This represents the authentication status of the user and it includes what +// authentication is needed. +type GetAccountStatusRespGetAccountStatusAuthentication struct { + // POI attempts made by the client + Attempts *GetAccountStatusRespGetAccountStatusAuthenticationAttempts `json:"attempts,omitempty"` + + // The authentication status for document. + Document *GetAccountStatusRespGetAccountStatusAuthenticationDocument `json:"document,omitempty"` + + // The authentication status for identity. + Identity *GetAccountStatusRespGetAccountStatusAuthenticationIdentity `json:"identity,omitempty"` + + // The authentication status for source of income document. + Income *GetAccountStatusRespGetAccountStatusAuthenticationIncome `json:"income,omitempty"` + + // An array containing the list of required authentication. + NeedsVerification []string `json:"needs_verification"` + + // The current state of the proof of ownership. + Ownership *GetAccountStatusRespGetAccountStatusAuthenticationOwnership `json:"ownership,omitempty"` } // POI attempts made by the client @@ -94,15 +180,110 @@ type GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElem struc Timestamp *int `json:"timestamp,omitempty"` } +type GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus string + const GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus = "expired" const GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatusNone GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus = "none" const GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatusPending GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus = "pending" 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{} +// The authentication status for document. +type GetAccountStatusRespGetAccountStatusAuthenticationDocument struct { + // This represents the current status of idv authentication for each mt5 + // jurisdiction. + AuthenticatedWithIdv *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdv `json:"authenticated_with_idv,omitempty"` + + // This is the epoch of the document expiry date. + ExpiryDate *int `json:"expiry_date,omitempty"` + + // This represents the current status of the proof of address document submitted + // for authentication. + Status *GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus `json:"status,omitempty"` + + // This represents the current status of authentication for each mt5 jurisdiction. + VerifiedJurisdiction *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdiction `json:"verified_jurisdiction,omitempty"` +} + +// This represents the current status of idv authentication for each mt5 +// jurisdiction. +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdv struct { + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Bvi *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvBvi `json:"bvi,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Dsl *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvDsl `json:"dsl,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Iom *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvIom `json:"iom,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Labuan *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvLabuan `json:"labuan,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Malta *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvMalta `json:"malta,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Maltainvest *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvMaltainvest `json:"maltainvest,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Samoa *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa `json:"samoa,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + SamoaVirtual *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual `json:"samoa-virtual,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Svg *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSvg `json:"svg,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Vanuatu *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvVanuatu `json:"vanuatu,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Virtual *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvVirtual `json:"virtual,omitempty"` +} + type GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvBvi int var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvBvi = []interface{}{ @@ -267,55 +448,55 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticated type GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa int -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa = []interface{}{ +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual int + +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual(v) return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual int - -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual = []interface{}{ +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa(v) return nil } @@ -348,7 +529,10 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticated type GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvVanuatu int -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus string +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvVanuatu = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvVanuatu) UnmarshalJSON(b []byte) error { @@ -397,106 +581,96 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticated return nil } -// This represents the current status of idv authentication for each mt5 -// jurisdiction. -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdv struct { - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Bvi *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvBvi `json:"bvi,omitempty"` +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus string - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Dsl *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvDsl `json:"dsl,omitempty"` +const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "expired" +const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusNone GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "none" +const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusPending GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "pending" +const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "rejected" +const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "suspected" +const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "verified" - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Iom *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvIom `json:"iom,omitempty"` +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 // this jurisdiction - Labuan *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvLabuan `json:"labuan,omitempty"` + Bvi *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi `json:"bvi,omitempty"` // This represents whether the client is allowed or not to create an account under // this jurisdiction - Malta *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvMalta `json:"malta,omitempty"` + Dsl *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl `json:"dsl,omitempty"` // This represents whether the client is allowed or not to create an account under // this jurisdiction - Maltainvest *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvMaltainvest `json:"maltainvest,omitempty"` + Iom *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom `json:"iom,omitempty"` // This represents whether the client is allowed or not to create an account under // this jurisdiction - Samoa *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoa `json:"samoa,omitempty"` + Labuan *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan `json:"labuan,omitempty"` // This represents whether the client is allowed or not to create an account under // this jurisdiction - SamoaVirtual *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSamoaVirtual `json:"samoa-virtual,omitempty"` + Malta *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta `json:"malta,omitempty"` // This represents whether the client is allowed or not to create an account under // this jurisdiction - Svg *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvSvg `json:"svg,omitempty"` + Maltainvest *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest `json:"maltainvest,omitempty"` // This represents whether the client is allowed or not to create an account under // this jurisdiction - Vanuatu *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvVanuatu `json:"vanuatu,omitempty"` + Samoa *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa `json:"samoa,omitempty"` // This represents whether the client is allowed or not to create an account under // this jurisdiction - Virtual *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvVirtual `json:"virtual,omitempty"` -} - -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus string - -type GetAccountStatusRespGetAccountStatusAuthenticationAttemptsHistoryElemStatus string - -// 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 -} + SamoaVirtual *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual `json:"samoa-virtual,omitempty"` -const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusNone GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusPending GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "verified" -const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "expired" -const GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus = "suspected" + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Svg *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg `json:"svg,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Vanuatu *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu `json:"vanuatu,omitempty"` + + // This represents whether the client is allowed or not to create an account under + // this jurisdiction + Virtual *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual `json:"virtual,omitempty"` +} type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi int -// 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 v, ok := raw["echo_req"]; !ok || v == nil { - return fmt.Errorf("field echo_req in GetAccountStatusResp: required") - } - if v, ok := raw["msg_type"]; !ok || v == nil { - return fmt.Errorf("field msg_type in GetAccountStatusResp: required") - } - type Plain GetAccountStatusResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = GetAccountStatusResp(plain) - return nil +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -519,23 +693,11 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJuris return nil } -// Echo of the request made. -type GetAccountStatusRespEchoReq map[string]interface{} - -// A message with Account Status -type GetAccountStatusResp struct { - // Echo of the request made. - EchoReq GetAccountStatusRespEchoReq `json:"echo_req"` - - // Account status details - GetAccountStatus *GetAccountStatusRespGetAccountStatus `json:"get_account_status,omitempty"` - - // Action name of the request made. - MsgType GetAccountStatusRespMsgType `json:"msg_type"` +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl int - // Optional field sent in request to map to response, present only when request - // contains `req_id`. - ReqId *int `json:"req_id,omitempty"` +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -560,7 +722,10 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJuris type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom int -const GetAccountStatusRespMsgTypeGetAccountStatus GetAccountStatusRespMsgType = "get_account_status" +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom) UnmarshalJSON(b []byte) error { @@ -584,24 +749,9 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJuris type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan int -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_GetAccountStatusRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespMsgType, v) - } - *j = GetAccountStatusRespMsgType(v) - return nil +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -626,209 +776,66 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJuris type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta int -type GetAccountStatusRespMsgType string - -// UnmarshalJSON implements json.Unmarshaler. -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_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta(v) - return nil -} - -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest int - -// UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatus) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - return err - } - if v, ok := raw["currency_config"]; !ok || v == nil { - return fmt.Errorf("field currency_config in GetAccountStatusRespGetAccountStatus: required") - } - if v, ok := raw["p2p_poa_required"]; !ok || v == nil { - return fmt.Errorf("field p2p_poa_required in GetAccountStatusRespGetAccountStatus: required") - } - if v, ok := raw["p2p_status"]; !ok || v == nil { - return fmt.Errorf("field p2p_status in GetAccountStatusRespGetAccountStatus: required") - } - if v, ok := raw["prompt_client_to_authenticate"]; !ok || v == nil { - return fmt.Errorf("field prompt_client_to_authenticate in GetAccountStatusRespGetAccountStatus: required") - } - if v, ok := raw["risk_classification"]; !ok || v == nil { - return fmt.Errorf("field risk_classification in GetAccountStatusRespGetAccountStatus: required") - } - if v, ok := raw["status"]; !ok || v == nil { - return fmt.Errorf("field status in GetAccountStatusRespGetAccountStatus: required") - } - type Plain GetAccountStatusRespGetAccountStatus - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = GetAccountStatusRespGetAccountStatus(plain) - return nil +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest) 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_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest, v) - } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest(v) - return nil -} - -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa int - -// Account status details -type GetAccountStatusRespGetAccountStatus struct { - // This represents the authentication status of the user and it includes what - // authentication is needed. - Authentication *GetAccountStatusRespGetAccountStatusAuthentication `json:"authentication,omitempty"` - - // Contains missing profile fields required for cashier access. - CashierMissingFields []string `json:"cashier_missing_fields,omitempty"` - - // If the cashier is unavailble, this array contains one or more error codes for - // each reason. - CashierValidation []string `json:"cashier_validation,omitempty"` - - // Provides cashier details for client currency. - CurrencyConfig GetAccountStatusRespGetAccountStatusCurrencyConfig `json:"currency_config"` - - // P2P requires proof of address. - P2PPoaRequired GetAccountStatusRespGetAccountStatusP2PPoaRequired `json:"p2p_poa_required"` - - // Current P2P status of client. - P2PStatus GetAccountStatusRespGetAccountStatusP2PStatus `json:"p2p_status"` - - // Indicates whether the client should be prompted to authenticate their account. - PromptClientToAuthenticate GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate `json:"prompt_client_to_authenticate"` - - // Client risk classification: `low`, `standard`, `high`. - RiskClassification string `json:"risk_classification"` - - // Social identity provider a user signed up with. - SocialIdentityProvider *GetAccountStatusRespGetAccountStatusSocialIdentityProvider `json:"social_identity_provider,omitempty"` - - // Account status. Possible status: - // - `address_verified`: client's address is verified by third party services. - // - `allow_document_upload`: client is allowed to upload documents. - // - `age_verification`: client is age-verified. - // - `authenticated`: client is fully authenticated. - // - `cashier_locked`: cashier is locked. - // - `crs_tin_information`: client has updated tax related information. - // - `deposit_locked`: deposit is not allowed. - // - `disabled`: account is disabled. - // - `document_expired`: client's submitted proof-of-identity documents have - // expired. - // - `document_expiring_soon`: client's submitted proof-of-identity documents are - // expiring within a month. - // - `dxtrade_password_not_set`: Deriv X password is not set. - // - `financial_assessment_not_complete`: client should complete their financial - // assessment. - // - `financial_information_not_complete`: client has not completed financial - // assessment. - // - `financial_risk_approval`: client has accepted financial risk disclosure. - // - `max_turnover_limit_not_set`: client has not set financial limits on their - // account. Applies to UK and Malta clients. - // - `mt5_password_not_set`: MT5 password is not set. - // - `mt5_withdrawal_locked`: MT5 deposits allowed, but withdrawal is not allowed. - // - `needs_affiliate_coc_approval`: user must approve the Affiliate's Code of - // Conduct Agreement. - // - `no_trading`: trading is disabled. - // - `no_withdrawal_or_trading`: client cannot trade or withdraw but can deposit. - // - `p2p_blocked_for_pa`: p2p is blocked for the current payment agent client. - // - `pa_withdrawal_explicitly_allowed`: withdrawal through payment agent is - // allowed. - // - `password_reset_required`: this client must reset their password. - // - `professional`: this client has opted for a professional account. - // - `professional_requested`: this client has requested for a professional - // account. - // - `professional_rejected`: this client's request for a professional account has - // been rejected. - // - `social_signup`: this client is using social signup. - // - `trading_experience_not_complete`: client has not completed the trading - // experience questionnaire. - // - `ukgc_funds_protection`: client has acknowledged UKGC funds protection - // notice. - // - `unwelcome`: client cannot deposit or buy contracts, but can withdraw or sell - // contracts. - // - `withdrawal_locked`: deposits allowed but withdrawals are not allowed. - // - `deposit_attempt`: this prevent a client from changing the account currency - // after deposit attempt. - // - `poi_name_mismatch`: client POI documents name mismatch. - // - `allow_poa_resubmission`: the client can resubmit POA documents. - // - `allow_poi_resubmission`: the client can resubmit POI documents. - // - `shared_payment_method`: the client has been sharing payment methods. - // - `personal_details_locked`: client is not allowed to edit personal profile - // details. - // - `transfers_blocked`: it block any transfer between two accounts. - // - `df_deposit_requires_poi`: the DF deposit will be blocked until the client - // gets age verified. - // - `authenticated_with_idv_photoid`: the client has been fully authenticated by - // IDV. - // - `idv_revoked`: the client used to be fully authenticated by IDV but it was - // taken away due to compliance criteria. - // - `mt5_additional_kyc_required`: client tax information, place of birth and - // account opening reason is missing. - // - `poi_expiring_soon`: the POI documents of the client will get expired soon, - // allow them to reupload POI documents. - // - `poa_expiring_soon`: the POA documents of the client will get outdated soon, - // allow them to reupload POA documents. - // - `tin_manually_approved`: the client's tax_identification_number has been - // manually approved as client is not applicable for tax_identification_number - Status []string `json:"status"` + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + 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_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta, v) + } + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta(v) + return nil +} + +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest int + +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest = []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 GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa int + type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual int -const GetAccountStatusRespGetAccountStatusSocialIdentityProviderApple GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "apple" +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual) UnmarshalJSON(b []byte) error { @@ -850,76 +857,92 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJuris return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg int - -const GetAccountStatusRespGetAccountStatusSocialIdentityProviderFacebook GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "facebook" +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg) 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_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg { + 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_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa(v) return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu int +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg int -const GetAccountStatusRespGetAccountStatusSocialIdentityProviderGoogle GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "google" +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu) UnmarshalJSON(b []byte) error { +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_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu { + 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_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg(v) return nil } -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual int +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu int + +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusSocialIdentityProvider) UnmarshalJSON(b []byte) error { - var v string +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_GetAccountStatusRespGetAccountStatusSocialIdentityProvider { + 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_GetAccountStatusRespGetAccountStatusSocialIdentityProvider, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu, v) } - *j = GetAccountStatusRespGetAccountStatusSocialIdentityProvider(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu(v) return nil } +type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual int + +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual) UnmarshalJSON(b []byte) error { var v int @@ -940,103 +963,98 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJuris 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 - // this jurisdiction - Bvi *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionBvi `json:"bvi,omitempty"` - - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Dsl *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl `json:"dsl,omitempty"` - - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Iom *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionIom `json:"iom,omitempty"` - - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Labuan *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionLabuan `json:"labuan,omitempty"` - - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Malta *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMalta `json:"malta,omitempty"` - - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Maltainvest *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionMaltainvest `json:"maltainvest,omitempty"` +// The authentication status for identity. +type GetAccountStatusRespGetAccountStatusAuthenticationIdentity struct { + // This is the epoch of the document expiry date. + ExpiryDate *int `json:"expiry_date,omitempty"` - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Samoa *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoa `json:"samoa,omitempty"` + // This shows the information about the authentication services implemented + Services *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServices `json:"services,omitempty"` - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - SamoaVirtual *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSamoaVirtual `json:"samoa-virtual,omitempty"` + // This represent the current status for proof of identity document submitted for + // authentication. + Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus `json:"status,omitempty"` +} - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Svg *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionSvg `json:"svg,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 represents whether the client is allowed or not to create an account under - // this jurisdiction - Vanuatu *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu `json:"vanuatu,omitempty"` + // This shows the information related to the manual POI checks + Manual *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManual `json:"manual,omitempty"` - // This represents whether the client is allowed or not to create an account under - // this jurisdiction - Virtual *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual `json:"virtual,omitempty"` + // This shows the information related to Onfido supported services + Onfido *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfido `json:"onfido,omitempty"` } -// The authentication status for document. -type GetAccountStatusRespGetAccountStatusAuthenticationDocument struct { - // This represents the current status of idv authentication for each mt5 - // jurisdiction. - AuthenticatedWithIdv *GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdv `json:"authenticated_with_idv,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"` - // This represents the current status of the proof of address document submitted - // for authentication. - Status *GetAccountStatusRespGetAccountStatusAuthenticationDocumentStatus `json:"status,omitempty"` + // Show the last IDV reported reasons for the rejected cases + LastRejected []string `json:"last_rejected,omitempty"` - // This represents the current status of authentication for each mt5 jurisdiction. - VerifiedJurisdiction *GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdiction `json:"verified_jurisdiction,omitempty"` -} + // Indicate if the verification report was returned by the provider + ReportAvailable *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable `json:"report_available,omitempty"` -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable int + // Shows the latest document properties detected and reported by IDVS + ReportedProperties GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportedProperties `json:"reported_properties,omitempty"` -type GetAccountStatusRespGetAccountStatusSocialIdentityProvider string + // This represents the status of the latest IDV check. + Status *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus `json:"status,omitempty"` -type GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionDsl int + // This shows the number of IDV submissions left for the client + SubmissionsLeft *int `json:"submissions_left,omitempty"` +} -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "expired" +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable int -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentAuthenticatedWithIdvVanuatu = []interface{}{ +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable) 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_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable { 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_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable, v) } - *j = GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate(v) + *j = GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable(v) 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", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus) UnmarshalJSON(b []byte) error { var v string @@ -1057,38 +1075,29 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvSt return nil } -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = "verified" - -// Shows the latest document properties detected and reported by IDVS -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportedProperties map[string]interface{} - -// 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"` +// 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 -type GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate int +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 *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus) UnmarshalJSON(b []byte) error { @@ -1110,22 +1119,39 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManua return nil } -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "verified" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "expired" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = "suspected" +// 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 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"` + // 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"` } type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported int -const GetAccountStatusRespGetAccountStatusP2PStatusPermBan GetAccountStatusRespGetAccountStatusP2PStatus = "perm_ban" +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported = []interface{}{ + 1, + 0, +} // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported) UnmarshalJSON(b []byte) error { @@ -1152,7 +1178,21 @@ type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoRep type GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus string -const GetAccountStatusRespGetAccountStatusP2PStatusTempBan GetAccountStatusRespGetAccountStatusP2PStatus = "temp_ban" +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 { @@ -1174,56 +1214,24 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfid return nil } -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "verified" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "expired" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = "suspected" - -// 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"` -} - -// 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"` +type GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus string - // This shows the information related to the manual POI checks - Manual *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManual `json:"manual,omitempty"` +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "expired" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "none" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "pending" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "rejected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "suspected" +const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "verified" - // This shows the information related to Onfido supported services - Onfido *GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfido `json:"onfido,omitempty"` +var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = []interface{}{ + "none", + "pending", + "rejected", + "verified", + "expired", + "suspected", } -type GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus string - -const GetAccountStatusRespGetAccountStatusP2PStatusActive GetAccountStatusRespGetAccountStatusP2PStatus = "active" - // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus) UnmarshalJSON(b []byte) error { var v string @@ -1244,29 +1252,30 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus) Unmar return nil } -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "verified" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusExpired GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "expired" -const GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatusSuspected GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = "suspected" - -// The authentication status for identity. -type GetAccountStatusRespGetAccountStatusAuthenticationIdentity struct { - // This is the epoch of the document expiry date. +// 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"` - // 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"` + // Current status of the proof of income document submitted for authentication. + Status *GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus `json:"status,omitempty"` } type GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus string -const GetAccountStatusRespGetAccountStatusP2PStatusNone GetAccountStatusRespGetAccountStatusP2PStatus = "none" +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", + "rejected", + "verified", + "locked", +} // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus) UnmarshalJSON(b []byte) error { @@ -1288,19 +1297,13 @@ func (j *GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus) Unmarsh return nil } -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusNone GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusPending GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "verified" -const GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatusLocked GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = "locked" - -// 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"` +// 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"` - // Current status of the proof of income document submitted for authentication. - Status *GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus `json:"status,omitempty"` + // This represents the current status of the proof of ownership + Status *GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus `json:"status,omitempty"` } type GetAccountStatusRespGetAccountStatusAuthenticationOwnershipRequestsElem struct { @@ -1313,12 +1316,106 @@ type GetAccountStatusRespGetAccountStatusAuthenticationOwnershipRequestsElem str // 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"` + // 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{}{ + "none", + "pending", + "rejected", + "verified", +} + +// UnmarshalJSON implements json.Unmarshaler. +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_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus, v) + } + *j = GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus(v) + return nil +} + +// 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 _, ok := raw["needs_verification"]; raw != nil && !ok { + 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 +} + +// 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 + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + 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_GetAccountStatusRespGetAccountStatusP2PPoaRequired, v) + } + *j = GetAccountStatusRespGetAccountStatusP2PPoaRequired(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", } -type GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus string - // UnmarshalJSON implements json.Unmarshaler. func (j *GetAccountStatusRespGetAccountStatusP2PStatus) UnmarshalJSON(b []byte) error { var v string @@ -1339,222 +1436,143 @@ func (j *GetAccountStatusRespGetAccountStatusP2PStatus) UnmarshalJSON(b []byte) return nil } +type GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate int + +var enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate = []interface{}{ + 1, + 0, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus) UnmarshalJSON(b []byte) error { - var v string +func (j *GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus { + for _, expected := range enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate { 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_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate, v) } - *j = GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus(v) + *j = GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate(v) return nil } -const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusNone GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "none" -const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusPending GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "pending" -const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusRejected GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "rejected" -const GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatusVerified GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = "verified" +type GetAccountStatusRespGetAccountStatusSocialIdentityProvider string -// 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"` +const GetAccountStatusRespGetAccountStatusSocialIdentityProviderApple GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "apple" +const GetAccountStatusRespGetAccountStatusSocialIdentityProviderFacebook GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "facebook" +const GetAccountStatusRespGetAccountStatusSocialIdentityProviderGoogle GetAccountStatusRespGetAccountStatusSocialIdentityProvider = "google" - // This represents the current status of the proof of ownership - Status *GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus `json:"status,omitempty"` +var enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider = []interface{}{ + "google", + "facebook", + "apple", } -// This represents the authentication status of the user and it includes what -// authentication is needed. -type GetAccountStatusRespGetAccountStatusAuthentication struct { - // POI attempts made by the client - Attempts *GetAccountStatusRespGetAccountStatusAuthenticationAttempts `json:"attempts,omitempty"` - - // The authentication status for document. - Document *GetAccountStatusRespGetAccountStatusAuthenticationDocument `json:"document,omitempty"` - - // The authentication status for identity. - Identity *GetAccountStatusRespGetAccountStatusAuthenticationIdentity `json:"identity,omitempty"` - - // The authentication status for source of income document. - Income *GetAccountStatusRespGetAccountStatusAuthenticationIncome `json:"income,omitempty"` - - // An array containing the list of required authentication. - NeedsVerification []string `json:"needs_verification"` - - // The current state of the proof of ownership. - Ownership *GetAccountStatusRespGetAccountStatusAuthenticationOwnership `json:"ownership,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +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_GetAccountStatusRespGetAccountStatusSocialIdentityProvider { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider, v) + } + *j = GetAccountStatusRespGetAccountStatusSocialIdentityProvider(v) + return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusAuthentication) UnmarshalJSON(b []byte) error { +func (j *GetAccountStatusRespGetAccountStatus) 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") + if _, ok := raw["currency_config"]; raw != nil && !ok { + return fmt.Errorf("field currency_config in GetAccountStatusRespGetAccountStatus: required") } - type Plain GetAccountStatusRespGetAccountStatusAuthentication + if _, ok := raw["p2p_poa_required"]; raw != nil && !ok { + return fmt.Errorf("field p2p_poa_required in GetAccountStatusRespGetAccountStatus: required") + } + if _, ok := raw["p2p_status"]; raw != nil && !ok { + return fmt.Errorf("field p2p_status in GetAccountStatusRespGetAccountStatus: required") + } + if _, ok := raw["prompt_client_to_authenticate"]; raw != nil && !ok { + return fmt.Errorf("field prompt_client_to_authenticate in GetAccountStatusRespGetAccountStatus: required") + } + if _, ok := raw["risk_classification"]; raw != nil && !ok { + return fmt.Errorf("field risk_classification in GetAccountStatusRespGetAccountStatus: required") + } + if _, ok := raw["status"]; raw != nil && !ok { + return fmt.Errorf("field status in GetAccountStatusRespGetAccountStatus: required") + } + type Plain GetAccountStatusRespGetAccountStatus var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = GetAccountStatusRespGetAccountStatusAuthentication(plain) + *j = GetAccountStatusRespGetAccountStatus(plain) return nil } -// Provides cashier details for client currency. -type GetAccountStatusRespGetAccountStatusCurrencyConfig map[string]interface{} +type GetAccountStatusRespMsgType string -type GetAccountStatusRespGetAccountStatusP2PPoaRequired int +const GetAccountStatusRespMsgTypeGetAccountStatus GetAccountStatusRespMsgType = "get_account_status" -type GetAccountStatusRespGetAccountStatusP2PStatus string +var enumValues_GetAccountStatusRespMsgType = []interface{}{ + "get_account_status", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *GetAccountStatusRespGetAccountStatusP2PPoaRequired) UnmarshalJSON(b []byte) error { - var v int +func (j *GetAccountStatusRespMsgType) 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_GetAccountStatusRespMsgType { 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_GetAccountStatusRespMsgType, v) } - *j = GetAccountStatusRespGetAccountStatusP2PPoaRequired(v) + *j = GetAccountStatusRespMsgType(v) return nil } -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVanuatu = []interface{}{ - 0, - 1, -} -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_GetAccountStatusRespGetAccountStatusAuthenticationDocumentVerifiedJurisdictionVirtual = []interface{}{ - 0, - 1, -} -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvReportAvailable = []interface{}{ - 0, - 1, -} -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesIdvStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", -} -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesManualStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", - "suspected", -} -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoIsCountrySupported = []interface{}{ - 1, - 0, -} -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityServicesOnfidoStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", - "suspected", -} -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIdentityStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "expired", - "suspected", -} -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationIncomeStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", - "locked", -} -var enumValues_GetAccountStatusRespGetAccountStatusAuthenticationOwnershipStatus = []interface{}{ - "none", - "pending", - "rejected", - "verified", -} -var enumValues_GetAccountStatusRespGetAccountStatusP2PPoaRequired = []interface{}{ - 0, - 1, -} -var enumValues_GetAccountStatusRespGetAccountStatusP2PStatus = []interface{}{ - "none", - "active", - "temp_ban", - "perm_ban", -} -var enumValues_GetAccountStatusRespGetAccountStatusPromptClientToAuthenticate = []interface{}{ - 1, - 0, -} -var enumValues_GetAccountStatusRespGetAccountStatusSocialIdentityProvider = []interface{}{ - "google", - "facebook", - "apple", -} -var enumValues_GetAccountStatusRespMsgType = []interface{}{ - "get_account_status", +// 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 { + return fmt.Errorf("field echo_req in GetAccountStatusResp: required") + } + if _, ok := raw["msg_type"]; raw != nil && !ok { + return fmt.Errorf("field msg_type in GetAccountStatusResp: required") + } + type Plain GetAccountStatusResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = GetAccountStatusResp(plain) + return nil } diff --git a/schema/get_financial_assessment.go b/schema/get_financial_assessment.go index c4e97c4..f0eb9da 100644 --- a/schema/get_financial_assessment.go +++ b/schema/get_financial_assessment.go @@ -6,6 +6,25 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,25 +51,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["get_financial_assessment"]; !ok || v == nil { + if _, ok := raw["get_financial_assessment"]; raw != nil && !ok { 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 97b733d..9b9894e 100644 --- a/schema/get_financial_assessment_resp.go +++ b/schema/get_financial_assessment_resp.go @@ -6,6 +6,22 @@ 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{} @@ -134,6 +150,8 @@ type GetFinancialAssessmentRespGetFinancialAssessment struct { type GetFinancialAssessmentRespMsgType string +const GetFinancialAssessmentRespMsgTypeGetFinancialAssessment GetFinancialAssessmentRespMsgType = "get_financial_assessment" + var enumValues_GetFinancialAssessmentRespMsgType = []interface{}{ "get_financial_assessment", } @@ -158,34 +176,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in GetFinancialAssessmentResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 153a170..2d25d0b 100644 --- a/schema/get_limits.go +++ b/schema/get_limits.go @@ -6,6 +6,23 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["get_limits"]; !ok || v == nil { + if _, ok := raw["get_limits"]; raw != nil && !ok { 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 083f4f2..0b27988 100644 --- a/schema/get_limits_resp.go +++ b/schema/get_limits_resp.go @@ -150,6 +150,10 @@ 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", } @@ -174,20 +178,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in GetLimitsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 c0ac4ce..df6749a 100644 --- a/schema/get_self_exclusion.go +++ b/schema/get_self_exclusion.go @@ -6,6 +6,25 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,25 +51,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["get_self_exclusion"]; !ok || v == nil { + if _, ok := raw["get_self_exclusion"]; raw != nil && !ok { 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 e098d4c..c517542 100644 --- a/schema/get_self_exclusion_resp.go +++ b/schema/get_self_exclusion_resp.go @@ -6,6 +6,22 @@ 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{} @@ -59,6 +75,8 @@ type GetSelfExclusionRespGetSelfExclusion struct { type GetSelfExclusionRespMsgType string +const GetSelfExclusionRespMsgTypeGetSelfExclusion GetSelfExclusionRespMsgType = "get_self_exclusion" + var enumValues_GetSelfExclusionRespMsgType = []interface{}{ "get_self_exclusion", } @@ -83,34 +101,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in GetSelfExclusionResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 0b9287c..2c0787b 100644 --- a/schema/get_settings.go +++ b/schema/get_settings.go @@ -6,6 +6,23 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["get_settings"]; !ok || v == nil { + if _, ok := raw["get_settings"]; raw != nil && !ok { 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 ba5e930..1735393 100644 --- a/schema/get_settings_resp.go +++ b/schema/get_settings_resp.go @@ -152,165 +152,134 @@ 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 { - // (Optional) Indicates the timestamp for the next verification attempt - NextAttempt *int `json:"next_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 *GetSettingsResp) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *GetSettingsRespGetSettingsAllowCopiers) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - if v, ok := raw["echo_req"]; !ok || v == nil { - return fmt.Errorf("field echo_req in GetSettingsResp: required") - } - if v, ok := raw["msg_type"]; !ok || v == nil { - return fmt.Errorf("field msg_type in GetSettingsResp: required") + var ok bool + for _, expected := range enumValues_GetSettingsRespGetSettingsAllowCopiers { + 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_GetSettingsRespGetSettingsAllowCopiers, v) } - *j = GetSettingsResp(plain) + *j = GetSettingsRespGetSettingsAllowCopiers(v) return nil } +type GetSettingsRespGetSettingsDxtradeUserException int + +var enumValues_GetSettingsRespGetSettingsDxtradeUserException = []interface{}{ + 0, + 1, +} + // 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 *GetSettingsRespGetSettingsDxtradeUserException) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - if v, ok := raw["verified"]; !ok || v == nil { - return fmt.Errorf("field verified in GetSettingsRespGetSettingsPhoneNumberVerification: required") + var ok bool + for _, expected := range enumValues_GetSettingsRespGetSettingsDxtradeUserException { + 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_GetSettingsRespGetSettingsDxtradeUserException, v) } - *j = GetSettingsRespGetSettingsPhoneNumberVerification(plain) + *j = GetSettingsRespGetSettingsDxtradeUserException(v) return nil } +type GetSettingsRespGetSettingsEmailConsent int + +var enumValues_GetSettingsRespGetSettingsEmailConsent = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsNonPepDeclaration) 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_GetSettingsRespGetSettingsNonPepDeclaration { + 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_GetSettingsRespGetSettingsNonPepDeclaration, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsEmailConsent, v) } - *j = GetSettingsRespGetSettingsNonPepDeclaration(v) + *j = GetSettingsRespGetSettingsEmailConsent(v) return nil } -var enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent = []interface{}{ - 0, - 1, -} -var enumValues_GetSettingsRespGetSettingsPhoneNumberVerificationVerified = []interface{}{ - 0, - 1, +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsPhoneNumberVerificationVerified) 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_GetSettingsRespGetSettingsPhoneNumberVerificationVerified { + 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_GetSettingsRespGetSettingsPhoneNumberVerificationVerified, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsEmploymentStatus, v) } - *j = GetSettingsRespGetSettingsPhoneNumberVerificationVerified(v) + *j = GetSettingsRespGetSettingsEmploymentStatus(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 @@ -331,7 +300,9 @@ func (j *GetSettingsRespGetSettingsFeatureFlagWallet) UnmarshalJSON(b []byte) er return nil } -var enumValues_GetSettingsRespGetSettingsNonPepDeclaration = []interface{}{ +type GetSettingsRespGetSettingsHasSecretAnswer int + +var enumValues_GetSettingsRespGetSettingsHasSecretAnswer = []interface{}{ 0, 1, } @@ -356,151 +327,186 @@ func (j *GetSettingsRespGetSettingsHasSecretAnswer) UnmarshalJSON(b []byte) erro return nil } +type GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent int + +var enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsRequestProfessionalStatus) UnmarshalJSON(b []byte) error { +func (j *GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent) 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_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent { 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_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent, v) } - *j = GetSettingsRespGetSettingsRequestProfessionalStatus(v) + *j = GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent(v) return nil } -var enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus = []interface{}{ +type GetSettingsRespGetSettingsNonPepDeclaration int + +var enumValues_GetSettingsRespGetSettingsNonPepDeclaration = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsEmploymentStatus) UnmarshalJSON(b []byte) error { - var v string +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_GetSettingsRespGetSettingsEmploymentStatus { + 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_GetSettingsRespGetSettingsEmploymentStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsNonPepDeclaration, v) } - *j = GetSettingsRespGetSettingsEmploymentStatus(v) + *j = GetSettingsRespGetSettingsNonPepDeclaration(v) return nil } +// The status of the Phone Number Verification. +type GetSettingsRespGetSettingsPhoneNumberVerification struct { + // (Optional) Indicates the timestamp for the next verification attempt + NextAttempt *int `json:"next_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 *GetSettingsRespGetSettingsEmailConsent) UnmarshalJSON(b []byte) error { +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_GetSettingsRespGetSettingsEmailConsent { + 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_GetSettingsRespGetSettingsEmailConsent, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsPhoneNumberVerificationVerified, v) } - *j = GetSettingsRespGetSettingsEmailConsent(v) + *j = GetSettingsRespGetSettingsPhoneNumberVerificationVerified(v) return nil } -var enumValues_GetSettingsRespMsgType = []interface{}{ - "get_settings", -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespMsgType) UnmarshalJSON(b []byte) error { - var v string - 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_GetSettingsRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if _, ok := raw["verified"]; raw != nil && !ok { + return fmt.Errorf("field verified in GetSettingsRespGetSettingsPhoneNumberVerification: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespMsgType, v) + type Plain GetSettingsRespGetSettingsPhoneNumberVerification + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err } - *j = GetSettingsRespMsgType(v) + *j = GetSettingsRespGetSettingsPhoneNumberVerification(plain) return nil } +type GetSettingsRespGetSettingsRequestProfessionalStatus int + +var enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsDxtradeUserException) 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_GetSettingsRespGetSettingsDxtradeUserException { + 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_GetSettingsRespGetSettingsDxtradeUserException, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsRequestProfessionalStatus, v) } - *j = GetSettingsRespGetSettingsDxtradeUserException(v) + *j = GetSettingsRespGetSettingsRequestProfessionalStatus(v) return nil } +type GetSettingsRespMsgType string + +const GetSettingsRespMsgTypeGetSettings GetSettingsRespMsgType = "get_settings" + +var enumValues_GetSettingsRespMsgType = []interface{}{ + "get_settings", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsAllowCopiers) UnmarshalJSON(b []byte) error { - var v int +func (j *GetSettingsRespMsgType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_GetSettingsRespGetSettingsAllowCopiers { + for _, expected := range enumValues_GetSettingsRespMsgType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsAllowCopiers, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespMsgType, v) } - *j = GetSettingsRespGetSettingsAllowCopiers(v) + *j = GetSettingsRespMsgType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent) 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_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if _, ok := raw["echo_req"]; raw != nil && !ok { + return fmt.Errorf("field echo_req in GetSettingsResp: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent, v) + if _, ok := raw["msg_type"]; raw != nil && !ok { + return fmt.Errorf("field msg_type in GetSettingsResp: required") } - *j = GetSettingsRespGetSettingsIsAuthenticatedPaymentAgent(v) + type Plain GetSettingsResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = GetSettingsResp(plain) return nil } diff --git a/schema/identity_verification_document_add.go b/schema/identity_verification_document_add.go index 0c78aeb..545012c 100644 --- a/schema/identity_verification_document_add.go +++ b/schema/identity_verification_document_add.go @@ -6,32 +6,6 @@ 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 { @@ -63,6 +37,32 @@ 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 v, ok := raw["document_number"]; !ok || v == nil { + if _, ok := raw["document_number"]; raw != nil && !ok { return fmt.Errorf("field document_number in IdentityVerificationDocumentAdd: required") } - if v, ok := raw["document_type"]; !ok || v == nil { + if _, ok := raw["document_type"]; raw != nil && !ok { return fmt.Errorf("field document_type in IdentityVerificationDocumentAdd: required") } - if v, ok := raw["identity_verification_document_add"]; !ok || v == nil { + if _, ok := raw["identity_verification_document_add"]; raw != nil && !ok { return fmt.Errorf("field identity_verification_document_add in IdentityVerificationDocumentAdd: required") } - if v, ok := raw["issuing_country"]; !ok || v == nil { + if _, ok := raw["issuing_country"]; raw != nil && !ok { 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 d5ad45c..25a87c6 100644 --- a/schema/identity_verification_document_add_resp.go +++ b/schema/identity_verification_document_add_resp.go @@ -6,6 +6,23 @@ 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{} @@ -37,6 +54,8 @@ func (j *IdentityVerificationDocumentAddRespIdentityVerificationDocumentAdd) Unm type IdentityVerificationDocumentAddRespMsgType string +const IdentityVerificationDocumentAddRespMsgTypeIdentityVerificationDocumentAdd IdentityVerificationDocumentAddRespMsgType = "identity_verification_document_add" + var enumValues_IdentityVerificationDocumentAddRespMsgType = []interface{}{ "identity_verification_document_add", } @@ -61,35 +80,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in IdentityVerificationDocumentAddResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 71091ea..0d7325b 100644 --- a/schema/kyc_auth_status.go +++ b/schema/kyc_auth_status.go @@ -32,6 +32,30 @@ 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" @@ -60,26 +84,6 @@ 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 @@ -104,17 +108,13 @@ 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 v, ok := raw["kyc_auth_status"]; !ok || v == nil { + if _, ok := raw["kyc_auth_status"]; raw != nil && !ok { 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 711cc22..d672a94 100644 --- a/schema/kyc_auth_status_resp.go +++ b/schema/kyc_auth_status_resp.go @@ -6,6 +6,23 @@ 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{} @@ -15,6 +32,8 @@ type KycAuthStatusRespKycAuthStatus map[string]interface{} type KycAuthStatusRespMsgType string +const KycAuthStatusRespMsgTypeKycAuthStatus KycAuthStatusRespMsgType = "kyc_auth_status" + var enumValues_KycAuthStatusRespMsgType = []interface{}{ "kyc_auth_status", } @@ -39,35 +58,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in KycAuthStatusResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 1ef28dc..765c88c 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 v, ok := raw["landing_company"]; !ok || v == nil { + if _, ok := raw["landing_company"]; raw != nil && !ok { 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 ab88079..8781a37 100644 --- a/schema/landing_company_details.go +++ b/schema/landing_company_details.go @@ -40,6 +40,20 @@ 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 @@ -64,27 +78,13 @@ 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 v, ok := raw["landing_company_details"]; !ok || v == nil { + if _, ok := raw["landing_company_details"]; raw != nil && !ok { 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 636b201..8eb1779 100644 --- a/schema/landing_company_details_resp.go +++ b/schema/landing_company_details_resp.go @@ -132,6 +132,31 @@ 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 @@ -216,28 +241,10 @@ func (j *LandingCompanyDetailsRespLandingCompanyDetailsTinNotMandatory) Unmarsha return nil } -// 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 -} - type LandingCompanyDetailsRespMsgType string +const LandingCompanyDetailsRespMsgTypeLandingCompanyDetails LandingCompanyDetailsRespMsgType = "landing_company_details" + var enumValues_LandingCompanyDetailsRespMsgType = []interface{}{ "landing_company_details", } @@ -262,23 +269,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in LandingCompanyDetailsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 661a2b6..51d14c4 100644 --- a/schema/landing_company_resp.go +++ b/schema/landing_company_resp.go @@ -6,71 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory, v) - } - *j = LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory(v) - return nil -} - -type LandingCompanyRespLandingCompanyIsIdvSupported int - -// 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 v, ok := raw["echo_req"]; !ok || v == nil { - return fmt.Errorf("field echo_req in LandingCompanyResp: required") - } - if v, ok := raw["msg_type"]; !ok || v == nil { - 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 -} - -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyAddressParseable { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyAddressParseable, v) - } - *j = LandingCompanyRespLandingCompanyAddressParseable(v) - return nil -} - -type LandingCompanyRespLandingCompanyAllCompany string - // Returns the Landing Company for clients of a given country. type LandingCompanyResp struct { // Echo of the request made. @@ -90,71 +25,6 @@ type LandingCompanyResp struct { // Echo of the request made. type LandingCompanyRespEchoReq map[string]interface{} -const LandingCompanyRespLandingCompanyAllCompanyNone LandingCompanyRespLandingCompanyAllCompany = "none" -const LandingCompanyRespLandingCompanyAllCompanySvg LandingCompanyRespLandingCompanyAllCompany = "svg" - -// Config structure with document types ,taxRequired ,tin format details. -type LandingCompanyRespLandingCompanyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyCtraderAllStandard string - -// 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 -} - -// 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 -} - -// 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"` -} - -const LandingCompanyRespLandingCompanyCtraderAllStandardNone LandingCompanyRespLandingCompanyCtraderAllStandard = "none" -const LandingCompanyRespLandingCompanyCtraderAllStandardSvg LandingCompanyRespLandingCompanyCtraderAllStandard = "svg" - -type LandingCompanyRespLandingCompanyDerivezAllStandard string - // Landing Company type LandingCompanyRespLandingCompany struct { // Flag to indicate if address parseable or not @@ -248,187 +118,277 @@ type LandingCompanyRespLandingCompany struct { VirtualCompany *string `json:"virtual_company,omitempty"` } +type LandingCompanyRespLandingCompanyAddressParseable int + +var enumValues_LandingCompanyRespLandingCompanyAddressParseable = []interface{}{ + 1, + 0, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDerivezAllStandard) UnmarshalJSON(b []byte) error { - var v string +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_LandingCompanyRespLandingCompanyDerivezAllStandard { + 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_LandingCompanyRespLandingCompanyDerivezAllStandard, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyAddressParseable, v) } - *j = LandingCompanyRespLandingCompanyDerivezAllStandard(v) + *j = LandingCompanyRespLandingCompanyAddressParseable(v) return nil } -const LandingCompanyRespLandingCompanyDerivezAllStandardNone LandingCompanyRespLandingCompanyDerivezAllStandard = "none" - -// 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"` +type LandingCompanyRespLandingCompanyAllCompany string - // Landing Company legal name - Name *string `json:"name,omitempty"` +const LandingCompanyRespLandingCompanyAllCompanyNone LandingCompanyRespLandingCompanyAllCompany = "none" +const LandingCompanyRespLandingCompanyAllCompanySvg LandingCompanyRespLandingCompanyAllCompany = "svg" - // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyGamingCompanyRequirements `json:"requirements,omitempty"` +var enumValues_LandingCompanyRespLandingCompanyAllCompany = []interface{}{ + "svg", + "none", +} - // Landing Company short code - Shortcode *string `json:"shortcode,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 +} - // Flag that indicates whether the landing company supports professional accounts - // or not - SupportProfessionalClient *LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient `json:"support_professional_client,omitempty"` +// Config structure with document types ,taxRequired ,tin format details. +type LandingCompanyRespLandingCompanyConfig map[string]interface{} - // Flag that indicates whether tax identifier number is not mandatory for the - // current country and landing company. - TinNotMandatory *LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory `json:"tin_not_mandatory,omitempty"` +// Available CTrader accounts. +type LandingCompanyRespLandingCompanyCtrader struct { + // CTrader all account types (Synthetic Indices and Financials). + All *LandingCompanyRespLandingCompanyCtraderAll `json:"all,omitempty"` } -// Available DerivEZ accounts. -type LandingCompanyRespLandingCompanyDerivez struct { - // DerivEZ all account types (Synthetic Indices and Financials). - All *LandingCompanyRespLandingCompanyDerivezAll `json:"all,omitempty"` +// CTrader all account types (Synthetic Indices and Financials). +type LandingCompanyRespLandingCompanyCtraderAll struct { + // For standard client + Standard *LandingCompanyRespLandingCompanyCtraderAllStandard `json:"standard,omitempty"` } -const LandingCompanyRespLandingCompanyDerivezAllStandardSvg LandingCompanyRespLandingCompanyDerivezAllStandard = "svg" - -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardChangeableFields map[string]interface{} +type LandingCompanyRespLandingCompanyCtraderAllStandard string -// The configuration of each currency. -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardCurrencyConfig map[string]interface{} +const LandingCompanyRespLandingCompanyCtraderAllStandardNone LandingCompanyRespLandingCompanyCtraderAllStandard = "none" +const LandingCompanyRespLandingCompanyCtraderAllStandardSvg LandingCompanyRespLandingCompanyCtraderAllStandard = "svg" -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck int +var enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard = []interface{}{ + "svg", + "none", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyUkgcFundsProtection) UnmarshalJSON(b []byte) error { - var v int +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_LandingCompanyRespLandingCompanyUkgcFundsProtection { + 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_LandingCompanyRespLandingCompanyUkgcFundsProtection, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard, v) } - *j = LandingCompanyRespLandingCompanyUkgcFundsProtection(v) + *j = LandingCompanyRespLandingCompanyCtraderAllStandard(v) return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck) UnmarshalJSON(b []byte) error { - var v int +// Available DerivEZ accounts. +type LandingCompanyRespLandingCompanyDerivez struct { + // DerivEZ all account types (Synthetic Indices and Financials). + All *LandingCompanyRespLandingCompanyDerivezAll `json:"all,omitempty"` +} + +// 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_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck { + 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_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDerivezAllStandard, v) } - *j = LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck(v) + *j = LandingCompanyRespLandingCompanyDerivezAllStandard(v) return nil } -// After first deposit requirements -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` +// Available Deriv X all account types (Synthetic Indices and Financials). +type LandingCompanyRespLandingCompanyDxtradeAllCompany struct { + // Landing Company details. + Standard *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard `json:"standard,omitempty"` } -// Compliance requirements -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` +// Landing Company details. +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard struct { + // Landing Company address + Address []string `json:"address,omitempty"` - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` -} + // Special conditions for changing sensitive fields + ChangeableFields LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + // Landing Company country of incorporation + Country *string `json:"country,omitempty"` - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirementsCompliance `json:"compliance,omitempty"` + // The configuration of each currency. + CurrencyConfig LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardCurrencyConfig `json:"currency_config,omitempty"` - // Sign up requirements - Signup []string `json:"signup,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"` - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,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"` } -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient int +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardChangeableFields map[string]interface{} + +// The configuration of each currency. +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardCurrencyConfig map[string]interface{} + +type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck int + +var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanySkipDepositVerification) 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_LandingCompanyRespLandingCompanySkipDepositVerification { + 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_LandingCompanyRespLandingCompanySkipDepositVerification, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck, v) } - *j = LandingCompanyRespLandingCompanySkipDepositVerification(v) + *j = LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck(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 { var v int @@ -451,24 +411,9 @@ func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfess type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory int -// 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 +var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -491,26 +436,32 @@ func (j *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandator return nil } +// Available Deriv X financial account types (all except Synthetic Indices). +type LandingCompanyRespLandingCompanyDxtradeFinancialCompany struct { + // Landing Company details. + Standard *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard `json:"standard,omitempty"` +} + // Landing Company details. -type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard struct { +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard struct { // Landing Company address Address []string `json:"address,omitempty"` // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` + ChangeableFields LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardChangeableFields `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 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 *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` + HasRealityCheck *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` // Allowed contract types LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` @@ -528,24 +479,18 @@ type LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard struct { Name *string `json:"name,omitempty"` // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardRequirements `json:"requirements,omitempty"` + 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 *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` + 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 *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Available Deriv X all account types (Synthetic Indices and Financials). -type LandingCompanyRespLandingCompanyDxtradeAllCompany struct { - // Landing Company details. - Standard *LandingCompanyRespLandingCompanyDxtradeAllCompanyStandard `json:"standard,omitempty"` + TinNotMandatory *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` } // Special conditions for changing sensitive fields @@ -556,24 +501,9 @@ type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardCurrencyConf type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck int -// 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 +var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -596,6 +526,21 @@ func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasReali 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"` +} + // After first deposit requirements type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsAfterFirstDeposit struct { // Financial assessment requirements @@ -611,42 +556,12 @@ type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirements TaxInformation []string `json:"tax_information,omitempty"` } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` +type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient int - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient int - -// 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 -} +var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient) UnmarshalJSON(b []byte) error { @@ -670,24 +585,9 @@ func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportP type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory int -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyRequireAddressPostcode { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode, v) - } - *j = LandingCompanyRespLandingCompanyRequireAddressPostcode(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -710,26 +610,32 @@ func (j *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMa 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 LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard struct { +type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandard struct { // Landing Company address Address []string `json:"address,omitempty"` // Special conditions for changing sensitive fields - ChangeableFields LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` + ChangeableFields LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardChangeableFields `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"` + 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 *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` + HasRealityCheck *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` // Allowed contract types LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` @@ -747,24 +653,18 @@ type LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard struct { Name *string `json:"name,omitempty"` // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardRequirements `json:"requirements,omitempty"` + 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 *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` + 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 *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` -} - -// Available Deriv X financial account types (all except Synthetic Indices). -type LandingCompanyRespLandingCompanyDxtradeFinancialCompany struct { - // Landing Company details. - Standard *LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandard `json:"standard,omitempty"` + TinNotMandatory *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory `json:"tin_not_mandatory,omitempty"` } // Special conditions for changing sensitive fields @@ -775,24 +675,9 @@ type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardCurrencyConfig type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck int -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyNoProvince { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyNoProvince, v) - } - *j = LandingCompanyRespLandingCompanyNoProvince(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -815,21 +700,6 @@ func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityC return nil } -// 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 @@ -845,26 +715,26 @@ type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirements st 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 -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit, v) - } - *j = LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -889,24 +759,9 @@ func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProf type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory int -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory, v) - } - *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotMandatory = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -929,34 +784,34 @@ func (j *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardTinNotManda return nil } -// Landing Company details. -type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandard struct { +// 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 LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardChangeableFields `json:"changeable_fields,omitempty"` + ChangeableFields LandingCompanyRespLandingCompanyFinancialCompanyChangeableFields `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"` + 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 *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck `json:"has_reality_check,omitempty"` + HasRealityCheck *LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck `json:"has_reality_check,omitempty"` - // Allowed contract types + // Allowed contract types for this Landing Company LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - // Allowable currencies + // Allowed account currencies for this Landing Company LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - // Allowable markets + // Allowed markets for this Landing Company LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` // Default account currency @@ -966,24 +821,18 @@ type LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandard struct { Name *string `json:"name,omitempty"` // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardRequirements `json:"requirements,omitempty"` + 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 *LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient `json:"support_professional_client,omitempty"` + 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 *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"` + TinNotMandatory *LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory `json:"tin_not_mandatory,omitempty"` } // Special conditions for changing sensitive fields @@ -994,24 +843,9 @@ type LandingCompanyRespLandingCompanyFinancialCompanyCurrencyConfig map[string]i type LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck int -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient, v) - } - *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck = []interface{}{ + 1, + 0, } // UnmarshalJSON implements json.Unmarshaler. @@ -1034,6 +868,21 @@ func (j *LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck) Unmars 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 @@ -1049,58 +898,28 @@ type LandingCompanyRespLandingCompanyFinancialCompanyRequirementsCompliance stru 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"` +type LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient int - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` +var enumValues_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient = []interface{}{ + 0, + 1, } -type LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient int - // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck) 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_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck { + 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_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck, v) - } - *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient { - 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_LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient, v) } *j = LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient(v) return nil @@ -1108,24 +927,9 @@ func (j *LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClie type LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory int -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory, v) - } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -1148,34 +952,34 @@ func (j *LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory) Unmars return nil } -// Landing Company for financial contracts (all except Synthetic Indices) -type LandingCompanyRespLandingCompanyFinancialCompany struct { +// 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 LandingCompanyRespLandingCompanyFinancialCompanyChangeableFields `json:"changeable_fields,omitempty"` + ChangeableFields LandingCompanyRespLandingCompanyGamingCompanyChangeableFields `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"` + 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 *LandingCompanyRespLandingCompanyFinancialCompanyHasRealityCheck `json:"has_reality_check,omitempty"` + HasRealityCheck *LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck `json:"has_reality_check,omitempty"` - // Allowed contract types for this Landing Company + // Allowed contract types LegalAllowedContractCategories []string `json:"legal_allowed_contract_categories,omitempty"` - // Allowed account currencies for this Landing Company + // Allowable currencies LegalAllowedCurrencies []string `json:"legal_allowed_currencies,omitempty"` - // Allowed markets for this Landing Company + // Allowable markets LegalAllowedMarkets []string `json:"legal_allowed_markets,omitempty"` // Default account currency @@ -1185,18 +989,18 @@ type LandingCompanyRespLandingCompanyFinancialCompany struct { Name *string `json:"name,omitempty"` // Legal requirements for the Landing Company - Requirements *LandingCompanyRespLandingCompanyFinancialCompanyRequirements `json:"requirements,omitempty"` + 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 *LandingCompanyRespLandingCompanyFinancialCompanySupportProfessionalClient `json:"support_professional_client,omitempty"` + 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 *LandingCompanyRespLandingCompanyFinancialCompanyTinNotMandatory `json:"tin_not_mandatory,omitempty"` + TinNotMandatory *LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory `json:"tin_not_mandatory,omitempty"` } // Special conditions for changing sensitive fields @@ -1207,24 +1011,9 @@ type LandingCompanyRespLandingCompanyGamingCompanyCurrencyConfig map[string]inte type LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck int -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient, v) - } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -1247,21 +1036,6 @@ func (j *LandingCompanyRespLandingCompanyGamingCompanyHasRealityCheck) Unmarshal return nil } -// 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 @@ -1277,26 +1051,26 @@ type LandingCompanyRespLandingCompanyGamingCompanyRequirements struct { 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 -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck, v) - } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -1321,72 +1095,36 @@ func (j *LandingCompanyRespLandingCompanyGamingCompanySupportProfessionalClient) type LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory int -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory, v) - } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory(v) - return nil -} - -type LandingCompanyRespLandingCompanyAddressParseable int - -// DerivEZ all account types (Synthetic Indices and Financials). -type LandingCompanyRespLandingCompanyDerivezAll struct { - // For standard client - Standard *LandingCompanyRespLandingCompanyDerivezAllStandard `json:"standard,omitempty"` +var enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyAllCompany) UnmarshalJSON(b []byte) error { - var v string +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_LandingCompanyRespLandingCompanyAllCompany { + 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_LandingCompanyRespLandingCompanyAllCompany, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory, v) } - *j = LandingCompanyRespLandingCompanyAllCompany(v) + *j = LandingCompanyRespLandingCompanyGamingCompanyTinNotMandatory(v) return nil } -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient, v) - } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient(v) - return nil +type LandingCompanyRespLandingCompanyIsIdvSupported int + +var enumValues_LandingCompanyRespLandingCompanyIsIdvSupported = []interface{}{ + 1, + 0, } // UnmarshalJSON implements json.Unmarshaler. @@ -1409,44 +1147,11 @@ func (j *LandingCompanyRespLandingCompanyIsIdvSupported) UnmarshalJSON(b []byte) return nil } -// UnmarshalJSON implements json.Unmarshaler. -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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck, v) - } - *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck(v) - return nil -} +type LandingCompanyRespLandingCompanyMt5AgeVerification int -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory, v) - } - *j = LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory(v) - return nil +var enumValues_LandingCompanyRespLandingCompanyMt5AgeVerification = []interface{}{ + 1, + 0, } // UnmarshalJSON implements json.Unmarshaler. @@ -1469,105 +1174,11 @@ func (j *LandingCompanyRespLandingCompanyMt5AgeVerification) UnmarshalJSON(b []b return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient, v) - } - *j = LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck, v) - } - *j = LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck(v) - return nil -} - -var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardTinNotMandatory = []interface{}{ - 0, - 1, -} -var enumValues_LandingCompanyRespLandingCompanyAddressParseable = []interface{}{ - 1, - 0, -} - -// The configuration of each currency. -type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeCurrencyConfig map[string]interface{} - -// After first deposit requirements -type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` -} - -// Compliance requirements -type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirementsCompliance 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 LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` - - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirementsCompliance `json:"compliance,omitempty"` - - // Sign up requirements - Signup []string `json:"signup,omitempty"` - - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` -} - -type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient int - -var enumValues_LandingCompanyRespLandingCompanyAllCompany = []interface{}{ - "svg", - "none", -} - -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeChangeableFields map[string]interface{} - -type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory int - -const LandingCompanyRespMsgTypeLandingCompany LandingCompanyRespMsgType = "landing_company" - -var enumValues_LandingCompanyRespLandingCompanyCtraderAllStandard = []interface{}{ - "svg", - "none", +// 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 *LandingCompanyRespLandingCompanyMtAllCompanySwapFree `json:"swap_free,omitempty"` } // Landing Company for MT5 combined all Synthetic and financial @@ -1621,44 +1232,46 @@ type LandingCompanyRespLandingCompanyMtAllCompanySwapFree struct { TinNotMandatory *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory `json:"tin_not_mandatory,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 *LandingCompanyRespLandingCompanyMtAllCompanySwapFree `json:"swap_free,omitempty"` -} - // Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialChangeableFields map[string]interface{} +type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeChangeableFields map[string]interface{} // The configuration of each currency. -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck int - -type LandingCompanyRespMsgType string - -type LandingCompanyRespLandingCompanyMt5AgeVerification int +type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeCurrencyConfig map[string]interface{} -// The configuration of each currency. -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialCurrencyConfig map[string]interface{} +type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck int -// Compliance requirements -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsCompliance struct { - // Compliance MT5 requirements - Mt5 []string `json:"mt5,omitempty"` +var enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck = []interface{}{ + 0, + 1, +} - // Compliance tax information requirements - TaxInformation []string `json:"tax_information,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck, v) + } + *j = LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck(v) + return nil } // Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirements struct { +type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirements struct { // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + AfterFirstDeposit *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsCompliance `json:"compliance,omitempty"` + Compliance *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirementsCompliance `json:"compliance,omitempty"` // Sign up requirements Signup []string `json:"signup,omitempty"` @@ -1667,26 +1280,91 @@ type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirements str Withdrawal []string `json:"withdrawal,omitempty"` } -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient int +// After first deposit requirements +type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` +} -var enumValues_LandingCompanyRespLandingCompanyDerivezAllStandard = []interface{}{ - "svg", - "none", +// Compliance requirements +type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` + + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` } -var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardHasRealityCheck = []interface{}{ + +type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient int + +var enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient = []interface{}{ 0, 1, } -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory int +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient, v) + } + *j = LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient(v) + return nil +} -type LandingCompanyRespLandingCompanyUkgcFundsProtection int +type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory int -var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardSupportProfessionalClient = []interface{}{ +var enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory = []interface{}{ 0, 1, } +// UnmarshalJSON implements json.Unmarshaler. +func (j *LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory, v) + } + *j = LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory(v) + return nil +} + +// 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 @@ -1742,42 +1420,45 @@ type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancial struct { } // Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialChangeableFields map[string]interface{} +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialChangeableFields map[string]interface{} // The configuration of each currency. -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpCurrencyConfig map[string]interface{} - -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck int +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialCurrencyConfig map[string]interface{} -type LandingCompanyRespLandingCompanySkipDepositVerification int +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck int -var enumValues_LandingCompanyRespLandingCompanyDxtradeAllCompanyStandardTinNotMandatory = []interface{}{ +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck = []interface{}{ 0, 1, } -// 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"` +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck, v) + } + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialHasRealityCheck(v) + return nil } // Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirements struct { +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirements struct { // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` + AfterFirstDeposit *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsCompliance `json:"compliance,omitempty"` + Compliance *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsCompliance `json:"compliance,omitempty"` // Sign up requirements Signup []string `json:"signup,omitempty"` @@ -1786,22 +1467,19 @@ type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirements Withdrawal []string `json:"withdrawal,omitempty"` } -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient int - -type LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified int - -var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardHasRealityCheck = []interface{}{ - 0, - 1, +// After first deposit requirements +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` } -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory int - -type LandingCompanyRespLandingCompanyRequirePoi int +// Compliance requirements +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsCompliance struct { + // Compliance MT5 requirements + Mt5 []string `json:"mt5,omitempty"` -var enumValues_LandingCompanyRespLandingCompanyDxtradeFinancialCompanyStandardSupportProfessionalClient = []interface{}{ - 0, - 1, + // Compliance tax information requirements + TaxInformation []string `json:"tax_information,omitempty"` } // Contain details for landing company for Financial STP subtype. The Financial STP @@ -1858,45 +1536,62 @@ type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStp struct { TinNotMandatory *LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory `json:"tin_not_mandatory,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"` +// Special conditions for changing sensitive fields +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpChangeableFields map[string]interface{} - // 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"` +// The configuration of each currency. +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpCurrencyConfig map[string]interface{} + +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck int + +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck = []interface{}{ + 0, + 1, } -// Special conditions for changing sensitive fields -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpChangeableFields map[string]interface{} +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck, v) + } + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpHasRealityCheck(v) + return nil +} -// After first deposit requirements -type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialRequirementsAfterFirstDeposit struct { - // Financial assessment requirements - FinancialAssessment []string `json:"financial_assessment,omitempty"` +// 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 LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsAfterFirstDeposit struct { +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsAfterFirstDeposit struct { // Financial assessment requirements FinancialAssessment []string `json:"financial_assessment,omitempty"` } -type LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic int - -type LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck int - -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck int - // Compliance requirements -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsCompliance struct { +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpRequirementsCompliance struct { // Compliance MT5 requirements Mt5 []string `json:"mt5,omitempty"` @@ -1904,30 +1599,113 @@ type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsComplia TaxInformation []string `json:"tax_information,omitempty"` } -// Legal requirements for the Landing Company -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirements struct { - // After first deposit requirements - AfterFirstDeposit *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsAfterFirstDeposit `json:"after_first_deposit,omitempty"` +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient int - // Compliance requirements - Compliance *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsCompliance `json:"compliance,omitempty"` +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient = []interface{}{ + 0, + 1, +} - // Sign up requirements - Signup []string `json:"signup,omitempty"` +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient, v) + } + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpSupportProfessionalClient(v) + return nil +} - // Withdrawal requirements - Withdrawal []string `json:"withdrawal,omitempty"` +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory int + +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory = []interface{}{ + 0, + 1, } -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient int +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory, v) + } + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialStpTinNotMandatory(v) + return nil +} -type LandingCompanyRespLandingCompanyRequireAddressPostcode int +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient int -type LandingCompanyRespLandingCompanyNoProvince int +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient = []interface{}{ + 0, + 1, +} -type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory int +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient, v) + } + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialSupportProfessionalClient(v) + return nil +} -type LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit int +type LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory int + +var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory = []interface{}{ + 0, + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory, v) + } + *j = LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory(v) + return nil +} // Landing Company for MT5 standard derived contracts (Synthetic Indices), // currently has Financial as subtype. @@ -1987,130 +1765,384 @@ type LandingCompanyRespLandingCompanyMtGamingCompanyFinancial struct { TinNotMandatory *LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory `json:"tin_not_mandatory,omitempty"` } -var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardHasRealityCheck = []interface{}{ - 0, - 1, -} -var enumValues_LandingCompanyRespLandingCompanyDxtradeGamingCompanyStandardSupportProfessionalClient = []interface{}{ +// 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, } -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 } -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_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeHasRealityCheck = []interface{}{ - 0, - 1, -} -var enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeSupportProfessionalClient = []interface{}{ - 0, - 1, -} -var enumValues_LandingCompanyRespLandingCompanyMtAllCompanySwapFreeTinNotMandatory = []interface{}{ - 0, - 1, -} -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, + +// 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"` } -var enumValues_LandingCompanyRespLandingCompanyMtFinancialCompanyFinancialTinNotMandatory = []interface{}{ - 0, - 1, + +// After first deposit requirements +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialRequirementsAfterFirstDeposit struct { + // Financial assessment requirements + FinancialAssessment []string `json:"financial_assessment,omitempty"` } -var enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialHasRealityCheck = []interface{}{ - 0, - 1, + +// 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 { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + 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_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient, v) + } + *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialSupportProfessionalClient(v) + return nil +} + +type LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory int + var enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory = []interface{}{ 0, 1, } + +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory, v) + } + *j = LandingCompanyRespLandingCompanyMtGamingCompanyFinancialTinNotMandatory(v) + return nil +} + +type LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit int + var enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit = []interface{}{ 0, 1, } + +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit, v) + } + *j = LandingCompanyRespLandingCompanyNeedSetMaxTurnoverLimit(v) + return nil +} + +type LandingCompanyRespLandingCompanyNoProvince int + var enumValues_LandingCompanyRespLandingCompanyNoProvince = []interface{}{ 0, 1, } + +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyNoProvince { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyNoProvince, v) + } + *j = LandingCompanyRespLandingCompanyNoProvince(v) + return nil +} + +type LandingCompanyRespLandingCompanyRequireAddressPostcode int + var enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode = []interface{}{ 0, 1, } + +// UnmarshalJSON implements json.Unmarshaler. +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_LandingCompanyRespLandingCompanyRequireAddressPostcode { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_LandingCompanyRespLandingCompanyRequireAddressPostcode, v) + } + *j = LandingCompanyRespLandingCompanyRequireAddressPostcode(v) + return nil +} + +type LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic int + var enumValues_LandingCompanyRespLandingCompanyRequireAgeVerifiedForSynthetic = []interface{}{ 0, 1, } + +// 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 +} + +type LandingCompanyRespLandingCompanyRequirePoi int + var enumValues_LandingCompanyRespLandingCompanyRequirePoi = []interface{}{ 0, 1, } + +// 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 +} + +type LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified int + var enumValues_LandingCompanyRespLandingCompanyRequireVerificationWhenNotAgeVerified = []interface{}{ 0, 1, } + +// 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 +} + +type LandingCompanyRespLandingCompanySkipDepositVerification int + var enumValues_LandingCompanyRespLandingCompanySkipDepositVerification = []interface{}{ 0, 1, } + +// 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 +} + +type LandingCompanyRespLandingCompanyUkgcFundsProtection int + var enumValues_LandingCompanyRespLandingCompanyUkgcFundsProtection = []interface{}{ 0, 1, } + +// 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 +} + +type LandingCompanyRespMsgType string + +const LandingCompanyRespMsgTypeLandingCompany LandingCompanyRespMsgType = "landing_company" + var enumValues_LandingCompanyRespMsgType = []interface{}{ "landing_company", } + +// 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 +} + +// 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 +} diff --git a/schema/login_history.go b/schema/login_history.go index dcfd81d..f7b46fd 100644 --- a/schema/login_history.go +++ b/schema/login_history.go @@ -6,6 +6,26 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,26 +52,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["login_history"]; !ok || v == nil { + if _, ok := raw["login_history"]; raw != nil && !ok { 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 cd6e49d..558a5da 100644 --- a/schema/login_history_resp.go +++ b/schema/login_history_resp.go @@ -6,9 +6,40 @@ 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{}{ @@ -36,37 +67,22 @@ 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 v, ok := raw["action"]; !ok || v == nil { + if _, ok := raw["action"]; raw != nil && !ok { return fmt.Errorf("field action in LoginHistoryRespLoginHistoryElem: required") } - if v, ok := raw["environment"]; !ok || v == nil { + if _, ok := raw["environment"]; raw != nil && !ok { return fmt.Errorf("field environment in LoginHistoryRespLoginHistoryElem: required") } - if v, ok := raw["status"]; !ok || v == nil { + if _, ok := raw["status"]; raw != nil && !ok { return fmt.Errorf("field status in LoginHistoryRespLoginHistoryElem: required") } - if v, ok := raw["time"]; !ok || v == nil { + if _, ok := raw["time"]; raw != nil && !ok { return fmt.Errorf("field time in LoginHistoryRespLoginHistoryElem: required") } type Plain LoginHistoryRespLoginHistoryElem @@ -80,6 +96,8 @@ func (j *LoginHistoryRespLoginHistoryElem) UnmarshalJSON(b []byte) error { type LoginHistoryRespMsgType string +const LoginHistoryRespMsgTypeLoginHistory LoginHistoryRespMsgType = "login_history" + var enumValues_LoginHistoryRespMsgType = []interface{}{ "login_history", } @@ -104,34 +122,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in LoginHistoryResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in LoginHistoryResp: required") } type Plain LoginHistoryResp diff --git a/schema/logout.go b/schema/logout.go index c65b6b0..634559a 100644 --- a/schema/logout.go +++ b/schema/logout.go @@ -6,6 +6,23 @@ import "encoding/json" import "fmt" import "reflect" +// Logout the session +type Logout struct { + // [Optional] The login id of the user. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ func (j *LogoutLogout) UnmarshalJSON(b []byte) error { return nil } -// Logout the session -type Logout struct { - // [Optional] The login id of the user. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["logout"]; !ok || v == nil { + if _, ok := raw["logout"]; raw != nil && !ok { return fmt.Errorf("field logout in Logout: required") } type Plain Logout diff --git a/schema/logout_resp.go b/schema/logout_resp.go index 409352a..51f30bf 100644 --- a/schema/logout_resp.go +++ b/schema/logout_resp.go @@ -6,6 +6,22 @@ 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{} @@ -37,6 +53,8 @@ func (j *LogoutRespLogout) UnmarshalJSON(b []byte) error { type LogoutRespMsgType string +const LogoutRespMsgTypeLogout LogoutRespMsgType = "logout" + var enumValues_LogoutRespMsgType = []interface{}{ "logout", } @@ -61,34 +79,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in LogoutResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 549ad11..db74a94 100644 --- a/schema/mt5_deposit.go +++ b/schema/mt5_deposit.go @@ -6,32 +6,6 @@ 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 @@ -59,6 +33,32 @@ 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 v, ok := raw["mt5_deposit"]; !ok || v == nil { + if _, ok := raw["mt5_deposit"]; raw != nil && !ok { return fmt.Errorf("field mt5_deposit in Mt5Deposit: required") } - if v, ok := raw["to_mt5"]; !ok || v == nil { + if _, ok := raw["to_mt5"]; raw != nil && !ok { 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 02081ff..78e78c9 100644 --- a/schema/mt5_deposit_resp.go +++ b/schema/mt5_deposit_resp.go @@ -6,11 +6,32 @@ 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", } @@ -35,37 +56,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in Mt5DepositResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 24eaf26..349c82d 100644 --- a/schema/mt5_get_settings.go +++ b/schema/mt5_get_settings.go @@ -6,6 +6,26 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,26 +52,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["login"]; !ok || v == nil { + if _, ok := raw["login"]; raw != nil && !ok { return fmt.Errorf("field login in Mt5GetSettings: required") } - if v, ok := raw["mt5_get_settings"]; !ok || v == nil { + if _, ok := raw["mt5_get_settings"]; raw != nil && !ok { 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 b35233f..01630da 100644 --- a/schema/mt5_get_settings_resp.go +++ b/schema/mt5_get_settings_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,10 +53,85 @@ func (j *Mt5GetSettingsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const Mt5GetSettingsRespMsgTypeMt5GetSettings Mt5GetSettingsRespMsgType = "mt5_get_settings" +// 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"` +} type Mt5GetSettingsRespMt5GetSettingsAccountType string +const Mt5GetSettingsRespMt5GetSettingsAccountTypeDemo Mt5GetSettingsRespMt5GetSettingsAccountType = "demo" +const Mt5GetSettingsRespMt5GetSettingsAccountTypeReal Mt5GetSettingsRespMt5GetSettingsAccountType = "real" + var enumValues_Mt5GetSettingsRespMt5GetSettingsAccountType = []interface{}{ "demo", "real", @@ -64,11 +157,16 @@ func (j *Mt5GetSettingsRespMt5GetSettingsAccountType) UnmarshalJSON(b []byte) er return nil } -const Mt5GetSettingsRespMt5GetSettingsAccountTypeDemo Mt5GetSettingsRespMt5GetSettingsAccountType = "demo" -const Mt5GetSettingsRespMt5GetSettingsAccountTypeReal Mt5GetSettingsRespMt5GetSettingsAccountType = "real" - type Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort 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" + var enumValues_Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort = []interface{}{ "bvi", "labuan", @@ -99,16 +197,12 @@ func (j *Mt5GetSettingsRespMt5GetSettingsLandingCompanyShort) UnmarshalJSON(b [] return nil } -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 Mt5GetSettingsRespMt5GetSettingsMarketType string +const Mt5GetSettingsRespMt5GetSettingsMarketTypeAll Mt5GetSettingsRespMt5GetSettingsMarketType = "all" +const Mt5GetSettingsRespMt5GetSettingsMarketTypeFinancial Mt5GetSettingsRespMt5GetSettingsMarketType = "financial" +const Mt5GetSettingsRespMt5GetSettingsMarketTypeSynthetic Mt5GetSettingsRespMt5GetSettingsMarketType = "synthetic" + var enumValues_Mt5GetSettingsRespMt5GetSettingsMarketType = []interface{}{ "all", "financial", @@ -135,12 +229,25 @@ func (j *Mt5GetSettingsRespMt5GetSettingsMarketType) UnmarshalJSON(b []byte) err return nil } -const Mt5GetSettingsRespMt5GetSettingsMarketTypeAll Mt5GetSettingsRespMt5GetSettingsMarketType = "all" -const Mt5GetSettingsRespMt5GetSettingsMarketTypeFinancial Mt5GetSettingsRespMt5GetSettingsMarketType = "financial" -const Mt5GetSettingsRespMt5GetSettingsMarketTypeSynthetic Mt5GetSettingsRespMt5GetSettingsMarketType = "synthetic" +// 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"` +} 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", @@ -168,23 +275,6 @@ 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. @@ -202,6 +292,13 @@ 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", @@ -231,15 +328,13 @@ func (j *Mt5GetSettingsRespMt5GetSettingsSubAccountCategory) UnmarshalJSON(b []b return nil } -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" - type Mt5GetSettingsRespMt5GetSettingsSubAccountType string +const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeDerivez Mt5GetSettingsRespMt5GetSettingsSubAccountType = "derivez" +const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeFinancial Mt5GetSettingsRespMt5GetSettingsSubAccountType = "financial" +const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeFinancialStp Mt5GetSettingsRespMt5GetSettingsSubAccountType = "financial_stp" +const Mt5GetSettingsRespMt5GetSettingsSubAccountTypeStandard Mt5GetSettingsRespMt5GetSettingsSubAccountType = "standard" + var enumValues_Mt5GetSettingsRespMt5GetSettingsSubAccountType = []interface{}{ "derivez", "financial", @@ -267,111 +362,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in Mt5GetSettingsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 2819ac7..a5b1482 100644 --- a/schema/mt5_login_list.go +++ b/schema/mt5_login_list.go @@ -6,6 +6,23 @@ import "encoding/json" import "fmt" import "reflect" +// Get list of MT5 accounts for client +type Mt5LoginList struct { + // [Optional] The login id of the user. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["mt5_login_list"]; !ok || v == nil { + if _, ok := raw["mt5_login_list"]; raw != nil && !ok { 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 a66bd66..c5c9bf8 100644 --- a/schema/mt5_login_list_resp.go +++ b/schema/mt5_login_list_resp.go @@ -29,6 +29,30 @@ 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"` @@ -112,6 +136,31 @@ 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{} @@ -177,6 +226,48 @@ 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. @@ -202,12 +293,68 @@ 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 = "" @@ -218,6 +365,36 @@ 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 @@ -306,82 +483,7 @@ const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivVUServer Mt5Logi const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivVUServer02 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivVU-Server-02" const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivVUServer03 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "DerivVU-Server-03" -// Geographical location of the server. -type Mt5LoginListRespMt5LoginListElemServerInfoGeolocation struct { - // Internal server grouping. - Group *string `json:"group,omitempty"` - - // Server location. - Location *string `json:"location,omitempty"` - - // Server region. - Region *string `json:"region,omitempty"` - - // Server sequence. - Sequence *int `json:"sequence,omitempty"` -} - -type Mt5LoginListRespMt5LoginListElemSubAccountCategory string - -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryBlank Mt5LoginListRespMt5LoginListElemSubAccountCategory = "" -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryIbt Mt5LoginListRespMt5LoginListElemSubAccountCategory = "ibt" -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryLim Mt5LoginListRespMt5LoginListElemSubAccountCategory = "lim" -const Mt5LoginListRespMt5LoginListElemSubAccountCategoryStp Mt5LoginListRespMt5LoginListElemSubAccountCategory = "stp" -const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFree Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free" -const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFreeHighRisk Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free_high_risk" - -type Mt5LoginListRespMt5LoginListElemSubAccountType string - -const Mt5LoginListRespMt5LoginListElemSubAccountTypeFinancial Mt5LoginListRespMt5LoginListElemSubAccountType = "financial" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeFinancialStp Mt5LoginListRespMt5LoginListElemSubAccountType = "financial_stp" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeStandard Mt5LoginListRespMt5LoginListElemSubAccountType = "standard" -const Mt5LoginListRespMt5LoginListElemSubAccountTypeSwapFree Mt5LoginListRespMt5LoginListElemSubAccountType = "swap_free" - -// White label settings -type Mt5LoginListRespMt5LoginListElemWhiteLabel struct { - // Links to download the MT5 application for different platforms. - DownloadLinks *Mt5LoginListRespMt5LoginListElemWhiteLabelDownloadLinks `json:"download_links,omitempty"` - - // A flag indicating whether the white label notification feature is enabled or - // disabled. - Notification *bool `json:"notification,omitempty"` -} - -// Links to download the MT5 application for different platforms. -type Mt5LoginListRespMt5LoginListElemWhiteLabelDownloadLinks struct { - // Download link for Android. - Android *string `json:"android,omitempty"` - - // Download link for iOS. - Ios *string `json:"ios,omitempty"` - - // Download link for Windows. - Windows *string `json:"windows,omitempty"` -} - -// Links to access MT5 application for different platforms. -type Mt5LoginListRespMt5LoginListElemWhiteLabelLinks struct { - // Download link for Android. - Android *string `json:"android,omitempty"` - - // Download link for iOS. - Ios *string `json:"ios,omitempty"` - - // MT5 webtrader url based on jurisdiction and platform - WebtraderUrl *string `json:"webtrader_url,omitempty"` - - // Download link for Windows. - Windows *string `json:"windows,omitempty"` -} - -var enumValues_Mt5LoginListRespMsgType = []interface{}{ - "mt5_login_list", -} -var enumValues_Mt5LoginListRespMt5LoginListElemAccountType = []interface{}{ - "demo", - "real", -} -var enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = []interface{}{ +var enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = []interface{}{ "Deriv-Demo", "Deriv-Server", "Deriv-Server-02", @@ -402,56 +504,51 @@ var enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment "DerivBVI-Server-02", "DerivBVI-Server-03", } -var enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort = []interface{}{ - "bvi", - "labuan", - "malta", - "maltainvest", - "svg", - "vanuatu", - "seychelles", -} // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment) UnmarshalJSON(b []byte) error { +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_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment { + 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_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment, v) } - *j = Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment(v) + *j = Mt5LoginListRespMt5LoginListElemServerInfoEnvironment(v) return nil } -// 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 +// Geographical location of the server. +type Mt5LoginListRespMt5LoginListElemServerInfoGeolocation struct { + // Internal server grouping. + Group *string `json:"group,omitempty"` + + // Server location. + Location *string `json:"location,omitempty"` + + // Server region. + Region *string `json:"region,omitempty"` + + // Server sequence. + Sequence *int `json:"sequence,omitempty"` } +type Mt5LoginListRespMt5LoginListElemSubAccountCategory string + +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryBlank Mt5LoginListRespMt5LoginListElemSubAccountCategory = "" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryIbt Mt5LoginListRespMt5LoginListElemSubAccountCategory = "ibt" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryLim Mt5LoginListRespMt5LoginListElemSubAccountCategory = "lim" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryStp Mt5LoginListRespMt5LoginListElemSubAccountCategory = "stp" +const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFree Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free" +const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFreeHighRisk Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free_high_risk" + var enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory = []interface{}{ "", "swap_free", @@ -461,68 +558,6 @@ var enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory = []interface{ "lim", } -// 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 -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemSubAccountType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemSubAccountType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemSubAccountType, v) - } - *j = Mt5LoginListRespMt5LoginListElemSubAccountType(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", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5LoginListRespMt5LoginListElemSubAccountCategory) UnmarshalJSON(b []byte) error { var v string @@ -543,106 +578,75 @@ func (j *Mt5LoginListRespMt5LoginListElemSubAccountCategory) UnmarshalJSON(b []b return nil } +type Mt5LoginListRespMt5LoginListElemSubAccountType string + +const Mt5LoginListRespMt5LoginListElemSubAccountTypeFinancial Mt5LoginListRespMt5LoginListElemSubAccountType = "financial" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeFinancialStp Mt5LoginListRespMt5LoginListElemSubAccountType = "financial_stp" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeStandard Mt5LoginListRespMt5LoginListElemSubAccountType = "standard" +const Mt5LoginListRespMt5LoginListElemSubAccountTypeSwapFree Mt5LoginListRespMt5LoginListElemSubAccountType = "swap_free" + var enumValues_Mt5LoginListRespMt5LoginListElemSubAccountType = []interface{}{ "standard", "financial", "financial_stp", "swap_free", } -var enumValues_Mt5LoginListRespMt5LoginListElemMarketType = []interface{}{ - "financial", - "synthetic", - "all", -} // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMt5LoginListElemMarketType) UnmarshalJSON(b []byte) error { +func (j *Mt5LoginListRespMt5LoginListElemSubAccountType) 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 { + for _, expected := range enumValues_Mt5LoginListRespMt5LoginListElemSubAccountType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemMarketType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMt5LoginListElemSubAccountType, v) } - *j = Mt5LoginListRespMt5LoginListElemMarketType(v) + *j = Mt5LoginListRespMt5LoginListElemSubAccountType(v) return nil } -var enumValues_Mt5LoginListRespMt5LoginListElemProduct = []interface{}{ - "", - "synthetic", - "financial", - "swap_free", - "zero_spread", - "standard", - "stp", -} +// White label settings +type Mt5LoginListRespMt5LoginListElemWhiteLabel struct { + // Links to download the MT5 application for different platforms. + DownloadLinks *Mt5LoginListRespMt5LoginListElemWhiteLabelDownloadLinks `json:"download_links,omitempty"` -// 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 + // A flag indicating whether the white label notification feature is enabled or + // disabled. + Notification *bool `json:"notification,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 +// Links to download the MT5 application for different platforms. +type Mt5LoginListRespMt5LoginListElemWhiteLabelDownloadLinks struct { + // Download link for Android. + Android *string `json:"android,omitempty"` + + // Download link for iOS. + Ios *string `json:"ios,omitempty"` + + // Download link for Windows. + Windows *string `json:"windows,omitempty"` } -// 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 +// Links to access MT5 application for different platforms. +type Mt5LoginListRespMt5LoginListElemWhiteLabelLinks struct { + // Download link for Android. + Android *string `json:"android,omitempty"` + + // Download link for iOS. + Ios *string `json:"ios,omitempty"` + + // MT5 webtrader url based on jurisdiction and platform + WebtraderUrl *string `json:"webtrader_url,omitempty"` + + // Download link for Windows. + Windows *string `json:"windows,omitempty"` } // UnmarshalJSON implements json.Unmarshaler. @@ -651,10 +655,10 @@ func (j *Mt5LoginListResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in Mt5LoginListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 ee34153..873e6b9 100644 --- a/schema/mt5_new_account.go +++ b/schema/mt5_new_account.go @@ -111,186 +111,199 @@ const Mt5NewAccountAccountTypeDemo Mt5NewAccountAccountType = "demo" const Mt5NewAccountAccountTypeFinancial Mt5NewAccountAccountType = "financial" const Mt5NewAccountAccountTypeGaming Mt5NewAccountAccountType = "gaming" -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" +var enumValues_Mt5NewAccountAccountType = []interface{}{ + "demo", + "gaming", + "financial", + "all", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountServer) UnmarshalJSON(b []byte) error { +func (j *Mt5NewAccountAccountType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_Mt5NewAccountServer { + for _, expected := range enumValues_Mt5NewAccountAccountType { 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_Mt5NewAccountAccountType, v) } - *j = Mt5NewAccountServer(v) + *j = Mt5NewAccountAccountType(v) return nil } +type Mt5NewAccountDryRun int + var enumValues_Mt5NewAccountDryRun = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountAccountType) 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_Mt5NewAccountAccountType { + 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_Mt5NewAccountAccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountDryRun, v) } - *j = Mt5NewAccountAccountType(v) + *j = Mt5NewAccountDryRun(v) return nil } -var enumValues_Mt5NewAccountProduct = []interface{}{ - "", - "synthetic", - "financial", +type Mt5NewAccountMt5AccountCategory string + +const Mt5NewAccountMt5AccountCategoryConventional Mt5NewAccountMt5AccountCategory = "conventional" +const Mt5NewAccountMt5AccountCategorySwapFree Mt5NewAccountMt5AccountCategory = "swap_free" + +var enumValues_Mt5NewAccountMt5AccountCategory = []interface{}{ + "conventional", "swap_free", - "zero_spread", - "standard", - "stp", } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountProduct) UnmarshalJSON(b []byte) error { +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_Mt5NewAccountProduct { + 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_Mt5NewAccountProduct, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountMt5AccountCategory, v) } - *j = Mt5NewAccountProduct(v) + *j = Mt5NewAccountMt5AccountCategory(v) return nil } -var enumValues_Mt5NewAccountMt5NewAccount = []interface{}{ - 1, +type Mt5NewAccountMt5AccountType string + +const Mt5NewAccountMt5AccountTypeFinancial Mt5NewAccountMt5AccountType = "financial" +const Mt5NewAccountMt5AccountTypeFinancialStp Mt5NewAccountMt5AccountType = "financial_stp" + +var enumValues_Mt5NewAccountMt5AccountType = []interface{}{ + "financial", + "financial_stp", } // 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 } -var enumValues_Mt5NewAccountMt5AccountCategory = []interface{}{ - "conventional", - "swap_free", +type Mt5NewAccountMt5NewAccount int + +var enumValues_Mt5NewAccountMt5NewAccount = []interface{}{ + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountMt5AccountCategory) 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_Mt5NewAccountMt5AccountCategory { + 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_Mt5NewAccountMt5AccountCategory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountMt5NewAccount, v) } - *j = Mt5NewAccountMt5AccountCategory(v) + *j = Mt5NewAccountMt5NewAccount(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", + "financial", + "swap_free", + "zero_spread", + "standard", + "stp", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountMt5AccountType) UnmarshalJSON(b []byte) error { +func (j *Mt5NewAccountProduct) 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_Mt5NewAccountProduct { 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_Mt5NewAccountProduct, v) } - *j = Mt5NewAccountMt5AccountType(v) + *j = Mt5NewAccountProduct(v) return nil } -var enumValues_Mt5NewAccountMt5AccountType = []interface{}{ - "financial", - "financial_stp", -} - -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" + var enumValues_Mt5NewAccountServer = []interface{}{ "p01_ts01", "p01_ts02", @@ -301,34 +314,30 @@ var enumValues_Mt5NewAccountServer = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountMt5NewAccount) UnmarshalJSON(b []byte) error { - var v int +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_Mt5NewAccountMt5NewAccount { + 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_Mt5NewAccountMt5NewAccount, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountServer, v) } - *j = Mt5NewAccountMt5NewAccount(v) + *j = Mt5NewAccountServer(v) return nil } -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 Mt5NewAccountSubAccountCategorySwapFree Mt5NewAccountSubAccountCategory = "swap_free" +const Mt5NewAccountSubAccountCategorySwapFreeHighRisk Mt5NewAccountSubAccountCategory = "swap_free_high_risk" + var enumValues_Mt5NewAccountSubAccountCategory = []interface{}{ "swap_free", "swap_free_high_risk", @@ -354,38 +363,28 @@ func (j *Mt5NewAccountSubAccountCategory) UnmarshalJSON(b []byte) error { return nil } -const Mt5NewAccountSubAccountCategorySwapFree Mt5NewAccountSubAccountCategory = "swap_free" -const Mt5NewAccountSubAccountCategorySwapFreeHighRisk Mt5NewAccountSubAccountCategory = "swap_free_high_risk" - -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 v, ok := raw["account_type"]; !ok || v == nil { + if _, ok := raw["account_type"]; raw != nil && !ok { return fmt.Errorf("field account_type in Mt5NewAccount: required") } - if v, ok := raw["email"]; !ok || v == nil { + if _, ok := raw["email"]; raw != nil && !ok { return fmt.Errorf("field email in Mt5NewAccount: required") } - if v, ok := raw["leverage"]; !ok || v == nil { + if _, ok := raw["leverage"]; raw != nil && !ok { return fmt.Errorf("field leverage in Mt5NewAccount: required") } - if v, ok := raw["mainPassword"]; !ok || v == nil { + if _, ok := raw["mainPassword"]; raw != nil && !ok { return fmt.Errorf("field mainPassword in Mt5NewAccount: required") } - if v, ok := raw["mt5_new_account"]; !ok || v == nil { + if _, ok := raw["mt5_new_account"]; raw != nil && !ok { return fmt.Errorf("field mt5_new_account in Mt5NewAccount: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { 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 8bd5020..269e1a6 100644 --- a/schema/mt5_new_account_resp.go +++ b/schema/mt5_new_account_resp.go @@ -29,6 +29,30 @@ 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. @@ -69,80 +93,41 @@ const Mt5NewAccountRespMt5NewAccountAccountTypeDemo Mt5NewAccountRespMt5NewAccou const Mt5NewAccountRespMt5NewAccountAccountTypeFinancial Mt5NewAccountRespMt5NewAccountAccountType = "financial" const Mt5NewAccountRespMt5NewAccountAccountTypeGaming Mt5NewAccountRespMt5NewAccountAccountType = "gaming" -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" - -var enumValues_Mt5NewAccountRespMt5NewAccountProduct = []interface{}{ - "", - "synthetic", +var enumValues_Mt5NewAccountRespMt5NewAccountAccountType = []interface{}{ + "demo", + "gaming", "financial", - "swap_free", - "zero_spread", - "standard", - "stp", + "all", } // 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 } -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountRespMt5NewAccountMt5AccountType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5NewAccountRespMt5NewAccountMt5AccountType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMt5NewAccountMt5AccountType, v) - } - *j = Mt5NewAccountRespMt5NewAccountMt5AccountType(v) - return nil -} +type Mt5NewAccountRespMt5NewAccountMt5AccountCategory string -var enumValues_Mt5NewAccountRespMt5NewAccountMt5AccountType = []interface{}{ - "financial", - "financial_stp", - "standard", +const Mt5NewAccountRespMt5NewAccountMt5AccountCategoryConventional Mt5NewAccountRespMt5NewAccountMt5AccountCategory = "conventional" +const Mt5NewAccountRespMt5NewAccountMt5AccountCategorySwapFree Mt5NewAccountRespMt5NewAccountMt5AccountCategory = "swap_free" + +var enumValues_Mt5NewAccountRespMt5NewAccountMt5AccountCategory = []interface{}{ + "conventional", + "swap_free", } // UnmarshalJSON implements json.Unmarshaler. @@ -165,74 +150,88 @@ func (j *Mt5NewAccountRespMt5NewAccountMt5AccountCategory) UnmarshalJSON(b []byt return nil } -const Mt5NewAccountRespMt5NewAccountProductZeroSpread Mt5NewAccountRespMt5NewAccountProduct = "zero_spread" +type Mt5NewAccountRespMt5NewAccountMt5AccountType string -var enumValues_Mt5NewAccountRespMt5NewAccountMt5AccountCategory = []interface{}{ - "conventional", - "swap_free", +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 *Mt5NewAccountRespMt5NewAccountAccountType) UnmarshalJSON(b []byte) error { +func (j *Mt5NewAccountRespMt5NewAccountMt5AccountType) 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_Mt5NewAccountRespMt5NewAccountMt5AccountType { 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_Mt5NewAccountRespMt5NewAccountMt5AccountType, v) } - *j = Mt5NewAccountRespMt5NewAccountAccountType(v) + *j = Mt5NewAccountRespMt5NewAccountMt5AccountType(v) return nil } -var enumValues_Mt5NewAccountRespMt5NewAccountAccountType = []interface{}{ - "demo", - "gaming", +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_Mt5NewAccountRespMt5NewAccountProduct = []interface{}{ + "", + "synthetic", "financial", - "all", + "swap_free", + "zero_spread", + "standard", + "stp", } // UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5NewAccountRespMsgType) UnmarshalJSON(b []byte) error { +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_Mt5NewAccountRespMsgType { + 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_Mt5NewAccountRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5NewAccountRespMt5NewAccountProduct, v) } - *j = Mt5NewAccountRespMsgType(v) + *j = Mt5NewAccountRespMt5NewAccountProduct(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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in Mt5NewAccountResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 da282a3..cea0f4c 100644 --- a/schema/mt5_password_change.go +++ b/schema/mt5_password_change.go @@ -6,6 +6,38 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -38,6 +70,9 @@ type Mt5PasswordChangePassthrough map[string]interface{} type Mt5PasswordChangePasswordType string +const Mt5PasswordChangePasswordTypeInvestor Mt5PasswordChangePasswordType = "investor" +const Mt5PasswordChangePasswordTypeMain Mt5PasswordChangePasswordType = "main" + var enumValues_Mt5PasswordChangePasswordType = []interface{}{ "main", "investor", @@ -63,57 +98,22 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["login"]; !ok || v == nil { + if _, ok := raw["login"]; raw != nil && !ok { return fmt.Errorf("field login in Mt5PasswordChange: required") } - if v, ok := raw["mt5_password_change"]; !ok || v == nil { + if _, ok := raw["mt5_password_change"]; raw != nil && !ok { return fmt.Errorf("field mt5_password_change in Mt5PasswordChange: required") } - if v, ok := raw["new_password"]; !ok || v == nil { + if _, ok := raw["new_password"]; raw != nil && !ok { return fmt.Errorf("field new_password in Mt5PasswordChange: required") } - if v, ok := raw["old_password"]; !ok || v == nil { + if _, ok := raw["old_password"]; raw != nil && !ok { 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 8def241..6a5cc6f 100644 --- a/schema/mt5_password_change_resp.go +++ b/schema/mt5_password_change_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in Mt5PasswordChangeResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 75321d4..f364099 100644 --- a/schema/mt5_password_check.go +++ b/schema/mt5_password_check.go @@ -6,6 +6,32 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -38,6 +64,9 @@ type Mt5PasswordCheckPassthrough map[string]interface{} type Mt5PasswordCheckPasswordType string +const Mt5PasswordCheckPasswordTypeInvestor Mt5PasswordCheckPasswordType = "investor" +const Mt5PasswordCheckPasswordTypeMain Mt5PasswordCheckPasswordType = "main" + var enumValues_Mt5PasswordCheckPasswordType = []interface{}{ "main", "investor", @@ -63,48 +92,19 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["login"]; !ok || v == nil { + if _, ok := raw["login"]; raw != nil && !ok { return fmt.Errorf("field login in Mt5PasswordCheck: required") } - if v, ok := raw["mt5_password_check"]; !ok || v == nil { + if _, ok := raw["mt5_password_check"]; raw != nil && !ok { return fmt.Errorf("field mt5_password_check in Mt5PasswordCheck: required") } - if v, ok := raw["password"]; !ok || v == nil { + if _, ok := raw["password"]; raw != nil && !ok { 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 457f616..f0de082 100644 --- a/schema/mt5_password_check_resp.go +++ b/schema/mt5_password_check_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in Mt5PasswordCheckResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 d09f26f..fb84f80 100644 --- a/schema/mt5_password_reset.go +++ b/schema/mt5_password_reset.go @@ -6,6 +6,38 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -38,6 +70,9 @@ type Mt5PasswordResetPassthrough map[string]interface{} type Mt5PasswordResetPasswordType string +const Mt5PasswordResetPasswordTypeInvestor Mt5PasswordResetPasswordType = "investor" +const Mt5PasswordResetPasswordTypeMain Mt5PasswordResetPasswordType = "main" + var enumValues_Mt5PasswordResetPasswordType = []interface{}{ "main", "investor", @@ -63,57 +98,22 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["login"]; !ok || v == nil { + if _, ok := raw["login"]; raw != nil && !ok { return fmt.Errorf("field login in Mt5PasswordReset: required") } - if v, ok := raw["mt5_password_reset"]; !ok || v == nil { + if _, ok := raw["mt5_password_reset"]; raw != nil && !ok { return fmt.Errorf("field mt5_password_reset in Mt5PasswordReset: required") } - if v, ok := raw["new_password"]; !ok || v == nil { + if _, ok := raw["new_password"]; raw != nil && !ok { return fmt.Errorf("field new_password in Mt5PasswordReset: required") } - if v, ok := raw["verification_code"]; !ok || v == nil { + if _, ok := raw["verification_code"]; raw != nil && !ok { 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 ce83c82..af07c8a 100644 --- a/schema/mt5_password_reset_resp.go +++ b/schema/mt5_password_reset_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in Mt5PasswordResetResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 b22f9ad..abcf985 100644 --- a/schema/mt5_withdrawal.go +++ b/schema/mt5_withdrawal.go @@ -6,32 +6,6 @@ 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 @@ -59,6 +33,32 @@ 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 v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in Mt5Withdrawal: required") } - if v, ok := raw["from_mt5"]; !ok || v == nil { + if _, ok := raw["from_mt5"]; raw != nil && !ok { return fmt.Errorf("field from_mt5 in Mt5Withdrawal: required") } - if v, ok := raw["mt5_withdrawal"]; !ok || v == nil { + if _, ok := raw["mt5_withdrawal"]; raw != nil && !ok { return fmt.Errorf("field mt5_withdrawal in Mt5Withdrawal: required") } - if v, ok := raw["to_binary"]; !ok || v == nil { + if _, ok := raw["to_binary"]; raw != nil && !ok { 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 9d64dd2..e61776e 100644 --- a/schema/mt5_withdrawal_resp.go +++ b/schema/mt5_withdrawal_resp.go @@ -6,11 +6,32 @@ 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", } @@ -35,37 +56,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in Mt5WithdrawalResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 e59f84e..efea924 100644 --- a/schema/new_account_maltainvest.go +++ b/schema/new_account_maltainvest.go @@ -174,12 +174,63 @@ 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" @@ -188,202 +239,6 @@ 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", @@ -391,720 +246,881 @@ 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 *NewAccountMaltainvestRiskTolerance) 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_NewAccountMaltainvestRiskTolerance { + 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_NewAccountMaltainvestRiskTolerance, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestAccountTurnover, v) } - *j = NewAccountMaltainvestRiskTolerance(v) + *j = NewAccountMaltainvestAccountTurnover(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 *NewAccountMaltainvestIncomeSource) 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_NewAccountMaltainvestIncomeSource { + 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_NewAccountMaltainvestIncomeSource, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdExperience, v) } - *j = NewAccountMaltainvestIncomeSource(v) + *j = NewAccountMaltainvestCfdExperience(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 *NewAccountMaltainvestOccupation) 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_NewAccountMaltainvestOccupation { + 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_NewAccountMaltainvestOccupation, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdFrequency, v) } - *j = NewAccountMaltainvestOccupation(v) + *j = NewAccountMaltainvestCfdFrequency(v) return nil } -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", +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.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestEstimatedWorth) 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_NewAccountMaltainvestEstimatedWorth { + 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_NewAccountMaltainvestEstimatedWorth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestCfdTradingDefinition, v) } - *j = NewAccountMaltainvestEstimatedWorth(v) + *j = NewAccountMaltainvestCfdTradingDefinition(v) return nil } -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.", +type NewAccountMaltainvestClientType string + +const NewAccountMaltainvestClientTypeProfessional NewAccountMaltainvestClientType = "professional" +const NewAccountMaltainvestClientTypeRetail NewAccountMaltainvestClientType = "retail" + +var enumValues_NewAccountMaltainvestClientType = []interface{}{ + "professional", + "retail", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestSourceOfExperience) 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_NewAccountMaltainvestSourceOfExperience { + 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_NewAccountMaltainvestSourceOfExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestClientType, v) } - *j = NewAccountMaltainvestSourceOfExperience(v) + *j = NewAccountMaltainvestClientType(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 *NewAccountMaltainvestNewAccountMaltainvest) UnmarshalJSON(b []byte) error { - var v int +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_NewAccountMaltainvestNewAccountMaltainvest { + 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_NewAccountMaltainvestNewAccountMaltainvest, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEducationLevel, v) } - *j = NewAccountMaltainvestNewAccountMaltainvest(v) + *j = NewAccountMaltainvestEducationLevel(v) return nil } -var enumValues_NewAccountMaltainvestNewAccountMaltainvest = []interface{}{ - 1, +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestLeverageImpactTrading) UnmarshalJSON(b []byte) error { +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_NewAccountMaltainvestLeverageImpactTrading { + 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_NewAccountMaltainvestLeverageImpactTrading, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEmploymentIndustry, v) } - *j = NewAccountMaltainvestLeverageImpactTrading(v) + *j = NewAccountMaltainvestEmploymentIndustry(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 *NewAccountMaltainvestSecretQuestion) UnmarshalJSON(b []byte) error { +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_NewAccountMaltainvestSecretQuestion { + 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_NewAccountMaltainvestSecretQuestion, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEmploymentStatus, v) } - *j = NewAccountMaltainvestSecretQuestion(v) + *j = NewAccountMaltainvestEmploymentStatus(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 *NewAccountMaltainvestLeverageTradingHighRiskStopLoss) 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_NewAccountMaltainvestLeverageTradingHighRiskStopLoss { + 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_NewAccountMaltainvestLeverageTradingHighRiskStopLoss, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestEstimatedWorth, v) } - *j = NewAccountMaltainvestLeverageTradingHighRiskStopLoss(v) + *j = NewAccountMaltainvestEstimatedWorth(v) return nil } +type NewAccountMaltainvestFatcaDeclaration int + +var enumValues_NewAccountMaltainvestFatcaDeclaration = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestAcceptRisk) UnmarshalJSON(b []byte) error { +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_NewAccountMaltainvestAcceptRisk { + 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_NewAccountMaltainvestAcceptRisk, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestFatcaDeclaration, v) } - *j = NewAccountMaltainvestAcceptRisk(v) + *j = NewAccountMaltainvestFatcaDeclaration(v) return nil } -var enumValues_NewAccountMaltainvestSourceOfWealth = []interface{}{ - "Accumulation of Income/Savings", - "Cash Business", - "Company Ownership", - "Divorce Settlement", - "Inheritance", - "Investment Income", - "Sale of Property", +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestSourceOfWealth) 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_NewAccountMaltainvestSourceOfWealth { + 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_NewAccountMaltainvestSourceOfWealth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestIncomeSource, v) } - *j = NewAccountMaltainvestSourceOfWealth(v) + *j = NewAccountMaltainvestIncomeSource(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 *NewAccountMaltainvestNetIncome) 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_NewAccountMaltainvestNetIncome { + 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_NewAccountMaltainvestNetIncome, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestLeverageImpactTrading, v) } - *j = NewAccountMaltainvestNetIncome(v) + *j = NewAccountMaltainvestLeverageImpactTrading(v) return nil } -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", +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.", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestAccountOpeningReason) 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_NewAccountMaltainvestAccountOpeningReason { + 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_NewAccountMaltainvestAccountOpeningReason, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestLeverageTradingHighRiskStopLoss, v) } - *j = NewAccountMaltainvestAccountOpeningReason(v) + *j = NewAccountMaltainvestLeverageTradingHighRiskStopLoss(v) return nil } -// UnmarshalJSON implements json.Unmarshaler. -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_NewAccountMaltainvestFatcaDeclaration { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestFatcaDeclaration, v) - } - *j = NewAccountMaltainvestFatcaDeclaration(v) - return nil -} +type NewAccountMaltainvestNetIncome string -var enumValues_NewAccountMaltainvestRiskTolerance = []interface{}{ - "Yes", - "No", +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 *NewAccountMaltainvestEmploymentStatus) 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_NewAccountMaltainvestEmploymentStatus { + 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_NewAccountMaltainvestEmploymentStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestNetIncome, v) } - *j = NewAccountMaltainvestEmploymentStatus(v) + *j = NewAccountMaltainvestNetIncome(v) return nil } +type NewAccountMaltainvestNewAccountMaltainvest int + +var enumValues_NewAccountMaltainvestNewAccountMaltainvest = []interface{}{ + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestResidentSelfDeclaration) UnmarshalJSON(b []byte) error { +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_NewAccountMaltainvestResidentSelfDeclaration { + 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_NewAccountMaltainvestResidentSelfDeclaration, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestNewAccountMaltainvest, v) } - *j = NewAccountMaltainvestResidentSelfDeclaration(v) + *j = NewAccountMaltainvestNewAccountMaltainvest(v) return nil } -var enumValues_NewAccountMaltainvestResidentSelfDeclaration = []interface{}{ - 1, -} -var enumValues_NewAccountMaltainvestTradingExperienceFinancialInstruments = []interface{}{ - "No experience", - "Less than a year", - "1 - 2 years", - "Over 3 years", +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 *NewAccountMaltainvestTradingExperienceFinancialInstruments) 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_NewAccountMaltainvestTradingExperienceFinancialInstruments { + 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_NewAccountMaltainvestTradingExperienceFinancialInstruments, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestOccupation, v) } - *j = NewAccountMaltainvestTradingExperienceFinancialInstruments(v) + *j = NewAccountMaltainvestOccupation(v) return nil } -// UnmarshalJSON implements json.Unmarshaler. -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_NewAccountMaltainvestAccountTurnover { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestAccountTurnover, v) - } - *j = NewAccountMaltainvestAccountTurnover(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 *NewAccountMaltainvestEmploymentIndustry) 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_NewAccountMaltainvestEmploymentIndustry { + 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_NewAccountMaltainvestEmploymentIndustry, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestRequiredInitialMargin, v) } - *j = NewAccountMaltainvestEmploymentIndustry(v) + *j = NewAccountMaltainvestRequiredInitialMargin(v) return nil } +type NewAccountMaltainvestResidentSelfDeclaration int + +var enumValues_NewAccountMaltainvestResidentSelfDeclaration = []interface{}{ + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestCfdExperience) UnmarshalJSON(b []byte) error { - var v string +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_NewAccountMaltainvestCfdExperience { + 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_NewAccountMaltainvestCfdExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestResidentSelfDeclaration, v) } - *j = NewAccountMaltainvestCfdExperience(v) + *j = NewAccountMaltainvestResidentSelfDeclaration(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 *NewAccountMaltainvestEducationLevel) 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_NewAccountMaltainvestEducationLevel { + 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_NewAccountMaltainvestEducationLevel, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestRiskTolerance, v) } - *j = NewAccountMaltainvestEducationLevel(v) + *j = NewAccountMaltainvestRiskTolerance(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 *NewAccountMaltainvestCfdFrequency) 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_NewAccountMaltainvestCfdFrequency { + 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_NewAccountMaltainvestCfdFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSalutation, v) } - *j = NewAccountMaltainvestCfdFrequency(v) + *j = NewAccountMaltainvestSalutation(v) return nil } -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", +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestTradingFrequencyFinancialInstruments) 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_NewAccountMaltainvestTradingFrequencyFinancialInstruments { + 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_NewAccountMaltainvestTradingFrequencyFinancialInstruments, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSecretQuestion, v) } - *j = NewAccountMaltainvestTradingFrequencyFinancialInstruments(v) + *j = NewAccountMaltainvestSecretQuestion(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 *NewAccountMaltainvestRequiredInitialMargin) 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_NewAccountMaltainvestRequiredInitialMargin { + 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_NewAccountMaltainvestRequiredInitialMargin, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSourceOfExperience, v) } - *j = NewAccountMaltainvestRequiredInitialMargin(v) + *j = NewAccountMaltainvestSourceOfExperience(v) return nil } -var enumValues_NewAccountMaltainvestRequiredInitialMargin = []interface{}{ - "When opening a Leveraged CFD trade.", - "When trading Multipliers.", - "When buying shares of a company.", - "All of the above.", +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestSalutation) 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_NewAccountMaltainvestSalutation { + 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_NewAccountMaltainvestSalutation, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestSourceOfWealth, v) } - *j = NewAccountMaltainvestSalutation(v) + *j = NewAccountMaltainvestSourceOfWealth(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 *NewAccountMaltainvestCfdTradingDefinition) 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_NewAccountMaltainvestCfdTradingDefinition { + 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_NewAccountMaltainvestCfdTradingDefinition, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestTradingExperienceFinancialInstruments, v) } - *j = NewAccountMaltainvestCfdTradingDefinition(v) + *j = NewAccountMaltainvestTradingExperienceFinancialInstruments(v) return nil } -var enumValues_NewAccountMaltainvestSalutation = []interface{}{ - "Mr", - "Ms", - "Miss", - "Mrs", +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountMaltainvestClientType) 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_NewAccountMaltainvestClientType { + 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_NewAccountMaltainvestClientType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountMaltainvestTradingFrequencyFinancialInstruments, v) } - *j = NewAccountMaltainvestClientType(v) + *j = NewAccountMaltainvestTradingFrequencyFinancialInstruments(v) return nil } @@ -1114,34 +1130,34 @@ func (j *NewAccountMaltainvest) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["address_city"]; !ok || v == nil { + if _, ok := raw["address_city"]; raw != nil && !ok { return fmt.Errorf("field address_city in NewAccountMaltainvest: required") } - if v, ok := raw["address_line_1"]; !ok || v == nil { + if _, ok := raw["address_line_1"]; raw != nil && !ok { return fmt.Errorf("field address_line_1 in NewAccountMaltainvest: required") } - if v, ok := raw["date_of_birth"]; !ok || v == nil { + if _, ok := raw["date_of_birth"]; raw != nil && !ok { return fmt.Errorf("field date_of_birth in NewAccountMaltainvest: required") } - if v, ok := raw["employment_status"]; !ok || v == nil { + if _, ok := raw["employment_status"]; raw != nil && !ok { return fmt.Errorf("field employment_status in NewAccountMaltainvest: required") } - if v, ok := raw["first_name"]; !ok || v == nil { + if _, ok := raw["first_name"]; raw != nil && !ok { return fmt.Errorf("field first_name in NewAccountMaltainvest: required") } - if v, ok := raw["last_name"]; !ok || v == nil { + if _, ok := raw["last_name"]; raw != nil && !ok { return fmt.Errorf("field last_name in NewAccountMaltainvest: required") } - if v, ok := raw["new_account_maltainvest"]; !ok || v == nil { + if _, ok := raw["new_account_maltainvest"]; raw != nil && !ok { return fmt.Errorf("field new_account_maltainvest in NewAccountMaltainvest: required") } - if v, ok := raw["residence"]; !ok || v == nil { + if _, ok := raw["residence"]; raw != nil && !ok { return fmt.Errorf("field residence in NewAccountMaltainvest: required") } - if v, ok := raw["salutation"]; !ok || v == nil { + if _, ok := raw["salutation"]; raw != nil && !ok { return fmt.Errorf("field salutation in NewAccountMaltainvest: required") } - if v, ok := raw["tax_residence"]; !ok || v == nil { + if _, ok := raw["tax_residence"]; raw != nil && !ok { 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 ebc121b..d3c2a0f 100644 --- a/schema/new_account_maltainvest_resp.go +++ b/schema/new_account_maltainvest_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ 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 @@ -61,13 +77,13 @@ func (j *NewAccountMaltainvestRespNewAccountMaltainvest) UnmarshalJSON(b []byte) if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["client_id"]; !ok || v == nil { + if _, ok := raw["client_id"]; raw != nil && !ok { return fmt.Errorf("field client_id in NewAccountMaltainvestRespNewAccountMaltainvest: required") } - if v, ok := raw["landing_company"]; !ok || v == nil { + if _, ok := raw["landing_company"]; raw != nil && !ok { return fmt.Errorf("field landing_company in NewAccountMaltainvestRespNewAccountMaltainvest: required") } - if v, ok := raw["oauth_token"]; !ok || v == nil { + if _, ok := raw["oauth_token"]; raw != nil && !ok { return fmt.Errorf("field oauth_token in NewAccountMaltainvestRespNewAccountMaltainvest: required") } type Plain NewAccountMaltainvestRespNewAccountMaltainvest @@ -79,32 +95,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in NewAccountMaltainvestResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 eae2e33..babf5c0 100644 --- a/schema/new_account_real.go +++ b/schema/new_account_real.go @@ -6,139 +6,6 @@ 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 @@ -243,27 +110,138 @@ 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 *NewAccountRealSecretQuestion) UnmarshalJSON(b []byte) error { +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_NewAccountRealSecretQuestion { + 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_NewAccountRealSecretQuestion, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountRealAccountOpeningReason, v) } - *j = NewAccountRealSecretQuestion(v) + *j = NewAccountRealAccountOpeningReason(v) return nil } -type NewAccountRealSalutation string +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 { + 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 { + 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 NewAccountRealNewAccountReal int + +var enumValues_NewAccountRealNewAccountReal = []interface{}{ + 1, +} // UnmarshalJSON implements json.Unmarshaler. func (j *NewAccountRealNewAccountReal) UnmarshalJSON(b []byte) error { @@ -289,8 +267,19 @@ func (j *NewAccountRealNewAccountReal) UnmarshalJSON(b []byte) error { // the `echo_req` output field. type NewAccountRealPassthrough map[string]interface{} -const NewAccountRealSalutationMrs NewAccountRealSalutation = "Mrs" +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", +} // UnmarshalJSON implements json.Unmarshaler. func (j *NewAccountRealSalutation) UnmarshalJSON(b []byte) error { @@ -312,8 +301,8 @@ func (j *NewAccountRealSalutation) UnmarshalJSON(b []byte) error { return nil } -const NewAccountRealSalutationMr NewAccountRealSalutation = "Mr" -const NewAccountRealSalutationMs NewAccountRealSalutation = "Ms" +type NewAccountRealSecretQuestion string + const NewAccountRealSecretQuestionBrandOfFirstCar NewAccountRealSecretQuestion = "Brand of first car" const NewAccountRealSecretQuestionFavouriteArtist NewAccountRealSecretQuestion = "Favourite artist" const NewAccountRealSecretQuestionFavouriteDish NewAccountRealSecretQuestion = "Favourite dish" @@ -323,36 +312,6 @@ 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", @@ -363,3 +322,50 @@ 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 fde79cb..04b6d79 100644 --- a/schema/new_account_real_resp.go +++ b/schema/new_account_real_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ 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 @@ -64,13 +80,13 @@ func (j *NewAccountRealRespNewAccountReal) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["client_id"]; !ok || v == nil { + if _, ok := raw["client_id"]; raw != nil && !ok { return fmt.Errorf("field client_id in NewAccountRealRespNewAccountReal: required") } - if v, ok := raw["landing_company"]; !ok || v == nil { + if _, ok := raw["landing_company"]; raw != nil && !ok { return fmt.Errorf("field landing_company in NewAccountRealRespNewAccountReal: required") } - if v, ok := raw["oauth_token"]; !ok || v == nil { + if _, ok := raw["oauth_token"]; raw != nil && !ok { return fmt.Errorf("field oauth_token in NewAccountRealRespNewAccountReal: required") } type Plain NewAccountRealRespNewAccountReal @@ -82,32 +98,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in NewAccountRealResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 757b05d..50e1127 100644 --- a/schema/new_account_virtual.go +++ b/schema/new_account_virtual.go @@ -108,117 +108,118 @@ 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 *NewAccountVirtualSignupDevice) 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_NewAccountVirtualSignupDevice { + 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_NewAccountVirtualSignupDevice, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualEmailConsent, v) } - *j = NewAccountVirtualSignupDevice(v) + *j = NewAccountVirtualEmailConsent(v) return nil } -var enumValues_NewAccountVirtualType = []interface{}{ - "trading", - "wallet", +type NewAccountVirtualNewAccountVirtual int + +var enumValues_NewAccountVirtualNewAccountVirtual = []interface{}{ + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *NewAccountVirtualType) 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_NewAccountVirtualType { + 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_NewAccountVirtualType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualNewAccountVirtual, v) } - *j = NewAccountVirtualType(v) + *j = NewAccountVirtualNewAccountVirtual(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 *NewAccountVirtualNewAccountVirtual) 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_NewAccountVirtualNewAccountVirtual { + 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_NewAccountVirtualNewAccountVirtual, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualSignupDevice, v) } - *j = NewAccountVirtualNewAccountVirtual(v) + *j = NewAccountVirtualSignupDevice(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 *NewAccountVirtualEmailConsent) 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_NewAccountVirtualEmailConsent { + 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_NewAccountVirtualEmailConsent, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualType, v) } - *j = NewAccountVirtualEmailConsent(v) + *j = NewAccountVirtualType(v) return nil } @@ -228,7 +229,7 @@ func (j *NewAccountVirtual) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["new_account_virtual"]; !ok || v == nil { + if _, ok := raw["new_account_virtual"]; raw != nil && !ok { 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 b514d8d..289be34 100644 --- a/schema/new_account_virtual_resp.go +++ b/schema/new_account_virtual_resp.go @@ -29,6 +29,30 @@ 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 @@ -59,48 +83,28 @@ 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 *NewAccountVirtualRespMsgType) UnmarshalJSON(b []byte) error { +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_NewAccountVirtualRespMsgType { + 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_NewAccountVirtualRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_NewAccountVirtualRespNewAccountVirtualType, v) } - *j = NewAccountVirtualRespMsgType(v) + *j = NewAccountVirtualRespNewAccountVirtualType(v) return nil } @@ -110,19 +114,19 @@ func (j *NewAccountVirtualRespNewAccountVirtual) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["balance"]; !ok || v == nil { + if _, ok := raw["balance"]; raw != nil && !ok { return fmt.Errorf("field balance in NewAccountVirtualRespNewAccountVirtual: required") } - if v, ok := raw["client_id"]; !ok || v == nil { + if _, ok := raw["client_id"]; raw != nil && !ok { return fmt.Errorf("field client_id in NewAccountVirtualRespNewAccountVirtual: required") } - if v, ok := raw["currency"]; !ok || v == nil { + if _, ok := raw["currency"]; raw != nil && !ok { return fmt.Errorf("field currency in NewAccountVirtualRespNewAccountVirtual: required") } - if v, ok := raw["email"]; !ok || v == nil { + if _, ok := raw["email"]; raw != nil && !ok { return fmt.Errorf("field email in NewAccountVirtualRespNewAccountVirtual: required") } - if v, ok := raw["oauth_token"]; !ok || v == nil { + if _, ok := raw["oauth_token"]; raw != nil && !ok { return fmt.Errorf("field oauth_token in NewAccountVirtualRespNewAccountVirtual: required") } type Plain NewAccountVirtualRespNewAccountVirtual @@ -134,20 +138,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in NewAccountVirtualResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 5d9d72e..ce3ce34 100644 --- a/schema/oauth_apps.go +++ b/schema/oauth_apps.go @@ -6,6 +6,23 @@ import "encoding/json" import "fmt" import "reflect" +// List all my used OAuth applications. +type OauthApps struct { + // [Optional] The login id of the user. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["oauth_apps"]; !ok || v == nil { + if _, ok := raw["oauth_apps"]; raw != nil && !ok { 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 e7a1401..813f8ca 100644 --- a/schema/oauth_apps_resp.go +++ b/schema/oauth_apps_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,7 +53,26 @@ func (j *OauthAppsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const OauthAppsRespMsgTypeOauthApps OauthAppsRespMsgType = "oauth_apps" +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"` +} type OauthAppsRespOauthAppsElemOfficial int @@ -64,49 +101,28 @@ 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 v, ok := raw["app_id"]; !ok || v == nil { + if _, ok := raw["app_id"]; raw != nil && !ok { return fmt.Errorf("field app_id in OauthAppsRespOauthAppsElem: required") } - if v, ok := raw["app_markup_percentage"]; !ok || v == nil { + if _, ok := raw["app_markup_percentage"]; raw != nil && !ok { return fmt.Errorf("field app_markup_percentage in OauthAppsRespOauthAppsElem: required") } - if v, ok := raw["last_used"]; !ok || v == nil { + if _, ok := raw["last_used"]; raw != nil && !ok { return fmt.Errorf("field last_used in OauthAppsRespOauthAppsElem: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in OauthAppsRespOauthAppsElem: required") } - if v, ok := raw["official"]; !ok || v == nil { + if _, ok := raw["official"]; raw != nil && !ok { return fmt.Errorf("field official in OauthAppsRespOauthAppsElem: required") } - if v, ok := raw["scopes"]; !ok || v == nil { + if _, ok := raw["scopes"]; raw != nil && !ok { return fmt.Errorf("field scopes in OauthAppsRespOauthAppsElem: required") } type Plain OauthAppsRespOauthAppsElem @@ -118,32 +134,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in OauthAppsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 ad49099..9afddb3 100644 --- a/schema/p2p_advert_create.go +++ b/schema/p2p_advert_create.go @@ -95,117 +95,118 @@ 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 *P2PAdvertCreateRateType) 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_P2PAdvertCreateRateType { + 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_P2PAdvertCreateRateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateBlockTrade, v) } - *j = P2PAdvertCreateRateType(v) + *j = P2PAdvertCreateBlockTrade(v) return nil } -var enumValues_P2PAdvertCreateType = []interface{}{ - "buy", - "sell", +type P2PAdvertCreateP2PAdvertCreate int + +var enumValues_P2PAdvertCreateP2PAdvertCreate = []interface{}{ + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateType) 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_P2PAdvertCreateType { + 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_P2PAdvertCreateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateP2PAdvertCreate, v) } - *j = P2PAdvertCreateType(v) + *j = P2PAdvertCreateP2PAdvertCreate(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 *P2PAdvertCreateP2PAdvertCreate) 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_P2PAdvertCreateP2PAdvertCreate { + 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_P2PAdvertCreateP2PAdvertCreate, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRateType, v) } - *j = P2PAdvertCreateP2PAdvertCreate(v) + *j = P2PAdvertCreateRateType(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 *P2PAdvertCreateBlockTrade) 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_P2PAdvertCreateBlockTrade { + 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_P2PAdvertCreateBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateType, v) } - *j = P2PAdvertCreateBlockTrade(v) + *j = P2PAdvertCreateType(v) return nil } @@ -215,22 +216,22 @@ func (j *P2PAdvertCreate) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in P2PAdvertCreate: required") } - if v, ok := raw["max_order_amount"]; !ok || v == nil { + if _, ok := raw["max_order_amount"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount in P2PAdvertCreate: required") } - if v, ok := raw["min_order_amount"]; !ok || v == nil { + if _, ok := raw["min_order_amount"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount in P2PAdvertCreate: required") } - if v, ok := raw["p2p_advert_create"]; !ok || v == nil { + if _, ok := raw["p2p_advert_create"]; raw != nil && !ok { return fmt.Errorf("field p2p_advert_create in P2PAdvertCreate: required") } - if v, ok := raw["rate"]; !ok || v == nil { + if _, ok := raw["rate"]; raw != nil && !ok { return fmt.Errorf("field rate in P2PAdvertCreate: required") } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { 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 2d1a9d7..bff7432 100644 --- a/schema/p2p_advert_create_resp.go +++ b/schema/p2p_advert_create_resp.go @@ -29,6 +29,30 @@ 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 @@ -235,108 +259,111 @@ type P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails struct { type P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline 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 P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertInactive P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_inactive" -const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertMaxLimit P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_max_limit" +var enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem) 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_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem { + 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_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem(v) + *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline(v) return nil } -var enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateIsActive) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails) 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_P2PAdvertCreateRespP2PAdvertCreateIsActive { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if _, ok := raw["completed_orders_count"]; raw != nil && !ok { + return fmt.Errorf("field completed_orders_count in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive, v) + if _, ok := raw["id"]; raw != nil && !ok { + return fmt.Errorf("field id in P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails: required") } - *j = P2PAdvertCreateRespP2PAdvertCreateIsActive(v) + if _, ok := raw["is_online"]; raw != nil && !ok { + return fmt.Errorf("field is_online 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") + } + type Plain P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetails(plain) return nil } -var enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType = []interface{}{ - "fixed", - "float", +type P2PAdvertCreateRespP2PAdvertCreateBlockTrade int + +var enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateRateType) 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_P2PAdvertCreateRespP2PAdvertCreateRateType { + 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_P2PAdvertCreateRespP2PAdvertCreateRateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateRateType(v) + *j = P2PAdvertCreateRespP2PAdvertCreateBlockTrade(v) return nil } -var enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive = []interface{}{ - 0, - 1, +type P2PAdvertCreateRespP2PAdvertCreateCounterpartyType string + +const P2PAdvertCreateRespP2PAdvertCreateCounterpartyTypeBuy P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = "buy" +const P2PAdvertCreateRespP2PAdvertCreateCounterpartyTypeSell P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = "sell" + +var enumValues_P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = []interface{}{ + "buy", + "sell", } // UnmarshalJSON implements json.Unmarshaler. @@ -359,163 +386,127 @@ func (j *P2PAdvertCreateRespP2PAdvertCreateCounterpartyType) UnmarshalJSON(b []b return nil } -var enumValues_P2PAdvertCreateRespP2PAdvertCreateCounterpartyType = []interface{}{ - "buy", - "sell", -} -var enumValues_P2PAdvertCreateRespP2PAdvertCreateType = []interface{}{ - "buy", - "sell", +type P2PAdvertCreateRespP2PAdvertCreateIsActive int + +var enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateType) 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_P2PAdvertCreateRespP2PAdvertCreateType { + 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_P2PAdvertCreateRespP2PAdvertCreateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateIsActive, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateType(v) + *j = P2PAdvertCreateRespP2PAdvertCreateIsActive(v) return nil } +type P2PAdvertCreateRespP2PAdvertCreateIsVisible int + +var enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateBlockTrade) 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_P2PAdvertCreateRespP2PAdvertCreateBlockTrade { + 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_P2PAdvertCreateRespP2PAdvertCreateBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateIsVisible, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateBlockTrade(v) + *j = P2PAdvertCreateRespP2PAdvertCreateIsVisible(v) return nil } -var enumValues_P2PAdvertCreateRespP2PAdvertCreateBlockTrade = []interface{}{ - 0, - 1, -} +// Details of available payment methods (sell adverts only). +type P2PAdvertCreateRespP2PAdvertCreatePaymentMethodDetails map[string]interface{} -// 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["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 -} +type P2PAdvertCreateRespP2PAdvertCreateRateType string -var enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = []interface{}{ - "advert_inactive", - "advert_max_limit", - "advert_min_limit", - "advert_remaining", - "advertiser_ads_paused", - "advertiser_approval", - "advertiser_balance", - "advertiser_block_trade_ineligible", - "advertiser_daily_limit", - "advertiser_temp_ban", +const P2PAdvertCreateRespP2PAdvertCreateRateTypeFixed P2PAdvertCreateRespP2PAdvertCreateRateType = "fixed" +const P2PAdvertCreateRespP2PAdvertCreateRateTypeFloat P2PAdvertCreateRespP2PAdvertCreateRateType = "float" + +var enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType = []interface{}{ + "fixed", + "float", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespP2PAdvertCreateIsVisible) 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_P2PAdvertCreateRespP2PAdvertCreateIsVisible { + 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_P2PAdvertCreateRespP2PAdvertCreateIsVisible, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateRateType, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateIsVisible(v) + *j = P2PAdvertCreateRespP2PAdvertCreateRateType(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 *P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline) 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_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline { + 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_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateType, v) } - *j = P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline(v) + *j = P2PAdvertCreateRespP2PAdvertCreateType(v) return nil } -var enumValues_P2PAdvertCreateRespP2PAdvertCreateAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} +type P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem string +const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertInactive P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_inactive" +const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertMaxLimit P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_max_limit" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertMinLimit P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_min_limit" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertRemaining P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advert_remaining" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserAdsPaused P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advertiser_ads_paused" @@ -525,23 +516,36 @@ const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserBlockTrade const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserDailyLimit P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advertiser_daily_limit" const P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElemAdvertiserTempBan P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = "advertiser_temp_ban" +var enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem = []interface{}{ + "advert_inactive", + "advert_max_limit", + "advert_min_limit", + "advert_remaining", + "advertiser_ads_paused", + "advertiser_approval", + "advertiser_balance", + "advertiser_block_trade_ineligible", + "advertiser_daily_limit", + "advertiser_temp_ban", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertCreateRespMsgType) UnmarshalJSON(b []byte) error { +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_P2PAdvertCreateRespMsgType { + 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_P2PAdvertCreateRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem, v) } - *j = P2PAdvertCreateRespMsgType(v) + *j = P2PAdvertCreateRespP2PAdvertCreateVisibilityStatusElem(v) return nil } @@ -551,103 +555,103 @@ func (j *P2PAdvertCreateRespP2PAdvertCreate) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["account_currency"]; !ok || v == nil { + if _, ok := raw["account_currency"]; raw != nil && !ok { return fmt.Errorf("field account_currency in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["active_orders"]; !ok || v == nil { + if _, ok := raw["active_orders"]; raw != nil && !ok { return fmt.Errorf("field active_orders in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["advertiser_details"]; !ok || v == nil { + if _, ok := raw["advertiser_details"]; raw != nil && !ok { return fmt.Errorf("field advertiser_details in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["amount_display"]; !ok || v == nil { + if _, ok := raw["amount_display"]; raw != nil && !ok { return fmt.Errorf("field amount_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["block_trade"]; !ok || v == nil { + if _, ok := raw["block_trade"]; raw != nil && !ok { return fmt.Errorf("field block_trade in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["counterparty_type"]; !ok || v == nil { + if _, ok := raw["counterparty_type"]; raw != nil && !ok { return fmt.Errorf("field counterparty_type in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["country"]; !ok || v == nil { + if _, ok := raw["country"]; raw != nil && !ok { return fmt.Errorf("field country in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["description"]; !ok || v == nil { + if _, ok := raw["description"]; raw != nil && !ok { return fmt.Errorf("field description in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["effective_rate"]; !ok || v == nil { + if _, ok := raw["effective_rate"]; raw != nil && !ok { return fmt.Errorf("field effective_rate in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["effective_rate_display"]; !ok || v == nil { + if _, ok := raw["effective_rate_display"]; raw != nil && !ok { return fmt.Errorf("field effective_rate_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["is_active"]; !ok || v == nil { + if _, ok := raw["is_active"]; raw != nil && !ok { return fmt.Errorf("field is_active in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["local_currency"]; !ok || v == nil { + if _, ok := raw["local_currency"]; raw != nil && !ok { return fmt.Errorf("field local_currency in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["max_order_amount"]; !ok || v == nil { + if _, ok := raw["max_order_amount"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["max_order_amount_display"]; !ok || v == nil { + if _, ok := raw["max_order_amount_display"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["max_order_amount_limit"]; !ok || v == nil { + if _, ok := raw["max_order_amount_limit"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount_limit in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["max_order_amount_limit_display"]; !ok || v == nil { + if _, ok := raw["max_order_amount_limit_display"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount_limit_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["min_order_amount"]; !ok || v == nil { + if _, ok := raw["min_order_amount"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["min_order_amount_display"]; !ok || v == nil { + if _, ok := raw["min_order_amount_display"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["min_order_amount_limit"]; !ok || v == nil { + if _, ok := raw["min_order_amount_limit"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount_limit in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["min_order_amount_limit_display"]; !ok || v == nil { + if _, ok := raw["min_order_amount_limit_display"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount_limit_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["order_expiry_period"]; !ok || v == nil { + if _, ok := raw["order_expiry_period"]; raw != nil && !ok { return fmt.Errorf("field order_expiry_period in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["payment_method"]; !ok || v == nil { + if _, ok := raw["payment_method"]; raw != nil && !ok { return fmt.Errorf("field payment_method in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["price_display"]; !ok || v == nil { + if _, ok := raw["price_display"]; raw != nil && !ok { return fmt.Errorf("field price_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["rate"]; !ok || v == nil { + if _, ok := raw["rate"]; raw != nil && !ok { return fmt.Errorf("field rate in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["rate_display"]; !ok || v == nil { + if _, ok := raw["rate_display"]; raw != nil && !ok { return fmt.Errorf("field rate_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["rate_type"]; !ok || v == nil { + if _, ok := raw["rate_type"]; raw != nil && !ok { return fmt.Errorf("field rate_type in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["remaining_amount"]; !ok || v == nil { + if _, ok := raw["remaining_amount"]; raw != nil && !ok { return fmt.Errorf("field remaining_amount in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["remaining_amount_display"]; !ok || v == nil { + if _, ok := raw["remaining_amount_display"]; raw != nil && !ok { return fmt.Errorf("field remaining_amount_display in P2PAdvertCreateRespP2PAdvertCreate: required") } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in P2PAdvertCreateRespP2PAdvertCreate: required") } type Plain P2PAdvertCreateRespP2PAdvertCreate @@ -662,20 +666,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertCreateResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 0144417..02b95ff 100644 --- a/schema/p2p_advert_info.go +++ b/schema/p2p_advert_info.go @@ -6,6 +6,35 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -89,42 +118,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_advert_info"]; !ok || v == nil { + if _, ok := raw["p2p_advert_info"]; raw != nil && !ok { 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 fcdca5a..ad93aed 100644 --- a/schema/p2p_advert_info_resp.go +++ b/schema/p2p_advert_info_resp.go @@ -6,11 +6,32 @@ import "encoding/json" import "fmt" import "reflect" +// Returns information about the given advert ID. +type P2PAdvertInfoResp struct { + // Echo of the request made. + EchoReq P2PAdvertInfoRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertInfoRespMsgType `json:"msg_type"` + + // P2P advert information. + P2PAdvertInfo *P2PAdvertInfoRespP2PAdvertInfo `json:"p2p_advert_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 *P2PAdvertInfoRespSubscription `json:"subscription,omitempty"` +} + // Echo of the request made. type P2PAdvertInfoRespEchoReq map[string]interface{} type P2PAdvertInfoRespMsgType string +const P2PAdvertInfoRespMsgTypeP2PAdvertInfo P2PAdvertInfoRespMsgType = "p2p_advert_info" + var enumValues_P2PAdvertInfoRespMsgType = []interface{}{ "p2p_advert_info", } @@ -35,7 +56,245 @@ func (j *P2PAdvertInfoRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertInfoRespMsgTypeP2PAdvertInfo P2PAdvertInfoRespMsgType = "p2p_advert_info" +// P2P advert information. +type P2PAdvertInfoRespP2PAdvertInfo 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 *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails `json:"advertiser_details,omitempty"` + + // 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 *P2PAdvertInfoRespP2PAdvertInfoBlockTrade `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 *P2PAdvertInfoRespP2PAdvertInfoCounterpartyType `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 *P2PAdvertInfoRespP2PAdvertInfoDeleted `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"` + + // 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 []P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem `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,omitempty"` + + // The activation status of the advert. + IsActive *P2PAdvertInfoRespP2PAdvertInfoIsActive `json:"is_active,omitempty"` + + // Indicates that the current user meets the counterparty terms for placing orders + // against this advert. + IsEligible P2PAdvertInfoRespP2PAdvertInfoIsEligible `json:"is_eligible,omitempty"` + + // Indicates that this advert will appear on the main advert list. It is only + // visible to the advert owner. + IsVisible P2PAdvertInfoRespP2PAdvertInfoIsVisible `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`. 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,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 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,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 P2PAdvertInfoRespP2PAdvertInfoPaymentMethodDetails `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 *P2PAdvertInfoRespP2PAdvertInfoRateType `json:"rate_type,omitempty"` + + // Amount currently available for orders, in `account_currency`. It is only + // visible for advertisers. + 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 *P2PAdvertInfoRespP2PAdvertInfoType `json:"type,omitempty"` + + // Reasons why an advert is not visible, only visible to the advert owner. + // Possible values: + // - `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. + // - `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_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 []P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem `json:"visibility_status,omitempty"` +} + +// Details of the advertiser for this advert. +type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails 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 *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked `json:"is_blocked,omitempty"` + + // Indicates that the advertiser is a favourite of the current user. + IsFavourite *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite `json:"is_favourite,omitempty"` + + // Indicates if the advertiser is currently online. + IsOnline P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline `json:"is_online"` + + // Indicates that the advertiser was recommended in the most recent review by the + // current user. + IsRecommended *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended `json:"is_recommended,omitempty"` + + // 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"` +} type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked int @@ -122,17 +381,17 @@ 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, } -// MarshalJSON implements json.Marshaler. -func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} - // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -155,90 +414,40 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended) Unmarshal return nil } -// Details of the advertiser for this advert. -type P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails 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 *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsBlocked `json:"is_blocked,omitempty"` - - // Indicates that the advertiser is a favourite of the current user. - IsFavourite *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsFavourite `json:"is_favourite,omitempty"` - - // Indicates if the advertiser is currently online. - IsOnline P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsOnline `json:"is_online"` - - // Indicates that the advertiser was recommended in the most recent review by the - // current user. - IsRecommended *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetailsIsRecommended `json:"is_recommended,omitempty"` - - // 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 *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails) 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 { + if _, ok := raw["completed_orders_count"]; raw != nil && !ok { return fmt.Errorf("field completed_orders_count in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["rating_average"]; !ok || v == nil { + if _, ok := raw["rating_average"]; raw != nil && !ok { return fmt.Errorf("field rating_average in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["rating_count"]; !ok || v == nil { + if _, ok := raw["rating_count"]; raw != nil && !ok { return fmt.Errorf("field rating_count in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["recommended_average"]; !ok || v == nil { + if _, ok := raw["recommended_average"]; raw != nil && !ok { return fmt.Errorf("field recommended_average in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["recommended_count"]; !ok || v == nil { + if _, ok := raw["recommended_count"]; raw != nil && !ok { return fmt.Errorf("field recommended_count in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } - if v, ok := raw["total_completion_rate"]; !ok || v == nil { + if _, ok := raw["total_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field total_completion_rate in P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails: required") } type Plain P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails @@ -279,6 +488,9 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoBlockTrade) UnmarshalJSON(b []byte) error type P2PAdvertInfoRespP2PAdvertInfoCounterpartyType string +const P2PAdvertInfoRespP2PAdvertInfoCounterpartyTypeBuy P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = "buy" +const P2PAdvertInfoRespP2PAdvertInfoCounterpartyTypeSell P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = "sell" + var enumValues_P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = []interface{}{ "buy", "sell", @@ -304,9 +516,6 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoCounterpartyType) UnmarshalJSON(b []byte) return nil } -const P2PAdvertInfoRespP2PAdvertInfoCounterpartyTypeBuy P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = "buy" -const P2PAdvertInfoRespP2PAdvertInfoCounterpartyTypeSell P2PAdvertInfoRespP2PAdvertInfoCounterpartyType = "sell" - type P2PAdvertInfoRespP2PAdvertInfoDeleted int var enumValues_P2PAdvertInfoRespP2PAdvertInfoDeleted = []interface{}{ @@ -335,6 +544,11 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoDeleted) UnmarshalJSON(b []byte) error { 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", @@ -362,11 +576,6 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem) UnmarshalJSON(b [] return nil } -const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemCompletionRate P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "completion_rate" -const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemCountry P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "country" -const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemJoinDate P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "join_date" -const P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElemRatingAverage P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem = "rating_average" - type P2PAdvertInfoRespP2PAdvertInfoIsActive int var enumValues_P2PAdvertInfoRespP2PAdvertInfoIsActive = []interface{}{ @@ -453,6 +662,9 @@ type P2PAdvertInfoRespP2PAdvertInfoPaymentMethodDetails map[string]interface{} type P2PAdvertInfoRespP2PAdvertInfoRateType string +const P2PAdvertInfoRespP2PAdvertInfoRateTypeFixed P2PAdvertInfoRespP2PAdvertInfoRateType = "fixed" +const P2PAdvertInfoRespP2PAdvertInfoRateTypeFloat P2PAdvertInfoRespP2PAdvertInfoRateType = "float" + var enumValues_P2PAdvertInfoRespP2PAdvertInfoRateType = []interface{}{ "fixed", "float", @@ -478,11 +690,11 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoRateType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertInfoRespP2PAdvertInfoRateTypeFixed P2PAdvertInfoRespP2PAdvertInfoRateType = "fixed" -const P2PAdvertInfoRespP2PAdvertInfoRateTypeFloat P2PAdvertInfoRespP2PAdvertInfoRateType = "float" - type P2PAdvertInfoRespP2PAdvertInfoType string +const P2PAdvertInfoRespP2PAdvertInfoTypeBuy P2PAdvertInfoRespP2PAdvertInfoType = "buy" +const P2PAdvertInfoRespP2PAdvertInfoTypeSell P2PAdvertInfoRespP2PAdvertInfoType = "sell" + var enumValues_P2PAdvertInfoRespP2PAdvertInfoType = []interface{}{ "buy", "sell", @@ -508,11 +720,19 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertInfoRespP2PAdvertInfoTypeBuy P2PAdvertInfoRespP2PAdvertInfoType = "buy" -const P2PAdvertInfoRespP2PAdvertInfoTypeSell P2PAdvertInfoRespP2PAdvertInfoType = "sell" - type P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem string +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertInactive P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_inactive" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertMaxLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_max_limit" +const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertMinLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_min_limit" +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 P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserTempBan P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_temp_ban" + var enumValues_P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = []interface{}{ "advert_inactive", "advert_max_limit", @@ -546,207 +766,6 @@ func (j *P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem) UnmarshalJSON(b []b return nil } -// P2P advert information. -type P2PAdvertInfoRespP2PAdvertInfo 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 *P2PAdvertInfoRespP2PAdvertInfoAdvertiserDetails `json:"advertiser_details,omitempty"` - - // 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 *P2PAdvertInfoRespP2PAdvertInfoBlockTrade `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 *P2PAdvertInfoRespP2PAdvertInfoCounterpartyType `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 *P2PAdvertInfoRespP2PAdvertInfoDeleted `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"` - - // 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 []P2PAdvertInfoRespP2PAdvertInfoEligibilityStatusElem `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,omitempty"` - - // The activation status of the advert. - IsActive *P2PAdvertInfoRespP2PAdvertInfoIsActive `json:"is_active,omitempty"` - - // Indicates that the current user meets the counterparty terms for placing orders - // against this advert. - IsEligible P2PAdvertInfoRespP2PAdvertInfoIsEligible `json:"is_eligible,omitempty"` - - // Indicates that this advert will appear on the main advert list. It is only - // visible to the advert owner. - IsVisible P2PAdvertInfoRespP2PAdvertInfoIsVisible `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`. 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,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 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,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 P2PAdvertInfoRespP2PAdvertInfoPaymentMethodDetails `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 *P2PAdvertInfoRespP2PAdvertInfoRateType `json:"rate_type,omitempty"` - - // Amount currently available for orders, in `account_currency`. It is only - // visible for advertisers. - 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 *P2PAdvertInfoRespP2PAdvertInfoType `json:"type,omitempty"` - - // Reasons why an advert is not visible, only visible to the advert owner. - // Possible values: - // - `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. - // - `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_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 []P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem `json:"visibility_status,omitempty"` -} - -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertInactive P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_inactive" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertMaxLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_max_limit" -const P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertMinLimit P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advert_min_limit" -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 P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElemAdvertiserTempBan P2PAdvertInfoRespP2PAdvertInfoVisibilityStatusElem = "advertiser_temp_ban" - // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertInfoRespP2PAdvertInfo) UnmarshalJSON(b []byte) error { var raw map[string]interface{} @@ -781,7 +800,7 @@ func (j *P2PAdvertInfoRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertInfoRespSubscription: required") } type Plain P2PAdvertInfoRespSubscription @@ -793,35 +812,16 @@ func (j *P2PAdvertInfoRespSubscription) UnmarshalJSON(b []byte) error { return nil } -// Returns information about the given advert ID. -type P2PAdvertInfoResp struct { - // Echo of the request made. - EchoReq P2PAdvertInfoRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertInfoRespMsgType `json:"msg_type"` - - // P2P advert information. - P2PAdvertInfo *P2PAdvertInfoRespP2PAdvertInfo `json:"p2p_advert_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 *P2PAdvertInfoRespSubscription `json:"subscription,omitempty"` -} - // 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertInfoResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 7d7a60a..81a0a5c 100644 --- a/schema/p2p_advert_list.go +++ b/schema/p2p_advert_list.go @@ -6,6 +6,66 @@ 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 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -35,6 +95,9 @@ func (j *P2PAdvertListBlockTrade) UnmarshalJSON(b []byte) error { type P2PAdvertListCounterpartyType string +const P2PAdvertListCounterpartyTypeBuy P2PAdvertListCounterpartyType = "buy" +const P2PAdvertListCounterpartyTypeSell P2PAdvertListCounterpartyType = "sell" + var enumValues_P2PAdvertListCounterpartyType = []interface{}{ "buy", "sell", @@ -60,9 +123,6 @@ func (j *P2PAdvertListCounterpartyType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertListCounterpartyTypeBuy P2PAdvertListCounterpartyType = "buy" -const P2PAdvertListCounterpartyTypeSell P2PAdvertListCounterpartyType = "sell" - type P2PAdvertListFavouritesOnly int var enumValues_P2PAdvertListFavouritesOnly = []interface{}{ @@ -149,6 +209,11 @@ 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", @@ -176,11 +241,6 @@ 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{}{ @@ -208,73 +268,13 @@ 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 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_advert_list"]; !ok || v == nil { + if _, ok := raw["p2p_advert_list"]; raw != nil && !ok { 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 cd3b351..42700e4 100644 --- a/schema/p2p_advert_list_resp.go +++ b/schema/p2p_advert_list_resp.go @@ -29,6 +29,30 @@ type P2PAdvertListRespMsgType string const P2PAdvertListRespMsgTypeP2PAdvertList P2PAdvertListRespMsgType = "p2p_advert_list" +var enumValues_P2PAdvertListRespMsgType = []interface{}{ + "p2p_advert_list", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertListRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertListRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespMsgType, v) + } + *j = P2PAdvertListRespMsgType(v) + return nil +} + // P2P adverts list. type P2PAdvertListRespP2PAdvertList struct { // List of adverts. @@ -269,51 +293,36 @@ type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails struct { type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked int -type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsFavourite int - -type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline int - -type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended struct { - Value interface{} +var enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked = []interface{}{ + 0, } -type P2PAdvertListRespP2PAdvertListListElemBlockTrade int - -type P2PAdvertListRespP2PAdvertListListElemCounterpartyType string - -const P2PAdvertListRespP2PAdvertListListElemCounterpartyTypeBuy P2PAdvertListRespP2PAdvertListListElemCounterpartyType = "buy" -const P2PAdvertListRespP2PAdvertListListElemCounterpartyTypeSell P2PAdvertListRespP2PAdvertListListElemCounterpartyType = "sell" - -type P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem string - -const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemCompletionRate P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "completion_rate" -const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemCountry P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "country" -const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemJoinDate P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "join_date" -const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemRatingAverage P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "rating_average" - -type P2PAdvertListRespP2PAdvertListListElemIsActive int - -type P2PAdvertListRespP2PAdvertListListElemIsEligible int - -type P2PAdvertListRespP2PAdvertListListElemIsVisible int - -type P2PAdvertListRespP2PAdvertListListElemRateType string - -const P2PAdvertListRespP2PAdvertListListElemRateTypeFixed P2PAdvertListRespP2PAdvertListListElemRateType = "fixed" -const P2PAdvertListRespP2PAdvertListListElemRateTypeFloat P2PAdvertListRespP2PAdvertListListElemRateType = "float" - -type P2PAdvertListRespP2PAdvertListListElemType string - -const P2PAdvertListRespP2PAdvertListListElemTypeBuy P2PAdvertListRespP2PAdvertListListElemType = "buy" -const P2PAdvertListRespP2PAdvertListListElemTypeSell P2PAdvertListRespP2PAdvertListListElemType = "sell" +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked, v) + } + *j = P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked(v) + return nil +} -type P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem string +type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsFavourite int -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertInactive P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_inactive" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertMaxLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_max_limit" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertMinLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_min_limit" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertRemaining P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_remaining" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserAdsPaused P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_ads_paused" +var enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsFavourite = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsFavourite) UnmarshalJSON(b []byte) error { @@ -335,28 +344,67 @@ func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsFavourite) Unm return nil } -var enumValues_P2PAdvertListRespP2PAdvertListListElemIsActive = []interface{}{ +type P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline int + +var enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemIsActive) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemIsActive { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemIsActive, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline, v) } - *j = P2PAdvertListRespP2PAdvertListListElemIsActive(v) + *j = P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline(v) + return nil +} + +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, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended) 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_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended { + if reflect.DeepEqual(v.Value, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended, v.Value) + } + *j = P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended(v) return nil } @@ -366,34 +414,34 @@ func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails) UnmarshalJSON( if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["completed_orders_count"]; !ok || v == nil { + if _, ok := raw["completed_orders_count"]; raw != nil && !ok { return fmt.Errorf("field completed_orders_count in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["rating_average"]; !ok || v == nil { + if _, ok := raw["rating_average"]; raw != nil && !ok { return fmt.Errorf("field rating_average in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["rating_count"]; !ok || v == nil { + if _, ok := raw["rating_count"]; raw != nil && !ok { return fmt.Errorf("field rating_count in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["recommended_average"]; !ok || v == nil { + if _, ok := raw["recommended_average"]; raw != nil && !ok { return fmt.Errorf("field recommended_average in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["recommended_count"]; !ok || v == nil { + if _, ok := raw["recommended_count"]; raw != nil && !ok { return fmt.Errorf("field recommended_count in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } - if v, ok := raw["total_completion_rate"]; !ok || v == nil { + if _, ok := raw["total_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field total_completion_rate in P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails: required") } type Plain P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails @@ -405,379 +453,360 @@ func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetails) UnmarshalJSON( return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemType, v) - } - *j = P2PAdvertListRespP2PAdvertListListElemType(v) - return nil +type P2PAdvertListRespP2PAdvertListListElemBlockTrade int + +var enumValues_P2PAdvertListRespP2PAdvertListListElemBlockTrade = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemIsEligible) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertListRespP2PAdvertListListElemBlockTrade) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemIsEligible { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemBlockTrade { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemIsEligible, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemBlockTrade, v) } - *j = P2PAdvertListRespP2PAdvertListListElemIsEligible(v) + *j = P2PAdvertListRespP2PAdvertListListElemBlockTrade(v) return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended) 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_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended { - if reflect.DeepEqual(v.Value, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended, v.Value) - } - *j = P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended(v) - return nil -} +type P2PAdvertListRespP2PAdvertListListElemCounterpartyType string -var enumValues_P2PAdvertListRespP2PAdvertListListElemIsVisible = []interface{}{ - 0, - 1, +const P2PAdvertListRespP2PAdvertListListElemCounterpartyTypeBuy P2PAdvertListRespP2PAdvertListListElemCounterpartyType = "buy" +const P2PAdvertListRespP2PAdvertListListElemCounterpartyTypeSell P2PAdvertListRespP2PAdvertListListElemCounterpartyType = "sell" + +var enumValues_P2PAdvertListRespP2PAdvertListListElemCounterpartyType = []interface{}{ + "buy", + "sell", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemIsVisible) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertListRespP2PAdvertListListElemCounterpartyType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemIsVisible { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemCounterpartyType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemIsVisible, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemCounterpartyType, v) } - *j = P2PAdvertListRespP2PAdvertListListElemIsVisible(v) + *j = P2PAdvertListRespP2PAdvertListListElemCounterpartyType(v) return nil } -// MarshalJSON implements json.Marshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} +type P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem string -var enumValues_P2PAdvertListRespP2PAdvertListListElemRateType = []interface{}{ - "fixed", - "float", +const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemCompletionRate P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "completion_rate" +const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemCountry P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "country" +const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemJoinDate P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "join_date" +const P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElemRatingAverage P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = "rating_average" + +var enumValues_P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = []interface{}{ + "completion_rate", + "country", + "join_date", + "rating_average", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemRateType) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemRateType { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemRateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem, v) } - *j = P2PAdvertListRespP2PAdvertListListElemRateType(v) + *j = P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem(v) return nil } +type P2PAdvertListRespP2PAdvertListListElemIsActive int + +var enumValues_P2PAdvertListRespP2PAdvertListListElemIsActive = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertListRespP2PAdvertListListElemIsActive) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemIsActive { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemIsActive, v) } - *j = P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked(v) + *j = P2PAdvertListRespP2PAdvertListListElemIsActive(v) return nil } +type P2PAdvertListRespP2PAdvertListListElemIsEligible int + +var enumValues_P2PAdvertListRespP2PAdvertListListElemIsEligible = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertListRespP2PAdvertListListElemIsEligible) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemIsEligible { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemIsEligible, v) } - *j = P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline(v) + *j = P2PAdvertListRespP2PAdvertListListElemIsEligible(v) return nil } -var enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsFavourite = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertListRespP2PAdvertListListElemIsEligible = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertListRespMsgType = []interface{}{ - "p2p_advert_list", -} -var enumValues_P2PAdvertListRespP2PAdvertListListElemBlockTrade = []interface{}{ +type P2PAdvertListRespP2PAdvertListListElemIsVisible int + +var enumValues_P2PAdvertListRespP2PAdvertListListElemIsVisible = []interface{}{ 0, 1, } -var enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, -} -var enumValues_P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = []interface{}{ - "advert_inactive", - "advert_max_limit", - "advert_min_limit", - "advert_remaining", - "advertiser_ads_paused", - "advertiser_approval", - "advertiser_balance", - "advertiser_block_trade_ineligible", - "advertiser_daily_limit", - "advertiser_temp_ban", -} // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem) UnmarshalJSON(b []byte) error { - var v string +func (j *P2PAdvertListRespP2PAdvertListListElemIsVisible) UnmarshalJSON(b []byte) error { + var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemIsVisible { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemIsVisible, v) } - *j = P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem(v) + *j = P2PAdvertListRespP2PAdvertListListElemIsVisible(v) return nil } -var enumValues_P2PAdvertListRespP2PAdvertListListElemCounterpartyType = []interface{}{ - "buy", - "sell", +type P2PAdvertListRespP2PAdvertListListElemRateType string + +const P2PAdvertListRespP2PAdvertListListElemRateTypeFixed P2PAdvertListRespP2PAdvertListListElemRateType = "fixed" +const P2PAdvertListRespP2PAdvertListListElemRateTypeFloat P2PAdvertListRespP2PAdvertListListElemRateType = "float" + +var enumValues_P2PAdvertListRespP2PAdvertListListElemRateType = []interface{}{ + "fixed", + "float", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemCounterpartyType) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertListRespP2PAdvertListListElemRateType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemCounterpartyType { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemRateType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemCounterpartyType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemRateType, v) } - *j = P2PAdvertListRespP2PAdvertListListElemCounterpartyType(v) + *j = P2PAdvertListRespP2PAdvertListListElemRateType(v) return nil } -var enumValues_P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem = []interface{}{ - "completion_rate", - "country", - "join_date", - "rating_average", +type P2PAdvertListRespP2PAdvertListListElemType string + +const P2PAdvertListRespP2PAdvertListListElemTypeBuy P2PAdvertListRespP2PAdvertListListElemType = "buy" +const P2PAdvertListRespP2PAdvertListListElemTypeSell P2PAdvertListRespP2PAdvertListListElemType = "sell" + +var enumValues_P2PAdvertListRespP2PAdvertListListElemType = []interface{}{ + "buy", + "sell", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertListRespP2PAdvertListListElemType) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemType { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemType, v) } - *j = P2PAdvertListRespP2PAdvertListListElemEligibilityStatusElem(v) + *j = P2PAdvertListRespP2PAdvertListListElemType(v) return nil } +type P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem string + +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertInactive P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_inactive" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertMaxLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_max_limit" +const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertMinLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advert_min_limit" +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 P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserTempBan P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_temp_ban" + +var enumValues_P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = []interface{}{ + "advert_inactive", + "advert_max_limit", + "advert_min_limit", + "advert_remaining", + "advertiser_ads_paused", + "advertiser_approval", + "advertiser_balance", + "advertiser_block_trade_ineligible", + "advertiser_daily_limit", + "advertiser_temp_ban", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespP2PAdvertListListElemBlockTrade) UnmarshalJSON(b []byte) error { - var v int +func (j *P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemBlockTrade { + for _, expected := range enumValues_P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem, v) } - *j = P2PAdvertListRespP2PAdvertListListElemBlockTrade(v) + *j = P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem(v) return nil } -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserApproval P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_approval" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserBalance P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_balance" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserBlockTradeIneligible P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_block_trade_ineligible" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserDailyLimit P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_daily_limit" -const P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElemAdvertiserTempBan P2PAdvertListRespP2PAdvertListListElemVisibilityStatusElem = "advertiser_temp_ban" - -var enumValues_P2PAdvertListRespP2PAdvertListListElemType = []interface{}{ - "buy", - "sell", -} - // 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 v, ok := raw["account_currency"]; !ok || v == nil { + if _, ok := raw["account_currency"]; raw != nil && !ok { return fmt.Errorf("field account_currency in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["advertiser_details"]; !ok || v == nil { + if _, ok := raw["advertiser_details"]; raw != nil && !ok { return fmt.Errorf("field advertiser_details in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["block_trade"]; !ok || v == nil { + if _, ok := raw["block_trade"]; raw != nil && !ok { return fmt.Errorf("field block_trade in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["counterparty_type"]; !ok || v == nil { + if _, ok := raw["counterparty_type"]; raw != nil && !ok { return fmt.Errorf("field counterparty_type in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["country"]; !ok || v == nil { + if _, ok := raw["country"]; raw != nil && !ok { return fmt.Errorf("field country in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["description"]; !ok || v == nil { + if _, ok := raw["description"]; raw != nil && !ok { return fmt.Errorf("field description in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["effective_rate"]; !ok || v == nil { + if _, ok := raw["effective_rate"]; raw != nil && !ok { return fmt.Errorf("field effective_rate in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["effective_rate_display"]; !ok || v == nil { + if _, ok := raw["effective_rate_display"]; raw != nil && !ok { return fmt.Errorf("field effective_rate_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["is_active"]; !ok || v == nil { + if _, ok := raw["is_active"]; raw != nil && !ok { return fmt.Errorf("field is_active in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["local_currency"]; !ok || v == nil { + if _, ok := raw["local_currency"]; raw != nil && !ok { return fmt.Errorf("field local_currency in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["max_order_amount_limit"]; !ok || v == nil { + if _, ok := raw["max_order_amount_limit"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount_limit in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["max_order_amount_limit_display"]; !ok || v == nil { + if _, ok := raw["max_order_amount_limit_display"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount_limit_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["min_order_amount_limit"]; !ok || v == nil { + if _, ok := raw["min_order_amount_limit"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount_limit in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["min_order_amount_limit_display"]; !ok || v == nil { + if _, ok := raw["min_order_amount_limit_display"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount_limit_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["order_expiry_period"]; !ok || v == nil { + if _, ok := raw["order_expiry_period"]; raw != nil && !ok { return fmt.Errorf("field order_expiry_period in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["payment_method"]; !ok || v == nil { + if _, ok := raw["payment_method"]; raw != nil && !ok { return fmt.Errorf("field payment_method in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["price_display"]; !ok || v == nil { + if _, ok := raw["price_display"]; raw != nil && !ok { return fmt.Errorf("field price_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["rate"]; !ok || v == nil { + if _, ok := raw["rate"]; raw != nil && !ok { return fmt.Errorf("field rate in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["rate_display"]; !ok || v == nil { + if _, ok := raw["rate_display"]; raw != nil && !ok { return fmt.Errorf("field rate_display in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["rate_type"]; !ok || v == nil { + if _, ok := raw["rate_type"]; raw != nil && !ok { return fmt.Errorf("field rate_type in P2PAdvertListRespP2PAdvertListListElem: required") } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in P2PAdvertListRespP2PAdvertListListElem: required") } type Plain P2PAdvertListRespP2PAdvertListListElem @@ -795,33 +824,13 @@ func (j *P2PAdvertListRespP2PAdvertListListElem) UnmarshalJSON(b []byte) error { return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertListRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertListRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertListRespMsgType, v) - } - *j = P2PAdvertListRespMsgType(v) - return nil -} - // 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 v, ok := raw["list"]; !ok || v == nil { + if _, ok := raw["list"]; raw != nil && !ok { return fmt.Errorf("field list in P2PAdvertListRespP2PAdvertList: required") } type Plain P2PAdvertListRespP2PAdvertList @@ -833,20 +842,16 @@ func (j *P2PAdvertListRespP2PAdvertList) UnmarshalJSON(b []byte) error { return nil } -var enumValues_P2PAdvertListRespP2PAdvertListListElemAdvertiserDetailsIsBlocked = []interface{}{ - 0, -} - // 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 4acd50b..4cee11f 100644 --- a/schema/p2p_advert_update.go +++ b/schema/p2p_advert_update.go @@ -6,110 +6,6 @@ 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. @@ -202,40 +98,146 @@ type P2PAdvertUpdate struct { ReqId *int `json:"req_id,omitempty"` } +type P2PAdvertUpdateDelete int + +var enumValues_P2PAdvertUpdateDelete = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertUpdateRateType) UnmarshalJSON(b []byte) error { - var v string +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_P2PAdvertUpdateRateType { + 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_P2PAdvertUpdateRateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateDelete, v) } - *j = P2PAdvertUpdateRateType(v) + *j = P2PAdvertUpdateDelete(v) return nil } -const P2PAdvertUpdateRateTypeFloat P2PAdvertUpdateRateType = "float" +type P2PAdvertUpdateIsActive int -var enumValues_P2PAdvertUpdateDelete = []interface{}{ - 0, - 1, -} var enumValues_P2PAdvertUpdateIsActive = []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 +} + +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 8187088..347f2e2 100644 --- a/schema/p2p_advert_update_resp.go +++ b/schema/p2p_advert_update_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,33 +53,175 @@ func (j *P2PAdvertUpdateRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertUpdateRespMsgTypeP2PAdvertUpdate P2PAdvertUpdateRespMsgType = "p2p_advert_update" +// 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"` -type P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline int + // The number of active orders against this advert. + ActiveOrders *int `json:"active_orders,omitempty"` -var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} + // Details of the advertiser for this advert. + AdvertiserDetails *P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails `json:"advertiser_details,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline, v) - } - *j = P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline(v) - return nil + // 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_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. + // - `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_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. @@ -104,40 +264,67 @@ type P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails struct { TotalCompletionRate *float64 `json:"total_completion_rate"` } +type P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline int + +var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline, v) + } + *j = P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetailsIsOnline(v) + return nil +} + // 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 v, ok := raw["completed_orders_count"]; !ok || v == nil { + if _, ok := raw["completed_orders_count"]; raw != nil && !ok { return fmt.Errorf("field completed_orders_count in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["rating_average"]; !ok || v == nil { + if _, ok := raw["rating_average"]; raw != nil && !ok { return fmt.Errorf("field rating_average in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["rating_count"]; !ok || v == nil { + if _, ok := raw["rating_count"]; raw != nil && !ok { return fmt.Errorf("field rating_count in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["recommended_average"]; !ok || v == nil { + if _, ok := raw["recommended_average"]; raw != nil && !ok { return fmt.Errorf("field recommended_average in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["recommended_count"]; !ok || v == nil { + if _, ok := raw["recommended_count"]; raw != nil && !ok { return fmt.Errorf("field recommended_count in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } - if v, ok := raw["total_completion_rate"]; !ok || v == nil { + if _, ok := raw["total_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field total_completion_rate in P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails: required") } type Plain P2PAdvertUpdateRespP2PAdvertUpdateAdvertiserDetails @@ -178,6 +365,9 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateBlockTrade) UnmarshalJSON(b []byte) e type P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType string +const P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyTypeBuy P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = "buy" +const P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyTypeSell P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = "sell" + var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = []interface{}{ "buy", "sell", @@ -203,9 +393,6 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType) UnmarshalJSON(b []b return nil } -const P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyTypeBuy P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = "buy" -const P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyTypeSell P2PAdvertUpdateRespP2PAdvertUpdateCounterpartyType = "sell" - type P2PAdvertUpdateRespP2PAdvertUpdateDeleted int var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateDeleted = []interface{}{ @@ -291,6 +478,9 @@ type P2PAdvertUpdateRespP2PAdvertUpdatePaymentMethodDetails map[string]interface type P2PAdvertUpdateRespP2PAdvertUpdateRateType string +const P2PAdvertUpdateRespP2PAdvertUpdateRateTypeFixed P2PAdvertUpdateRespP2PAdvertUpdateRateType = "fixed" +const P2PAdvertUpdateRespP2PAdvertUpdateRateTypeFloat P2PAdvertUpdateRespP2PAdvertUpdateRateType = "float" + var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateRateType = []interface{}{ "fixed", "float", @@ -316,11 +506,11 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateRateType) UnmarshalJSON(b []byte) err return nil } -const P2PAdvertUpdateRespP2PAdvertUpdateRateTypeFixed P2PAdvertUpdateRespP2PAdvertUpdateRateType = "fixed" -const P2PAdvertUpdateRespP2PAdvertUpdateRateTypeFloat P2PAdvertUpdateRespP2PAdvertUpdateRateType = "float" - type P2PAdvertUpdateRespP2PAdvertUpdateType string +const P2PAdvertUpdateRespP2PAdvertUpdateTypeBuy P2PAdvertUpdateRespP2PAdvertUpdateType = "buy" +const P2PAdvertUpdateRespP2PAdvertUpdateTypeSell P2PAdvertUpdateRespP2PAdvertUpdateType = "sell" + var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateType = []interface{}{ "buy", "sell", @@ -346,11 +536,19 @@ func (j *P2PAdvertUpdateRespP2PAdvertUpdateType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertUpdateRespP2PAdvertUpdateTypeBuy P2PAdvertUpdateRespP2PAdvertUpdateType = "buy" -const P2PAdvertUpdateRespP2PAdvertUpdateTypeSell P2PAdvertUpdateRespP2PAdvertUpdateType = "sell" - type P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem string +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertInactive P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_inactive" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertMaxLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_max_limit" +const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertMinLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_min_limit" +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 P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertiserTempBan P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advertiser_temp_ban" + var enumValues_P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = []interface{}{ "advert_inactive", "advert_max_limit", @@ -384,195 +582,13 @@ 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_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. - // - `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_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 P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertInactive P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_inactive" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertMaxLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_max_limit" -const P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElemAdvertMinLimit P2PAdvertUpdateRespP2PAdvertUpdateVisibilityStatusElem = "advert_min_limit" -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 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 v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertUpdateRespP2PAdvertUpdate: required") } type Plain P2PAdvertUpdateRespP2PAdvertUpdate @@ -587,32 +603,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertUpdateResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 c1e2730..40c79c5 100644 --- a/schema/p2p_advertiser_adverts.go +++ b/schema/p2p_advertiser_adverts.go @@ -6,32 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -type P2PAdvertiserAdvertsP2PAdvertiserAdverts int - -var enumValues_P2PAdvertiserAdvertsP2PAdvertiserAdverts = []interface{}{ - 1, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserAdvertsP2PAdvertiserAdverts) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertiserAdvertsP2PAdvertiserAdverts { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsP2PAdvertiserAdverts, v) - } - *j = P2PAdvertiserAdvertsP2PAdvertiserAdverts(v) - return nil -} - // Returns all P2P adverts created by the authorized client. Can only be used by a // registered P2P advertiser. type P2PAdvertiserAdverts struct { @@ -58,6 +32,32 @@ type P2PAdvertiserAdverts struct { ReqId *int `json:"req_id,omitempty"` } +type P2PAdvertiserAdvertsP2PAdvertiserAdverts int + +var enumValues_P2PAdvertiserAdvertsP2PAdvertiserAdverts = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertiserAdvertsP2PAdvertiserAdverts) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertiserAdvertsP2PAdvertiserAdverts { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsP2PAdvertiserAdverts, v) + } + *j = P2PAdvertiserAdvertsP2PAdvertiserAdverts(v) + return nil +} + // [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 v, ok := raw["p2p_advertiser_adverts"]; !ok || v == nil { + if _, ok := raw["p2p_advertiser_adverts"]; raw != nil && !ok { 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 7de09fb..cff0219 100644 --- a/schema/p2p_advertiser_adverts_resp.go +++ b/schema/p2p_advertiser_adverts_resp.go @@ -6,11 +6,29 @@ import "encoding/json" import "fmt" import "reflect" +// All adverts belonging to the current advertiser. +type P2PAdvertiserAdvertsResp struct { + // Echo of the request made. + EchoReq P2PAdvertiserAdvertsRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType P2PAdvertiserAdvertsRespMsgType `json:"msg_type"` + + // List of the P2P advertiser adverts. + P2PAdvertiserAdverts *P2PAdvertiserAdvertsRespP2PAdvertiserAdverts `json:"p2p_advertiser_adverts,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 P2PAdvertiserAdvertsRespEchoReq map[string]interface{} type P2PAdvertiserAdvertsRespMsgType string +const P2PAdvertiserAdvertsRespMsgTypeP2PAdvertiserAdverts P2PAdvertiserAdvertsRespMsgType = "p2p_advertiser_adverts" + var enumValues_P2PAdvertiserAdvertsRespMsgType = []interface{}{ "p2p_advertiser_adverts", } @@ -35,33 +53,173 @@ func (j *P2PAdvertiserAdvertsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertiserAdvertsRespMsgTypeP2PAdvertiserAdverts P2PAdvertiserAdvertsRespMsgType = "p2p_advertiser_adverts" +// List of the P2P advertiser adverts. +type P2PAdvertiserAdvertsRespP2PAdvertiserAdverts struct { + // List of advertiser adverts. + List []P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem `json:"list"` +} -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline int +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem struct { + // Currency for this advert. This is the system currency to be transferred between + // advertiser and client. + AccountCurrency string `json:"account_currency"` -var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} + // The number of active orders against this advert. + ActiveOrders int `json:"active_orders"` -// UnmarshalJSON implements json.Unmarshaler. -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_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline, v) - } - *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline(v) - return nil + // Details of the advertiser for this advert. + AdvertiserDetails P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails `json:"advertiser_details"` + + // The total amount specified in advert, in `account_currency`. + Amount float64 `json:"amount"` + + // The total amount specified in advert, in `account_currency`, formatted to + // appropriate decimal places. + AmountDisplay string `json:"amount_display"` + + // Indicates if this is block trade advert or not. + BlockTrade P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade `json:"block_trade"` + + // Advertiser contact information. Only applicable for 'sell adverts'. + ContactInfo string `json:"contact_info"` + + // This is the type of transaction from the counterparty's perspective. + CounterpartyType P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType `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"` + + // 2 letter country codes. Counterparties who do not live in these countries are + // not allowed to place orders. + EligibleCountries []string `json:"eligible_countries,omitempty"` + + // The unique identifier for this advert. + Id string `json:"id"` + + // The activation status of the advert. + IsActive P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive `json:"is_active"` + + // Indicates that this advert will appear on the main advert list. + IsVisible P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible `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, in `account_currency`. + MaxOrderAmount float64 `json:"max_order_amount"` + + // Maximum order amount, in `account_currency`, formatted to appropriate decimal + // places. + MaxOrderAmountDisplay string `json:"max_order_amount_display"` + + // 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. + MinCompletionRate *float64 `json:"min_completion_rate,omitempty"` + + // Counterparties who joined less than this number of days ago are not allowed to + // place orders. + MinJoinDays *int `json:"min_join_days,omitempty"` + + // Minimum order amount, in `account_currency`. + MinOrderAmount float64 `json:"min_order_amount"` + + // Minimum order amount, in `account_currency`, formatted to appropriate decimal + // places. + MinOrderAmountDisplay string `json:"min_order_amount_display"` + + // 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. + 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"` + + // 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 P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType `json:"rate_type"` + + // Amount currently available for orders, in `account_currency`. + RemainingAmount float64 `json:"remaining_amount"` + + // Amount currently available for orders, in `account_currency`, formatted to + // appropriate decimal places. + RemainingAmountDisplay string `json:"remaining_amount_display"` + + // Whether this is a buy or a sell. + Type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType `json:"type"` + + // Reasons why an advert is not visible. Possible values: + // - `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. + // - `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_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 []P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem `json:"visibility_status,omitempty"` } // Details of the advertiser for this advert. @@ -104,40 +262,67 @@ type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails struc TotalCompletionRate *float64 `json:"total_completion_rate"` } +type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline int + +var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +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_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline, v) + } + *j = P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetailsIsOnline(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 v, ok := raw["completed_orders_count"]; !ok || v == nil { + if _, ok := raw["completed_orders_count"]; raw != nil && !ok { return fmt.Errorf("field completed_orders_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["rating_average"]; !ok || v == nil { + if _, ok := raw["rating_average"]; raw != nil && !ok { return fmt.Errorf("field rating_average in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["rating_count"]; !ok || v == nil { + if _, ok := raw["rating_count"]; raw != nil && !ok { return fmt.Errorf("field rating_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["recommended_average"]; !ok || v == nil { + if _, ok := raw["recommended_average"]; raw != nil && !ok { return fmt.Errorf("field recommended_average in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["recommended_count"]; !ok || v == nil { + if _, ok := raw["recommended_count"]; raw != nil && !ok { return fmt.Errorf("field recommended_count in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } - if v, ok := raw["total_completion_rate"]; !ok || v == nil { + if _, ok := raw["total_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field total_completion_rate in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails: required") } type Plain P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails @@ -178,6 +363,9 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade) Unmarsh type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType string +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyTypeBuy P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = "buy" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyTypeSell P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = "sell" + var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = []interface{}{ "buy", "sell", @@ -203,9 +391,6 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType) U return nil } -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyTypeBuy P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = "buy" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyTypeSell P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType = "sell" - type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive int var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive = []interface{}{ @@ -262,6 +447,9 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible) Unmarsha type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType string +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateTypeFixed P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = "fixed" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateTypeFloat P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = "float" + var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = []interface{}{ "fixed", "float", @@ -287,11 +475,11 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType) Unmarshal return nil } -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateTypeFixed P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = "fixed" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateTypeFloat P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType = "float" - type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType string +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemTypeBuy P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = "buy" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemTypeSell P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = "sell" + var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = []interface{}{ "buy", "sell", @@ -317,11 +505,19 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType) UnmarshalJSON return nil } -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemTypeBuy P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = "buy" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemTypeSell P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType = "sell" - type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem string +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertInactive P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_inactive" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertMaxLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_max_limit" +const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertMinLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_min_limit" +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 P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserTempBan P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_temp_ban" + var enumValues_P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = []interface{}{ "advert_inactive", "advert_max_limit", @@ -355,289 +551,115 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusEle return nil } -type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem 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"` - - // Details of the advertiser for this advert. - AdvertiserDetails P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemAdvertiserDetails `json:"advertiser_details"` - - // The total amount specified in advert, in `account_currency`. - Amount float64 `json:"amount"` - - // The total amount specified in advert, in `account_currency`, formatted to - // appropriate decimal places. - AmountDisplay string `json:"amount_display"` - - // Indicates if this is block trade advert or not. - BlockTrade P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemBlockTrade `json:"block_trade"` - - // Advertiser contact information. Only applicable for 'sell adverts'. - ContactInfo string `json:"contact_info"` - - // This is the type of transaction from the counterparty's perspective. - CounterpartyType P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemCounterpartyType `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"` - - // 2 letter country codes. Counterparties who do not live in these countries are - // not allowed to place orders. - EligibleCountries []string `json:"eligible_countries,omitempty"` - - // The unique identifier for this advert. - Id string `json:"id"` - - // The activation status of the advert. - IsActive P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsActive `json:"is_active"` - - // Indicates that this advert will appear on the main advert list. - IsVisible P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemIsVisible `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, in `account_currency`. - MaxOrderAmount float64 `json:"max_order_amount"` - - // Maximum order amount, in `account_currency`, formatted to appropriate decimal - // places. - MaxOrderAmountDisplay string `json:"max_order_amount_display"` - - // 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. - MinCompletionRate *float64 `json:"min_completion_rate,omitempty"` - - // Counterparties who joined less than this number of days ago are not allowed to - // place orders. - MinJoinDays *int `json:"min_join_days,omitempty"` - - // Minimum order amount, in `account_currency`. - MinOrderAmount float64 `json:"min_order_amount"` - - // Minimum order amount, in `account_currency`, formatted to appropriate decimal - // places. - MinOrderAmountDisplay string `json:"min_order_amount_display"` - - // 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. - 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"` - - // 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 P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemRateType `json:"rate_type"` - - // Amount currently available for orders, in `account_currency`. - RemainingAmount float64 `json:"remaining_amount"` - - // Amount currently available for orders, in `account_currency`, formatted to - // appropriate decimal places. - RemainingAmountDisplay string `json:"remaining_amount_display"` - - // Whether this is a buy or a sell. - Type P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemType `json:"type"` - - // Reasons why an advert is not visible. Possible values: - // - `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. - // - `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_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 []P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem `json:"visibility_status,omitempty"` -} - -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertInactive P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_inactive" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertMaxLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_max_limit" -const P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertMinLimit P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advert_min_limit" -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 P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElemAdvertiserTempBan P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElemVisibilityStatusElem = "advertiser_temp_ban" - // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem) 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 { + if _, ok := raw["account_currency"]; raw != nil && !ok { return fmt.Errorf("field account_currency in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["active_orders"]; !ok || v == nil { + if _, ok := raw["active_orders"]; raw != nil && !ok { return fmt.Errorf("field active_orders in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["advertiser_details"]; !ok || v == nil { + if _, ok := raw["advertiser_details"]; raw != nil && !ok { return fmt.Errorf("field advertiser_details in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["amount_display"]; !ok || v == nil { + if _, ok := raw["amount_display"]; raw != nil && !ok { return fmt.Errorf("field amount_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["block_trade"]; !ok || v == nil { + if _, ok := raw["block_trade"]; raw != nil && !ok { return fmt.Errorf("field block_trade in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["contact_info"]; !ok || v == nil { + if _, ok := raw["contact_info"]; raw != nil && !ok { return fmt.Errorf("field contact_info in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["counterparty_type"]; !ok || v == nil { + if _, ok := raw["counterparty_type"]; raw != nil && !ok { return fmt.Errorf("field counterparty_type in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["country"]; !ok || v == nil { + if _, ok := raw["country"]; raw != nil && !ok { return fmt.Errorf("field country in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["description"]; !ok || v == nil { + if _, ok := raw["description"]; raw != nil && !ok { return fmt.Errorf("field description in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["effective_rate"]; !ok || v == nil { + if _, ok := raw["effective_rate"]; raw != nil && !ok { return fmt.Errorf("field effective_rate in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["effective_rate_display"]; !ok || v == nil { + if _, ok := raw["effective_rate_display"]; raw != nil && !ok { return fmt.Errorf("field effective_rate_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["is_active"]; !ok || v == nil { + if _, ok := raw["is_active"]; raw != nil && !ok { return fmt.Errorf("field is_active in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["local_currency"]; !ok || v == nil { + if _, ok := raw["local_currency"]; raw != nil && !ok { return fmt.Errorf("field local_currency in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["max_order_amount"]; !ok || v == nil { + if _, ok := raw["max_order_amount"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["max_order_amount_display"]; !ok || v == nil { + if _, ok := raw["max_order_amount_display"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["max_order_amount_limit"]; !ok || v == nil { + if _, ok := raw["max_order_amount_limit"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount_limit in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["max_order_amount_limit_display"]; !ok || v == nil { + if _, ok := raw["max_order_amount_limit_display"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount_limit_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["min_order_amount"]; !ok || v == nil { + if _, ok := raw["min_order_amount"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["min_order_amount_display"]; !ok || v == nil { + if _, ok := raw["min_order_amount_display"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["min_order_amount_limit"]; !ok || v == nil { + if _, ok := raw["min_order_amount_limit"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount_limit in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["min_order_amount_limit_display"]; !ok || v == nil { + if _, ok := raw["min_order_amount_limit_display"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount_limit_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["order_expiry_period"]; !ok || v == nil { + if _, ok := raw["order_expiry_period"]; raw != nil && !ok { return fmt.Errorf("field order_expiry_period in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["payment_info"]; !ok || v == nil { + if _, ok := raw["payment_info"]; raw != nil && !ok { return fmt.Errorf("field payment_info in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["payment_method"]; !ok || v == nil { + if _, ok := raw["payment_method"]; raw != nil && !ok { return fmt.Errorf("field payment_method in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["price_display"]; !ok || v == nil { + if _, ok := raw["price_display"]; raw != nil && !ok { return fmt.Errorf("field price_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["rate"]; !ok || v == nil { + if _, ok := raw["rate"]; raw != nil && !ok { return fmt.Errorf("field rate in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["rate_display"]; !ok || v == nil { + if _, ok := raw["rate_display"]; raw != nil && !ok { return fmt.Errorf("field rate_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["rate_type"]; !ok || v == nil { + if _, ok := raw["rate_type"]; raw != nil && !ok { return fmt.Errorf("field rate_type in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["remaining_amount"]; !ok || v == nil { + if _, ok := raw["remaining_amount"]; raw != nil && !ok { return fmt.Errorf("field remaining_amount in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["remaining_amount_display"]; !ok || v == nil { + if _, ok := raw["remaining_amount_display"]; raw != nil && !ok { return fmt.Errorf("field remaining_amount_display in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem: required") } type Plain P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem @@ -652,19 +674,13 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem) UnmarshalJSON(b [ return nil } -// List of the P2P advertiser adverts. -type P2PAdvertiserAdvertsRespP2PAdvertiserAdverts struct { - // List of advertiser adverts. - List []P2PAdvertiserAdvertsRespP2PAdvertiserAdvertsListElem `json:"list"` -} - // 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 v, ok := raw["list"]; !ok || v == nil { + if _, ok := raw["list"]; raw != nil && !ok { return fmt.Errorf("field list in P2PAdvertiserAdvertsRespP2PAdvertiserAdverts: required") } type Plain P2PAdvertiserAdvertsRespP2PAdvertiserAdverts @@ -676,32 +692,16 @@ func (j *P2PAdvertiserAdvertsRespP2PAdvertiserAdverts) UnmarshalJSON(b []byte) e return nil } -// All adverts belonging to the current advertiser. -type P2PAdvertiserAdvertsResp struct { - // Echo of the request made. - EchoReq P2PAdvertiserAdvertsRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType P2PAdvertiserAdvertsRespMsgType `json:"msg_type"` - - // List of the P2P advertiser adverts. - P2PAdvertiserAdverts *P2PAdvertiserAdvertsRespP2PAdvertiserAdverts `json:"p2p_advertiser_adverts,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 *P2PAdvertiserAdvertsResp) 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 { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertiserAdvertsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 db28947..c3fa6a4 100644 --- a/schema/p2p_advertiser_create.go +++ b/schema/p2p_advertiser_create.go @@ -6,6 +6,42 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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] 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{}{ @@ -62,52 +98,16 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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] 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 v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertiserCreate: required") } - if v, ok := raw["p2p_advertiser_create"]; !ok || v == nil { + if _, ok := raw["p2p_advertiser_create"]; raw != nil && !ok { 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 e321116..8392f17 100644 --- a/schema/p2p_advertiser_create_resp.go +++ b/schema/p2p_advertiser_create_resp.go @@ -6,11 +6,32 @@ 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", } @@ -35,7 +56,153 @@ func (j *P2PAdvertiserCreateRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertiserCreateRespMsgTypeP2PAdvertiserCreate P2PAdvertiserCreateRespMsgType = "p2p_advertiser_create" +// 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"` + + // 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"` + + // 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"` +} type P2PAdvertiserCreateRespP2PAdvertiserCreateBasicVerification int @@ -199,266 +366,118 @@ 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"` - - // 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"` - - // 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 v, ok := raw["advert_rates"]; !ok || v == nil { + if _, ok := raw["advert_rates"]; raw != nil && !ok { return fmt.Errorf("field advert_rates in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["balance_available"]; !ok || v == nil { + if _, ok := raw["balance_available"]; raw != nil && !ok { return fmt.Errorf("field balance_available in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["basic_verification"]; !ok || v == nil { + if _, ok := raw["basic_verification"]; raw != nil && !ok { return fmt.Errorf("field basic_verification in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["blocked_by_count"]; !ok || v == nil { + if _, ok := raw["blocked_by_count"]; raw != nil && !ok { return fmt.Errorf("field blocked_by_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["buy_completion_rate"]; !ok || v == nil { + if _, ok := raw["buy_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field buy_completion_rate in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["buy_orders_amount"]; !ok || v == nil { + if _, ok := raw["buy_orders_amount"]; raw != nil && !ok { return fmt.Errorf("field buy_orders_amount in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["buy_orders_count"]; !ok || v == nil { + if _, ok := raw["buy_orders_count"]; raw != nil && !ok { return fmt.Errorf("field buy_orders_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["buy_time_avg"]; !ok || v == nil { + if _, ok := raw["buy_time_avg"]; raw != nil && !ok { return fmt.Errorf("field buy_time_avg in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["cancel_time_avg"]; !ok || v == nil { + if _, ok := raw["cancel_time_avg"]; raw != nil && !ok { return fmt.Errorf("field cancel_time_avg in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["cancels_remaining"]; !ok || v == nil { + if _, ok := raw["cancels_remaining"]; raw != nil && !ok { return fmt.Errorf("field cancels_remaining in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["chat_token"]; !ok || v == nil { + if _, ok := raw["chat_token"]; raw != nil && !ok { return fmt.Errorf("field chat_token in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["chat_user_id"]; !ok || v == nil { + if _, ok := raw["chat_user_id"]; raw != nil && !ok { return fmt.Errorf("field chat_user_id in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["contact_info"]; !ok || v == nil { + if _, ok := raw["contact_info"]; raw != nil && !ok { return fmt.Errorf("field contact_info in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["default_advert_description"]; !ok || v == nil { + if _, ok := raw["default_advert_description"]; raw != nil && !ok { return fmt.Errorf("field default_advert_description in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["full_verification"]; !ok || v == nil { + if _, ok := raw["full_verification"]; raw != nil && !ok { return fmt.Errorf("field full_verification in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["is_approved"]; !ok || v == nil { + if _, ok := raw["is_approved"]; raw != nil && !ok { return fmt.Errorf("field is_approved in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["is_listed"]; !ok || v == nil { + if _, ok := raw["is_listed"]; raw != nil && !ok { return fmt.Errorf("field is_listed in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["partner_count"]; !ok || v == nil { + if _, ok := raw["partner_count"]; raw != nil && !ok { return fmt.Errorf("field partner_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["payment_info"]; !ok || v == nil { + if _, ok := raw["payment_info"]; raw != nil && !ok { return fmt.Errorf("field payment_info in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["rating_average"]; !ok || v == nil { + if _, ok := raw["rating_average"]; raw != nil && !ok { return fmt.Errorf("field rating_average in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["rating_count"]; !ok || v == nil { + if _, ok := raw["rating_count"]; raw != nil && !ok { return fmt.Errorf("field rating_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["recommended_average"]; !ok || v == nil { + if _, ok := raw["recommended_average"]; raw != nil && !ok { return fmt.Errorf("field recommended_average in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["recommended_count"]; !ok || v == nil { + if _, ok := raw["recommended_count"]; raw != nil && !ok { return fmt.Errorf("field recommended_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["release_time_avg"]; !ok || v == nil { + if _, ok := raw["release_time_avg"]; raw != nil && !ok { return fmt.Errorf("field release_time_avg in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["sell_completion_rate"]; !ok || v == nil { + if _, ok := raw["sell_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field sell_completion_rate in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["sell_orders_amount"]; !ok || v == nil { + if _, ok := raw["sell_orders_amount"]; raw != nil && !ok { return fmt.Errorf("field sell_orders_amount in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["sell_orders_count"]; !ok || v == nil { + if _, ok := raw["sell_orders_count"]; raw != nil && !ok { return fmt.Errorf("field sell_orders_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["show_name"]; !ok || v == nil { + if _, ok := raw["show_name"]; raw != nil && !ok { return fmt.Errorf("field show_name in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["total_completion_rate"]; !ok || v == nil { + if _, ok := raw["total_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field total_completion_rate in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["total_orders_count"]; !ok || v == nil { + if _, ok := raw["total_orders_count"]; raw != nil && !ok { return fmt.Errorf("field total_orders_count in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } - if v, ok := raw["total_turnover"]; !ok || v == nil { + if _, ok := raw["total_turnover"]; raw != nil && !ok { return fmt.Errorf("field total_turnover in P2PAdvertiserCreateRespP2PAdvertiserCreate: required") } type Plain P2PAdvertiserCreateRespP2PAdvertiserCreate @@ -483,7 +502,7 @@ func (j *P2PAdvertiserCreateRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertiserCreateRespSubscription: required") } type Plain P2PAdvertiserCreateRespSubscription @@ -495,35 +514,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertiserCreateResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 0ad1bfc..f679d31 100644 --- a/schema/p2p_advertiser_info.go +++ b/schema/p2p_advertiser_info.go @@ -6,6 +6,31 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -62,38 +87,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_advertiser_info"]; !ok || v == nil { + if _, ok := raw["p2p_advertiser_info"]; raw != nil && !ok { 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 d96d7c3..50c2430 100644 --- a/schema/p2p_advertiser_info_resp.go +++ b/schema/p2p_advertiser_info_resp.go @@ -32,6 +32,30 @@ type P2PAdvertiserInfoRespMsgType string const P2PAdvertiserInfoRespMsgTypeP2PAdvertiserInfo P2PAdvertiserInfoRespMsgType = "p2p_advertiser_info" +var enumValues_P2PAdvertiserInfoRespMsgType = []interface{}{ + "p2p_advertiser_info", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertiserInfoRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_P2PAdvertiserInfoRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespMsgType, v) + } + *j = P2PAdvertiserInfoRespMsgType(v) + return nil +} + // P2P advertiser information. type P2PAdvertiserInfoRespP2PAdvertiserInfo struct { // Number of active fixed rate adverts belonging to the advertiser. @@ -213,124 +237,68 @@ type P2PAdvertiserInfoRespP2PAdvertiserInfo struct { type P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification int -// Block trading limits, if block trading is allowed. -type P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade struct { - // Maximum order amount for block trade adverts. - MaxOrderAmount string `json:"max_order_amount"` - - // Minimum order amount for block trade adverts. - MinOrderAmount string `json:"min_order_amount"` -} - -type P2PAdvertiserInfoRespP2PAdvertiserInfoFullVerification int - -type P2PAdvertiserInfoRespP2PAdvertiserInfoIsApproved int - -type P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked int - -type P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite int - -type P2PAdvertiserInfoRespP2PAdvertiserInfoIsListed int - -type P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline int - -type P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended struct { - Value interface{} -} - -type P2PAdvertiserInfoRespP2PAdvertiserInfoShowName int - -// 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 - -// For subscription requests only. -type P2PAdvertiserInfoRespSubscription struct { - // A per-connection unique identifier. Can be passed to the `forget` API call to - // unsubscribe. - Id string `json:"id"` -} - -var enumValues_P2PAdvertiserInfoRespMsgType = []interface{}{ - "p2p_advertiser_info", -} var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification = []interface{}{ 1, 0, } -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoFullVerification = []interface{}{ - 1, - 0, -} -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsApproved = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsListed = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, -} -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoShowName = []interface{}{ - 0, - 1, -} -var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade = []interface{}{ - 0, - 1, -} - -// MarshalJSON implements json.Marshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade { + for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification, v) } - *j = P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade(v) + *j = P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification(v) + return nil +} + +// Block trading limits, if block trading is allowed. +type P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade struct { + // Maximum order amount for block trade adverts. + MaxOrderAmount string `json:"max_order_amount"` + + // Minimum order amount for block trade adverts. + MinOrderAmount string `json:"min_order_amount"` +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if _, ok := raw["max_order_amount"]; raw != nil && !ok { + return fmt.Errorf("field max_order_amount in P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade: required") + } + if _, ok := raw["min_order_amount"]; raw != nil && !ok { + return fmt.Errorf("field min_order_amount in P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade: required") + } + type Plain P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade(plain) return nil } +type P2PAdvertiserInfoRespP2PAdvertiserInfoFullVerification int + +var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoFullVerification = []interface{}{ + 1, + 0, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoFullVerification) UnmarshalJSON(b []byte) error { var v int @@ -351,6 +319,13 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoFullVerification) UnmarshalJSON(b return nil } +type P2PAdvertiserInfoRespP2PAdvertiserInfoIsApproved int + +var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsApproved = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsApproved) UnmarshalJSON(b []byte) error { var v int @@ -371,46 +346,67 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsApproved) UnmarshalJSON(b []byt return nil } +type P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked int + +var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite { + for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked, v) } - *j = P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite(v) + *j = P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked(v) return nil } +type P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite int + +var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoShowName) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoShowName { + for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoShowName, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite, v) } - *j = P2PAdvertiserInfoRespP2PAdvertiserInfoShowName(v) + *j = P2PAdvertiserInfoRespP2PAdvertiserInfoIsFavourite(v) return nil } +type P2PAdvertiserInfoRespP2PAdvertiserInfoIsListed int + +var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsListed = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsListed) UnmarshalJSON(b []byte) error { var v int @@ -431,47 +427,48 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsListed) UnmarshalJSON(b []byte) return nil } -// 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 v, ok := raw["echo_req"]; !ok || v == nil { - return fmt.Errorf("field echo_req in P2PAdvertiserInfoResp: required") - } - if v, ok := raw["msg_type"]; !ok || v == nil { - return fmt.Errorf("field msg_type in P2PAdvertiserInfoResp: required") - } - type Plain P2PAdvertiserInfoResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = P2PAdvertiserInfoResp(plain) - return nil +type P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline int + +var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline) UnmarshalJSON(b []byte) error { var v int if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked { + for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline, v) } - *j = P2PAdvertiserInfoRespP2PAdvertiserInfoIsBlocked(v) + *j = P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline(v) return nil } +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, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -494,45 +491,90 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsRecommended) UnmarshalJSON(b [] return nil } +type P2PAdvertiserInfoRespP2PAdvertiserInfoShowName int + +var enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoShowName = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoShowName) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - if v, ok := raw["max_daily_buy"]; !ok || v == nil { - return fmt.Errorf("field max_daily_buy in P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits: required") + var ok bool + for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoShowName { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - if v, ok := raw["max_daily_sell"]; !ok || v == nil { - return fmt.Errorf("field max_daily_sell in P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits: required") + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoShowName, v) } - type Plain P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { + *j = P2PAdvertiserInfoRespP2PAdvertiserInfoShowName(v) + 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{}{ + 0, + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { return err } - *j = P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits(plain) + var ok bool + for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade, v) + } + *j = P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimitsBlockTrade(v) return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade) UnmarshalJSON(b []byte) error { +func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["max_order_amount"]; !ok || v == nil { - return fmt.Errorf("field max_order_amount in P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade: required") + if _, ok := raw["max_daily_buy"]; raw != nil && !ok { + return fmt.Errorf("field max_daily_buy in P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits: required") } - if v, ok := raw["min_order_amount"]; !ok || v == nil { - return fmt.Errorf("field min_order_amount in P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade: required") + if _, ok := raw["max_daily_sell"]; raw != nil && !ok { + return fmt.Errorf("field max_daily_sell in P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits: required") } - type Plain P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade + type Plain P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = P2PAdvertiserInfoRespP2PAdvertiserInfoBlockTrade(plain) + *j = P2PAdvertiserInfoRespP2PAdvertiserInfoUpgradableDailyLimits(plain) return nil } @@ -542,88 +584,88 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfo) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["advert_rates"]; !ok || v == nil { + if _, ok := raw["advert_rates"]; raw != nil && !ok { return fmt.Errorf("field advert_rates in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["basic_verification"]; !ok || v == nil { + if _, ok := raw["basic_verification"]; raw != nil && !ok { return fmt.Errorf("field basic_verification in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["buy_completion_rate"]; !ok || v == nil { + if _, ok := raw["buy_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field buy_completion_rate in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["buy_orders_amount"]; !ok || v == nil { + if _, ok := raw["buy_orders_amount"]; raw != nil && !ok { return fmt.Errorf("field buy_orders_amount in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["buy_orders_count"]; !ok || v == nil { + if _, ok := raw["buy_orders_count"]; raw != nil && !ok { return fmt.Errorf("field buy_orders_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["buy_time_avg"]; !ok || v == nil { + if _, ok := raw["buy_time_avg"]; raw != nil && !ok { return fmt.Errorf("field buy_time_avg in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["cancel_time_avg"]; !ok || v == nil { + if _, ok := raw["cancel_time_avg"]; raw != nil && !ok { return fmt.Errorf("field cancel_time_avg in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["default_advert_description"]; !ok || v == nil { + if _, ok := raw["default_advert_description"]; raw != nil && !ok { return fmt.Errorf("field default_advert_description in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["full_verification"]; !ok || v == nil { + if _, ok := raw["full_verification"]; raw != nil && !ok { return fmt.Errorf("field full_verification in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["is_approved"]; !ok || v == nil { + if _, ok := raw["is_approved"]; raw != nil && !ok { return fmt.Errorf("field is_approved in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["is_listed"]; !ok || v == nil { + if _, ok := raw["is_listed"]; raw != nil && !ok { return fmt.Errorf("field is_listed in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["partner_count"]; !ok || v == nil { + if _, ok := raw["partner_count"]; raw != nil && !ok { return fmt.Errorf("field partner_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["rating_average"]; !ok || v == nil { + if _, ok := raw["rating_average"]; raw != nil && !ok { return fmt.Errorf("field rating_average in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["rating_count"]; !ok || v == nil { + if _, ok := raw["rating_count"]; raw != nil && !ok { return fmt.Errorf("field rating_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["recommended_average"]; !ok || v == nil { + if _, ok := raw["recommended_average"]; raw != nil && !ok { return fmt.Errorf("field recommended_average in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["recommended_count"]; !ok || v == nil { + if _, ok := raw["recommended_count"]; raw != nil && !ok { return fmt.Errorf("field recommended_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["release_time_avg"]; !ok || v == nil { + if _, ok := raw["release_time_avg"]; raw != nil && !ok { return fmt.Errorf("field release_time_avg in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["sell_completion_rate"]; !ok || v == nil { + if _, ok := raw["sell_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field sell_completion_rate in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["sell_orders_amount"]; !ok || v == nil { + if _, ok := raw["sell_orders_amount"]; raw != nil && !ok { return fmt.Errorf("field sell_orders_amount in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["sell_orders_count"]; !ok || v == nil { + if _, ok := raw["sell_orders_count"]; raw != nil && !ok { return fmt.Errorf("field sell_orders_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["total_completion_rate"]; !ok || v == nil { + if _, ok := raw["total_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field total_completion_rate in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["total_orders_count"]; !ok || v == nil { + if _, ok := raw["total_orders_count"]; raw != nil && !ok { return fmt.Errorf("field total_orders_count in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } - if v, ok := raw["total_turnover"]; !ok || v == nil { + if _, ok := raw["total_turnover"]; raw != nil && !ok { return fmt.Errorf("field total_turnover in P2PAdvertiserInfoRespP2PAdvertiserInfo: required") } type Plain P2PAdvertiserInfoRespP2PAdvertiserInfo @@ -635,24 +677,11 @@ func (j *P2PAdvertiserInfoRespP2PAdvertiserInfo) UnmarshalJSON(b []byte) error { return nil } -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification, v) - } - *j = P2PAdvertiserInfoRespP2PAdvertiserInfoBasicVerification(v) - return nil +// For subscription requests only. +type P2PAdvertiserInfoRespSubscription struct { + // A per-connection unique identifier. Can be passed to the `forget` API call to + // unsubscribe. + Id string `json:"id"` } // UnmarshalJSON implements json.Unmarshaler. @@ -661,7 +690,7 @@ func (j *P2PAdvertiserInfoRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertiserInfoRespSubscription: required") } type Plain P2PAdvertiserInfoRespSubscription @@ -674,41 +703,22 @@ func (j *P2PAdvertiserInfoRespSubscription) UnmarshalJSON(b []byte) error { } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { +func (j *P2PAdvertiserInfoResp) 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_P2PAdvertiserInfoRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if _, ok := raw["echo_req"]; raw != nil && !ok { + return fmt.Errorf("field echo_req in P2PAdvertiserInfoResp: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespMsgType, v) + if _, ok := raw["msg_type"]; raw != nil && !ok { + return fmt.Errorf("field msg_type in P2PAdvertiserInfoResp: required") } - *j = P2PAdvertiserInfoRespMsgType(v) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { + type Plain P2PAdvertiserInfoResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { return err } - var ok bool - for _, expected := range enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline, v) - } - *j = P2PAdvertiserInfoRespP2PAdvertiserInfoIsOnline(v) + *j = P2PAdvertiserInfoResp(plain) return nil } diff --git a/schema/p2p_advertiser_list.go b/schema/p2p_advertiser_list.go index 38426f7..23aaad4 100644 --- a/schema/p2p_advertiser_list.go +++ b/schema/p2p_advertiser_list.go @@ -43,52 +43,35 @@ 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 *P2PAdvertiserListSortBy) UnmarshalJSON(b []byte) error { - var v string +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_P2PAdvertiserListSortBy { + 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_P2PAdvertiserListSortBy, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListIsBlocked, v) } - *j = P2PAdvertiserListSortBy(v) + *j = P2PAdvertiserListIsBlocked(v) return nil } -var enumValues_P2PAdvertiserListSortBy = []interface{}{ - "name", - "created_time", - "last_interaction_time", +type P2PAdvertiserListP2PAdvertiserList int + +var enumValues_P2PAdvertiserListP2PAdvertiserList = []interface{}{ + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -111,48 +94,66 @@ func (j *P2PAdvertiserListP2PAdvertiserList) UnmarshalJSON(b []byte) error { return nil } -var enumValues_P2PAdvertiserListTradePartners = []interface{}{ - 0, - 1, +// [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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserListTradePartners) 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_P2PAdvertiserListTradePartners { + 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_P2PAdvertiserListTradePartners, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListSortBy, v) } - *j = P2PAdvertiserListTradePartners(v) + *j = P2PAdvertiserListSortBy(v) return nil } +type P2PAdvertiserListTradePartners int + +var enumValues_P2PAdvertiserListTradePartners = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2PAdvertiserListIsBlocked) UnmarshalJSON(b []byte) error { +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_P2PAdvertiserListIsBlocked { + 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_P2PAdvertiserListIsBlocked, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2PAdvertiserListTradePartners, v) } - *j = P2PAdvertiserListIsBlocked(v) + *j = P2PAdvertiserListTradePartners(v) return nil } @@ -162,7 +163,7 @@ func (j *P2PAdvertiserList) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["p2p_advertiser_list"]; !ok || v == nil { + if _, ok := raw["p2p_advertiser_list"]; raw != nil && !ok { 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 7eaacab..a341426 100644 --- a/schema/p2p_advertiser_list_resp.go +++ b/schema/p2p_advertiser_list_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,7 +53,121 @@ func (j *P2PAdvertiserListRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertiserListRespMsgTypeP2PAdvertiserList P2PAdvertiserListRespMsgType = "p2p_advertiser_list" +// 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"` + + // 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"` + + // 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"` +} type P2PAdvertiserListRespP2PAdvertiserListListElemBasicVerification int @@ -253,207 +385,97 @@ func (j *P2PAdvertiserListRespP2PAdvertiserListListElemIsRecommended) UnmarshalJ 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"` - - // 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"` - - // 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 v, ok := raw["advert_rates"]; !ok || v == nil { + if _, ok := raw["advert_rates"]; raw != nil && !ok { return fmt.Errorf("field advert_rates in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["basic_verification"]; !ok || v == nil { + if _, ok := raw["basic_verification"]; raw != nil && !ok { return fmt.Errorf("field basic_verification in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["buy_completion_rate"]; !ok || v == nil { + if _, ok := raw["buy_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field buy_completion_rate in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["buy_orders_amount"]; !ok || v == nil { + if _, ok := raw["buy_orders_amount"]; raw != nil && !ok { return fmt.Errorf("field buy_orders_amount in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["buy_orders_count"]; !ok || v == nil { + if _, ok := raw["buy_orders_count"]; raw != nil && !ok { return fmt.Errorf("field buy_orders_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["buy_time_avg"]; !ok || v == nil { + if _, ok := raw["buy_time_avg"]; raw != nil && !ok { return fmt.Errorf("field buy_time_avg in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["cancel_time_avg"]; !ok || v == nil { + if _, ok := raw["cancel_time_avg"]; raw != nil && !ok { return fmt.Errorf("field cancel_time_avg in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["default_advert_description"]; !ok || v == nil { + if _, ok := raw["default_advert_description"]; raw != nil && !ok { return fmt.Errorf("field default_advert_description in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["full_verification"]; !ok || v == nil { + if _, ok := raw["full_verification"]; raw != nil && !ok { return fmt.Errorf("field full_verification in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["is_approved"]; !ok || v == nil { + if _, ok := raw["is_approved"]; raw != nil && !ok { return fmt.Errorf("field is_approved in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["is_blocked"]; !ok || v == nil { + if _, ok := raw["is_blocked"]; raw != nil && !ok { return fmt.Errorf("field is_blocked in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["is_listed"]; !ok || v == nil { + if _, ok := raw["is_listed"]; raw != nil && !ok { return fmt.Errorf("field is_listed in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["partner_count"]; !ok || v == nil { + if _, ok := raw["partner_count"]; raw != nil && !ok { return fmt.Errorf("field partner_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["rating_average"]; !ok || v == nil { + if _, ok := raw["rating_average"]; raw != nil && !ok { return fmt.Errorf("field rating_average in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["rating_count"]; !ok || v == nil { + if _, ok := raw["rating_count"]; raw != nil && !ok { return fmt.Errorf("field rating_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["recommended_average"]; !ok || v == nil { + if _, ok := raw["recommended_average"]; raw != nil && !ok { return fmt.Errorf("field recommended_average in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["recommended_count"]; !ok || v == nil { + if _, ok := raw["recommended_count"]; raw != nil && !ok { return fmt.Errorf("field recommended_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["release_time_avg"]; !ok || v == nil { + if _, ok := raw["release_time_avg"]; raw != nil && !ok { return fmt.Errorf("field release_time_avg in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["sell_completion_rate"]; !ok || v == nil { + if _, ok := raw["sell_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field sell_completion_rate in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["sell_orders_amount"]; !ok || v == nil { + if _, ok := raw["sell_orders_amount"]; raw != nil && !ok { return fmt.Errorf("field sell_orders_amount in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["sell_orders_count"]; !ok || v == nil { + if _, ok := raw["sell_orders_count"]; raw != nil && !ok { return fmt.Errorf("field sell_orders_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["total_completion_rate"]; !ok || v == nil { + if _, ok := raw["total_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field total_completion_rate in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["total_orders_count"]; !ok || v == nil { + if _, ok := raw["total_orders_count"]; raw != nil && !ok { return fmt.Errorf("field total_orders_count in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } - if v, ok := raw["total_turnover"]; !ok || v == nil { + if _, ok := raw["total_turnover"]; raw != nil && !ok { return fmt.Errorf("field total_turnover in P2PAdvertiserListRespP2PAdvertiserListListElem: required") } type Plain P2PAdvertiserListRespP2PAdvertiserListListElem @@ -465,19 +487,13 @@ 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 v, ok := raw["list"]; !ok || v == nil { + if _, ok := raw["list"]; raw != nil && !ok { return fmt.Errorf("field list in P2PAdvertiserListRespP2PAdvertiserList: required") } type Plain P2PAdvertiserListRespP2PAdvertiserList @@ -489,32 +505,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertiserListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 3094619..ae70296 100644 --- a/schema/p2p_advertiser_payment_methods.go +++ b/schema/p2p_advertiser_payment_methods.go @@ -6,6 +6,32 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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"` @@ -17,7 +43,7 @@ func (j *P2PAdvertiserPaymentMethodsCreateElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["method"]; !ok || v == nil { + if _, ok := raw["method"]; raw != nil && !ok { return fmt.Errorf("field method in P2PAdvertiserPaymentMethodsCreateElem: required") } type Plain P2PAdvertiserPaymentMethodsCreateElem @@ -55,32 +81,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_advertiser_payment_methods"]; !ok || v == nil { + if _, ok := raw["p2p_advertiser_payment_methods"]; raw != nil && !ok { 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 c044d16..f12539f 100644 --- a/schema/p2p_advertiser_payment_methods_resp.go +++ b/schema/p2p_advertiser_payment_methods_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertiserPaymentMethodsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 2efa4f4..6c808ee 100644 --- a/schema/p2p_advertiser_relations.go +++ b/schema/p2p_advertiser_relations.go @@ -6,32 +6,6 @@ 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. @@ -61,6 +35,32 @@ 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 v, ok := raw["p2p_advertiser_relations"]; !ok || v == nil { + if _, ok := raw["p2p_advertiser_relations"]; raw != nil && !ok { 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 958c663..ebf3ecb 100644 --- a/schema/p2p_advertiser_relations_resp.go +++ b/schema/p2p_advertiser_relations_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ 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. @@ -76,10 +92,10 @@ func (j *P2PAdvertiserRelationsRespP2PAdvertiserRelations) UnmarshalJSON(b []byt if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["blocked_advertisers"]; !ok || v == nil { + if _, ok := raw["blocked_advertisers"]; raw != nil && !ok { return fmt.Errorf("field blocked_advertisers in P2PAdvertiserRelationsRespP2PAdvertiserRelations: required") } - if v, ok := raw["favourite_advertisers"]; !ok || v == nil { + if _, ok := raw["favourite_advertisers"]; raw != nil && !ok { return fmt.Errorf("field favourite_advertisers in P2PAdvertiserRelationsRespP2PAdvertiserRelations: required") } type Plain P2PAdvertiserRelationsRespP2PAdvertiserRelations @@ -91,32 +107,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertiserRelationsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 e02a99f..53eb29b 100644 --- a/schema/p2p_advertiser_update.go +++ b/schema/p2p_advertiser_update.go @@ -6,6 +6,48 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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] 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{}{ @@ -116,55 +158,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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] 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 v, ok := raw["p2p_advertiser_update"]; !ok || v == nil { + if _, ok := raw["p2p_advertiser_update"]; raw != nil && !ok { 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 106d010..eac11f2 100644 --- a/schema/p2p_advertiser_update_resp.go +++ b/schema/p2p_advertiser_update_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,7 +53,174 @@ func (j *P2PAdvertiserUpdateRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const P2PAdvertiserUpdateRespMsgTypeP2PAdvertiserUpdate P2PAdvertiserUpdateRespMsgType = "p2p_advertiser_update" +// 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"` + + // 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"` + + // 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"` +} type P2PAdvertiserUpdateRespP2PAdvertiserUpdateBasicVerification int @@ -79,10 +264,10 @@ func (j *P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade) UnmarshalJSON(b [ if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["max_order_amount"]; !ok || v == nil { + if _, ok := raw["max_order_amount"]; raw != nil && !ok { return fmt.Errorf("field max_order_amount in P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade: required") } - if v, ok := raw["min_order_amount"]; !ok || v == nil { + if _, ok := raw["min_order_amount"]; raw != nil && !ok { return fmt.Errorf("field min_order_amount in P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade: required") } type Plain P2PAdvertiserUpdateRespP2PAdvertiserUpdateBlockTrade @@ -229,6 +414,18 @@ 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{}{ @@ -256,28 +453,16 @@ 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 v, ok := raw["max_daily_buy"]; !ok || v == nil { + if _, ok := raw["max_daily_buy"]; raw != nil && !ok { return fmt.Errorf("field max_daily_buy in P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits: required") } - if v, ok := raw["max_daily_sell"]; !ok || v == nil { + if _, ok := raw["max_daily_sell"]; raw != nil && !ok { return fmt.Errorf("field max_daily_sell in P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits: required") } type Plain P2PAdvertiserUpdateRespP2PAdvertiserUpdateUpgradableDailyLimits @@ -289,287 +474,118 @@ 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"` - - // 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"` - - // 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 v, ok := raw["advert_rates"]; !ok || v == nil { + if _, ok := raw["advert_rates"]; raw != nil && !ok { return fmt.Errorf("field advert_rates in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["balance_available"]; !ok || v == nil { + if _, ok := raw["balance_available"]; raw != nil && !ok { return fmt.Errorf("field balance_available in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["basic_verification"]; !ok || v == nil { + if _, ok := raw["basic_verification"]; raw != nil && !ok { return fmt.Errorf("field basic_verification in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["blocked_by_count"]; !ok || v == nil { + if _, ok := raw["blocked_by_count"]; raw != nil && !ok { return fmt.Errorf("field blocked_by_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["buy_completion_rate"]; !ok || v == nil { + if _, ok := raw["buy_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field buy_completion_rate in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["buy_orders_amount"]; !ok || v == nil { + if _, ok := raw["buy_orders_amount"]; raw != nil && !ok { return fmt.Errorf("field buy_orders_amount in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["buy_orders_count"]; !ok || v == nil { + if _, ok := raw["buy_orders_count"]; raw != nil && !ok { return fmt.Errorf("field buy_orders_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["buy_time_avg"]; !ok || v == nil { + if _, ok := raw["buy_time_avg"]; raw != nil && !ok { return fmt.Errorf("field buy_time_avg in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["cancel_time_avg"]; !ok || v == nil { + if _, ok := raw["cancel_time_avg"]; raw != nil && !ok { return fmt.Errorf("field cancel_time_avg in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["cancels_remaining"]; !ok || v == nil { + if _, ok := raw["cancels_remaining"]; raw != nil && !ok { return fmt.Errorf("field cancels_remaining in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["chat_token"]; !ok || v == nil { + if _, ok := raw["chat_token"]; raw != nil && !ok { return fmt.Errorf("field chat_token in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["chat_user_id"]; !ok || v == nil { + if _, ok := raw["chat_user_id"]; raw != nil && !ok { return fmt.Errorf("field chat_user_id in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["contact_info"]; !ok || v == nil { + if _, ok := raw["contact_info"]; raw != nil && !ok { return fmt.Errorf("field contact_info in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["default_advert_description"]; !ok || v == nil { + if _, ok := raw["default_advert_description"]; raw != nil && !ok { return fmt.Errorf("field default_advert_description in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["full_verification"]; !ok || v == nil { + if _, ok := raw["full_verification"]; raw != nil && !ok { return fmt.Errorf("field full_verification in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["is_approved"]; !ok || v == nil { + if _, ok := raw["is_approved"]; raw != nil && !ok { return fmt.Errorf("field is_approved in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["is_listed"]; !ok || v == nil { + if _, ok := raw["is_listed"]; raw != nil && !ok { return fmt.Errorf("field is_listed in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["partner_count"]; !ok || v == nil { + if _, ok := raw["partner_count"]; raw != nil && !ok { return fmt.Errorf("field partner_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["payment_info"]; !ok || v == nil { + if _, ok := raw["payment_info"]; raw != nil && !ok { return fmt.Errorf("field payment_info in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["rating_average"]; !ok || v == nil { + if _, ok := raw["rating_average"]; raw != nil && !ok { return fmt.Errorf("field rating_average in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["rating_count"]; !ok || v == nil { + if _, ok := raw["rating_count"]; raw != nil && !ok { return fmt.Errorf("field rating_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["recommended_average"]; !ok || v == nil { + if _, ok := raw["recommended_average"]; raw != nil && !ok { return fmt.Errorf("field recommended_average in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["recommended_count"]; !ok || v == nil { + if _, ok := raw["recommended_count"]; raw != nil && !ok { return fmt.Errorf("field recommended_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["release_time_avg"]; !ok || v == nil { + if _, ok := raw["release_time_avg"]; raw != nil && !ok { return fmt.Errorf("field release_time_avg in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["sell_completion_rate"]; !ok || v == nil { + if _, ok := raw["sell_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field sell_completion_rate in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["sell_orders_amount"]; !ok || v == nil { + if _, ok := raw["sell_orders_amount"]; raw != nil && !ok { return fmt.Errorf("field sell_orders_amount in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["sell_orders_count"]; !ok || v == nil { + if _, ok := raw["sell_orders_count"]; raw != nil && !ok { return fmt.Errorf("field sell_orders_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["show_name"]; !ok || v == nil { + if _, ok := raw["show_name"]; raw != nil && !ok { return fmt.Errorf("field show_name in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["total_completion_rate"]; !ok || v == nil { + if _, ok := raw["total_completion_rate"]; raw != nil && !ok { return fmt.Errorf("field total_completion_rate in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["total_orders_count"]; !ok || v == nil { + if _, ok := raw["total_orders_count"]; raw != nil && !ok { return fmt.Errorf("field total_orders_count in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } - if v, ok := raw["total_turnover"]; !ok || v == nil { + if _, ok := raw["total_turnover"]; raw != nil && !ok { return fmt.Errorf("field total_turnover in P2PAdvertiserUpdateRespP2PAdvertiserUpdate: required") } type Plain P2PAdvertiserUpdateRespP2PAdvertiserUpdate @@ -581,32 +597,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PAdvertiserUpdateResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 166306a..0a8c70f 100644 --- a/schema/p2p_chat_create.go +++ b/schema/p2p_chat_create.go @@ -6,6 +6,26 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,26 +52,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["order_id"]; !ok || v == nil { + if _, ok := raw["order_id"]; raw != nil && !ok { return fmt.Errorf("field order_id in P2PChatCreate: required") } - if v, ok := raw["p2p_chat_create"]; !ok || v == nil { + if _, ok := raw["p2p_chat_create"]; raw != nil && !ok { 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 969d58c..04c48f4 100644 --- a/schema/p2p_chat_create_resp.go +++ b/schema/p2p_chat_create_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ 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. @@ -52,10 +68,10 @@ func (j *P2PChatCreateRespP2PChatCreate) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["channel_url"]; !ok || v == nil { + if _, ok := raw["channel_url"]; raw != nil && !ok { return fmt.Errorf("field channel_url in P2PChatCreateRespP2PChatCreate: required") } - if v, ok := raw["order_id"]; !ok || v == nil { + if _, ok := raw["order_id"]; raw != nil && !ok { return fmt.Errorf("field order_id in P2PChatCreateRespP2PChatCreate: required") } type Plain P2PChatCreateRespP2PChatCreate @@ -67,32 +83,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PChatCreateResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 02d46a8..883e2e4 100644 --- a/schema/p2p_country_list.go +++ b/schema/p2p_country_list.go @@ -6,6 +6,26 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,26 +52,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_country_list"]; !ok || v == nil { + if _, ok := raw["p2p_country_list"]; raw != nil && !ok { 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 c584b4e..4bc3428 100644 --- a/schema/p2p_country_list_resp.go +++ b/schema/p2p_country_list_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PCountryListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 cd266cb..1c74bcc 100644 --- a/schema/p2p_order_cancel.go +++ b/schema/p2p_order_cancel.go @@ -6,6 +6,26 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,26 +52,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderCancel: required") } - if v, ok := raw["p2p_order_cancel"]; !ok || v == nil { + if _, ok := raw["p2p_order_cancel"]; raw != nil && !ok { 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 574d292..0fba82d 100644 --- a/schema/p2p_order_cancel_resp.go +++ b/schema/p2p_order_cancel_resp.go @@ -29,60 +29,64 @@ type P2POrderCancelRespMsgType string const P2POrderCancelRespMsgTypeP2POrderCancel P2POrderCancelRespMsgType = "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", +var enumValues_P2POrderCancelRespMsgType = []interface{}{ + "p2p_order_cancel", } // 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 } +// 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 *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 } @@ -92,10 +96,10 @@ func (j *P2POrderCancelRespP2POrderCancel) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderCancelRespP2POrderCancel: required") } - if v, ok := raw["status"]; !ok || v == nil { + if _, ok := raw["status"]; raw != nil && !ok { return fmt.Errorf("field status in P2POrderCancelRespP2POrderCancel: required") } type Plain P2POrderCancelRespP2POrderCancel @@ -107,20 +111,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2POrderCancelResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 2a63ebe..e328c1b 100644 --- a/schema/p2p_order_confirm.go +++ b/schema/p2p_order_confirm.go @@ -6,6 +6,32 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -59,32 +85,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderConfirm: required") } - if v, ok := raw["p2p_order_confirm"]; !ok || v == nil { + if _, ok := raw["p2p_order_confirm"]; raw != nil && !ok { 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 e18f43e..996f1d9 100644 --- a/schema/p2p_order_confirm_resp.go +++ b/schema/p2p_order_confirm_resp.go @@ -29,6 +29,30 @@ 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. @@ -43,7 +67,9 @@ type P2POrderConfirmRespP2POrderConfirm struct { type P2POrderConfirmRespP2POrderConfirmDryRun int -type P2POrderConfirmRespP2POrderConfirmStatus string +var enumValues_P2POrderConfirmRespP2POrderConfirmDryRun = []interface{}{ + 1, +} // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderConfirmRespP2POrderConfirmDryRun) UnmarshalJSON(b []byte) error { @@ -65,9 +91,11 @@ func (j *P2POrderConfirmRespP2POrderConfirmDryRun) UnmarshalJSON(b []byte) error return nil } -var enumValues_P2POrderConfirmRespP2POrderConfirmDryRun = []interface{}{ - 1, -} +type P2POrderConfirmRespP2POrderConfirmStatus string + +const P2POrderConfirmRespP2POrderConfirmStatusBuyerConfirmed P2POrderConfirmRespP2POrderConfirmStatus = "buyer-confirmed" +const P2POrderConfirmRespP2POrderConfirmStatusCompleted P2POrderConfirmRespP2POrderConfirmStatus = "completed" + var enumValues_P2POrderConfirmRespP2POrderConfirmStatus = []interface{}{ "buyer-confirmed", "completed", @@ -93,36 +121,13 @@ 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 v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderConfirmRespP2POrderConfirm: required") } type Plain P2POrderConfirmRespP2POrderConfirm @@ -134,20 +139,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2POrderConfirmResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 01b98a8..056d90a 100644 --- a/schema/p2p_order_create.go +++ b/schema/p2p_order_create.go @@ -6,6 +6,46 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -62,59 +102,19 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["advert_id"]; !ok || v == nil { + if _, ok := raw["advert_id"]; raw != nil && !ok { return fmt.Errorf("field advert_id in P2POrderCreate: required") } - if v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in P2POrderCreate: required") } - if v, ok := raw["p2p_order_create"]; !ok || v == nil { + if _, ok := raw["p2p_order_create"]; raw != nil && !ok { 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 ff6d417..4a6e944 100644 --- a/schema/p2p_order_create_resp.go +++ b/schema/p2p_order_create_resp.go @@ -6,53 +6,6 @@ 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. @@ -72,213 +25,34 @@ type P2POrderCreateResp struct { Subscription *P2POrderCreateRespSubscription `json:"subscription,omitempty"` } -type P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade int - -// 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 -} +// Echo of the request made. +type P2POrderCreateRespEchoReq map[string]interface{} -// 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 -} +type P2POrderCreateRespMsgType string -type P2POrderCreateRespP2POrderCreateAdvertDetailsType string +const P2POrderCreateRespMsgTypeP2POrderCreate P2POrderCreateRespMsgType = "p2p_order_create" -// 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 +var enumValues_P2POrderCreateRespMsgType = []interface{}{ + "p2p_order_create", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateAdvertDetailsType) 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_P2POrderCreateRespP2POrderCreateAdvertDetailsType { + 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_P2POrderCreateRespP2POrderCreateAdvertDetailsType, 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 + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespMsgType, v) } - *j = P2POrderCreateRespP2POrderCreateAdvertDetails(plain) + *j = P2POrderCreateRespMsgType(v) return nil } @@ -362,63 +136,159 @@ 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 *P2POrderCreateRespP2POrderCreateType) UnmarshalJSON(b []byte) error { - var v string +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_P2POrderCreateRespP2POrderCreateType { + 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_P2POrderCreateRespP2POrderCreateType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade, v) } - *j = P2POrderCreateRespP2POrderCreateType(v) + *j = P2POrderCreateRespP2POrderCreateAdvertDetailsBlockTrade(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 *P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int +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_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline { + 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_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertDetailsType, v) } - *j = P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline(v) + *j = P2POrderCreateRespP2POrderCreateAdvertDetailsType(v) return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateStatus) UnmarshalJSON(b []byte) error { - var v string +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 if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateStatus { + 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_P2POrderCreateRespP2POrderCreateStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline, v) } - *j = P2POrderCreateRespP2POrderCreateStatus(v) + *j = P2POrderCreateRespP2POrderCreateAdvertiserDetailsIsOnline(v) return nil } @@ -428,19 +298,19 @@ func (j *P2POrderCreateRespP2POrderCreateAdvertiserDetails) UnmarshalJSON(b []by if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } - if v, ok := raw["loginid"]; !ok || v == nil { + if _, ok := raw["loginid"]; raw != nil && !ok { return fmt.Errorf("field loginid in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2POrderCreateRespP2POrderCreateAdvertiserDetails: required") } type Plain P2POrderCreateRespP2POrderCreateAdvertiserDetails @@ -452,204 +322,341 @@ 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 *P2POrderCreateRespP2POrderCreateIsSeen) 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_P2POrderCreateRespP2POrderCreateIsSeen { + 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_P2POrderCreateRespP2POrderCreateIsSeen, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline, v) } - *j = P2POrderCreateRespP2POrderCreateIsSeen(v) + *j = P2POrderCreateRespP2POrderCreateClientDetailsIsOnline(v) return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateIsReviewable) UnmarshalJSON(b []byte) error { +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 + } + *j = P2POrderCreateRespP2POrderCreateDisputeDetails(plain) + return nil +} + +type P2POrderCreateRespP2POrderCreateIsIncoming int + +var enumValues_P2POrderCreateRespP2POrderCreateIsIncoming = []interface{}{ + 0, + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +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_P2POrderCreateRespP2POrderCreateIsReviewable { + 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_P2POrderCreateRespP2POrderCreateIsReviewable, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsIncoming, v) } - *j = P2POrderCreateRespP2POrderCreateIsReviewable(v) + *j = P2POrderCreateRespP2POrderCreateIsIncoming(v) return nil } +type P2POrderCreateRespP2POrderCreateIsReviewable int + +var enumValues_P2POrderCreateRespP2POrderCreateIsReviewable = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateClientDetailsIsOnline) 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_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline { + 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_P2POrderCreateRespP2POrderCreateClientDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsReviewable, v) } - *j = P2POrderCreateRespP2POrderCreateClientDetailsIsOnline(v) + *j = P2POrderCreateRespP2POrderCreateIsReviewable(v) return nil } +type P2POrderCreateRespP2POrderCreateIsSeen int + +var enumValues_P2POrderCreateRespP2POrderCreateIsSeen = []interface{}{ + 1, + 0, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespP2POrderCreateIsIncoming) 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_P2POrderCreateRespP2POrderCreateIsIncoming { + 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_P2POrderCreateRespP2POrderCreateIsIncoming, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateIsSeen, v) } - *j = P2POrderCreateRespP2POrderCreateIsIncoming(v) + *j = P2POrderCreateRespP2POrderCreateIsSeen(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 *P2POrderCreateRespSubscription) UnmarshalJSON(b []byte) error { - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { +func (j *P2POrderCreateRespP2POrderCreateStatus) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { - return fmt.Errorf("field id in P2POrderCreateRespSubscription: required") + var ok bool + for _, expected := range enumValues_P2POrderCreateRespP2POrderCreateStatus { + if reflect.DeepEqual(v, expected) { + ok = true + break + } } - type Plain P2POrderCreateRespSubscription - 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_P2POrderCreateRespP2POrderCreateStatus, v) } - *j = P2POrderCreateRespSubscription(plain) + *j = P2POrderCreateRespP2POrderCreateStatus(v) return nil } -const P2POrderCreateRespMsgTypeP2POrderCreate P2POrderCreateRespMsgType = "p2p_order_create" +type P2POrderCreateRespP2POrderCreateType string + +const P2POrderCreateRespP2POrderCreateTypeBuy P2POrderCreateRespP2POrderCreateType = "buy" +const P2POrderCreateRespP2POrderCreateTypeSell P2POrderCreateRespP2POrderCreateType = "sell" + +var enumValues_P2POrderCreateRespP2POrderCreateType = []interface{}{ + "buy", + "sell", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderCreateRespMsgType) UnmarshalJSON(b []byte) error { +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_P2POrderCreateRespMsgType { + 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_P2POrderCreateRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderCreateRespP2POrderCreateType, v) } - *j = P2POrderCreateRespMsgType(v) + *j = P2POrderCreateRespP2POrderCreateType(v) 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"` +// 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 } // For subscription requests only. @@ -659,41 +666,41 @@ type P2POrderCreateRespSubscription struct { Id string `json:"id"` } -var enumValues_P2POrderCreateRespMsgType = []interface{}{ - "p2p_order_create", -} -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", +// 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_P2POrderCreateRespP2POrderCreateType = []interface{}{ - "buy", - "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 _, 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 } diff --git a/schema/p2p_order_dispute.go b/schema/p2p_order_dispute.go index e306930..4c16354 100644 --- a/schema/p2p_order_dispute.go +++ b/schema/p2p_order_dispute.go @@ -37,6 +37,14 @@ 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 @@ -87,27 +95,19 @@ 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 v, ok := raw["dispute_reason"]; !ok || v == nil { + if _, ok := raw["dispute_reason"]; raw != nil && !ok { return fmt.Errorf("field dispute_reason in P2POrderDispute: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderDispute: required") } - if v, ok := raw["p2p_order_dispute"]; !ok || v == nil { + if _, ok := raw["p2p_order_dispute"]; raw != nil && !ok { 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 40ebe90..95d36ca 100644 --- a/schema/p2p_order_dispute_resp.go +++ b/schema/p2p_order_dispute_resp.go @@ -29,6 +29,30 @@ 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. @@ -137,11 +161,91 @@ 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. @@ -168,6 +272,61 @@ 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. @@ -194,63 +353,29 @@ 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, } -var enumValues_P2POrderDisputeRespP2POrderDisputeIsIncoming = []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 } // UnmarshalJSON implements json.Unmarshaler. @@ -259,19 +384,19 @@ func (j *P2POrderDisputeRespP2POrderDisputeClientDetails) UnmarshalJSON(b []byte if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } - if v, ok := raw["is_online"]; !ok || v == nil { + if _, ok := raw["is_online"]; raw != nil && !ok { return fmt.Errorf("field is_online in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } - if v, ok := raw["last_online_time"]; !ok || v == nil { + if _, ok := raw["last_online_time"]; raw != nil && !ok { return fmt.Errorf("field last_online_time in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } - if v, ok := raw["loginid"]; !ok || v == nil { + if _, ok := raw["loginid"]; raw != nil && !ok { return fmt.Errorf("field loginid in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2POrderDisputeRespP2POrderDisputeClientDetails: required") } type Plain P2POrderDisputeRespP2POrderDisputeClientDetails @@ -283,65 +408,39 @@ func (j *P2POrderDisputeRespP2POrderDisputeClientDetails) UnmarshalJSON(b []byte return nil } -var enumValues_P2POrderDisputeRespP2POrderDisputeStatus = []interface{}{ - "pending", - "buyer-confirmed", - "cancelled", - "timed-out", - "blocked", - "refunded", - "completed", - "disputed", - "dispute-refunded", - "dispute-completed", +// 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"` } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeIsSeen) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *P2POrderDisputeRespP2POrderDisputeDisputeDetails) 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_P2POrderDisputeRespP2POrderDisputeIsSeen { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if _, ok := raw["dispute_reason"]; raw != nil && !ok { + return fmt.Errorf("field dispute_reason in P2POrderDisputeRespP2POrderDisputeDisputeDetails: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen, v) + if _, ok := raw["disputer_loginid"]; raw != nil && !ok { + return fmt.Errorf("field disputer_loginid in P2POrderDisputeRespP2POrderDisputeDisputeDetails: required") } - *j = P2POrderDisputeRespP2POrderDisputeIsSeen(v) - return nil -} - -var enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen = []interface{}{ - 1, - 0, -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeIsReviewable) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { + type Plain P2POrderDisputeRespP2POrderDisputeDisputeDetails + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { return err } - var ok bool - 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_P2POrderDisputeRespP2POrderDisputeIsReviewable, v) - } - *j = P2POrderDisputeRespP2POrderDisputeIsReviewable(v) + *j = P2POrderDisputeRespP2POrderDisputeDisputeDetails(plain) return nil } -var enumValues_P2POrderDisputeRespP2POrderDisputeIsReviewable = []interface{}{ +type P2POrderDisputeRespP2POrderDisputeIsIncoming int + +var enumValues_P2POrderDisputeRespP2POrderDisputeIsIncoming = []interface{}{ 0, 1, } @@ -366,65 +465,84 @@ func (j *P2POrderDisputeRespP2POrderDisputeIsIncoming) UnmarshalJSON(b []byte) e return nil } +type P2POrderDisputeRespP2POrderDisputeIsReviewable int + +var enumValues_P2POrderDisputeRespP2POrderDisputeIsReviewable = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline) 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_P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline { + 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_P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsReviewable, v) } - *j = P2POrderDisputeRespP2POrderDisputeAdvertiserDetailsIsOnline(v) + *j = P2POrderDisputeRespP2POrderDisputeIsReviewable(v) return nil } +type P2POrderDisputeRespP2POrderDisputeIsSeen int + +var enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen = []interface{}{ + 1, + 0, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade) UnmarshalJSON(b []byte) error { +func (j *P2POrderDisputeRespP2POrderDisputeIsSeen) 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 { + for _, expected := range enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderDisputeRespP2POrderDisputeIsSeen, v) } - *j = P2POrderDisputeRespP2POrderDisputeAdvertDetailsBlockTrade(v) + *j = P2POrderDisputeRespP2POrderDisputeIsSeen(v) return nil } -// 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 +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. @@ -447,6 +565,11 @@ 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", @@ -472,75 +595,7 @@ func (j *P2POrderDisputeRespP2POrderDisputeType) UnmarshalJSON(b []byte) error { return nil } -// 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 -} +type P2POrderDisputeRespP2POrderDisputeVerificationPending int var enumValues_P2POrderDisputeRespP2POrderDisputeVerificationPending = []interface{}{ 0, @@ -567,99 +622,79 @@ 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 v, ok := raw["account_currency"]; !ok || v == nil { + if _, ok := raw["account_currency"]; raw != nil && !ok { return fmt.Errorf("field account_currency in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["advert_details"]; !ok || v == nil { + if _, ok := raw["advert_details"]; raw != nil && !ok { return fmt.Errorf("field advert_details in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["advertiser_details"]; !ok || v == nil { + if _, ok := raw["advertiser_details"]; raw != nil && !ok { return fmt.Errorf("field advertiser_details in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["amount_display"]; !ok || v == nil { + if _, ok := raw["amount_display"]; raw != nil && !ok { return fmt.Errorf("field amount_display in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["chat_channel_url"]; !ok || v == nil { + if _, ok := raw["chat_channel_url"]; raw != nil && !ok { return fmt.Errorf("field chat_channel_url in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["client_details"]; !ok || v == nil { + if _, ok := raw["client_details"]; raw != nil && !ok { return fmt.Errorf("field client_details in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["contact_info"]; !ok || v == nil { + if _, ok := raw["contact_info"]; raw != nil && !ok { return fmt.Errorf("field contact_info in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["dispute_details"]; !ok || v == nil { + if _, ok := raw["dispute_details"]; raw != nil && !ok { return fmt.Errorf("field dispute_details in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["expiry_time"]; !ok || v == nil { + if _, ok := raw["expiry_time"]; raw != nil && !ok { return fmt.Errorf("field expiry_time in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["is_incoming"]; !ok || v == nil { + if _, ok := raw["is_incoming"]; raw != nil && !ok { return fmt.Errorf("field is_incoming in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["is_reviewable"]; !ok || v == nil { + if _, ok := raw["is_reviewable"]; raw != nil && !ok { return fmt.Errorf("field is_reviewable in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["is_seen"]; !ok || v == nil { + if _, ok := raw["is_seen"]; raw != nil && !ok { return fmt.Errorf("field is_seen in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["local_currency"]; !ok || v == nil { + if _, ok := raw["local_currency"]; raw != nil && !ok { return fmt.Errorf("field local_currency in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["payment_info"]; !ok || v == nil { + if _, ok := raw["payment_info"]; raw != nil && !ok { return fmt.Errorf("field payment_info in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["price_display"]; !ok || v == nil { + if _, ok := raw["price_display"]; raw != nil && !ok { return fmt.Errorf("field price_display in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["rate"]; !ok || v == nil { + if _, ok := raw["rate"]; raw != nil && !ok { return fmt.Errorf("field rate in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["rate_display"]; !ok || v == nil { + if _, ok := raw["rate_display"]; raw != nil && !ok { return fmt.Errorf("field rate_display in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["status"]; !ok || v == nil { + if _, ok := raw["status"]; raw != nil && !ok { return fmt.Errorf("field status in P2POrderDisputeRespP2POrderDispute: required") } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in P2POrderDisputeRespP2POrderDispute: required") } type Plain P2POrderDisputeRespP2POrderDispute @@ -671,46 +706,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2POrderDisputeResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 ee3a677..f0b8344 100644 --- a/schema/p2p_order_info.go +++ b/schema/p2p_order_info.go @@ -6,6 +6,29 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -62,39 +85,16 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderInfo: required") } - if v, ok := raw["p2p_order_info"]; !ok || v == nil { + if _, ok := raw["p2p_order_info"]; raw != nil && !ok { 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 66a1854..c9dab4e 100644 --- a/schema/p2p_order_info_resp.go +++ b/schema/p2p_order_info_resp.go @@ -32,6 +32,30 @@ 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. @@ -155,11 +179,91 @@ 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. @@ -190,10 +294,98 @@ 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. @@ -224,74 +416,33 @@ type P2POrderInfoRespP2POrderInfoClientDetails struct { type P2POrderInfoRespP2POrderInfoClientDetailsIsOnline int -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{} +var enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsOnline = []interface{}{ + 0, + 1, } -type P2POrderInfoRespP2POrderInfoStatus string - -const P2POrderInfoRespP2POrderInfoStatusBlocked P2POrderInfoRespP2POrderInfoStatus = "blocked" -const P2POrderInfoRespP2POrderInfoStatusBuyerConfirmed P2POrderInfoRespP2POrderInfoStatus = "buyer-confirmed" -const P2POrderInfoRespP2POrderInfoStatusCancelled P2POrderInfoRespP2POrderInfoStatus = "cancelled" - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertDetailsType) UnmarshalJSON(b []byte) error { - var v string +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_P2POrderInfoRespP2POrderInfoAdvertDetailsType { + 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_P2POrderInfoRespP2POrderInfoAdvertDetailsType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsOnline, v) } - *j = P2POrderInfoRespP2POrderInfoAdvertDetailsType(v) + *j = P2POrderInfoRespP2POrderInfoClientDetailsIsOnline(v) return nil } -var enumValues_P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, +type P2POrderInfoRespP2POrderInfoClientDetailsIsRecommended struct { + Value interface{} } // MarshalJSON implements json.Marshaler. @@ -299,6 +450,12 @@ 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 { @@ -321,24 +478,19 @@ 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 v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderInfoRespP2POrderInfoClientDetails: required") } - if v, ok := raw["loginid"]; !ok || v == nil { + if _, ok := raw["loginid"]; raw != nil && !ok { return fmt.Errorf("field loginid in P2POrderInfoRespP2POrderInfoClientDetails: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in P2POrderInfoRespP2POrderInfoClientDetails: required") } type Plain P2POrderInfoRespP2POrderInfoClientDetails @@ -350,34 +502,13 @@ func (j *P2POrderInfoRespP2POrderInfoClientDetails) UnmarshalJSON(b []byte) erro 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 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 +// 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. @@ -386,10 +517,10 @@ func (j *P2POrderInfoRespP2POrderInfoDisputeDetails) UnmarshalJSON(b []byte) err if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["dispute_reason"]; !ok || v == nil { + if _, ok := raw["dispute_reason"]; raw != nil && !ok { return fmt.Errorf("field dispute_reason in P2POrderInfoRespP2POrderInfoDisputeDetails: required") } - if v, ok := raw["disputer_loginid"]; !ok || v == nil { + if _, ok := raw["disputer_loginid"]; raw != nil && !ok { return fmt.Errorf("field disputer_loginid in P2POrderInfoRespP2POrderInfoDisputeDetails: required") } type Plain P2POrderInfoRespP2POrderInfoDisputeDetails @@ -401,27 +532,7 @@ func (j *P2POrderInfoRespP2POrderInfoDisputeDetails) UnmarshalJSON(b []byte) err return nil } -// 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 -} +type P2POrderInfoRespP2POrderInfoIsIncoming int var enumValues_P2POrderInfoRespP2POrderInfoIsIncoming = []interface{}{ 0, @@ -448,10 +559,7 @@ func (j *P2POrderInfoRespP2POrderInfoIsIncoming) UnmarshalJSON(b []byte) error { return nil } -// MarshalJSON implements json.Marshaler. -func (j *P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) -} +type P2POrderInfoRespP2POrderInfoIsReviewable int var enumValues_P2POrderInfoRespP2POrderInfoIsReviewable = []interface{}{ 0, @@ -478,11 +586,8 @@ func (j *P2POrderInfoRespP2POrderInfoIsReviewable) UnmarshalJSON(b []byte) error return nil } -var enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, -} +type P2POrderInfoRespP2POrderInfoIsSeen int + var enumValues_P2POrderInfoRespP2POrderInfoIsSeen = []interface{}{ 1, 0, @@ -508,34 +613,23 @@ func (j *P2POrderInfoRespP2POrderInfoIsSeen) UnmarshalJSON(b []byte) error { return nil } -// 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 -} +// Details of available payment methods. +type P2POrderInfoRespP2POrderInfoPaymentMethodDetails map[string]interface{} -var enumValues_P2POrderInfoRespP2POrderInfoAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, +// 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"` } -var enumValues_P2POrderInfoRespP2POrderInfoReviewDetailsRecommended = []interface{}{ - nil, - 0.0, - 1.0, + +type P2POrderInfoRespP2POrderInfoReviewDetailsRecommended struct { + Value interface{} } // MarshalJSON implements json.Marshaler. @@ -543,6 +637,12 @@ func (j *P2POrderInfoRespP2POrderInfoReviewDetailsRecommended) MarshalJSON() ([] return json.Marshal(j.Value) } +var enumValues_P2POrderInfoRespP2POrderInfoReviewDetailsRecommended = []interface{}{ + nil, + 0.0, + 1.0, +} + // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderInfoRespP2POrderInfoReviewDetailsRecommended) UnmarshalJSON(b []byte) error { var v struct { @@ -565,49 +665,19 @@ 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 v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2POrderInfoRespP2POrderInfoReviewDetails: required") } - if v, ok := raw["rating"]; !ok || v == nil { + if _, ok := raw["rating"]; raw != nil && !ok { return fmt.Errorf("field rating in P2POrderInfoRespP2POrderInfoReviewDetails: required") } - if v, ok := raw["recommended"]; !ok || v == nil { + if _, ok := raw["recommended"]; raw != nil && !ok { return fmt.Errorf("field recommended in P2POrderInfoRespP2POrderInfoReviewDetails: required") } type Plain P2POrderInfoRespP2POrderInfoReviewDetails @@ -619,25 +689,18 @@ func (j *P2POrderInfoRespP2POrderInfoReviewDetails) UnmarshalJSON(b []byte) erro return nil } -// 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 -} +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" var enumValues_P2POrderInfoRespP2POrderInfoStatus = []interface{}{ "pending", @@ -672,48 +735,11 @@ func (j *P2POrderInfoRespP2POrderInfoStatus) UnmarshalJSON(b []byte) error { return nil } -const P2POrderInfoRespP2POrderInfoStatusPending P2POrderInfoRespP2POrderInfoStatus = "pending" - -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 +const P2POrderInfoRespP2POrderInfoTypeBuy P2POrderInfoRespP2POrderInfoType = "buy" +const P2POrderInfoRespP2POrderInfoTypeSell P2POrderInfoRespP2POrderInfoType = "sell" + var enumValues_P2POrderInfoRespP2POrderInfoType = []interface{}{ "buy", "sell", @@ -739,9 +765,6 @@ func (j *P2POrderInfoRespP2POrderInfoType) UnmarshalJSON(b []byte) error { return nil } -const P2POrderInfoRespP2POrderInfoTypeBuy P2POrderInfoRespP2POrderInfoType = "buy" -const P2POrderInfoRespP2POrderInfoTypeSell P2POrderInfoRespP2POrderInfoType = "sell" - type P2POrderInfoRespP2POrderInfoVerificationPending int var enumValues_P2POrderInfoRespP2POrderInfoVerificationPending = []interface{}{ @@ -769,96 +792,76 @@ 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 v, ok := raw["account_currency"]; !ok || v == nil { + if _, ok := raw["account_currency"]; raw != nil && !ok { return fmt.Errorf("field account_currency in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["advert_details"]; !ok || v == nil { + if _, ok := raw["advert_details"]; raw != nil && !ok { return fmt.Errorf("field advert_details in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["advertiser_details"]; !ok || v == nil { + if _, ok := raw["advertiser_details"]; raw != nil && !ok { return fmt.Errorf("field advertiser_details in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["amount_display"]; !ok || v == nil { + if _, ok := raw["amount_display"]; raw != nil && !ok { return fmt.Errorf("field amount_display in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["chat_channel_url"]; !ok || v == nil { + if _, ok := raw["chat_channel_url"]; raw != nil && !ok { return fmt.Errorf("field chat_channel_url in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["client_details"]; !ok || v == nil { + if _, ok := raw["client_details"]; raw != nil && !ok { return fmt.Errorf("field client_details in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["contact_info"]; !ok || v == nil { + if _, ok := raw["contact_info"]; raw != nil && !ok { return fmt.Errorf("field contact_info in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["dispute_details"]; !ok || v == nil { + if _, ok := raw["dispute_details"]; raw != nil && !ok { return fmt.Errorf("field dispute_details in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["expiry_time"]; !ok || v == nil { + if _, ok := raw["expiry_time"]; raw != nil && !ok { return fmt.Errorf("field expiry_time in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["is_incoming"]; !ok || v == nil { + if _, ok := raw["is_incoming"]; raw != nil && !ok { return fmt.Errorf("field is_incoming in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["is_reviewable"]; !ok || v == nil { + if _, ok := raw["is_reviewable"]; raw != nil && !ok { return fmt.Errorf("field is_reviewable in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["local_currency"]; !ok || v == nil { + if _, ok := raw["local_currency"]; raw != nil && !ok { return fmt.Errorf("field local_currency in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["payment_info"]; !ok || v == nil { + if _, ok := raw["payment_info"]; raw != nil && !ok { return fmt.Errorf("field payment_info in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["price_display"]; !ok || v == nil { + if _, ok := raw["price_display"]; raw != nil && !ok { return fmt.Errorf("field price_display in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["rate"]; !ok || v == nil { + if _, ok := raw["rate"]; raw != nil && !ok { return fmt.Errorf("field rate in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["rate_display"]; !ok || v == nil { + if _, ok := raw["rate_display"]; raw != nil && !ok { return fmt.Errorf("field rate_display in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["status"]; !ok || v == nil { + if _, ok := raw["status"]; raw != nil && !ok { return fmt.Errorf("field status in P2POrderInfoRespP2POrderInfo: required") } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in P2POrderInfoRespP2POrderInfo: required") } type Plain P2POrderInfoRespP2POrderInfo @@ -883,7 +886,7 @@ func (j *P2POrderInfoRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderInfoRespSubscription: required") } type Plain P2POrderInfoRespSubscription @@ -895,20 +898,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2POrderInfoResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 b8ec446..661e4b4 100644 --- a/schema/p2p_order_list.go +++ b/schema/p2p_order_list.go @@ -6,6 +6,47 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -89,54 +130,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_order_list"]; !ok || v == nil { + if _, ok := raw["p2p_order_list"]; raw != nil && !ok { 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 5a73e30..63da3d0 100644 --- a/schema/p2p_order_list_resp.go +++ b/schema/p2p_order_list_resp.go @@ -32,6 +32,30 @@ 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. @@ -157,11 +181,91 @@ 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. @@ -192,119 +296,48 @@ type P2POrderListRespP2POrderListListElemAdvertiserDetails struct { type P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline int -type P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended struct { - Value interface{} -} - -// Details of the client who created the order. -type P2POrderListRespP2POrderListListElemClientDetails 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 P2POrderListRespP2POrderListListElemClientDetailsIsOnline `json:"is_online"` - - // Indicates that the client was recommended in the most recent review by the - // current user. - IsRecommended *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended `json:"is_recommended,omitempty"` - - // 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 P2POrderListRespP2POrderListListElemClientDetailsIsOnline int - -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) +var enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemIsIncoming) 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_P2POrderListRespP2POrderListListElemIsIncoming { + 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_P2POrderListRespP2POrderListListElemIsIncoming, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline, v) } - *j = P2POrderListRespP2POrderListListElemIsIncoming(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 *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended) UnmarshalJSON(b []byte) error { +func (j *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { var v struct { Value interface{} } @@ -312,72 +345,82 @@ func (j *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended) Unmarsh return err } var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsRecommended { + 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_P2POrderListRespP2POrderListListElemClientDetailsIsRecommended, v.Value) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended, v.Value) } - *j = P2POrderListRespP2POrderListListElemClientDetailsIsRecommended(v) + *j = P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended(v) return nil } -var enumValues_P2POrderListRespP2POrderListListElemIsReviewable = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemIsReviewable) 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_P2POrderListRespP2POrderListListElemIsReviewable { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + if _, ok := raw["id"]; raw != nil && !ok { + return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsReviewable, v) + if _, ok := raw["is_online"]; raw != nil && !ok { + return fmt.Errorf("field is_online in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") } - *j = P2POrderListRespP2POrderListListElemIsReviewable(v) + 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 } -var enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, -} -var enumValues_P2POrderListRespP2POrderListListElemIsSeen = []interface{}{ - 1, - 0, +// Details of the client who created the order. +type P2POrderListRespP2POrderListListElemClientDetails 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 P2POrderListRespP2POrderListListElemClientDetailsIsOnline `json:"is_online"` + + // Indicates that the client was recommended in the most recent review by the + // current user. + IsRecommended *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended `json:"is_recommended,omitempty"` + + // 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"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemIsSeen) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsSeen { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsSeen, v) - } - *j = P2POrderListRespP2POrderListListElemIsSeen(v) - return nil +type P2POrderListRespP2POrderListListElemClientDetailsIsOnline int + +var enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsOnline = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -400,153 +443,202 @@ func (j *P2POrderListRespP2POrderListListElemClientDetailsIsOnline) UnmarshalJSO return nil } -var enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended = []interface{}{ - nil, - 0.0, - 1.0, +type P2POrderListRespP2POrderListListElemClientDetailsIsRecommended struct { + Value interface{} } // MarshalJSON implements json.Marshaler. -func (j *P2POrderListRespP2POrderListListElemReviewDetailsRecommended) MarshalJSON() ([]byte, error) { +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 *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { +func (j *P2POrderListRespP2POrderListListElemClientDetailsIsRecommended) 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_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline { - if reflect.DeepEqual(v, expected) { + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsRecommended { + if reflect.DeepEqual(v.Value, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsRecommended, v.Value) } - *j = P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline(v) + *j = P2POrderListRespP2POrderListListElemClientDetailsIsRecommended(v) return nil } -var enumValues_P2POrderListRespP2POrderListListElemClientDetailsIsOnline = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemReviewDetails) UnmarshalJSON(b []byte) error { +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["created_time"]; !ok || v == nil { - return fmt.Errorf("field created_time in P2POrderListRespP2POrderListListElemReviewDetails: required") + if _, ok := raw["id"]; raw != nil && !ok { + return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemClientDetails: required") } - if v, ok := raw["rating"]; !ok || v == nil { - return fmt.Errorf("field rating in P2POrderListRespP2POrderListListElemReviewDetails: required") + if _, ok := raw["is_online"]; raw != nil && !ok { + return fmt.Errorf("field is_online in P2POrderListRespP2POrderListListElemClientDetails: required") } - if v, ok := raw["recommended"]; !ok || v == nil { - return fmt.Errorf("field recommended in P2POrderListRespP2POrderListListElemReviewDetails: required") + if _, ok := raw["last_online_time"]; raw != nil && !ok { + return fmt.Errorf("field last_online_time in P2POrderListRespP2POrderListListElemClientDetails: required") } - type Plain P2POrderListRespP2POrderListListElemReviewDetails + if _, ok := raw["loginid"]; raw != nil && !ok { + return fmt.Errorf("field loginid in P2POrderListRespP2POrderListListElemClientDetails: required") + } + if _, ok := raw["name"]; raw != nil && !ok { + 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 = P2POrderListRespP2POrderListListElemReviewDetails(plain) + *j = P2POrderListRespP2POrderListListElemClientDetails(plain) return nil } +// 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"` +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertiserDetails) UnmarshalJSON(b []byte) error { +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["id"]; !ok || v == nil { - return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") - } - if v, ok := raw["is_online"]; !ok || v == nil { - return fmt.Errorf("field is_online in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") - } - 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 _, ok := raw["dispute_reason"]; raw != nil && !ok { + return fmt.Errorf("field dispute_reason in P2POrderListRespP2POrderListListElemDisputeDetails: required") } - if v, ok := raw["name"]; !ok || v == nil { - return fmt.Errorf("field name in P2POrderListRespP2POrderListListElemAdvertiserDetails: required") + if _, ok := raw["disputer_loginid"]; raw != nil && !ok { + return fmt.Errorf("field disputer_loginid in P2POrderListRespP2POrderListListElemDisputeDetails: required") } - type Plain P2POrderListRespP2POrderListListElemAdvertiserDetails + type Plain P2POrderListRespP2POrderListListElemDisputeDetails var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = P2POrderListRespP2POrderListListElemAdvertiserDetails(plain) + *j = P2POrderListRespP2POrderListListElemDisputeDetails(plain) return nil } -var enumValues_P2POrderListRespP2POrderListListElemStatus = []interface{}{ - "pending", - "buyer-confirmed", - "cancelled", - "timed-out", - "blocked", - "refunded", - "completed", - "disputed", - "dispute-refunded", - "dispute-completed", +type P2POrderListRespP2POrderListListElemIsIncoming int + +var enumValues_P2POrderListRespP2POrderListListElemIsIncoming = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemStatus) UnmarshalJSON(b []byte) error { - var v string +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_P2POrderListRespP2POrderListListElemStatus { + 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_P2POrderListRespP2POrderListListElemStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsIncoming, v) } - *j = P2POrderListRespP2POrderListListElemStatus(v) + *j = P2POrderListRespP2POrderListListElemIsIncoming(v) return nil } +type P2POrderListRespP2POrderListListElemIsReviewable int + +var enumValues_P2POrderListRespP2POrderListListElemIsReviewable = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended) UnmarshalJSON(b []byte) error { - var v struct { - Value interface{} +func (j *P2POrderListRespP2POrderListListElemIsReviewable) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err } - if err := json.Unmarshal(b, &v.Value); err != nil { + var ok bool + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsReviewable { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsReviewable, v) + } + *j = P2POrderListRespP2POrderListListElemIsReviewable(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 { return err } var ok bool - for _, expected := range enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended { - if reflect.DeepEqual(v.Value, expected) { + for _, expected := range enumValues_P2POrderListRespP2POrderListListElemIsSeen { + if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended, v.Value) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemIsSeen, v) } - *j = P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended(v) + *j = P2POrderListRespP2POrderListListElemIsSeen(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 *P2POrderListRespP2POrderListListElemAdvertiserDetailsIsRecommended) MarshalJSON() ([]byte, error) { +func (j *P2POrderListRespP2POrderListListElemReviewDetailsRecommended) MarshalJSON() ([]byte, error) { return json.Marshal(j.Value) } @@ -555,10 +647,6 @@ var enumValues_P2POrderListRespP2POrderListListElemReviewDetailsRecommended = [] 0.0, 1.0, } -var enumValues_P2POrderListRespP2POrderListListElemIsIncoming = []interface{}{ - 0, - 1, -} // UnmarshalJSON implements json.Unmarshaler. func (j *P2POrderListRespP2POrderListListElemReviewDetailsRecommended) UnmarshalJSON(b []byte) error { @@ -582,106 +670,80 @@ func (j *P2POrderListRespP2POrderListListElemReviewDetailsRecommended) Unmarshal return nil } -var enumValues_P2POrderListRespP2POrderListListElemAdvertiserDetailsIsOnline = []interface{}{ - 0, - 1, -} - // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertDetails) UnmarshalJSON(b []byte) error { +func (j *P2POrderListRespP2POrderListListElemReviewDetails) 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 P2POrderListRespP2POrderListListElemAdvertDetails: required") - } - if v, ok := raw["description"]; !ok || v == nil { - return fmt.Errorf("field description in P2POrderListRespP2POrderListListElemAdvertDetails: required") - } - if v, ok := raw["id"]; !ok || v == nil { - return fmt.Errorf("field id in P2POrderListRespP2POrderListListElemAdvertDetails: required") + if _, ok := raw["created_time"]; raw != nil && !ok { + return fmt.Errorf("field created_time in P2POrderListRespP2POrderListListElemReviewDetails: required") } - if v, ok := raw["payment_method"]; !ok || v == nil { - return fmt.Errorf("field payment_method in P2POrderListRespP2POrderListListElemAdvertDetails: required") + if _, ok := raw["rating"]; raw != nil && !ok { + return fmt.Errorf("field rating in P2POrderListRespP2POrderListListElemReviewDetails: required") } - if v, ok := raw["type"]; !ok || v == nil { - return fmt.Errorf("field type in P2POrderListRespP2POrderListListElemAdvertDetails: required") + if _, ok := raw["recommended"]; raw != nil && !ok { + return fmt.Errorf("field recommended in P2POrderListRespP2POrderListListElemReviewDetails: required") } - type Plain P2POrderListRespP2POrderListListElemAdvertDetails + type Plain P2POrderListRespP2POrderListListElemReviewDetails var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = P2POrderListRespP2POrderListListElemAdvertDetails(plain) + *j = P2POrderListRespP2POrderListListElemReviewDetails(plain) return nil } -// 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 -} +type P2POrderListRespP2POrderListListElemStatus string -var enumValues_P2POrderListRespP2POrderListListElemAdvertDetailsType = []interface{}{ - "buy", - "sell", +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" + +var enumValues_P2POrderListRespP2POrderListListElemStatus = []interface{}{ + "pending", + "buyer-confirmed", + "cancelled", + "timed-out", + "blocked", + "refunded", + "completed", + "disputed", + "dispute-refunded", + "dispute-completed", } // UnmarshalJSON implements json.Unmarshaler. -func (j *P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade) 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_P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade { + 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_P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_P2POrderListRespP2POrderListListElemStatus, v) } - *j = P2POrderListRespP2POrderListListElemAdvertDetailsBlockTrade(v) + *j = P2POrderListRespP2POrderListListElemStatus(v) return nil } -// 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 -} +type P2POrderListRespP2POrderListListElemType string + +const P2POrderListRespP2POrderListListElemTypeBuy P2POrderListRespP2POrderListListElemType = "buy" +const P2POrderListRespP2POrderListListElemTypeSell P2POrderListRespP2POrderListListElemType = "sell" var enumValues_P2POrderListRespP2POrderListListElemType = []interface{}{ "buy", @@ -708,38 +770,6 @@ 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{}{ @@ -767,78 +797,73 @@ 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 v, ok := raw["account_currency"]; !ok || v == nil { + if _, ok := raw["account_currency"]; raw != nil && !ok { return fmt.Errorf("field account_currency in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["advert_details"]; !ok || v == nil { + if _, ok := raw["advert_details"]; raw != nil && !ok { return fmt.Errorf("field advert_details in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["advertiser_details"]; !ok || v == nil { + if _, ok := raw["advertiser_details"]; raw != nil && !ok { return fmt.Errorf("field advertiser_details in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["amount_display"]; !ok || v == nil { + if _, ok := raw["amount_display"]; raw != nil && !ok { return fmt.Errorf("field amount_display in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["chat_channel_url"]; !ok || v == nil { + if _, ok := raw["chat_channel_url"]; raw != nil && !ok { return fmt.Errorf("field chat_channel_url in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["contact_info"]; !ok || v == nil { + if _, ok := raw["contact_info"]; raw != nil && !ok { return fmt.Errorf("field contact_info in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["dispute_details"]; !ok || v == nil { + if _, ok := raw["dispute_details"]; raw != nil && !ok { return fmt.Errorf("field dispute_details in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["expiry_time"]; !ok || v == nil { + if _, ok := raw["expiry_time"]; raw != nil && !ok { return fmt.Errorf("field expiry_time in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["is_incoming"]; !ok || v == nil { + if _, ok := raw["is_incoming"]; raw != nil && !ok { return fmt.Errorf("field is_incoming in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["is_reviewable"]; !ok || v == nil { + if _, ok := raw["is_reviewable"]; raw != nil && !ok { return fmt.Errorf("field is_reviewable in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["local_currency"]; !ok || v == nil { + if _, ok := raw["local_currency"]; raw != nil && !ok { return fmt.Errorf("field local_currency in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["payment_info"]; !ok || v == nil { + if _, ok := raw["payment_info"]; raw != nil && !ok { return fmt.Errorf("field payment_info in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["price_display"]; !ok || v == nil { + if _, ok := raw["price_display"]; raw != nil && !ok { return fmt.Errorf("field price_display in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["rate"]; !ok || v == nil { + if _, ok := raw["rate"]; raw != nil && !ok { return fmt.Errorf("field rate in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["rate_display"]; !ok || v == nil { + if _, ok := raw["rate_display"]; raw != nil && !ok { return fmt.Errorf("field rate_display in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["status"]; !ok || v == nil { + if _, ok := raw["status"]; raw != nil && !ok { return fmt.Errorf("field status in P2POrderListRespP2POrderListListElem: required") } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in P2POrderListRespP2POrderListListElem: required") } type Plain P2POrderListRespP2POrderListListElem @@ -850,33 +875,13 @@ 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 v, ok := raw["list"]; !ok || v == nil { + if _, ok := raw["list"]; raw != nil && !ok { return fmt.Errorf("field list in P2POrderListRespP2POrderList: required") } type Plain P2POrderListRespP2POrderList @@ -901,7 +906,7 @@ func (j *P2POrderListRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2POrderListRespSubscription: required") } type Plain P2POrderListRespSubscription @@ -913,20 +918,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2POrderListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 6e3eda8..29c97a0 100644 --- a/schema/p2p_order_review.go +++ b/schema/p2p_order_review.go @@ -6,6 +6,32 @@ import "encoding/json" import "fmt" import "reflect" +// Creates a review for the specified order. +type P2POrderReview struct { + // [Optional] The login id of the user. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -40,17 +66,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 { @@ -73,45 +99,19 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["order_id"]; !ok || v == nil { + if _, ok := raw["order_id"]; raw != nil && !ok { return fmt.Errorf("field order_id in P2POrderReview: required") } - if v, ok := raw["p2p_order_review"]; !ok || v == nil { + if _, ok := raw["p2p_order_review"]; raw != nil && !ok { return fmt.Errorf("field p2p_order_review in P2POrderReview: required") } - if v, ok := raw["rating"]; !ok || v == nil { + if _, ok := raw["rating"]; raw != nil && !ok { 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 2a86337..86bf043 100644 --- a/schema/p2p_order_review_resp.go +++ b/schema/p2p_order_review_resp.go @@ -29,6 +29,30 @@ 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. @@ -51,17 +75,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 { @@ -84,45 +108,25 @@ 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 v, ok := raw["advertiser_id"]; !ok || v == nil { + if _, ok := raw["advertiser_id"]; raw != nil && !ok { return fmt.Errorf("field advertiser_id in P2POrderReviewRespP2POrderReview: required") } - if v, ok := raw["created_time"]; !ok || v == nil { + if _, ok := raw["created_time"]; raw != nil && !ok { return fmt.Errorf("field created_time in P2POrderReviewRespP2POrderReview: required") } - if v, ok := raw["order_id"]; !ok || v == nil { + if _, ok := raw["order_id"]; raw != nil && !ok { return fmt.Errorf("field order_id in P2POrderReviewRespP2POrderReview: required") } - if v, ok := raw["rating"]; !ok || v == nil { + if _, ok := raw["rating"]; raw != nil && !ok { return fmt.Errorf("field rating in P2POrderReviewRespP2POrderReview: required") } - if v, ok := raw["recommended"]; !ok || v == nil { + if _, ok := raw["recommended"]; raw != nil && !ok { return fmt.Errorf("field recommended in P2POrderReviewRespP2POrderReview: required") } type Plain P2POrderReviewRespP2POrderReview @@ -134,20 +138,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2POrderReviewResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 8482e7c..b55c906 100644 --- a/schema/p2p_payment_methods.go +++ b/schema/p2p_payment_methods.go @@ -6,6 +6,23 @@ import "encoding/json" import "fmt" import "reflect" +// List all P2P payment methods. +type P2PPaymentMethods struct { + // [Optional] The login id of the user. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,23 +49,6 @@ func (j *P2PPaymentMethodsP2PPaymentMethods) UnmarshalJSON(b []byte) error { return nil } -// List all P2P payment methods. -type P2PPaymentMethods struct { - // [Optional] The login id of the user. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_payment_methods"]; !ok || v == nil { + if _, ok := raw["p2p_payment_methods"]; raw != nil && !ok { 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 3784c3b..6a74d2c 100644 --- a/schema/p2p_payment_methods_resp.go +++ b/schema/p2p_payment_methods_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PPaymentMethodsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 c620683..c41dc50 100644 --- a/schema/p2p_ping.go +++ b/schema/p2p_ping.go @@ -6,6 +6,24 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -32,24 +50,6 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_ping"]; !ok || v == nil { + if _, ok := raw["p2p_ping"]; raw != nil && !ok { 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 8aa81ab..6238da6 100644 --- a/schema/p2p_ping_resp.go +++ b/schema/p2p_ping_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,10 +53,10 @@ func (j *P2PPingRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const P2PPingRespMsgTypeP2PPing P2PPingRespMsgType = "p2p_ping" - type P2PPingRespP2PPing string +const P2PPingRespP2PPingPong P2PPingRespP2PPing = "pong" + var enumValues_P2PPingRespP2PPing = []interface{}{ "pong", } @@ -63,34 +81,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PPingResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 9fd0933..e02605c 100644 --- a/schema/p2p_settings.go +++ b/schema/p2p_settings.go @@ -6,6 +6,27 @@ import "encoding/json" import "fmt" import "reflect" +// Request P2P Settings information. +type P2PSettings struct { + // [Optional] The login id of the user. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -62,34 +83,13 @@ func (j *P2PSettingsSubscribe) UnmarshalJSON(b []byte) error { return nil } -// Request P2P Settings information. -type P2PSettings struct { - // [Optional] The login id of the user. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["p2p_settings"]; !ok || v == nil { + if _, ok := raw["p2p_settings"]; raw != nil && !ok { 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 b563249..5d67dda 100644 --- a/schema/p2p_settings_resp.go +++ b/schema/p2p_settings_resp.go @@ -6,11 +6,32 @@ 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", } @@ -35,7 +56,98 @@ func (j *P2PSettingsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const P2PSettingsRespMsgTypeP2PSettings P2PSettingsRespMsgType = "p2p_settings" +// 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"` + + // 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"` +} type P2PSettingsRespP2PSettingsBlockTradeDisabled int @@ -64,15 +176,6 @@ 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. @@ -91,13 +194,13 @@ func (j *P2PSettingsRespP2PSettingsCounterpartyTermSteps) UnmarshalJSON(b []byte if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["completion_rate"]; !ok || v == nil { + if _, ok := raw["completion_rate"]; raw != nil && !ok { return fmt.Errorf("field completion_rate in P2PSettingsRespP2PSettingsCounterpartyTermSteps: required") } - if v, ok := raw["join_days"]; !ok || v == nil { + if _, ok := raw["join_days"]; raw != nil && !ok { return fmt.Errorf("field join_days in P2PSettingsRespP2PSettingsCounterpartyTermSteps: required") } - if v, ok := raw["rating"]; !ok || v == nil { + if _, ok := raw["rating"]; raw != nil && !ok { return fmt.Errorf("field rating in P2PSettingsRespP2PSettingsCounterpartyTermSteps: required") } type Plain P2PSettingsRespP2PSettingsCounterpartyTermSteps @@ -165,6 +268,10 @@ 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", @@ -191,12 +298,12 @@ func (j *P2PSettingsRespP2PSettingsFixedRateAdverts) UnmarshalJSON(b []byte) err return nil } -const P2PSettingsRespP2PSettingsFixedRateAdvertsDisabled P2PSettingsRespP2PSettingsFixedRateAdverts = "disabled" -const P2PSettingsRespP2PSettingsFixedRateAdvertsEnabled P2PSettingsRespP2PSettingsFixedRateAdverts = "enabled" -const P2PSettingsRespP2PSettingsFixedRateAdvertsListOnly P2PSettingsRespP2PSettingsFixedRateAdverts = "list_only" - type P2PSettingsRespP2PSettingsFloatRateAdverts string +const P2PSettingsRespP2PSettingsFloatRateAdvertsDisabled P2PSettingsRespP2PSettingsFloatRateAdverts = "disabled" +const P2PSettingsRespP2PSettingsFloatRateAdvertsEnabled P2PSettingsRespP2PSettingsFloatRateAdverts = "enabled" +const P2PSettingsRespP2PSettingsFloatRateAdvertsListOnly P2PSettingsRespP2PSettingsFloatRateAdverts = "list_only" + var enumValues_P2PSettingsRespP2PSettingsFloatRateAdverts = []interface{}{ "disabled", "enabled", @@ -223,9 +330,20 @@ func (j *P2PSettingsRespP2PSettingsFloatRateAdverts) UnmarshalJSON(b []byte) err return nil } -const P2PSettingsRespP2PSettingsFloatRateAdvertsDisabled P2PSettingsRespP2PSettingsFloatRateAdverts = "disabled" -const P2PSettingsRespP2PSettingsFloatRateAdvertsEnabled P2PSettingsRespP2PSettingsFloatRateAdverts = "enabled" -const P2PSettingsRespP2PSettingsFloatRateAdvertsListOnly P2PSettingsRespP2PSettingsFloatRateAdverts = "list_only" +// 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"` +} type P2PSettingsRespP2PSettingsLocalCurrenciesElemHasAdverts int @@ -280,34 +398,19 @@ 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 v, ok := raw["display_name"]; !ok || v == nil { + if _, ok := raw["display_name"]; raw != nil && !ok { return fmt.Errorf("field display_name in P2PSettingsRespP2PSettingsLocalCurrenciesElem: required") } - if v, ok := raw["has_adverts"]; !ok || v == nil { + if _, ok := raw["has_adverts"]; raw != nil && !ok { return fmt.Errorf("field has_adverts in P2PSettingsRespP2PSettingsLocalCurrenciesElem: required") } - if v, ok := raw["symbol"]; !ok || v == nil { + if _, ok := raw["symbol"]; raw != nil && !ok { return fmt.Errorf("field symbol in P2PSettingsRespP2PSettingsLocalCurrenciesElem: required") } type Plain P2PSettingsRespP2PSettingsLocalCurrenciesElem @@ -346,157 +449,73 @@ 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"` - - // 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 v, ok := raw["adverts_active_limit"]; !ok || v == nil { + if _, ok := raw["adverts_active_limit"]; raw != nil && !ok { return fmt.Errorf("field adverts_active_limit in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["block_trade"]; !ok || v == nil { + if _, ok := raw["block_trade"]; raw != nil && !ok { return fmt.Errorf("field block_trade in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["cancellation_block_duration"]; !ok || v == nil { + if _, ok := raw["cancellation_block_duration"]; raw != nil && !ok { return fmt.Errorf("field cancellation_block_duration in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["cancellation_count_period"]; !ok || v == nil { + if _, ok := raw["cancellation_count_period"]; raw != nil && !ok { return fmt.Errorf("field cancellation_count_period in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["cancellation_grace_period"]; !ok || v == nil { + if _, ok := raw["cancellation_grace_period"]; raw != nil && !ok { return fmt.Errorf("field cancellation_grace_period in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["cancellation_limit"]; !ok || v == nil { + if _, ok := raw["cancellation_limit"]; raw != nil && !ok { return fmt.Errorf("field cancellation_limit in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["cross_border_ads_enabled"]; !ok || v == nil { + if _, ok := raw["cross_border_ads_enabled"]; raw != nil && !ok { return fmt.Errorf("field cross_border_ads_enabled in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["disabled"]; !ok || v == nil { + if _, ok := raw["disabled"]; raw != nil && !ok { return fmt.Errorf("field disabled in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["feature_level"]; !ok || v == nil { + if _, ok := raw["feature_level"]; raw != nil && !ok { return fmt.Errorf("field feature_level in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["fixed_rate_adverts"]; !ok || v == nil { + if _, ok := raw["fixed_rate_adverts"]; raw != nil && !ok { return fmt.Errorf("field fixed_rate_adverts in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["float_rate_adverts"]; !ok || v == nil { + if _, ok := raw["float_rate_adverts"]; raw != nil && !ok { return fmt.Errorf("field float_rate_adverts in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["float_rate_offset_limit"]; !ok || v == nil { + if _, ok := raw["float_rate_offset_limit"]; raw != nil && !ok { return fmt.Errorf("field float_rate_offset_limit in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["local_currencies"]; !ok || v == nil { + if _, ok := raw["local_currencies"]; raw != nil && !ok { return fmt.Errorf("field local_currencies in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["maximum_advert_amount"]; !ok || v == nil { + if _, ok := raw["maximum_advert_amount"]; raw != nil && !ok { return fmt.Errorf("field maximum_advert_amount in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["maximum_order_amount"]; !ok || v == nil { + if _, ok := raw["maximum_order_amount"]; raw != nil && !ok { return fmt.Errorf("field maximum_order_amount in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["order_daily_limit"]; !ok || v == nil { + if _, ok := raw["order_daily_limit"]; raw != nil && !ok { return fmt.Errorf("field order_daily_limit in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["order_expiry_options"]; !ok || v == nil { + if _, ok := raw["order_expiry_options"]; raw != nil && !ok { return fmt.Errorf("field order_expiry_options in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["order_payment_period"]; !ok || v == nil { + if _, ok := raw["order_payment_period"]; raw != nil && !ok { return fmt.Errorf("field order_payment_period in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["payment_methods_enabled"]; !ok || v == nil { + if _, ok := raw["payment_methods_enabled"]; raw != nil && !ok { return fmt.Errorf("field payment_methods_enabled in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["review_period"]; !ok || v == nil { + if _, ok := raw["review_period"]; raw != nil && !ok { return fmt.Errorf("field review_period in P2PSettingsRespP2PSettings: required") } - if v, ok := raw["supported_currencies"]; !ok || v == nil { + if _, ok := raw["supported_currencies"]; raw != nil && !ok { return fmt.Errorf("field supported_currencies in P2PSettingsRespP2PSettings: required") } type Plain P2PSettingsRespP2PSettings @@ -521,7 +540,7 @@ func (j *P2PSettingsRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in P2PSettingsRespSubscription: required") } type Plain P2PSettingsRespSubscription @@ -533,35 +552,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in P2PSettingsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 2257581..5066b59 100644 --- a/schema/payment_methods.go +++ b/schema/payment_methods.go @@ -6,6 +6,27 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -36,34 +57,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["payment_methods"]; !ok || v == nil { + if _, ok := raw["payment_methods"]; raw != nil && !ok { 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 c72d6e3..8a25d75 100644 --- a/schema/payment_methods_resp.go +++ b/schema/payment_methods_resp.go @@ -6,11 +6,30 @@ 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", } @@ -35,8 +54,6 @@ 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. @@ -91,43 +108,43 @@ func (j *PaymentMethodsRespPaymentMethodsElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["deposit_limits"]; !ok || v == nil { + if _, ok := raw["deposit_limits"]; raw != nil && !ok { return fmt.Errorf("field deposit_limits in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["deposit_time"]; !ok || v == nil { + if _, ok := raw["deposit_time"]; raw != nil && !ok { return fmt.Errorf("field deposit_time in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["description"]; !ok || v == nil { + if _, ok := raw["description"]; raw != nil && !ok { return fmt.Errorf("field description in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["display_name"]; !ok || v == nil { + if _, ok := raw["display_name"]; raw != nil && !ok { return fmt.Errorf("field display_name in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["payment_processor"]; !ok || v == nil { + if _, ok := raw["payment_processor"]; raw != nil && !ok { return fmt.Errorf("field payment_processor in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["predefined_amounts"]; !ok || v == nil { + if _, ok := raw["predefined_amounts"]; raw != nil && !ok { return fmt.Errorf("field predefined_amounts in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["signup_link"]; !ok || v == nil { + if _, ok := raw["signup_link"]; raw != nil && !ok { return fmt.Errorf("field signup_link in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["supported_currencies"]; !ok || v == nil { + if _, ok := raw["supported_currencies"]; raw != nil && !ok { return fmt.Errorf("field supported_currencies in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["type_display_name"]; !ok || v == nil { + if _, ok := raw["type_display_name"]; raw != nil && !ok { return fmt.Errorf("field type_display_name in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["withdraw_limits"]; !ok || v == nil { + if _, ok := raw["withdraw_limits"]; raw != nil && !ok { return fmt.Errorf("field withdraw_limits in PaymentMethodsRespPaymentMethodsElem: required") } - if v, ok := raw["withdrawal_time"]; !ok || v == nil { + if _, ok := raw["withdrawal_time"]; raw != nil && !ok { return fmt.Errorf("field withdrawal_time in PaymentMethodsRespPaymentMethodsElem: required") } type Plain PaymentMethodsRespPaymentMethodsElem @@ -139,33 +156,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PaymentMethodsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 ba7660b..a6edc1b 100644 --- a/schema/paymentagent_create.go +++ b/schema/paymentagent_create.go @@ -6,6 +6,53 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -73,7 +120,7 @@ func (j *PaymentagentCreatePhoneNumbersElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["phone_number"]; !ok || v == nil { + if _, ok := raw["phone_number"]; raw != nil && !ok { return fmt.Errorf("field phone_number in PaymentagentCreatePhoneNumbersElem: required") } type Plain PaymentagentCreatePhoneNumbersElem @@ -96,7 +143,7 @@ func (j *PaymentagentCreateSupportedPaymentMethodsElem) UnmarshalJSON(b []byte) if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["payment_method"]; !ok || v == nil { + if _, ok := raw["payment_method"]; raw != nil && !ok { return fmt.Errorf("field payment_method in PaymentagentCreateSupportedPaymentMethodsElem: required") } type Plain PaymentagentCreateSupportedPaymentMethodsElem @@ -119,7 +166,7 @@ func (j *PaymentagentCreateUrlsElem) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["url"]; !ok || v == nil { + if _, ok := raw["url"]; raw != nil && !ok { return fmt.Errorf("field url in PaymentagentCreateUrlsElem: required") } type Plain PaymentagentCreateUrlsElem @@ -131,84 +178,37 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["code_of_conduct_approval"]; !ok || v == nil { + if _, ok := raw["code_of_conduct_approval"]; raw != nil && !ok { return fmt.Errorf("field code_of_conduct_approval in PaymentagentCreate: required") } - if v, ok := raw["commission_deposit"]; !ok || v == nil { + if _, ok := raw["commission_deposit"]; raw != nil && !ok { return fmt.Errorf("field commission_deposit in PaymentagentCreate: required") } - if v, ok := raw["commission_withdrawal"]; !ok || v == nil { + if _, ok := raw["commission_withdrawal"]; raw != nil && !ok { return fmt.Errorf("field commission_withdrawal in PaymentagentCreate: required") } - if v, ok := raw["email"]; !ok || v == nil { + if _, ok := raw["email"]; raw != nil && !ok { return fmt.Errorf("field email in PaymentagentCreate: required") } - if v, ok := raw["information"]; !ok || v == nil { + if _, ok := raw["information"]; raw != nil && !ok { return fmt.Errorf("field information in PaymentagentCreate: required") } - if v, ok := raw["payment_agent_name"]; !ok || v == nil { + if _, ok := raw["payment_agent_name"]; raw != nil && !ok { return fmt.Errorf("field payment_agent_name in PaymentagentCreate: required") } - if v, ok := raw["paymentagent_create"]; !ok || v == nil { + if _, ok := raw["paymentagent_create"]; raw != nil && !ok { return fmt.Errorf("field paymentagent_create in PaymentagentCreate: required") } - if v, ok := raw["supported_payment_methods"]; !ok || v == nil { + if _, ok := raw["supported_payment_methods"]; raw != nil && !ok { return fmt.Errorf("field supported_payment_methods in PaymentagentCreate: required") } - if v, ok := raw["urls"]; !ok || v == nil { + if _, ok := raw["urls"]; raw != nil && !ok { 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 6a24eea..307727e 100644 --- a/schema/paymentagent_create_resp.go +++ b/schema/paymentagent_create_resp.go @@ -6,11 +6,26 @@ 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", } @@ -35,31 +50,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PaymentagentCreateResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 7eaf5b9..0c0dcc2 100644 --- a/schema/paymentagent_details.go +++ b/schema/paymentagent_details.go @@ -6,6 +6,23 @@ import "encoding/json" import "fmt" import "reflect" +// Gets client's payment agent details. +type PaymentagentDetails struct { + // [Optional] The login id of the user. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -36,30 +53,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["paymentagent_details"]; !ok || v == nil { + if _, ok := raw["paymentagent_details"]; raw != nil && !ok { 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 bc0c87f..df811af 100644 --- a/schema/paymentagent_details_resp.go +++ b/schema/paymentagent_details_resp.go @@ -33,6 +33,30 @@ 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{} @@ -98,60 +122,60 @@ type PaymentagentDetailsRespPaymentagentDetails struct { type PaymentagentDetailsRespPaymentagentDetailsCanApply int -type PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval int - -type PaymentagentDetailsRespPaymentagentDetailsNewlyAuthorized int - -type PaymentagentDetailsRespPaymentagentDetailsPhoneNumbersElem struct { - // A phone number. - PhoneNumber *string `json:"phone_number,omitempty"` -} - -var enumValues_PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval = []interface{}{ +var enumValues_PaymentagentDetailsRespPaymentagentDetailsCanApply = []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 PaymentagentDetailsRespPaymentagentDetailsCodeOfConductApproval int + +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 PaymentagentDetailsRespPaymentagentDetailsNewlyAuthorized int + var enumValues_PaymentagentDetailsRespPaymentagentDetailsNewlyAuthorized = []interface{}{ 0, 1, @@ -177,6 +201,11 @@ 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"` @@ -187,38 +216,13 @@ 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 v, ok := raw["can_apply"]; !ok || v == nil { + if _, ok := raw["can_apply"]; raw != nil && !ok { return fmt.Errorf("field can_apply in PaymentagentDetailsRespPaymentagentDetails: required") } type Plain PaymentagentDetailsRespPaymentagentDetails @@ -230,20 +234,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PaymentagentDetailsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 b1453a8..20a9124 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 v, ok := raw["paymentagent_list"]; !ok || v == nil { + if _, ok := raw["paymentagent_list"]; raw != nil && !ok { 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 d42eea2..beab941 100644 --- a/schema/paymentagent_list_resp.go +++ b/schema/paymentagent_list_resp.go @@ -29,6 +29,30 @@ 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. @@ -100,43 +124,43 @@ func (j *PaymentagentListRespPaymentagentListListElem) UnmarshalJSON(b []byte) e if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["currencies"]; !ok || v == nil { + if _, ok := raw["currencies"]; raw != nil && !ok { return fmt.Errorf("field currencies in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["deposit_commission"]; !ok || v == nil { + if _, ok := raw["deposit_commission"]; raw != nil && !ok { return fmt.Errorf("field deposit_commission in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["email"]; !ok || v == nil { + if _, ok := raw["email"]; raw != nil && !ok { return fmt.Errorf("field email in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["further_information"]; !ok || v == nil { + if _, ok := raw["further_information"]; raw != nil && !ok { return fmt.Errorf("field further_information in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["max_withdrawal"]; !ok || v == nil { + if _, ok := raw["max_withdrawal"]; raw != nil && !ok { return fmt.Errorf("field max_withdrawal in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["min_withdrawal"]; !ok || v == nil { + if _, ok := raw["min_withdrawal"]; raw != nil && !ok { return fmt.Errorf("field min_withdrawal in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["paymentagent_loginid"]; !ok || v == nil { + if _, ok := raw["paymentagent_loginid"]; raw != nil && !ok { return fmt.Errorf("field paymentagent_loginid in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["phone_numbers"]; !ok || v == nil { + if _, ok := raw["phone_numbers"]; raw != nil && !ok { return fmt.Errorf("field phone_numbers in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["summary"]; !ok || v == nil { + if _, ok := raw["summary"]; raw != nil && !ok { return fmt.Errorf("field summary in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["supported_payment_methods"]; !ok || v == nil { + if _, ok := raw["supported_payment_methods"]; raw != nil && !ok { return fmt.Errorf("field supported_payment_methods in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["urls"]; !ok || v == nil { + if _, ok := raw["urls"]; raw != nil && !ok { return fmt.Errorf("field urls in PaymentagentListRespPaymentagentListListElem: required") } - if v, ok := raw["withdrawal_commission"]; !ok || v == nil { + if _, ok := raw["withdrawal_commission"]; raw != nil && !ok { return fmt.Errorf("field withdrawal_commission in PaymentagentListRespPaymentagentListListElem: required") } type Plain PaymentagentListRespPaymentagentListListElem @@ -148,33 +172,13 @@ 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 v, ok := raw["list"]; !ok || v == nil { + if _, ok := raw["list"]; raw != nil && !ok { return fmt.Errorf("field list in PaymentagentListRespPaymentagentList: required") } type Plain PaymentagentListRespPaymentagentList @@ -186,20 +190,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PaymentagentListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 e13da1c..7648f22 100644 --- a/schema/paymentagent_transfer.go +++ b/schema/paymentagent_transfer.go @@ -6,6 +6,39 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -63,55 +96,22 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in PaymentagentTransfer: required") } - if v, ok := raw["currency"]; !ok || v == nil { + if _, ok := raw["currency"]; raw != nil && !ok { return fmt.Errorf("field currency in PaymentagentTransfer: required") } - if v, ok := raw["paymentagent_transfer"]; !ok || v == nil { + if _, ok := raw["paymentagent_transfer"]; raw != nil && !ok { return fmt.Errorf("field paymentagent_transfer in PaymentagentTransfer: required") } - if v, ok := raw["transfer_to"]; !ok || v == nil { + if _, ok := raw["transfer_to"]; raw != nil && !ok { 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 c667655..49cca71 100644 --- a/schema/paymentagent_transfer_resp.go +++ b/schema/paymentagent_transfer_resp.go @@ -6,11 +6,38 @@ 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", } @@ -35,8 +62,6 @@ func (j *PaymentagentTransferRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const PaymentagentTransferRespMsgTypePaymentagentTransfer PaymentagentTransferRespMsgType = "paymentagent_transfer" - type PaymentagentTransferRespPaymentagentTransfer int var enumValues_PaymentagentTransferRespPaymentagentTransfer = []interface{}{ @@ -64,41 +89,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PaymentagentTransferResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 df87bd4..25df12f 100644 --- a/schema/paymentagent_withdraw.go +++ b/schema/paymentagent_withdraw.go @@ -6,6 +6,43 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -63,62 +100,25 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["amount"]; !ok || v == nil { + if _, ok := raw["amount"]; raw != nil && !ok { return fmt.Errorf("field amount in PaymentagentWithdraw: required") } - if v, ok := raw["currency"]; !ok || v == nil { + if _, ok := raw["currency"]; raw != nil && !ok { return fmt.Errorf("field currency in PaymentagentWithdraw: required") } - if v, ok := raw["paymentagent_loginid"]; !ok || v == nil { + if _, ok := raw["paymentagent_loginid"]; raw != nil && !ok { return fmt.Errorf("field paymentagent_loginid in PaymentagentWithdraw: required") } - if v, ok := raw["paymentagent_withdraw"]; !ok || v == nil { + if _, ok := raw["paymentagent_withdraw"]; raw != nil && !ok { return fmt.Errorf("field paymentagent_withdraw in PaymentagentWithdraw: required") } - if v, ok := raw["verification_code"]; !ok || v == nil { + if _, ok := raw["verification_code"]; raw != nil && !ok { 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 4567018..539fa38 100644 --- a/schema/paymentagent_withdraw_justification.go +++ b/schema/paymentagent_withdraw_justification.go @@ -6,6 +6,26 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -36,33 +56,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["paymentagent_withdraw_justification"]; !ok || v == nil { + if _, ok := raw["paymentagent_withdraw_justification"]; raw != nil && !ok { 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 2c498a1..2e237d5 100644 --- a/schema/paymentagent_withdraw_justification_resp.go +++ b/schema/paymentagent_withdraw_justification_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PaymentagentWithdrawJustificationResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 d2af56e..8639d12 100644 --- a/schema/paymentagent_withdraw_resp.go +++ b/schema/paymentagent_withdraw_resp.go @@ -6,11 +6,35 @@ 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", } @@ -35,8 +59,6 @@ func (j *PaymentagentWithdrawRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const PaymentagentWithdrawRespMsgTypePaymentagentWithdraw PaymentagentWithdrawRespMsgType = "paymentagent_withdraw" - type PaymentagentWithdrawRespPaymentagentWithdraw int var enumValues_PaymentagentWithdrawRespPaymentagentWithdraw = []interface{}{ @@ -64,38 +86,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PaymentagentWithdrawResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 4eddb40..11a9a5f 100644 --- a/schema/payout_currencies.go +++ b/schema/payout_currencies.go @@ -6,6 +6,24 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -36,31 +54,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["payout_currencies"]; !ok || v == nil { + if _, ok := raw["payout_currencies"]; raw != nil && !ok { 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 fc7e191..0cc0c3e 100644 --- a/schema/payout_currencies_resp.go +++ b/schema/payout_currencies_resp.go @@ -6,11 +6,30 @@ 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", } @@ -35,35 +54,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PayoutCurrenciesResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in PayoutCurrenciesResp: required") } type Plain PayoutCurrenciesResp diff --git a/schema/ping.go b/schema/ping.go index 8f81fdb..def60e7 100644 --- a/schema/ping.go +++ b/schema/ping.go @@ -6,6 +6,20 @@ 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{} @@ -36,27 +50,13 @@ 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 v, ok := raw["ping"]; !ok || v == nil { + if _, ok := raw["ping"]; raw != nil && !ok { return fmt.Errorf("field ping in Ping: required") } type Plain Ping diff --git a/schema/ping_resp.go b/schema/ping_resp.go index 8b383ab..08740dc 100644 --- a/schema/ping_resp.go +++ b/schema/ping_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,10 +53,10 @@ func (j *PingRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const PingRespMsgTypePing PingRespMsgType = "ping" - type PingRespPing string +const PingRespPingPong PingRespPing = "pong" + var enumValues_PingRespPing = []interface{}{ "pong", } @@ -63,34 +81,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PingResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in PingResp: required") } type Plain PingResp diff --git a/schema/portfolio.go b/schema/portfolio.go index 2bb9728..683047d 100644 --- a/schema/portfolio.go +++ b/schema/portfolio.go @@ -67,6 +67,47 @@ 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 @@ -117,54 +158,13 @@ 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 v, ok := raw["portfolio"]; !ok || v == nil { + if _, ok := raw["portfolio"]; raw != nil && !ok { return fmt.Errorf("field portfolio in Portfolio: required") } type Plain Portfolio diff --git a/schema/portfolio_resp.go b/schema/portfolio_resp.go index 2d8e5bd..9e0a159 100644 --- a/schema/portfolio_resp.go +++ b/schema/portfolio_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ 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. @@ -93,7 +109,7 @@ func (j *PortfolioRespPortfolio) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["contracts"]; !ok || v == nil { + if _, ok := raw["contracts"]; raw != nil && !ok { return fmt.Errorf("field contracts in PortfolioRespPortfolio: required") } type Plain PortfolioRespPortfolio @@ -105,32 +121,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in PortfolioResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 29e87e9..5343bc7 100644 --- a/schema/profit_table.go +++ b/schema/profit_table.go @@ -85,59 +85,100 @@ const ProfitTableContractTypeElemUPORDOWN ProfitTableContractTypeElem = "UPORDOW const ProfitTableContractTypeElemVANILLALONGCALL ProfitTableContractTypeElem = "VANILLALONGCALL" const ProfitTableContractTypeElemVANILLALONGPUT ProfitTableContractTypeElem = "VANILLALONGPUT" -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 +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 *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 } +type ProfitTableDescription int + var enumValues_ProfitTableDescription = []interface{}{ 0, 1, } // 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 } +// [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, } @@ -164,6 +205,9 @@ func (j *ProfitTableProfitTable) UnmarshalJSON(b []byte) error { type ProfitTableSort string +const ProfitTableSortASC ProfitTableSort = "ASC" +const ProfitTableSortDESC ProfitTableSort = "DESC" + var enumValues_ProfitTableSort = []interface{}{ "ASC", "DESC", @@ -189,57 +233,13 @@ 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 v, ok := raw["profit_table"]; !ok || v == nil { + if _, ok := raw["profit_table"]; raw != nil && !ok { 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 30b4156..1ff400a 100644 --- a/schema/profit_table_resp.go +++ b/schema/profit_table_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ProfitTableResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in ProfitTableResp: required") } type Plain ProfitTableResp diff --git a/schema/proposal.go b/schema/proposal.go index ed2cbc6..5f65a57 100644 --- a/schema/proposal.go +++ b/schema/proposal.go @@ -109,11 +109,62 @@ 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" @@ -155,48 +206,6 @@ 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", @@ -237,37 +246,43 @@ 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 *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 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 @@ -288,26 +303,53 @@ 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 *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 ProposalProposal int + var enumValues_ProposalProposal = []interface{}{ 1, } @@ -332,25 +374,7 @@ func (j *ProposalProposal) UnmarshalJSON(b []byte) error { return nil } -// 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 ProposalSubscribe int var enumValues_ProposalSubscribe = []interface{}{ 1, @@ -376,42 +400,22 @@ 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 v, ok := raw["contract_type"]; !ok || v == nil { + if _, ok := raw["contract_type"]; raw != nil && !ok { return fmt.Errorf("field contract_type in Proposal: required") } - if v, ok := raw["currency"]; !ok || v == nil { + if _, ok := raw["currency"]; raw != nil && !ok { return fmt.Errorf("field currency in Proposal: required") } - if v, ok := raw["proposal"]; !ok || v == nil { + if _, ok := raw["proposal"]; raw != nil && !ok { return fmt.Errorf("field proposal in Proposal: required") } - if v, ok := raw["symbol"]; !ok || v == nil { + if _, ok := raw["symbol"]; raw != nil && !ok { 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 e5d2ce5..a009de8 100644 --- a/schema/proposal_open_contract.go +++ b/schema/proposal_open_contract.go @@ -6,6 +6,30 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -62,37 +86,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["proposal_open_contract"]; !ok || v == nil { + if _, ok := raw["proposal_open_contract"]; raw != nil && !ok { 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 9bf7d79..41757a5 100644 --- a/schema/proposal_open_contract_resp.go +++ b/schema/proposal_open_contract_resp.go @@ -6,86 +6,6 @@ import "encoding/json" import "fmt" import "reflect" -// UnmarshalJSON implements json.Unmarshaler. -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_ProposalOpenContractRespProposalOpenContractIsSettleable { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable, v) - } - *j = ProposalOpenContractRespProposalOpenContractIsSettleable(v) - return nil -} - -type ProposalOpenContractRespProposalOpenContractIsForwardStarting int - -// 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 v, ok := raw["echo_req"]; !ok || v == nil { - return fmt.Errorf("field echo_req in ProposalOpenContractResp: required") - } - type Plain ProposalOpenContractResp - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = ProposalOpenContractResp(plain) - return nil -} - -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ProposalOpenContractRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespMsgType, v) - } - *j = ProposalOpenContractRespMsgType(v) - return nil -} - -const ProposalOpenContractRespMsgTypeProposalOpenContract ProposalOpenContractRespMsgType = "proposal_open_contract" - -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"` -} - // Latest price and other details for an open contract in the user's portfolio type ProposalOpenContractResp struct { // Echo of the request made. @@ -105,87 +25,37 @@ type ProposalOpenContractResp struct { Subscription *ProposalOpenContractRespSubscription `json:"subscription,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"` -} - -// 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"` -} - -// Contains information about contract cancellation option. -type ProposalOpenContractRespProposalOpenContractCancellation struct { - // Ask price of contract cancellation option. - AskPrice *float64 `json:"ask_price,omitempty"` +// Echo of the request made. +type ProposalOpenContractRespEchoReq map[string]interface{} - // Expiry time in epoch for contract cancellation option. - DateExpiry *int `json:"date_expiry,omitempty"` -} +type ProposalOpenContractRespMsgType string -type ProposalOpenContractRespProposalOpenContractIsExpired int +const ProposalOpenContractRespMsgTypeProposalOpenContract ProposalOpenContractRespMsgType = "proposal_open_contract" -// UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespSubscription) 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 ProposalOpenContractRespSubscription: required") - } - type Plain ProposalOpenContractRespSubscription - var plain Plain - if err := json.Unmarshal(b, &plain); err != nil { - return err - } - *j = ProposalOpenContractRespSubscription(plain) - return nil +var enumValues_ProposalOpenContractRespMsgType = []interface{}{ + "proposal_open_contract", } // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsExpired) UnmarshalJSON(b []byte) error { - var v int +func (j *ProposalOpenContractRespMsgType) UnmarshalJSON(b []byte) error { + var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_ProposalOpenContractRespProposalOpenContractIsExpired { + for _, expected := range enumValues_ProposalOpenContractRespMsgType { 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_ProposalOpenContractRespMsgType, v) } - *j = ProposalOpenContractRespProposalOpenContractIsExpired(v) + *j = ProposalOpenContractRespMsgType(v) return nil } -type ProposalOpenContractRespMsgType string - // Latest price and other details for an open contract type ProposalOpenContractRespProposalOpenContract struct { // Account Id @@ -432,51 +302,140 @@ type ProposalOpenContractRespProposalOpenContract struct { ValidationErrorCode *string `json:"validation_error_code,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{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsForwardStarting) UnmarshalJSON(b []byte) error { +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_ProposalOpenContractRespProposalOpenContractIsForwardStarting { + 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_ProposalOpenContractRespProposalOpenContractIsForwardStarting, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsExpired, v) } - *j = ProposalOpenContractRespProposalOpenContractIsForwardStarting(v) + *j = ProposalOpenContractRespProposalOpenContractIsExpired(v) return nil } +type ProposalOpenContractRespProposalOpenContractIsForwardStarting int + +var enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting = []interface{}{ + 0, + 1, +} + // 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 { +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_ProposalOpenContractRespProposalOpenContractStatus { - if reflect.DeepEqual(v.Value, expected) { + 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_ProposalOpenContractRespProposalOpenContractStatus, v.Value) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting, v) } - *j = ProposalOpenContractRespProposalOpenContractStatus(v) + *j = ProposalOpenContractRespProposalOpenContractIsForwardStarting(v) return nil } -// MarshalJSON implements json.Marshaler. -func (j *ProposalOpenContractRespProposalOpenContractStatus) MarshalJSON() ([]byte, error) { - return json.Marshal(j.Value) +type ProposalOpenContractRespProposalOpenContractIsIntraday int + +var enumValues_ProposalOpenContractRespProposalOpenContractIsIntraday = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. @@ -499,118 +458,140 @@ func (j *ProposalOpenContractRespProposalOpenContractIsIntraday) UnmarshalJSON(b return nil } +type ProposalOpenContractRespProposalOpenContractIsPathDependent int + +var enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsValidToSell) UnmarshalJSON(b []byte) error { +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_ProposalOpenContractRespProposalOpenContractIsValidToSell { + 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_ProposalOpenContractRespProposalOpenContractIsValidToSell, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent, v) } - *j = ProposalOpenContractRespProposalOpenContractIsValidToSell(v) + *j = ProposalOpenContractRespProposalOpenContractIsPathDependent(v) return nil } -// Echo of the request made. -type ProposalOpenContractRespEchoReq map[string]interface{} +type ProposalOpenContractRespProposalOpenContractIsSettleable int + +var enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable = []interface{}{ + 0, + 1, +} // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsPathDependent) 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_ProposalOpenContractRespProposalOpenContractIsPathDependent { + 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_ProposalOpenContractRespProposalOpenContractIsPathDependent, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable, v) } - *j = ProposalOpenContractRespProposalOpenContractIsPathDependent(v) + *j = ProposalOpenContractRespProposalOpenContractIsSettleable(v) return nil } +type ProposalOpenContractRespProposalOpenContractIsSold int + +var enumValues_ProposalOpenContractRespProposalOpenContractIsSold = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsValidToCancel) 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_ProposalOpenContractRespProposalOpenContractIsValidToCancel { + 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_ProposalOpenContractRespProposalOpenContractIsValidToCancel, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsSold, v) } - *j = ProposalOpenContractRespProposalOpenContractIsValidToCancel(v) + *j = ProposalOpenContractRespProposalOpenContractIsSold(v) return nil } +type ProposalOpenContractRespProposalOpenContractIsValidToCancel int + +var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel = []interface{}{ + 0, + 1, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *ProposalOpenContractRespProposalOpenContractIsSold) 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_ProposalOpenContractRespProposalOpenContractIsSold { + 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_ProposalOpenContractRespProposalOpenContractIsSold, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel, v) } - *j = ProposalOpenContractRespProposalOpenContractIsSold(v) + *j = ProposalOpenContractRespProposalOpenContractIsValidToCancel(v) return nil } -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"` +type ProposalOpenContractRespProposalOpenContractIsValidToSell int - // The spot value with the correct precision at the given epoch. - TickDisplayValue *string `json:"tick_display_value,omitempty"` +var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell = []interface{}{ + 0, + 1, } -type ProposalOpenContractRespProposalOpenContractIsIntraday int - -type ProposalOpenContractRespProposalOpenContractIsPathDependent int - -type ProposalOpenContractRespProposalOpenContractIsSettleable int - -type ProposalOpenContractRespProposalOpenContractIsSold int - -type ProposalOpenContractRespProposalOpenContractIsValidToCancel int - -type ProposalOpenContractRespProposalOpenContractIsValidToSell int +// UnmarshalJSON implements json.Unmarshaler. +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_ProposalOpenContractRespProposalOpenContractIsValidToSell { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell, v) + } + *j = ProposalOpenContractRespProposalOpenContractIsValidToSell(v) + return nil +} // Orders are applicable to `MULTUP` and `MULTDOWN` contracts only. type ProposalOpenContractRespProposalOpenContractLimitOrder struct { @@ -679,6 +660,42 @@ type ProposalOpenContractRespProposalOpenContractStatus struct { Value interface{} } +// MarshalJSON implements json.Marshaler. +func (j *ProposalOpenContractRespProposalOpenContractStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(j.Value) +} + +var enumValues_ProposalOpenContractRespProposalOpenContractStatus = []interface{}{ + "open", + "sold", + "won", + "lost", + "cancelled", + nil, +} + +// 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 +} + type ProposalOpenContractRespProposalOpenContractTickStreamElem struct { // Epoch time of a tick or the contract start or end time. Epoch *int `json:"epoch,omitempty"` @@ -709,46 +726,38 @@ type ProposalOpenContractRespSubscription struct { Id string `json:"id"` } -var enumValues_ProposalOpenContractRespMsgType = []interface{}{ - "proposal_open_contract", -} -var enumValues_ProposalOpenContractRespProposalOpenContractIsExpired = []interface{}{ - 0, - 1, -} -var enumValues_ProposalOpenContractRespProposalOpenContractIsForwardStarting = []interface{}{ - 0, - 1, -} -var enumValues_ProposalOpenContractRespProposalOpenContractIsIntraday = []interface{}{ - 0, - 1, -} -var enumValues_ProposalOpenContractRespProposalOpenContractIsPathDependent = []interface{}{ - 0, - 1, -} -var enumValues_ProposalOpenContractRespProposalOpenContractIsSettleable = []interface{}{ - 0, - 1, -} -var enumValues_ProposalOpenContractRespProposalOpenContractIsSold = []interface{}{ - 0, - 1, -} -var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToCancel = []interface{}{ - 0, - 1, -} -var enumValues_ProposalOpenContractRespProposalOpenContractIsValidToSell = []interface{}{ - 0, - 1, +// UnmarshalJSON implements json.Unmarshaler. +func (j *ProposalOpenContractRespSubscription) 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 ProposalOpenContractRespSubscription: required") + } + type Plain ProposalOpenContractRespSubscription + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = ProposalOpenContractRespSubscription(plain) + return nil } -var enumValues_ProposalOpenContractRespProposalOpenContractStatus = []interface{}{ - "open", - "sold", - "won", - "lost", - "cancelled", - nil, + +// 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 { + return fmt.Errorf("field echo_req in ProposalOpenContractResp: required") + } + type Plain ProposalOpenContractResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = ProposalOpenContractResp(plain) + return nil } diff --git a/schema/proposal_resp.go b/schema/proposal_resp.go index d821f52..e2758c7 100644 --- a/schema/proposal_resp.go +++ b/schema/proposal_resp.go @@ -32,6 +32,30 @@ 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. @@ -211,54 +235,34 @@ type ProposalRespProposalLimitOrderTakeProfit struct { Value *string `json:"value,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 v, ok := raw["ask_price"]; !ok || v == nil { + if _, ok := raw["ask_price"]; raw != nil && !ok { return fmt.Errorf("field ask_price in ProposalRespProposal: required") } - if v, ok := raw["date_start"]; !ok || v == nil { + if _, ok := raw["date_start"]; raw != nil && !ok { return fmt.Errorf("field date_start in ProposalRespProposal: required") } - if v, ok := raw["display_value"]; !ok || v == nil { + if _, ok := raw["display_value"]; raw != nil && !ok { return fmt.Errorf("field display_value in ProposalRespProposal: required") } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in ProposalRespProposal: required") } - if v, ok := raw["longcode"]; !ok || v == nil { + if _, ok := raw["longcode"]; raw != nil && !ok { return fmt.Errorf("field longcode in ProposalRespProposal: required") } - if v, ok := raw["payout"]; !ok || v == nil { + if _, ok := raw["payout"]; raw != nil && !ok { return fmt.Errorf("field payout in ProposalRespProposal: required") } - if v, ok := raw["spot"]; !ok || v == nil { + if _, ok := raw["spot"]; raw != nil && !ok { return fmt.Errorf("field spot in ProposalRespProposal: required") } - if v, ok := raw["spot_time"]; !ok || v == nil { + if _, ok := raw["spot_time"]; raw != nil && !ok { return fmt.Errorf("field spot_time in ProposalRespProposal: required") } type Plain ProposalRespProposal @@ -283,7 +287,7 @@ func (j *ProposalRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in ProposalRespSubscription: required") } type Plain ProposalRespSubscription @@ -295,20 +299,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ProposalResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 8711e6e..b7635ea 100644 --- a/schema/reality_check.go +++ b/schema/reality_check.go @@ -6,6 +6,26 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -36,33 +56,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["reality_check"]; !ok || v == nil { + if _, ok := raw["reality_check"]; raw != nil && !ok { 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 595ad5e..f7b9148 100644 --- a/schema/reality_check_resp.go +++ b/schema/reality_check_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in RealityCheckResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 56652bd..eaf42c1 100644 --- a/schema/residence_list.go +++ b/schema/residence_list.go @@ -6,6 +6,20 @@ 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] 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{} @@ -36,27 +50,13 @@ 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] 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 v, ok := raw["residence_list"]; !ok || v == nil { + if _, ok := raw["residence_list"]; raw != nil && !ok { 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 ce684d1..5a33c57 100644 --- a/schema/residence_list_resp.go +++ b/schema/residence_list_resp.go @@ -29,6 +29,30 @@ 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"` @@ -57,6 +81,31 @@ 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 +} + // Information about identity options available type ResidenceListRespResidenceListElemIdentity struct { // Identity services configuration @@ -89,142 +138,94 @@ 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 - -var enumValues_ResidenceListRespMsgType = []interface{}{ - "residence_list", -} -var enumValues_ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired = []interface{}{ +var enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample = []interface{}{ 0, 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported) UnmarshalJSON(b []byte) error { +func (j *ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample) 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_ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample { 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_ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample, v) } - *j = ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported(v) + *j = ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample(v) return nil } -var enumValues_ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported = []interface{}{ +type ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported int + +var enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported = []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 } -var enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvIsCountrySupported = []interface{}{ - 0, - 1, -} +// Onfido configuration +type ResidenceListRespResidenceListElemIdentityServicesOnfido struct { + // Documents supported by the IDV service in this country + DocumentsSupported ResidenceListRespResidenceListElemIdentityServicesOnfidoDocumentsSupported `json:"documents_supported,omitempty"` -// UnmarshalJSON implements json.Unmarshaler. -func (j *ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample) UnmarshalJSON(b []byte) error { - var v int - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample, v) - } - *j = ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample(v) - return nil + // Flag which indicates whether Onfido is available in this country + IsCountrySupported *ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported `json:"is_country_supported,omitempty"` } -var enumValues_ResidenceListRespResidenceListElemIdentityServicesIdvHasVisualSample = []interface{}{ +// 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 *ResidenceListRespResidenceListElemAccountOpeningSelfDeclarationRequired) UnmarshalJSON(b []byte) error { +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_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 -} - -// 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 { + 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_ResidenceListRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported, v) } - *j = ResidenceListRespMsgType(v) + *j = ResidenceListRespResidenceListElemIdentityServicesOnfidoIsCountrySupported(v) return nil } @@ -234,10 +235,10 @@ func (j *ResidenceListResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in ResidenceListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 c2c9ab1..5b7081b 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 v, ok := raw["revoke_oauth_app"]; !ok || v == nil { + if _, ok := raw["revoke_oauth_app"]; raw != nil && !ok { 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 c273e07..e6cd89c 100644 --- a/schema/revoke_oauth_app_resp.go +++ b/schema/revoke_oauth_app_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in RevokeOauthAppResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in RevokeOauthAppResp: required") } type Plain RevokeOauthAppResp diff --git a/schema/sell.go b/schema/sell.go index b67a1db..af8ad57 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 v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in Sell: required") } - if v, ok := raw["sell"]; !ok || v == nil { + if _, ok := raw["sell"]; raw != nil && !ok { 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 3a32e65..0fdad8d 100644 --- a/schema/sell_contract_for_multiple_accounts.go +++ b/schema/sell_contract_for_multiple_accounts.go @@ -6,36 +6,6 @@ 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 @@ -69,22 +39,52 @@ 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 v, ok := raw["price"]; !ok || v == nil { + if _, ok := raw["price"]; raw != nil && !ok { return fmt.Errorf("field price in SellContractForMultipleAccounts: required") } - if v, ok := raw["sell_contract_for_multiple_accounts"]; !ok || v == nil { + if _, ok := raw["sell_contract_for_multiple_accounts"]; raw != nil && !ok { return fmt.Errorf("field sell_contract_for_multiple_accounts in SellContractForMultipleAccounts: required") } - if v, ok := raw["shortcode"]; !ok || v == nil { + if _, ok := raw["shortcode"]; raw != nil && !ok { return fmt.Errorf("field shortcode in SellContractForMultipleAccounts: required") } - if v, ok := raw["tokens"]; !ok || v == nil { + if _, ok := raw["tokens"]; raw != nil && !ok { 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 3820c7f..ce41141 100644 --- a/schema/sell_contract_for_multiple_accounts_resp.go +++ b/schema/sell_contract_for_multiple_accounts_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in SellContractForMultipleAccountsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 e2ae9f8..c090e05 100644 --- a/schema/sell_expired.go +++ b/schema/sell_expired.go @@ -6,6 +6,24 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -36,31 +54,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["sell_expired"]; !ok || v == nil { + if _, ok := raw["sell_expired"]; raw != nil && !ok { 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 2ca7cb1..4204c4f 100644 --- a/schema/sell_expired_resp.go +++ b/schema/sell_expired_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in SellExpiredResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 76bf6c6..3bff59e 100644 --- a/schema/sell_resp.go +++ b/schema/sell_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in SellResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 45c9004..a7bba09 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 v, ok := raw["set_account_currency"]; !ok || v == nil { + if _, ok := raw["set_account_currency"]; raw != nil && !ok { 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 4dd255f..4e5b302 100644 --- a/schema/set_account_currency_resp.go +++ b/schema/set_account_currency_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ func (j *SetAccountCurrencyRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const SetAccountCurrencyRespMsgTypeSetAccountCurrency SetAccountCurrencyRespMsgType = "set_account_currency" - type SetAccountCurrencyRespSetAccountCurrency int var enumValues_SetAccountCurrencyRespSetAccountCurrency = []interface{}{ @@ -64,32 +80,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in SetAccountCurrencyResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 b1ae665..40f1461 100644 --- a/schema/set_financial_assessment.go +++ b/schema/set_financial_assessment.go @@ -93,454 +93,6 @@ const SetFinancialAssessmentAccountTurnoverA50001100000 SetFinancialAssessmentAc const SetFinancialAssessmentAccountTurnoverLessThan25000 SetFinancialAssessmentAccountTurnover = "Less than $25,000" const SetFinancialAssessmentAccountTurnoverOver500000 SetFinancialAssessmentAccountTurnover = "Over $500,000" -type SetFinancialAssessmentBinaryOptionsTradingExperience string - -const SetFinancialAssessmentBinaryOptionsTradingExperienceA01Year SetFinancialAssessmentBinaryOptionsTradingExperience = "0-1 year" -const SetFinancialAssessmentBinaryOptionsTradingExperienceA12Years SetFinancialAssessmentBinaryOptionsTradingExperience = "1-2 years" -const SetFinancialAssessmentBinaryOptionsTradingExperienceOver3Years SetFinancialAssessmentBinaryOptionsTradingExperience = "Over 3 years" - -type SetFinancialAssessmentBinaryOptionsTradingFrequency string - -const SetFinancialAssessmentBinaryOptionsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "0-5 transactions in the past 12 months" -const SetFinancialAssessmentBinaryOptionsTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "11-39 transactions in the past 12 months" -const SetFinancialAssessmentBinaryOptionsTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentBinaryOptionsTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "6-10 transactions in the past 12 months" - -type SetFinancialAssessmentCfdTradingExperience string - -const SetFinancialAssessmentCfdTradingExperienceA01Year SetFinancialAssessmentCfdTradingExperience = "0-1 year" -const SetFinancialAssessmentCfdTradingExperienceA12Years SetFinancialAssessmentCfdTradingExperience = "1-2 years" -const SetFinancialAssessmentCfdTradingExperienceOver3Years SetFinancialAssessmentCfdTradingExperience = "Over 3 years" - -type SetFinancialAssessmentCfdTradingFrequency string - -const SetFinancialAssessmentCfdTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentCfdTradingFrequency = "0-5 transactions in the past 12 months" -const SetFinancialAssessmentCfdTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentCfdTradingFrequency = "11-39 transactions in the past 12 months" -const SetFinancialAssessmentCfdTradingFrequencyA40TransactionsOrMoreInThePast12Months SetFinancialAssessmentCfdTradingFrequency = "40 transactions or more in the past 12 months" -const SetFinancialAssessmentCfdTradingFrequencyA610TransactionsInThePast12Months SetFinancialAssessmentCfdTradingFrequency = "6-10 transactions in the past 12 months" - -type SetFinancialAssessmentEducationLevel string - -const SetFinancialAssessmentEducationLevelPrimary SetFinancialAssessmentEducationLevel = "Primary" -const SetFinancialAssessmentEducationLevelSecondary SetFinancialAssessmentEducationLevel = "Secondary" -const SetFinancialAssessmentEducationLevelTertiary SetFinancialAssessmentEducationLevel = "Tertiary" - -type SetFinancialAssessmentEmploymentIndustry string - -const SetFinancialAssessmentEmploymentIndustryAgriculture SetFinancialAssessmentEmploymentIndustry = "Agriculture" -const SetFinancialAssessmentEmploymentIndustryConstruction SetFinancialAssessmentEmploymentIndustry = "Construction" -const SetFinancialAssessmentEmploymentIndustryEducation SetFinancialAssessmentEmploymentIndustry = "Education" -const SetFinancialAssessmentEmploymentIndustryFinance SetFinancialAssessmentEmploymentIndustry = "Finance" -const SetFinancialAssessmentEmploymentIndustryFoodServices SetFinancialAssessmentEmploymentIndustry = "Food Services" -const SetFinancialAssessmentEmploymentIndustryHealth SetFinancialAssessmentEmploymentIndustry = "Health" -const SetFinancialAssessmentEmploymentIndustryInformationCommunicationsTechnology SetFinancialAssessmentEmploymentIndustry = "Information & Communications Technology" -const SetFinancialAssessmentEmploymentIndustryLegal SetFinancialAssessmentEmploymentIndustry = "Legal" -const SetFinancialAssessmentEmploymentIndustryManufacturing SetFinancialAssessmentEmploymentIndustry = "Manufacturing" -const SetFinancialAssessmentEmploymentIndustryRealEstate SetFinancialAssessmentEmploymentIndustry = "Real Estate" -const SetFinancialAssessmentEmploymentIndustryScienceEngineering SetFinancialAssessmentEmploymentIndustry = "Science & Engineering" -const SetFinancialAssessmentEmploymentIndustrySocialCultural SetFinancialAssessmentEmploymentIndustry = "Social & Cultural" -const SetFinancialAssessmentEmploymentIndustryTourism SetFinancialAssessmentEmploymentIndustry = "Tourism" -const SetFinancialAssessmentEmploymentIndustryUnemployed SetFinancialAssessmentEmploymentIndustry = "Unemployed" - -type SetFinancialAssessmentEmploymentStatus string - -const SetFinancialAssessmentEmploymentStatusEmployed SetFinancialAssessmentEmploymentStatus = "Employed" -const SetFinancialAssessmentEmploymentStatusPensioner SetFinancialAssessmentEmploymentStatus = "Pensioner" -const SetFinancialAssessmentEmploymentStatusSelfEmployed SetFinancialAssessmentEmploymentStatus = "Self-Employed" -const SetFinancialAssessmentEmploymentStatusStudent SetFinancialAssessmentEmploymentStatus = "Student" -const SetFinancialAssessmentEmploymentStatusUnemployed SetFinancialAssessmentEmploymentStatus = "Unemployed" - -type SetFinancialAssessmentEstimatedWorth string - -const SetFinancialAssessmentEstimatedWorthA100000250000 SetFinancialAssessmentEstimatedWorth = "$100,000 - $250,000" -const SetFinancialAssessmentEstimatedWorthA250001500000 SetFinancialAssessmentEstimatedWorth = "$250,001 - $500,000" -const SetFinancialAssessmentEstimatedWorthA5000011000000 SetFinancialAssessmentEstimatedWorth = "$500,001 - $1,000,000" -const SetFinancialAssessmentEstimatedWorthLessThan100000 SetFinancialAssessmentEstimatedWorth = "Less than $100,000" -const SetFinancialAssessmentEstimatedWorthOver1000000 SetFinancialAssessmentEstimatedWorth = "Over $1,000,000" - -// [Optional] The financial information of a client -type SetFinancialAssessmentFinancialInformation struct { - // [Optional] The anticipated account turnover. - AccountTurnover *SetFinancialAssessmentFinancialInformationAccountTurnover `json:"account_turnover,omitempty"` - - // Level of Education. - EducationLevel SetFinancialAssessmentFinancialInformationEducationLevel `json:"education_level"` - - // Industry of Employment. - EmploymentIndustry SetFinancialAssessmentFinancialInformationEmploymentIndustry `json:"employment_industry"` - - // [Optional] Employment Status. - EmploymentStatus *SetFinancialAssessmentFinancialInformationEmploymentStatus `json:"employment_status,omitempty"` - - // Estimated Net Worth. - EstimatedWorth SetFinancialAssessmentFinancialInformationEstimatedWorth `json:"estimated_worth"` - - // Income Source. - IncomeSource SetFinancialAssessmentFinancialInformationIncomeSource `json:"income_source"` - - // Net Annual Income. - NetIncome SetFinancialAssessmentFinancialInformationNetIncome `json:"net_income"` - - // Occupation. - Occupation *SetFinancialAssessmentFinancialInformationOccupation `json:"occupation,omitempty"` - - // [Optional] Source of wealth. - SourceOfWealth *SetFinancialAssessmentFinancialInformationSourceOfWealth `json:"source_of_wealth,omitempty"` -} - -type SetFinancialAssessmentFinancialInformationAccountTurnover string - -const SetFinancialAssessmentFinancialInformationAccountTurnoverA100001500000 SetFinancialAssessmentFinancialInformationAccountTurnover = "$100,001 - $500,000" -const SetFinancialAssessmentFinancialInformationAccountTurnoverA2500050000 SetFinancialAssessmentFinancialInformationAccountTurnover = "$25,000 - $50,000" -const SetFinancialAssessmentFinancialInformationAccountTurnoverA50001100000 SetFinancialAssessmentFinancialInformationAccountTurnover = "$50,001 - $100,000" -const SetFinancialAssessmentFinancialInformationAccountTurnoverLessThan25000 SetFinancialAssessmentFinancialInformationAccountTurnover = "Less than $25,000" -const SetFinancialAssessmentFinancialInformationAccountTurnoverOver500000 SetFinancialAssessmentFinancialInformationAccountTurnover = "Over $500,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", @@ -548,681 +100,913 @@ var enumValues_SetFinancialAssessmentAccountTurnover = []interface{}{ "$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", + +// 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 } -var enumValues_SetFinancialAssessmentForexTradingExperience = []interface{}{ + +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", } -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", + +// 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 } -var enumValues_SetFinancialAssessmentOtherInstrumentsTradingFrequency = []interface{}{ + +type SetFinancialAssessmentBinaryOptionsTradingFrequency string + +const SetFinancialAssessmentBinaryOptionsTradingFrequencyA05TransactionsInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "0-5 transactions in the past 12 months" +const SetFinancialAssessmentBinaryOptionsTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentBinaryOptionsTradingFrequency = "11-39 transactions in the past 12 months" +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", } -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", + +// 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 } -var enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience = []interface{}{ + +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", } -var enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency = []interface{}{ + +// 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" +const SetFinancialAssessmentCfdTradingFrequencyA1139TransactionsInThePast12Months SetFinancialAssessmentCfdTradingFrequency = "11-39 transactions in the past 12 months" +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", } -var enumValues_SetFinancialAssessmentTradingExperienceCfdTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", -} // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency) 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_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency { + 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_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentCfdTradingFrequency, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency(v) + *j = SetFinancialAssessmentCfdTradingFrequency(v) return nil } -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", +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 *SetFinancialAssessmentTradingExperienceRegulatedCfdExperience) 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_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience { + 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_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEducationLevel, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedCfdExperience(v) + *j = SetFinancialAssessmentEducationLevel(v) return nil } -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.", +type SetFinancialAssessmentEmploymentIndustry string + +const SetFinancialAssessmentEmploymentIndustryAgriculture SetFinancialAssessmentEmploymentIndustry = "Agriculture" +const SetFinancialAssessmentEmploymentIndustryConstruction SetFinancialAssessmentEmploymentIndustry = "Construction" +const SetFinancialAssessmentEmploymentIndustryEducation SetFinancialAssessmentEmploymentIndustry = "Education" +const SetFinancialAssessmentEmploymentIndustryFinance SetFinancialAssessmentEmploymentIndustry = "Finance" +const SetFinancialAssessmentEmploymentIndustryFoodServices SetFinancialAssessmentEmploymentIndustry = "Food Services" +const SetFinancialAssessmentEmploymentIndustryHealth SetFinancialAssessmentEmploymentIndustry = "Health" +const SetFinancialAssessmentEmploymentIndustryInformationCommunicationsTechnology SetFinancialAssessmentEmploymentIndustry = "Information & Communications Technology" +const SetFinancialAssessmentEmploymentIndustryLegal SetFinancialAssessmentEmploymentIndustry = "Legal" +const SetFinancialAssessmentEmploymentIndustryManufacturing SetFinancialAssessmentEmploymentIndustry = "Manufacturing" +const SetFinancialAssessmentEmploymentIndustryRealEstate SetFinancialAssessmentEmploymentIndustry = "Real Estate" +const SetFinancialAssessmentEmploymentIndustryScienceEngineering SetFinancialAssessmentEmploymentIndustry = "Science & Engineering" +const SetFinancialAssessmentEmploymentIndustrySocialCultural SetFinancialAssessmentEmploymentIndustry = "Social & Cultural" +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 *SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition { + 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_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEmploymentIndustry, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition(v) + *j = SetFinancialAssessmentEmploymentIndustry(v) return nil } +type SetFinancialAssessmentEmploymentStatus string + +const SetFinancialAssessmentEmploymentStatusEmployed SetFinancialAssessmentEmploymentStatus = "Employed" +const SetFinancialAssessmentEmploymentStatusPensioner SetFinancialAssessmentEmploymentStatus = "Pensioner" +const SetFinancialAssessmentEmploymentStatusSelfEmployed SetFinancialAssessmentEmploymentStatus = "Self-Employed" +const SetFinancialAssessmentEmploymentStatusStudent SetFinancialAssessmentEmploymentStatus = "Student" +const SetFinancialAssessmentEmploymentStatusUnemployed SetFinancialAssessmentEmploymentStatus = "Unemployed" + +var enumValues_SetFinancialAssessmentEmploymentStatus = []interface{}{ + "Employed", + "Pensioner", + "Self-Employed", + "Student", + "Unemployed", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency) 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_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency { + 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_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEmploymentStatus, v) } - *j = SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency(v) + *j = SetFinancialAssessmentEmploymentStatus(v) return nil } -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", +type SetFinancialAssessmentEstimatedWorth string + +const SetFinancialAssessmentEstimatedWorthA100000250000 SetFinancialAssessmentEstimatedWorth = "$100,000 - $250,000" +const SetFinancialAssessmentEstimatedWorthA250001500000 SetFinancialAssessmentEstimatedWorth = "$250,001 - $500,000" +const SetFinancialAssessmentEstimatedWorthA5000011000000 SetFinancialAssessmentEstimatedWorth = "$500,001 - $1,000,000" +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 *SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience) 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_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience { + 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_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentEstimatedWorth, v) } - *j = SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience(v) + *j = SetFinancialAssessmentEstimatedWorth(v) return nil } -var enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", +// [Optional] The financial information of a client +type SetFinancialAssessmentFinancialInformation struct { + // [Optional] The anticipated account turnover. + AccountTurnover *SetFinancialAssessmentFinancialInformationAccountTurnover `json:"account_turnover,omitempty"` + + // Level of Education. + EducationLevel SetFinancialAssessmentFinancialInformationEducationLevel `json:"education_level"` + + // Industry of Employment. + EmploymentIndustry SetFinancialAssessmentFinancialInformationEmploymentIndustry `json:"employment_industry"` + + // [Optional] Employment Status. + EmploymentStatus *SetFinancialAssessmentFinancialInformationEmploymentStatus `json:"employment_status,omitempty"` + + // Estimated Net Worth. + EstimatedWorth SetFinancialAssessmentFinancialInformationEstimatedWorth `json:"estimated_worth"` + + // Income Source. + IncomeSource SetFinancialAssessmentFinancialInformationIncomeSource `json:"income_source"` + + // Net Annual Income. + NetIncome SetFinancialAssessmentFinancialInformationNetIncome `json:"net_income"` + + // Occupation. + Occupation *SetFinancialAssessmentFinancialInformationOccupation `json:"occupation,omitempty"` + + // [Optional] Source of wealth. + SourceOfWealth *SetFinancialAssessmentFinancialInformationSourceOfWealth `json:"source_of_wealth,omitempty"` +} + +type SetFinancialAssessmentFinancialInformationAccountTurnover string + +const SetFinancialAssessmentFinancialInformationAccountTurnoverA100001500000 SetFinancialAssessmentFinancialInformationAccountTurnover = "$100,001 - $500,000" +const SetFinancialAssessmentFinancialInformationAccountTurnoverA2500050000 SetFinancialAssessmentFinancialInformationAccountTurnover = "$25,000 - $50,000" +const SetFinancialAssessmentFinancialInformationAccountTurnoverA50001100000 SetFinancialAssessmentFinancialInformationAccountTurnover = "$50,001 - $100,000" +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", + "$50,001 - $100,000", + "$100,001 - $500,000", + "Over $500,000", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceForexTradingFrequency) 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_SetFinancialAssessmentTradingExperienceForexTradingFrequency { + 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_SetFinancialAssessmentTradingExperienceForexTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationAccountTurnover, v) } - *j = SetFinancialAssessmentTradingExperienceForexTradingFrequency(v) + *j = SetFinancialAssessmentFinancialInformationAccountTurnover(v) return nil } -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.", +type SetFinancialAssessmentFinancialInformationEducationLevel string + +const SetFinancialAssessmentFinancialInformationEducationLevelPrimary SetFinancialAssessmentFinancialInformationEducationLevel = "Primary" +const SetFinancialAssessmentFinancialInformationEducationLevelSecondary SetFinancialAssessmentFinancialInformationEducationLevel = "Secondary" +const SetFinancialAssessmentFinancialInformationEducationLevelTertiary SetFinancialAssessmentFinancialInformationEducationLevel = "Tertiary" + +var enumValues_SetFinancialAssessmentFinancialInformationEducationLevel = []interface{}{ + "Primary", + "Secondary", + "Tertiary", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading) 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_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading { + 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_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEducationLevel, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading(v) + *j = SetFinancialAssessmentFinancialInformationEducationLevel(v) return nil } -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", +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" + +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 *SetFinancialAssessmentTradingExperienceForexTradingExperience) 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_SetFinancialAssessmentTradingExperienceForexTradingExperience { + 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_SetFinancialAssessmentTradingExperienceForexTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEmploymentIndustry, v) } - *j = SetFinancialAssessmentTradingExperienceForexTradingExperience(v) + *j = SetFinancialAssessmentFinancialInformationEmploymentIndustry(v) return nil } -var enumValues_SetFinancialAssessmentTradingExperienceForexTradingExperience = []interface{}{ - "0-1 year", - "1-2 years", - "Over 3 years", +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceCfdTradingFrequency) 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_SetFinancialAssessmentTradingExperienceCfdTradingFrequency { + 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_SetFinancialAssessmentTradingExperienceCfdTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEmploymentStatus, v) } - *j = SetFinancialAssessmentTradingExperienceCfdTradingFrequency(v) + *j = SetFinancialAssessmentFinancialInformationEmploymentStatus(v) return nil } -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.", +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss { + 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_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationEstimatedWorth, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss(v) + *j = SetFinancialAssessmentFinancialInformationEstimatedWorth(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", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceCfdTradingExperience) 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_SetFinancialAssessmentTradingExperienceCfdTradingExperience { + 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_SetFinancialAssessmentTradingExperienceCfdTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationIncomeSource, v) } - *j = SetFinancialAssessmentTradingExperienceCfdTradingExperience(v) + *j = SetFinancialAssessmentFinancialInformationIncomeSource(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", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationOccupation) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentFinancialInformationOccupation { + 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_SetFinancialAssessmentFinancialInformationOccupation, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationNetIncome, v) } - *j = SetFinancialAssessmentFinancialInformationOccupation(v) + *j = SetFinancialAssessmentFinancialInformationNetIncome(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 *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentFinancialInformationOccupation) 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_SetFinancialAssessmentFinancialInformationOccupation { 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_SetFinancialAssessmentFinancialInformationOccupation, v) } - *j = SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency(v) + *j = SetFinancialAssessmentFinancialInformationOccupation(v) 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 *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience) 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_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience { + 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_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentFinancialInformationSourceOfWealth, v) } - *j = SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience(v) + *j = SetFinancialAssessmentFinancialInformationSourceOfWealth(v) return nil } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentSourceOfWealth) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { +func (j *SetFinancialAssessmentFinancialInformation) 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_SetFinancialAssessmentSourceOfWealth { - if reflect.DeepEqual(v, expected) { - ok = true - break - } + 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") } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentSourceOfWealth, v) + type Plain SetFinancialAssessmentFinancialInformation + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err } - *j = SetFinancialAssessmentSourceOfWealth(v) + *j = SetFinancialAssessmentFinancialInformation(plain) return nil } -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin = []interface{}{ - "When opening a Leveraged CFD trade.", - "When trading Multipliers.", - "When buying shares of a company.", - "All of the above.", +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 *SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin) 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_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin { + 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_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentForexTradingExperience, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin(v) + *j = SetFinancialAssessmentForexTradingExperience(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", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentSetFinancialAssessment) UnmarshalJSON(b []byte) error { - var v int +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_SetFinancialAssessmentSetFinancialAssessment { + 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_SetFinancialAssessmentSetFinancialAssessment, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentForexTradingFrequency, v) } - *j = SetFinancialAssessmentSetFinancialAssessment(v) + *j = SetFinancialAssessmentForexTradingFrequency(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 *SetFinancialAssessmentOtherInstrumentsTradingFrequency) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentOtherInstrumentsTradingFrequency { + 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_SetFinancialAssessmentOtherInstrumentsTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentIncomeSource, v) } - *j = SetFinancialAssessmentOtherInstrumentsTradingFrequency(v) + *j = SetFinancialAssessmentIncomeSource(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 *SetFinancialAssessmentOtherInstrumentsTradingExperience) 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_SetFinancialAssessmentOtherInstrumentsTradingExperience { + 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_SetFinancialAssessmentOtherInstrumentsTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentNetIncome, v) } - *j = SetFinancialAssessmentOtherInstrumentsTradingExperience(v) + *j = SetFinancialAssessmentNetIncome(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 { var v string @@ -1243,541 +1027,808 @@ func (j *SetFinancialAssessmentOccupation) UnmarshalJSON(b []byte) error { 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 *SetFinancialAssessmentNetIncome) 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_SetFinancialAssessmentNetIncome { + 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_SetFinancialAssessmentNetIncome, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentOtherInstrumentsTradingExperience, v) } - *j = SetFinancialAssessmentNetIncome(v) + *j = SetFinancialAssessmentOtherInstrumentsTradingExperience(v) return nil } -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance = []interface{}{ - "Yes", - "No", +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 *SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance) 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_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance { + 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_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentOtherInstrumentsTradingFrequency, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance(v) + *j = SetFinancialAssessmentOtherInstrumentsTradingFrequency(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, +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentAccountTurnover) 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_SetFinancialAssessmentAccountTurnover { + 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_SetFinancialAssessmentAccountTurnover, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentSetFinancialAssessment, v) } - *j = SetFinancialAssessmentAccountTurnover(v) + *j = SetFinancialAssessmentSetFinancialAssessment(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 *SetFinancialAssessmentIncomeSource) 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_SetFinancialAssessmentIncomeSource { + 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_SetFinancialAssessmentIncomeSource, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentSourceOfWealth, v) } - *j = SetFinancialAssessmentIncomeSource(v) + *j = SetFinancialAssessmentSourceOfWealth(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 *SetFinancialAssessmentBinaryOptionsTradingExperience) UnmarshalJSON(b []byte) error { +func (j *SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience) 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 { + for _, expected := range enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentBinaryOptionsTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience, v) } - *j = SetFinancialAssessmentBinaryOptionsTradingExperience(v) + *j = SetFinancialAssessmentTradingExperienceBinaryOptionsTradingExperience(v) return nil } -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.", +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience) 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_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience { + 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_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience(v) + *j = SetFinancialAssessmentTradingExperienceBinaryOptionsTradingFrequency(v) return nil } -// 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 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 *SetFinancialAssessmentCfdTradingExperience) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentCfdTradingExperience { + 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_SetFinancialAssessmentCfdTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceCfdTradingExperience, v) } - *j = SetFinancialAssessmentCfdTradingExperience(v) + *j = SetFinancialAssessmentTradingExperienceCfdTradingExperience(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 *SetFinancialAssessmentForexTradingFrequency) 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_SetFinancialAssessmentForexTradingFrequency { + 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_SetFinancialAssessmentForexTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceCfdTradingFrequency, v) } - *j = SetFinancialAssessmentForexTradingFrequency(v) + *j = SetFinancialAssessmentTradingExperienceCfdTradingFrequency(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 *SetFinancialAssessmentCfdTradingFrequency) 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_SetFinancialAssessmentCfdTradingFrequency { + 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_SetFinancialAssessmentCfdTradingFrequency, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceForexTradingExperience, v) } - *j = SetFinancialAssessmentCfdTradingFrequency(v) + *j = SetFinancialAssessmentTradingExperienceForexTradingExperience(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 *SetFinancialAssessmentEducationLevel) 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_SetFinancialAssessmentEducationLevel { + 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_SetFinancialAssessmentEducationLevel, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceForexTradingFrequency, v) } - *j = SetFinancialAssessmentEducationLevel(v) + *j = SetFinancialAssessmentTradingExperienceForexTradingFrequency(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 *SetFinancialAssessmentForexTradingExperience) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentForexTradingExperience { + 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_SetFinancialAssessmentForexTradingExperience, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience, v) } - *j = SetFinancialAssessmentForexTradingExperience(v) + *j = SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingExperience(v) return nil } -var enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments = []interface{}{ - "No experience", - "Less than a year", - "1 - 2 years", - "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" + +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 *SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments { + 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_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments(v) + *j = SetFinancialAssessmentTradingExperienceOtherInstrumentsTradingFrequency(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 +// [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{}{ + "No experience", + "Less than a year", + "1 - 2 years", + "Over 3 years", } // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentEmploymentIndustry) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentEmploymentIndustry { + 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_SetFinancialAssessmentEmploymentIndustry, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdExperience, v) } - *j = SetFinancialAssessmentEmploymentIndustry(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedCfdExperience(v) return nil } -// 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 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 *SetFinancialAssessmentEstimatedWorth) 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_SetFinancialAssessmentEstimatedWorth { + 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_SetFinancialAssessmentEstimatedWorth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency, v) } - *j = SetFinancialAssessmentEstimatedWorth(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedCfdFrequency(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 *SetFinancialAssessmentFinancialInformationAccountTurnover) 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_SetFinancialAssessmentFinancialInformationAccountTurnover { + 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_SetFinancialAssessmentFinancialInformationAccountTurnover, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition, v) } - *j = SetFinancialAssessmentFinancialInformationAccountTurnover(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedCfdTradingDefinition(v) return nil } -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", +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 *SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments) 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_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments { + 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_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading, v) } - *j = SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedLeverageImpactTrading(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.", +} + // UnmarshalJSON implements json.Unmarshaler. -func (j *SetFinancialAssessmentFinancialInformationSourceOfWealth) 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_SetFinancialAssessmentFinancialInformationSourceOfWealth { + 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_SetFinancialAssessmentFinancialInformationSourceOfWealth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss, v) } - *j = SetFinancialAssessmentFinancialInformationSourceOfWealth(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedLeverageTradingHighRiskStopLoss(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 *SetFinancialAssessmentFinancialInformationEducationLevel) 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_SetFinancialAssessmentFinancialInformationEducationLevel { + 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_SetFinancialAssessmentFinancialInformationEducationLevel, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin, v) } - *j = SetFinancialAssessmentFinancialInformationEducationLevel(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedRequiredInitialMargin(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 *SetFinancialAssessmentFinancialInformationEmploymentIndustry) UnmarshalJSON(b []byte) error { +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_SetFinancialAssessmentFinancialInformationEmploymentIndustry { + 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_SetFinancialAssessmentFinancialInformationEmploymentIndustry, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance, v) } - *j = SetFinancialAssessmentFinancialInformationEmploymentIndustry(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedRiskTolerance(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 *SetFinancialAssessmentFinancialInformationEmploymentStatus) 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_SetFinancialAssessmentFinancialInformationEmploymentStatus { + 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_SetFinancialAssessmentFinancialInformationEmploymentStatus, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience, v) } - *j = SetFinancialAssessmentFinancialInformationEmploymentStatus(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedSourceOfExperience(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 *SetFinancialAssessmentFinancialInformationEstimatedWorth) 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_SetFinancialAssessmentFinancialInformationEstimatedWorth { + 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_SetFinancialAssessmentFinancialInformationEstimatedWorth, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments, v) } - *j = SetFinancialAssessmentFinancialInformationEstimatedWorth(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedTradingExperienceFinancialInstruments(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 *SetFinancialAssessmentFinancialInformationIncomeSource) 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_SetFinancialAssessmentFinancialInformationIncomeSource { + 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_SetFinancialAssessmentFinancialInformationIncomeSource, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments, v) } - *j = SetFinancialAssessmentFinancialInformationIncomeSource(v) + *j = SetFinancialAssessmentTradingExperienceRegulatedTradingFrequencyFinancialInstruments(v) return nil } @@ -1787,34 +1838,34 @@ func (j *SetFinancialAssessmentTradingExperienceRegulated) UnmarshalJSON(b []byt if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["cfd_experience"]; !ok || v == nil { + if _, ok := raw["cfd_experience"]; raw != nil && !ok { return fmt.Errorf("field cfd_experience in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["cfd_frequency"]; !ok || v == nil { + if _, ok := raw["cfd_frequency"]; raw != nil && !ok { return fmt.Errorf("field cfd_frequency in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["cfd_trading_definition"]; !ok || v == nil { + if _, ok := raw["cfd_trading_definition"]; raw != nil && !ok { return fmt.Errorf("field cfd_trading_definition in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["leverage_impact_trading"]; !ok || v == nil { + if _, ok := raw["leverage_impact_trading"]; raw != nil && !ok { return fmt.Errorf("field leverage_impact_trading in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["leverage_trading_high_risk_stop_loss"]; !ok || v == nil { + if _, ok := raw["leverage_trading_high_risk_stop_loss"]; raw != nil && !ok { return fmt.Errorf("field leverage_trading_high_risk_stop_loss in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["required_initial_margin"]; !ok || v == nil { + if _, ok := raw["required_initial_margin"]; raw != nil && !ok { return fmt.Errorf("field required_initial_margin in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["risk_tolerance"]; !ok || v == nil { + if _, ok := raw["risk_tolerance"]; raw != nil && !ok { return fmt.Errorf("field risk_tolerance in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["source_of_experience"]; !ok || v == nil { + if _, ok := raw["source_of_experience"]; raw != nil && !ok { return fmt.Errorf("field source_of_experience in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["trading_experience_financial_instruments"]; !ok || v == nil { + if _, ok := raw["trading_experience_financial_instruments"]; raw != nil && !ok { return fmt.Errorf("field trading_experience_financial_instruments in SetFinancialAssessmentTradingExperienceRegulated: required") } - if v, ok := raw["trading_frequency_financial_instruments"]; !ok || v == nil { + if _, ok := raw["trading_frequency_financial_instruments"]; raw != nil && !ok { return fmt.Errorf("field trading_frequency_financial_instruments in SetFinancialAssessmentTradingExperienceRegulated: required") } type Plain SetFinancialAssessmentTradingExperienceRegulated @@ -1826,33 +1877,13 @@ 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 v, ok := raw["set_financial_assessment"]; !ok || v == nil { + if _, ok := raw["set_financial_assessment"]; raw != nil && !ok { 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 ada1526..3f5074d 100644 --- a/schema/set_financial_assessment_resp.go +++ b/schema/set_financial_assessment_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in SetFinancialAssessmentResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 22c78c8..769b857 100644 --- a/schema/set_self_exclusion.go +++ b/schema/set_self_exclusion.go @@ -6,36 +6,6 @@ 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 { @@ -100,13 +70,43 @@ 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 v, ok := raw["set_self_exclusion"]; !ok || v == nil { + if _, ok := raw["set_self_exclusion"]; raw != nil && !ok { 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 9ae9027..efb0659 100644 --- a/schema/set_self_exclusion_resp.go +++ b/schema/set_self_exclusion_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in SetSelfExclusionResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 b74be52..faa2cdd 100644 --- a/schema/set_settings.go +++ b/schema/set_settings.go @@ -6,44 +6,144 @@ import "encoding/json" import "fmt" import "reflect" -// 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 +// 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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 *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 +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. @@ -66,12 +166,7 @@ func (j *SetSettingsAccountOpeningReason) UnmarshalJSON(b []byte) error { return nil } -const SetSettingsAccountOpeningReasonHedging SetSettingsAccountOpeningReason = "Hedging" -const SetSettingsAccountOpeningReasonIncomeEarning SetSettingsAccountOpeningReason = "Income Earning" -const SetSettingsAccountOpeningReasonPeerToPeerExchange SetSettingsAccountOpeningReason = "Peer-to-peer exchange" -const SetSettingsAccountOpeningReasonSpeculative SetSettingsAccountOpeningReason = "Speculative" - -type SetSettingsAccountOpeningReason string +type SetSettingsAllowCopiers int var enumValues_SetSettingsAllowCopiers = []interface{}{ 0, @@ -154,6 +249,12 @@ 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", @@ -182,11 +283,12 @@ func (j *SetSettingsEmploymentStatus) UnmarshalJSON(b []byte) error { return nil } -const SetSettingsEmploymentStatusEmployed SetSettingsEmploymentStatus = "Employed" -const SetSettingsEmploymentStatusPensioner SetSettingsEmploymentStatus = "Pensioner" -const SetSettingsEmploymentStatusSelfEmployed SetSettingsEmploymentStatus = "Self-Employed" -const SetSettingsEmploymentStatusStudent SetSettingsEmploymentStatus = "Student" -const SetSettingsEmploymentStatusUnemployed SetSettingsEmploymentStatus = "Unemployed" +// [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 SetSettingsFeatureFlagWallet int @@ -215,29 +317,37 @@ 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, } -type SetSettingsRequestProfessionalStatus int - -var enumValues_SetSettingsAccountOpeningReason = []interface{}{ - "Speculative", - "Income Earning", - "Hedging", - "Peer-to-peer exchange", +// 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 SetSettingsAllowCopiers int +// [Optional] Used to pass data through the websocket, which may be retrieved via +// the `echo_req` output field. +type SetSettingsPassthrough map[string]interface{} + +type SetSettingsRequestProfessionalStatus int var enumValues_SetSettingsRequestProfessionalStatus = []interface{}{ 1, @@ -265,6 +375,11 @@ 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", @@ -292,13 +407,17 @@ func (j *SetSettingsSalutation) UnmarshalJSON(b []byte) error { return nil } -const SetSettingsSalutationMiss SetSettingsSalutation = "Miss" -const SetSettingsSalutationMr SetSettingsSalutation = "Mr" -const SetSettingsSalutationMrs SetSettingsSalutation = "Mrs" -const SetSettingsSalutationMs SetSettingsSalutation = "Ms" - type SetSettingsSecretQuestion string +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" + var enumValues_SetSettingsSecretQuestion = []interface{}{ "Mother's maiden name", "Name of your pet", @@ -330,15 +449,6 @@ 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{}{ @@ -372,134 +482,24 @@ var enumValues_SetSettingsTradingHub = []interface{}{ 1, } -// [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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 *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. @@ -508,7 +508,7 @@ func (j *SetSettings) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["set_settings"]; !ok || v == nil { + if _, ok := raw["set_settings"]; raw != nil && !ok { 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 1fc82ec..fe17abd 100644 --- a/schema/set_settings_resp.go +++ b/schema/set_settings_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in SetSettingsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in SetSettingsResp: required") } type Plain SetSettingsResp diff --git a/schema/statement.go b/schema/statement.go index 1549f9a..e6f0a62 100644 --- a/schema/statement.go +++ b/schema/statement.go @@ -52,6 +52,17 @@ 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 @@ -129,24 +140,13 @@ 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 v, ok := raw["statement"]; !ok || v == nil { + if _, ok := raw["statement"]; raw != nil && !ok { return fmt.Errorf("field statement in Statement: required") } type Plain Statement diff --git a/schema/statement_resp.go b/schema/statement_resp.go index 149d95e..0924d94 100644 --- a/schema/statement_resp.go +++ b/schema/statement_resp.go @@ -29,6 +29,30 @@ 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 @@ -106,56 +130,6 @@ const StatementRespStatementTransactionsElemActionTypeTransfer StatementRespStat const StatementRespStatementTransactionsElemActionTypeVirtualCredit StatementRespStatementTransactionsElemActionType = "virtual_credit" const StatementRespStatementTransactionsElemActionTypeWithdrawal StatementRespStatementTransactionsElemActionType = "withdrawal" -// Contains details about fees used for transfer. It is present only when action -// type is transfer. -type StatementRespStatementTransactionsElemFees struct { - // Fees amount - Amount *float64 `json:"amount,omitempty"` - - // Fees currency - Currency *string `json:"currency,omitempty"` - - // Minimum amount of fees - Minimum *float64 `json:"minimum,omitempty"` - - // Fees percentage - Percentage *float64 `json:"percentage,omitempty"` -} - -// Contains details of account from which amount was transferred. It is present -// only when action type is transfer. -type StatementRespStatementTransactionsElemFrom struct { - // Login id of the account from which money was transferred. - 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 { - // Login id of the account to which money was transferred. - Loginid *string `json:"loginid,omitempty"` -} - var enumValues_StatementRespStatementTransactionsElemActionType = []interface{}{ "buy", "sell", @@ -169,27 +143,53 @@ var enumValues_StatementRespStatementTransactionsElemActionType = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *StatementRespMsgType) UnmarshalJSON(b []byte) error { +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_StatementRespMsgType { + 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_StatementRespMsgType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_StatementRespStatementTransactionsElemActionType, v) } - *j = StatementRespMsgType(v) + *j = StatementRespStatementTransactionsElemActionType(v) return nil } -var enumValues_StatementRespMsgType = []interface{}{ - "statement", +// Contains details about fees used for transfer. It is present only when action +// type is transfer. +type StatementRespStatementTransactionsElemFees struct { + // Fees amount + Amount *float64 `json:"amount,omitempty"` + + // Fees currency + Currency *string `json:"currency,omitempty"` + + // Minimum amount of fees + Minimum *float64 `json:"minimum,omitempty"` + + // Fees percentage + Percentage *float64 `json:"percentage,omitempty"` +} + +// Contains details of account from which amount was transferred. It is present +// only when action type is transfer. +type StatementRespStatementTransactionsElemFrom struct { + // Login id of the account from which money was transferred. + Loginid *string `json:"loginid,omitempty"` +} + +// Contains details of account to which amount was transferred. It is present only +// when action type is transfer. +type StatementRespStatementTransactionsElemTo struct { + // Login id of the account to which money was transferred. + Loginid *string `json:"loginid,omitempty"` } // UnmarshalJSON implements json.Unmarshaler. @@ -198,10 +198,10 @@ func (j *StatementResp) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in StatementResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 b4dd9c2..05499c3 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 v, ok := raw["states_list"]; !ok || v == nil { + if _, ok := raw["states_list"]; raw != nil && !ok { 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 075a37e..11f1f65 100644 --- a/schema/states_list_resp.go +++ b/schema/states_list_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in StatesListResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in StatesListResp: required") } type Plain StatesListResp diff --git a/schema/ticks.go b/schema/ticks.go index 003d1ff..e0f3cf9 100644 --- a/schema/ticks.go +++ b/schema/ticks.go @@ -6,6 +6,23 @@ 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{} @@ -36,30 +53,13 @@ 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 v, ok := raw["ticks"]; !ok || v == nil { + if _, ok := raw["ticks"]; raw != nil && !ok { return fmt.Errorf("field ticks in Ticks: required") } type Plain Ticks diff --git a/schema/ticks_history.go b/schema/ticks_history.go index ee85c73..b138400 100644 --- a/schema/ticks_history.go +++ b/schema/ticks_history.go @@ -49,22 +49,32 @@ type TicksHistory struct { type TicksHistoryAdjustStartTime int -type TicksHistoryGranularity int - -// [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" - -type TicksHistorySubscribe int - var enumValues_TicksHistoryAdjustStartTime = []interface{}{ 1, } + +// 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 +} + +type TicksHistoryGranularity int + var enumValues_TicksHistoryGranularity = []interface{}{ 60, 120, @@ -81,50 +91,61 @@ var enumValues_TicksHistoryGranularity = []interface{}{ } // 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 } +// [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 *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 } +type TicksHistorySubscribe int + var enumValues_TicksHistorySubscribe = []interface{}{ 1, } @@ -149,36 +170,16 @@ 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 v, ok := raw["end"]; !ok || v == nil { + if _, ok := raw["end"]; raw != nil && !ok { return fmt.Errorf("field end in TicksHistory: required") } - if v, ok := raw["ticks_history"]; !ok || v == nil { + if _, ok := raw["ticks_history"]; raw != nil && !ok { 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 b9ba8e6..cf51a74 100644 --- a/schema/ticks_history_resp.go +++ b/schema/ticks_history_resp.go @@ -76,8 +76,16 @@ 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 @@ -98,8 +106,6 @@ 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 { @@ -148,7 +154,7 @@ func (j *TicksHistoryRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in TicksHistoryRespSubscription: required") } type Plain TicksHistoryRespSubscription @@ -160,23 +166,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TicksHistoryResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 7f047b5..2fc0c22 100644 --- a/schema/ticks_resp.go +++ b/schema/ticks_resp.go @@ -6,11 +6,33 @@ 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", } @@ -35,8 +57,6 @@ 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 @@ -50,7 +70,7 @@ func (j *TicksRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in TicksRespSubscription: required") } type Plain TicksRespSubscription @@ -94,7 +114,7 @@ func (j *TicksRespTick) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["pip_size"]; !ok || v == nil { + if _, ok := raw["pip_size"]; raw != nil && !ok { return fmt.Errorf("field pip_size in TicksRespTick: required") } type Plain TicksRespTick @@ -106,36 +126,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TicksResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in TicksResp: required") } type Plain TicksResp diff --git a/schema/time.go b/schema/time.go index dfa2268..ec0d9ef 100644 --- a/schema/time.go +++ b/schema/time.go @@ -6,6 +6,19 @@ 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{} @@ -36,26 +49,13 @@ 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 v, ok := raw["time"]; !ok || v == nil { + if _, ok := raw["time"]; raw != nil && !ok { return fmt.Errorf("field time in Time: required") } type Plain Time diff --git a/schema/time_resp.go b/schema/time_resp.go index 9bface3..b4ae53c 100644 --- a/schema/time_resp.go +++ b/schema/time_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,34 +53,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TimeResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in TimeResp: required") } type Plain TimeResp diff --git a/schema/tnc_approval.go b/schema/tnc_approval.go index 6b7c59e..e9548ef 100644 --- a/schema/tnc_approval.go +++ b/schema/tnc_approval.go @@ -6,6 +6,29 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{}{ @@ -88,36 +111,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["tnc_approval"]; !ok || v == nil { + if _, ok := raw["tnc_approval"]; raw != nil && !ok { 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 c67600b..549f713 100644 --- a/schema/tnc_approval_resp.go +++ b/schema/tnc_approval_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ func (j *TncApprovalRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const TncApprovalRespMsgTypeTncApproval TncApprovalRespMsgType = "tnc_approval" - type TncApprovalRespTncApproval int var enumValues_TncApprovalRespTncApproval = []interface{}{ @@ -63,32 +79,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TncApprovalResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 0232678..d00cdb6 100644 --- a/schema/topup_virtual.go +++ b/schema/topup_virtual.go @@ -6,6 +6,24 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -36,31 +54,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["topup_virtual"]; !ok || v == nil { + if _, ok := raw["topup_virtual"]; raw != nil && !ok { 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 84e8b82..0239315 100644 --- a/schema/topup_virtual_resp.go +++ b/schema/topup_virtual_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,24 +53,6 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TopupVirtualResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 bf5e314..b0e00b7 100644 --- a/schema/trading_durations.go +++ b/schema/trading_durations.go @@ -46,7 +46,15 @@ const TradingDurationsLandingCompanyShortMaltainvest TradingDurationsLandingComp const TradingDurationsLandingCompanyShortSvg TradingDurationsLandingCompanyShort = "svg" const TradingDurationsLandingCompanyShortVanuatu TradingDurationsLandingCompanyShort = "vanuatu" const TradingDurationsLandingCompanyShortVirtual TradingDurationsLandingCompanyShort = "virtual" -const TradingDurationsLandingCompanySvg TradingDurationsLandingCompany = "svg" + +var enumValues_TradingDurationsLandingCompanyShort = []interface{}{ + "iom", + "malta", + "maltainvest", + "svg", + "virtual", + "vanuatu", +} // UnmarshalJSON implements json.Unmarshaler. func (j *TradingDurationsLandingCompanyShort) UnmarshalJSON(b []byte) error { @@ -68,10 +76,11 @@ func (j *TradingDurationsLandingCompanyShort) UnmarshalJSON(b []byte) error { return nil } +const TradingDurationsLandingCompanySvg TradingDurationsLandingCompany = "svg" const TradingDurationsLandingCompanyVanuatu TradingDurationsLandingCompany = "vanuatu" const TradingDurationsLandingCompanyVirtual TradingDurationsLandingCompany = "virtual" -var enumValues_TradingDurationsLandingCompanyShort = []interface{}{ +var enumValues_TradingDurationsLandingCompany = []interface{}{ "iom", "malta", "maltainvest", @@ -130,22 +139,13 @@ 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 v, ok := raw["trading_durations"]; !ok || v == nil { + if _, ok := raw["trading_durations"]; raw != nil && !ok { 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 e84344d..eec5cda 100644 --- a/schema/trading_durations_resp.go +++ b/schema/trading_durations_resp.go @@ -31,6 +31,30 @@ 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"` @@ -131,40 +155,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TradingDurationsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 f6d1d33..476baba 100644 --- a/schema/trading_platform_investor_password_reset.go +++ b/schema/trading_platform_investor_password_reset.go @@ -6,12 +6,47 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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", } @@ -36,8 +71,6 @@ func (j *TradingPlatformInvestorPasswordResetPlatform) UnmarshalJSON(b []byte) e return nil } -const TradingPlatformInvestorPasswordResetPlatformMt5 TradingPlatformInvestorPasswordResetPlatform = "mt5" - type TradingPlatformInvestorPasswordResetTradingPlatformInvestorPasswordReset int var enumValues_TradingPlatformInvestorPasswordResetTradingPlatformInvestorPasswordReset = []interface{}{ @@ -64,58 +97,25 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["account_id"]; !ok || v == nil { + if _, ok := raw["account_id"]; raw != nil && !ok { return fmt.Errorf("field account_id in TradingPlatformInvestorPasswordReset: required") } - if v, ok := raw["new_password"]; !ok || v == nil { + if _, ok := raw["new_password"]; raw != nil && !ok { return fmt.Errorf("field new_password in TradingPlatformInvestorPasswordReset: required") } - if v, ok := raw["platform"]; !ok || v == nil { + if _, ok := raw["platform"]; raw != nil && !ok { return fmt.Errorf("field platform in TradingPlatformInvestorPasswordReset: required") } - if v, ok := raw["trading_platform_investor_password_reset"]; !ok || v == nil { + if _, ok := raw["trading_platform_investor_password_reset"]; raw != nil && !ok { return fmt.Errorf("field trading_platform_investor_password_reset in TradingPlatformInvestorPasswordReset: required") } - if v, ok := raw["verification_code"]; !ok || v == nil { + if _, ok := raw["verification_code"]; raw != nil && !ok { 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 7998d0b..56519d1 100644 --- a/schema/trading_platform_investor_password_reset_resp.go +++ b/schema/trading_platform_investor_password_reset_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ func (j *TradingPlatformInvestorPasswordResetRespMsgType) UnmarshalJSON(b []byte return nil } -const TradingPlatformInvestorPasswordResetRespMsgTypeTradingPlatformInvestorPasswordReset TradingPlatformInvestorPasswordResetRespMsgType = "trading_platform_investor_password_reset" - type TradingPlatformInvestorPasswordResetRespTradingPlatformPasswordReset int var enumValues_TradingPlatformInvestorPasswordResetRespTradingPlatformPasswordReset = []interface{}{ @@ -64,32 +80,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TradingPlatformInvestorPasswordResetResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 96cbdec..fdb2374 100644 --- a/schema/trading_platform_password_reset.go +++ b/schema/trading_platform_password_reset.go @@ -6,12 +6,47 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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", @@ -37,9 +72,6 @@ func (j *TradingPlatformPasswordResetPlatform) UnmarshalJSON(b []byte) error { return nil } -const TradingPlatformPasswordResetPlatformDxtrade TradingPlatformPasswordResetPlatform = "dxtrade" -const TradingPlatformPasswordResetPlatformMt5 TradingPlatformPasswordResetPlatform = "mt5" - type TradingPlatformPasswordResetTradingPlatformPasswordReset int var enumValues_TradingPlatformPasswordResetTradingPlatformPasswordReset = []interface{}{ @@ -66,54 +98,22 @@ func (j *TradingPlatformPasswordResetTradingPlatformPasswordReset) UnmarshalJSON return nil } -// Reset the password of a Trading Platform Account -type TradingPlatformPasswordReset struct { - // [Optional] The login id of the user. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["new_password"]; !ok || v == nil { + if _, ok := raw["new_password"]; raw != nil && !ok { return fmt.Errorf("field new_password in TradingPlatformPasswordReset: required") } - if v, ok := raw["platform"]; !ok || v == nil { + if _, ok := raw["platform"]; raw != nil && !ok { return fmt.Errorf("field platform in TradingPlatformPasswordReset: required") } - if v, ok := raw["trading_platform_password_reset"]; !ok || v == nil { + if _, ok := raw["trading_platform_password_reset"]; raw != nil && !ok { return fmt.Errorf("field trading_platform_password_reset in TradingPlatformPasswordReset: required") } - if v, ok := raw["verification_code"]; !ok || v == nil { + if _, ok := raw["verification_code"]; raw != nil && !ok { 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 1c8c757..2df600a 100644 --- a/schema/trading_platform_password_reset_resp.go +++ b/schema/trading_platform_password_reset_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ func (j *TradingPlatformPasswordResetRespMsgType) UnmarshalJSON(b []byte) error return nil } -const TradingPlatformPasswordResetRespMsgTypeTradingPlatformPasswordReset TradingPlatformPasswordResetRespMsgType = "trading_platform_password_reset" - type TradingPlatformPasswordResetRespTradingPlatformPasswordReset int var enumValues_TradingPlatformPasswordResetRespTradingPlatformPasswordReset = []interface{}{ @@ -64,32 +80,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TradingPlatformPasswordResetResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in TradingPlatformPasswordResetResp: required") } type Plain TradingPlatformPasswordResetResp diff --git a/schema/trading_servers.go b/schema/trading_servers.go index 9531517..effafa2 100644 --- a/schema/trading_servers.go +++ b/schema/trading_servers.go @@ -41,6 +41,31 @@ 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" @@ -49,27 +74,6 @@ 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", @@ -77,35 +81,37 @@ var enumValues_TradingServersEnvironment = []interface{}{ "Deriv-Server-02", "Deriv-Server-03", } -var enumValues_TradingServersMarketType = []interface{}{ - "all", - "financial", - "synthetic", -} // 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 } -var enumValues_TradingServersPlatform = []interface{}{ - "mt5", - "dxtrade", +type TradingServersMarketType string + +const TradingServersMarketTypeAll TradingServersMarketType = "all" +const TradingServersMarketTypeFinancial TradingServersMarketType = "financial" +const TradingServersMarketTypeSynthetic TradingServersMarketType = "synthetic" + +var enumValues_TradingServersMarketType = []interface{}{ + "all", + "financial", + "synthetic", } // UnmarshalJSON implements json.Unmarshaler. @@ -128,26 +134,42 @@ 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 *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 TradingServersTradingServers int + var enumValues_TradingServersTradingServers = []interface{}{ 1, } @@ -172,33 +194,13 @@ 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 v, ok := raw["trading_servers"]; !ok || v == nil { + if _, ok := raw["trading_servers"]; raw != nil && !ok { 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 3604915..4fd687e 100644 --- a/schema/trading_servers_resp.go +++ b/schema/trading_servers_resp.go @@ -29,6 +29,30 @@ 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"` @@ -65,93 +89,92 @@ type TradingServersRespTradingServersElemAccountType string const TradingServersRespTradingServersElemAccountTypeDemo TradingServersRespTradingServersElemAccountType = "demo" const TradingServersRespTradingServersElemAccountTypeReal TradingServersRespTradingServersElemAccountType = "real" -type TradingServersRespTradingServersElemDisabled int - -type TradingServersRespTradingServersElemEnvironment string - -const TradingServersRespTradingServersElemEnvironmentDerivDemo TradingServersRespTradingServersElemEnvironment = "Deriv-Demo" -const TradingServersRespTradingServersElemEnvironmentDerivServer TradingServersRespTradingServersElemEnvironment = "Deriv-Server" -const TradingServersRespTradingServersElemEnvironmentDerivServer02 TradingServersRespTradingServersElemEnvironment = "Deriv-Server-02" +var enumValues_TradingServersRespTradingServersElemAccountType = []interface{}{ + "demo", + "real", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespTradingServersElemId) 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_TradingServersRespTradingServersElemId { + 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_TradingServersRespTradingServersElemId, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemAccountType, v) } - *j = TradingServersRespTradingServersElemId(v) + *j = TradingServersRespTradingServersElemAccountType(v) return nil } -var enumValues_TradingServersRespTradingServersElemEnvironment = []interface{}{ - "Deriv-Demo", - "Deriv-Server", - "Deriv-Server-02", - "Deriv-Server-03", +type TradingServersRespTradingServersElemDisabled int + +var enumValues_TradingServersRespTradingServersElemDisabled = []interface{}{ + 0, + 1, } // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespTradingServersElemEnvironment) 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_TradingServersRespTradingServersElemEnvironment { + 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_TradingServersRespTradingServersElemEnvironment, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemDisabled, v) } - *j = TradingServersRespTradingServersElemEnvironment(v) + *j = TradingServersRespTradingServersElemDisabled(v) return nil } -var enumValues_TradingServersRespTradingServersElemDisabled = []interface{}{ - 0, - 1, +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespTradingServersElemAccountType) UnmarshalJSON(b []byte) error { +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_TradingServersRespTradingServersElemAccountType { + 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_TradingServersRespTradingServersElemAccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemEnvironment, v) } - *j = TradingServersRespTradingServersElemAccountType(v) + *j = TradingServersRespTradingServersElemEnvironment(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. @@ -169,6 +192,13 @@ 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", @@ -179,32 +209,25 @@ var enumValues_TradingServersRespTradingServersElemId = []interface{}{ } // UnmarshalJSON implements json.Unmarshaler. -func (j *TradingServersRespTradingServersElemDisabled) UnmarshalJSON(b []byte) error { - var v int +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_TradingServersRespTradingServersElemDisabled { + 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_TradingServersRespTradingServersElemDisabled, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TradingServersRespTradingServersElemId, v) } - *j = TradingServersRespTradingServersElemDisabled(v) + *j = TradingServersRespTradingServersElemId(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{}{ @@ -232,40 +255,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TradingServersResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 f563441..7764c53 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 v, ok := raw["trading_times"]; !ok || v == nil { + if _, ok := raw["trading_times"]; raw != nil && !ok { 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 83cfc66..80ac7ad 100644 --- a/schema/trading_times_resp.go +++ b/schema/trading_times_resp.go @@ -30,6 +30,30 @@ 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 { @@ -75,6 +99,24 @@ 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 @@ -95,23 +137,16 @@ 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 v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElem: required") } - if v, ok := raw["symbol"]; !ok || v == nil { + if _, ok := raw["symbol"]; raw != nil && !ok { return fmt.Errorf("field symbol in TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElem: required") } type Plain TradingTimesRespTradingTimesMarketsElemSubmarketsElemSymbolsElem @@ -123,18 +158,16 @@ 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 v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in TradingTimesRespTradingTimesMarketsElemSubmarketsElem: required") } - if v, ok := raw["symbols"]; !ok || v == nil { + if _, ok := raw["symbols"]; raw != nil && !ok { return fmt.Errorf("field symbols in TradingTimesRespTradingTimesMarketsElemSubmarketsElem: required") } type Plain TradingTimesRespTradingTimesMarketsElemSubmarketsElem @@ -146,23 +179,13 @@ 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 v, ok := raw["name"]; !ok || v == nil { + if _, ok := raw["name"]; raw != nil && !ok { return fmt.Errorf("field name in TradingTimesRespTradingTimesMarketsElem: required") } type Plain TradingTimesRespTradingTimesMarketsElem @@ -174,33 +197,13 @@ 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 v, ok := raw["markets"]; !ok || v == nil { + if _, ok := raw["markets"]; raw != nil && !ok { return fmt.Errorf("field markets in TradingTimesRespTradingTimes: required") } type Plain TradingTimesRespTradingTimes @@ -212,20 +215,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TradingTimesResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in TradingTimesResp: required") } type Plain TradingTimesResp diff --git a/schema/transaction.go b/schema/transaction.go index 7fedf15..5aa5c4e 100644 --- a/schema/transaction.go +++ b/schema/transaction.go @@ -6,6 +6,27 @@ import "encoding/json" import "fmt" import "reflect" +// Subscribe to transaction notifications +type Transaction struct { + // [Optional] The login id of the user. If left unspecified, it defaults to the + // initial authorized token's login id. + 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{} @@ -62,37 +83,16 @@ func (j *TransactionTransaction) UnmarshalJSON(b []byte) error { return nil } -// Subscribe to transaction notifications -type Transaction struct { - // [Optional] The login id of the user. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["subscribe"]; !ok || v == nil { + if _, ok := raw["subscribe"]; raw != nil && !ok { return fmt.Errorf("field subscribe in Transaction: required") } - if v, ok := raw["transaction"]; !ok || v == nil { + if _, ok := raw["transaction"]; raw != nil && !ok { return fmt.Errorf("field transaction in Transaction: required") } type Plain Transaction diff --git a/schema/transaction_resp.go b/schema/transaction_resp.go index 8403d46..b392394 100644 --- a/schema/transaction_resp.go +++ b/schema/transaction_resp.go @@ -32,6 +32,30 @@ 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 @@ -39,6 +63,24 @@ 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. @@ -68,7 +110,7 @@ type TransactionRespTransaction struct { DisplayName *string `json:"display_name,omitempty"` // The high barrier of a contract. Only applicable to double barrier contracts. - HighBarrier *string `json:"high_barrier,omitempty"` + HighBarrier interface{} `json:"high_barrier,omitempty"` // A per-connection unique identifier. Can be passed to the `forget` API call to // unsubscribe. @@ -114,6 +156,8 @@ 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{}{ @@ -147,61 +191,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TransactionResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 1510e09..9eb8c80 100644 --- a/schema/transfer_between_accounts.go +++ b/schema/transfer_between_accounts.go @@ -6,8 +6,49 @@ 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. If left unspecified, it defaults to the + // initial authorized token's login id. + 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", @@ -33,9 +74,6 @@ 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{} @@ -66,51 +104,13 @@ 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. If left unspecified, it defaults to the - // initial authorized token's login id. - 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 v, ok := raw["transfer_between_accounts"]; !ok || v == nil { + if _, ok := raw["transfer_between_accounts"]; raw != nil && !ok { 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 b616817..80d3eb5 100644 --- a/schema/transfer_between_accounts_resp.go +++ b/schema/transfer_between_accounts_resp.go @@ -85,6 +85,31 @@ type TransferBetweenAccountsRespAccountsElemAccountCategory string const TransferBetweenAccountsRespAccountsElemAccountCategoryTrading TransferBetweenAccountsRespAccountsElemAccountCategory = "trading" const TransferBetweenAccountsRespAccountsElemAccountCategoryWallet TransferBetweenAccountsRespAccountsElemAccountCategory = "wallet" +var enumValues_TransferBetweenAccountsRespAccountsElemAccountCategory = []interface{}{ + "trading", + "wallet", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *TransferBetweenAccountsRespAccountsElemAccountCategory) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemAccountCategory { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemAccountCategory, v) + } + *j = TransferBetweenAccountsRespAccountsElemAccountCategory(v) + return nil +} + type TransferBetweenAccountsRespAccountsElemAccountType string const TransferBetweenAccountsRespAccountsElemAccountTypeBinary TransferBetweenAccountsRespAccountsElemAccountType = "binary" @@ -100,124 +125,147 @@ const TransferBetweenAccountsRespAccountsElemAccountTypePaymentagentClient Trans 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" +var enumValues_TransferBetweenAccountsRespAccountsElemAccountType = []interface{}{ + "binary", + "crypto", + "ctrader", + "doughflow", + "dxtrade", + "derivez", + "mt5", + "p2p", + "paymentagent", + "paymentagent_client", + "standard", + "virtual", +} // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemTransfers) UnmarshalJSON(b []byte) error { +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_TransferBetweenAccountsRespAccountsElemTransfers { + 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_TransferBetweenAccountsRespAccountsElemTransfers, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemAccountType, v) } - *j = TransferBetweenAccountsRespAccountsElemTransfers(v) + *j = TransferBetweenAccountsRespAccountsElemAccountType(v) return nil } +type TransferBetweenAccountsRespAccountsElemDemoAccount int + +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 } -var enumValues_TransferBetweenAccountsRespAccountsElemProduct = []interface{}{ - "", - "synthetic", +type TransferBetweenAccountsRespAccountsElemMarketType string + +const TransferBetweenAccountsRespAccountsElemMarketTypeAll TransferBetweenAccountsRespAccountsElemMarketType = "all" +const TransferBetweenAccountsRespAccountsElemMarketTypeFinancial TransferBetweenAccountsRespAccountsElemMarketType = "financial" +const TransferBetweenAccountsRespAccountsElemMarketTypeSynthetic TransferBetweenAccountsRespAccountsElemMarketType = "synthetic" + +var enumValues_TransferBetweenAccountsRespAccountsElemMarketType = []interface{}{ + "all", "financial", - "swap_free", - "zero_spread", - "standard", - "stp", + "synthetic", } // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemAccountType) 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_TransferBetweenAccountsRespAccountsElemAccountType { + 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_TransferBetweenAccountsRespAccountsElemAccountType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemMarketType, v) } - *j = TransferBetweenAccountsRespAccountsElemAccountType(v) + *j = TransferBetweenAccountsRespAccountsElemMarketType(v) return nil } -var enumValues_TransferBetweenAccountsRespAccountsElemDemoAccount = []interface{}{ - 0, - 1, +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", } // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemDemoAccount) UnmarshalJSON(b []byte) error { - var v int +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_TransferBetweenAccountsRespAccountsElemDemoAccount { + 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_TransferBetweenAccountsRespAccountsElemDemoAccount, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemProduct, v) } - *j = TransferBetweenAccountsRespAccountsElemDemoAccount(v) + *j = TransferBetweenAccountsRespAccountsElemProduct(v) return nil } +type TransferBetweenAccountsRespAccountsElemSubAccountType string + +const TransferBetweenAccountsRespAccountsElemSubAccountTypeFinancial TransferBetweenAccountsRespAccountsElemSubAccountType = "financial" +const TransferBetweenAccountsRespAccountsElemSubAccountTypeFinancialStp TransferBetweenAccountsRespAccountsElemSubAccountType = "financial_stp" +const TransferBetweenAccountsRespAccountsElemSubAccountTypeStandard TransferBetweenAccountsRespAccountsElemSubAccountType = "standard" +const TransferBetweenAccountsRespAccountsElemSubAccountTypeSwapFree TransferBetweenAccountsRespAccountsElemSubAccountType = "swap_free" + var enumValues_TransferBetweenAccountsRespAccountsElemSubAccountType = []interface{}{ "financial", "financial_stp", @@ -245,88 +293,47 @@ func (j *TransferBetweenAccountsRespAccountsElemSubAccountType) UnmarshalJSON(b return nil } -var enumValues_TransferBetweenAccountsRespAccountsElemMarketType = []interface{}{ - "all", - "financial", - "synthetic", -} - -// UnmarshalJSON implements json.Unmarshaler. -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_TransferBetweenAccountsRespAccountsElemMarketType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemMarketType, v) - } - *j = TransferBetweenAccountsRespAccountsElemMarketType(v) - return nil -} - -const TransferBetweenAccountsRespAccountsElemSubAccountTypeStandard TransferBetweenAccountsRespAccountsElemSubAccountType = "standard" -const TransferBetweenAccountsRespAccountsElemSubAccountTypeSwapFree TransferBetweenAccountsRespAccountsElemSubAccountType = "swap_free" - type TransferBetweenAccountsRespAccountsElemTransfers string +const TransferBetweenAccountsRespAccountsElemTransfersAll TransferBetweenAccountsRespAccountsElemTransfers = "all" +const TransferBetweenAccountsRespAccountsElemTransfersDeposit TransferBetweenAccountsRespAccountsElemTransfers = "deposit" +const TransferBetweenAccountsRespAccountsElemTransfersNone TransferBetweenAccountsRespAccountsElemTransfers = "none" +const TransferBetweenAccountsRespAccountsElemTransfersWithdrawal TransferBetweenAccountsRespAccountsElemTransfers = "withdrawal" + var enumValues_TransferBetweenAccountsRespAccountsElemTransfers = []interface{}{ "all", "deposit", "none", "withdrawal", } -var enumValues_TransferBetweenAccountsRespAccountsElemAccountType = []interface{}{ - "binary", - "crypto", - "ctrader", - "doughflow", - "dxtrade", - "derivez", - "mt5", - "p2p", - "paymentagent", - "paymentagent_client", - "standard", - "virtual", -} // UnmarshalJSON implements json.Unmarshaler. -func (j *TransferBetweenAccountsRespAccountsElemAccountCategory) UnmarshalJSON(b []byte) error { +func (j *TransferBetweenAccountsRespAccountsElemTransfers) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemAccountCategory { + for _, expected := range enumValues_TransferBetweenAccountsRespAccountsElemTransfers { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemAccountCategory, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_TransferBetweenAccountsRespAccountsElemTransfers, v) } - *j = TransferBetweenAccountsRespAccountsElemAccountCategory(v) + *j = TransferBetweenAccountsRespAccountsElemTransfers(v) return nil } -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", } @@ -351,8 +358,6 @@ func (j *TransferBetweenAccountsRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const TransferBetweenAccountsRespMsgTypeTransferBetweenAccounts TransferBetweenAccountsRespMsgType = "transfer_between_accounts" - type TransferBetweenAccountsRespTransferBetweenAccounts int var enumValues_TransferBetweenAccountsRespTransferBetweenAccounts = []interface{}{ @@ -380,21 +385,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in TransferBetweenAccountsResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 5ce63c5..6f4d7c2 100644 --- a/schema/unsubscribe_email.go +++ b/schema/unsubscribe_email.go @@ -6,6 +6,25 @@ 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{} @@ -36,38 +55,19 @@ 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 v, ok := raw["binary_user_id"]; !ok || v == nil { + if _, ok := raw["binary_user_id"]; raw != nil && !ok { return fmt.Errorf("field binary_user_id in UnsubscribeEmail: required") } - if v, ok := raw["checksum"]; !ok || v == nil { + if _, ok := raw["checksum"]; raw != nil && !ok { return fmt.Errorf("field checksum in UnsubscribeEmail: required") } - if v, ok := raw["unsubscribe_email"]; !ok || v == nil { + if _, ok := raw["unsubscribe_email"]; raw != nil && !ok { 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 c489c5f..fc6fa94 100644 --- a/schema/unsubscribe_email_resp.go +++ b/schema/unsubscribe_email_resp.go @@ -6,6 +6,26 @@ 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{} @@ -38,6 +58,8 @@ func (j *UnsubscribeEmailRespEmailUnsubscribeStatus) UnmarshalJSON(b []byte) err type UnsubscribeEmailRespMsgType string +const UnsubscribeEmailRespMsgTypeUnsubscribeEmail UnsubscribeEmailRespMsgType = "unsubscribe_email" + var enumValues_UnsubscribeEmailRespMsgType = []interface{}{ "unsubscribe_email", } @@ -62,38 +84,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in UnsubscribeEmailResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 d7e0099..5a224de 100644 --- a/schema/verify_email.go +++ b/schema/verify_email.go @@ -48,6 +48,19 @@ const VerifyEmailTypeTradingPlatformDxtradePasswordReset VerifyEmailType = "trad const VerifyEmailTypeTradingPlatformInvestorPasswordReset VerifyEmailType = "trading_platform_investor_password_reset" const VerifyEmailTypeTradingPlatformMt5PasswordReset VerifyEmailType = "trading_platform_mt5_password_reset" +var enumValues_VerifyEmailType = []interface{}{ + "partner_account_opening", + "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", +} + // UnmarshalJSON implements json.Unmarshaler. func (j *VerifyEmailType) UnmarshalJSON(b []byte) error { var v string @@ -68,33 +81,6 @@ 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. @@ -177,20 +163,34 @@ type VerifyEmailUrlParameters struct { UtmTerm interface{} `json:"utm_term,omitempty"` } +type VerifyEmailUrlParametersSignupDevice string + const VerifyEmailUrlParametersSignupDeviceDesktop VerifyEmailUrlParametersSignupDevice = "desktop" const VerifyEmailUrlParametersSignupDeviceMobile VerifyEmailUrlParametersSignupDevice = "mobile" -var enumValues_VerifyEmailType = []interface{}{ - "partner_account_opening", - "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", +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 } // 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 v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in VerifyEmail: required") } - if v, ok := raw["verify_email"]; !ok || v == nil { + if _, ok := raw["verify_email"]; raw != nil && !ok { return fmt.Errorf("field verify_email in VerifyEmail: required") } type Plain VerifyEmail diff --git a/schema/verify_email_cellxpert.go b/schema/verify_email_cellxpert.go index 36c8144..dde5337 100644 --- a/schema/verify_email_cellxpert.go +++ b/schema/verify_email_cellxpert.go @@ -38,6 +38,30 @@ type VerifyEmailCellxpertType string const VerifyEmailCellxpertTypePartnerAccountOpening VerifyEmailCellxpertType = "partner_account_opening" +var enumValues_VerifyEmailCellxpertType = []interface{}{ + "partner_account_opening", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *VerifyEmailCellxpertType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_VerifyEmailCellxpertType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_VerifyEmailCellxpertType, v) + } + *j = VerifyEmailCellxpertType(v) + return nil +} + // [Optional] Extra parameters that can be attached to the verify email link URL. type VerifyEmailCellxpertUrlParameters struct { // [Optional] Affiliate token, within 32 characters. @@ -128,65 +152,41 @@ type VerifyEmailCellxpertUrlParametersSignupDevice string const VerifyEmailCellxpertUrlParametersSignupDeviceDesktop VerifyEmailCellxpertUrlParametersSignupDevice = "desktop" const VerifyEmailCellxpertUrlParametersSignupDeviceMobile VerifyEmailCellxpertUrlParametersSignupDevice = "mobile" -// UnmarshalJSON implements json.Unmarshaler. -func (j *VerifyEmailCellxpertUrlParametersSignupDevice) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_VerifyEmailCellxpertUrlParametersSignupDevice { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_VerifyEmailCellxpertUrlParametersSignupDevice, v) - } - *j = VerifyEmailCellxpertUrlParametersSignupDevice(v) - return nil -} - var enumValues_VerifyEmailCellxpertUrlParametersSignupDevice = []interface{}{ "desktop", "mobile", } // UnmarshalJSON implements json.Unmarshaler. -func (j *VerifyEmailCellxpertType) UnmarshalJSON(b []byte) error { +func (j *VerifyEmailCellxpertUrlParametersSignupDevice) UnmarshalJSON(b []byte) error { var v string if err := json.Unmarshal(b, &v); err != nil { return err } var ok bool - for _, expected := range enumValues_VerifyEmailCellxpertType { + for _, expected := range enumValues_VerifyEmailCellxpertUrlParametersSignupDevice { if reflect.DeepEqual(v, expected) { ok = true break } } if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_VerifyEmailCellxpertType, v) + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_VerifyEmailCellxpertUrlParametersSignupDevice, v) } - *j = VerifyEmailCellxpertType(v) + *j = VerifyEmailCellxpertUrlParametersSignupDevice(v) return nil } -var enumValues_VerifyEmailCellxpertType = []interface{}{ - "partner_account_opening", -} - // UnmarshalJSON implements json.Unmarshaler. func (j *VerifyEmailCellxpert) UnmarshalJSON(b []byte) error { var raw map[string]interface{} if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["type"]; !ok || v == nil { + if _, ok := raw["type"]; raw != nil && !ok { return fmt.Errorf("field type in VerifyEmailCellxpert: required") } - if v, ok := raw["verify_email_cellxpert"]; !ok || v == nil { + if _, ok := raw["verify_email_cellxpert"]; raw != nil && !ok { return fmt.Errorf("field verify_email_cellxpert in VerifyEmailCellxpert: required") } type Plain VerifyEmailCellxpert diff --git a/schema/verify_email_cellxpert_resp.go b/schema/verify_email_cellxpert_resp.go index 01e26a3..3cd04c5 100644 --- a/schema/verify_email_cellxpert_resp.go +++ b/schema/verify_email_cellxpert_resp.go @@ -6,11 +6,29 @@ import "encoding/json" import "fmt" import "reflect" +// Verify Email Cellxpert Receive +type VerifyEmailCellxpertResp struct { + // Echo of the request made. + EchoReq VerifyEmailCellxpertRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType VerifyEmailCellxpertRespMsgType `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) + VerifyEmailCellxpert *VerifyEmailCellxpertRespVerifyEmailCellxpert `json:"verify_email_cellxpert,omitempty"` +} + // Echo of the request made. type VerifyEmailCellxpertRespEchoReq map[string]interface{} type VerifyEmailCellxpertRespMsgType string +const VerifyEmailCellxpertRespMsgTypeVerifyEmailCellxpert VerifyEmailCellxpertRespMsgType = "verify_email_cellxpert" + var enumValues_VerifyEmailCellxpertRespMsgType = []interface{}{ "verify_email_cellxpert", } @@ -35,8 +53,6 @@ func (j *VerifyEmailCellxpertRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const VerifyEmailCellxpertRespMsgTypeVerifyEmailCellxpert VerifyEmailCellxpertRespMsgType = "verify_email_cellxpert" - type VerifyEmailCellxpertRespVerifyEmailCellxpert int var enumValues_VerifyEmailCellxpertRespVerifyEmailCellxpert = []interface{}{ @@ -64,32 +80,16 @@ func (j *VerifyEmailCellxpertRespVerifyEmailCellxpert) UnmarshalJSON(b []byte) e return nil } -// Verify Email Cellxpert Receive -type VerifyEmailCellxpertResp struct { - // Echo of the request made. - EchoReq VerifyEmailCellxpertRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType VerifyEmailCellxpertRespMsgType `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) - VerifyEmailCellxpert *VerifyEmailCellxpertRespVerifyEmailCellxpert `json:"verify_email_cellxpert,omitempty"` -} - // UnmarshalJSON implements json.Unmarshaler. func (j *VerifyEmailCellxpertResp) 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 { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in VerifyEmailCellxpertResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in VerifyEmailCellxpertResp: required") } type Plain VerifyEmailCellxpertResp diff --git a/schema/verify_email_resp.go b/schema/verify_email_resp.go index 680bc9b..fc18fc8 100644 --- a/schema/verify_email_resp.go +++ b/schema/verify_email_resp.go @@ -6,11 +6,29 @@ 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", } @@ -35,8 +53,6 @@ func (j *VerifyEmailRespMsgType) UnmarshalJSON(b []byte) error { return nil } -const VerifyEmailRespMsgTypeVerifyEmail VerifyEmailRespMsgType = "verify_email" - type VerifyEmailRespVerifyEmail int var enumValues_VerifyEmailRespVerifyEmail = []interface{}{ @@ -64,32 +80,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in VerifyEmailResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { 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 9cc07a1..d060fb3 100644 --- a/schema/website_config.go +++ b/schema/website_config.go @@ -6,6 +6,19 @@ 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{} @@ -36,26 +49,13 @@ 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 v, ok := raw["website_config"]; !ok || v == nil { + if _, ok := raw["website_config"]; raw != nil && !ok { 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 ab39453..caae9a6 100644 --- a/schema/website_config_resp.go +++ b/schema/website_config_resp.go @@ -6,46 +6,34 @@ import "encoding/json" import "fmt" import "reflect" -// 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 +// 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"` } -// Initial deposit requirement per country. -type WebsiteConfigRespWebsiteConfigPaymentAgentsInitialDepositPerCountry map[string]interface{} +// Echo of the request made. +type WebsiteConfigRespEchoReq map[string]interface{} -// 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 +type WebsiteConfigRespMsgType string + +const WebsiteConfigRespMsgTypeWebsiteConfig WebsiteConfigRespMsgType = "website_config" + +var enumValues_WebsiteConfigRespMsgType = []interface{}{ + "website_config", } // UnmarshalJSON implements json.Unmarshaler. @@ -68,8 +56,6 @@ 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 @@ -77,35 +63,21 @@ 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 *WebsiteConfigRespWebsiteConfigPaymentAgents) UnmarshalJSON(b []byte) error { +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["initial_deposit_per_country"]; !ok || v == nil { - return fmt.Errorf("field initial_deposit_per_country in WebsiteConfigRespWebsiteConfigPaymentAgents: required") + if _, ok := raw["id"]; raw != nil && !ok { + return fmt.Errorf("field id in WebsiteConfigRespSubscription: required") } - type Plain WebsiteConfigRespWebsiteConfigPaymentAgents + type Plain WebsiteConfigRespSubscription var plain Plain if err := json.Unmarshal(b, &plain); err != nil { return err } - *j = WebsiteConfigRespWebsiteConfigPaymentAgents(plain) + *j = WebsiteConfigRespSubscription(plain) return nil } @@ -129,13 +101,43 @@ 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 v, ok := raw["currencies_config"]; !ok || v == nil { + if _, ok := raw["currencies_config"]; raw != nil && !ok { return fmt.Errorf("field currencies_config in WebsiteConfigRespWebsiteConfig: required") } type Plain WebsiteConfigRespWebsiteConfig @@ -147,25 +149,23 @@ func (j *WebsiteConfigRespWebsiteConfig) UnmarshalJSON(b []byte) error { 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", +// 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 } diff --git a/schema/website_status.go b/schema/website_status.go index 7eaab0d..526ed98 100644 --- a/schema/website_status.go +++ b/schema/website_status.go @@ -6,6 +6,22 @@ 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{} @@ -63,29 +79,13 @@ 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 v, ok := raw["website_status"]; !ok || v == nil { + if _, ok := raw["website_status"]; raw != nil && !ok { 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 56669dc..de2968b 100644 --- a/schema/website_status_resp.go +++ b/schema/website_status_resp.go @@ -6,11 +6,33 @@ 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", } @@ -35,8 +57,6 @@ 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 @@ -50,7 +70,7 @@ func (j *WebsiteStatusRespSubscription) UnmarshalJSON(b []byte) error { if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["id"]; !ok || v == nil { + if _, ok := raw["id"]; raw != nil && !ok { return fmt.Errorf("field id in WebsiteStatusRespSubscription: required") } type Plain WebsiteStatusRespSubscription @@ -62,6 +82,61 @@ 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. @@ -77,10 +152,10 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription) Unm if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["applies_to"]; !ok || v == nil { + if _, ok := raw["applies_to"]; raw != nil && !ok { return fmt.Errorf("field applies_to in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription: required") } - if v, ok := raw["max"]; !ok || v == nil { + if _, ok := raw["max"]; raw != nil && !ok { return fmt.Errorf("field max in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimitsMaxProposalSubscription @@ -110,13 +185,13 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral) Unmarsh if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["applies_to"]; !ok || v == nil { + if _, ok := raw["applies_to"]; raw != nil && !ok { return fmt.Errorf("field applies_to in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral: required") } - if v, ok := raw["hourly"]; !ok || v == nil { + if _, ok := raw["hourly"]; raw != nil && !ok { return fmt.Errorf("field hourly in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral: required") } - if v, ok := raw["minutely"]; !ok || v == nil { + if _, ok := raw["minutely"]; raw != nil && !ok { return fmt.Errorf("field minutely in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestesGeneral @@ -146,13 +221,13 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome) Unmarsha if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["applies_to"]; !ok || v == nil { + if _, ok := raw["applies_to"]; raw != nil && !ok { return fmt.Errorf("field applies_to in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome: required") } - if v, ok := raw["hourly"]; !ok || v == nil { + if _, ok := raw["hourly"]; raw != nil && !ok { return fmt.Errorf("field hourly in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome: required") } - if v, ok := raw["minutely"]; !ok || v == nil { + if _, ok := raw["minutely"]; raw != nil && !ok { return fmt.Errorf("field minutely in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsOutcome @@ -182,13 +257,13 @@ func (j *WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing) Unmarsha if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["applies_to"]; !ok || v == nil { + if _, ok := raw["applies_to"]; raw != nil && !ok { return fmt.Errorf("field applies_to in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing: required") } - if v, ok := raw["hourly"]; !ok || v == nil { + if _, ok := raw["hourly"]; raw != nil && !ok { return fmt.Errorf("field hourly in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing: required") } - if v, ok := raw["minutely"]; !ok || v == nil { + if _, ok := raw["minutely"]; raw != nil && !ok { return fmt.Errorf("field minutely in WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimitsMaxRequestsPricing @@ -200,37 +275,22 @@ 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 v, ok := raw["max_proposal_subscription"]; !ok || v == nil { + if _, ok := raw["max_proposal_subscription"]; raw != nil && !ok { return fmt.Errorf("field max_proposal_subscription in WebsiteStatusRespWebsiteStatusApiCallLimits: required") } - if v, ok := raw["max_requestes_general"]; !ok || v == nil { + if _, ok := raw["max_requestes_general"]; raw != nil && !ok { return fmt.Errorf("field max_requestes_general in WebsiteStatusRespWebsiteStatusApiCallLimits: required") } - if v, ok := raw["max_requests_outcome"]; !ok || v == nil { + if _, ok := raw["max_requests_outcome"]; raw != nil && !ok { return fmt.Errorf("field max_requests_outcome in WebsiteStatusRespWebsiteStatusApiCallLimits: required") } - if v, ok := raw["max_requests_pricing"]; !ok || v == nil { + if _, ok := raw["max_requests_pricing"]; raw != nil && !ok { return fmt.Errorf("field max_requests_pricing in WebsiteStatusRespWebsiteStatusApiCallLimits: required") } type Plain WebsiteStatusRespWebsiteStatusApiCallLimits @@ -266,6 +326,93 @@ 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{}{ @@ -293,15 +440,6 @@ 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{}{ @@ -358,6 +496,10 @@ 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", @@ -384,12 +526,12 @@ func (j *WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts) UnmarshalJSON( return nil } -const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsDisabled WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "disabled" -const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsEnabled WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "enabled" -const WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdvertsListOnly WebsiteStatusRespWebsiteStatusP2PConfigFixedRateAdverts = "list_only" - type WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts string +const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsDisabled WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "disabled" +const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsEnabled WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "enabled" +const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsListOnly WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "list_only" + var enumValues_WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = []interface{}{ "disabled", "enabled", @@ -416,9 +558,20 @@ func (j *WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts) UnmarshalJSON( return nil } -const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsDisabled WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "disabled" -const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsEnabled WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "enabled" -const WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdvertsListOnly WebsiteStatusRespWebsiteStatusP2PConfigFloatRateAdverts = "list_only" +// 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"` +} type WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElemHasAdverts int @@ -473,34 +626,19 @@ 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 v, ok := raw["display_name"]; !ok || v == nil { + if _, ok := raw["display_name"]; raw != nil && !ok { return fmt.Errorf("field display_name in WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem: required") } - if v, ok := raw["has_adverts"]; !ok || v == nil { + if _, ok := raw["has_adverts"]; raw != nil && !ok { return fmt.Errorf("field has_adverts in WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem: required") } - if v, ok := raw["symbol"]; !ok || v == nil { + if _, ok := raw["symbol"]; raw != nil && !ok { return fmt.Errorf("field symbol in WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem: required") } type Plain WebsiteStatusRespWebsiteStatusP2PConfigLocalCurrenciesElem @@ -539,148 +677,70 @@ 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 v, ok := raw["adverts_active_limit"]; !ok || v == nil { + if _, ok := raw["adverts_active_limit"]; raw != nil && !ok { return fmt.Errorf("field adverts_active_limit in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["block_trade"]; !ok || v == nil { + if _, ok := raw["block_trade"]; raw != nil && !ok { return fmt.Errorf("field block_trade in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["cancellation_block_duration"]; !ok || v == nil { + if _, ok := raw["cancellation_block_duration"]; raw != nil && !ok { return fmt.Errorf("field cancellation_block_duration in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["cancellation_count_period"]; !ok || v == nil { + if _, ok := raw["cancellation_count_period"]; raw != nil && !ok { return fmt.Errorf("field cancellation_count_period in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["cancellation_grace_period"]; !ok || v == nil { + if _, ok := raw["cancellation_grace_period"]; raw != nil && !ok { return fmt.Errorf("field cancellation_grace_period in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["cancellation_limit"]; !ok || v == nil { + if _, ok := raw["cancellation_limit"]; raw != nil && !ok { return fmt.Errorf("field cancellation_limit in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["cross_border_ads_enabled"]; !ok || v == nil { + if _, ok := raw["cross_border_ads_enabled"]; raw != nil && !ok { return fmt.Errorf("field cross_border_ads_enabled in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["disabled"]; !ok || v == nil { + if _, ok := raw["disabled"]; raw != nil && !ok { return fmt.Errorf("field disabled in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["feature_level"]; !ok || v == nil { + if _, ok := raw["feature_level"]; raw != nil && !ok { return fmt.Errorf("field feature_level in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["fixed_rate_adverts"]; !ok || v == nil { + if _, ok := raw["fixed_rate_adverts"]; raw != nil && !ok { return fmt.Errorf("field fixed_rate_adverts in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["float_rate_adverts"]; !ok || v == nil { + if _, ok := raw["float_rate_adverts"]; raw != nil && !ok { return fmt.Errorf("field float_rate_adverts in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["float_rate_offset_limit"]; !ok || v == nil { + if _, ok := raw["float_rate_offset_limit"]; raw != nil && !ok { return fmt.Errorf("field float_rate_offset_limit in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["local_currencies"]; !ok || v == nil { + if _, ok := raw["local_currencies"]; raw != nil && !ok { return fmt.Errorf("field local_currencies in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["maximum_advert_amount"]; !ok || v == nil { + if _, ok := raw["maximum_advert_amount"]; raw != nil && !ok { return fmt.Errorf("field maximum_advert_amount in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["maximum_order_amount"]; !ok || v == nil { + if _, ok := raw["maximum_order_amount"]; raw != nil && !ok { return fmt.Errorf("field maximum_order_amount in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["order_daily_limit"]; !ok || v == nil { + if _, ok := raw["order_daily_limit"]; raw != nil && !ok { return fmt.Errorf("field order_daily_limit in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["order_payment_period"]; !ok || v == nil { + if _, ok := raw["order_payment_period"]; raw != nil && !ok { return fmt.Errorf("field order_payment_period in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["payment_methods_enabled"]; !ok || v == nil { + if _, ok := raw["payment_methods_enabled"]; raw != nil && !ok { return fmt.Errorf("field payment_methods_enabled in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["review_period"]; !ok || v == nil { + if _, ok := raw["review_period"]; raw != nil && !ok { return fmt.Errorf("field review_period in WebsiteStatusRespWebsiteStatusP2PConfig: required") } - if v, ok := raw["supported_currencies"]; !ok || v == nil { + if _, ok := raw["supported_currencies"]; raw != nil && !ok { return fmt.Errorf("field supported_currencies in WebsiteStatusRespWebsiteStatusP2PConfig: required") } type Plain WebsiteStatusRespWebsiteStatusP2PConfig @@ -707,7 +767,7 @@ func (j *WebsiteStatusRespWebsiteStatusPaymentAgents) UnmarshalJSON(b []byte) er if err := json.Unmarshal(b, &raw); err != nil { return err } - if v, ok := raw["initial_deposit_per_country"]; !ok || v == nil { + if _, ok := raw["initial_deposit_per_country"]; raw != nil && !ok { return fmt.Errorf("field initial_deposit_per_country in WebsiteStatusRespWebsiteStatusPaymentAgents: required") } type Plain WebsiteStatusRespWebsiteStatusPaymentAgents @@ -721,6 +781,10 @@ 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", @@ -747,60 +811,16 @@ 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 v, ok := raw["api_call_limits"]; !ok || v == nil { + if _, ok := raw["api_call_limits"]; raw != nil && !ok { return fmt.Errorf("field api_call_limits in WebsiteStatusRespWebsiteStatus: required") } - if v, ok := raw["currencies_config"]; !ok || v == nil { + if _, ok := raw["currencies_config"]; raw != nil && !ok { return fmt.Errorf("field currencies_config in WebsiteStatusRespWebsiteStatus: required") } type Plain WebsiteStatusRespWebsiteStatus @@ -812,36 +832,16 @@ 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 v, ok := raw["echo_req"]; !ok || v == nil { + if _, ok := raw["echo_req"]; raw != nil && !ok { return fmt.Errorf("field echo_req in WebsiteStatusResp: required") } - if v, ok := raw["msg_type"]; !ok || v == nil { + if _, ok := raw["msg_type"]; raw != nil && !ok { return fmt.Errorf("field msg_type in WebsiteStatusResp: required") } type Plain WebsiteStatusResp