examples_test.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudsearchdomain_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/cloudsearchdomain"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleCloudSearchDomain_Search() {
  13. svc := cloudsearchdomain.New(nil)
  14. params := &cloudsearchdomain.SearchInput{
  15. Query: aws.String("Query"), // Required
  16. Cursor: aws.String("Cursor"),
  17. Expr: aws.String("Expr"),
  18. Facet: aws.String("Facet"),
  19. FilterQuery: aws.String("FilterQuery"),
  20. Highlight: aws.String("Highlight"),
  21. Partial: aws.Bool(true),
  22. QueryOptions: aws.String("QueryOptions"),
  23. QueryParser: aws.String("QueryParser"),
  24. Return: aws.String("Return"),
  25. Size: aws.Int64(1),
  26. Sort: aws.String("Sort"),
  27. Start: aws.Int64(1),
  28. }
  29. resp, err := svc.Search(params)
  30. if err != nil {
  31. // Print the error, cast err to awserr.Error to get the Code and
  32. // Message from an error.
  33. fmt.Println(err.Error())
  34. return
  35. }
  36. // Pretty-print the response data.
  37. fmt.Println(resp)
  38. }
  39. func ExampleCloudSearchDomain_Suggest() {
  40. svc := cloudsearchdomain.New(nil)
  41. params := &cloudsearchdomain.SuggestInput{
  42. Query: aws.String("Query"), // Required
  43. Suggester: aws.String("Suggester"), // Required
  44. Size: aws.Int64(1),
  45. }
  46. resp, err := svc.Suggest(params)
  47. if err != nil {
  48. // Print the error, cast err to awserr.Error to get the Code and
  49. // Message from an error.
  50. fmt.Println(err.Error())
  51. return
  52. }
  53. // Pretty-print the response data.
  54. fmt.Println(resp)
  55. }
  56. func ExampleCloudSearchDomain_UploadDocuments() {
  57. svc := cloudsearchdomain.New(nil)
  58. params := &cloudsearchdomain.UploadDocumentsInput{
  59. ContentType: aws.String("ContentType"), // Required
  60. Documents: bytes.NewReader([]byte("PAYLOAD")), // Required
  61. }
  62. resp, err := svc.UploadDocuments(params)
  63. if err != nil {
  64. // Print the error, cast err to awserr.Error to get the Code and
  65. // Message from an error.
  66. fmt.Println(err.Error())
  67. return
  68. }
  69. // Pretty-print the response data.
  70. fmt.Println(resp)
  71. }