@maxim_mazurok/gapi.client.webfonts-v1 0.0.20220613
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 +82 -0
- package/package.json +20 -0
- package/readme.md +52 -0
- package/tests.ts +22 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Web Fonts Developer API v1 0.0 */
|
|
2
|
+
// Project: https://developers.google.com/fonts/docs/developer_api
|
|
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://webfonts.googleapis.com/$discovery/rest?version=v1
|
|
13
|
+
// Revision: 20220613
|
|
14
|
+
|
|
15
|
+
/// <reference types="gapi.client" />
|
|
16
|
+
|
|
17
|
+
declare namespace gapi.client {
|
|
18
|
+
/** Load Web Fonts Developer API v1 */
|
|
19
|
+
function load(urlOrObject: "https://webfonts.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
|
|
20
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
21
|
+
function load(name: "webfonts", version: "v1"): Promise<void>;
|
|
22
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
23
|
+
function load(name: "webfonts", version: "v1", callback: () => any): void;
|
|
24
|
+
|
|
25
|
+
namespace webfonts {
|
|
26
|
+
interface Webfont {
|
|
27
|
+
/** The category of the font. */
|
|
28
|
+
category?: string;
|
|
29
|
+
/** The name of the font. */
|
|
30
|
+
family?: string;
|
|
31
|
+
/** The font files (with all supported scripts) for each one of the available variants, as a key : value map. */
|
|
32
|
+
files?: { [P in string]: string };
|
|
33
|
+
/** This kind represents a webfont object in the webfonts service. */
|
|
34
|
+
kind?: string;
|
|
35
|
+
/** The date (format "yyyy-MM-dd") the font was modified for the last time. */
|
|
36
|
+
lastModified?: string;
|
|
37
|
+
/** The scripts supported by the font. */
|
|
38
|
+
subsets?: string[];
|
|
39
|
+
/** The available variants for the font. */
|
|
40
|
+
variants?: string[];
|
|
41
|
+
/** The font version. */
|
|
42
|
+
version?: string;
|
|
43
|
+
}
|
|
44
|
+
interface WebfontList {
|
|
45
|
+
/** The list of fonts currently served by the Google Fonts API. */
|
|
46
|
+
items?: Webfont[];
|
|
47
|
+
/** This kind represents a list of webfont objects in the webfonts service. */
|
|
48
|
+
kind?: string;
|
|
49
|
+
}
|
|
50
|
+
interface WebfontsResource {
|
|
51
|
+
/** Retrieves the list of fonts currently served by the Google Fonts Developer API. */
|
|
52
|
+
list(request?: {
|
|
53
|
+
/** V1 error format. */
|
|
54
|
+
"$.xgafv"?: string;
|
|
55
|
+
/** OAuth access token. */
|
|
56
|
+
access_token?: string;
|
|
57
|
+
/** Data format for response. */
|
|
58
|
+
alt?: string;
|
|
59
|
+
/** JSONP */
|
|
60
|
+
callback?: string;
|
|
61
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
62
|
+
fields?: string;
|
|
63
|
+
/** 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. */
|
|
64
|
+
key?: string;
|
|
65
|
+
/** OAuth 2.0 token for the current user. */
|
|
66
|
+
oauth_token?: string;
|
|
67
|
+
/** Returns response with indentations and line breaks. */
|
|
68
|
+
prettyPrint?: boolean;
|
|
69
|
+
/** 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. */
|
|
70
|
+
quotaUser?: string;
|
|
71
|
+
/** Enables sorting of the list. */
|
|
72
|
+
sort?: string;
|
|
73
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
74
|
+
upload_protocol?: string;
|
|
75
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
76
|
+
uploadType?: string;
|
|
77
|
+
}): Request<WebfontList>;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const webfonts: WebfontsResource;
|
|
81
|
+
}
|
|
82
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.webfonts-v1",
|
|
3
|
+
"version": "0.0.20220613",
|
|
4
|
+
"description": "TypeScript typings for Web Fonts Developer 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 Web Fonts Developer API v1
|
|
2
|
+
|
|
3
|
+
The Google Web Fonts Developer API lets you retrieve information about web fonts served by Google.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/fonts/docs/developer_api).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Web Fonts Developer API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.webfonts-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://webfonts.googleapis.com/$discovery/rest?version=v1', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.webfonts
|
|
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('webfonts', 'v1', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.webfonts
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
After that you can use Web Fonts Developer API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
Retrieves the list of fonts currently served by the Google Fonts Developer API.
|
|
50
|
+
*/
|
|
51
|
+
await gapi.client.webfonts.webfonts.list({ });
|
|
52
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.webfonts-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: 20220613
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://webfonts.googleapis.com/$discovery/rest?version=v1');
|
|
12
|
+
/** now we can use gapi.client.webfonts */
|
|
13
|
+
|
|
14
|
+
run();
|
|
15
|
+
|
|
16
|
+
async function run() {
|
|
17
|
+
/** Retrieves the list of fonts currently served by the Google Fonts Developer API. */
|
|
18
|
+
await gapi.client.webfonts.webfonts.list({
|
|
19
|
+
sort: "Test string",
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
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
|
+
}
|