@grom.js/bot-api-spec 0.1.0 → 0.3.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 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_ — `{ kind: 'str' }`
29
- - _Type_ is _Integer_ — `{ kind: 'int32' }`
30
- - _Type_ is _Integer_ and _Description_ says "...may have more than 32 significant bits...but it has at most 52 significant bits..." — `{ kind: 'int52' }`
31
- - _Type_ is _Boolean_ — `{ kind: 'bool' }`
32
- - _Type_ is _True_ — `{ kind: 'bool', literal: true }`
33
- - _Type_ is _Float_ — `{ kind: 'float' }`
34
- - _Description_ says "always X" — `{ kind: ..., literal: X }`
35
- - _Type_ is _InputFile_ — `{ kind: 'input-file' }`
36
- - _Type_ is _X_, where X is any API type — `{ kind: 'api-type', name: X }`
37
- - _Type_ is _Array of X_ — `{ kind: 'array', of: X }`
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, `kind` is set to `int52` for such fields/parameters.
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
@@ -17,6 +17,7 @@ interface ApiTypeObject {
17
17
  * Fields of the object representing this type.
18
18
  */
19
19
  fields: Array<FieldOrParam>;
20
+ oneOf?: never;
20
21
  }
21
22
  interface ApiTypeOneOf {
22
23
  /**
@@ -31,6 +32,7 @@ interface ApiTypeOneOf {
31
32
  * Array of possible types this type can be.
32
33
  */
33
34
  oneOf: Array<ValueTypeApiType>;
35
+ fields?: never;
34
36
  }
35
37
  interface ApiMethod {
36
38
  /**
@@ -86,21 +88,21 @@ type ValueType = ValueTypeString | ValueTypeBoolean | ValueTypeInteger32 | Value
86
88
  * `String` value type.
87
89
  */
88
90
  interface ValueTypeString {
89
- kind: 'str';
91
+ type: 'str';
90
92
  literal?: string;
91
93
  }
92
94
  /**
93
95
  * `Boolean` value type.
94
96
  */
95
97
  interface ValueTypeBoolean {
96
- kind: 'bool';
98
+ type: 'bool';
97
99
  literal?: boolean;
98
100
  }
99
101
  /**
100
102
  * `Integer` value type, which fits in a 32-bit integer.
101
103
  */
102
104
  interface ValueTypeInteger32 {
103
- kind: 'int32';
105
+ type: 'int32';
104
106
  literal?: number;
105
107
  }
106
108
  /**
@@ -109,39 +111,39 @@ interface ValueTypeInteger32 {
109
111
  * type are safe for storing values of this type.
110
112
  */
111
113
  interface ValueTypeInteger52 {
112
- kind: 'int52';
114
+ type: 'int52';
113
115
  }
114
116
  /**
115
117
  * `Float` value type.
116
118
  */
117
119
  interface ValueTypeFloat {
118
- kind: 'float';
120
+ type: 'float';
119
121
  }
120
122
  /**
121
123
  * [`InputFile`](https://core.telegram.org/bots/api#inputfile) value type.
122
124
  */
123
125
  interface ValueTypeInputFile {
124
- kind: 'input-file';
126
+ type: 'input-file';
125
127
  }
126
128
  /**
127
129
  * Any {@link ApiType} value type.
128
130
  */
129
131
  interface ValueTypeApiType {
130
- kind: 'api-type';
132
+ type: 'api-type';
131
133
  name: keyof typeof types;
132
134
  }
133
135
  /**
134
136
  * Array of any value type.
135
137
  */
136
138
  interface ValueTypeArray {
137
- kind: 'array';
139
+ type: 'array';
138
140
  of: ValueType;
139
141
  }
140
142
  /**
141
143
  * Union of any value types.
142
144
  */
143
145
  interface ValueTypeUnion {
144
- kind: 'union';
146
+ type: 'union';
145
147
  types: Array<ValueType>;
146
148
  }
147
149
  //#endregion