@bettergi/types 0.0.10 → 0.0.11

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 CHANGED
@@ -16,6 +16,9 @@
16
16
  // 文件访问(受限)
17
17
  /// <reference path="./modules/file.d.ts" />
18
18
 
19
+ // 网络请求(受限)
20
+ /// <reference path="./modules/http.d.ts" />
21
+
19
22
  // 消息通知
20
23
  /// <reference path="./modules/notification.d.ts" />
21
24
 
@@ -0,0 +1,41 @@
1
+ type HttpReponse = {
2
+ /** 状态码 */
3
+ status_code: number;
4
+
5
+ /** 响应头 */
6
+ headers: Record<string, string>;
7
+
8
+ /** 响应体 */
9
+ body: string;
10
+ };
11
+
12
+ declare global {
13
+ /** @since 0.52.0 */
14
+ namespace http {
15
+ /**
16
+ * 发送HTTP请求
17
+ * @param method 请求方法
18
+ * @param url 请求URL
19
+ * @param body 请求体(可选)
20
+ * @param headersJson 请求头(可选)
21
+ * @since 0.52.0
22
+ */
23
+ function request(
24
+ method:
25
+ | "GET"
26
+ | "PUT"
27
+ | "POST"
28
+ | "DELETE"
29
+ | "HEAD"
30
+ | "OPTIONS"
31
+ | "TRACE"
32
+ | "PATCH"
33
+ | "CONNECT",
34
+ url: string,
35
+ body?: string,
36
+ headersJson?: string
37
+ ): Promise<HttpReponse>;
38
+ }
39
+ }
40
+
41
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bettergi/types",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "TypeScript Definitions for BetterGI JavaScript",
5
5
  "type": "module",
6
6
  "author": "Bread Grocery<https://github.com/breadgrocery>",