SearchRequest.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. package request
  2. import (
  3. "bytes"
  4. "fmt"
  5. "net/url"
  6. )
  7. type SearchInstrumentRequest struct {
  8. QueryString string
  9. OffsetInstrumentId int64
  10. }
  11. func NewSearchInstrumentRequest(q string, insId int64) *SearchInstrumentRequest {
  12. return &SearchInstrumentRequest{q, insId}
  13. }
  14. func (this *SearchInstrumentRequest) Url() string {
  15. return "/secure/instrument/searchCurrentInstruments?q=" + url.QueryEscape(this.QueryString) +
  16. "&offset=" + fmt.Sprintf("%d", this.OffsetInstrumentId)
  17. }
  18. func (this *SearchInstrumentRequest) GetRequestData() *bytes.Buffer {
  19. return nil
  20. }
  21. type CompletedOrderRequest struct {
  22. Offset string
  23. Pagesize int32
  24. }
  25. func NewCompletedOrderRequest(pageSize int32, offset string) *CompletedOrderRequest {
  26. if offset == "" {
  27. offset = "-"
  28. }
  29. return &CompletedOrderRequest{offset, pageSize}
  30. }
  31. func (this *CompletedOrderRequest) Url() string {
  32. return "/secure/read/account/getCompletedOrders?offset="+url.QueryEscape(this.Offset)+"&pageSize=" + fmt.Sprint(this.Pagesize)
  33. }
  34. func (this *CompletedOrderRequest) GetRequestData() *bytes.Buffer {
  35. return nil
  36. }
  37. type Activity struct {
  38. Offset int32
  39. Pagesize int32
  40. }
  41. func NewActivityRequest(pageSize int32, offset int32) *Activity {
  42. if pageSize == 0 {
  43. pageSize = 20
  44. }
  45. return &Activity{offset, pageSize}
  46. }
  47. func (this *Activity) Url() string {
  48. return "/secure/read/account/getActivity/auditTrail/"+fmt.Sprint(this.Offset)+"/" + fmt.Sprint(this.Pagesize)
  49. }
  50. func (this *Activity) GetRequestData() *bytes.Buffer {
  51. return nil
  52. }
  53. type AccountStatement struct {
  54. Offset int32
  55. Pagesize int32
  56. }
  57. func NewAccountStatementRequest(pageSize int32, offset int32) *AccountStatement {
  58. if pageSize == 0 {
  59. pageSize = 20
  60. }
  61. return &AccountStatement{offset, pageSize}
  62. }
  63. func (this *AccountStatement) Url() string {
  64. return "/secure/read/account/getAccountStatement/"+fmt.Sprint(this.Offset)+"/" + fmt.Sprint(this.Pagesize)
  65. }
  66. func (this *AccountStatement) GetRequestData() *bytes.Buffer {
  67. return nil
  68. }