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 18namespace Google\Service\Digitalassetlinks\Resource; 19 20use Google\Service\Digitalassetlinks\BulkCheckRequest; 21use Google\Service\Digitalassetlinks\BulkCheckResponse; 22use Google\Service\Digitalassetlinks\CheckResponse; 23 24/** 25 * The "assetlinks" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $digitalassetlinksService = new Google\Service\Digitalassetlinks(...); 29 * $assetlinks = $digitalassetlinksService->assetlinks; 30 * </code> 31 */ 32class Assetlinks extends \Google\Service\Resource 33{ 34 /** 35 * Send a bundle of statement checks in a single RPC to minimize latency and 36 * service load. Statements need not be all for the same source and/or target. 37 * We recommend using this method when you need to check more than one statement 38 * in a short period of time. (assetlinks.bulkCheck) 39 * 40 * @param BulkCheckRequest $postBody 41 * @param array $optParams Optional parameters. 42 * @return BulkCheckResponse 43 */ 44 public function bulkCheck(BulkCheckRequest $postBody, $optParams = []) 45 { 46 $params = ['postBody' => $postBody]; 47 $params = array_merge($params, $optParams); 48 return $this->call('bulkCheck', [$params], BulkCheckResponse::class); 49 } 50 /** 51 * Determines whether the specified (directional) relationship exists between 52 * the specified source and target assets. The relation describes the intent of 53 * the link between the two assets as claimed by the source asset. An example 54 * for such relationships is the delegation of privileges or permissions. This 55 * command is most often used by infrastructure systems to check preconditions 56 * for an action. For example, a client may want to know if it is OK to send a 57 * web URL to a particular mobile app instead. The client can check for the 58 * relevant asset link from the website to the mobile app to decide if the 59 * operation should be allowed. A note about security: if you specify a secure 60 * asset as the source, such as an HTTPS website or an Android app, the API will 61 * ensure that any statements used to generate the response have been made in a 62 * secure way by the owner of that asset. Conversely, if the source asset is an 63 * insecure HTTP website (that is, the URL starts with `http://` instead of 64 * `https://`), the API cannot verify its statements securely, and it is not 65 * possible to ensure that the website's statements have not been altered by a 66 * third party. For more information, see the [Digital Asset Links technical 67 * design specification](https://github.com/google/digitalassetlinks/blob/master 68 * /well-known/details.md). (assetlinks.check) 69 * 70 * @param array $optParams Optional parameters. 71 * 72 * @opt_param string relation Query string for the relation. We identify 73 * relations with strings of the format `/`, where `` must be one of a set of 74 * pre-defined purpose categories, and `` is a free-form lowercase alphanumeric 75 * string that describes the specific use case of the statement. Refer to [our 76 * API documentation](/digital-asset-links/v1/relation-strings) for the current 77 * list of supported relations. For a query to match an asset link, both the 78 * query's and the asset link's relation strings must match exactly. Example: A 79 * query with relation `delegate_permission/common.handle_all_urls` matches an 80 * asset link with relation `delegate_permission/common.handle_all_urls`. 81 * @opt_param string source.androidApp.certificate.sha256Fingerprint The 82 * uppercase SHA-265 fingerprint of the certificate. From the PEM certificate, 83 * it can be acquired like this: $ keytool -printcert -file $CERTFILE | grep 84 * SHA256: SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \ 85 * 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in 86 * $CERTFILE -noout -fingerprint -sha256 SHA256 87 * Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \ 88 * 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the contents 89 * of this field would be `14:6D:E9:83:C5:73: 90 * 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF: 91 * 44:E5`. If these tools are not available to you, you can convert the PEM 92 * certificate into the DER format, compute the SHA-256 hash of that string and 93 * represent the result as a hexstring (that is, uppercase hexadecimal 94 * representations of each octet, separated by colons). 95 * @opt_param string source.androidApp.packageName Android App assets are 96 * naturally identified by their Java package name. For example, the Google Maps 97 * app uses the package name `com.google.android.apps.maps`. REQUIRED 98 * @opt_param string source.web.site Web assets are identified by a URL that 99 * contains only the scheme, hostname and port parts. The format is 100 * http[s]://[:] Hostnames must be fully qualified: they must end in a single 101 * period ("`.`"). Only the schemes "http" and "https" are currently allowed. 102 * Port numbers are given as a decimal number, and they must be omitted if the 103 * standard port numbers are used: 80 for http and 443 for https. We call this 104 * limited URL the "site". All URLs that share the same scheme, hostname and 105 * port are considered to be a part of the site and thus belong to the web 106 * asset. Example: the asset with the site `https://www.google.com` contains all 107 * these URLs: * `https://www.google.com/` * `https://www.google.com:443/` * 108 * `https://www.google.com/foo` * `https://www.google.com/foo?bar` * 109 * `https://www.google.com/foo#bar` * `https://user@password:www.google.com/` 110 * But it does not contain these URLs: * `http://www.google.com/` (wrong scheme) 111 * * `https://google.com/` (hostname does not match) * 112 * `https://www.google.com:444/` (port does not match) REQUIRED 113 * @opt_param string target.androidApp.certificate.sha256Fingerprint The 114 * uppercase SHA-265 fingerprint of the certificate. From the PEM certificate, 115 * it can be acquired like this: $ keytool -printcert -file $CERTFILE | grep 116 * SHA256: SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \ 117 * 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 or like this: $ openssl x509 -in 118 * $CERTFILE -noout -fingerprint -sha256 SHA256 119 * Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \ 120 * 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5 In this example, the contents 121 * of this field would be `14:6D:E9:83:C5:73: 122 * 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF: 123 * 44:E5`. If these tools are not available to you, you can convert the PEM 124 * certificate into the DER format, compute the SHA-256 hash of that string and 125 * represent the result as a hexstring (that is, uppercase hexadecimal 126 * representations of each octet, separated by colons). 127 * @opt_param string target.androidApp.packageName Android App assets are 128 * naturally identified by their Java package name. For example, the Google Maps 129 * app uses the package name `com.google.android.apps.maps`. REQUIRED 130 * @opt_param string target.web.site Web assets are identified by a URL that 131 * contains only the scheme, hostname and port parts. The format is 132 * http[s]://[:] Hostnames must be fully qualified: they must end in a single 133 * period ("`.`"). Only the schemes "http" and "https" are currently allowed. 134 * Port numbers are given as a decimal number, and they must be omitted if the 135 * standard port numbers are used: 80 for http and 443 for https. We call this 136 * limited URL the "site". All URLs that share the same scheme, hostname and 137 * port are considered to be a part of the site and thus belong to the web 138 * asset. Example: the asset with the site `https://www.google.com` contains all 139 * these URLs: * `https://www.google.com/` * `https://www.google.com:443/` * 140 * `https://www.google.com/foo` * `https://www.google.com/foo?bar` * 141 * `https://www.google.com/foo#bar` * `https://user@password:www.google.com/` 142 * But it does not contain these URLs: * `http://www.google.com/` (wrong scheme) 143 * * `https://google.com/` (hostname does not match) * 144 * `https://www.google.com:444/` (port does not match) REQUIRED 145 * @return CheckResponse 146 */ 147 public function check($optParams = []) 148 { 149 $params = []; 150 $params = array_merge($params, $optParams); 151 return $this->call('check', [$params], CheckResponse::class); 152 } 153} 154 155// Adding a class alias for backwards compatibility with the previous class name. 156class_alias(Assetlinks::class, 'Google_Service_Digitalassetlinks_Resource_Assetlinks'); 157