25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

2359 lines
85 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package language provides access to the Cloud Natural Language API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/language/apiv1 instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/natural-language/
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/language/v1beta2"
  16. // ...
  17. // ctx := context.Background()
  18. // languageService, err := language.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // languageService, err := language.NewService(ctx, option.WithScopes(language.CloudPlatformScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // languageService, err := language.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // languageService, err := language.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package language // import "google.golang.org/api/language/v1beta2"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "language:v1beta2"
  73. const apiName = "language"
  74. const apiVersion = "v1beta2"
  75. const basePath = "https://language.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // Apply machine learning models to reveal the structure and meaning of
  79. // text
  80. CloudLanguageScope = "https://www.googleapis.com/auth/cloud-language"
  81. // View and manage your data across Google Cloud Platform services
  82. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  83. )
  84. // NewService creates a new Service.
  85. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  86. scopesOption := option.WithScopes(
  87. "https://www.googleapis.com/auth/cloud-language",
  88. "https://www.googleapis.com/auth/cloud-platform",
  89. )
  90. // NOTE: prepend, so we don't override user-specified scopes.
  91. opts = append([]option.ClientOption{scopesOption}, opts...)
  92. client, endpoint, err := htransport.NewClient(ctx, opts...)
  93. if err != nil {
  94. return nil, err
  95. }
  96. s, err := New(client)
  97. if err != nil {
  98. return nil, err
  99. }
  100. if endpoint != "" {
  101. s.BasePath = endpoint
  102. }
  103. return s, nil
  104. }
  105. // New creates a new Service. It uses the provided http.Client for requests.
  106. //
  107. // Deprecated: please use NewService instead.
  108. // To provide a custom HTTP client, use option.WithHTTPClient.
  109. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  110. func New(client *http.Client) (*Service, error) {
  111. if client == nil {
  112. return nil, errors.New("client is nil")
  113. }
  114. s := &Service{client: client, BasePath: basePath}
  115. s.Documents = NewDocumentsService(s)
  116. return s, nil
  117. }
  118. type Service struct {
  119. client *http.Client
  120. BasePath string // API endpoint base URL
  121. UserAgent string // optional additional User-Agent fragment
  122. Documents *DocumentsService
  123. }
  124. func (s *Service) userAgent() string {
  125. if s.UserAgent == "" {
  126. return googleapi.UserAgent
  127. }
  128. return googleapi.UserAgent + " " + s.UserAgent
  129. }
  130. func NewDocumentsService(s *Service) *DocumentsService {
  131. rs := &DocumentsService{s: s}
  132. return rs
  133. }
  134. type DocumentsService struct {
  135. s *Service
  136. }
  137. // AnalyzeEntitiesRequest: The entity analysis request message.
  138. type AnalyzeEntitiesRequest struct {
  139. // Document: Input document.
  140. Document *Document `json:"document,omitempty"`
  141. // EncodingType: The encoding type used by the API to calculate offsets.
  142. //
  143. // Possible values:
  144. // "NONE" - If `EncodingType` is not specified, encoding-dependent
  145. // information (such as
  146. // `begin_offset`) will be set at `-1`.
  147. // "UTF8" - Encoding-dependent information (such as `begin_offset`) is
  148. // calculated based
  149. // on the UTF-8 encoding of the input. C++ and Go are examples of
  150. // languages
  151. // that use this encoding natively.
  152. // "UTF16" - Encoding-dependent information (such as `begin_offset`)
  153. // is calculated based
  154. // on the UTF-16 encoding of the input. Java and Javascript are examples
  155. // of
  156. // languages that use this encoding natively.
  157. // "UTF32" - Encoding-dependent information (such as `begin_offset`)
  158. // is calculated based
  159. // on the UTF-32 encoding of the input. Python is an example of a
  160. // language
  161. // that uses this encoding natively.
  162. EncodingType string `json:"encodingType,omitempty"`
  163. // ForceSendFields is a list of field names (e.g. "Document") to
  164. // unconditionally include in API requests. By default, fields with
  165. // empty values are omitted from API requests. However, any non-pointer,
  166. // non-interface field appearing in ForceSendFields will be sent to the
  167. // server regardless of whether the field is empty or not. This may be
  168. // used to include empty fields in Patch requests.
  169. ForceSendFields []string `json:"-"`
  170. // NullFields is a list of field names (e.g. "Document") to include in
  171. // API requests with the JSON null value. By default, fields with empty
  172. // values are omitted from API requests. However, any field with an
  173. // empty value appearing in NullFields will be sent to the server as
  174. // null. It is an error if a field in this list has a non-empty value.
  175. // This may be used to include null fields in Patch requests.
  176. NullFields []string `json:"-"`
  177. }
  178. func (s *AnalyzeEntitiesRequest) MarshalJSON() ([]byte, error) {
  179. type NoMethod AnalyzeEntitiesRequest
  180. raw := NoMethod(*s)
  181. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  182. }
  183. // AnalyzeEntitiesResponse: The entity analysis response message.
  184. type AnalyzeEntitiesResponse struct {
  185. // Entities: The recognized entities in the input document.
  186. Entities []*Entity `json:"entities,omitempty"`
  187. // Language: The language of the text, which will be the same as the
  188. // language specified
  189. // in the request or, if not specified, the automatically-detected
  190. // language.
  191. // See Document.language field for more details.
  192. Language string `json:"language,omitempty"`
  193. // ServerResponse contains the HTTP response code and headers from the
  194. // server.
  195. googleapi.ServerResponse `json:"-"`
  196. // ForceSendFields is a list of field names (e.g. "Entities") to
  197. // unconditionally include in API requests. By default, fields with
  198. // empty values are omitted from API requests. However, any non-pointer,
  199. // non-interface field appearing in ForceSendFields will be sent to the
  200. // server regardless of whether the field is empty or not. This may be
  201. // used to include empty fields in Patch requests.
  202. ForceSendFields []string `json:"-"`
  203. // NullFields is a list of field names (e.g. "Entities") to include in
  204. // API requests with the JSON null value. By default, fields with empty
  205. // values are omitted from API requests. However, any field with an
  206. // empty value appearing in NullFields will be sent to the server as
  207. // null. It is an error if a field in this list has a non-empty value.
  208. // This may be used to include null fields in Patch requests.
  209. NullFields []string `json:"-"`
  210. }
  211. func (s *AnalyzeEntitiesResponse) MarshalJSON() ([]byte, error) {
  212. type NoMethod AnalyzeEntitiesResponse
  213. raw := NoMethod(*s)
  214. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  215. }
  216. // AnalyzeEntitySentimentRequest: The entity-level sentiment analysis
  217. // request message.
  218. type AnalyzeEntitySentimentRequest struct {
  219. // Document: Input document.
  220. Document *Document `json:"document,omitempty"`
  221. // EncodingType: The encoding type used by the API to calculate offsets.
  222. //
  223. // Possible values:
  224. // "NONE" - If `EncodingType` is not specified, encoding-dependent
  225. // information (such as
  226. // `begin_offset`) will be set at `-1`.
  227. // "UTF8" - Encoding-dependent information (such as `begin_offset`) is
  228. // calculated based
  229. // on the UTF-8 encoding of the input. C++ and Go are examples of
  230. // languages
  231. // that use this encoding natively.
  232. // "UTF16" - Encoding-dependent information (such as `begin_offset`)
  233. // is calculated based
  234. // on the UTF-16 encoding of the input. Java and Javascript are examples
  235. // of
  236. // languages that use this encoding natively.
  237. // "UTF32" - Encoding-dependent information (such as `begin_offset`)
  238. // is calculated based
  239. // on the UTF-32 encoding of the input. Python is an example of a
  240. // language
  241. // that uses this encoding natively.
  242. EncodingType string `json:"encodingType,omitempty"`
  243. // ForceSendFields is a list of field names (e.g. "Document") to
  244. // unconditionally include in API requests. By default, fields with
  245. // empty values are omitted from API requests. However, any non-pointer,
  246. // non-interface field appearing in ForceSendFields will be sent to the
  247. // server regardless of whether the field is empty or not. This may be
  248. // used to include empty fields in Patch requests.
  249. ForceSendFields []string `json:"-"`
  250. // NullFields is a list of field names (e.g. "Document") to include in
  251. // API requests with the JSON null value. By default, fields with empty
  252. // values are omitted from API requests. However, any field with an
  253. // empty value appearing in NullFields will be sent to the server as
  254. // null. It is an error if a field in this list has a non-empty value.
  255. // This may be used to include null fields in Patch requests.
  256. NullFields []string `json:"-"`
  257. }
  258. func (s *AnalyzeEntitySentimentRequest) MarshalJSON() ([]byte, error) {
  259. type NoMethod AnalyzeEntitySentimentRequest
  260. raw := NoMethod(*s)
  261. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  262. }
  263. // AnalyzeEntitySentimentResponse: The entity-level sentiment analysis
  264. // response message.
  265. type AnalyzeEntitySentimentResponse struct {
  266. // Entities: The recognized entities in the input document with
  267. // associated sentiments.
  268. Entities []*Entity `json:"entities,omitempty"`
  269. // Language: The language of the text, which will be the same as the
  270. // language specified
  271. // in the request or, if not specified, the automatically-detected
  272. // language.
  273. // See Document.language field for more details.
  274. Language string `json:"language,omitempty"`
  275. // ServerResponse contains the HTTP response code and headers from the
  276. // server.
  277. googleapi.ServerResponse `json:"-"`
  278. // ForceSendFields is a list of field names (e.g. "Entities") to
  279. // unconditionally include in API requests. By default, fields with
  280. // empty values are omitted from API requests. However, any non-pointer,
  281. // non-interface field appearing in ForceSendFields will be sent to the
  282. // server regardless of whether the field is empty or not. This may be
  283. // used to include empty fields in Patch requests.
  284. ForceSendFields []string `json:"-"`
  285. // NullFields is a list of field names (e.g. "Entities") to include in
  286. // API requests with the JSON null value. By default, fields with empty
  287. // values are omitted from API requests. However, any field with an
  288. // empty value appearing in NullFields will be sent to the server as
  289. // null. It is an error if a field in this list has a non-empty value.
  290. // This may be used to include null fields in Patch requests.
  291. NullFields []string `json:"-"`
  292. }
  293. func (s *AnalyzeEntitySentimentResponse) MarshalJSON() ([]byte, error) {
  294. type NoMethod AnalyzeEntitySentimentResponse
  295. raw := NoMethod(*s)
  296. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  297. }
  298. // AnalyzeSentimentRequest: The sentiment analysis request message.
  299. type AnalyzeSentimentRequest struct {
  300. // Document: Input document.
  301. Document *Document `json:"document,omitempty"`
  302. // EncodingType: The encoding type used by the API to calculate sentence
  303. // offsets for the
  304. // sentence sentiment.
  305. //
  306. // Possible values:
  307. // "NONE" - If `EncodingType` is not specified, encoding-dependent
  308. // information (such as
  309. // `begin_offset`) will be set at `-1`.
  310. // "UTF8" - Encoding-dependent information (such as `begin_offset`) is
  311. // calculated based
  312. // on the UTF-8 encoding of the input. C++ and Go are examples of
  313. // languages
  314. // that use this encoding natively.
  315. // "UTF16" - Encoding-dependent information (such as `begin_offset`)
  316. // is calculated based
  317. // on the UTF-16 encoding of the input. Java and Javascript are examples
  318. // of
  319. // languages that use this encoding natively.
  320. // "UTF32" - Encoding-dependent information (such as `begin_offset`)
  321. // is calculated based
  322. // on the UTF-32 encoding of the input. Python is an example of a
  323. // language
  324. // that uses this encoding natively.
  325. EncodingType string `json:"encodingType,omitempty"`
  326. // ForceSendFields is a list of field names (e.g. "Document") to
  327. // unconditionally include in API requests. By default, fields with
  328. // empty values are omitted from API requests. However, any non-pointer,
  329. // non-interface field appearing in ForceSendFields will be sent to the
  330. // server regardless of whether the field is empty or not. This may be
  331. // used to include empty fields in Patch requests.
  332. ForceSendFields []string `json:"-"`
  333. // NullFields is a list of field names (e.g. "Document") to include in
  334. // API requests with the JSON null value. By default, fields with empty
  335. // values are omitted from API requests. However, any field with an
  336. // empty value appearing in NullFields will be sent to the server as
  337. // null. It is an error if a field in this list has a non-empty value.
  338. // This may be used to include null fields in Patch requests.
  339. NullFields []string `json:"-"`
  340. }
  341. func (s *AnalyzeSentimentRequest) MarshalJSON() ([]byte, error) {
  342. type NoMethod AnalyzeSentimentRequest
  343. raw := NoMethod(*s)
  344. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  345. }
  346. // AnalyzeSentimentResponse: The sentiment analysis response message.
  347. type AnalyzeSentimentResponse struct {
  348. // DocumentSentiment: The overall sentiment of the input document.
  349. DocumentSentiment *Sentiment `json:"documentSentiment,omitempty"`
  350. // Language: The language of the text, which will be the same as the
  351. // language specified
  352. // in the request or, if not specified, the automatically-detected
  353. // language.
  354. // See Document.language field for more details.
  355. Language string `json:"language,omitempty"`
  356. // Sentences: The sentiment for all the sentences in the document.
  357. Sentences []*Sentence `json:"sentences,omitempty"`
  358. // ServerResponse contains the HTTP response code and headers from the
  359. // server.
  360. googleapi.ServerResponse `json:"-"`
  361. // ForceSendFields is a list of field names (e.g. "DocumentSentiment")
  362. // to unconditionally include in API requests. By default, fields with
  363. // empty values are omitted from API requests. However, any non-pointer,
  364. // non-interface field appearing in ForceSendFields will be sent to the
  365. // server regardless of whether the field is empty or not. This may be
  366. // used to include empty fields in Patch requests.
  367. ForceSendFields []string `json:"-"`
  368. // NullFields is a list of field names (e.g. "DocumentSentiment") to
  369. // include in API requests with the JSON null value. By default, fields
  370. // with empty values are omitted from API requests. However, any field
  371. // with an empty value appearing in NullFields will be sent to the
  372. // server as null. It is an error if a field in this list has a
  373. // non-empty value. This may be used to include null fields in Patch
  374. // requests.
  375. NullFields []string `json:"-"`
  376. }
  377. func (s *AnalyzeSentimentResponse) MarshalJSON() ([]byte, error) {
  378. type NoMethod AnalyzeSentimentResponse
  379. raw := NoMethod(*s)
  380. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  381. }
  382. // AnalyzeSyntaxRequest: The syntax analysis request message.
  383. type AnalyzeSyntaxRequest struct {
  384. // Document: Input document.
  385. Document *Document `json:"document,omitempty"`
  386. // EncodingType: The encoding type used by the API to calculate offsets.
  387. //
  388. // Possible values:
  389. // "NONE" - If `EncodingType` is not specified, encoding-dependent
  390. // information (such as
  391. // `begin_offset`) will be set at `-1`.
  392. // "UTF8" - Encoding-dependent information (such as `begin_offset`) is
  393. // calculated based
  394. // on the UTF-8 encoding of the input. C++ and Go are examples of
  395. // languages
  396. // that use this encoding natively.
  397. // "UTF16" - Encoding-dependent information (such as `begin_offset`)
  398. // is calculated based
  399. // on the UTF-16 encoding of the input. Java and Javascript are examples
  400. // of
  401. // languages that use this encoding natively.
  402. // "UTF32" - Encoding-dependent information (such as `begin_offset`)
  403. // is calculated based
  404. // on the UTF-32 encoding of the input. Python is an example of a
  405. // language
  406. // that uses this encoding natively.
  407. EncodingType string `json:"encodingType,omitempty"`
  408. // ForceSendFields is a list of field names (e.g. "Document") to
  409. // unconditionally include in API requests. By default, fields with
  410. // empty values are omitted from API requests. However, any non-pointer,
  411. // non-interface field appearing in ForceSendFields will be sent to the
  412. // server regardless of whether the field is empty or not. This may be
  413. // used to include empty fields in Patch requests.
  414. ForceSendFields []string `json:"-"`
  415. // NullFields is a list of field names (e.g. "Document") to include in
  416. // API requests with the JSON null value. By default, fields with empty
  417. // values are omitted from API requests. However, any field with an
  418. // empty value appearing in NullFields will be sent to the server as
  419. // null. It is an error if a field in this list has a non-empty value.
  420. // This may be used to include null fields in Patch requests.
  421. NullFields []string `json:"-"`
  422. }
  423. func (s *AnalyzeSyntaxRequest) MarshalJSON() ([]byte, error) {
  424. type NoMethod AnalyzeSyntaxRequest
  425. raw := NoMethod(*s)
  426. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  427. }
  428. // AnalyzeSyntaxResponse: The syntax analysis response message.
  429. type AnalyzeSyntaxResponse struct {
  430. // Language: The language of the text, which will be the same as the
  431. // language specified
  432. // in the request or, if not specified, the automatically-detected
  433. // language.
  434. // See Document.language field for more details.
  435. Language string `json:"language,omitempty"`
  436. // Sentences: Sentences in the input document.
  437. Sentences []*Sentence `json:"sentences,omitempty"`
  438. // Tokens: Tokens, along with their syntactic information, in the input
  439. // document.
  440. Tokens []*Token `json:"tokens,omitempty"`
  441. // ServerResponse contains the HTTP response code and headers from the
  442. // server.
  443. googleapi.ServerResponse `json:"-"`
  444. // ForceSendFields is a list of field names (e.g. "Language") to
  445. // unconditionally include in API requests. By default, fields with
  446. // empty values are omitted from API requests. However, any non-pointer,
  447. // non-interface field appearing in ForceSendFields will be sent to the
  448. // server regardless of whether the field is empty or not. This may be
  449. // used to include empty fields in Patch requests.
  450. ForceSendFields []string `json:"-"`
  451. // NullFields is a list of field names (e.g. "Language") to include in
  452. // API requests with the JSON null value. By default, fields with empty
  453. // values are omitted from API requests. However, any field with an
  454. // empty value appearing in NullFields will be sent to the server as
  455. // null. It is an error if a field in this list has a non-empty value.
  456. // This may be used to include null fields in Patch requests.
  457. NullFields []string `json:"-"`
  458. }
  459. func (s *AnalyzeSyntaxResponse) MarshalJSON() ([]byte, error) {
  460. type NoMethod AnalyzeSyntaxResponse
  461. raw := NoMethod(*s)
  462. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  463. }
  464. // AnnotateTextRequest: The request message for the text annotation API,
  465. // which can perform multiple
  466. // analysis types (sentiment, entities, and syntax) in one call.
  467. type AnnotateTextRequest struct {
  468. // Document: Input document.
  469. Document *Document `json:"document,omitempty"`
  470. // EncodingType: The encoding type used by the API to calculate offsets.
  471. //
  472. // Possible values:
  473. // "NONE" - If `EncodingType` is not specified, encoding-dependent
  474. // information (such as
  475. // `begin_offset`) will be set at `-1`.
  476. // "UTF8" - Encoding-dependent information (such as `begin_offset`) is
  477. // calculated based
  478. // on the UTF-8 encoding of the input. C++ and Go are examples of
  479. // languages
  480. // that use this encoding natively.
  481. // "UTF16" - Encoding-dependent information (such as `begin_offset`)
  482. // is calculated based
  483. // on the UTF-16 encoding of the input. Java and Javascript are examples
  484. // of
  485. // languages that use this encoding natively.
  486. // "UTF32" - Encoding-dependent information (such as `begin_offset`)
  487. // is calculated based
  488. // on the UTF-32 encoding of the input. Python is an example of a
  489. // language
  490. // that uses this encoding natively.
  491. EncodingType string `json:"encodingType,omitempty"`
  492. // Features: The enabled features.
  493. Features *Features `json:"features,omitempty"`
  494. // ForceSendFields is a list of field names (e.g. "Document") to
  495. // unconditionally include in API requests. By default, fields with
  496. // empty values are omitted from API requests. However, any non-pointer,
  497. // non-interface field appearing in ForceSendFields will be sent to the
  498. // server regardless of whether the field is empty or not. This may be
  499. // used to include empty fields in Patch requests.
  500. ForceSendFields []string `json:"-"`
  501. // NullFields is a list of field names (e.g. "Document") to include in
  502. // API requests with the JSON null value. By default, fields with empty
  503. // values are omitted from API requests. However, any field with an
  504. // empty value appearing in NullFields will be sent to the server as
  505. // null. It is an error if a field in this list has a non-empty value.
  506. // This may be used to include null fields in Patch requests.
  507. NullFields []string `json:"-"`
  508. }
  509. func (s *AnnotateTextRequest) MarshalJSON() ([]byte, error) {
  510. type NoMethod AnnotateTextRequest
  511. raw := NoMethod(*s)
  512. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  513. }
  514. // AnnotateTextResponse: The text annotations response message.
  515. type AnnotateTextResponse struct {
  516. // Categories: Categories identified in the input document.
  517. Categories []*ClassificationCategory `json:"categories,omitempty"`
  518. // DocumentSentiment: The overall sentiment for the document. Populated
  519. // if the user
  520. // enables
  521. // AnnotateTextRequest.Features.extract_document_sentiment.
  522. DocumentSentiment *Sentiment `json:"documentSentiment,omitempty"`
  523. // Entities: Entities, along with their semantic information, in the
  524. // input document.
  525. // Populated if the user
  526. // enables
  527. // AnnotateTextRequest.Features.extract_entities.
  528. Entities []*Entity `json:"entities,omitempty"`
  529. // Language: The language of the text, which will be the same as the
  530. // language specified
  531. // in the request or, if not specified, the automatically-detected
  532. // language.
  533. // See Document.language field for more details.
  534. Language string `json:"language,omitempty"`
  535. // Sentences: Sentences in the input document. Populated if the user
  536. // enables
  537. // AnnotateTextRequest.Features.extract_syntax.
  538. Sentences []*Sentence `json:"sentences,omitempty"`
  539. // Tokens: Tokens, along with their syntactic information, in the input
  540. // document.
  541. // Populated if the user
  542. // enables
  543. // AnnotateTextRequest.Features.extract_syntax.
  544. Tokens []*Token `json:"tokens,omitempty"`
  545. // ServerResponse contains the HTTP response code and headers from the
  546. // server.
  547. googleapi.ServerResponse `json:"-"`
  548. // ForceSendFields is a list of field names (e.g. "Categories") to
  549. // unconditionally include in API requests. By default, fields with
  550. // empty values are omitted from API requests. However, any non-pointer,
  551. // non-interface field appearing in ForceSendFields will be sent to the
  552. // server regardless of whether the field is empty or not. This may be
  553. // used to include empty fields in Patch requests.
  554. ForceSendFields []string `json:"-"`
  555. // NullFields is a list of field names (e.g. "Categories") to include in
  556. // API requests with the JSON null value. By default, fields with empty
  557. // values are omitted from API requests. However, any field with an
  558. // empty value appearing in NullFields will be sent to the server as
  559. // null. It is an error if a field in this list has a non-empty value.
  560. // This may be used to include null fields in Patch requests.
  561. NullFields []string `json:"-"`
  562. }
  563. func (s *AnnotateTextResponse) MarshalJSON() ([]byte, error) {
  564. type NoMethod AnnotateTextResponse
  565. raw := NoMethod(*s)
  566. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  567. }
  568. // ClassificationCategory: Represents a category returned from the text
  569. // classifier.
  570. type ClassificationCategory struct {
  571. // Confidence: The classifier's confidence of the category. Number
  572. // represents how certain
  573. // the classifier is that this category represents the given text.
  574. Confidence float64 `json:"confidence,omitempty"`
  575. // Name: The name of the category representing the document, from the
  576. // [predefined
  577. // taxonomy](/natural-language/docs/categories).
  578. Name string `json:"name,omitempty"`
  579. // ForceSendFields is a list of field names (e.g. "Confidence") to
  580. // unconditionally include in API requests. By default, fields with
  581. // empty values are omitted from API requests. However, any non-pointer,
  582. // non-interface field appearing in ForceSendFields will be sent to the
  583. // server regardless of whether the field is empty or not. This may be
  584. // used to include empty fields in Patch requests.
  585. ForceSendFields []string `json:"-"`
  586. // NullFields is a list of field names (e.g. "Confidence") to include in
  587. // API requests with the JSON null value. By default, fields with empty
  588. // values are omitted from API requests. However, any field with an
  589. // empty value appearing in NullFields will be sent to the server as
  590. // null. It is an error if a field in this list has a non-empty value.
  591. // This may be used to include null fields in Patch requests.
  592. NullFields []string `json:"-"`
  593. }
  594. func (s *ClassificationCategory) MarshalJSON() ([]byte, error) {
  595. type NoMethod ClassificationCategory
  596. raw := NoMethod(*s)
  597. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  598. }
  599. func (s *ClassificationCategory) UnmarshalJSON(data []byte) error {
  600. type NoMethod ClassificationCategory
  601. var s1 struct {
  602. Confidence gensupport.JSONFloat64 `json:"confidence"`
  603. *NoMethod
  604. }
  605. s1.NoMethod = (*NoMethod)(s)
  606. if err := json.Unmarshal(data, &s1); err != nil {
  607. return err
  608. }
  609. s.Confidence = float64(s1.Confidence)
  610. return nil
  611. }
  612. // ClassifyTextRequest: The document classification request message.
  613. type ClassifyTextRequest struct {
  614. // Document: Input document.
  615. Document *Document `json:"document,omitempty"`
  616. // ForceSendFields is a list of field names (e.g. "Document") to
  617. // unconditionally include in API requests. By default, fields with
  618. // empty values are omitted from API requests. However, any non-pointer,
  619. // non-interface field appearing in ForceSendFields will be sent to the
  620. // server regardless of whether the field is empty or not. This may be
  621. // used to include empty fields in Patch requests.
  622. ForceSendFields []string `json:"-"`
  623. // NullFields is a list of field names (e.g. "Document") to include in
  624. // API requests with the JSON null value. By default, fields with empty
  625. // values are omitted from API requests. However, any field with an
  626. // empty value appearing in NullFields will be sent to the server as
  627. // null. It is an error if a field in this list has a non-empty value.
  628. // This may be used to include null fields in Patch requests.
  629. NullFields []string `json:"-"`
  630. }
  631. func (s *ClassifyTextRequest) MarshalJSON() ([]byte, error) {
  632. type NoMethod ClassifyTextRequest
  633. raw := NoMethod(*s)
  634. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  635. }
  636. // ClassifyTextResponse: The document classification response message.
  637. type ClassifyTextResponse struct {
  638. // Categories: Categories representing the input document.
  639. Categories []*ClassificationCategory `json:"categories,omitempty"`
  640. // ServerResponse contains the HTTP response code and headers from the
  641. // server.
  642. googleapi.ServerResponse `json:"-"`
  643. // ForceSendFields is a list of field names (e.g. "Categories") to
  644. // unconditionally include in API requests. By default, fields with
  645. // empty values are omitted from API requests. However, any non-pointer,
  646. // non-interface field appearing in ForceSendFields will be sent to the
  647. // server regardless of whether the field is empty or not. This may be
  648. // used to include empty fields in Patch requests.
  649. ForceSendFields []string `json:"-"`
  650. // NullFields is a list of field names (e.g. "Categories") to include in
  651. // API requests with the JSON null value. By default, fields with empty
  652. // values are omitted from API requests. However, any field with an
  653. // empty value appearing in NullFields will be sent to the server as
  654. // null. It is an error if a field in this list has a non-empty value.
  655. // This may be used to include null fields in Patch requests.
  656. NullFields []string `json:"-"`
  657. }
  658. func (s *ClassifyTextResponse) MarshalJSON() ([]byte, error) {
  659. type NoMethod ClassifyTextResponse
  660. raw := NoMethod(*s)
  661. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  662. }
  663. // DependencyEdge: Represents dependency parse tree information for a
  664. // token.
  665. type DependencyEdge struct {
  666. // HeadTokenIndex: Represents the head of this token in the dependency
  667. // tree.
  668. // This is the index of the token which has an arc going to this
  669. // token.
  670. // The index is the position of the token in the array of tokens
  671. // returned
  672. // by the API method. If this token is a root token, then
  673. // the
  674. // `head_token_index` is its own index.
  675. HeadTokenIndex int64 `json:"headTokenIndex,omitempty"`
  676. // Label: The parse label for the token.
  677. //
  678. // Possible values:
  679. // "UNKNOWN" - Unknown
  680. // "ABBREV" - Abbreviation modifier
  681. // "ACOMP" - Adjectival complement
  682. // "ADVCL" - Adverbial clause modifier
  683. // "ADVMOD" - Adverbial modifier
  684. // "AMOD" - Adjectival modifier of an NP
  685. // "APPOS" - Appositional modifier of an NP
  686. // "ATTR" - Attribute dependent of a copular verb
  687. // "AUX" - Auxiliary (non-main) verb
  688. // "AUXPASS" - Passive auxiliary
  689. // "CC" - Coordinating conjunction
  690. // "CCOMP" - Clausal complement of a verb or adjective
  691. // "CONJ" - Conjunct
  692. // "CSUBJ" - Clausal subject
  693. // "CSUBJPASS" - Clausal passive subject
  694. // "DEP" - Dependency (unable to determine)
  695. // "DET" - Determiner
  696. // "DISCOURSE" - Discourse
  697. // "DOBJ" - Direct object
  698. // "EXPL" - Expletive
  699. // "GOESWITH" - Goes with (part of a word in a text not well edited)
  700. // "IOBJ" - Indirect object
  701. // "MARK" - Marker (word introducing a subordinate clause)
  702. // "MWE" - Multi-word expression
  703. // "MWV" - Multi-word verbal expression
  704. // "NEG" - Negation modifier
  705. // "NN" - Noun compound modifier
  706. // "NPADVMOD" - Noun phrase used as an adverbial modifier
  707. // "NSUBJ" - Nominal subject
  708. // "NSUBJPASS" - Passive nominal subject
  709. // "NUM" - Numeric modifier of a noun
  710. // "NUMBER" - Element of compound number
  711. // "P" - Punctuation mark
  712. // "PARATAXIS" - Parataxis relation
  713. // "PARTMOD" - Participial modifier
  714. // "PCOMP" - The complement of a preposition is a clause
  715. // "POBJ" - Object of a preposition
  716. // "POSS" - Possession modifier
  717. // "POSTNEG" - Postverbal negative particle
  718. // "PRECOMP" - Predicate complement
  719. // "PRECONJ" - Preconjunt
  720. // "PREDET" - Predeterminer
  721. // "PREF" - Prefix
  722. // "PREP" - Prepositional modifier
  723. // "PRONL" - The relationship between a verb and verbal morpheme
  724. // "PRT" - Particle
  725. // "PS" - Associative or possessive marker
  726. // "QUANTMOD" - Quantifier phrase modifier
  727. // "RCMOD" - Relative clause modifier
  728. // "RCMODREL" - Complementizer in relative clause
  729. // "RDROP" - Ellipsis without a preceding predicate
  730. // "REF" - Referent
  731. // "REMNANT" - Remnant
  732. // "REPARANDUM" - Reparandum
  733. // "ROOT" - Root
  734. // "SNUM" - Suffix specifying a unit of number
  735. // "SUFF" - Suffix
  736. // "TMOD" - Temporal modifier
  737. // "TOPIC" - Topic marker
  738. // "VMOD" - Clause headed by an infinite form of the verb that
  739. // modifies a noun
  740. // "VOCATIVE" - Vocative
  741. // "XCOMP" - Open clausal complement
  742. // "SUFFIX" - Name suffix
  743. // "TITLE" - Name title
  744. // "ADVPHMOD" - Adverbial phrase modifier
  745. // "AUXCAUS" - Causative auxiliary
  746. // "AUXVV" - Helper auxiliary
  747. // "DTMOD" - Rentaishi (Prenominal modifier)
  748. // "FOREIGN" - Foreign words
  749. // "KW" - Keyword
  750. // "LIST" - List for chains of comparable items
  751. // "NOMC" - Nominalized clause
  752. // "NOMCSUBJ" - Nominalized clausal subject
  753. // "NOMCSUBJPASS" - Nominalized clausal passive
  754. // "NUMC" - Compound of numeric modifier
  755. // "COP" - Copula
  756. // "DISLOCATED" - Dislocated relation (for fronted/topicalized
  757. // elements)
  758. // "ASP" - Aspect marker
  759. // "GMOD" - Genitive modifier
  760. // "GOBJ" - Genitive object
  761. // "INFMOD" - Infinitival modifier
  762. // "MES" - Measure
  763. // "NCOMP" - Nominal complement of a noun
  764. Label string `json:"label,omitempty"`
  765. // ForceSendFields is a list of field names (e.g. "HeadTokenIndex") to
  766. // unconditionally include in API requests. By default, fields with
  767. // empty values are omitted from API requests. However, any non-pointer,
  768. // non-interface field appearing in ForceSendFields will be sent to the
  769. // server regardless of whether the field is empty or not. This may be
  770. // used to include empty fields in Patch requests.
  771. ForceSendFields []string `json:"-"`
  772. // NullFields is a list of field names (e.g. "HeadTokenIndex") to
  773. // include in API requests with the JSON null value. By default, fields
  774. // with empty values are omitted from API requests. However, any field
  775. // with an empty value appearing in NullFields will be sent to the
  776. // server as null. It is an error if a field in this list has a
  777. // non-empty value. This may be used to include null fields in Patch
  778. // requests.
  779. NullFields []string `json:"-"`
  780. }
  781. func (s *DependencyEdge) MarshalJSON() ([]byte, error) {
  782. type NoMethod DependencyEdge
  783. raw := NoMethod(*s)
  784. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  785. }
  786. // Document:
  787. // ################################################################
  788. // #
  789. //
  790. // Represents the input to API methods.
  791. type Document struct {
  792. // Content: The content of the input in string format.
  793. // Cloud audit logging exempt since it is based on user data.
  794. Content string `json:"content,omitempty"`
  795. // GcsContentUri: The Google Cloud Storage URI where the file content is
  796. // located.
  797. // This URI must be of the form: gs://bucket_name/object_name. For
  798. // more
  799. // details, see
  800. // https://cloud.google.com/storage/docs/reference-uris.
  801. // NOTE: Cloud Storage object versioning is not supported.
  802. GcsContentUri string `json:"gcsContentUri,omitempty"`
  803. // Language: The language of the document (if not specified, the
  804. // language is
  805. // automatically detected). Both ISO and BCP-47 language codes
  806. // are
  807. // accepted.<br>
  808. // [Language Support](/natural-language/docs/languages)
  809. // lists currently supported languages for each API method.
  810. // If the language (either specified by the caller or automatically
  811. // detected)
  812. // is not supported by the called API method, an `INVALID_ARGUMENT`
  813. // error
  814. // is returned.
  815. Language string `json:"language,omitempty"`
  816. // Type: Required. If the type is not set or is
  817. // `TYPE_UNSPECIFIED`,
  818. // returns an `INVALID_ARGUMENT` error.
  819. //
  820. // Possible values:
  821. // "TYPE_UNSPECIFIED" - The content type is not specified.
  822. // "PLAIN_TEXT" - Plain text
  823. // "HTML" - HTML
  824. Type string `json:"type,omitempty"`
  825. // ForceSendFields is a list of field names (e.g. "Content") to
  826. // unconditionally include in API requests. By default, fields with
  827. // empty values are omitted from API requests. However, any non-pointer,
  828. // non-interface field appearing in ForceSendFields will be sent to the
  829. // server regardless of whether the field is empty or not. This may be
  830. // used to include empty fields in Patch requests.
  831. ForceSendFields []string `json:"-"`
  832. // NullFields is a list of field names (e.g. "Content") to include in
  833. // API requests with the JSON null value. By default, fields with empty
  834. // values are omitted from API requests. However, any field with an
  835. // empty value appearing in NullFields will be sent to the server as
  836. // null. It is an error if a field in this list has a non-empty value.
  837. // This may be used to include null fields in Patch requests.
  838. NullFields []string `json:"-"`
  839. }
  840. func (s *Document) MarshalJSON() ([]byte, error) {
  841. type NoMethod Document
  842. raw := NoMethod(*s)
  843. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  844. }
  845. // Entity: Represents a phrase in the text that is a known entity, such
  846. // as
  847. // a person, an organization, or location. The API associates
  848. // information, such
  849. // as salience and mentions, with entities.
  850. type Entity struct {
  851. // Mentions: The mentions of this entity in the input document. The API
  852. // currently
  853. // supports proper noun mentions.
  854. Mentions []*EntityMention `json:"mentions,omitempty"`
  855. // Metadata: Metadata associated with the entity.
  856. //
  857. // Currently, Wikipedia URLs and Knowledge Graph MIDs are provided,
  858. // if
  859. // available. The associated keys are "wikipedia_url" and "mid",
  860. // respectively.
  861. Metadata map[string]string `json:"metadata,omitempty"`
  862. // Name: The representative name for the entity.
  863. Name string `json:"name,omitempty"`
  864. // Salience: The salience score associated with the entity in the [0,
  865. // 1.0] range.
  866. //
  867. // The salience score for an entity provides information about
  868. // the
  869. // importance or centrality of that entity to the entire document
  870. // text.
  871. // Scores closer to 0 are less salient, while scores closer to 1.0 are
  872. // highly
  873. // salient.
  874. Salience float64 `json:"salience,omitempty"`
  875. // Sentiment: For calls to AnalyzeEntitySentiment or
  876. // if
  877. // AnnotateTextRequest.Features.extract_entity_sentiment is set to
  878. // true, this field will contain the aggregate sentiment expressed for
  879. // this
  880. // entity in the provided document.
  881. Sentiment *Sentiment `json:"sentiment,omitempty"`
  882. // Type: The entity type.
  883. //
  884. // Possible values:
  885. // "UNKNOWN" - Unknown
  886. // "PERSON" - Person
  887. // "LOCATION" - Location
  888. // "ORGANIZATION" - Organization
  889. // "EVENT" - Event
  890. // "WORK_OF_ART" - Work of art
  891. // "CONSUMER_GOOD" - Consumer goods
  892. // "OTHER" - Other types
  893. Type string `json:"type,omitempty"`
  894. // ForceSendFields is a list of field names (e.g. "Mentions") to
  895. // unconditionally include in API requests. By default, fields with
  896. // empty values are omitted from API requests. However, any non-pointer,
  897. // non-interface field appearing in ForceSendFields will be sent to the
  898. // server regardless of whether the field is empty or not. This may be
  899. // used to include empty fields in Patch requests.
  900. ForceSendFields []string `json:"-"`
  901. // NullFields is a list of field names (e.g. "Mentions") to include in
  902. // API requests with the JSON null value. By default, fields with empty
  903. // values are omitted from API requests. However, any field with an
  904. // empty value appearing in NullFields will be sent to the server as
  905. // null. It is an error if a field in this list has a non-empty value.
  906. // This may be used to include null fields in Patch requests.
  907. NullFields []string `json:"-"`
  908. }
  909. func (s *Entity) MarshalJSON() ([]byte, error) {
  910. type NoMethod Entity
  911. raw := NoMethod(*s)
  912. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  913. }
  914. func (s *Entity) UnmarshalJSON(data []byte) error {
  915. type NoMethod Entity
  916. var s1 struct {
  917. Salience gensupport.JSONFloat64 `json:"salience"`
  918. *NoMethod
  919. }
  920. s1.NoMethod = (*NoMethod)(s)
  921. if err := json.Unmarshal(data, &s1); err != nil {
  922. return err
  923. }
  924. s.Salience = float64(s1.Salience)
  925. return nil
  926. }
  927. // EntityMention: Represents a mention for an entity in the text.
  928. // Currently, proper noun
  929. // mentions are supported.
  930. type EntityMention struct {
  931. // Sentiment: For calls to AnalyzeEntitySentiment or
  932. // if
  933. // AnnotateTextRequest.Features.extract_entity_sentiment is set to
  934. // true, this field will contain the sentiment expressed for this
  935. // mention of
  936. // the entity in the provided document.
  937. Sentiment *Sentiment `json:"sentiment,omitempty"`
  938. // Text: The mention text.
  939. Text *TextSpan `json:"text,omitempty"`
  940. // Type: The type of the entity mention.
  941. //
  942. // Possible values:
  943. // "TYPE_UNKNOWN" - Unknown
  944. // "PROPER" - Proper name
  945. // "COMMON" - Common noun (or noun compound)
  946. Type string `json:"type,omitempty"`
  947. // ForceSendFields is a list of field names (e.g. "Sentiment") to
  948. // unconditionally include in API requests. By default, fields with
  949. // empty values are omitted from API requests. However, any non-pointer,
  950. // non-interface field appearing in ForceSendFields will be sent to the
  951. // server regardless of whether the field is empty or not. This may be
  952. // used to include empty fields in Patch requests.
  953. ForceSendFields []string `json:"-"`
  954. // NullFields is a list of field names (e.g. "Sentiment") to include in
  955. // API requests with the JSON null value. By default, fields with empty
  956. // values are omitted from API requests. However, any field with an
  957. // empty value appearing in NullFields will be sent to the server as
  958. // null. It is an error if a field in this list has a non-empty value.
  959. // This may be used to include null fields in Patch requests.
  960. NullFields []string `json:"-"`
  961. }
  962. func (s *EntityMention) MarshalJSON() ([]byte, error) {
  963. type NoMethod EntityMention
  964. raw := NoMethod(*s)
  965. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  966. }
  967. // Features: All available features for sentiment, syntax, and semantic
  968. // analysis.
  969. // Setting each one to true will enable that specific analysis for the
  970. // input.
  971. // Next ID: 10
  972. type Features struct {
  973. // ClassifyText: Classify the full document into categories. If this is
  974. // true,
  975. // the API will use the default model which classifies into
  976. // a
  977. // [predefined taxonomy](/natural-language/docs/categories).
  978. ClassifyText bool `json:"classifyText,omitempty"`
  979. // ExtractDocumentSentiment: Extract document-level sentiment.
  980. ExtractDocumentSentiment bool `json:"extractDocumentSentiment,omitempty"`
  981. // ExtractEntities: Extract entities.
  982. ExtractEntities bool `json:"extractEntities,omitempty"`
  983. // ExtractEntitySentiment: Extract entities and their associated
  984. // sentiment.
  985. ExtractEntitySentiment bool `json:"extractEntitySentiment,omitempty"`
  986. // ExtractSyntax: Extract syntax information.
  987. ExtractSyntax bool `json:"extractSyntax,omitempty"`
  988. // ForceSendFields is a list of field names (e.g. "ClassifyText") to
  989. // unconditionally include in API requests. By default, fields with
  990. // empty values are omitted from API requests. However, any non-pointer,
  991. // non-interface field appearing in ForceSendFields will be sent to the
  992. // server regardless of whether the field is empty or not. This may be
  993. // used to include empty fields in Patch requests.
  994. ForceSendFields []string `json:"-"`
  995. // NullFields is a list of field names (e.g. "ClassifyText") to include
  996. // in API requests with the JSON null value. By default, fields with
  997. // empty values are omitted from API requests. However, any field with
  998. // an empty value appearing in NullFields will be sent to the server as
  999. // null. It is an error if a field in this list has a non-empty value.
  1000. // This may be used to include null fields in Patch requests.
  1001. NullFields []string `json:"-"`
  1002. }
  1003. func (s *Features) MarshalJSON() ([]byte, error) {
  1004. type NoMethod Features
  1005. raw := NoMethod(*s)
  1006. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1007. }
  1008. // PartOfSpeech: Represents part of speech information for a token.
  1009. type PartOfSpeech struct {
  1010. // Aspect: The grammatical aspect.
  1011. //
  1012. // Possible values:
  1013. // "ASPECT_UNKNOWN" - Aspect is not applicable in the analyzed
  1014. // language or is not predicted.
  1015. // "PERFECTIVE" - Perfective
  1016. // "IMPERFECTIVE" - Imperfective
  1017. // "PROGRESSIVE" - Progressive
  1018. Aspect string `json:"aspect,omitempty"`
  1019. // Case: The grammatical case.
  1020. //
  1021. // Possible values:
  1022. // "CASE_UNKNOWN" - Case is not applicable in the analyzed language or
  1023. // is not predicted.
  1024. // "ACCUSATIVE" - Accusative
  1025. // "ADVERBIAL" - Adverbial
  1026. // "COMPLEMENTIVE" - Complementive
  1027. // "DATIVE" - Dative
  1028. // "GENITIVE" - Genitive
  1029. // "INSTRUMENTAL" - Instrumental
  1030. // "LOCATIVE" - Locative
  1031. // "NOMINATIVE" - Nominative
  1032. // "OBLIQUE" - Oblique
  1033. // "PARTITIVE" - Partitive
  1034. // "PREPOSITIONAL" - Prepositional
  1035. // "REFLEXIVE_CASE" - Reflexive
  1036. // "RELATIVE_CASE" - Relative
  1037. // "VOCATIVE" - Vocative
  1038. Case string `json:"case,omitempty"`
  1039. // Form: The grammatical form.
  1040. //
  1041. // Possible values:
  1042. // "FORM_UNKNOWN" - Form is not applicable in the analyzed language or
  1043. // is not predicted.
  1044. // "ADNOMIAL" - Adnomial
  1045. // "AUXILIARY" - Auxiliary
  1046. // "COMPLEMENTIZER" - Complementizer
  1047. // "FINAL_ENDING" - Final ending
  1048. // "GERUND" - Gerund
  1049. // "REALIS" - Realis
  1050. // "IRREALIS" - Irrealis
  1051. // "SHORT" - Short form
  1052. // "LONG" - Long form
  1053. // "ORDER" - Order form
  1054. // "SPECIFIC" - Specific form
  1055. Form string `json:"form,omitempty"`
  1056. // Gender: The grammatical gender.
  1057. //
  1058. // Possible values:
  1059. // "GENDER_UNKNOWN" - Gender is not applicable in the analyzed
  1060. // language or is not predicted.
  1061. // "FEMININE" - Feminine
  1062. // "MASCULINE" - Masculine
  1063. // "NEUTER" - Neuter
  1064. Gender string `json:"gender,omitempty"`
  1065. // Mood: The grammatical mood.
  1066. //
  1067. // Possible values:
  1068. // "MOOD_UNKNOWN" - Mood is not applicable in the analyzed language or
  1069. // is not predicted.
  1070. // "CONDITIONAL_MOOD" - Conditional
  1071. // "IMPERATIVE" - Imperative
  1072. // "INDICATIVE" - Indicative
  1073. // "INTERROGATIVE" - Interrogative
  1074. // "JUSSIVE" - Jussive
  1075. // "SUBJUNCTIVE" - Subjunctive
  1076. Mood string `json:"mood,omitempty"`
  1077. // Number: The grammatical number.
  1078. //
  1079. // Possible values:
  1080. // "NUMBER_UNKNOWN" - Number is not applicable in the analyzed
  1081. // language or is not predicted.
  1082. // "SINGULAR" - Singular
  1083. // "PLURAL" - Plural
  1084. // "DUAL" - Dual
  1085. Number string `json:"number,omitempty"`
  1086. // Person: The grammatical person.
  1087. //
  1088. // Possible values:
  1089. // "PERSON_UNKNOWN" - Person is not applicable in the analyzed
  1090. // language or is not predicted.
  1091. // "FIRST" - First
  1092. // "SECOND" - Second
  1093. // "THIRD" - Third
  1094. // "REFLEXIVE_PERSON" - Reflexive
  1095. Person string `json:"person,omitempty"`
  1096. // Proper: The grammatical properness.
  1097. //
  1098. // Possible values:
  1099. // "PROPER_UNKNOWN" - Proper is not applicable in the analyzed
  1100. // language or is not predicted.
  1101. // "PROPER" - Proper
  1102. // "NOT_PROPER" - Not proper
  1103. Proper string `json:"proper,omitempty"`
  1104. // Reciprocity: The grammatical reciprocity.
  1105. //
  1106. // Possible values:
  1107. // "RECIPROCITY_UNKNOWN" - Reciprocity is not applicable in the
  1108. // analyzed language or is not
  1109. // predicted.
  1110. // "RECIPROCAL" - Reciprocal
  1111. // "NON_RECIPROCAL" - Non-reciprocal
  1112. Reciprocity string `json:"reciprocity,omitempty"`
  1113. // Tag: The part of speech tag.
  1114. //
  1115. // Possible values:
  1116. // "UNKNOWN" - Unknown
  1117. // "ADJ" - Adjective
  1118. // "ADP" - Adposition (preposition and postposition)
  1119. // "ADV" - Adverb
  1120. // "CONJ" - Conjunction
  1121. // "DET" - Determiner
  1122. // "NOUN" - Noun (common and proper)
  1123. // "NUM" - Cardinal number
  1124. // "PRON" - Pronoun
  1125. // "PRT" - Particle or other function word
  1126. // "PUNCT" - Punctuation
  1127. // "VERB" - Verb (all tenses and modes)
  1128. // "X" - Other: foreign words, typos, abbreviations
  1129. // "AFFIX" - Affix
  1130. Tag string `json:"tag,omitempty"`
  1131. // Tense: The grammatical tense.
  1132. //
  1133. // Possible values:
  1134. // "TENSE_UNKNOWN" - Tense is not applicable in the analyzed language
  1135. // or is not predicted.
  1136. // "CONDITIONAL_TENSE" - Conditional
  1137. // "FUTURE" - Future
  1138. // "PAST" - Past
  1139. // "PRESENT" - Present
  1140. // "IMPERFECT" - Imperfect
  1141. // "PLUPERFECT" - Pluperfect
  1142. Tense string `json:"tense,omitempty"`
  1143. // Voice: The grammatical voice.
  1144. //
  1145. // Possible values:
  1146. // "VOICE_UNKNOWN" - Voice is not applicable in the analyzed language
  1147. // or is not predicted.
  1148. // "ACTIVE" - Active
  1149. // "CAUSATIVE" - Causative
  1150. // "PASSIVE" - Passive
  1151. Voice string `json:"voice,omitempty"`
  1152. // ForceSendFields is a list of field names (e.g. "Aspect") to
  1153. // unconditionally include in API requests. By default, fields with
  1154. // empty values are omitted from API requests. However, any non-pointer,
  1155. // non-interface field appearing in ForceSendFields will be sent to the
  1156. // server regardless of whether the field is empty or not. This may be
  1157. // used to include empty fields in Patch requests.
  1158. ForceSendFields []string `json:"-"`
  1159. // NullFields is a list of field names (e.g. "Aspect") to include in API
  1160. // requests with the JSON null value. By default, fields with empty
  1161. // values are omitted from API requests. However, any field with an
  1162. // empty value appearing in NullFields will be sent to the server as
  1163. // null. It is an error if a field in this list has a non-empty value.
  1164. // This may be used to include null fields in Patch requests.
  1165. NullFields []string `json:"-"`
  1166. }
  1167. func (s *PartOfSpeech) MarshalJSON() ([]byte, error) {
  1168. type NoMethod PartOfSpeech
  1169. raw := NoMethod(*s)
  1170. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1171. }
  1172. // Sentence: Represents a sentence in the input document.
  1173. type Sentence struct {
  1174. // Sentiment: For calls to AnalyzeSentiment or
  1175. // if
  1176. // AnnotateTextRequest.Features.extract_document_sentiment is set
  1177. // to
  1178. // true, this field will contain the sentiment for the sentence.
  1179. Sentiment *Sentiment `json:"sentiment,omitempty"`
  1180. // Text: The sentence text.
  1181. Text *TextSpan `json:"text,omitempty"`
  1182. // ForceSendFields is a list of field names (e.g. "Sentiment") to
  1183. // unconditionally include in API requests. By default, fields with
  1184. // empty values are omitted from API requests. However, any non-pointer,
  1185. // non-interface field appearing in ForceSendFields will be sent to the
  1186. // server regardless of whether the field is empty or not. This may be
  1187. // used to include empty fields in Patch requests.
  1188. ForceSendFields []string `json:"-"`
  1189. // NullFields is a list of field names (e.g. "Sentiment") to include in
  1190. // API requests with the JSON null value. By default, fields with empty
  1191. // values are omitted from API requests. However, any field with an
  1192. // empty value appearing in NullFields will be sent to the server as
  1193. // null. It is an error if a field in this list has a non-empty value.
  1194. // This may be used to include null fields in Patch requests.
  1195. NullFields []string `json:"-"`
  1196. }
  1197. func (s *Sentence) MarshalJSON() ([]byte, error) {
  1198. type NoMethod Sentence
  1199. raw := NoMethod(*s)
  1200. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1201. }
  1202. // Sentiment: Represents the feeling associated with the entire text or
  1203. // entities in
  1204. // the text.
  1205. // Next ID: 6
  1206. type Sentiment struct {
  1207. // Magnitude: A non-negative number in the [0, +inf) range, which
  1208. // represents
  1209. // the absolute magnitude of sentiment regardless of score (positive
  1210. // or
  1211. // negative).
  1212. Magnitude float64 `json:"magnitude,omitempty"`
  1213. // Score: Sentiment score between -1.0 (negative sentiment) and
  1214. // 1.0
  1215. // (positive sentiment).
  1216. Score float64 `json:"score,omitempty"`
  1217. // ForceSendFields is a list of field names (e.g. "Magnitude") to
  1218. // unconditionally include in API requests. By default, fields with
  1219. // empty values are omitted from API requests. However, any non-pointer,
  1220. // non-interface field appearing in ForceSendFields will be sent to the
  1221. // server regardless of whether the field is empty or not. This may be
  1222. // used to include empty fields in Patch requests.
  1223. ForceSendFields []string `json:"-"`
  1224. // NullFields is a list of field names (e.g. "Magnitude") to include in
  1225. // API requests with the JSON null value. By default, fields with empty
  1226. // values are omitted from API requests. However, any field with an
  1227. // empty value appearing in NullFields will be sent to the server as
  1228. // null. It is an error if a field in this list has a non-empty value.
  1229. // This may be used to include null fields in Patch requests.
  1230. NullFields []string `json:"-"`
  1231. }
  1232. func (s *Sentiment) MarshalJSON() ([]byte, error) {
  1233. type NoMethod Sentiment
  1234. raw := NoMethod(*s)
  1235. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1236. }
  1237. func (s *Sentiment) UnmarshalJSON(data []byte) error {
  1238. type NoMethod Sentiment
  1239. var s1 struct {
  1240. Magnitude gensupport.JSONFloat64 `json:"magnitude"`
  1241. Score gensupport.JSONFloat64 `json:"score"`
  1242. *NoMethod
  1243. }
  1244. s1.NoMethod = (*NoMethod)(s)
  1245. if err := json.Unmarshal(data, &s1); err != nil {
  1246. return err
  1247. }
  1248. s.Magnitude = float64(s1.Magnitude)
  1249. s.Score = float64(s1.Score)
  1250. return nil
  1251. }
  1252. // Status: The `Status` type defines a logical error model that is
  1253. // suitable for
  1254. // different programming environments, including REST APIs and RPC APIs.
  1255. // It is
  1256. // used by [gRPC](https://github.com/grpc). The error model is designed
  1257. // to be:
  1258. //
  1259. // - Simple to use and understand for most users
  1260. // - Flexible enough to meet unexpected needs
  1261. //
  1262. // # Overview
  1263. //
  1264. // The `Status` message contains three pieces of data: error code,
  1265. // error
  1266. // message, and error details. The error code should be an enum value
  1267. // of
  1268. // google.rpc.Code, but it may accept additional error codes if needed.
  1269. // The
  1270. // error message should be a developer-facing English message that
  1271. // helps
  1272. // developers *understand* and *resolve* the error. If a localized
  1273. // user-facing
  1274. // error message is needed, put the localized message in the error
  1275. // details or
  1276. // localize it in the client. The optional error details may contain
  1277. // arbitrary
  1278. // information about the error. There is a predefined set of error
  1279. // detail types
  1280. // in the package `google.rpc` that can be used for common error
  1281. // conditions.
  1282. //
  1283. // # Language mapping
  1284. //
  1285. // The `Status` message is the logical representation of the error
  1286. // model, but it
  1287. // is not necessarily the actual wire format. When the `Status` message
  1288. // is
  1289. // exposed in different client libraries and different wire protocols,
  1290. // it can be
  1291. // mapped differently. For example, it will likely be mapped to some
  1292. // exceptions
  1293. // in Java, but more likely mapped to some error codes in C.
  1294. //
  1295. // # Other uses
  1296. //
  1297. // The error model and the `Status` message can be used in a variety
  1298. // of
  1299. // environments, either with or without APIs, to provide a
  1300. // consistent developer experience across different
  1301. // environments.
  1302. //
  1303. // Example uses of this error model include:
  1304. //
  1305. // - Partial errors. If a service needs to return partial errors to the
  1306. // client,
  1307. // it may embed the `Status` in the normal response to indicate the
  1308. // partial
  1309. // errors.
  1310. //
  1311. // - Workflow errors. A typical workflow has multiple steps. Each step
  1312. // may
  1313. // have a `Status` message for error reporting.
  1314. //
  1315. // - Batch operations. If a client uses batch request and batch
  1316. // response, the
  1317. // `Status` message should be used directly inside batch response,
  1318. // one for
  1319. // each error sub-response.
  1320. //
  1321. // - Asynchronous operations. If an API call embeds asynchronous
  1322. // operation
  1323. // results in its response, the status of those operations should
  1324. // be
  1325. // represented directly using the `Status` message.
  1326. //
  1327. // - Logging. If some API errors are stored in logs, the message
  1328. // `Status` could
  1329. // be used directly after any stripping needed for security/privacy
  1330. // reasons.
  1331. type Status struct {
  1332. // Code: The status code, which should be an enum value of
  1333. // google.rpc.Code.
  1334. Code int64 `json:"code,omitempty"`
  1335. // Details: A list of messages that carry the error details. There is a
  1336. // common set of
  1337. // message types for APIs to use.
  1338. Details []googleapi.RawMessage `json:"details,omitempty"`
  1339. // Message: A developer-facing error message, which should be in
  1340. // English. Any
  1341. // user-facing error message should be localized and sent in
  1342. // the
  1343. // google.rpc.Status.details field, or localized by the client.
  1344. Message string `json:"message,omitempty"`
  1345. // ForceSendFields is a list of field names (e.g. "Code") to
  1346. // unconditionally include in API requests. By default, fields with
  1347. // empty values are omitted from API requests. However, any non-pointer,
  1348. // non-interface field appearing in ForceSendFields will be sent to the
  1349. // server regardless of whether the field is empty or not. This may be
  1350. // used to include empty fields in Patch requests.
  1351. ForceSendFields []string `json:"-"`
  1352. // NullFields is a list of field names (e.g. "Code") to include in API
  1353. // requests with the JSON null value. By default, fields with empty
  1354. // values are omitted from API requests. However, any field with an
  1355. // empty value appearing in NullFields will be sent to the server as
  1356. // null. It is an error if a field in this list has a non-empty value.
  1357. // This may be used to include null fields in Patch requests.
  1358. NullFields []string `json:"-"`
  1359. }
  1360. func (s *Status) MarshalJSON() ([]byte, error) {
  1361. type NoMethod Status
  1362. raw := NoMethod(*s)
  1363. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1364. }
  1365. // TextSpan: Represents an output piece of text.
  1366. type TextSpan struct {
  1367. // BeginOffset: The API calculates the beginning offset of the content
  1368. // in the original
  1369. // document according to the EncodingType specified in the API request.
  1370. BeginOffset int64 `json:"beginOffset,omitempty"`
  1371. // Content: The content of the output text.
  1372. Content string `json:"content,omitempty"`
  1373. // ForceSendFields is a list of field names (e.g. "BeginOffset") to
  1374. // unconditionally include in API requests. By default, fields with
  1375. // empty values are omitted from API requests. However, any non-pointer,
  1376. // non-interface field appearing in ForceSendFields will be sent to the
  1377. // server regardless of whether the field is empty or not. This may be
  1378. // used to include empty fields in Patch requests.
  1379. ForceSendFields []string `json:"-"`
  1380. // NullFields is a list of field names (e.g. "BeginOffset") to include
  1381. // in API requests with the JSON null value. By default, fields with
  1382. // empty values are omitted from API requests. However, any field with
  1383. // an empty value appearing in NullFields will be sent to the server as
  1384. // null. It is an error if a field in this list has a non-empty value.
  1385. // This may be used to include null fields in Patch requests.
  1386. NullFields []string `json:"-"`
  1387. }
  1388. func (s *TextSpan) MarshalJSON() ([]byte, error) {
  1389. type NoMethod TextSpan
  1390. raw := NoMethod(*s)
  1391. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1392. }
  1393. // Token: Represents the smallest syntactic building block of the text.
  1394. type Token struct {
  1395. // DependencyEdge: Dependency tree parse for this token.
  1396. DependencyEdge *DependencyEdge `json:"dependencyEdge,omitempty"`
  1397. // Lemma: [Lemma](https://en.wikipedia.org/wiki/Lemma_%28morphology%29)
  1398. // of the token.
  1399. Lemma string `json:"lemma,omitempty"`
  1400. // PartOfSpeech: Parts of speech tag for this token.
  1401. PartOfSpeech *PartOfSpeech `json:"partOfSpeech,omitempty"`
  1402. // Text: The token text.
  1403. Text *TextSpan `json:"text,omitempty"`
  1404. // ForceSendFields is a list of field names (e.g. "DependencyEdge") to
  1405. // unconditionally include in API requests. By default, fields with
  1406. // empty values are omitted from API requests. However, any non-pointer,
  1407. // non-interface field appearing in ForceSendFields will be sent to the
  1408. // server regardless of whether the field is empty or not. This may be
  1409. // used to include empty fields in Patch requests.
  1410. ForceSendFields []string `json:"-"`
  1411. // NullFields is a list of field names (e.g. "DependencyEdge") to
  1412. // include in API requests with the JSON null value. By default, fields
  1413. // with empty values are omitted from API requests. However, any field
  1414. // with an empty value appearing in NullFields will be sent to the
  1415. // server as null. It is an error if a field in this list has a
  1416. // non-empty value. This may be used to include null fields in Patch
  1417. // requests.
  1418. NullFields []string `json:"-"`
  1419. }
  1420. func (s *Token) MarshalJSON() ([]byte, error) {
  1421. type NoMethod Token
  1422. raw := NoMethod(*s)
  1423. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1424. }
  1425. // method id "language.documents.analyzeEntities":
  1426. type DocumentsAnalyzeEntitiesCall struct {
  1427. s *Service
  1428. analyzeentitiesrequest *AnalyzeEntitiesRequest
  1429. urlParams_ gensupport.URLParams
  1430. ctx_ context.Context
  1431. header_ http.Header
  1432. }
  1433. // AnalyzeEntities: Finds named entities (currently proper names and
  1434. // common nouns) in the text
  1435. // along with entity types, salience, mentions for each entity,
  1436. // and
  1437. // other properties.
  1438. func (r *DocumentsService) AnalyzeEntities(analyzeentitiesrequest *AnalyzeEntitiesRequest) *DocumentsAnalyzeEntitiesCall {
  1439. c := &DocumentsAnalyzeEntitiesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1440. c.analyzeentitiesrequest = analyzeentitiesrequest
  1441. return c
  1442. }
  1443. // Fields allows partial responses to be retrieved. See
  1444. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1445. // for more information.
  1446. func (c *DocumentsAnalyzeEntitiesCall) Fields(s ...googleapi.Field) *DocumentsAnalyzeEntitiesCall {
  1447. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1448. return c
  1449. }
  1450. // Context sets the context to be used in this call's Do method. Any
  1451. // pending HTTP request will be aborted if the provided context is
  1452. // canceled.
  1453. func (c *DocumentsAnalyzeEntitiesCall) Context(ctx context.Context) *DocumentsAnalyzeEntitiesCall {
  1454. c.ctx_ = ctx
  1455. return c
  1456. }
  1457. // Header returns an http.Header that can be modified by the caller to
  1458. // add HTTP headers to the request.
  1459. func (c *DocumentsAnalyzeEntitiesCall) Header() http.Header {
  1460. if c.header_ == nil {
  1461. c.header_ = make(http.Header)
  1462. }
  1463. return c.header_
  1464. }
  1465. func (c *DocumentsAnalyzeEntitiesCall) doRequest(alt string) (*http.Response, error) {
  1466. reqHeaders := make(http.Header)
  1467. for k, v := range c.header_ {
  1468. reqHeaders[k] = v
  1469. }
  1470. reqHeaders.Set("User-Agent", c.s.userAgent())
  1471. var body io.Reader = nil
  1472. body, err := googleapi.WithoutDataWrapper.JSONReader(c.analyzeentitiesrequest)
  1473. if err != nil {
  1474. return nil, err
  1475. }
  1476. reqHeaders.Set("Content-Type", "application/json")
  1477. c.urlParams_.Set("alt", alt)
  1478. c.urlParams_.Set("prettyPrint", "false")
  1479. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/documents:analyzeEntities")
  1480. urls += "?" + c.urlParams_.Encode()
  1481. req, err := http.NewRequest("POST", urls, body)
  1482. if err != nil {
  1483. return nil, err
  1484. }
  1485. req.Header = reqHeaders
  1486. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1487. }
  1488. // Do executes the "language.documents.analyzeEntities" call.
  1489. // Exactly one of *AnalyzeEntitiesResponse or error will be non-nil. Any
  1490. // non-2xx status code is an error. Response headers are in either
  1491. // *AnalyzeEntitiesResponse.ServerResponse.Header or (if a response was
  1492. // returned at all) in error.(*googleapi.Error).Header. Use
  1493. // googleapi.IsNotModified to check whether the returned error was
  1494. // because http.StatusNotModified was returned.
  1495. func (c *DocumentsAnalyzeEntitiesCall) Do(opts ...googleapi.CallOption) (*AnalyzeEntitiesResponse, error) {
  1496. gensupport.SetOptions(c.urlParams_, opts...)
  1497. res, err := c.doRequest("json")
  1498. if res != nil && res.StatusCode == http.StatusNotModified {
  1499. if res.Body != nil {
  1500. res.Body.Close()
  1501. }
  1502. return nil, &googleapi.Error{
  1503. Code: res.StatusCode,
  1504. Header: res.Header,
  1505. }
  1506. }
  1507. if err != nil {
  1508. return nil, err
  1509. }
  1510. defer googleapi.CloseBody(res)
  1511. if err := googleapi.CheckResponse(res); err != nil {
  1512. return nil, err
  1513. }
  1514. ret := &AnalyzeEntitiesResponse{
  1515. ServerResponse: googleapi.ServerResponse{
  1516. Header: res.Header,
  1517. HTTPStatusCode: res.StatusCode,
  1518. },
  1519. }
  1520. target := &ret
  1521. if err := gensupport.DecodeResponse(target, res); err != nil {
  1522. return nil, err
  1523. }
  1524. return ret, nil
  1525. // {
  1526. // "description": "Finds named entities (currently proper names and common nouns) in the text\nalong with entity types, salience, mentions for each entity, and\nother properties.",
  1527. // "flatPath": "v1beta2/documents:analyzeEntities",
  1528. // "httpMethod": "POST",
  1529. // "id": "language.documents.analyzeEntities",
  1530. // "parameterOrder": [],
  1531. // "parameters": {},
  1532. // "path": "v1beta2/documents:analyzeEntities",
  1533. // "request": {
  1534. // "$ref": "AnalyzeEntitiesRequest"
  1535. // },
  1536. // "response": {
  1537. // "$ref": "AnalyzeEntitiesResponse"
  1538. // },
  1539. // "scopes": [
  1540. // "https://www.googleapis.com/auth/cloud-language",
  1541. // "https://www.googleapis.com/auth/cloud-platform"
  1542. // ]
  1543. // }
  1544. }
  1545. // method id "language.documents.analyzeEntitySentiment":
  1546. type DocumentsAnalyzeEntitySentimentCall struct {
  1547. s *Service
  1548. analyzeentitysentimentrequest *AnalyzeEntitySentimentRequest
  1549. urlParams_ gensupport.URLParams
  1550. ctx_ context.Context
  1551. header_ http.Header
  1552. }
  1553. // AnalyzeEntitySentiment: Finds entities, similar to AnalyzeEntities in
  1554. // the text and analyzes
  1555. // sentiment associated with each entity and its mentions.
  1556. func (r *DocumentsService) AnalyzeEntitySentiment(analyzeentitysentimentrequest *AnalyzeEntitySentimentRequest) *DocumentsAnalyzeEntitySentimentCall {
  1557. c := &DocumentsAnalyzeEntitySentimentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1558. c.analyzeentitysentimentrequest = analyzeentitysentimentrequest
  1559. return c
  1560. }
  1561. // Fields allows partial responses to be retrieved. See
  1562. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1563. // for more information.
  1564. func (c *DocumentsAnalyzeEntitySentimentCall) Fields(s ...googleapi.Field) *DocumentsAnalyzeEntitySentimentCall {
  1565. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1566. return c
  1567. }
  1568. // Context sets the context to be used in this call's Do method. Any
  1569. // pending HTTP request will be aborted if the provided context is
  1570. // canceled.
  1571. func (c *DocumentsAnalyzeEntitySentimentCall) Context(ctx context.Context) *DocumentsAnalyzeEntitySentimentCall {
  1572. c.ctx_ = ctx
  1573. return c
  1574. }
  1575. // Header returns an http.Header that can be modified by the caller to
  1576. // add HTTP headers to the request.
  1577. func (c *DocumentsAnalyzeEntitySentimentCall) Header() http.Header {
  1578. if c.header_ == nil {
  1579. c.header_ = make(http.Header)
  1580. }
  1581. return c.header_
  1582. }
  1583. func (c *DocumentsAnalyzeEntitySentimentCall) doRequest(alt string) (*http.Response, error) {
  1584. reqHeaders := make(http.Header)
  1585. for k, v := range c.header_ {
  1586. reqHeaders[k] = v
  1587. }
  1588. reqHeaders.Set("User-Agent", c.s.userAgent())
  1589. var body io.Reader = nil
  1590. body, err := googleapi.WithoutDataWrapper.JSONReader(c.analyzeentitysentimentrequest)
  1591. if err != nil {
  1592. return nil, err
  1593. }
  1594. reqHeaders.Set("Content-Type", "application/json")
  1595. c.urlParams_.Set("alt", alt)
  1596. c.urlParams_.Set("prettyPrint", "false")
  1597. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/documents:analyzeEntitySentiment")
  1598. urls += "?" + c.urlParams_.Encode()
  1599. req, err := http.NewRequest("POST", urls, body)
  1600. if err != nil {
  1601. return nil, err
  1602. }
  1603. req.Header = reqHeaders
  1604. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1605. }
  1606. // Do executes the "language.documents.analyzeEntitySentiment" call.
  1607. // Exactly one of *AnalyzeEntitySentimentResponse or error will be
  1608. // non-nil. Any non-2xx status code is an error. Response headers are in
  1609. // either *AnalyzeEntitySentimentResponse.ServerResponse.Header or (if a
  1610. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1611. // googleapi.IsNotModified to check whether the returned error was
  1612. // because http.StatusNotModified was returned.
  1613. func (c *DocumentsAnalyzeEntitySentimentCall) Do(opts ...googleapi.CallOption) (*AnalyzeEntitySentimentResponse, error) {
  1614. gensupport.SetOptions(c.urlParams_, opts...)
  1615. res, err := c.doRequest("json")
  1616. if res != nil && res.StatusCode == http.StatusNotModified {
  1617. if res.Body != nil {
  1618. res.Body.Close()
  1619. }
  1620. return nil, &googleapi.Error{
  1621. Code: res.StatusCode,
  1622. Header: res.Header,
  1623. }
  1624. }
  1625. if err != nil {
  1626. return nil, err
  1627. }
  1628. defer googleapi.CloseBody(res)
  1629. if err := googleapi.CheckResponse(res); err != nil {
  1630. return nil, err
  1631. }
  1632. ret := &AnalyzeEntitySentimentResponse{
  1633. ServerResponse: googleapi.ServerResponse{
  1634. Header: res.Header,
  1635. HTTPStatusCode: res.StatusCode,
  1636. },
  1637. }
  1638. target := &ret
  1639. if err := gensupport.DecodeResponse(target, res); err != nil {
  1640. return nil, err
  1641. }
  1642. return ret, nil
  1643. // {
  1644. // "description": "Finds entities, similar to AnalyzeEntities in the text and analyzes\nsentiment associated with each entity and its mentions.",
  1645. // "flatPath": "v1beta2/documents:analyzeEntitySentiment",
  1646. // "httpMethod": "POST",
  1647. // "id": "language.documents.analyzeEntitySentiment",
  1648. // "parameterOrder": [],
  1649. // "parameters": {},
  1650. // "path": "v1beta2/documents:analyzeEntitySentiment",
  1651. // "request": {
  1652. // "$ref": "AnalyzeEntitySentimentRequest"
  1653. // },
  1654. // "response": {
  1655. // "$ref": "AnalyzeEntitySentimentResponse"
  1656. // },
  1657. // "scopes": [
  1658. // "https://www.googleapis.com/auth/cloud-language",
  1659. // "https://www.googleapis.com/auth/cloud-platform"
  1660. // ]
  1661. // }
  1662. }
  1663. // method id "language.documents.analyzeSentiment":
  1664. type DocumentsAnalyzeSentimentCall struct {
  1665. s *Service
  1666. analyzesentimentrequest *AnalyzeSentimentRequest
  1667. urlParams_ gensupport.URLParams
  1668. ctx_ context.Context
  1669. header_ http.Header
  1670. }
  1671. // AnalyzeSentiment: Analyzes the sentiment of the provided text.
  1672. func (r *DocumentsService) AnalyzeSentiment(analyzesentimentrequest *AnalyzeSentimentRequest) *DocumentsAnalyzeSentimentCall {
  1673. c := &DocumentsAnalyzeSentimentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1674. c.analyzesentimentrequest = analyzesentimentrequest
  1675. return c
  1676. }
  1677. // Fields allows partial responses to be retrieved. See
  1678. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1679. // for more information.
  1680. func (c *DocumentsAnalyzeSentimentCall) Fields(s ...googleapi.Field) *DocumentsAnalyzeSentimentCall {
  1681. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1682. return c
  1683. }
  1684. // Context sets the context to be used in this call's Do method. Any
  1685. // pending HTTP request will be aborted if the provided context is
  1686. // canceled.
  1687. func (c *DocumentsAnalyzeSentimentCall) Context(ctx context.Context) *DocumentsAnalyzeSentimentCall {
  1688. c.ctx_ = ctx
  1689. return c
  1690. }
  1691. // Header returns an http.Header that can be modified by the caller to
  1692. // add HTTP headers to the request.
  1693. func (c *DocumentsAnalyzeSentimentCall) Header() http.Header {
  1694. if c.header_ == nil {
  1695. c.header_ = make(http.Header)
  1696. }
  1697. return c.header_
  1698. }
  1699. func (c *DocumentsAnalyzeSentimentCall) doRequest(alt string) (*http.Response, error) {
  1700. reqHeaders := make(http.Header)
  1701. for k, v := range c.header_ {
  1702. reqHeaders[k] = v
  1703. }
  1704. reqHeaders.Set("User-Agent", c.s.userAgent())
  1705. var body io.Reader = nil
  1706. body, err := googleapi.WithoutDataWrapper.JSONReader(c.analyzesentimentrequest)
  1707. if err != nil {
  1708. return nil, err
  1709. }
  1710. reqHeaders.Set("Content-Type", "application/json")
  1711. c.urlParams_.Set("alt", alt)
  1712. c.urlParams_.Set("prettyPrint", "false")
  1713. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/documents:analyzeSentiment")
  1714. urls += "?" + c.urlParams_.Encode()
  1715. req, err := http.NewRequest("POST", urls, body)
  1716. if err != nil {
  1717. return nil, err
  1718. }
  1719. req.Header = reqHeaders
  1720. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1721. }
  1722. // Do executes the "language.documents.analyzeSentiment" call.
  1723. // Exactly one of *AnalyzeSentimentResponse or error will be non-nil.
  1724. // Any non-2xx status code is an error. Response headers are in either
  1725. // *AnalyzeSentimentResponse.ServerResponse.Header or (if a response was
  1726. // returned at all) in error.(*googleapi.Error).Header. Use
  1727. // googleapi.IsNotModified to check whether the returned error was
  1728. // because http.StatusNotModified was returned.
  1729. func (c *DocumentsAnalyzeSentimentCall) Do(opts ...googleapi.CallOption) (*AnalyzeSentimentResponse, error) {
  1730. gensupport.SetOptions(c.urlParams_, opts...)
  1731. res, err := c.doRequest("json")
  1732. if res != nil && res.StatusCode == http.StatusNotModified {
  1733. if res.Body != nil {
  1734. res.Body.Close()
  1735. }
  1736. return nil, &googleapi.Error{
  1737. Code: res.StatusCode,
  1738. Header: res.Header,
  1739. }
  1740. }
  1741. if err != nil {
  1742. return nil, err
  1743. }
  1744. defer googleapi.CloseBody(res)
  1745. if err := googleapi.CheckResponse(res); err != nil {
  1746. return nil, err
  1747. }
  1748. ret := &AnalyzeSentimentResponse{
  1749. ServerResponse: googleapi.ServerResponse{
  1750. Header: res.Header,
  1751. HTTPStatusCode: res.StatusCode,
  1752. },
  1753. }
  1754. target := &ret
  1755. if err := gensupport.DecodeResponse(target, res); err != nil {
  1756. return nil, err
  1757. }
  1758. return ret, nil
  1759. // {
  1760. // "description": "Analyzes the sentiment of the provided text.",
  1761. // "flatPath": "v1beta2/documents:analyzeSentiment",
  1762. // "httpMethod": "POST",
  1763. // "id": "language.documents.analyzeSentiment",
  1764. // "parameterOrder": [],
  1765. // "parameters": {},
  1766. // "path": "v1beta2/documents:analyzeSentiment",
  1767. // "request": {
  1768. // "$ref": "AnalyzeSentimentRequest"
  1769. // },
  1770. // "response": {
  1771. // "$ref": "AnalyzeSentimentResponse"
  1772. // },
  1773. // "scopes": [
  1774. // "https://www.googleapis.com/auth/cloud-language",
  1775. // "https://www.googleapis.com/auth/cloud-platform"
  1776. // ]
  1777. // }
  1778. }
  1779. // method id "language.documents.analyzeSyntax":
  1780. type DocumentsAnalyzeSyntaxCall struct {
  1781. s *Service
  1782. analyzesyntaxrequest *AnalyzeSyntaxRequest
  1783. urlParams_ gensupport.URLParams
  1784. ctx_ context.Context
  1785. header_ http.Header
  1786. }
  1787. // AnalyzeSyntax: Analyzes the syntax of the text and provides sentence
  1788. // boundaries and
  1789. // tokenization along with part of speech tags, dependency trees, and
  1790. // other
  1791. // properties.
  1792. func (r *DocumentsService) AnalyzeSyntax(analyzesyntaxrequest *AnalyzeSyntaxRequest) *DocumentsAnalyzeSyntaxCall {
  1793. c := &DocumentsAnalyzeSyntaxCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1794. c.analyzesyntaxrequest = analyzesyntaxrequest
  1795. return c
  1796. }
  1797. // Fields allows partial responses to be retrieved. See
  1798. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1799. // for more information.
  1800. func (c *DocumentsAnalyzeSyntaxCall) Fields(s ...googleapi.Field) *DocumentsAnalyzeSyntaxCall {
  1801. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1802. return c
  1803. }
  1804. // Context sets the context to be used in this call's Do method. Any
  1805. // pending HTTP request will be aborted if the provided context is
  1806. // canceled.
  1807. func (c *DocumentsAnalyzeSyntaxCall) Context(ctx context.Context) *DocumentsAnalyzeSyntaxCall {
  1808. c.ctx_ = ctx
  1809. return c
  1810. }
  1811. // Header returns an http.Header that can be modified by the caller to
  1812. // add HTTP headers to the request.
  1813. func (c *DocumentsAnalyzeSyntaxCall) Header() http.Header {
  1814. if c.header_ == nil {
  1815. c.header_ = make(http.Header)
  1816. }
  1817. return c.header_
  1818. }
  1819. func (c *DocumentsAnalyzeSyntaxCall) doRequest(alt string) (*http.Response, error) {
  1820. reqHeaders := make(http.Header)
  1821. for k, v := range c.header_ {
  1822. reqHeaders[k] = v
  1823. }
  1824. reqHeaders.Set("User-Agent", c.s.userAgent())
  1825. var body io.Reader = nil
  1826. body, err := googleapi.WithoutDataWrapper.JSONReader(c.analyzesyntaxrequest)
  1827. if err != nil {
  1828. return nil, err
  1829. }
  1830. reqHeaders.Set("Content-Type", "application/json")
  1831. c.urlParams_.Set("alt", alt)
  1832. c.urlParams_.Set("prettyPrint", "false")
  1833. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/documents:analyzeSyntax")
  1834. urls += "?" + c.urlParams_.Encode()
  1835. req, err := http.NewRequest("POST", urls, body)
  1836. if err != nil {
  1837. return nil, err
  1838. }
  1839. req.Header = reqHeaders
  1840. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1841. }
  1842. // Do executes the "language.documents.analyzeSyntax" call.
  1843. // Exactly one of *AnalyzeSyntaxResponse or error will be non-nil. Any
  1844. // non-2xx status code is an error. Response headers are in either
  1845. // *AnalyzeSyntaxResponse.ServerResponse.Header or (if a response was
  1846. // returned at all) in error.(*googleapi.Error).Header. Use
  1847. // googleapi.IsNotModified to check whether the returned error was
  1848. // because http.StatusNotModified was returned.
  1849. func (c *DocumentsAnalyzeSyntaxCall) Do(opts ...googleapi.CallOption) (*AnalyzeSyntaxResponse, error) {
  1850. gensupport.SetOptions(c.urlParams_, opts...)
  1851. res, err := c.doRequest("json")
  1852. if res != nil && res.StatusCode == http.StatusNotModified {
  1853. if res.Body != nil {
  1854. res.Body.Close()
  1855. }
  1856. return nil, &googleapi.Error{
  1857. Code: res.StatusCode,
  1858. Header: res.Header,
  1859. }
  1860. }
  1861. if err != nil {
  1862. return nil, err
  1863. }
  1864. defer googleapi.CloseBody(res)
  1865. if err := googleapi.CheckResponse(res); err != nil {
  1866. return nil, err
  1867. }
  1868. ret := &AnalyzeSyntaxResponse{
  1869. ServerResponse: googleapi.ServerResponse{
  1870. Header: res.Header,
  1871. HTTPStatusCode: res.StatusCode,
  1872. },
  1873. }
  1874. target := &ret
  1875. if err := gensupport.DecodeResponse(target, res); err != nil {
  1876. return nil, err
  1877. }
  1878. return ret, nil
  1879. // {
  1880. // "description": "Analyzes the syntax of the text and provides sentence boundaries and\ntokenization along with part of speech tags, dependency trees, and other\nproperties.",
  1881. // "flatPath": "v1beta2/documents:analyzeSyntax",
  1882. // "httpMethod": "POST",
  1883. // "id": "language.documents.analyzeSyntax",
  1884. // "parameterOrder": [],
  1885. // "parameters": {},
  1886. // "path": "v1beta2/documents:analyzeSyntax",
  1887. // "request": {
  1888. // "$ref": "AnalyzeSyntaxRequest"
  1889. // },
  1890. // "response": {
  1891. // "$ref": "AnalyzeSyntaxResponse"
  1892. // },
  1893. // "scopes": [
  1894. // "https://www.googleapis.com/auth/cloud-language",
  1895. // "https://www.googleapis.com/auth/cloud-platform"
  1896. // ]
  1897. // }
  1898. }
  1899. // method id "language.documents.annotateText":
  1900. type DocumentsAnnotateTextCall struct {
  1901. s *Service
  1902. annotatetextrequest *AnnotateTextRequest
  1903. urlParams_ gensupport.URLParams
  1904. ctx_ context.Context
  1905. header_ http.Header
  1906. }
  1907. // AnnotateText: A convenience method that provides all syntax,
  1908. // sentiment, entity, and
  1909. // classification features in one call.
  1910. func (r *DocumentsService) AnnotateText(annotatetextrequest *AnnotateTextRequest) *DocumentsAnnotateTextCall {
  1911. c := &DocumentsAnnotateTextCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1912. c.annotatetextrequest = annotatetextrequest
  1913. return c
  1914. }
  1915. // Fields allows partial responses to be retrieved. See
  1916. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1917. // for more information.
  1918. func (c *DocumentsAnnotateTextCall) Fields(s ...googleapi.Field) *DocumentsAnnotateTextCall {
  1919. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1920. return c
  1921. }
  1922. // Context sets the context to be used in this call's Do method. Any
  1923. // pending HTTP request will be aborted if the provided context is
  1924. // canceled.
  1925. func (c *DocumentsAnnotateTextCall) Context(ctx context.Context) *DocumentsAnnotateTextCall {
  1926. c.ctx_ = ctx
  1927. return c
  1928. }
  1929. // Header returns an http.Header that can be modified by the caller to
  1930. // add HTTP headers to the request.
  1931. func (c *DocumentsAnnotateTextCall) Header() http.Header {
  1932. if c.header_ == nil {
  1933. c.header_ = make(http.Header)
  1934. }
  1935. return c.header_
  1936. }
  1937. func (c *DocumentsAnnotateTextCall) doRequest(alt string) (*http.Response, error) {
  1938. reqHeaders := make(http.Header)
  1939. for k, v := range c.header_ {
  1940. reqHeaders[k] = v
  1941. }
  1942. reqHeaders.Set("User-Agent", c.s.userAgent())
  1943. var body io.Reader = nil
  1944. body, err := googleapi.WithoutDataWrapper.JSONReader(c.annotatetextrequest)
  1945. if err != nil {
  1946. return nil, err
  1947. }
  1948. reqHeaders.Set("Content-Type", "application/json")
  1949. c.urlParams_.Set("alt", alt)
  1950. c.urlParams_.Set("prettyPrint", "false")
  1951. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/documents:annotateText")
  1952. urls += "?" + c.urlParams_.Encode()
  1953. req, err := http.NewRequest("POST", urls, body)
  1954. if err != nil {
  1955. return nil, err
  1956. }
  1957. req.Header = reqHeaders
  1958. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1959. }
  1960. // Do executes the "language.documents.annotateText" call.
  1961. // Exactly one of *AnnotateTextResponse or error will be non-nil. Any
  1962. // non-2xx status code is an error. Response headers are in either
  1963. // *AnnotateTextResponse.ServerResponse.Header or (if a response was
  1964. // returned at all) in error.(*googleapi.Error).Header. Use
  1965. // googleapi.IsNotModified to check whether the returned error was
  1966. // because http.StatusNotModified was returned.
  1967. func (c *DocumentsAnnotateTextCall) Do(opts ...googleapi.CallOption) (*AnnotateTextResponse, error) {
  1968. gensupport.SetOptions(c.urlParams_, opts...)
  1969. res, err := c.doRequest("json")
  1970. if res != nil && res.StatusCode == http.StatusNotModified {
  1971. if res.Body != nil {
  1972. res.Body.Close()
  1973. }
  1974. return nil, &googleapi.Error{
  1975. Code: res.StatusCode,
  1976. Header: res.Header,
  1977. }
  1978. }
  1979. if err != nil {
  1980. return nil, err
  1981. }
  1982. defer googleapi.CloseBody(res)
  1983. if err := googleapi.CheckResponse(res); err != nil {
  1984. return nil, err
  1985. }
  1986. ret := &AnnotateTextResponse{
  1987. ServerResponse: googleapi.ServerResponse{
  1988. Header: res.Header,
  1989. HTTPStatusCode: res.StatusCode,
  1990. },
  1991. }
  1992. target := &ret
  1993. if err := gensupport.DecodeResponse(target, res); err != nil {
  1994. return nil, err
  1995. }
  1996. return ret, nil
  1997. // {
  1998. // "description": "A convenience method that provides all syntax, sentiment, entity, and\nclassification features in one call.",
  1999. // "flatPath": "v1beta2/documents:annotateText",
  2000. // "httpMethod": "POST",
  2001. // "id": "language.documents.annotateText",
  2002. // "parameterOrder": [],
  2003. // "parameters": {},
  2004. // "path": "v1beta2/documents:annotateText",
  2005. // "request": {
  2006. // "$ref": "AnnotateTextRequest"
  2007. // },
  2008. // "response": {
  2009. // "$ref": "AnnotateTextResponse"
  2010. // },
  2011. // "scopes": [
  2012. // "https://www.googleapis.com/auth/cloud-language",
  2013. // "https://www.googleapis.com/auth/cloud-platform"
  2014. // ]
  2015. // }
  2016. }
  2017. // method id "language.documents.classifyText":
  2018. type DocumentsClassifyTextCall struct {
  2019. s *Service
  2020. classifytextrequest *ClassifyTextRequest
  2021. urlParams_ gensupport.URLParams
  2022. ctx_ context.Context
  2023. header_ http.Header
  2024. }
  2025. // ClassifyText: Classifies a document into categories.
  2026. func (r *DocumentsService) ClassifyText(classifytextrequest *ClassifyTextRequest) *DocumentsClassifyTextCall {
  2027. c := &DocumentsClassifyTextCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2028. c.classifytextrequest = classifytextrequest
  2029. return c
  2030. }
  2031. // Fields allows partial responses to be retrieved. See
  2032. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2033. // for more information.
  2034. func (c *DocumentsClassifyTextCall) Fields(s ...googleapi.Field) *DocumentsClassifyTextCall {
  2035. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2036. return c
  2037. }
  2038. // Context sets the context to be used in this call's Do method. Any
  2039. // pending HTTP request will be aborted if the provided context is
  2040. // canceled.
  2041. func (c *DocumentsClassifyTextCall) Context(ctx context.Context) *DocumentsClassifyTextCall {
  2042. c.ctx_ = ctx
  2043. return c
  2044. }
  2045. // Header returns an http.Header that can be modified by the caller to
  2046. // add HTTP headers to the request.
  2047. func (c *DocumentsClassifyTextCall) Header() http.Header {
  2048. if c.header_ == nil {
  2049. c.header_ = make(http.Header)
  2050. }
  2051. return c.header_
  2052. }
  2053. func (c *DocumentsClassifyTextCall) doRequest(alt string) (*http.Response, error) {
  2054. reqHeaders := make(http.Header)
  2055. for k, v := range c.header_ {
  2056. reqHeaders[k] = v
  2057. }
  2058. reqHeaders.Set("User-Agent", c.s.userAgent())
  2059. var body io.Reader = nil
  2060. body, err := googleapi.WithoutDataWrapper.JSONReader(c.classifytextrequest)
  2061. if err != nil {
  2062. return nil, err
  2063. }
  2064. reqHeaders.Set("Content-Type", "application/json")
  2065. c.urlParams_.Set("alt", alt)
  2066. c.urlParams_.Set("prettyPrint", "false")
  2067. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/documents:classifyText")
  2068. urls += "?" + c.urlParams_.Encode()
  2069. req, err := http.NewRequest("POST", urls, body)
  2070. if err != nil {
  2071. return nil, err
  2072. }
  2073. req.Header = reqHeaders
  2074. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2075. }
  2076. // Do executes the "language.documents.classifyText" call.
  2077. // Exactly one of *ClassifyTextResponse or error will be non-nil. Any
  2078. // non-2xx status code is an error. Response headers are in either
  2079. // *ClassifyTextResponse.ServerResponse.Header or (if a response was
  2080. // returned at all) in error.(*googleapi.Error).Header. Use
  2081. // googleapi.IsNotModified to check whether the returned error was
  2082. // because http.StatusNotModified was returned.
  2083. func (c *DocumentsClassifyTextCall) Do(opts ...googleapi.CallOption) (*ClassifyTextResponse, error) {
  2084. gensupport.SetOptions(c.urlParams_, opts...)
  2085. res, err := c.doRequest("json")
  2086. if res != nil && res.StatusCode == http.StatusNotModified {
  2087. if res.Body != nil {
  2088. res.Body.Close()
  2089. }
  2090. return nil, &googleapi.Error{
  2091. Code: res.StatusCode,
  2092. Header: res.Header,
  2093. }
  2094. }
  2095. if err != nil {
  2096. return nil, err
  2097. }
  2098. defer googleapi.CloseBody(res)
  2099. if err := googleapi.CheckResponse(res); err != nil {
  2100. return nil, err
  2101. }
  2102. ret := &ClassifyTextResponse{
  2103. ServerResponse: googleapi.ServerResponse{
  2104. Header: res.Header,
  2105. HTTPStatusCode: res.StatusCode,
  2106. },
  2107. }
  2108. target := &ret
  2109. if err := gensupport.DecodeResponse(target, res); err != nil {
  2110. return nil, err
  2111. }
  2112. return ret, nil
  2113. // {
  2114. // "description": "Classifies a document into categories.",
  2115. // "flatPath": "v1beta2/documents:classifyText",
  2116. // "httpMethod": "POST",
  2117. // "id": "language.documents.classifyText",
  2118. // "parameterOrder": [],
  2119. // "parameters": {},
  2120. // "path": "v1beta2/documents:classifyText",
  2121. // "request": {
  2122. // "$ref": "ClassifyTextRequest"
  2123. // },
  2124. // "response": {
  2125. // "$ref": "ClassifyTextResponse"
  2126. // },
  2127. // "scopes": [
  2128. // "https://www.googleapis.com/auth/cloud-language",
  2129. // "https://www.googleapis.com/auth/cloud-platform"
  2130. // ]
  2131. // }
  2132. }