@grom.js/bot-api-spec 0.6.0 → 0.6.2

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,8 +1,8 @@
1
1
  [![bot-api](https://img.shields.io/badge/v9.3-000?style=flat&logo=telegram&logoColor=%2325A3E1&label=Bot%20API&labelColor=%23000&color=%2325A3E1)][bot-api]
2
- [![npm](https://img.shields.io/npm/v/%40grom.js%2Fbot-api-spec?style=flat&logo=npm&logoColor=%23BB443E&logoSize=auto&label=%C2%A0&labelColor=%23fff&color=%23BB443E)](https://www.npmjs.com/package/@grom.js/tgx)
3
- [![jsr](https://img.shields.io/jsr/v/%40grom/bot-api-spec?style=flat&logo=jsr&logoColor=%231B3646&logoSize=auto&label=%C2%A0&labelColor=%23F3E051&color=%231B3646)](https://jsr.io/@grom/tgx)
2
+ [![npm](https://img.shields.io/npm/v/%40grom.js%2Fbot-api-spec?style=flat&logo=npm&logoColor=%23BB443E&logoSize=auto&label=%C2%A0&labelColor=%23fff&color=%23BB443E)](https://www.npmjs.com/package/@grom.js/bot-api-spec)
3
+ [![jsr](https://img.shields.io/jsr/v/%40grom/bot-api-spec?style=flat&logo=jsr&logoColor=%231B3646&logoSize=auto&label=%C2%A0&labelColor=%23F3E051&color=%231B3646)](https://jsr.io/@grom/bot-api-spec)
4
4
 
5
- [Telegram Bot API](https://core.telegram.org/bots/api) specification as a collection of JavaScript objects in a [custom format](#format).
5
+ [Telegram Bot API][bot-api] specification as a collection of JavaScript objects in a [custom format](#format).
6
6
 
7
7
  ## Motivation
8
8
 
@@ -20,10 +20,7 @@ deno add jsr:@grom/bot-api-spec
20
20
 
21
21
  ## Usage
22
22
 
23
- Root module exports two objects:
24
-
25
- 1. `types` — definition of all Bot API types
26
- 2. `methods` — definition of all Bot API methods
23
+ Root module exports two objects: `types` and `methods`, containing definitions of all Bot API types and methods respectively.
27
24
 
28
25
  ```ts
29
26
  import { types, methods } from '@grom.js/bot-api-spec' // '@grom/bot-api-spec' for JSR
package/dist/format.d.ts CHANGED
@@ -1,9 +1,18 @@
1
+ /**
2
+ * This module exports types for representing Bot API methods and types
3
+ * in a structured format.
4
+ *
5
+ * @module
6
+ */
1
7
  import type { types } from './types.gen.ts';
2
8
  /**
3
9
  * Type defined in the API. It can either be an {@link ApiTypeObject object}
4
10
  * or a {@link ApiTypeOneOf union}.
5
11
  */
6
12
  export type ApiType = ApiTypeObject | ApiTypeOneOf;
13
+ /**
14
+ * Bot API type represented as an object with fields.
15
+ */
7
16
  export interface ApiTypeObject {
8
17
  /**
9
18
  * Name of the type.
@@ -19,6 +28,9 @@ export interface ApiTypeObject {
19
28
  fields: Array<FieldOrParam>;
20
29
  oneOf?: never;
21
30
  }
31
+ /**
32
+ * Bot API type represented as a union of other types.
33
+ */
22
34
  export interface ApiTypeOneOf {
23
35
  /**
24
36
  * Name of the type.
@@ -34,6 +46,9 @@ export interface ApiTypeOneOf {
34
46
  oneOf: Array<ValueTypeApiType>;
35
47
  fields?: never;
36
48
  }
49
+ /**
50
+ * Bot API method with parameters and return type.
51
+ */
37
52
  export interface ApiMethod {
38
53
  /**
39
54
  * Name of the method.
@@ -52,6 +67,9 @@ export interface ApiMethod {
52
67
  */
53
68
  returnType: ValueType;
54
69
  }
70
+ /**
71
+ * Field of a type or parameter of a method.
72
+ */
55
73
  export interface FieldOrParam {
56
74
  /**
57
75
  * Name of the field/parameter.
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAE3C;;;GAGG;AACH,MAAM,MAAM,OAAO,GACb,aAAa,GACb,YAAY,CAAA;AAElB,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,WAAW,EAAE,WAAW,CAAA;IAExB;;OAEG;IACH,MAAM,EAAE,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O,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAA;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,CAAA;IAChB,IAAI,EAAE,MAAM,OAAO,KAAK,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAA;IACb,EAAE,EAAE,SAAS,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;CACxB"}
package/dist/format.js CHANGED
@@ -1,2 +1,8 @@
1
+ /**
2
+ * This module exports types for representing Bot API methods and types
3
+ * in a structured format.
4
+ *
5
+ * @module
6
+ */
1
7
  export {};
2
8
  //# sourceMappingURL=format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * This module exports definitions of all Bot API methods and types.
3
+ *
4
+ * @module
5
+ */
1
6
  export { methods } from './methods.gen.ts';
2
7
  export { types } from './types.gen.ts';
3
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,8 @@
1
+ /**
2
+ * This module exports definitions of all Bot API methods and types.
3
+ *
4
+ * @module
5
+ */
1
6
  export { methods } from "./methods.gen.js";
2
7
  export { types } from "./types.gen.js";
3
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grom.js/bot-api-spec",
3
3
  "type": "module",
4
- "version": "0.6.0",
4
+ "version": "0.6.2",
5
5
  "description": "Telegram Bot API specification as a collection of JavaScript objects in a custom format.",
6
6
  "license": "MIT",
7
7
  "repository": {
package/src/format.ts CHANGED
@@ -1,3 +1,10 @@
1
+ /**
2
+ * This module exports types for representing Bot API methods and types
3
+ * in a structured format.
4
+ *
5
+ * @module
6
+ */
7
+
1
8
  import type { types } from './types.gen.ts'
2
9
 
3
10
  /**
@@ -8,6 +15,9 @@ export type ApiType
8
15
  = | ApiTypeObject
9
16
  | ApiTypeOneOf
10
17
 
18
+ /**
19
+ * Bot API type represented as an object with fields.
20
+ */
11
21
  export interface ApiTypeObject {
12
22
  /**
13
23
  * Name of the type.
@@ -27,6 +37,9 @@ export interface ApiTypeObject {
27
37
  oneOf?: never
28
38
  }
29
39
 
40
+ /**
41
+ * Bot API type represented as a union of other types.
42
+ */
30
43
  export interface ApiTypeOneOf {
31
44
  /**
32
45
  * Name of the type.
@@ -46,6 +59,9 @@ export interface ApiTypeOneOf {
46
59
  fields?: never
47
60
  }
48
61
 
62
+ /**
63
+ * Bot API method with parameters and return type.
64
+ */
49
65
  export interface ApiMethod {
50
66
  /**
51
67
  * Name of the method.
@@ -68,6 +84,9 @@ export interface ApiMethod {
68
84
  returnType: ValueType
69
85
  }
70
86
 
87
+ /**
88
+ * Field of a type or parameter of a method.
89
+ */
71
90
  export interface FieldOrParam {
72
91
  /**
73
92
  * Name of the field/parameter.
package/src/index.ts CHANGED
@@ -1,2 +1,9 @@
1
+ /**
2
+ * This module exports definitions of all Bot API methods and types.
3
+ *
4
+ * @module
5
+ */
6
+
1
7
  export { methods } from './methods.gen.ts'
8
+
2
9
  export { types } from './types.gen.ts'