@grom.js/bot-api-spec 0.1.0 → 0.2.0
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/README.md +11 -14
- package/dist/index.d.ts +9 -9
- package/dist/index.js +2777 -2777
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
[Telegram Bot API](https://core.telegram.org/bots/api) specification as a collection of JavaScript objects in a [custom format](#format).
|
|
2
2
|
|
|
3
|
-
> ⚠️ Work in progress.
|
|
4
|
-
|
|
5
3
|
## Motivation
|
|
6
4
|
|
|
7
5
|
Automatically generate tools, libraries, MCP servers, custom documentations, etc.
|
|
@@ -25,17 +23,16 @@ We define custom value types to represent types of the fields and parameters, to
|
|
|
25
23
|
|
|
26
24
|
Below are the rules how we map type of a field/parameter to the `ValueType`:
|
|
27
25
|
|
|
28
|
-
- _Type_ is _String_ — `{
|
|
29
|
-
- _Type_ is _Integer_ — `{
|
|
30
|
-
- _Type_ is _Integer_ and _Description_ says "...may have more than 32 significant bits...but it has at most 52 significant bits..." — `{
|
|
31
|
-
- _Type_ is _Boolean_ — `{
|
|
32
|
-
- _Type_ is _True_ — `{
|
|
33
|
-
- _Type_ is _Float_ — `{
|
|
34
|
-
-
|
|
35
|
-
- _Type_ is
|
|
36
|
-
- _Type_ is
|
|
37
|
-
- _Type_ is
|
|
38
|
-
- _Type_ is _X or Y or ..._ — `{ kind: 'union', types: [X, Y, ...] }`
|
|
26
|
+
- _Type_ is _String_ — `{ type: 'str' }`
|
|
27
|
+
- _Type_ is _Integer_ — `{ type: 'int32' }`
|
|
28
|
+
- _Type_ is _Integer_ and _Description_ says "...may have more than 32 significant bits...but it has at most 52 significant bits..." — `{ type: 'int52' }`
|
|
29
|
+
- _Type_ is _Boolean_ — `{ type: 'bool' }`
|
|
30
|
+
- _Type_ is _True_ — `{ type: 'bool', literal: true }`
|
|
31
|
+
- _Type_ is _Float_ — `{ type: 'float' }`
|
|
32
|
+
- _Type_ is _InputFile_ — `{ type: 'input-file' }`
|
|
33
|
+
- _Type_ is _X_, where X is any API type — `{ type: 'api-type', name: X }`
|
|
34
|
+
- _Type_ is _Array of X_ — `{ type: 'array', of: X }`
|
|
35
|
+
- _Type_ is _X or Y or ..._ — `{ type: 'union', types: [X, Y, ...] }`
|
|
39
36
|
|
|
40
37
|
### Descriptions
|
|
41
38
|
|
|
@@ -44,4 +41,4 @@ Objects also include descriptions of the API types, methods, fields, and paramet
|
|
|
44
41
|
- Description is an object with a single `markdown` property, a string containing the description in Markdown format with formatting (**bold**, _italic_, etc.) and links preserved.
|
|
45
42
|
- "_Optional._" prefix in field descriptions is omitted; instead, the `required` property is set to `false` for such fields.
|
|
46
43
|
- "JSON-serialized..." in field/parameter descriptions is omitted; instead, the `jsonSerialized` property is set to `true` for such fields/parameters.
|
|
47
|
-
- "...may have more than 32 significant bits...but it has at most 52 significant bits..." in _Integer_ field/parameter descriptions is omitted; instead, `
|
|
44
|
+
- "...may have more than 32 significant bits...but it has at most 52 significant bits..." in _Integer_ field/parameter descriptions is omitted; instead, `type` is set to `int52` for such fields/parameters.
|
package/dist/index.d.ts
CHANGED
|
@@ -86,21 +86,21 @@ type ValueType = ValueTypeString | ValueTypeBoolean | ValueTypeInteger32 | Value
|
|
|
86
86
|
* `String` value type.
|
|
87
87
|
*/
|
|
88
88
|
interface ValueTypeString {
|
|
89
|
-
|
|
89
|
+
type: 'str';
|
|
90
90
|
literal?: string;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
93
|
* `Boolean` value type.
|
|
94
94
|
*/
|
|
95
95
|
interface ValueTypeBoolean {
|
|
96
|
-
|
|
96
|
+
type: 'bool';
|
|
97
97
|
literal?: boolean;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* `Integer` value type, which fits in a 32-bit integer.
|
|
101
101
|
*/
|
|
102
102
|
interface ValueTypeInteger32 {
|
|
103
|
-
|
|
103
|
+
type: 'int32';
|
|
104
104
|
literal?: number;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
@@ -109,39 +109,39 @@ interface ValueTypeInteger32 {
|
|
|
109
109
|
* type are safe for storing values of this type.
|
|
110
110
|
*/
|
|
111
111
|
interface ValueTypeInteger52 {
|
|
112
|
-
|
|
112
|
+
type: 'int52';
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* `Float` value type.
|
|
116
116
|
*/
|
|
117
117
|
interface ValueTypeFloat {
|
|
118
|
-
|
|
118
|
+
type: 'float';
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* [`InputFile`](https://core.telegram.org/bots/api#inputfile) value type.
|
|
122
122
|
*/
|
|
123
123
|
interface ValueTypeInputFile {
|
|
124
|
-
|
|
124
|
+
type: 'input-file';
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* Any {@link ApiType} value type.
|
|
128
128
|
*/
|
|
129
129
|
interface ValueTypeApiType {
|
|
130
|
-
|
|
130
|
+
type: 'api-type';
|
|
131
131
|
name: keyof typeof types;
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
134
134
|
* Array of any value type.
|
|
135
135
|
*/
|
|
136
136
|
interface ValueTypeArray {
|
|
137
|
-
|
|
137
|
+
type: 'array';
|
|
138
138
|
of: ValueType;
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Union of any value types.
|
|
142
142
|
*/
|
|
143
143
|
interface ValueTypeUnion {
|
|
144
|
-
|
|
144
|
+
type: 'union';
|
|
145
145
|
types: Array<ValueType>;
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|