@maxim_mazurok/gapi.client.digitalassetlinks-v1 0.0.20220806
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +344 -0
- package/package.json +20 -0
- package/readme.md +62 -0
- package/tests.ts +110 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Digital Asset Links API v1 0.0 */
|
|
2
|
+
// Project: https://developers.google.com/digital-asset-links/
|
|
3
|
+
// Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
|
|
4
|
+
// Nick Amoscato <https://github.com/namoscato>
|
|
5
|
+
// Declan Vong <https://github.com/declanvong>
|
|
6
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
7
|
+
// TypeScript Version: 2.8
|
|
8
|
+
|
|
9
|
+
// IMPORTANT
|
|
10
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
11
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
12
|
+
// Generated from: https://digitalassetlinks.googleapis.com/$discovery/rest?version=v1
|
|
13
|
+
// Revision: 20220806
|
|
14
|
+
|
|
15
|
+
/// <reference types="gapi.client" />
|
|
16
|
+
|
|
17
|
+
declare namespace gapi.client {
|
|
18
|
+
/** Load Digital Asset Links API v1 */
|
|
19
|
+
function load(urlOrObject: "https://digitalassetlinks.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
|
|
20
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
21
|
+
function load(name: "digitalassetlinks", version: "v1"): Promise<void>;
|
|
22
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
23
|
+
function load(name: "digitalassetlinks", version: "v1", callback: () => any): void;
|
|
24
|
+
|
|
25
|
+
namespace digitalassetlinks {
|
|
26
|
+
interface AndroidAppAsset {
|
|
27
|
+
/**
|
|
28
|
+
* 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
|
|
29
|
+
* 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
|
|
30
|
+
* 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
|
|
31
|
+
* 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
|
|
32
|
+
* certificates.) REQUIRED
|
|
33
|
+
*/
|
|
34
|
+
certificate?: CertificateInfo;
|
|
35
|
+
/** 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 */
|
|
36
|
+
packageName?: string;
|
|
37
|
+
}
|
|
38
|
+
interface Asset {
|
|
39
|
+
/** Set if this is an Android App asset. */
|
|
40
|
+
androidApp?: AndroidAppAsset;
|
|
41
|
+
/** Set if this is a web asset. */
|
|
42
|
+
web?: WebAsset;
|
|
43
|
+
}
|
|
44
|
+
interface BulkCheckRequest {
|
|
45
|
+
/** Same configuration as in Check request, all statements checks will use same configurations. */
|
|
46
|
+
allowGoogleInternalDataSources?: boolean;
|
|
47
|
+
/** If specified, will be used in any given template statement that doesn’t specify a relation. */
|
|
48
|
+
defaultRelation?: string;
|
|
49
|
+
/** If specified, will be used in any given template statement that doesn’t specify a source. */
|
|
50
|
+
defaultSource?: Asset;
|
|
51
|
+
/** If specified, will be used in any given template statement that doesn’t specify a target. */
|
|
52
|
+
defaultTarget?: Asset;
|
|
53
|
+
/** Same configuration as in Check request, all statements checks will use same configurations. */
|
|
54
|
+
skipCacheLookup?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* List of statements to check. For each statement, you can omit a field if the corresponding default_* field below was supplied. Minimum 1 statement; maximum 1,000 statements. Any
|
|
57
|
+
* additional statements will be ignored.
|
|
58
|
+
*/
|
|
59
|
+
statements?: StatementTemplate[];
|
|
60
|
+
}
|
|
61
|
+
interface BulkCheckResponse {
|
|
62
|
+
/** Error code for the entire request. Present only if the entire request failed. Individual check errors will not trigger the presence of this field. */
|
|
63
|
+
bulkErrorCode?: string;
|
|
64
|
+
/** List of results for each check request. Results are returned in the same order in which they were sent in the request. */
|
|
65
|
+
checkResults?: CheckResponse[];
|
|
66
|
+
}
|
|
67
|
+
interface CertificateInfo {
|
|
68
|
+
/**
|
|
69
|
+
* 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:
|
|
70
|
+
* 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
|
|
71
|
+
* 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
|
|
72
|
+
* `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
|
|
73
|
+
* 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
|
|
74
|
+
* colons).
|
|
75
|
+
*/
|
|
76
|
+
sha256Fingerprint?: string;
|
|
77
|
+
}
|
|
78
|
+
interface CheckResponse {
|
|
79
|
+
/**
|
|
80
|
+
* 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
|
|
81
|
+
* 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
|
|
82
|
+
* not attempt to programmatically parse this data. For programmatic access, use the error_code field below.
|
|
83
|
+
*/
|
|
84
|
+
debugString?: string;
|
|
85
|
+
/** Error codes that describe the result of the Check operation. */
|
|
86
|
+
errorCode?: string[];
|
|
87
|
+
/** Set to true if the assets specified in the request are linked by the relation specified in the request. */
|
|
88
|
+
linked?: boolean;
|
|
89
|
+
/** From serving time, how much longer the response should be considered valid barring further updates. REQUIRED */
|
|
90
|
+
maxAge?: string;
|
|
91
|
+
}
|
|
92
|
+
interface ListResponse {
|
|
93
|
+
/**
|
|
94
|
+
* 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
|
|
95
|
+
* 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
|
|
96
|
+
* not attempt to programmatically parse this data. For programmatic access, use the error_code field below.
|
|
97
|
+
*/
|
|
98
|
+
debugString?: string;
|
|
99
|
+
/** Error codes that describe the result of the List operation. */
|
|
100
|
+
errorCode?: string[];
|
|
101
|
+
/** From serving time, how much longer the response should be considered valid barring further updates. REQUIRED */
|
|
102
|
+
maxAge?: string;
|
|
103
|
+
/** A list of all the matching statements that have been found. */
|
|
104
|
+
statements?: Statement[];
|
|
105
|
+
}
|
|
106
|
+
interface Statement {
|
|
107
|
+
/**
|
|
108
|
+
* 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
|
|
109
|
+
* relation. We identify relations with strings of the format `/`, where `` must be one of a set of pre-defined purpose categories, and `` is a free-form lowercase alphanumeric string
|
|
110
|
+
* 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.
|
|
111
|
+
* Example: `delegate_permission/common.handle_all_urls` REQUIRED
|
|
112
|
+
*/
|
|
113
|
+
relation?: string;
|
|
114
|
+
/** Every statement has a source asset. REQUIRED */
|
|
115
|
+
source?: Asset;
|
|
116
|
+
/** Every statement has a target asset. REQUIRED */
|
|
117
|
+
target?: Asset;
|
|
118
|
+
}
|
|
119
|
+
interface StatementTemplate {
|
|
120
|
+
/** The relationship being asserted between the source and target. If omitted, you must specify a BulkCheckRequest.default_relation value to use here. */
|
|
121
|
+
relation?: string;
|
|
122
|
+
/** The source asset that is asserting the statement. If omitted, you must specify a BulkCheckRequest.default_source value to use here. */
|
|
123
|
+
source?: Asset;
|
|
124
|
+
/** The target that the source is declaring the relationship with. If omitted, you must specify a BulkCheckRequest.default_target to use here. */
|
|
125
|
+
target?: Asset;
|
|
126
|
+
}
|
|
127
|
+
interface WebAsset {
|
|
128
|
+
/**
|
|
129
|
+
* Web assets are identified by a URL that contains only the scheme, hostname and port parts. The format is http[s]://[:] Hostnames must be fully qualified: they must end in a single
|
|
130
|
+
* 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
|
|
131
|
+
* 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
|
|
132
|
+
* 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/` *
|
|
133
|
+
* `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: *
|
|
134
|
+
* `http://www.google.com/` (wrong scheme) * `https://google.com/` (hostname does not match) * `https://www.google.com:444/` (port does not match) REQUIRED
|
|
135
|
+
*/
|
|
136
|
+
site?: string;
|
|
137
|
+
}
|
|
138
|
+
interface AssetlinksResource {
|
|
139
|
+
/**
|
|
140
|
+
* Send a bundle of statement checks in a single RPC to minimize latency and service load. Statements need not be all for the same source and/or target. We recommend using this method
|
|
141
|
+
* when you need to check more than one statement in a short period of time.
|
|
142
|
+
*/
|
|
143
|
+
bulkCheck(request: {
|
|
144
|
+
/** V1 error format. */
|
|
145
|
+
"$.xgafv"?: string;
|
|
146
|
+
/** OAuth access token. */
|
|
147
|
+
access_token?: string;
|
|
148
|
+
/** Data format for response. */
|
|
149
|
+
alt?: string;
|
|
150
|
+
/** JSONP */
|
|
151
|
+
callback?: string;
|
|
152
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
153
|
+
fields?: string;
|
|
154
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
155
|
+
key?: string;
|
|
156
|
+
/** OAuth 2.0 token for the current user. */
|
|
157
|
+
oauth_token?: string;
|
|
158
|
+
/** Returns response with indentations and line breaks. */
|
|
159
|
+
prettyPrint?: boolean;
|
|
160
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
161
|
+
quotaUser?: string;
|
|
162
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
163
|
+
upload_protocol?: string;
|
|
164
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
165
|
+
uploadType?: string;
|
|
166
|
+
/** Request body */
|
|
167
|
+
resource: BulkCheckRequest;
|
|
168
|
+
}): Request<BulkCheckResponse>;
|
|
169
|
+
bulkCheck(request: {
|
|
170
|
+
/** V1 error format. */
|
|
171
|
+
"$.xgafv"?: string;
|
|
172
|
+
/** OAuth access token. */
|
|
173
|
+
access_token?: string;
|
|
174
|
+
/** Data format for response. */
|
|
175
|
+
alt?: string;
|
|
176
|
+
/** JSONP */
|
|
177
|
+
callback?: string;
|
|
178
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
179
|
+
fields?: string;
|
|
180
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
181
|
+
key?: string;
|
|
182
|
+
/** OAuth 2.0 token for the current user. */
|
|
183
|
+
oauth_token?: string;
|
|
184
|
+
/** Returns response with indentations and line breaks. */
|
|
185
|
+
prettyPrint?: boolean;
|
|
186
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
187
|
+
quotaUser?: string;
|
|
188
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
189
|
+
upload_protocol?: string;
|
|
190
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
191
|
+
uploadType?: string;
|
|
192
|
+
},
|
|
193
|
+
body: BulkCheckRequest): Request<BulkCheckResponse>;
|
|
194
|
+
/**
|
|
195
|
+
* 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
|
|
196
|
+
* 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
|
|
197
|
+
* 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
|
|
198
|
+
* 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
|
|
199
|
+
* 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
|
|
200
|
+
* 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
|
|
201
|
+
* that the website's statements have not been altered by a third party. For more information, see the [Digital Asset Links technical design
|
|
202
|
+
* specification](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).
|
|
203
|
+
*/
|
|
204
|
+
check(request?: {
|
|
205
|
+
/** V1 error format. */
|
|
206
|
+
"$.xgafv"?: string;
|
|
207
|
+
/** OAuth access token. */
|
|
208
|
+
access_token?: string;
|
|
209
|
+
/** Data format for response. */
|
|
210
|
+
alt?: string;
|
|
211
|
+
/** JSONP */
|
|
212
|
+
callback?: string;
|
|
213
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
214
|
+
fields?: string;
|
|
215
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
216
|
+
key?: string;
|
|
217
|
+
/** OAuth 2.0 token for the current user. */
|
|
218
|
+
oauth_token?: string;
|
|
219
|
+
/** Returns response with indentations and line breaks. */
|
|
220
|
+
prettyPrint?: boolean;
|
|
221
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
222
|
+
quotaUser?: string;
|
|
223
|
+
/**
|
|
224
|
+
* Query string for the relation. We identify relations with strings of the format `/`, where `` must be one of a set of pre-defined purpose categories, and `` is a free-form
|
|
225
|
+
* 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
|
|
226
|
+
* 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
|
|
227
|
+
* `delegate_permission/common.handle_all_urls` matches an asset link with relation `delegate_permission/common.handle_all_urls`.
|
|
228
|
+
*/
|
|
229
|
+
relation?: string;
|
|
230
|
+
/**
|
|
231
|
+
* 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:
|
|
232
|
+
* 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
|
|
233
|
+
* 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
|
|
234
|
+
* `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
|
|
235
|
+
* 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
|
|
236
|
+
* colons).
|
|
237
|
+
*/
|
|
238
|
+
"source.androidApp.certificate.sha256Fingerprint"?: string;
|
|
239
|
+
/** 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 */
|
|
240
|
+
"source.androidApp.packageName"?: string;
|
|
241
|
+
/**
|
|
242
|
+
* Web assets are identified by a URL that contains only the scheme, hostname and port parts. The format is http[s]://[:] Hostnames must be fully qualified: they must end in a
|
|
243
|
+
* 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
|
|
244
|
+
* 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
|
|
245
|
+
* 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/` *
|
|
246
|
+
* `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
|
|
247
|
+
* 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)
|
|
248
|
+
* REQUIRED
|
|
249
|
+
*/
|
|
250
|
+
"source.web.site"?: string;
|
|
251
|
+
/**
|
|
252
|
+
* 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:
|
|
253
|
+
* 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
|
|
254
|
+
* 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
|
|
255
|
+
* `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
|
|
256
|
+
* 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
|
|
257
|
+
* colons).
|
|
258
|
+
*/
|
|
259
|
+
"target.androidApp.certificate.sha256Fingerprint"?: string;
|
|
260
|
+
/** 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 */
|
|
261
|
+
"target.androidApp.packageName"?: string;
|
|
262
|
+
/**
|
|
263
|
+
* Web assets are identified by a URL that contains only the scheme, hostname and port parts. The format is http[s]://[:] Hostnames must be fully qualified: they must end in a
|
|
264
|
+
* 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
|
|
265
|
+
* 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
|
|
266
|
+
* 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/` *
|
|
267
|
+
* `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
|
|
268
|
+
* 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)
|
|
269
|
+
* REQUIRED
|
|
270
|
+
*/
|
|
271
|
+
"target.web.site"?: string;
|
|
272
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
273
|
+
upload_protocol?: string;
|
|
274
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
275
|
+
uploadType?: string;
|
|
276
|
+
}): Request<CheckResponse>;
|
|
277
|
+
}
|
|
278
|
+
interface StatementsResource {
|
|
279
|
+
/**
|
|
280
|
+
* 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
|
|
281
|
+
* 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
|
|
282
|
+
* 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
|
|
283
|
+
* 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
|
|
284
|
+
* 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
|
|
285
|
+
* a device, the feature would make it easy to navigate to the corresponding web site or Google+ profile.
|
|
286
|
+
*/
|
|
287
|
+
list(request?: {
|
|
288
|
+
/** V1 error format. */
|
|
289
|
+
"$.xgafv"?: string;
|
|
290
|
+
/** OAuth access token. */
|
|
291
|
+
access_token?: string;
|
|
292
|
+
/** Data format for response. */
|
|
293
|
+
alt?: string;
|
|
294
|
+
/** JSONP */
|
|
295
|
+
callback?: string;
|
|
296
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
297
|
+
fields?: string;
|
|
298
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
299
|
+
key?: string;
|
|
300
|
+
/** OAuth 2.0 token for the current user. */
|
|
301
|
+
oauth_token?: string;
|
|
302
|
+
/** Returns response with indentations and line breaks. */
|
|
303
|
+
prettyPrint?: boolean;
|
|
304
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
305
|
+
quotaUser?: string;
|
|
306
|
+
/**
|
|
307
|
+
* 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
|
|
308
|
+
* 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.
|
|
309
|
+
* Example: A query with relation `delegate_permission/common.handle_all_urls` matches an asset link with relation `delegate_permission/common.handle_all_urls`.
|
|
310
|
+
*/
|
|
311
|
+
relation?: string;
|
|
312
|
+
/**
|
|
313
|
+
* 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:
|
|
314
|
+
* 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
|
|
315
|
+
* 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
|
|
316
|
+
* `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
|
|
317
|
+
* 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
|
|
318
|
+
* colons).
|
|
319
|
+
*/
|
|
320
|
+
"source.androidApp.certificate.sha256Fingerprint"?: string;
|
|
321
|
+
/** 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 */
|
|
322
|
+
"source.androidApp.packageName"?: string;
|
|
323
|
+
/**
|
|
324
|
+
* Web assets are identified by a URL that contains only the scheme, hostname and port parts. The format is http[s]://[:] Hostnames must be fully qualified: they must end in a
|
|
325
|
+
* 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
|
|
326
|
+
* 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
|
|
327
|
+
* 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/` *
|
|
328
|
+
* `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
|
|
329
|
+
* 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)
|
|
330
|
+
* REQUIRED
|
|
331
|
+
*/
|
|
332
|
+
"source.web.site"?: string;
|
|
333
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
334
|
+
upload_protocol?: string;
|
|
335
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
336
|
+
uploadType?: string;
|
|
337
|
+
}): Request<ListResponse>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const assetlinks: AssetlinksResource;
|
|
341
|
+
|
|
342
|
+
const statements: StatementsResource;
|
|
343
|
+
}
|
|
344
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.digitalassetlinks-v1",
|
|
3
|
+
"version": "0.0.20220806",
|
|
4
|
+
"description": "TypeScript typings for Digital Asset Links API v1",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"email": "maxim@mazurok.com",
|
|
8
|
+
"name": "Maxim Mazurok",
|
|
9
|
+
"url": "https://maxim.mazurok.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
14
|
+
},
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/gapi.client": "*",
|
|
18
|
+
"@types/gapi.client.discovery": "*"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# TypeScript typings for Digital Asset Links API v1
|
|
2
|
+
|
|
3
|
+
Discovers relationships between online assets such as websites or mobile apps.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/digital-asset-links/).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Digital Asset Links API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.digitalassetlinks-v1 --save-dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
You need to initialize Google API client in your code:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
gapi.load('client', () => {
|
|
20
|
+
// now we can use gapi.client
|
|
21
|
+
// ...
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then load api client wrapper:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
gapi.client.load('https://digitalassetlinks.googleapis.com/$discovery/rest?version=v1', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.digitalassetlinks
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
|
|
36
|
+
gapi.client.load('digitalassetlinks', 'v1', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.digitalassetlinks
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
After that you can use Digital Asset Links API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
Send a bundle of statement checks in a single RPC to minimize latency and service load. Statements need not be all for the same source and/or target. We recommend using this method when you need to check more than one statement in a short period of time.
|
|
50
|
+
*/
|
|
51
|
+
await gapi.client.digitalassetlinks.assetlinks.bulkCheck({ });
|
|
52
|
+
|
|
53
|
+
/*
|
|
54
|
+
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).
|
|
55
|
+
*/
|
|
56
|
+
await gapi.client.digitalassetlinks.assetlinks.check({ });
|
|
57
|
+
|
|
58
|
+
/*
|
|
59
|
+
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.
|
|
60
|
+
*/
|
|
61
|
+
await gapi.client.digitalassetlinks.statements.list({ });
|
|
62
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.digitalassetlinks-v1 definition tests */
|
|
2
|
+
// IMPORTANT
|
|
3
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
4
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
5
|
+
|
|
6
|
+
// Revision: 20220806
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://digitalassetlinks.googleapis.com/$discovery/rest?version=v1');
|
|
12
|
+
/** now we can use gapi.client.digitalassetlinks */
|
|
13
|
+
|
|
14
|
+
run();
|
|
15
|
+
|
|
16
|
+
async function run() {
|
|
17
|
+
/**
|
|
18
|
+
* Send a bundle of statement checks in a single RPC to minimize latency and service load. Statements need not be all for the same source and/or target. We recommend using this method when
|
|
19
|
+
* you need to check more than one statement in a short period of time.
|
|
20
|
+
*/
|
|
21
|
+
await gapi.client.digitalassetlinks.assetlinks.bulkCheck({
|
|
22
|
+
}, {
|
|
23
|
+
allowGoogleInternalDataSources: true,
|
|
24
|
+
defaultRelation: "Test string",
|
|
25
|
+
defaultSource: {
|
|
26
|
+
androidApp: {
|
|
27
|
+
certificate: {
|
|
28
|
+
sha256Fingerprint: "Test string",
|
|
29
|
+
},
|
|
30
|
+
packageName: "Test string",
|
|
31
|
+
},
|
|
32
|
+
web: {
|
|
33
|
+
site: "Test string",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
defaultTarget: {
|
|
37
|
+
androidApp: {
|
|
38
|
+
certificate: {
|
|
39
|
+
sha256Fingerprint: "Test string",
|
|
40
|
+
},
|
|
41
|
+
packageName: "Test string",
|
|
42
|
+
},
|
|
43
|
+
web: {
|
|
44
|
+
site: "Test string",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
skipCacheLookup: true,
|
|
48
|
+
statements: [
|
|
49
|
+
{
|
|
50
|
+
relation: "Test string",
|
|
51
|
+
source: {
|
|
52
|
+
androidApp: {
|
|
53
|
+
certificate: {
|
|
54
|
+
sha256Fingerprint: "Test string",
|
|
55
|
+
},
|
|
56
|
+
packageName: "Test string",
|
|
57
|
+
},
|
|
58
|
+
web: {
|
|
59
|
+
site: "Test string",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
target: {
|
|
63
|
+
androidApp: {
|
|
64
|
+
certificate: {
|
|
65
|
+
sha256Fingerprint: "Test string",
|
|
66
|
+
},
|
|
67
|
+
packageName: "Test string",
|
|
68
|
+
},
|
|
69
|
+
web: {
|
|
70
|
+
site: "Test string",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
});
|
|
76
|
+
/**
|
|
77
|
+
* 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
|
|
78
|
+
* 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
|
|
79
|
+
* 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
|
|
80
|
+
* 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
|
|
81
|
+
* 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
|
|
82
|
+
* 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
|
|
83
|
+
* statements have not been altered by a third party. For more information, see the [Digital Asset Links technical design
|
|
84
|
+
* specification](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).
|
|
85
|
+
*/
|
|
86
|
+
await gapi.client.digitalassetlinks.assetlinks.check({
|
|
87
|
+
relation: "Test string",
|
|
88
|
+
"source.androidApp.certificate.sha256Fingerprint": "Test string",
|
|
89
|
+
"source.androidApp.packageName": "Test string",
|
|
90
|
+
"source.web.site": "Test string",
|
|
91
|
+
"target.androidApp.certificate.sha256Fingerprint": "Test string",
|
|
92
|
+
"target.androidApp.packageName": "Test string",
|
|
93
|
+
"target.web.site": "Test string",
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* 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
|
|
97
|
+
* 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
|
|
98
|
+
* 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
|
|
99
|
+
* 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
|
|
100
|
+
* 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
|
|
101
|
+
* device, the feature would make it easy to navigate to the corresponding web site or Google+ profile.
|
|
102
|
+
*/
|
|
103
|
+
await gapi.client.digitalassetlinks.statements.list({
|
|
104
|
+
relation: "Test string",
|
|
105
|
+
"source.androidApp.certificate.sha256Fingerprint": "Test string",
|
|
106
|
+
"source.androidApp.packageName": "Test string",
|
|
107
|
+
"source.web.site": "Test string",
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": ["es6", "dom"],
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noImplicitThis": true,
|
|
7
|
+
"strictNullChecks": true,
|
|
8
|
+
"baseUrl": "../",
|
|
9
|
+
"typeRoots": [
|
|
10
|
+
"../"
|
|
11
|
+
],
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"strictFunctionTypes": true
|
|
16
|
+
},
|
|
17
|
+
"files": ["index.d.ts", "tests.ts"]
|
|
18
|
+
}
|