Documentation ¶
Overview ¶
Package digitalassetlinks provides access to the Digital Asset Links API.
For product documentation, see: https://developers.google.com/digital-asset-links/
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 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 option.WithTokenSource:
config := &oauth2.Config{...} // ... token, err := config.Exchange(ctx, ...) digitalassetlinksService, err := digitalassetlinks.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
See https://godoc.org/google.golang.org/api/option/ for details on options.
Index ¶
- type AndroidAppAsset
- type Asset
- type AssetlinksCheckCall
- func (c *AssetlinksCheckCall) Context(ctx context.Context) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) Do(opts ...googleapi.CallOption) (*CheckResponse, error)
- func (c *AssetlinksCheckCall) Fields(s ...googleapi.Field) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) Header() http.Header
- func (c *AssetlinksCheckCall) IfNoneMatch(entityTag string) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) Relation(relation string) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) SourceWebSite(sourceWebSite string) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) TargetAndroidAppCertificateSha256Fingerprint(targetAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) TargetAndroidAppPackageName(targetAndroidAppPackageName string) *AssetlinksCheckCall
- func (c *AssetlinksCheckCall) TargetWebSite(targetWebSite string) *AssetlinksCheckCall
- type AssetlinksService
- type CertificateInfo
- type CheckResponse
- type ListResponse
- type Service
- type Statement
- type StatementsListCall
- func (c *StatementsListCall) Context(ctx context.Context) *StatementsListCall
- func (c *StatementsListCall) Do(opts ...googleapi.CallOption) (*ListResponse, error)
- func (c *StatementsListCall) Fields(s ...googleapi.Field) *StatementsListCall
- func (c *StatementsListCall) Header() http.Header
- func (c *StatementsListCall) IfNoneMatch(entityTag string) *StatementsListCall
- func (c *StatementsListCall) Relation(relation string) *StatementsListCall
- func (c *StatementsListCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *StatementsListCall
- func (c *StatementsListCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *StatementsListCall
- func (c *StatementsListCall) SourceWebSite(sourceWebSite string) *StatementsListCall
- type StatementsService
- type WebAsset
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 values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. 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. However, any field with // an empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. 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 values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. 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. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. 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 ¶
type AssetlinksCheckCall ¶
type AssetlinksCheckCall struct {
// contains filtered or unexported fields
}
func (*AssetlinksCheckCall) Context ¶
func (c *AssetlinksCheckCall) Context(ctx context.Context) *AssetlinksCheckCall
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
func (*AssetlinksCheckCall) Do ¶
func (c *AssetlinksCheckCall) Do(opts ...googleapi.CallOption) (*CheckResponse, error)
Do executes the "digitalassetlinks.assetlinks.check" call. Exactly one of *CheckResponse or error will be non-nil. 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 ¶
func (c *AssetlinksCheckCall) Fields(s ...googleapi.Field) *AssetlinksCheckCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*AssetlinksCheckCall) Header ¶
func (c *AssetlinksCheckCall) Header() http.Header
Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.
func (*AssetlinksCheckCall) IfNoneMatch ¶
func (c *AssetlinksCheckCall) IfNoneMatch(entityTag string) *AssetlinksCheckCall
IfNoneMatch sets the 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. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.
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 `<kind>/<detail>`, where `<kind>` must be one of a set of pre-defined purpose categories, and `<detail>` 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]://<hostname>[:<port>]
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]://<hostname>[:<port>]
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) Check ¶
func (r *AssetlinksService) Check() *AssetlinksCheckCall
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/digitalasset links/blob/master/well-known/details.md).
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 values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. 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. However, any field // with an empty value appearing in NullFields will be sent to the // server as null. It is an error if a field in this list has a // non-empty value. This may be used to include null fields in Patch // requests. 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 values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. 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. However, any field with // an empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. 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 values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. 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. However, any field with // an empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. 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
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 ¶
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 `<kind>/<detail>`, // where // `<kind>` must be one of a set of pre-defined purpose categories, // and // `<detail>` 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 values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. 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. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. 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 ¶
type StatementsListCall ¶
type StatementsListCall struct {
// contains filtered or unexported fields
}
func (*StatementsListCall) Context ¶
func (c *StatementsListCall) Context(ctx context.Context) *StatementsListCall
Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.
func (*StatementsListCall) Do ¶
func (c *StatementsListCall) Do(opts ...googleapi.CallOption) (*ListResponse, error)
Do executes the "digitalassetlinks.statements.list" call. Exactly one of *ListResponse or error will be non-nil. 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 ¶
func (c *StatementsListCall) Fields(s ...googleapi.Field) *StatementsListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*StatementsListCall) Header ¶
func (c *StatementsListCall) Header() http.Header
Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.
func (*StatementsListCall) IfNoneMatch ¶
func (c *StatementsListCall) IfNoneMatch(entityTag string) *StatementsListCall
IfNoneMatch sets the 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. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.
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]://<hostname>[:<port>]
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 ¶
func (r *StatementsService) List() *StatementsListCall
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]://<hostname>[:<port>] // // 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 values are omitted from API requests. However, any non-pointer, // non-interface field appearing in ForceSendFields will be sent to the // server regardless of whether the field is empty or not. This may be // used to include empty fields in Patch requests. 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. However, any field with an // empty value appearing in NullFields will be sent to the server as // null. It is an error if a field in this list has a non-empty value. // This may be used to include null fields in Patch requests. NullFields []string `json:"-"` }
WebAsset: Describes a web asset.