digitalassetlinks

package
v0.177.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package digitalassetlinks provides access to the Digital Asset Links API.

For product documentation, see: https://developers.google.com/digital-asset-links/

Library status

These client libraries are officially supported by Google. However, this library is considered complete and is in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.

When possible, we recommend using our newer [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) that are still actively being worked and iterated on.

Creating a client

Usage example:

import "google.golang.org/api/digitalassetlinks/v1"
...
ctx := context.Background()
digitalassetlinksService, err := digitalassetlinks.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication. For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use google.golang.org/api/option.WithAPIKey:

digitalassetlinksService, err := digitalassetlinks.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow, use google.golang.org/api/option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
digitalassetlinksService, err := digitalassetlinks.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See google.golang.org/api/option.ClientOption for details on options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AndroidAppAsset

type AndroidAppAsset struct {
	// Certificate: Because there is no global enforcement of package name
	// uniqueness, we also require a signing certificate, which in combination with
	// the package name uniquely identifies an app. Some apps' signing keys are
	// rotated, so they may be signed by different keys over time. We treat these
	// as distinct assets, since we use (package name, cert) as the unique ID. This
	// should not normally pose any problems as both versions of the app will make
	// the same or similar statements. Other assets making statements about the app
	// will have to be updated when a key is rotated, however. (Note that the
	// syntaxes for publishing and querying for statements contain syntactic sugar
	// to easily let you specify apps that are known by multiple certificates.)
	// REQUIRED
	Certificate *CertificateInfo `json:"certificate,omitempty"`
	// PackageName: Android App assets are naturally identified by their Java
	// package name. For example, the Google Maps app uses the package name
	// `com.google.android.apps.maps`. REQUIRED
	PackageName string `json:"packageName,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Certificate") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Certificate") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

AndroidAppAsset: Describes an android app asset.

func (*AndroidAppAsset) MarshalJSON

func (s *AndroidAppAsset) MarshalJSON() ([]byte, error)

type Asset

type Asset struct {
	// AndroidApp: Set if this is an Android App asset.
	AndroidApp *AndroidAppAsset `json:"androidApp,omitempty"`
	// Web: Set if this is a web asset.
	Web *WebAsset `json:"web,omitempty"`
	// ForceSendFields is a list of field names (e.g. "AndroidApp") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "AndroidApp") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

Asset: Uniquely identifies an asset. A digital asset is an identifiable and addressable online entity that typically provides some service or content. Examples of assets are websites, Android apps, Twitter feeds, and Plus Pages.

func (*Asset) MarshalJSON

func (s *Asset) MarshalJSON() ([]byte, error)

type AssetlinksBulkCheckCall added in v0.67.0

type AssetlinksBulkCheckCall struct {
	// contains filtered or unexported fields
}

func (*AssetlinksBulkCheckCall) Context added in v0.67.0

Context sets the context to be used in this call's Do method.

func (*AssetlinksBulkCheckCall) Do added in v0.67.0

Do executes the "digitalassetlinks.assetlinks.bulkCheck" call. Any non-2xx status code is an error. Response headers are in either *BulkCheckResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*AssetlinksBulkCheckCall) Fields added in v0.67.0

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*AssetlinksBulkCheckCall) Header added in v0.67.0

func (c *AssetlinksBulkCheckCall) Header() http.Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

type AssetlinksCheckCall

type AssetlinksCheckCall struct {
	// contains filtered or unexported fields
}

func (*AssetlinksCheckCall) Context

Context sets the context to be used in this call's Do method.

func (*AssetlinksCheckCall) Do

Do executes the "digitalassetlinks.assetlinks.check" call. Any non-2xx status code is an error. Response headers are in either *CheckResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*AssetlinksCheckCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*AssetlinksCheckCall) Header

func (c *AssetlinksCheckCall) Header() http.Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*AssetlinksCheckCall) IfNoneMatch

func (c *AssetlinksCheckCall) IfNoneMatch(entityTag string) *AssetlinksCheckCall

IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.

func (*AssetlinksCheckCall) Relation

func (c *AssetlinksCheckCall) Relation(relation string) *AssetlinksCheckCall

Relation sets the optional parameter "relation": Query string for the relation. We identify relations with strings of the format `/`, where “ must be one of a set of pre-defined purpose categories, and “ is a free-form lowercase alphanumeric string that describes the specific use case of the statement. Refer to our API documentation (/digital-asset-links/v1/relation-strings) for the current list of supported relations. For a query to match an asset link, both the query's and the asset link's relation strings must match exactly. Example: A query with relation `delegate_permission/common.handle_all_urls` matches an asset link with relation `delegate_permission/common.handle_all_urls`.

func (*AssetlinksCheckCall) SourceAndroidAppCertificateSha256Fingerprint

func (c *AssetlinksCheckCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall

SourceAndroidAppCertificateSha256Fingerprint sets the optional parameter "source.androidApp.certificate.sha256Fingerprint": The uppercase SHA-265 fingerprint of the certificate. From the PEM certificate, it can be acquired like this: $ keytool -printcert -file $CERTFILE | grep SHA256: SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \ 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256 SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \ 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the contents of this field would be `14:6D:E9:83:C5:73: 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF: 44:E5`. If these tools are not available to you, you can convert the PEM certificate into the DER format, compute the SHA-256 hash of that string and represent the result as a hexstring (that is, uppercase hexadecimal representations of each octet, separated by colons).

func (*AssetlinksCheckCall) SourceAndroidAppPackageName

func (c *AssetlinksCheckCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *AssetlinksCheckCall

SourceAndroidAppPackageName sets the optional parameter "source.androidApp.packageName": Android App assets are naturally identified by their Java package name. For example, the Google Maps app uses the package name `com.google.android.apps.maps`. REQUIRED

func (*AssetlinksCheckCall) SourceWebSite

func (c *AssetlinksCheckCall) SourceWebSite(sourceWebSite string) *AssetlinksCheckCall

SourceWebSite sets the optional parameter "source.web.site": Web assets are identified by a URL that contains only the scheme, hostname and port parts. The format is http[s]://[:] Hostnames must be fully qualified: they must end in a single period ("."). Only the schemes "http" and "https" are currently allowed. Port numbers are given as a decimal number, and they must be omitted if the standard port numbers are used: 80 for http and 443 for https. We call this limited URL the "site". All URLs that share the same scheme, hostname and port are considered to be a part of the site and thus belong to the web asset. Example: the asset with the site `https://www.google.com` contains all these URLs: * `https://www.google.com/` * `https://www.google.com:443/` * `https://www.google.com/foo` * `https://www.google.com/foo?bar` * `https://www.google.com/foo#bar` * `https://user@password:www.google.com/` But it does not contain these URLs: * `http://www.google.com/` (wrong scheme) * `https://google.com/` (hostname does not match) * `https://www.google.com:444/` (port does not match) REQUIRED

func (*AssetlinksCheckCall) TargetAndroidAppCertificateSha256Fingerprint

func (c *AssetlinksCheckCall) TargetAndroidAppCertificateSha256Fingerprint(targetAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall

TargetAndroidAppCertificateSha256Fingerprint sets the optional parameter "target.androidApp.certificate.sha256Fingerprint": The uppercase SHA-265 fingerprint of the certificate. From the PEM certificate, it can be acquired like this: $ keytool -printcert -file $CERTFILE | grep SHA256: SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \ 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256 SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \ 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the contents of this field would be `14:6D:E9:83:C5:73: 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF: 44:E5`. If these tools are not available to you, you can convert the PEM certificate into the DER format, compute the SHA-256 hash of that string and represent the result as a hexstring (that is, uppercase hexadecimal representations of each octet, separated by colons).

func (*AssetlinksCheckCall) TargetAndroidAppPackageName

func (c *AssetlinksCheckCall) TargetAndroidAppPackageName(targetAndroidAppPackageName string) *AssetlinksCheckCall

TargetAndroidAppPackageName sets the optional parameter "target.androidApp.packageName": Android App assets are naturally identified by their Java package name. For example, the Google Maps app uses the package name `com.google.android.apps.maps`. REQUIRED

func (*AssetlinksCheckCall) TargetWebSite

func (c *AssetlinksCheckCall) TargetWebSite(targetWebSite string) *AssetlinksCheckCall

TargetWebSite sets the optional parameter "target.web.site": Web assets are identified by a URL that contains only the scheme, hostname and port parts. The format is http[s]://[:] Hostnames must be fully qualified: they must end in a single period ("."). Only the schemes "http" and "https" are currently allowed. Port numbers are given as a decimal number, and they must be omitted if the standard port numbers are used: 80 for http and 443 for https. We call this limited URL the "site". All URLs that share the same scheme, hostname and port are considered to be a part of the site and thus belong to the web asset. Example: the asset with the site `https://www.google.com` contains all these URLs: * `https://www.google.com/` * `https://www.google.com:443/` * `https://www.google.com/foo` * `https://www.google.com/foo?bar` * `https://www.google.com/foo#bar` * `https://user@password:www.google.com/` But it does not contain these URLs: * `http://www.google.com/` (wrong scheme) * `https://google.com/` (hostname does not match) * `https://www.google.com:444/` (port does not match) REQUIRED

type AssetlinksService

type AssetlinksService struct {
	// contains filtered or unexported fields
}

func NewAssetlinksService

func NewAssetlinksService(s *Service) *AssetlinksService

func (*AssetlinksService) BulkCheck added in v0.67.0

func (r *AssetlinksService) BulkCheck(bulkcheckrequest *BulkCheckRequest) *AssetlinksBulkCheckCall

BulkCheck: Send a bundle of statement checks in a single RPC to minimize latency and service load. Statements need not be all for the same source and/or target. We recommend using this method when you need to check more than one statement in a short period of time.

func (*AssetlinksService) Check

Check: Determines whether the specified (directional) relationship exists between the specified source and target assets. The relation describes the intent of the link between the two assets as claimed by the source asset. An example for such relationships is the delegation of privileges or permissions. This command is most often used by infrastructure systems to check preconditions for an action. For example, a client may want to know if it is OK to send a web URL to a particular mobile app instead. The client can check for the relevant asset link from the website to the mobile app to decide if the operation should be allowed. A note about security: if you specify a secure asset as the source, such as an HTTPS website or an Android app, the API will ensure that any statements used to generate the response have been made in a secure way by the owner of that asset. Conversely, if the source asset is an insecure HTTP website (that is, the URL starts with `http://` instead of `https://`), the API cannot verify its statements securely, and it is not possible to ensure that the website's statements have not been altered by a third party. For more information, see the Digital Asset Links technical design specification (https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).

type BulkCheckRequest added in v0.67.0

type BulkCheckRequest struct {
	// AllowGoogleInternalDataSources: Same configuration as in Check request, all
	// statements checks will use same configurations.
	AllowGoogleInternalDataSources bool `json:"allowGoogleInternalDataSources,omitempty"`
	// DefaultRelation: If specified, will be used in any given template statement
	// that doesn’t specify a relation.
	DefaultRelation string `json:"defaultRelation,omitempty"`
	// DefaultSource: If specified, will be used in any given template statement
	// that doesn’t specify a source.
	DefaultSource *Asset `json:"defaultSource,omitempty"`
	// DefaultTarget: If specified, will be used in any given template statement
	// that doesn’t specify a target.
	DefaultTarget *Asset `json:"defaultTarget,omitempty"`
	// SkipCacheLookup: Same configuration as in Check request, all statements
	// checks will use same configurations.
	SkipCacheLookup bool `json:"skipCacheLookup,omitempty"`
	// Statements: List of statements to check. For each statement, you can omit a
	// field if the corresponding default_* field below was supplied. Minimum 1
	// statement; maximum 1,000 statements. Any additional statements will be
	// ignored.
	Statements []*StatementTemplate `json:"statements,omitempty"`
	// ForceSendFields is a list of field names (e.g.
	// "AllowGoogleInternalDataSources") to unconditionally include in API
	// requests. By default, fields with empty or default values are omitted from
	// API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "AllowGoogleInternalDataSources")
	// to include in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

BulkCheckRequest: Message used to check for the existence of multiple digital asset links within a single RPC.

func (*BulkCheckRequest) MarshalJSON added in v0.67.0

func (s *BulkCheckRequest) MarshalJSON() ([]byte, error)

type BulkCheckResponse added in v0.67.0

type BulkCheckResponse struct {
	// BulkErrorCode: Error code for the entire request. Present only if the entire
	// request failed. Individual check errors will not trigger the presence of
	// this field.
	//
	// Possible values:
	//   "ERROR_CODE_UNSPECIFIED"
	//   "ERROR_CODE_INVALID_QUERY" - Unable to parse query.
	//   "ERROR_CODE_FETCH_ERROR" - Unable to fetch the asset links data.
	//   "ERROR_CODE_FAILED_SSL_VALIDATION" - Invalid HTTPS certificate .
	//   "ERROR_CODE_REDIRECT" - HTTP redirects (e.g, 301) are not allowed.
	//   "ERROR_CODE_TOO_LARGE" - Asset links data exceeds maximum size.
	//   "ERROR_CODE_MALFORMED_HTTP_RESPONSE" - Can't parse HTTP response.
	//   "ERROR_CODE_WRONG_CONTENT_TYPE" - HTTP Content-type should be
	// application/json.
	//   "ERROR_CODE_MALFORMED_CONTENT" - JSON content is malformed.
	//   "ERROR_CODE_SECURE_ASSET_INCLUDES_INSECURE" - A secure asset includes an
	// insecure asset (security downgrade).
	//   "ERROR_CODE_FETCH_BUDGET_EXHAUSTED" - Too many includes (maybe a loop).
	BulkErrorCode string `json:"bulkErrorCode,omitempty"`
	// CheckResults: List of results for each check request. Results are returned
	// in the same order in which they were sent in the request.
	CheckResults []*CheckResponse `json:"checkResults,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "BulkErrorCode") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "BulkErrorCode") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

BulkCheckResponse: Response for BulkCheck call. Results are sent in a list in the same order in which they were sent. Individual check errors are described in the appropriate check_results entry. If the entire call fails, the response will include a bulk_error_code field describing the error.

func (*BulkCheckResponse) MarshalJSON added in v0.67.0

func (s *BulkCheckResponse) MarshalJSON() ([]byte, error)

type CertificateInfo

type CertificateInfo struct {
	// Sha256Fingerprint: The uppercase SHA-265 fingerprint of the certificate.
	// From the PEM certificate, it can be acquired like this: $ keytool -printcert
	// -file $CERTFILE | grep SHA256: SHA256:
	// 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \
	// 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in
	// $CERTFILE -noout -fingerprint -sha256 SHA256
	// Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
	// 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the
	// contents of this field would be `14:6D:E9:83:C5:73:
	// 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:
	// 44:E5`. If these tools are not available to you, you can convert the PEM
	// certificate into the DER format, compute the SHA-256 hash of that string and
	// represent the result as a hexstring (that is, uppercase hexadecimal
	// representations of each octet, separated by colons).
	Sha256Fingerprint string `json:"sha256Fingerprint,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Sha256Fingerprint") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Sha256Fingerprint") to include in
	// API requests with the JSON null value. By default, fields with empty values
	// are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

CertificateInfo: Describes an X509 certificate.

func (*CertificateInfo) MarshalJSON

func (s *CertificateInfo) MarshalJSON() ([]byte, error)

type CheckResponse

type CheckResponse struct {
	// DebugString: Human-readable message containing information intended to help
	// end users understand, reproduce and debug the result. The message will be in
	// English and we are currently not planning to offer any translations. Please
	// note that no guarantees are made about the contents or format of this
	// string. Any aspect of it may be subject to change without notice. You should
	// not attempt to programmatically parse this data. For programmatic access,
	// use the error_code field below.
	DebugString string `json:"debugString,omitempty"`
	// ErrorCode: Error codes that describe the result of the Check operation.
	//
	// Possible values:
	//   "ERROR_CODE_UNSPECIFIED"
	//   "ERROR_CODE_INVALID_QUERY" - Unable to parse query.
	//   "ERROR_CODE_FETCH_ERROR" - Unable to fetch the asset links data.
	//   "ERROR_CODE_FAILED_SSL_VALIDATION" - Invalid HTTPS certificate .
	//   "ERROR_CODE_REDIRECT" - HTTP redirects (e.g, 301) are not allowed.
	//   "ERROR_CODE_TOO_LARGE" - Asset links data exceeds maximum size.
	//   "ERROR_CODE_MALFORMED_HTTP_RESPONSE" - Can't parse HTTP response.
	//   "ERROR_CODE_WRONG_CONTENT_TYPE" - HTTP Content-type should be
	// application/json.
	//   "ERROR_CODE_MALFORMED_CONTENT" - JSON content is malformed.
	//   "ERROR_CODE_SECURE_ASSET_INCLUDES_INSECURE" - A secure asset includes an
	// insecure asset (security downgrade).
	//   "ERROR_CODE_FETCH_BUDGET_EXHAUSTED" - Too many includes (maybe a loop).
	ErrorCode []string `json:"errorCode,omitempty"`
	// Linked: Set to true if the assets specified in the request are linked by the
	// relation specified in the request.
	Linked bool `json:"linked,omitempty"`
	// MaxAge: From serving time, how much longer the response should be considered
	// valid barring further updates. REQUIRED
	MaxAge string `json:"maxAge,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "DebugString") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "DebugString") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

CheckResponse: Response message for the CheckAssetLinks call.

func (*CheckResponse) MarshalJSON

func (s *CheckResponse) MarshalJSON() ([]byte, error)

type ListResponse

type ListResponse struct {
	// DebugString: Human-readable message containing information intended to help
	// end users understand, reproduce and debug the result. The message will be in
	// English and we are currently not planning to offer any translations. Please
	// note that no guarantees are made about the contents or format of this
	// string. Any aspect of it may be subject to change without notice. You should
	// not attempt to programmatically parse this data. For programmatic access,
	// use the error_code field below.
	DebugString string `json:"debugString,omitempty"`
	// ErrorCode: Error codes that describe the result of the List operation.
	//
	// Possible values:
	//   "ERROR_CODE_UNSPECIFIED"
	//   "ERROR_CODE_INVALID_QUERY" - Unable to parse query.
	//   "ERROR_CODE_FETCH_ERROR" - Unable to fetch the asset links data.
	//   "ERROR_CODE_FAILED_SSL_VALIDATION" - Invalid HTTPS certificate .
	//   "ERROR_CODE_REDIRECT" - HTTP redirects (e.g, 301) are not allowed.
	//   "ERROR_CODE_TOO_LARGE" - Asset links data exceeds maximum size.
	//   "ERROR_CODE_MALFORMED_HTTP_RESPONSE" - Can't parse HTTP response.
	//   "ERROR_CODE_WRONG_CONTENT_TYPE" - HTTP Content-type should be
	// application/json.
	//   "ERROR_CODE_MALFORMED_CONTENT" - JSON content is malformed.
	//   "ERROR_CODE_SECURE_ASSET_INCLUDES_INSECURE" - A secure asset includes an
	// insecure asset (security downgrade).
	//   "ERROR_CODE_FETCH_BUDGET_EXHAUSTED" - Too many includes (maybe a loop).
	ErrorCode []string `json:"errorCode,omitempty"`
	// MaxAge: From serving time, how much longer the response should be considered
	// valid barring further updates. REQUIRED
	MaxAge string `json:"maxAge,omitempty"`
	// Statements: A list of all the matching statements that have been found.
	Statements []*Statement `json:"statements,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the server.
	googleapi.ServerResponse `json:"-"`
	// ForceSendFields is a list of field names (e.g. "DebugString") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "DebugString") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

ListResponse: Response message for the List call.

func (*ListResponse) MarshalJSON

func (s *ListResponse) MarshalJSON() ([]byte, error)

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Assetlinks *AssetlinksService

	Statements *StatementsService
	// contains filtered or unexported fields
}

func New deprecated

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService added in v0.3.0

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

type Statement

type Statement struct {
	// Relation: The relation identifies the use of the statement as intended by
	// the source asset's owner (that is, the person or entity who issued the
	// statement). Every complete statement has a relation. We identify relations
	// with strings of the format `/`, where “ must be one of a set of pre-defined
	// purpose categories, and “ is a free-form lowercase alphanumeric string that
	// describes the specific use case of the statement. Refer to our API
	// documentation (/digital-asset-links/v1/relation-strings) for the current
	// list of supported relations. Example:
	// `delegate_permission/common.handle_all_urls` REQUIRED
	Relation string `json:"relation,omitempty"`
	// Source: Every statement has a source asset. REQUIRED
	Source *Asset `json:"source,omitempty"`
	// Target: Every statement has a target asset. REQUIRED
	Target *Asset `json:"target,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Relation") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Relation") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

Statement: Describes a reliable statement that has been made about the relationship between a source asset and a target asset. Statements are always made by the source asset, either directly or by delegating to a statement list that is stored elsewhere. For more detailed definitions of statements and assets, please refer to our API documentation landing page (/digital-asset-links/v1/getting-started).

func (*Statement) MarshalJSON

func (s *Statement) MarshalJSON() ([]byte, error)

type StatementTemplate added in v0.67.0

type StatementTemplate struct {
	// Relation: The relationship being asserted between the source and target. If
	// omitted, you must specify a BulkCheckRequest.default_relation value to use
	// here.
	Relation string `json:"relation,omitempty"`
	// Source: The source asset that is asserting the statement. If omitted, you
	// must specify a BulkCheckRequest.default_source value to use here.
	Source *Asset `json:"source,omitempty"`
	// Target: The target that the source is declaring the relationship with. If
	// omitted, you must specify a BulkCheckRequest.default_target to use here.
	Target *Asset `json:"target,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Relation") to
	// unconditionally include in API requests. By default, fields with empty or
	// default values are omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Relation") to include in API
	// requests with the JSON null value. By default, fields with empty values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

StatementTemplate: A single statement to check in a bulk call using BulkCheck. See CheckRequest for details about each field.

func (*StatementTemplate) MarshalJSON added in v0.67.0

func (s *StatementTemplate) MarshalJSON() ([]byte, error)

type StatementsListCall

type StatementsListCall struct {
	// contains filtered or unexported fields
}

func (*StatementsListCall) Context

Context sets the context to be used in this call's Do method.

func (*StatementsListCall) Do

Do executes the "digitalassetlinks.statements.list" call. Any non-2xx status code is an error. Response headers are in either *ListResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*StatementsListCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.

func (*StatementsListCall) Header

func (c *StatementsListCall) Header() http.Header

Header returns a http.Header that can be modified by the caller to add headers to the request.

func (*StatementsListCall) IfNoneMatch

func (c *StatementsListCall) IfNoneMatch(entityTag string) *StatementsListCall

IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.

func (*StatementsListCall) Relation

func (c *StatementsListCall) Relation(relation string) *StatementsListCall

Relation sets the optional parameter "relation": Use only associations that match the specified relation. See the `Statement` (#Statement) message for a detailed definition of relation strings. For a query to match a statement, one of the following must be true: * both the query's and the statement's relation strings match exactly, or * the query's relation string is empty or missing. Example: A query with relation `delegate_permission/common.handle_all_urls` matches an asset link with relation `delegate_permission/common.handle_all_urls`.

func (*StatementsListCall) SourceAndroidAppCertificateSha256Fingerprint

func (c *StatementsListCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *StatementsListCall

SourceAndroidAppCertificateSha256Fingerprint sets the optional parameter "source.androidApp.certificate.sha256Fingerprint": The uppercase SHA-265 fingerprint of the certificate. From the PEM certificate, it can be acquired like this: $ keytool -printcert -file $CERTFILE | grep SHA256: SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \ 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256 SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \ 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the contents of this field would be `14:6D:E9:83:C5:73: 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF: 44:E5`. If these tools are not available to you, you can convert the PEM certificate into the DER format, compute the SHA-256 hash of that string and represent the result as a hexstring (that is, uppercase hexadecimal representations of each octet, separated by colons).

func (*StatementsListCall) SourceAndroidAppPackageName

func (c *StatementsListCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *StatementsListCall

SourceAndroidAppPackageName sets the optional parameter "source.androidApp.packageName": Android App assets are naturally identified by their Java package name. For example, the Google Maps app uses the package name `com.google.android.apps.maps`. REQUIRED

func (*StatementsListCall) SourceWebSite

func (c *StatementsListCall) SourceWebSite(sourceWebSite string) *StatementsListCall

SourceWebSite sets the optional parameter "source.web.site": Web assets are identified by a URL that contains only the scheme, hostname and port parts. The format is http[s]://[:] Hostnames must be fully qualified: they must end in a single period ("."). Only the schemes "http" and "https" are currently allowed. Port numbers are given as a decimal number, and they must be omitted if the standard port numbers are used: 80 for http and 443 for https. We call this limited URL the "site". All URLs that share the same scheme, hostname and port are considered to be a part of the site and thus belong to the web asset. Example: the asset with the site `https://www.google.com` contains all these URLs: * `https://www.google.com/` * `https://www.google.com:443/` * `https://www.google.com/foo` * `https://www.google.com/foo?bar` * `https://www.google.com/foo#bar` * `https://user@password:www.google.com/` But it does not contain these URLs: * `http://www.google.com/` (wrong scheme) * `https://google.com/` (hostname does not match) * `https://www.google.com:444/` (port does not match) REQUIRED

type StatementsService

type StatementsService struct {
	// contains filtered or unexported fields
}

func NewStatementsService

func NewStatementsService(s *Service) *StatementsService

func (*StatementsService) List

List: Retrieves a list of all statements from a given source that match the specified target and statement string. The API guarantees that all statements with secure source assets, such as HTTPS websites or Android apps, have been made in a secure way by the owner of those assets, as described in the Digital Asset Links technical design specification (https://github.com/google/digitalassetlinks/blob/master/well-known/details.md). Specifically, you should consider that for insecure websites (that is, where the URL starts with `http://` instead of `https://`), this guarantee cannot be made. The `List` command is most useful in cases where the API client wants to know all the ways in which two assets are related, or enumerate all the relationships from a particular source asset. Example: a feature that helps users navigate to related items. When a mobile app is running on a device, the feature would make it easy to navigate to the corresponding web site or Google+ profile.

type WebAsset

type WebAsset struct {
	// Site: Web assets are identified by a URL that contains only the scheme,
	// hostname and port parts. The format is http[s]://[:] Hostnames must be fully
	// qualified: they must end in a single period ("."). Only the schemes "http"
	// and "https" are currently allowed. Port numbers are given as a decimal
	// number, and they must be omitted if the standard port numbers are used: 80
	// for http and 443 for https. We call this limited URL the "site". All URLs
	// that share the same scheme, hostname and port are considered to be a part of
	// the site and thus belong to the web asset. Example: the asset with the site
	// `https://www.google.com` contains all these URLs: *
	// `https://www.google.com/` * `https://www.google.com:443/` *
	// `https://www.google.com/foo` * `https://www.google.com/foo?bar` *
	// `https://www.google.com/foo#bar` * `https://user@password:www.google.com/`
	// But it does not contain these URLs: * `http://www.google.com/` (wrong
	// scheme) * `https://google.com/` (hostname does not match) *
	// `https://www.google.com:444/` (port does not match) REQUIRED
	Site string `json:"site,omitempty"`
	// ForceSendFields is a list of field names (e.g. "Site") to unconditionally
	// include in API requests. By default, fields with empty or default values are
	// omitted from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
	// details.
	ForceSendFields []string `json:"-"`
	// NullFields is a list of field names (e.g. "Site") to include in API requests
	// with the JSON null value. By default, fields with empty values are omitted
	// from API requests. See
	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
	NullFields []string `json:"-"`
}

WebAsset: Describes a web asset.

func (*WebAsset) MarshalJSON

func (s *WebAsset) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL