1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\Digitalassetlinks\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Digitalassetlinks\ListResponse;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * The "statements" collection of methods.
|
---|
24 | * Typical usage is:
|
---|
25 | * <code>
|
---|
26 | * $digitalassetlinksService = new Google\Service\Digitalassetlinks(...);
|
---|
27 | * $statements = $digitalassetlinksService->statements;
|
---|
28 | * </code>
|
---|
29 | */
|
---|
30 | class Statements extends \Google\Service\Resource
|
---|
31 | {
|
---|
32 | /**
|
---|
33 | * Retrieves a list of all statements from a given source that match the
|
---|
34 | * specified target and statement string. The API guarantees that all statements
|
---|
35 | * with secure source assets, such as HTTPS websites or Android apps, have been
|
---|
36 | * made in a secure way by the owner of those assets, as described in the
|
---|
37 | * [Digital Asset Links technical design
|
---|
38 | * specification](https://github.com/google/digitalassetlinks/blob/master/well-
|
---|
39 | * known/details.md). Specifically, you should consider that for insecure
|
---|
40 | * websites (that is, where the URL starts with `http://` instead of
|
---|
41 | * `https://`), this guarantee cannot be made. The `List` command is most useful
|
---|
42 | * in cases where the API client wants to know all the ways in which two assets
|
---|
43 | * are related, or enumerate all the relationships from a particular source
|
---|
44 | * asset. Example: a feature that helps users navigate to related items. When a
|
---|
45 | * mobile app is running on a device, the feature would make it easy to navigate
|
---|
46 | * to the corresponding web site or Google+ profile. (statements.listStatements)
|
---|
47 | *
|
---|
48 | * @param array $optParams Optional parameters.
|
---|
49 | *
|
---|
50 | * @opt_param string relation Use only associations that match the specified
|
---|
51 | * relation. See the [`Statement`](#Statement) message for a detailed definition
|
---|
52 | * of relation strings. For a query to match a statement, one of the following
|
---|
53 | * must be true: * both the query's and the statement's relation strings match
|
---|
54 | * exactly, or * the query's relation string is empty or missing. Example: A
|
---|
55 | * query with relation `delegate_permission/common.handle_all_urls` matches an
|
---|
56 | * asset link with relation `delegate_permission/common.handle_all_urls`.
|
---|
57 | * @opt_param string source.androidApp.certificate.sha256Fingerprint The
|
---|
58 | * uppercase SHA-265 fingerprint of the certificate. From the PEM certificate,
|
---|
59 | * it can be acquired like this: $ keytool -printcert -file $CERTFILE | grep
|
---|
60 | * SHA256: SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \
|
---|
61 | * 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in
|
---|
62 | * $CERTFILE -noout -fingerprint -sha256 SHA256
|
---|
63 | * Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
|
---|
64 | * 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the contents
|
---|
65 | * of this field would be `14:6D:E9:83:C5:73:
|
---|
66 | * 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:
|
---|
67 | * 44:E5`. If these tools are not available to you, you can convert the PEM
|
---|
68 | * certificate into the DER format, compute the SHA-256 hash of that string and
|
---|
69 | * represent the result as a hexstring (that is, uppercase hexadecimal
|
---|
70 | * representations of each octet, separated by colons).
|
---|
71 | * @opt_param string source.androidApp.packageName Android App assets are
|
---|
72 | * naturally identified by their Java package name. For example, the Google Maps
|
---|
73 | * app uses the package name `com.google.android.apps.maps`. REQUIRED
|
---|
74 | * @opt_param string source.web.site Web assets are identified by a URL that
|
---|
75 | * contains only the scheme, hostname and port parts. The format is
|
---|
76 | * http[s]://[:] Hostnames must be fully qualified: they must end in a single
|
---|
77 | * period ("`.`"). Only the schemes "http" and "https" are currently allowed.
|
---|
78 | * Port numbers are given as a decimal number, and they must be omitted if the
|
---|
79 | * standard port numbers are used: 80 for http and 443 for https. We call this
|
---|
80 | * limited URL the "site". All URLs that share the same scheme, hostname and
|
---|
81 | * port are considered to be a part of the site and thus belong to the web
|
---|
82 | * asset. Example: the asset with the site `https://www.google.com` contains all
|
---|
83 | * these URLs: * `https://www.google.com/` * `https://www.google.com:443/` *
|
---|
84 | * `https://www.google.com/foo` * `https://www.google.com/foo?bar` *
|
---|
85 | * `https://www.google.com/foo#bar` * `https://user@password:www.google.com/`
|
---|
86 | * But it does not contain these URLs: * `http://www.google.com/` (wrong scheme)
|
---|
87 | * * `https://google.com/` (hostname does not match) *
|
---|
88 | * `https://www.google.com:444/` (port does not match) REQUIRED
|
---|
89 | * @return ListResponse
|
---|
90 | * @throws \Google\Service\Exception
|
---|
91 | */
|
---|
92 | public function listStatements($optParams = [])
|
---|
93 | {
|
---|
94 | $params = [];
|
---|
95 | $params = array_merge($params, $optParams);
|
---|
96 | return $this->call('list', [$params], ListResponse::class);
|
---|
97 | }
|
---|
98 | }
|
---|
99 |
|
---|
100 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
101 | class_alias(Statements::class, 'Google_Service_Digitalassetlinks_Resource_Statements');
|
---|