...

Source file src/google.golang.org/api/language/v1beta1/language-gen.go

Documentation: google.golang.org/api/language/v1beta1

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

View as plain text