You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

158 lines
3.3 KiB

  1. // Copyright 2019 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // https://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Code generated by gapic-generator. DO NOT EDIT.
  15. package dialogflow_test
  16. import (
  17. "context"
  18. dialogflow "cloud.google.com/go/dialogflow/apiv2"
  19. "google.golang.org/api/iterator"
  20. dialogflowpb "google.golang.org/genproto/googleapis/cloud/dialogflow/v2"
  21. )
  22. func ExampleNewAgentsClient() {
  23. ctx := context.Background()
  24. c, err := dialogflow.NewAgentsClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleAgentsClient_GetAgent() {
  32. ctx := context.Background()
  33. c, err := dialogflow.NewAgentsClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &dialogflowpb.GetAgentRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. resp, err := c.GetAgent(ctx, req)
  41. if err != nil {
  42. // TODO: Handle error.
  43. }
  44. // TODO: Use resp.
  45. _ = resp
  46. }
  47. func ExampleAgentsClient_SearchAgents() {
  48. ctx := context.Background()
  49. c, err := dialogflow.NewAgentsClient(ctx)
  50. if err != nil {
  51. // TODO: Handle error.
  52. }
  53. req := &dialogflowpb.SearchAgentsRequest{
  54. // TODO: Fill request struct fields.
  55. }
  56. it := c.SearchAgents(ctx, req)
  57. for {
  58. resp, err := it.Next()
  59. if err == iterator.Done {
  60. break
  61. }
  62. if err != nil {
  63. // TODO: Handle error.
  64. }
  65. // TODO: Use resp.
  66. _ = resp
  67. }
  68. }
  69. func ExampleAgentsClient_TrainAgent() {
  70. ctx := context.Background()
  71. c, err := dialogflow.NewAgentsClient(ctx)
  72. if err != nil {
  73. // TODO: Handle error.
  74. }
  75. req := &dialogflowpb.TrainAgentRequest{
  76. // TODO: Fill request struct fields.
  77. }
  78. op, err := c.TrainAgent(ctx, req)
  79. if err != nil {
  80. // TODO: Handle error.
  81. }
  82. err = op.Wait(ctx)
  83. // TODO: Handle error.
  84. }
  85. func ExampleAgentsClient_ExportAgent() {
  86. ctx := context.Background()
  87. c, err := dialogflow.NewAgentsClient(ctx)
  88. if err != nil {
  89. // TODO: Handle error.
  90. }
  91. req := &dialogflowpb.ExportAgentRequest{
  92. // TODO: Fill request struct fields.
  93. }
  94. op, err := c.ExportAgent(ctx, req)
  95. if err != nil {
  96. // TODO: Handle error.
  97. }
  98. resp, err := op.Wait(ctx)
  99. if err != nil {
  100. // TODO: Handle error.
  101. }
  102. // TODO: Use resp.
  103. _ = resp
  104. }
  105. func ExampleAgentsClient_ImportAgent() {
  106. ctx := context.Background()
  107. c, err := dialogflow.NewAgentsClient(ctx)
  108. if err != nil {
  109. // TODO: Handle error.
  110. }
  111. req := &dialogflowpb.ImportAgentRequest{
  112. // TODO: Fill request struct fields.
  113. }
  114. op, err := c.ImportAgent(ctx, req)
  115. if err != nil {
  116. // TODO: Handle error.
  117. }
  118. err = op.Wait(ctx)
  119. // TODO: Handle error.
  120. }
  121. func ExampleAgentsClient_RestoreAgent() {
  122. ctx := context.Background()
  123. c, err := dialogflow.NewAgentsClient(ctx)
  124. if err != nil {
  125. // TODO: Handle error.
  126. }
  127. req := &dialogflowpb.RestoreAgentRequest{
  128. // TODO: Fill request struct fields.
  129. }
  130. op, err := c.RestoreAgent(ctx, req)
  131. if err != nil {
  132. // TODO: Handle error.
  133. }
  134. err = op.Wait(ctx)
  135. // TODO: Handle error.
  136. }