@maxim_mazurok/gapi.client.acceleratedmobilepageurl-v1 0.0.20220809

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 ADDED
@@ -0,0 +1,114 @@
1
+ /* Type definitions for non-npm package Accelerated Mobile Pages (AMP) URL API v1 0.0 */
2
+ // Project: https://developers.google.com/amp/cache/
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://acceleratedmobilepageurl.googleapis.com/$discovery/rest?version=v1
13
+ // Revision: 20220809
14
+
15
+ /// <reference types="gapi.client" />
16
+
17
+ declare namespace gapi.client {
18
+ /** Load Accelerated Mobile Pages (AMP) URL API v1 */
19
+ function load(urlOrObject: "https://acceleratedmobilepageurl.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
20
+ /** @deprecated Please load APIs with discovery documents. */
21
+ function load(name: "acceleratedmobilepageurl", version: "v1"): Promise<void>;
22
+ /** @deprecated Please load APIs with discovery documents. */
23
+ function load(name: "acceleratedmobilepageurl", version: "v1", callback: () => any): void;
24
+
25
+ namespace acceleratedmobilepageurl {
26
+ interface AmpUrl {
27
+ /** The AMP URL pointing to the publisher's web server. */
28
+ ampUrl?: string;
29
+ /** The [AMP Cache URL](/amp/cache/overview#amp-cache-url-format) pointing to the cached document in the Google AMP Cache. */
30
+ cdnAmpUrl?: string;
31
+ /** The original non-AMP URL. */
32
+ originalUrl?: string;
33
+ }
34
+ interface AmpUrlError {
35
+ /** The error code of an API call. */
36
+ errorCode?: string;
37
+ /** An optional descriptive error message. */
38
+ errorMessage?: string;
39
+ /** The original non-AMP URL. */
40
+ originalUrl?: string;
41
+ }
42
+ interface BatchGetAmpUrlsRequest {
43
+ /** The lookup_strategy being requested. */
44
+ lookupStrategy?: string;
45
+ /** List of URLs to look up for the paired AMP URLs. The URLs are case-sensitive. Up to 50 URLs per lookup (see [Usage Limits](/amp/cache/reference/limits)). */
46
+ urls?: string[];
47
+ }
48
+ interface BatchGetAmpUrlsResponse {
49
+ /**
50
+ * For each URL in BatchAmpUrlsRequest, the URL response. The response might not be in the same order as URLs in the batch request. If BatchAmpUrlsRequest contains duplicate URLs,
51
+ * AmpUrl is generated only once.
52
+ */
53
+ ampUrls?: AmpUrl[];
54
+ /** The errors for requested URLs that have no AMP URL. */
55
+ urlErrors?: AmpUrlError[];
56
+ }
57
+ interface AmpUrlsResource {
58
+ /** Returns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format). */
59
+ batchGet(request: {
60
+ /** V1 error format. */
61
+ "$.xgafv"?: string;
62
+ /** OAuth access token. */
63
+ access_token?: string;
64
+ /** Data format for response. */
65
+ alt?: string;
66
+ /** JSONP */
67
+ callback?: string;
68
+ /** Selector specifying which fields to include in a partial response. */
69
+ fields?: string;
70
+ /** 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. */
71
+ key?: string;
72
+ /** OAuth 2.0 token for the current user. */
73
+ oauth_token?: string;
74
+ /** Returns response with indentations and line breaks. */
75
+ prettyPrint?: boolean;
76
+ /** 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. */
77
+ quotaUser?: string;
78
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
79
+ upload_protocol?: string;
80
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
81
+ uploadType?: string;
82
+ /** Request body */
83
+ resource: BatchGetAmpUrlsRequest;
84
+ }): Request<BatchGetAmpUrlsResponse>;
85
+ batchGet(request: {
86
+ /** V1 error format. */
87
+ "$.xgafv"?: string;
88
+ /** OAuth access token. */
89
+ access_token?: string;
90
+ /** Data format for response. */
91
+ alt?: string;
92
+ /** JSONP */
93
+ callback?: string;
94
+ /** Selector specifying which fields to include in a partial response. */
95
+ fields?: string;
96
+ /** 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. */
97
+ key?: string;
98
+ /** OAuth 2.0 token for the current user. */
99
+ oauth_token?: string;
100
+ /** Returns response with indentations and line breaks. */
101
+ prettyPrint?: boolean;
102
+ /** 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. */
103
+ quotaUser?: string;
104
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
105
+ upload_protocol?: string;
106
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
107
+ uploadType?: string;
108
+ },
109
+ body: BatchGetAmpUrlsRequest): Request<BatchGetAmpUrlsResponse>;
110
+ }
111
+
112
+ const ampUrls: AmpUrlsResource;
113
+ }
114
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.acceleratedmobilepageurl-v1",
3
+ "version": "0.0.20220809",
4
+ "description": "TypeScript typings for Accelerated Mobile Pages (AMP) URL 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,52 @@
1
+ # TypeScript typings for Accelerated Mobile Pages (AMP) URL API v1
2
+
3
+ Retrieves the list of AMP URLs (and equivalent AMP Cache URLs) for a given list of public URL(s).
4
+ For detailed description please check [documentation](https://developers.google.com/amp/cache/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Accelerated Mobile Pages (AMP) URL API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.acceleratedmobilepageurl-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://acceleratedmobilepageurl.googleapis.com/$discovery/rest?version=v1', () => {
29
+ // now we can use:
30
+ // gapi.client.acceleratedmobilepageurl
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('acceleratedmobilepageurl', 'v1', () => {
37
+ // now we can use:
38
+ // gapi.client.acceleratedmobilepageurl
39
+ });
40
+ ```
41
+
42
+
43
+
44
+ After that you can use Accelerated Mobile Pages (AMP) URL API resources: <!-- TODO: make this work for multiple namespaces -->
45
+
46
+ ```typescript
47
+
48
+ /*
49
+ Returns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format).
50
+ */
51
+ await gapi.client.acceleratedmobilepageurl.ampUrls.batchGet({ });
52
+ ```
package/tests.ts ADDED
@@ -0,0 +1,26 @@
1
+ /* This is stub file for gapi.client.acceleratedmobilepageurl-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: 20220809
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://acceleratedmobilepageurl.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.acceleratedmobilepageurl */
13
+
14
+ run();
15
+
16
+ async function run() {
17
+ /** Returns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format). */
18
+ await gapi.client.acceleratedmobilepageurl.ampUrls.batchGet({
19
+ }, {
20
+ lookupStrategy: "Test string",
21
+ urls: [
22
+ "Test string"
23
+ ],
24
+ });
25
+ }
26
+ });
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
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }