| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package request
- import (
- "bytes"
- "encoding/xml"
- )
- type productTypeString struct {
- CFD_LIVE string
- CFD_DEMO string
- }
- const protocolVersion = "1.8"
- var ProductType productTypeString = productTypeString{CFD_LIVE: "CFD_LIVE", CFD_DEMO: "CFD_DEMO"}
- type LoginRequest struct {
- XMLName xml.Name `xml:"req" json:"-"`
- UserName string `xml:"body>username" json:"username"`
- Password string `xml:"body>password" json:"password"`
- Version string `xml:"body>protocolVersion" json:"version"`
- ProductType string `xml:"body>productType" json:"productType"`
- }
- func NewLoginRequest(username, password, producttype string) *LoginRequest {
- lr := LoginRequest{UserName: username, Password: password, ProductType: producttype, Version: protocolVersion}
- return &lr
- }
- func (this *LoginRequest) Url() string {
- return "/public/security/login"
- }
- func (this *LoginRequest) GetRequestData() *bytes.Buffer {
- output, _ := xml.Marshal(this)
- return bytes.NewBuffer(output)
- }
- const CurrencyUSD = "USD"
- const AccountTypeStandard = "STANDARD_TRADER"
- type RegisterRequest struct {
- XMLName xml.Name `xml:"req" json:"-"`
- Title string `xml:"body>title" json:"title"`
- FirstName string `xml:"body>firstname" json:"firstname"`
- Surname string `xml:"body>surname" json:"surname"`
- Email string `xml:"body>email" json:"email"`
- Phone string `xml:"body>phone" json:"phone"`
- UserName string `xml:"body>username" json:"username"`
- Password string `xml:"body>password" json:"password"`
- Currency string `xml:"body>currency" json:"currency"`
- AccountType string `xml:"body>accountType" json:"accountType"`
- ProductType string `xml:"body>productType" json:"productType"`
- }
- func (this *RegisterRequest) Url() string {
- return "/public/security/register"
- }
- func (this *RegisterRequest) GetRequestData() *bytes.Buffer {
- output, _ := xml.Marshal(this)
- return bytes.NewBuffer(output)
- }
|