From 899add98de5cdf91b05e32ff2ffadc34c0107729 Mon Sep 17 00:00:00 2001 From: Kirill Sysoev Date: Thu, 1 Feb 2024 08:03:15 +0000 Subject: [PATCH] Updates API schema --- calls.go | 8 + schema/confirm_email.go | 110 ++++++++ schema/confirm_email_resp.go | 102 +++++++ schema/mt5_login_list_resp.go | 501 +++++++++++++++++----------------- 4 files changed, 476 insertions(+), 245 deletions(-) create mode 100644 schema/confirm_email.go create mode 100644 schema/confirm_email_resp.go diff --git a/calls.go b/calls.go index 140a938..227ee7d 100644 --- a/calls.go +++ b/calls.go @@ -140,6 +140,14 @@ func (a *DerivAPI) Cashier(r schema.Cashier) (resp schema.CashierResp, err error return } +// ConfirmEmail Verifies the email for the user using verification code passed in the request object +func (a *DerivAPI) ConfirmEmail(r schema.ConfirmEmail) (resp schema.ConfirmEmailResp, err error) { + id := a.getNextRequestID() + r.ReqId = &id + err = a.SendRequest(id, r, &resp) + return +} + // ContractUpdate Update a contract condition. func (a *DerivAPI) ContractUpdate(r schema.ContractUpdate) (resp schema.ContractUpdateResp, err error) { id := a.getNextRequestID() diff --git a/schema/confirm_email.go b/schema/confirm_email.go new file mode 100644 index 0000000..f2bd1d5 --- /dev/null +++ b/schema/confirm_email.go @@ -0,0 +1,110 @@ +// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT. + +package schema + +import "encoding/json" +import "fmt" +import "reflect" + +type ConfirmEmailConfirmEmail int + +var enumValues_ConfirmEmailConfirmEmail = []interface{}{ + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ConfirmEmailConfirmEmail) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ConfirmEmailConfirmEmail { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ConfirmEmailConfirmEmail, v) + } + *j = ConfirmEmailConfirmEmail(v) + return nil +} + +type ConfirmEmailEmailConsent int + +var enumValues_ConfirmEmailEmailConsent = []interface{}{ + 1, + 0, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ConfirmEmailEmailConsent) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ConfirmEmailEmailConsent { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ConfirmEmailEmailConsent, v) + } + *j = ConfirmEmailEmailConsent(v) + 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{} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ConfirmEmail) UnmarshalJSON(b []byte) error { + var raw map[string]interface{} + if err := json.Unmarshal(b, &raw); err != nil { + return err + } + if v, ok := raw["confirm_email"]; !ok || v == nil { + return fmt.Errorf("field confirm_email in ConfirmEmail: required") + } + if v, ok := raw["email_consent"]; !ok || v == nil { + return fmt.Errorf("field email_consent in ConfirmEmail: required") + } + if v, ok := raw["verification_code"]; !ok || v == nil { + return fmt.Errorf("field verification_code in ConfirmEmail: required") + } + type Plain ConfirmEmail + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = ConfirmEmail(plain) + return nil +} diff --git a/schema/confirm_email_resp.go b/schema/confirm_email_resp.go new file mode 100644 index 0000000..8f857b4 --- /dev/null +++ b/schema/confirm_email_resp.go @@ -0,0 +1,102 @@ +// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT. + +package schema + +import "encoding/json" +import "fmt" +import "reflect" + +type ConfirmEmailRespConfirmEmail int + +var enumValues_ConfirmEmailRespConfirmEmail = []interface{}{ + 0, + 1, +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ConfirmEmailRespConfirmEmail) UnmarshalJSON(b []byte) error { + var v int + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ConfirmEmailRespConfirmEmail { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ConfirmEmailRespConfirmEmail, v) + } + *j = ConfirmEmailRespConfirmEmail(v) + return nil +} + +// Echo of the request made. +type ConfirmEmailRespEchoReq map[string]interface{} + +type ConfirmEmailRespMsgType string + +var enumValues_ConfirmEmailRespMsgType = []interface{}{ + "confirm_email", +} + +// UnmarshalJSON implements json.Unmarshaler. +func (j *ConfirmEmailRespMsgType) UnmarshalJSON(b []byte) error { + var v string + if err := json.Unmarshal(b, &v); err != nil { + return err + } + var ok bool + for _, expected := range enumValues_ConfirmEmailRespMsgType { + if reflect.DeepEqual(v, expected) { + ok = true + break + } + } + if !ok { + return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_ConfirmEmailRespMsgType, v) + } + *j = ConfirmEmailRespMsgType(v) + 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 { + return fmt.Errorf("field echo_req in ConfirmEmailResp: required") + } + if v, ok := raw["msg_type"]; !ok || v == nil { + return fmt.Errorf("field msg_type in ConfirmEmailResp: required") + } + type Plain ConfirmEmailResp + var plain Plain + if err := json.Unmarshal(b, &plain); err != nil { + return err + } + *j = ConfirmEmailResp(plain) + return nil +} diff --git a/schema/mt5_login_list_resp.go b/schema/mt5_login_list_resp.go index a6400e9..2566792 100644 --- a/schema/mt5_login_list_resp.go +++ b/schema/mt5_login_list_resp.go @@ -6,99 +6,98 @@ import "encoding/json" import "fmt" import "reflect" -// Get list of MT5 accounts for client. -type Mt5LoginListResp struct { - // Echo of the request made. - EchoReq Mt5LoginListRespEchoReq `json:"echo_req"` - - // Action name of the request made. - MsgType Mt5LoginListRespMsgType `json:"msg_type"` - - // Array containing MT5 account objects. - Mt5LoginList []Mt5LoginListRespMt5LoginListElem `json:"mt5_login_list,omitempty"` +// 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 +} - // 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 *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 } -// Echo of the request made. -type Mt5LoginListRespEchoReq map[string]interface{} +var enumValues_Mt5LoginListRespMsgType = []interface{}{ + "mt5_login_list", +} -type Mt5LoginListRespMsgType string +// 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 +} const Mt5LoginListRespMsgTypeMt5LoginList Mt5LoginListRespMsgType = "mt5_login_list" -type Mt5LoginListRespMt5LoginListElem struct { - // Account type. - AccountType *Mt5LoginListRespMt5LoginListElemAccountType `json:"account_type,omitempty"` - - // Balance of the MT5 account. - Balance *float64 `json:"balance,omitempty"` - - // Residence of the MT5 account. - Country *string `json:"country,omitempty"` - - // Currency of the MT5 account. - Currency *string `json:"currency,omitempty"` - - // Account balance, formatted to appropriate decimal places. - DisplayBalance *string `json:"display_balance,omitempty"` - - // [Optional] Determines the eligibility status for migrating a client account - // based on verification and account type. - EligibleToMigrate Mt5LoginListRespMt5LoginListElemEligibleToMigrate `json:"eligible_to_migrate,omitempty"` - - // Email address of the MT5 account. - Email *string `json:"email,omitempty"` - - // Error in MT5 account details. - Error *Mt5LoginListRespMt5LoginListElemError `json:"error,omitempty"` - - // Group type of the MT5 account, e.g. `demo\svg_financial` - Group *string `json:"group,omitempty"` - - // Broker name - LandingCompany *string `json:"landing_company,omitempty"` - - // Landing company shortcode of the MT5 account. - LandingCompanyShort *Mt5LoginListRespMt5LoginListElemLandingCompanyShort `json:"landing_company_short,omitempty"` - - // Leverage of the MT5 account (1 to 1000). - Leverage *float64 `json:"leverage,omitempty"` - - // Login of MT5 account. - Login *string `json:"login,omitempty"` - - // Market type - MarketType *Mt5LoginListRespMt5LoginListElemMarketType `json:"market_type,omitempty"` - - // Name of the owner of the MT5 account. - Name *string `json:"name,omitempty"` - - // Trade server name of the MT5 account. - Server *string `json:"server,omitempty"` - - // Trade server information. - ServerInfo *Mt5LoginListRespMt5LoginListElemServerInfo `json:"server_info,omitempty"` - - // MT5 account status. - Status *string `json:"status,omitempty"` - - // Sub account category - SubAccountCategory *Mt5LoginListRespMt5LoginListElemSubAccountCategory `json:"sub_account_category,omitempty"` - - // Sub account type refer to classic MT5 account - SubAccountType *Mt5LoginListRespMt5LoginListElemSubAccountType `json:"sub_account_type,omitempty"` - - // MT5 webtrader url for each mt5 platform - WebtraderUrl *string `json:"webtrader_url,omitempty"` +type Mt5LoginListRespMt5LoginListElemAccountType string - // Links to download the MT5 application for different platforms. - WhiteLabelDownloadLinks *Mt5LoginListRespMt5LoginListElemWhiteLabelDownloadLinks `json:"white_label_download_links,omitempty"` +var enumValues_Mt5LoginListRespMt5LoginListElemAccountType = []interface{}{ + "demo", + "real", } -type Mt5LoginListRespMt5LoginListElemAccountType string +// 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 +} const Mt5LoginListRespMt5LoginListElemAccountTypeDemo Mt5LoginListRespMt5LoginListElemAccountType = "demo" const Mt5LoginListRespMt5LoginListElemAccountTypeReal Mt5LoginListRespMt5LoginListElemAccountType = "real" @@ -107,6 +106,20 @@ const Mt5LoginListRespMt5LoginListElemAccountTypeReal Mt5LoginListRespMt5LoginLi // based on verification and account type. type Mt5LoginListRespMt5LoginListElemEligibleToMigrate map[string]interface{} +type Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment string + +var enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = []interface{}{ + "Deriv-Demo", + "Deriv-Server", + "Deriv-Server-02", + "Deriv-Server-03", +} +var enumValues_Mt5LoginListRespMt5LoginListElemMarketType = []interface{}{ + "financial", + "synthetic", + "all", +} + // Error in MT5 account details. type Mt5LoginListRespMt5LoginListElemError struct { // Error code string. @@ -146,8 +159,6 @@ type Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfo struct { Id *string `json:"id,omitempty"` } -type Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment string - const Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironmentDerivDemo Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = "Deriv-Demo" const Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironmentDerivServer Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = "Deriv-Server" const Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironmentDerivServer02 Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = "Deriv-Server-02" @@ -170,6 +181,19 @@ type Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoGeolocation struct { type Mt5LoginListRespMt5LoginListElemLandingCompanyShort string +var enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort = []interface{}{ + "bvi", + "labuan", + "malta", + "maltainvest", + "svg", + "vanuatu", + "seychelles", +} + +// Echo of the request made. +type Mt5LoginListRespEchoReq map[string]interface{} + const Mt5LoginListRespMt5LoginListElemLandingCompanyShortBvi Mt5LoginListRespMt5LoginListElemLandingCompanyShort = "bvi" const Mt5LoginListRespMt5LoginListElemLandingCompanyShortLabuan Mt5LoginListRespMt5LoginListElemLandingCompanyShort = "labuan" const Mt5LoginListRespMt5LoginListElemLandingCompanyShortMalta Mt5LoginListRespMt5LoginListElemLandingCompanyShort = "malta" @@ -178,55 +202,6 @@ const Mt5LoginListRespMt5LoginListElemLandingCompanyShortSeychelles Mt5LoginList const Mt5LoginListRespMt5LoginListElemLandingCompanyShortSvg Mt5LoginListRespMt5LoginListElemLandingCompanyShort = "svg" const Mt5LoginListRespMt5LoginListElemLandingCompanyShortVanuatu Mt5LoginListRespMt5LoginListElemLandingCompanyShort = "vanuatu" -type Mt5LoginListRespMt5LoginListElemMarketType string - -const Mt5LoginListRespMt5LoginListElemMarketTypeAll Mt5LoginListRespMt5LoginListElemMarketType = "all" -const Mt5LoginListRespMt5LoginListElemMarketTypeFinancial Mt5LoginListRespMt5LoginListElemMarketType = "financial" -const Mt5LoginListRespMt5LoginListElemMarketTypeSynthetic Mt5LoginListRespMt5LoginListElemMarketType = "synthetic" - -// Trade server information. -type Mt5LoginListRespMt5LoginListElemServerInfo struct { - // The environment. E.g. Deriv-Server. - Environment *Mt5LoginListRespMt5LoginListElemServerInfoEnvironment `json:"environment,omitempty"` - - // Geographical location of the server. - Geolocation *Mt5LoginListRespMt5LoginListElemServerInfoGeolocation `json:"geolocation,omitempty"` - - // Server id. - Id *string `json:"id,omitempty"` -} - -type Mt5LoginListRespMt5LoginListElemServerInfoEnvironment string - -const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivDemo Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Demo" -const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Server" -const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer02 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Server-02" -const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer03 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-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" - // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5LoginListRespMt5LoginListElemServerInfoEnvironment) UnmarshalJSON(b []byte) error { var v string @@ -247,35 +222,7 @@ func (j *Mt5LoginListRespMt5LoginListElemServerInfoEnvironment) UnmarshalJSON(b return nil } -// 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 -} - -var enumValues_Mt5LoginListRespMt5LoginListElemLandingCompanyShort = []interface{}{ - "bvi", - "labuan", - "malta", - "maltainvest", - "svg", - "vanuatu", - "seychelles", -} +type Mt5LoginListRespMsgType string // UnmarshalJSON implements json.Unmarshaler. func (j *Mt5LoginListRespMt5LoginListElemLandingCompanyShort) UnmarshalJSON(b []byte) error { @@ -297,6 +244,55 @@ func (j *Mt5LoginListRespMt5LoginListElemLandingCompanyShort) UnmarshalJSON(b [] return nil } +const Mt5LoginListRespMt5LoginListElemMarketTypeAll Mt5LoginListRespMt5LoginListElemMarketType = "all" +const Mt5LoginListRespMt5LoginListElemMarketTypeFinancial Mt5LoginListRespMt5LoginListElemMarketType = "financial" +const Mt5LoginListRespMt5LoginListElemMarketTypeSynthetic Mt5LoginListRespMt5LoginListElemMarketType = "synthetic" + +type Mt5LoginListRespMt5LoginListElemServerInfoEnvironment string + +var enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = []interface{}{ + "Deriv-Demo", + "Deriv-Server", + "Deriv-Server-02", + "Deriv-Server-03", +} + +type Mt5LoginListRespMt5LoginListElemMarketType string + +const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivDemo Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Demo" +const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Server" +const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer02 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-Server-02" +const Mt5LoginListRespMt5LoginListElemServerInfoEnvironmentDerivServer03 Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = "Deriv-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"` +} + +// Trade server information. +type Mt5LoginListRespMt5LoginListElemServerInfo struct { + // The environment. E.g. Deriv-Server. + Environment *Mt5LoginListRespMt5LoginListElemServerInfoEnvironment `json:"environment,omitempty"` + + // Geographical location of the server. + Geolocation *Mt5LoginListRespMt5LoginListElemServerInfoGeolocation `json:"geolocation,omitempty"` + + // Server id. + Id *string `json:"id,omitempty"` +} + +type Mt5LoginListRespMt5LoginListElemSubAccountCategory string + var enumValues_Mt5LoginListRespMt5LoginListElemSubAccountCategory = []interface{}{ "", "swap_free", @@ -326,68 +322,12 @@ func (j *Mt5LoginListRespMt5LoginListElemSubAccountCategory) UnmarshalJSON(b []b 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 -} - -var enumValues_Mt5LoginListRespMt5LoginListElemAccountType = []interface{}{ - "demo", - "real", -} - -// 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 -} - -var enumValues_Mt5LoginListRespMt5LoginListElemMarketType = []interface{}{ - "financial", - "synthetic", - "all", -} -var enumValues_Mt5LoginListRespMt5LoginListElemErrorDetailsServerInfoEnvironment = []interface{}{ - "Deriv-Demo", - "Deriv-Server", - "Deriv-Server-02", - "Deriv-Server-03", -} -var enumValues_Mt5LoginListRespMt5LoginListElemServerInfoEnvironment = []interface{}{ - "Deriv-Demo", - "Deriv-Server", - "Deriv-Server-02", - "Deriv-Server-03", -} +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryBlank Mt5LoginListRespMt5LoginListElemSubAccountCategory = "" +const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFree Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free" +const Mt5LoginListRespMt5LoginListElemSubAccountCategorySwapFreeHighRisk Mt5LoginListRespMt5LoginListElemSubAccountCategory = "swap_free_high_risk" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryIbt Mt5LoginListRespMt5LoginListElemSubAccountCategory = "ibt" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryStp Mt5LoginListRespMt5LoginListElemSubAccountCategory = "stp" +const Mt5LoginListRespMt5LoginListElemSubAccountCategoryLim Mt5LoginListRespMt5LoginListElemSubAccountCategory = "lim" type Mt5LoginListRespMt5LoginListElemSubAccountType string @@ -435,28 +375,99 @@ type Mt5LoginListRespMt5LoginListElemWhiteLabelDownloadLinks struct { Windows *string `json:"windows,omitempty"` } -// UnmarshalJSON implements json.Unmarshaler. -func (j *Mt5LoginListRespMsgType) UnmarshalJSON(b []byte) error { - var v string - if err := json.Unmarshal(b, &v); err != nil { - return err - } - var ok bool - for _, expected := range enumValues_Mt5LoginListRespMsgType { - if reflect.DeepEqual(v, expected) { - ok = true - break - } - } - if !ok { - return fmt.Errorf("invalid value (expected one of %#v): %#v", enumValues_Mt5LoginListRespMsgType, v) - } - *j = Mt5LoginListRespMsgType(v) - return nil +// 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"` } -var enumValues_Mt5LoginListRespMsgType = []interface{}{ - "mt5_login_list", +type Mt5LoginListRespMt5LoginListElem struct { + // Account type. + AccountType *Mt5LoginListRespMt5LoginListElemAccountType `json:"account_type,omitempty"` + + // Balance of the MT5 account. + Balance *float64 `json:"balance,omitempty"` + + // Residence of the MT5 account. + Country *string `json:"country,omitempty"` + + // Currency of the MT5 account. + Currency *string `json:"currency,omitempty"` + + // Account balance, formatted to appropriate decimal places. + DisplayBalance *string `json:"display_balance,omitempty"` + + // [Optional] Determines the eligibility status for migrating a client account + // based on verification and account type. + EligibleToMigrate Mt5LoginListRespMt5LoginListElemEligibleToMigrate `json:"eligible_to_migrate,omitempty"` + + // Email address of the MT5 account. + Email *string `json:"email,omitempty"` + + // Error in MT5 account details. + Error *Mt5LoginListRespMt5LoginListElemError `json:"error,omitempty"` + + // Group type of the MT5 account, e.g. `demo\svg_financial` + Group *string `json:"group,omitempty"` + + // Broker name + LandingCompany *string `json:"landing_company,omitempty"` + + // Landing company shortcode of the MT5 account. + LandingCompanyShort *Mt5LoginListRespMt5LoginListElemLandingCompanyShort `json:"landing_company_short,omitempty"` + + // Leverage of the MT5 account (1 to 1000). + Leverage *float64 `json:"leverage,omitempty"` + + // Login of MT5 account. + Login *string `json:"login,omitempty"` + + // Market type + MarketType *Mt5LoginListRespMt5LoginListElemMarketType `json:"market_type,omitempty"` + + // Name of the owner of the MT5 account. + Name *string `json:"name,omitempty"` + + // Trade server name of the MT5 account. + Server *string `json:"server,omitempty"` + + // Trade server information. + ServerInfo *Mt5LoginListRespMt5LoginListElemServerInfo `json:"server_info,omitempty"` + + // MT5 account status. + Status *string `json:"status,omitempty"` + + // Sub account category + SubAccountCategory *Mt5LoginListRespMt5LoginListElemSubAccountCategory `json:"sub_account_category,omitempty"` + + // Sub account type refer to classic MT5 account + SubAccountType *Mt5LoginListRespMt5LoginListElemSubAccountType `json:"sub_account_type,omitempty"` + + // MT5 webtrader url for each mt5 platform + WebtraderUrl *string `json:"webtrader_url,omitempty"` + + // White label settings + WhiteLabel *Mt5LoginListRespMt5LoginListElemWhiteLabel `json:"white_label,omitempty"` +} + +// Get list of MT5 accounts for client. +type Mt5LoginListResp struct { + // Echo of the request made. + EchoReq Mt5LoginListRespEchoReq `json:"echo_req"` + + // Action name of the request made. + MsgType Mt5LoginListRespMsgType `json:"msg_type"` + + // Array containing MT5 account objects. + Mt5LoginList []Mt5LoginListRespMt5LoginListElem `json:"mt5_login_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.