...

Source file src/google.golang.org/api/digitalassetlinks/v1/digitalassetlinks-gen.go

Documentation: google.golang.org/api/digitalassetlinks/v1

     1  // Copyright 2024 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 digitalassetlinks provides access to the Digital Asset Links API.
     8  //
     9  // For product documentation, see: https://developers.google.com/digital-asset-links/
    10  //
    11  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/digitalassetlinks/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	digitalassetlinksService, err := digitalassetlinks.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // To use an API key for authentication (note: some APIs do not support API
    38  // keys), use [google.golang.org/api/option.WithAPIKey]:
    39  //
    40  //	digitalassetlinksService, err := digitalassetlinks.NewService(ctx, option.WithAPIKey("AIza..."))
    41  //
    42  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    43  // flow, use [google.golang.org/api/option.WithTokenSource]:
    44  //
    45  //	config := &oauth2.Config{...}
    46  //	// ...
    47  //	token, err := config.Exchange(ctx, ...)
    48  //	digitalassetlinksService, err := digitalassetlinks.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package digitalassetlinks // import "google.golang.org/api/digitalassetlinks/v1"
    52  
    53  import (
    54  	"bytes"
    55  	"context"
    56  	"encoding/json"
    57  	"errors"
    58  	"fmt"
    59  	"io"
    60  	"net/http"
    61  	"net/url"
    62  	"strconv"
    63  	"strings"
    64  
    65  	googleapi "google.golang.org/api/googleapi"
    66  	internal "google.golang.org/api/internal"
    67  	gensupport "google.golang.org/api/internal/gensupport"
    68  	option "google.golang.org/api/option"
    69  	internaloption "google.golang.org/api/option/internaloption"
    70  	htransport "google.golang.org/api/transport/http"
    71  )
    72  
    73  // Always reference these packages, just in case the auto-generated code
    74  // below doesn't.
    75  var _ = bytes.NewBuffer
    76  var _ = strconv.Itoa
    77  var _ = fmt.Sprintf
    78  var _ = json.NewDecoder
    79  var _ = io.Copy
    80  var _ = url.Parse
    81  var _ = gensupport.MarshalJSON
    82  var _ = googleapi.Version
    83  var _ = errors.New
    84  var _ = strings.Replace
    85  var _ = context.Canceled
    86  var _ = internaloption.WithDefaultEndpoint
    87  var _ = internal.Version
    88  
    89  const apiId = "digitalassetlinks:v1"
    90  const apiName = "digitalassetlinks"
    91  const apiVersion = "v1"
    92  const basePath = "https://digitalassetlinks.googleapis.com/"
    93  const basePathTemplate = "https://digitalassetlinks.UNIVERSE_DOMAIN/"
    94  const mtlsBasePath = "https://digitalassetlinks.mtls.googleapis.com/"
    95  
    96  // NewService creates a new Service.
    97  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    98  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
    99  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   100  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   101  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   102  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   103  	if err != nil {
   104  		return nil, err
   105  	}
   106  	s, err := New(client)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	if endpoint != "" {
   111  		s.BasePath = endpoint
   112  	}
   113  	return s, nil
   114  }
   115  
   116  // New creates a new Service. It uses the provided http.Client for requests.
   117  //
   118  // Deprecated: please use NewService instead.
   119  // To provide a custom HTTP client, use option.WithHTTPClient.
   120  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   121  func New(client *http.Client) (*Service, error) {
   122  	if client == nil {
   123  		return nil, errors.New("client is nil")
   124  	}
   125  	s := &Service{client: client, BasePath: basePath}
   126  	s.Assetlinks = NewAssetlinksService(s)
   127  	s.Statements = NewStatementsService(s)
   128  	return s, nil
   129  }
   130  
   131  type Service struct {
   132  	client    *http.Client
   133  	BasePath  string // API endpoint base URL
   134  	UserAgent string // optional additional User-Agent fragment
   135  
   136  	Assetlinks *AssetlinksService
   137  
   138  	Statements *StatementsService
   139  }
   140  
   141  func (s *Service) userAgent() string {
   142  	if s.UserAgent == "" {
   143  		return googleapi.UserAgent
   144  	}
   145  	return googleapi.UserAgent + " " + s.UserAgent
   146  }
   147  
   148  func NewAssetlinksService(s *Service) *AssetlinksService {
   149  	rs := &AssetlinksService{s: s}
   150  	return rs
   151  }
   152  
   153  type AssetlinksService struct {
   154  	s *Service
   155  }
   156  
   157  func NewStatementsService(s *Service) *StatementsService {
   158  	rs := &StatementsService{s: s}
   159  	return rs
   160  }
   161  
   162  type StatementsService struct {
   163  	s *Service
   164  }
   165  
   166  // AndroidAppAsset: Describes an android app asset.
   167  type AndroidAppAsset struct {
   168  	// Certificate: Because there is no global enforcement of package name
   169  	// uniqueness, we also require a signing certificate, which in combination with
   170  	// the package name uniquely identifies an app. Some apps' signing keys are
   171  	// rotated, so they may be signed by different keys over time. We treat these
   172  	// as distinct assets, since we use (package name, cert) as the unique ID. This
   173  	// should not normally pose any problems as both versions of the app will make
   174  	// the same or similar statements. Other assets making statements about the app
   175  	// will have to be updated when a key is rotated, however. (Note that the
   176  	// syntaxes for publishing and querying for statements contain syntactic sugar
   177  	// to easily let you specify apps that are known by multiple certificates.)
   178  	// REQUIRED
   179  	Certificate *CertificateInfo `json:"certificate,omitempty"`
   180  	// PackageName: Android App assets are naturally identified by their Java
   181  	// package name. For example, the Google Maps app uses the package name
   182  	// `com.google.android.apps.maps`. REQUIRED
   183  	PackageName string `json:"packageName,omitempty"`
   184  	// ForceSendFields is a list of field names (e.g. "Certificate") to
   185  	// unconditionally include in API requests. By default, fields with empty or
   186  	// default values are omitted from API requests. See
   187  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   188  	// details.
   189  	ForceSendFields []string `json:"-"`
   190  	// NullFields is a list of field names (e.g. "Certificate") to include in API
   191  	// requests with the JSON null value. By default, fields with empty values are
   192  	// omitted from API requests. See
   193  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   194  	NullFields []string `json:"-"`
   195  }
   196  
   197  func (s *AndroidAppAsset) MarshalJSON() ([]byte, error) {
   198  	type NoMethod AndroidAppAsset
   199  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   200  }
   201  
   202  // Asset: Uniquely identifies an asset. A digital asset is an identifiable and
   203  // addressable online entity that typically provides some service or content.
   204  // Examples of assets are websites, Android apps, Twitter feeds, and Plus
   205  // Pages.
   206  type Asset struct {
   207  	// AndroidApp: Set if this is an Android App asset.
   208  	AndroidApp *AndroidAppAsset `json:"androidApp,omitempty"`
   209  	// Web: Set if this is a web asset.
   210  	Web *WebAsset `json:"web,omitempty"`
   211  	// ForceSendFields is a list of field names (e.g. "AndroidApp") to
   212  	// unconditionally include in API requests. By default, fields with empty or
   213  	// default values are omitted from API requests. See
   214  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   215  	// details.
   216  	ForceSendFields []string `json:"-"`
   217  	// NullFields is a list of field names (e.g. "AndroidApp") to include in API
   218  	// requests with the JSON null value. By default, fields with empty values are
   219  	// omitted from API requests. See
   220  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   221  	NullFields []string `json:"-"`
   222  }
   223  
   224  func (s *Asset) MarshalJSON() ([]byte, error) {
   225  	type NoMethod Asset
   226  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   227  }
   228  
   229  // BulkCheckRequest: Message used to check for the existence of multiple
   230  // digital asset links within a single RPC.
   231  type BulkCheckRequest struct {
   232  	// AllowGoogleInternalDataSources: Same configuration as in Check request, all
   233  	// statements checks will use same configurations.
   234  	AllowGoogleInternalDataSources bool `json:"allowGoogleInternalDataSources,omitempty"`
   235  	// DefaultRelation: If specified, will be used in any given template statement
   236  	// that doesn’t specify a relation.
   237  	DefaultRelation string `json:"defaultRelation,omitempty"`
   238  	// DefaultSource: If specified, will be used in any given template statement
   239  	// that doesn’t specify a source.
   240  	DefaultSource *Asset `json:"defaultSource,omitempty"`
   241  	// DefaultTarget: If specified, will be used in any given template statement
   242  	// that doesn’t specify a target.
   243  	DefaultTarget *Asset `json:"defaultTarget,omitempty"`
   244  	// SkipCacheLookup: Same configuration as in Check request, all statements
   245  	// checks will use same configurations.
   246  	SkipCacheLookup bool `json:"skipCacheLookup,omitempty"`
   247  	// Statements: List of statements to check. For each statement, you can omit a
   248  	// field if the corresponding default_* field below was supplied. Minimum 1
   249  	// statement; maximum 1,000 statements. Any additional statements will be
   250  	// ignored.
   251  	Statements []*StatementTemplate `json:"statements,omitempty"`
   252  	// ForceSendFields is a list of field names (e.g.
   253  	// "AllowGoogleInternalDataSources") to unconditionally include in API
   254  	// requests. By default, fields with empty or default values are omitted from
   255  	// API requests. See
   256  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   257  	// details.
   258  	ForceSendFields []string `json:"-"`
   259  	// NullFields is a list of field names (e.g. "AllowGoogleInternalDataSources")
   260  	// to include in API requests with the JSON null value. By default, fields with
   261  	// empty values are omitted from API requests. See
   262  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   263  	NullFields []string `json:"-"`
   264  }
   265  
   266  func (s *BulkCheckRequest) MarshalJSON() ([]byte, error) {
   267  	type NoMethod BulkCheckRequest
   268  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   269  }
   270  
   271  // BulkCheckResponse: Response for BulkCheck call. Results are sent in a list
   272  // in the same order in which they were sent. Individual check errors are
   273  // described in the appropriate check_results entry. If the entire call fails,
   274  // the response will include a bulk_error_code field describing the error.
   275  type BulkCheckResponse struct {
   276  	// BulkErrorCode: Error code for the entire request. Present only if the entire
   277  	// request failed. Individual check errors will not trigger the presence of
   278  	// this field.
   279  	//
   280  	// Possible values:
   281  	//   "ERROR_CODE_UNSPECIFIED"
   282  	//   "ERROR_CODE_INVALID_QUERY" - Unable to parse query.
   283  	//   "ERROR_CODE_FETCH_ERROR" - Unable to fetch the asset links data.
   284  	//   "ERROR_CODE_FAILED_SSL_VALIDATION" - Invalid HTTPS certificate .
   285  	//   "ERROR_CODE_REDIRECT" - HTTP redirects (e.g, 301) are not allowed.
   286  	//   "ERROR_CODE_TOO_LARGE" - Asset links data exceeds maximum size.
   287  	//   "ERROR_CODE_MALFORMED_HTTP_RESPONSE" - Can't parse HTTP response.
   288  	//   "ERROR_CODE_WRONG_CONTENT_TYPE" - HTTP Content-type should be
   289  	// application/json.
   290  	//   "ERROR_CODE_MALFORMED_CONTENT" - JSON content is malformed.
   291  	//   "ERROR_CODE_SECURE_ASSET_INCLUDES_INSECURE" - A secure asset includes an
   292  	// insecure asset (security downgrade).
   293  	//   "ERROR_CODE_FETCH_BUDGET_EXHAUSTED" - Too many includes (maybe a loop).
   294  	BulkErrorCode string `json:"bulkErrorCode,omitempty"`
   295  	// CheckResults: List of results for each check request. Results are returned
   296  	// in the same order in which they were sent in the request.
   297  	CheckResults []*CheckResponse `json:"checkResults,omitempty"`
   298  
   299  	// ServerResponse contains the HTTP response code and headers from the server.
   300  	googleapi.ServerResponse `json:"-"`
   301  	// ForceSendFields is a list of field names (e.g. "BulkErrorCode") to
   302  	// unconditionally include in API requests. By default, fields with empty or
   303  	// default values are omitted from API requests. See
   304  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   305  	// details.
   306  	ForceSendFields []string `json:"-"`
   307  	// NullFields is a list of field names (e.g. "BulkErrorCode") to include in API
   308  	// requests with the JSON null value. By default, fields with empty values are
   309  	// omitted from API requests. See
   310  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   311  	NullFields []string `json:"-"`
   312  }
   313  
   314  func (s *BulkCheckResponse) MarshalJSON() ([]byte, error) {
   315  	type NoMethod BulkCheckResponse
   316  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   317  }
   318  
   319  // CertificateInfo: Describes an X509 certificate.
   320  type CertificateInfo struct {
   321  	// Sha256Fingerprint: The uppercase SHA-265 fingerprint of the certificate.
   322  	// From the PEM certificate, it can be acquired like this: $ keytool -printcert
   323  	// -file $CERTFILE | grep SHA256: SHA256:
   324  	// 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \
   325  	// 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in
   326  	// $CERTFILE -noout -fingerprint -sha256 SHA256
   327  	// Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
   328  	// 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the
   329  	// contents of this field would be `14:6D:E9:83:C5:73:
   330  	// 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:
   331  	// 44:E5`. If these tools are not available to you, you can convert the PEM
   332  	// certificate into the DER format, compute the SHA-256 hash of that string and
   333  	// represent the result as a hexstring (that is, uppercase hexadecimal
   334  	// representations of each octet, separated by colons).
   335  	Sha256Fingerprint string `json:"sha256Fingerprint,omitempty"`
   336  	// ForceSendFields is a list of field names (e.g. "Sha256Fingerprint") to
   337  	// unconditionally include in API requests. By default, fields with empty or
   338  	// default values are omitted from API requests. See
   339  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   340  	// details.
   341  	ForceSendFields []string `json:"-"`
   342  	// NullFields is a list of field names (e.g. "Sha256Fingerprint") to include in
   343  	// API requests with the JSON null value. By default, fields with empty values
   344  	// are omitted from API requests. See
   345  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   346  	NullFields []string `json:"-"`
   347  }
   348  
   349  func (s *CertificateInfo) MarshalJSON() ([]byte, error) {
   350  	type NoMethod CertificateInfo
   351  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   352  }
   353  
   354  // CheckResponse: Response message for the CheckAssetLinks call.
   355  type CheckResponse struct {
   356  	// DebugString: Human-readable message containing information intended to help
   357  	// end users understand, reproduce and debug the result. The message will be in
   358  	// English and we are currently not planning to offer any translations. Please
   359  	// note that no guarantees are made about the contents or format of this
   360  	// string. Any aspect of it may be subject to change without notice. You should
   361  	// not attempt to programmatically parse this data. For programmatic access,
   362  	// use the error_code field below.
   363  	DebugString string `json:"debugString,omitempty"`
   364  	// ErrorCode: Error codes that describe the result of the Check operation.
   365  	//
   366  	// Possible values:
   367  	//   "ERROR_CODE_UNSPECIFIED"
   368  	//   "ERROR_CODE_INVALID_QUERY" - Unable to parse query.
   369  	//   "ERROR_CODE_FETCH_ERROR" - Unable to fetch the asset links data.
   370  	//   "ERROR_CODE_FAILED_SSL_VALIDATION" - Invalid HTTPS certificate .
   371  	//   "ERROR_CODE_REDIRECT" - HTTP redirects (e.g, 301) are not allowed.
   372  	//   "ERROR_CODE_TOO_LARGE" - Asset links data exceeds maximum size.
   373  	//   "ERROR_CODE_MALFORMED_HTTP_RESPONSE" - Can't parse HTTP response.
   374  	//   "ERROR_CODE_WRONG_CONTENT_TYPE" - HTTP Content-type should be
   375  	// application/json.
   376  	//   "ERROR_CODE_MALFORMED_CONTENT" - JSON content is malformed.
   377  	//   "ERROR_CODE_SECURE_ASSET_INCLUDES_INSECURE" - A secure asset includes an
   378  	// insecure asset (security downgrade).
   379  	//   "ERROR_CODE_FETCH_BUDGET_EXHAUSTED" - Too many includes (maybe a loop).
   380  	ErrorCode []string `json:"errorCode,omitempty"`
   381  	// Linked: Set to true if the assets specified in the request are linked by the
   382  	// relation specified in the request.
   383  	Linked bool `json:"linked,omitempty"`
   384  	// MaxAge: From serving time, how much longer the response should be considered
   385  	// valid barring further updates. REQUIRED
   386  	MaxAge string `json:"maxAge,omitempty"`
   387  
   388  	// ServerResponse contains the HTTP response code and headers from the server.
   389  	googleapi.ServerResponse `json:"-"`
   390  	// ForceSendFields is a list of field names (e.g. "DebugString") to
   391  	// unconditionally include in API requests. By default, fields with empty or
   392  	// default values are omitted from API requests. See
   393  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   394  	// details.
   395  	ForceSendFields []string `json:"-"`
   396  	// NullFields is a list of field names (e.g. "DebugString") to include in API
   397  	// requests with the JSON null value. By default, fields with empty values are
   398  	// omitted from API requests. See
   399  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   400  	NullFields []string `json:"-"`
   401  }
   402  
   403  func (s *CheckResponse) MarshalJSON() ([]byte, error) {
   404  	type NoMethod CheckResponse
   405  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   406  }
   407  
   408  // ListResponse: Response message for the List call.
   409  type ListResponse struct {
   410  	// DebugString: Human-readable message containing information intended to help
   411  	// end users understand, reproduce and debug the result. The message will be in
   412  	// English and we are currently not planning to offer any translations. Please
   413  	// note that no guarantees are made about the contents or format of this
   414  	// string. Any aspect of it may be subject to change without notice. You should
   415  	// not attempt to programmatically parse this data. For programmatic access,
   416  	// use the error_code field below.
   417  	DebugString string `json:"debugString,omitempty"`
   418  	// ErrorCode: Error codes that describe the result of the List operation.
   419  	//
   420  	// Possible values:
   421  	//   "ERROR_CODE_UNSPECIFIED"
   422  	//   "ERROR_CODE_INVALID_QUERY" - Unable to parse query.
   423  	//   "ERROR_CODE_FETCH_ERROR" - Unable to fetch the asset links data.
   424  	//   "ERROR_CODE_FAILED_SSL_VALIDATION" - Invalid HTTPS certificate .
   425  	//   "ERROR_CODE_REDIRECT" - HTTP redirects (e.g, 301) are not allowed.
   426  	//   "ERROR_CODE_TOO_LARGE" - Asset links data exceeds maximum size.
   427  	//   "ERROR_CODE_MALFORMED_HTTP_RESPONSE" - Can't parse HTTP response.
   428  	//   "ERROR_CODE_WRONG_CONTENT_TYPE" - HTTP Content-type should be
   429  	// application/json.
   430  	//   "ERROR_CODE_MALFORMED_CONTENT" - JSON content is malformed.
   431  	//   "ERROR_CODE_SECURE_ASSET_INCLUDES_INSECURE" - A secure asset includes an
   432  	// insecure asset (security downgrade).
   433  	//   "ERROR_CODE_FETCH_BUDGET_EXHAUSTED" - Too many includes (maybe a loop).
   434  	ErrorCode []string `json:"errorCode,omitempty"`
   435  	// MaxAge: From serving time, how much longer the response should be considered
   436  	// valid barring further updates. REQUIRED
   437  	MaxAge string `json:"maxAge,omitempty"`
   438  	// Statements: A list of all the matching statements that have been found.
   439  	Statements []*Statement `json:"statements,omitempty"`
   440  
   441  	// ServerResponse contains the HTTP response code and headers from the server.
   442  	googleapi.ServerResponse `json:"-"`
   443  	// ForceSendFields is a list of field names (e.g. "DebugString") to
   444  	// unconditionally include in API requests. By default, fields with empty or
   445  	// default values are omitted from API requests. See
   446  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   447  	// details.
   448  	ForceSendFields []string `json:"-"`
   449  	// NullFields is a list of field names (e.g. "DebugString") to include in API
   450  	// requests with the JSON null value. By default, fields with empty values are
   451  	// omitted from API requests. See
   452  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   453  	NullFields []string `json:"-"`
   454  }
   455  
   456  func (s *ListResponse) MarshalJSON() ([]byte, error) {
   457  	type NoMethod ListResponse
   458  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   459  }
   460  
   461  // Statement: Describes a reliable statement that has been made about the
   462  // relationship between a source asset and a target asset. Statements are
   463  // always made by the source asset, either directly or by delegating to a
   464  // statement list that is stored elsewhere. For more detailed definitions of
   465  // statements and assets, please refer to our API documentation landing page
   466  // (/digital-asset-links/v1/getting-started).
   467  type Statement struct {
   468  	// Relation: The relation identifies the use of the statement as intended by
   469  	// the source asset's owner (that is, the person or entity who issued the
   470  	// statement). Every complete statement has a relation. We identify relations
   471  	// with strings of the format `/`, where `` must be one of a set of pre-defined
   472  	// purpose categories, and `` is a free-form lowercase alphanumeric string that
   473  	// describes the specific use case of the statement. Refer to our API
   474  	// documentation (/digital-asset-links/v1/relation-strings) for the current
   475  	// list of supported relations. Example:
   476  	// `delegate_permission/common.handle_all_urls` REQUIRED
   477  	Relation string `json:"relation,omitempty"`
   478  	// Source: Every statement has a source asset. REQUIRED
   479  	Source *Asset `json:"source,omitempty"`
   480  	// Target: Every statement has a target asset. REQUIRED
   481  	Target *Asset `json:"target,omitempty"`
   482  	// ForceSendFields is a list of field names (e.g. "Relation") to
   483  	// unconditionally include in API requests. By default, fields with empty or
   484  	// default values are omitted from API requests. See
   485  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   486  	// details.
   487  	ForceSendFields []string `json:"-"`
   488  	// NullFields is a list of field names (e.g. "Relation") to include in API
   489  	// requests with the JSON null value. By default, fields with empty values are
   490  	// omitted from API requests. See
   491  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   492  	NullFields []string `json:"-"`
   493  }
   494  
   495  func (s *Statement) MarshalJSON() ([]byte, error) {
   496  	type NoMethod Statement
   497  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   498  }
   499  
   500  // StatementTemplate: A single statement to check in a bulk call using
   501  // BulkCheck. See CheckRequest for details about each field.
   502  type StatementTemplate struct {
   503  	// Relation: The relationship being asserted between the source and target. If
   504  	// omitted, you must specify a BulkCheckRequest.default_relation value to use
   505  	// here.
   506  	Relation string `json:"relation,omitempty"`
   507  	// Source: The source asset that is asserting the statement. If omitted, you
   508  	// must specify a BulkCheckRequest.default_source value to use here.
   509  	Source *Asset `json:"source,omitempty"`
   510  	// Target: The target that the source is declaring the relationship with. If
   511  	// omitted, you must specify a BulkCheckRequest.default_target to use here.
   512  	Target *Asset `json:"target,omitempty"`
   513  	// ForceSendFields is a list of field names (e.g. "Relation") to
   514  	// unconditionally include in API requests. By default, fields with empty or
   515  	// default values are omitted from API requests. See
   516  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   517  	// details.
   518  	ForceSendFields []string `json:"-"`
   519  	// NullFields is a list of field names (e.g. "Relation") to include in API
   520  	// requests with the JSON null value. By default, fields with empty values are
   521  	// omitted from API requests. See
   522  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   523  	NullFields []string `json:"-"`
   524  }
   525  
   526  func (s *StatementTemplate) MarshalJSON() ([]byte, error) {
   527  	type NoMethod StatementTemplate
   528  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   529  }
   530  
   531  // WebAsset: Describes a web asset.
   532  type WebAsset struct {
   533  	// Site: Web assets are identified by a URL that contains only the scheme,
   534  	// hostname and port parts. The format is http[s]://[:] Hostnames must be fully
   535  	// qualified: they must end in a single period ("."). Only the schemes "http"
   536  	// and "https" are currently allowed. Port numbers are given as a decimal
   537  	// number, and they must be omitted if the standard port numbers are used: 80
   538  	// for http and 443 for https. We call this limited URL the "site". All URLs
   539  	// that share the same scheme, hostname and port are considered to be a part of
   540  	// the site and thus belong to the web asset. Example: the asset with the site
   541  	// `https://www.google.com` contains all these URLs: *
   542  	// `https://www.google.com/` * `https://www.google.com:443/` *
   543  	// `https://www.google.com/foo` * `https://www.google.com/foo?bar` *
   544  	// `https://www.google.com/foo#bar` * `https://user@password:www.google.com/`
   545  	// But it does not contain these URLs: * `http://www.google.com/` (wrong
   546  	// scheme) * `https://google.com/` (hostname does not match) *
   547  	// `https://www.google.com:444/` (port does not match) REQUIRED
   548  	Site string `json:"site,omitempty"`
   549  	// ForceSendFields is a list of field names (e.g. "Site") to unconditionally
   550  	// include in API requests. By default, fields with empty or default values are
   551  	// omitted from API requests. See
   552  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   553  	// details.
   554  	ForceSendFields []string `json:"-"`
   555  	// NullFields is a list of field names (e.g. "Site") to include in API requests
   556  	// with the JSON null value. By default, fields with empty values are omitted
   557  	// from API requests. See
   558  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   559  	NullFields []string `json:"-"`
   560  }
   561  
   562  func (s *WebAsset) MarshalJSON() ([]byte, error) {
   563  	type NoMethod WebAsset
   564  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   565  }
   566  
   567  type AssetlinksBulkCheckCall struct {
   568  	s                *Service
   569  	bulkcheckrequest *BulkCheckRequest
   570  	urlParams_       gensupport.URLParams
   571  	ctx_             context.Context
   572  	header_          http.Header
   573  }
   574  
   575  // BulkCheck: Send a bundle of statement checks in a single RPC to minimize
   576  // latency and service load. Statements need not be all for the same source
   577  // and/or target. We recommend using this method when you need to check more
   578  // than one statement in a short period of time.
   579  func (r *AssetlinksService) BulkCheck(bulkcheckrequest *BulkCheckRequest) *AssetlinksBulkCheckCall {
   580  	c := &AssetlinksBulkCheckCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   581  	c.bulkcheckrequest = bulkcheckrequest
   582  	return c
   583  }
   584  
   585  // Fields allows partial responses to be retrieved. See
   586  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   587  // details.
   588  func (c *AssetlinksBulkCheckCall) Fields(s ...googleapi.Field) *AssetlinksBulkCheckCall {
   589  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   590  	return c
   591  }
   592  
   593  // Context sets the context to be used in this call's Do method.
   594  func (c *AssetlinksBulkCheckCall) Context(ctx context.Context) *AssetlinksBulkCheckCall {
   595  	c.ctx_ = ctx
   596  	return c
   597  }
   598  
   599  // Header returns a http.Header that can be modified by the caller to add
   600  // headers to the request.
   601  func (c *AssetlinksBulkCheckCall) Header() http.Header {
   602  	if c.header_ == nil {
   603  		c.header_ = make(http.Header)
   604  	}
   605  	return c.header_
   606  }
   607  
   608  func (c *AssetlinksBulkCheckCall) doRequest(alt string) (*http.Response, error) {
   609  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   610  	var body io.Reader = nil
   611  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.bulkcheckrequest)
   612  	if err != nil {
   613  		return nil, err
   614  	}
   615  	c.urlParams_.Set("alt", alt)
   616  	c.urlParams_.Set("prettyPrint", "false")
   617  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/assetlinks:bulkCheck")
   618  	urls += "?" + c.urlParams_.Encode()
   619  	req, err := http.NewRequest("POST", urls, body)
   620  	if err != nil {
   621  		return nil, err
   622  	}
   623  	req.Header = reqHeaders
   624  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   625  }
   626  
   627  // Do executes the "digitalassetlinks.assetlinks.bulkCheck" call.
   628  // Any non-2xx status code is an error. Response headers are in either
   629  // *BulkCheckResponse.ServerResponse.Header or (if a response was returned at
   630  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   631  // check whether the returned error was because http.StatusNotModified was
   632  // returned.
   633  func (c *AssetlinksBulkCheckCall) Do(opts ...googleapi.CallOption) (*BulkCheckResponse, error) {
   634  	gensupport.SetOptions(c.urlParams_, opts...)
   635  	res, err := c.doRequest("json")
   636  	if res != nil && res.StatusCode == http.StatusNotModified {
   637  		if res.Body != nil {
   638  			res.Body.Close()
   639  		}
   640  		return nil, gensupport.WrapError(&googleapi.Error{
   641  			Code:   res.StatusCode,
   642  			Header: res.Header,
   643  		})
   644  	}
   645  	if err != nil {
   646  		return nil, err
   647  	}
   648  	defer googleapi.CloseBody(res)
   649  	if err := googleapi.CheckResponse(res); err != nil {
   650  		return nil, gensupport.WrapError(err)
   651  	}
   652  	ret := &BulkCheckResponse{
   653  		ServerResponse: googleapi.ServerResponse{
   654  			Header:         res.Header,
   655  			HTTPStatusCode: res.StatusCode,
   656  		},
   657  	}
   658  	target := &ret
   659  	if err := gensupport.DecodeResponse(target, res); err != nil {
   660  		return nil, err
   661  	}
   662  	return ret, nil
   663  }
   664  
   665  type AssetlinksCheckCall struct {
   666  	s            *Service
   667  	urlParams_   gensupport.URLParams
   668  	ifNoneMatch_ string
   669  	ctx_         context.Context
   670  	header_      http.Header
   671  }
   672  
   673  // Check: Determines whether the specified (directional) relationship exists
   674  // between the specified source and target assets. The relation describes the
   675  // intent of the link between the two assets as claimed by the source asset. An
   676  // example for such relationships is the delegation of privileges or
   677  // permissions. This command is most often used by infrastructure systems to
   678  // check preconditions for an action. For example, a client may want to know if
   679  // it is OK to send a web URL to a particular mobile app instead. The client
   680  // can check for the relevant asset link from the website to the mobile app to
   681  // decide if the operation should be allowed. A note about security: if you
   682  // specify a secure asset as the source, such as an HTTPS website or an Android
   683  // app, the API will ensure that any statements used to generate the response
   684  // have been made in a secure way by the owner of that asset. Conversely, if
   685  // the source asset is an insecure HTTP website (that is, the URL starts with
   686  // `http://` instead of `https://`), the API cannot verify its statements
   687  // securely, and it is not possible to ensure that the website's statements
   688  // have not been altered by a third party. For more information, see the
   689  // Digital Asset Links technical design specification
   690  // (https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).
   691  func (r *AssetlinksService) Check() *AssetlinksCheckCall {
   692  	c := &AssetlinksCheckCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   693  	return c
   694  }
   695  
   696  // Relation sets the optional parameter "relation": Query string for the
   697  // relation. We identify relations with strings of the format `/`, where “
   698  // must be one of a set of pre-defined purpose categories, and “ is a
   699  // free-form lowercase alphanumeric string that describes the specific use case
   700  // of the statement. Refer to our API documentation
   701  // (/digital-asset-links/v1/relation-strings) for the current list of supported
   702  // relations. For a query to match an asset link, both the query's and the
   703  // asset link's relation strings must match exactly. Example: A query with
   704  // relation `delegate_permission/common.handle_all_urls` matches an asset link
   705  // with relation `delegate_permission/common.handle_all_urls`.
   706  func (c *AssetlinksCheckCall) Relation(relation string) *AssetlinksCheckCall {
   707  	c.urlParams_.Set("relation", relation)
   708  	return c
   709  }
   710  
   711  // SourceAndroidAppCertificateSha256Fingerprint sets the optional parameter
   712  // "source.androidApp.certificate.sha256Fingerprint": The uppercase SHA-265
   713  // fingerprint of the certificate. From the PEM certificate, it can be acquired
   714  // like this: $ keytool -printcert -file $CERTFILE | grep SHA256: SHA256:
   715  // 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \
   716  // 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in
   717  // $CERTFILE -noout -fingerprint -sha256 SHA256
   718  // Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
   719  // 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the
   720  // contents of this field would be `14:6D:E9:83:C5:73:
   721  // 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:
   722  // 44:E5`. If these tools are not available to you, you can convert the PEM
   723  // certificate into the DER format, compute the SHA-256 hash of that string and
   724  // represent the result as a hexstring (that is, uppercase hexadecimal
   725  // representations of each octet, separated by colons).
   726  func (c *AssetlinksCheckCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall {
   727  	c.urlParams_.Set("source.androidApp.certificate.sha256Fingerprint", sourceAndroidAppCertificateSha256Fingerprint)
   728  	return c
   729  }
   730  
   731  // SourceAndroidAppPackageName sets the optional parameter
   732  // "source.androidApp.packageName": Android App assets are naturally identified
   733  // by their Java package name. For example, the Google Maps app uses the
   734  // package name `com.google.android.apps.maps`. REQUIRED
   735  func (c *AssetlinksCheckCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *AssetlinksCheckCall {
   736  	c.urlParams_.Set("source.androidApp.packageName", sourceAndroidAppPackageName)
   737  	return c
   738  }
   739  
   740  // SourceWebSite sets the optional parameter "source.web.site": Web assets are
   741  // identified by a URL that contains only the scheme, hostname and port parts.
   742  // The format is http[s]://[:] Hostnames must be fully qualified: they must end
   743  // in a single period ("."). Only the schemes "http" and "https" are
   744  // currently allowed. Port numbers are given as a decimal number, and they must
   745  // be omitted if the standard port numbers are used: 80 for http and 443 for
   746  // https. We call this limited URL the "site". All URLs that share the same
   747  // scheme, hostname and port are considered to be a part of the site and thus
   748  // belong to the web asset. Example: the asset with the site
   749  // `https://www.google.com` contains all these URLs: *
   750  // `https://www.google.com/` * `https://www.google.com:443/` *
   751  // `https://www.google.com/foo` * `https://www.google.com/foo?bar` *
   752  // `https://www.google.com/foo#bar` * `https://user@password:www.google.com/`
   753  // But it does not contain these URLs: * `http://www.google.com/` (wrong
   754  // scheme) * `https://google.com/` (hostname does not match) *
   755  // `https://www.google.com:444/` (port does not match) REQUIRED
   756  func (c *AssetlinksCheckCall) SourceWebSite(sourceWebSite string) *AssetlinksCheckCall {
   757  	c.urlParams_.Set("source.web.site", sourceWebSite)
   758  	return c
   759  }
   760  
   761  // TargetAndroidAppCertificateSha256Fingerprint sets the optional parameter
   762  // "target.androidApp.certificate.sha256Fingerprint": The uppercase SHA-265
   763  // fingerprint of the certificate. From the PEM certificate, it can be acquired
   764  // like this: $ keytool -printcert -file $CERTFILE | grep SHA256: SHA256:
   765  // 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \
   766  // 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in
   767  // $CERTFILE -noout -fingerprint -sha256 SHA256
   768  // Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
   769  // 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the
   770  // contents of this field would be `14:6D:E9:83:C5:73:
   771  // 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:
   772  // 44:E5`. If these tools are not available to you, you can convert the PEM
   773  // certificate into the DER format, compute the SHA-256 hash of that string and
   774  // represent the result as a hexstring (that is, uppercase hexadecimal
   775  // representations of each octet, separated by colons).
   776  func (c *AssetlinksCheckCall) TargetAndroidAppCertificateSha256Fingerprint(targetAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall {
   777  	c.urlParams_.Set("target.androidApp.certificate.sha256Fingerprint", targetAndroidAppCertificateSha256Fingerprint)
   778  	return c
   779  }
   780  
   781  // TargetAndroidAppPackageName sets the optional parameter
   782  // "target.androidApp.packageName": Android App assets are naturally identified
   783  // by their Java package name. For example, the Google Maps app uses the
   784  // package name `com.google.android.apps.maps`. REQUIRED
   785  func (c *AssetlinksCheckCall) TargetAndroidAppPackageName(targetAndroidAppPackageName string) *AssetlinksCheckCall {
   786  	c.urlParams_.Set("target.androidApp.packageName", targetAndroidAppPackageName)
   787  	return c
   788  }
   789  
   790  // TargetWebSite sets the optional parameter "target.web.site": Web assets are
   791  // identified by a URL that contains only the scheme, hostname and port parts.
   792  // The format is http[s]://[:] Hostnames must be fully qualified: they must end
   793  // in a single period ("."). Only the schemes "http" and "https" are
   794  // currently allowed. Port numbers are given as a decimal number, and they must
   795  // be omitted if the standard port numbers are used: 80 for http and 443 for
   796  // https. We call this limited URL the "site". All URLs that share the same
   797  // scheme, hostname and port are considered to be a part of the site and thus
   798  // belong to the web asset. Example: the asset with the site
   799  // `https://www.google.com` contains all these URLs: *
   800  // `https://www.google.com/` * `https://www.google.com:443/` *
   801  // `https://www.google.com/foo` * `https://www.google.com/foo?bar` *
   802  // `https://www.google.com/foo#bar` * `https://user@password:www.google.com/`
   803  // But it does not contain these URLs: * `http://www.google.com/` (wrong
   804  // scheme) * `https://google.com/` (hostname does not match) *
   805  // `https://www.google.com:444/` (port does not match) REQUIRED
   806  func (c *AssetlinksCheckCall) TargetWebSite(targetWebSite string) *AssetlinksCheckCall {
   807  	c.urlParams_.Set("target.web.site", targetWebSite)
   808  	return c
   809  }
   810  
   811  // Fields allows partial responses to be retrieved. See
   812  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   813  // details.
   814  func (c *AssetlinksCheckCall) Fields(s ...googleapi.Field) *AssetlinksCheckCall {
   815  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   816  	return c
   817  }
   818  
   819  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   820  // object's ETag matches the given value. This is useful for getting updates
   821  // only after the object has changed since the last request.
   822  func (c *AssetlinksCheckCall) IfNoneMatch(entityTag string) *AssetlinksCheckCall {
   823  	c.ifNoneMatch_ = entityTag
   824  	return c
   825  }
   826  
   827  // Context sets the context to be used in this call's Do method.
   828  func (c *AssetlinksCheckCall) Context(ctx context.Context) *AssetlinksCheckCall {
   829  	c.ctx_ = ctx
   830  	return c
   831  }
   832  
   833  // Header returns a http.Header that can be modified by the caller to add
   834  // headers to the request.
   835  func (c *AssetlinksCheckCall) Header() http.Header {
   836  	if c.header_ == nil {
   837  		c.header_ = make(http.Header)
   838  	}
   839  	return c.header_
   840  }
   841  
   842  func (c *AssetlinksCheckCall) doRequest(alt string) (*http.Response, error) {
   843  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   844  	if c.ifNoneMatch_ != "" {
   845  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   846  	}
   847  	var body io.Reader = nil
   848  	c.urlParams_.Set("alt", alt)
   849  	c.urlParams_.Set("prettyPrint", "false")
   850  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/assetlinks:check")
   851  	urls += "?" + c.urlParams_.Encode()
   852  	req, err := http.NewRequest("GET", urls, body)
   853  	if err != nil {
   854  		return nil, err
   855  	}
   856  	req.Header = reqHeaders
   857  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   858  }
   859  
   860  // Do executes the "digitalassetlinks.assetlinks.check" call.
   861  // Any non-2xx status code is an error. Response headers are in either
   862  // *CheckResponse.ServerResponse.Header or (if a response was returned at all)
   863  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   864  // whether the returned error was because http.StatusNotModified was returned.
   865  func (c *AssetlinksCheckCall) Do(opts ...googleapi.CallOption) (*CheckResponse, error) {
   866  	gensupport.SetOptions(c.urlParams_, opts...)
   867  	res, err := c.doRequest("json")
   868  	if res != nil && res.StatusCode == http.StatusNotModified {
   869  		if res.Body != nil {
   870  			res.Body.Close()
   871  		}
   872  		return nil, gensupport.WrapError(&googleapi.Error{
   873  			Code:   res.StatusCode,
   874  			Header: res.Header,
   875  		})
   876  	}
   877  	if err != nil {
   878  		return nil, err
   879  	}
   880  	defer googleapi.CloseBody(res)
   881  	if err := googleapi.CheckResponse(res); err != nil {
   882  		return nil, gensupport.WrapError(err)
   883  	}
   884  	ret := &CheckResponse{
   885  		ServerResponse: googleapi.ServerResponse{
   886  			Header:         res.Header,
   887  			HTTPStatusCode: res.StatusCode,
   888  		},
   889  	}
   890  	target := &ret
   891  	if err := gensupport.DecodeResponse(target, res); err != nil {
   892  		return nil, err
   893  	}
   894  	return ret, nil
   895  }
   896  
   897  type StatementsListCall struct {
   898  	s            *Service
   899  	urlParams_   gensupport.URLParams
   900  	ifNoneMatch_ string
   901  	ctx_         context.Context
   902  	header_      http.Header
   903  }
   904  
   905  // List: Retrieves a list of all statements from a given source that match the
   906  // specified target and statement string. The API guarantees that all
   907  // statements with secure source assets, such as HTTPS websites or Android
   908  // apps, have been made in a secure way by the owner of those assets, as
   909  // described in the Digital Asset Links technical design specification
   910  // (https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).
   911  // Specifically, you should consider that for insecure websites (that is, where
   912  // the URL starts with `http://` instead of `https://`), this guarantee cannot
   913  // be made. The `List` command is most useful in cases where the API client
   914  // wants to know all the ways in which two assets are related, or enumerate all
   915  // the relationships from a particular source asset. Example: a feature that
   916  // helps users navigate to related items. When a mobile app is running on a
   917  // device, the feature would make it easy to navigate to the corresponding web
   918  // site or Google+ profile.
   919  func (r *StatementsService) List() *StatementsListCall {
   920  	c := &StatementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   921  	return c
   922  }
   923  
   924  // Relation sets the optional parameter "relation": Use only associations that
   925  // match the specified relation. See the `Statement` (#Statement) message for a
   926  // detailed definition of relation strings. For a query to match a statement,
   927  // one of the following must be true: * both the query's and the statement's
   928  // relation strings match exactly, or * the query's relation string is empty or
   929  // missing. Example: A query with relation
   930  // `delegate_permission/common.handle_all_urls` matches an asset link with
   931  // relation `delegate_permission/common.handle_all_urls`.
   932  func (c *StatementsListCall) Relation(relation string) *StatementsListCall {
   933  	c.urlParams_.Set("relation", relation)
   934  	return c
   935  }
   936  
   937  // SourceAndroidAppCertificateSha256Fingerprint sets the optional parameter
   938  // "source.androidApp.certificate.sha256Fingerprint": The uppercase SHA-265
   939  // fingerprint of the certificate. From the PEM certificate, it can be acquired
   940  // like this: $ keytool -printcert -file $CERTFILE | grep SHA256: SHA256:
   941  // 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \
   942  // 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in
   943  // $CERTFILE -noout -fingerprint -sha256 SHA256
   944  // Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
   945  // 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the
   946  // contents of this field would be `14:6D:E9:83:C5:73:
   947  // 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:
   948  // 44:E5`. If these tools are not available to you, you can convert the PEM
   949  // certificate into the DER format, compute the SHA-256 hash of that string and
   950  // represent the result as a hexstring (that is, uppercase hexadecimal
   951  // representations of each octet, separated by colons).
   952  func (c *StatementsListCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *StatementsListCall {
   953  	c.urlParams_.Set("source.androidApp.certificate.sha256Fingerprint", sourceAndroidAppCertificateSha256Fingerprint)
   954  	return c
   955  }
   956  
   957  // SourceAndroidAppPackageName sets the optional parameter
   958  // "source.androidApp.packageName": Android App assets are naturally identified
   959  // by their Java package name. For example, the Google Maps app uses the
   960  // package name `com.google.android.apps.maps`. REQUIRED
   961  func (c *StatementsListCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *StatementsListCall {
   962  	c.urlParams_.Set("source.androidApp.packageName", sourceAndroidAppPackageName)
   963  	return c
   964  }
   965  
   966  // SourceWebSite sets the optional parameter "source.web.site": Web assets are
   967  // identified by a URL that contains only the scheme, hostname and port parts.
   968  // The format is http[s]://[:] Hostnames must be fully qualified: they must end
   969  // in a single period ("."). Only the schemes "http" and "https" are
   970  // currently allowed. Port numbers are given as a decimal number, and they must
   971  // be omitted if the standard port numbers are used: 80 for http and 443 for
   972  // https. We call this limited URL the "site". All URLs that share the same
   973  // scheme, hostname and port are considered to be a part of the site and thus
   974  // belong to the web asset. Example: the asset with the site
   975  // `https://www.google.com` contains all these URLs: *
   976  // `https://www.google.com/` * `https://www.google.com:443/` *
   977  // `https://www.google.com/foo` * `https://www.google.com/foo?bar` *
   978  // `https://www.google.com/foo#bar` * `https://user@password:www.google.com/`
   979  // But it does not contain these URLs: * `http://www.google.com/` (wrong
   980  // scheme) * `https://google.com/` (hostname does not match) *
   981  // `https://www.google.com:444/` (port does not match) REQUIRED
   982  func (c *StatementsListCall) SourceWebSite(sourceWebSite string) *StatementsListCall {
   983  	c.urlParams_.Set("source.web.site", sourceWebSite)
   984  	return c
   985  }
   986  
   987  // Fields allows partial responses to be retrieved. See
   988  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   989  // details.
   990  func (c *StatementsListCall) Fields(s ...googleapi.Field) *StatementsListCall {
   991  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   992  	return c
   993  }
   994  
   995  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   996  // object's ETag matches the given value. This is useful for getting updates
   997  // only after the object has changed since the last request.
   998  func (c *StatementsListCall) IfNoneMatch(entityTag string) *StatementsListCall {
   999  	c.ifNoneMatch_ = entityTag
  1000  	return c
  1001  }
  1002  
  1003  // Context sets the context to be used in this call's Do method.
  1004  func (c *StatementsListCall) Context(ctx context.Context) *StatementsListCall {
  1005  	c.ctx_ = ctx
  1006  	return c
  1007  }
  1008  
  1009  // Header returns a http.Header that can be modified by the caller to add
  1010  // headers to the request.
  1011  func (c *StatementsListCall) Header() http.Header {
  1012  	if c.header_ == nil {
  1013  		c.header_ = make(http.Header)
  1014  	}
  1015  	return c.header_
  1016  }
  1017  
  1018  func (c *StatementsListCall) doRequest(alt string) (*http.Response, error) {
  1019  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1020  	if c.ifNoneMatch_ != "" {
  1021  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1022  	}
  1023  	var body io.Reader = nil
  1024  	c.urlParams_.Set("alt", alt)
  1025  	c.urlParams_.Set("prettyPrint", "false")
  1026  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/statements:list")
  1027  	urls += "?" + c.urlParams_.Encode()
  1028  	req, err := http.NewRequest("GET", urls, body)
  1029  	if err != nil {
  1030  		return nil, err
  1031  	}
  1032  	req.Header = reqHeaders
  1033  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1034  }
  1035  
  1036  // Do executes the "digitalassetlinks.statements.list" call.
  1037  // Any non-2xx status code is an error. Response headers are in either
  1038  // *ListResponse.ServerResponse.Header or (if a response was returned at all)
  1039  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1040  // whether the returned error was because http.StatusNotModified was returned.
  1041  func (c *StatementsListCall) Do(opts ...googleapi.CallOption) (*ListResponse, error) {
  1042  	gensupport.SetOptions(c.urlParams_, opts...)
  1043  	res, err := c.doRequest("json")
  1044  	if res != nil && res.StatusCode == http.StatusNotModified {
  1045  		if res.Body != nil {
  1046  			res.Body.Close()
  1047  		}
  1048  		return nil, gensupport.WrapError(&googleapi.Error{
  1049  			Code:   res.StatusCode,
  1050  			Header: res.Header,
  1051  		})
  1052  	}
  1053  	if err != nil {
  1054  		return nil, err
  1055  	}
  1056  	defer googleapi.CloseBody(res)
  1057  	if err := googleapi.CheckResponse(res); err != nil {
  1058  		return nil, gensupport.WrapError(err)
  1059  	}
  1060  	ret := &ListResponse{
  1061  		ServerResponse: googleapi.ServerResponse{
  1062  			Header:         res.Header,
  1063  			HTTPStatusCode: res.StatusCode,
  1064  		},
  1065  	}
  1066  	target := &ret
  1067  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1068  		return nil, err
  1069  	}
  1070  	return ret, nil
  1071  }
  1072  

View as plain text