1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228
|
// Package digitalassetlinks provides access to the Digital Asset Links API.
//
// See https://developers.google.com/digital-asset-links/
//
// Usage example:
//
// import "google.golang.org/api/digitalassetlinks/v1"
// ...
// digitalassetlinksService, err := digitalassetlinks.New(oauthHttpClient)
package digitalassetlinks // import "google.golang.org/api/digitalassetlinks/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
context "golang.org/x/net/context"
ctxhttp "golang.org/x/net/context/ctxhttp"
gensupport "google.golang.org/api/gensupport"
googleapi "google.golang.org/api/googleapi"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "digitalassetlinks:v1"
const apiName = "digitalassetlinks"
const apiVersion = "v1"
const basePath = "https://digitalassetlinks.googleapis.com/"
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Assetlinks = NewAssetlinksService(s)
s.Statements = NewStatementsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Assetlinks *AssetlinksService
Statements *StatementsService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewAssetlinksService(s *Service) *AssetlinksService {
rs := &AssetlinksService{s: s}
return rs
}
type AssetlinksService struct {
s *Service
}
func NewStatementsService(s *Service) *StatementsService {
rs := &StatementsService{s: s}
return rs
}
type StatementsService struct {
s *Service
}
// AndroidAppAsset: Describes an android app asset.
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:"-"`
}
func (s *AndroidAppAsset) MarshalJSON() ([]byte, error) {
type NoMethod AndroidAppAsset
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// 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.
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:"-"`
}
func (s *Asset) MarshalJSON() ([]byte, error) {
type NoMethod Asset
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CertificateInfo: Describes an X509 certificate.
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:"-"`
}
func (s *CertificateInfo) MarshalJSON() ([]byte, error) {
type NoMethod CertificateInfo
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// CheckResponse: Response message for the CheckAssetLinks call.
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:"-"`
}
func (s *CheckResponse) MarshalJSON() ([]byte, error) {
type NoMethod CheckResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// ListResponse: Response message for the List call.
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:"-"`
}
func (s *ListResponse) MarshalJSON() ([]byte, error) {
type NoMethod ListResponse
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// 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).
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:"-"`
}
func (s *Statement) MarshalJSON() ([]byte, error) {
type NoMethod Statement
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// WebAsset: Describes a web asset.
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:"-"`
}
func (s *WebAsset) MarshalJSON() ([]byte, error) {
type NoMethod WebAsset
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// method id "digitalassetlinks.assetlinks.check":
type AssetlinksCheckCall struct {
s *Service
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// Check: Determines whether the specified (directional) relationship
// exists between
// the specified source and target assets.
//
// The relation describes the intent of the link between the two assets
// as
// claimed by the source asset. An example for such relationships is
// the
// delegation of privileges or permissions.
//
// This command is most often used by infrastructure systems to
// check
// preconditions for an action. For example, a client may want to know
// if it
// is OK to send a web URL to a particular mobile app instead. The
// client can
// check for the relevant asset link from the website to the mobile app
// to
// decide if the operation should be allowed.
//
// A note about security: if you specify a secure asset as the source,
// such as
// an HTTPS website or an Android app, the API will ensure that
// any
// statements used to generate the response have been made in a secure
// way by
// the owner of that asset. Conversely, if the source asset is an
// insecure
// HTTP website (that is, the URL starts with `http://` instead of
// `https://`),
// the API cannot verify its statements securely, and it is not possible
// to
// ensure that the website's statements have not been altered by a
// third
// party. For more information, see the [Digital Asset Links technical
// design
// specification](https://github.com/google/digitalassetlinks/blob
// /master/well-known/details.md).
func (r *AssetlinksService) Check() *AssetlinksCheckCall {
c := &AssetlinksCheckCall{s: r.s, urlParams_: make(gensupport.URLParams)}
return c
}
// 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 (c *AssetlinksCheckCall) Relation(relation string) *AssetlinksCheckCall {
c.urlParams_.Set("relation", relation)
return c
}
// 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 (c *AssetlinksCheckCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall {
c.urlParams_.Set("source.androidApp.certificate.sha256Fingerprint", sourceAndroidAppCertificateSha256Fingerprint)
return c
}
// 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 (c *AssetlinksCheckCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *AssetlinksCheckCall {
c.urlParams_.Set("source.androidApp.packageName", sourceAndroidAppPackageName)
return c
}
// 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 (c *AssetlinksCheckCall) SourceWebSite(sourceWebSite string) *AssetlinksCheckCall {
c.urlParams_.Set("source.web.site", sourceWebSite)
return c
}
// 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 (c *AssetlinksCheckCall) TargetAndroidAppCertificateSha256Fingerprint(targetAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall {
c.urlParams_.Set("target.androidApp.certificate.sha256Fingerprint", targetAndroidAppCertificateSha256Fingerprint)
return c
}
// 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 (c *AssetlinksCheckCall) TargetAndroidAppPackageName(targetAndroidAppPackageName string) *AssetlinksCheckCall {
c.urlParams_.Set("target.androidApp.packageName", targetAndroidAppPackageName)
return c
}
// 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
func (c *AssetlinksCheckCall) TargetWebSite(targetWebSite string) *AssetlinksCheckCall {
c.urlParams_.Set("target.web.site", targetWebSite)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *AssetlinksCheckCall) Fields(s ...googleapi.Field) *AssetlinksCheckCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// 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 (c *AssetlinksCheckCall) IfNoneMatch(entityTag string) *AssetlinksCheckCall {
c.ifNoneMatch_ = entityTag
return c
}
// 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 (c *AssetlinksCheckCall) Context(ctx context.Context) *AssetlinksCheckCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *AssetlinksCheckCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *AssetlinksCheckCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/assetlinks:check")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// 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 (c *AssetlinksCheckCall) Do(opts ...googleapi.CallOption) (*CheckResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &CheckResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Determines whether the specified (directional) relationship exists between\nthe specified source and target assets.\n\nThe relation describes the intent of the link between the two assets as\nclaimed by the source asset. An example for such relationships is the\ndelegation of privileges or permissions.\n\nThis command is most often used by infrastructure systems to check\npreconditions for an action. For example, a client may want to know if it\nis OK to send a web URL to a particular mobile app instead. The client can\ncheck for the relevant asset link from the website to the mobile app to\ndecide if the operation should be allowed.\n\nA note about security: if you specify a secure asset as the source, such as\nan HTTPS website or an Android app, the API will ensure that any\nstatements used to generate the response have been made in a secure way by\nthe owner of that asset. Conversely, if the source asset is an insecure\nHTTP website (that is, the URL starts with `http://` instead of `https://`),\nthe API cannot verify its statements securely, and it is not possible to\nensure that the website's statements have not been altered by a third\nparty. For more information, see the [Digital Asset Links technical design\nspecification](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).",
// "flatPath": "v1/assetlinks:check",
// "httpMethod": "GET",
// "id": "digitalassetlinks.assetlinks.check",
// "parameterOrder": [],
// "parameters": {
// "relation": {
// "description": "Query string for the relation.\n\nWe identify relations with strings of the format `\u003ckind\u003e/\u003cdetail\u003e`, where\n`\u003ckind\u003e` must be one of a set of pre-defined purpose categories, and\n`\u003cdetail\u003e` is a free-form lowercase alphanumeric string that describes the\nspecific use case of the statement.\n\nRefer to [our API documentation](/digital-asset-links/v1/relation-strings)\nfor the current list of supported relations.\n\nFor a query to match an asset link, both the query's and the asset link's\nrelation strings must match exactly.\n\nExample: A query with relation `delegate_permission/common.handle_all_urls`\nmatches an asset link with relation\n`delegate_permission/common.handle_all_urls`.",
// "location": "query",
// "type": "string"
// },
// "source.androidApp.certificate.sha256Fingerprint": {
// "description": "The uppercase SHA-265 fingerprint of the certificate. From the PEM\n certificate, it can be acquired like this:\n\n $ keytool -printcert -file $CERTFILE | grep SHA256:\n SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \\\n 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nor like this:\n\n $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256\n SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \\\n 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nIn this example, the contents of this field would be `14:6D:E9:83:C5:73:\n06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:\n44:E5`.\n\nIf these tools are not available to you, you can convert the PEM\ncertificate into the DER format, compute the SHA-256 hash of that string\nand represent the result as a hexstring (that is, uppercase hexadecimal\nrepresentations of each octet, separated by colons).",
// "location": "query",
// "type": "string"
// },
// "source.androidApp.packageName": {
// "description": "Android App assets are naturally identified by their Java package name.\nFor example, the Google Maps app uses the package name\n`com.google.android.apps.maps`.\nREQUIRED",
// "location": "query",
// "type": "string"
// },
// "source.web.site": {
// "description": "Web assets are identified by a URL that contains only the scheme, hostname\nand port parts. The format is\n\n http[s]://\u003chostname\u003e[:\u003cport\u003e]\n\nHostnames must be fully qualified: they must end in a single period\n(\"`.`\").\n\nOnly the schemes \"http\" and \"https\" are currently allowed.\n\nPort numbers are given as a decimal number, and they must be omitted if the\nstandard port numbers are used: 80 for http and 443 for https.\n\nWe call this limited URL the \"site\". All URLs that share the same scheme,\nhostname and port are considered to be a part of the site and thus belong\nto the web asset.\n\nExample: the asset with the site `https://www.google.com` contains all\nthese URLs:\n\n * `https://www.google.com/`\n * `https://www.google.com:443/`\n * `https://www.google.com/foo`\n * `https://www.google.com/foo?bar`\n * `https://www.google.com/foo#bar`\n * `https://user@password:www.google.com/`\n\nBut it does not contain these URLs:\n\n * `http://www.google.com/` (wrong scheme)\n * `https://google.com/` (hostname does not match)\n * `https://www.google.com:444/` (port does not match)\nREQUIRED",
// "location": "query",
// "type": "string"
// },
// "target.androidApp.certificate.sha256Fingerprint": {
// "description": "The uppercase SHA-265 fingerprint of the certificate. From the PEM\n certificate, it can be acquired like this:\n\n $ keytool -printcert -file $CERTFILE | grep SHA256:\n SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \\\n 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nor like this:\n\n $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256\n SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \\\n 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nIn this example, the contents of this field would be `14:6D:E9:83:C5:73:\n06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:\n44:E5`.\n\nIf these tools are not available to you, you can convert the PEM\ncertificate into the DER format, compute the SHA-256 hash of that string\nand represent the result as a hexstring (that is, uppercase hexadecimal\nrepresentations of each octet, separated by colons).",
// "location": "query",
// "type": "string"
// },
// "target.androidApp.packageName": {
// "description": "Android App assets are naturally identified by their Java package name.\nFor example, the Google Maps app uses the package name\n`com.google.android.apps.maps`.\nREQUIRED",
// "location": "query",
// "type": "string"
// },
// "target.web.site": {
// "description": "Web assets are identified by a URL that contains only the scheme, hostname\nand port parts. The format is\n\n http[s]://\u003chostname\u003e[:\u003cport\u003e]\n\nHostnames must be fully qualified: they must end in a single period\n(\"`.`\").\n\nOnly the schemes \"http\" and \"https\" are currently allowed.\n\nPort numbers are given as a decimal number, and they must be omitted if the\nstandard port numbers are used: 80 for http and 443 for https.\n\nWe call this limited URL the \"site\". All URLs that share the same scheme,\nhostname and port are considered to be a part of the site and thus belong\nto the web asset.\n\nExample: the asset with the site `https://www.google.com` contains all\nthese URLs:\n\n * `https://www.google.com/`\n * `https://www.google.com:443/`\n * `https://www.google.com/foo`\n * `https://www.google.com/foo?bar`\n * `https://www.google.com/foo#bar`\n * `https://user@password:www.google.com/`\n\nBut it does not contain these URLs:\n\n * `http://www.google.com/` (wrong scheme)\n * `https://google.com/` (hostname does not match)\n * `https://www.google.com:444/` (port does not match)\nREQUIRED",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/assetlinks:check",
// "response": {
// "$ref": "CheckResponse"
// }
// }
}
// method id "digitalassetlinks.statements.list":
type StatementsListCall struct {
s *Service
urlParams_ gensupport.URLParams
ifNoneMatch_ string
ctx_ context.Context
header_ http.Header
}
// 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.
func (r *StatementsService) List() *StatementsListCall {
c := &StatementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
return c
}
// 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 (c *StatementsListCall) Relation(relation string) *StatementsListCall {
c.urlParams_.Set("relation", relation)
return c
}
// 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 (c *StatementsListCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *StatementsListCall {
c.urlParams_.Set("source.androidApp.certificate.sha256Fingerprint", sourceAndroidAppCertificateSha256Fingerprint)
return c
}
// 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 (c *StatementsListCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *StatementsListCall {
c.urlParams_.Set("source.androidApp.packageName", sourceAndroidAppPackageName)
return c
}
// 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 (c *StatementsListCall) SourceWebSite(sourceWebSite string) *StatementsListCall {
c.urlParams_.Set("source.web.site", sourceWebSite)
return c
}
// Fields allows partial responses to be retrieved. See
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
// for more information.
func (c *StatementsListCall) Fields(s ...googleapi.Field) *StatementsListCall {
c.urlParams_.Set("fields", googleapi.CombineFields(s))
return c
}
// 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 (c *StatementsListCall) IfNoneMatch(entityTag string) *StatementsListCall {
c.ifNoneMatch_ = entityTag
return c
}
// 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 (c *StatementsListCall) Context(ctx context.Context) *StatementsListCall {
c.ctx_ = ctx
return c
}
// Header returns an http.Header that can be modified by the caller to
// add HTTP headers to the request.
func (c *StatementsListCall) Header() http.Header {
if c.header_ == nil {
c.header_ = make(http.Header)
}
return c.header_
}
func (c *StatementsListCall) doRequest(alt string) (*http.Response, error) {
reqHeaders := make(http.Header)
for k, v := range c.header_ {
reqHeaders[k] = v
}
reqHeaders.Set("User-Agent", c.s.userAgent())
if c.ifNoneMatch_ != "" {
reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
}
var body io.Reader = nil
c.urlParams_.Set("alt", alt)
c.urlParams_.Set("prettyPrint", "false")
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/statements:list")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.Header = reqHeaders
return gensupport.SendRequest(c.ctx_, c.s.client, req)
}
// 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 (c *StatementsListCall) Do(opts ...googleapi.CallOption) (*ListResponse, error) {
gensupport.SetOptions(c.urlParams_, opts...)
res, err := c.doRequest("json")
if res != nil && res.StatusCode == http.StatusNotModified {
if res.Body != nil {
res.Body.Close()
}
return nil, &googleapi.Error{
Code: res.StatusCode,
Header: res.Header,
}
}
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
ret := &ListResponse{
ServerResponse: googleapi.ServerResponse{
Header: res.Header,
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Retrieves a list of all statements from a given source that match the\nspecified target and statement string.\n\nThe API guarantees that all statements with secure source assets, such as\nHTTPS websites or Android apps, have been made in a secure way by the owner\nof those assets, as described in the [Digital Asset Links technical design\nspecification](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).\nSpecifically, you should consider that for insecure websites (that is,\nwhere the URL starts with `http://` instead of `https://`), this guarantee\ncannot be made.\n\nThe `List` command is most useful in cases where the API client wants to\nknow all the ways in which two assets are related, or enumerate all the\nrelationships from a particular source asset. Example: a feature that\nhelps users navigate to related items. When a mobile app is running on a\ndevice, the feature would make it easy to navigate to the corresponding web\nsite or Google+ profile.",
// "flatPath": "v1/statements:list",
// "httpMethod": "GET",
// "id": "digitalassetlinks.statements.list",
// "parameterOrder": [],
// "parameters": {
// "relation": {
// "description": "Use only associations that match the specified relation.\n\nSee the [`Statement`](#Statement) message for a detailed definition of\nrelation strings.\n\nFor a query to match a statement, one of the following must be true:\n\n* both the query's and the statement's relation strings match exactly,\n or\n* the query's relation string is empty or missing.\n\nExample: A query with relation `delegate_permission/common.handle_all_urls`\nmatches an asset link with relation\n`delegate_permission/common.handle_all_urls`.",
// "location": "query",
// "type": "string"
// },
// "source.androidApp.certificate.sha256Fingerprint": {
// "description": "The uppercase SHA-265 fingerprint of the certificate. From the PEM\n certificate, it can be acquired like this:\n\n $ keytool -printcert -file $CERTFILE | grep SHA256:\n SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \\\n 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nor like this:\n\n $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256\n SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \\\n 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nIn this example, the contents of this field would be `14:6D:E9:83:C5:73:\n06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:\n44:E5`.\n\nIf these tools are not available to you, you can convert the PEM\ncertificate into the DER format, compute the SHA-256 hash of that string\nand represent the result as a hexstring (that is, uppercase hexadecimal\nrepresentations of each octet, separated by colons).",
// "location": "query",
// "type": "string"
// },
// "source.androidApp.packageName": {
// "description": "Android App assets are naturally identified by their Java package name.\nFor example, the Google Maps app uses the package name\n`com.google.android.apps.maps`.\nREQUIRED",
// "location": "query",
// "type": "string"
// },
// "source.web.site": {
// "description": "Web assets are identified by a URL that contains only the scheme, hostname\nand port parts. The format is\n\n http[s]://\u003chostname\u003e[:\u003cport\u003e]\n\nHostnames must be fully qualified: they must end in a single period\n(\"`.`\").\n\nOnly the schemes \"http\" and \"https\" are currently allowed.\n\nPort numbers are given as a decimal number, and they must be omitted if the\nstandard port numbers are used: 80 for http and 443 for https.\n\nWe call this limited URL the \"site\". All URLs that share the same scheme,\nhostname and port are considered to be a part of the site and thus belong\nto the web asset.\n\nExample: the asset with the site `https://www.google.com` contains all\nthese URLs:\n\n * `https://www.google.com/`\n * `https://www.google.com:443/`\n * `https://www.google.com/foo`\n * `https://www.google.com/foo?bar`\n * `https://www.google.com/foo#bar`\n * `https://user@password:www.google.com/`\n\nBut it does not contain these URLs:\n\n * `http://www.google.com/` (wrong scheme)\n * `https://google.com/` (hostname does not match)\n * `https://www.google.com:444/` (port does not match)\nREQUIRED",
// "location": "query",
// "type": "string"
// }
// },
// "path": "v1/statements:list",
// "response": {
// "$ref": "ListResponse"
// }
// }
}
|