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

1805 lines
64 KiB

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