examples_test.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package mobileanalytics_test
  3. import (
  4. "bytes"
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/service/mobileanalytics"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleMobileAnalytics_PutEvents() {
  13. svc := mobileanalytics.New(nil)
  14. params := &mobileanalytics.PutEventsInput{
  15. ClientContext: aws.String("String"), // Required
  16. Events: []*mobileanalytics.Event{ // Required
  17. { // Required
  18. EventType: aws.String("String50Chars"), // Required
  19. Timestamp: aws.String("ISO8601Timestamp"), // Required
  20. Attributes: map[string]*string{
  21. "Key": aws.String("String0to1000Chars"), // Required
  22. // More values...
  23. },
  24. Metrics: map[string]*float64{
  25. "Key": aws.Float64(1.0), // Required
  26. // More values...
  27. },
  28. Session: &mobileanalytics.Session{
  29. Duration: aws.Int64(1),
  30. Id: aws.String("String50Chars"),
  31. StartTimestamp: aws.String("ISO8601Timestamp"),
  32. StopTimestamp: aws.String("ISO8601Timestamp"),
  33. },
  34. Version: aws.String("String10Chars"),
  35. },
  36. // More values...
  37. },
  38. ClientContextEncoding: aws.String("String"),
  39. }
  40. resp, err := svc.PutEvents(params)
  41. if err != nil {
  42. // Print the error, cast err to awserr.Error to get the Code and
  43. // Message from an error.
  44. fmt.Println(err.Error())
  45. return
  46. }
  47. // Pretty-print the response data.
  48. fmt.Println(resp)
  49. }