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.
 
 
 

229 lines
5.0 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 ExampleNewEntityTypesClient() {
  23. ctx := context.Background()
  24. c, err := dialogflow.NewEntityTypesClient(ctx)
  25. if err != nil {
  26. // TODO: Handle error.
  27. }
  28. // TODO: Use client.
  29. _ = c
  30. }
  31. func ExampleEntityTypesClient_ListEntityTypes() {
  32. ctx := context.Background()
  33. c, err := dialogflow.NewEntityTypesClient(ctx)
  34. if err != nil {
  35. // TODO: Handle error.
  36. }
  37. req := &dialogflowpb.ListEntityTypesRequest{
  38. // TODO: Fill request struct fields.
  39. }
  40. it := c.ListEntityTypes(ctx, req)
  41. for {
  42. resp, err := it.Next()
  43. if err == iterator.Done {
  44. break
  45. }
  46. if err != nil {
  47. // TODO: Handle error.
  48. }
  49. // TODO: Use resp.
  50. _ = resp
  51. }
  52. }
  53. func ExampleEntityTypesClient_GetEntityType() {
  54. ctx := context.Background()
  55. c, err := dialogflow.NewEntityTypesClient(ctx)
  56. if err != nil {
  57. // TODO: Handle error.
  58. }
  59. req := &dialogflowpb.GetEntityTypeRequest{
  60. // TODO: Fill request struct fields.
  61. }
  62. resp, err := c.GetEntityType(ctx, req)
  63. if err != nil {
  64. // TODO: Handle error.
  65. }
  66. // TODO: Use resp.
  67. _ = resp
  68. }
  69. func ExampleEntityTypesClient_CreateEntityType() {
  70. ctx := context.Background()
  71. c, err := dialogflow.NewEntityTypesClient(ctx)
  72. if err != nil {
  73. // TODO: Handle error.
  74. }
  75. req := &dialogflowpb.CreateEntityTypeRequest{
  76. // TODO: Fill request struct fields.
  77. }
  78. resp, err := c.CreateEntityType(ctx, req)
  79. if err != nil {
  80. // TODO: Handle error.
  81. }
  82. // TODO: Use resp.
  83. _ = resp
  84. }
  85. func ExampleEntityTypesClient_UpdateEntityType() {
  86. ctx := context.Background()
  87. c, err := dialogflow.NewEntityTypesClient(ctx)
  88. if err != nil {
  89. // TODO: Handle error.
  90. }
  91. req := &dialogflowpb.UpdateEntityTypeRequest{
  92. // TODO: Fill request struct fields.
  93. }
  94. resp, err := c.UpdateEntityType(ctx, req)
  95. if err != nil {
  96. // TODO: Handle error.
  97. }
  98. // TODO: Use resp.
  99. _ = resp
  100. }
  101. func ExampleEntityTypesClient_DeleteEntityType() {
  102. ctx := context.Background()
  103. c, err := dialogflow.NewEntityTypesClient(ctx)
  104. if err != nil {
  105. // TODO: Handle error.
  106. }
  107. req := &dialogflowpb.DeleteEntityTypeRequest{
  108. // TODO: Fill request struct fields.
  109. }
  110. err = c.DeleteEntityType(ctx, req)
  111. if err != nil {
  112. // TODO: Handle error.
  113. }
  114. }
  115. func ExampleEntityTypesClient_BatchUpdateEntityTypes() {
  116. ctx := context.Background()
  117. c, err := dialogflow.NewEntityTypesClient(ctx)
  118. if err != nil {
  119. // TODO: Handle error.
  120. }
  121. req := &dialogflowpb.BatchUpdateEntityTypesRequest{
  122. // TODO: Fill request struct fields.
  123. }
  124. op, err := c.BatchUpdateEntityTypes(ctx, req)
  125. if err != nil {
  126. // TODO: Handle error.
  127. }
  128. resp, err := op.Wait(ctx)
  129. if err != nil {
  130. // TODO: Handle error.
  131. }
  132. // TODO: Use resp.
  133. _ = resp
  134. }
  135. func ExampleEntityTypesClient_BatchDeleteEntityTypes() {
  136. ctx := context.Background()
  137. c, err := dialogflow.NewEntityTypesClient(ctx)
  138. if err != nil {
  139. // TODO: Handle error.
  140. }
  141. req := &dialogflowpb.BatchDeleteEntityTypesRequest{
  142. // TODO: Fill request struct fields.
  143. }
  144. op, err := c.BatchDeleteEntityTypes(ctx, req)
  145. if err != nil {
  146. // TODO: Handle error.
  147. }
  148. err = op.Wait(ctx)
  149. // TODO: Handle error.
  150. }
  151. func ExampleEntityTypesClient_BatchCreateEntities() {
  152. ctx := context.Background()
  153. c, err := dialogflow.NewEntityTypesClient(ctx)
  154. if err != nil {
  155. // TODO: Handle error.
  156. }
  157. req := &dialogflowpb.BatchCreateEntitiesRequest{
  158. // TODO: Fill request struct fields.
  159. }
  160. op, err := c.BatchCreateEntities(ctx, req)
  161. if err != nil {
  162. // TODO: Handle error.
  163. }
  164. err = op.Wait(ctx)
  165. // TODO: Handle error.
  166. }
  167. func ExampleEntityTypesClient_BatchUpdateEntities() {
  168. ctx := context.Background()
  169. c, err := dialogflow.NewEntityTypesClient(ctx)
  170. if err != nil {
  171. // TODO: Handle error.
  172. }
  173. req := &dialogflowpb.BatchUpdateEntitiesRequest{
  174. // TODO: Fill request struct fields.
  175. }
  176. op, err := c.BatchUpdateEntities(ctx, req)
  177. if err != nil {
  178. // TODO: Handle error.
  179. }
  180. err = op.Wait(ctx)
  181. // TODO: Handle error.
  182. }
  183. func ExampleEntityTypesClient_BatchDeleteEntities() {
  184. ctx := context.Background()
  185. c, err := dialogflow.NewEntityTypesClient(ctx)
  186. if err != nil {
  187. // TODO: Handle error.
  188. }
  189. req := &dialogflowpb.BatchDeleteEntitiesRequest{
  190. // TODO: Fill request struct fields.
  191. }
  192. op, err := c.BatchDeleteEntities(ctx, req)
  193. if err != nil {
  194. // TODO: Handle error.
  195. }
  196. err = op.Wait(ctx)
  197. // TODO: Handle error.
  198. }