api.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. // Package mobileanalytics provides a client for Amazon Mobile Analytics.
  3. package mobileanalytics
  4. import (
  5. "github.com/aws/aws-sdk-go/aws/awsutil"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. )
  8. const opPutEvents = "PutEvents"
  9. // PutEventsRequest generates a request for the PutEvents operation.
  10. func (c *MobileAnalytics) PutEventsRequest(input *PutEventsInput) (req *request.Request, output *PutEventsOutput) {
  11. op := &request.Operation{
  12. Name: opPutEvents,
  13. HTTPMethod: "POST",
  14. HTTPPath: "/2014-06-05/events",
  15. }
  16. if input == nil {
  17. input = &PutEventsInput{}
  18. }
  19. req = c.newRequest(op, input, output)
  20. output = &PutEventsOutput{}
  21. req.Data = output
  22. return
  23. }
  24. // The PutEvents operation records one or more events. You can have up to 1,500
  25. // unique custom events per app, any combination of up to 40 attributes and
  26. // metrics per custom event, and any number of attribute or metric values.
  27. func (c *MobileAnalytics) PutEvents(input *PutEventsInput) (*PutEventsOutput, error) {
  28. req, out := c.PutEventsRequest(input)
  29. err := req.Send()
  30. return out, err
  31. }
  32. // A JSON object representing a batch of unique event occurrences in your app.
  33. type Event struct {
  34. // A collection of key-value pairs that give additional context to the event.
  35. // The key-value pairs are specified by the developer.
  36. //
  37. // This collection can be empty or the attribute object can be omitted.
  38. Attributes map[string]*string `locationName:"attributes" type:"map"`
  39. // A name signifying an event that occurred in your app. This is used for grouping
  40. // and aggregating like events together for reporting purposes.
  41. EventType *string `locationName:"eventType" type:"string" required:"true"`
  42. // A collection of key-value pairs that gives additional, measurable context
  43. // to the event. The key-value pairs are specified by the developer.
  44. //
  45. // This collection can be empty or the attribute object can be omitted.
  46. Metrics map[string]*float64 `locationName:"metrics" type:"map"`
  47. // The session the event occured within.
  48. Session *Session `locationName:"session" type:"structure"`
  49. // The time the event occurred in ISO 8601 standard date time format. For example,
  50. // 2014-06-30T19:07:47.885Z
  51. Timestamp *string `locationName:"timestamp" type:"string" required:"true"`
  52. // The version of the event.
  53. Version *string `locationName:"version" type:"string"`
  54. metadataEvent `json:"-" xml:"-"`
  55. }
  56. type metadataEvent struct {
  57. SDKShapeTraits bool `type:"structure"`
  58. }
  59. // String returns the string representation
  60. func (s Event) String() string {
  61. return awsutil.Prettify(s)
  62. }
  63. // GoString returns the string representation
  64. func (s Event) GoString() string {
  65. return s.String()
  66. }
  67. // A container for the data needed for a PutEvent operation
  68. type PutEventsInput struct {
  69. // The client context including the client ID, app title, app version and package
  70. // name.
  71. ClientContext *string `location:"header" locationName:"x-amz-Client-Context" type:"string" required:"true"`
  72. // The encoding used for the client context.
  73. ClientContextEncoding *string `location:"header" locationName:"x-amz-Client-Context-Encoding" type:"string"`
  74. // An array of Event JSON objects
  75. Events []*Event `locationName:"events" type:"list" required:"true"`
  76. metadataPutEventsInput `json:"-" xml:"-"`
  77. }
  78. type metadataPutEventsInput struct {
  79. SDKShapeTraits bool `type:"structure"`
  80. }
  81. // String returns the string representation
  82. func (s PutEventsInput) String() string {
  83. return awsutil.Prettify(s)
  84. }
  85. // GoString returns the string representation
  86. func (s PutEventsInput) GoString() string {
  87. return s.String()
  88. }
  89. type PutEventsOutput struct {
  90. metadataPutEventsOutput `json:"-" xml:"-"`
  91. }
  92. type metadataPutEventsOutput struct {
  93. SDKShapeTraits bool `type:"structure"`
  94. }
  95. // String returns the string representation
  96. func (s PutEventsOutput) String() string {
  97. return awsutil.Prettify(s)
  98. }
  99. // GoString returns the string representation
  100. func (s PutEventsOutput) GoString() string {
  101. return s.String()
  102. }
  103. // Describes the session. Session information is required on ALL events.
  104. type Session struct {
  105. // The duration of the session.
  106. Duration *int64 `locationName:"duration" type:"long"`
  107. // A unique identifier for the session
  108. Id *string `locationName:"id" type:"string"`
  109. // The time the event started in ISO 8601 standard date time format. For example,
  110. // 2014-06-30T19:07:47.885Z
  111. StartTimestamp *string `locationName:"startTimestamp" type:"string"`
  112. // The time the event terminated in ISO 8601 standard date time format. For
  113. // example, 2014-06-30T19:07:47.885Z
  114. StopTimestamp *string `locationName:"stopTimestamp" type:"string"`
  115. metadataSession `json:"-" xml:"-"`
  116. }
  117. type metadataSession struct {
  118. SDKShapeTraits bool `type:"structure"`
  119. }
  120. // String returns the string representation
  121. func (s Session) String() string {
  122. return awsutil.Prettify(s)
  123. }
  124. // GoString returns the string representation
  125. func (s Session) GoString() string {
  126. return s.String()
  127. }