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