Skip to content

Commit 1b46599

Browse files
🔄 Sync from private repository - 2026-02-04 13:22:39
1 parent e7bda42 commit 1b46599

5 files changed

Lines changed: 106 additions & 76 deletions

File tree

API.en.md

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The following icons indicate API compatibility when running in background trigge
2222
- [storage](#storage) ✅ - Local key-value storage
2323
- [icloud](#icloud) ✅ - iCloud file operations
2424
- [file](#file) ✅ - File system operations
25-
- [http](#http) ✅ - Network requests
25+
- [http](#http) ✅ - Network requests (Async Promise-based)
2626
- [network](#network) ⚠️ - Network operations
2727
- [app](#app) ⚠️ - App operations and management
2828
- [haptic](#haptic) ⚠️ - Haptic feedback
@@ -796,146 +796,158 @@ Check if the Root Helper is available
796796

797797
![Full Support](https://img.shields.io/badge/Trigger-Full-brightgreen)
798798

799-
Network requests
799+
Network requests (Async Promise-based)
800800

801801
### `http.get`
802802

803803
**Signature:** `get(url, options?)`
804804

805-
Send a GET request
805+
Send a GET request (async, returns Promise)
806806

807807
**Parameters:**
808808

809809
| Name | Type | Description | Optional |
810810
|------|------|-------------|----------|
811811
| `url` | `string` | Target URL | No |
812-
| `options` | `object` | Request options { headers, timeout } | Yes |
812+
| `options` | `object` | Request options { headers, timeout, insecure, sync } | Yes |
813813

814-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
814+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
815815

816-
*Object containing success status, status code, response data, and response headers*
816+
*Returns a Promise that resolves with success status, status code, response data, and headers. Set sync: true for synchronous mode*
817817

818818
---
819819

820820
### `http.post`
821821

822822
**Signature:** `post(url, options?)`
823823

824-
Send a POST request
824+
Send a POST request (async, returns Promise)
825825

826826
**Parameters:**
827827

828828
| Name | Type | Description | Optional |
829829
|------|------|-------------|----------|
830830
| `url` | `string` | Target URL | No |
831-
| `options` | `object` | Request options { body, headers, timeout, insecure } | Yes |
831+
| `options` | `object` | Request options { body, headers, timeout, insecure, sync } | Yes |
832832

833-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
833+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
834+
835+
*Returns a Promise that resolves with the response. Set sync: true for synchronous mode*
834836

835837
---
836838

837839
### `http.put`
838840

839841
**Signature:** `put(url, options?)`
840842

841-
Send a PUT request
843+
Send a PUT request (async, returns Promise)
842844

843845
**Parameters:**
844846

845847
| Name | Type | Description | Optional |
846848
|------|------|-------------|----------|
847849
| `url` | `string` | Target URL | No |
848-
| `options` | `object` | Request options { body, headers, timeout, insecure } | Yes |
850+
| `options` | `object` | Request options { body, headers, timeout, insecure, sync } | Yes |
851+
852+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
849853

850-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
854+
*Returns a Promise that resolves with the response*
851855

852856
---
853857

854858
### `http.delete`
855859

856860
**Signature:** `delete(url, options?)`
857861

858-
Send a DELETE request
862+
Send a DELETE request (async, returns Promise)
859863

860864
**Parameters:**
861865

862866
| Name | Type | Description | Optional |
863867
|------|------|-------------|----------|
864868
| `url` | `string` | Target URL | No |
865-
| `options` | `object` | Request options { headers, timeout, insecure } | Yes |
869+
| `options` | `object` | Request options { headers, timeout, insecure, sync } | Yes |
870+
871+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
866872

867-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
873+
*Returns a Promise that resolves with the response*
868874

869875
---
870876

871877
### `http.patch`
872878

873879
**Signature:** `patch(url, options?)`
874880

875-
Send a PATCH request
881+
Send a PATCH request (async, returns Promise)
876882

877883
**Parameters:**
878884

879885
| Name | Type | Description | Optional |
880886
|------|------|-------------|----------|
881887
| `url` | `string` | Target URL | No |
882-
| `options` | `object` | Request options { body, headers, timeout, insecure } | Yes |
888+
| `options` | `object` | Request options { body, headers, timeout, insecure, sync } | Yes |
883889

884-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
890+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
891+
892+
*Returns a Promise that resolves with the response*
885893

886894
---
887895

888896
### `http.head`
889897

890898
**Signature:** `head(url, options?)`
891899

892-
Send a HEAD request
900+
Send a HEAD request (async, returns Promise)
893901

894902
**Parameters:**
895903

896904
| Name | Type | Description | Optional |
897905
|------|------|-------------|----------|
898906
| `url` | `string` | Target URL | No |
899-
| `options` | `object` | Request options { headers, timeout, insecure } | Yes |
907+
| `options` | `object` | Request options { headers, timeout, insecure, sync } | Yes |
908+
909+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
900910

901-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
911+
*Returns a Promise that resolves with the response (data is typically empty for HEAD requests)*
902912

903913
---
904914

905915
### `http.request`
906916

907917
**Signature:** `request(url, options)`
908918

909-
Send a custom HTTP request
919+
Send a custom HTTP request (async, returns Promise)
910920

911921
**Parameters:**
912922

913923
| Name | Type | Description | Optional |
914924
|------|------|-------------|----------|
915925
| `url` | `string` | Target URL | No |
916-
| `options` | `object` | Request options { method, body, headers, timeout, insecure } | No |
926+
| `options` | `object` | Request options { method, body, headers, timeout, insecure, sync } | No |
917927

918-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
928+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
929+
930+
*Returns a Promise that resolves with the response*
919931

920932
---
921933

922934
### `http.download`
923935

924936
**Signature:** `download(url, path, options?)`
925937

926-
Download a file from a URL
938+
Download a file (async, returns Promise)
927939

928940
**Parameters:**
929941

930942
| Name | Type | Description | Optional |
931943
|------|------|-------------|----------|
932944
| `url` | `string` | Download source URL | No |
933945
| `path` | `string` | Local destination path to save the file | No |
934-
| `options` | `object` | Request options { insecure } | Yes |
946+
| `options` | `object` | Request options { insecure, sync } | Yes |
935947

936-
**Returns:** `{ success: boolean, path?: string, error?: string }`
948+
**Returns:** `Promise<{ success: boolean, path?: string, error?: string }>`
937949

938-
*Object containing success status and the local file path*
950+
*Returns a Promise that resolves with success status and local file path*
939951

940952
---
941953

API.md

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ The following icons indicate API compatibility when running in background trigge
2222
- [storage](#storage) ✅ - 本地存储
2323
- [icloud](#icloud) ✅ - iCloud 文件操作
2424
- [file](#file) ✅ - 文件操作
25-
- [http](#http) ✅ - 网络请求
25+
- [http](#http) ✅ - 网络请求(异步 Promise 模式)
2626
- [network](#network) ⚠️ - 网络操作
2727
- [app](#app) ⚠️ - 应用操作与管理
2828
- [haptic](#haptic) ⚠️ - 触觉反馈
@@ -795,146 +795,158 @@ iCloud 文件操作
795795

796796
![Full Support](https://img.shields.io/badge/Trigger-Full-brightgreen)
797797

798-
网络请求
798+
网络请求(异步 Promise 模式)
799799

800800
### `http.get`
801801

802802
**Signature:** `get(url, options?)`
803803

804-
发送 GET 请求
804+
发送 GET 请求(异步,返回 Promise)
805805

806806
**Parameters:**
807807

808808
| Name | Type | Description | Optional |
809809
|------|------|-------------|----------|
810810
| `url` | `string` | 请求地址 | No |
811-
| `options` | `object` | 请求选项 { headers, timeout, insecure } | Yes |
811+
| `options` | `object` | 请求选项 { headers, timeout, insecure, sync } | Yes |
812812

813-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
813+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
814814

815-
*包含成功状态、状态码、响应数据、响应头的对象*
815+
*返回 Promise,resolve 时包含成功状态、状态码、响应数据、响应头的对象。设置 sync: true 可使用同步模式*
816816

817817
---
818818

819819
### `http.post`
820820

821821
**Signature:** `post(url, options?)`
822822

823-
发送 POST 请求
823+
发送 POST 请求(异步,返回 Promise)
824824

825825
**Parameters:**
826826

827827
| Name | Type | Description | Optional |
828828
|------|------|-------------|----------|
829829
| `url` | `string` | 请求地址 | No |
830-
| `options` | `object` | 请求选项 { body, headers, timeout, insecure } | Yes |
830+
| `options` | `object` | 请求选项 { body, headers, timeout, insecure, sync } | Yes |
831831

832-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
832+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
833+
834+
*返回 Promise,resolve 时包含响应结果。设置 sync: true 可使用同步模式*
833835

834836
---
835837

836838
### `http.put`
837839

838840
**Signature:** `put(url, options?)`
839841

840-
发送 PUT 请求
842+
发送 PUT 请求(异步,返回 Promise)
841843

842844
**Parameters:**
843845

844846
| Name | Type | Description | Optional |
845847
|------|------|-------------|----------|
846848
| `url` | `string` | 请求地址 | No |
847-
| `options` | `object` | 请求选项 { body, headers, timeout, insecure } | Yes |
849+
| `options` | `object` | 请求选项 { body, headers, timeout, insecure, sync } | Yes |
850+
851+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
848852

849-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
853+
*返回 Promise,resolve 时包含响应结果*
850854

851855
---
852856

853857
### `http.delete`
854858

855859
**Signature:** `delete(url, options?)`
856860

857-
发送 DELETE 请求
861+
发送 DELETE 请求(异步,返回 Promise)
858862

859863
**Parameters:**
860864

861865
| Name | Type | Description | Optional |
862866
|------|------|-------------|----------|
863867
| `url` | `string` | 请求地址 | No |
864-
| `options` | `object` | 请求选项 { headers, timeout, insecure } | Yes |
868+
| `options` | `object` | 请求选项 { headers, timeout, insecure, sync } | Yes |
869+
870+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
865871

866-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
872+
*返回 Promise,resolve 时包含响应结果*
867873

868874
---
869875

870876
### `http.patch`
871877

872878
**Signature:** `patch(url, options?)`
873879

874-
发送 PATCH 请求
880+
发送 PATCH 请求(异步,返回 Promise)
875881

876882
**Parameters:**
877883

878884
| Name | Type | Description | Optional |
879885
|------|------|-------------|----------|
880886
| `url` | `string` | 请求地址 | No |
881-
| `options` | `object` | 请求选项 { body, headers, timeout, insecure } | Yes |
887+
| `options` | `object` | 请求选项 { body, headers, timeout, insecure, sync } | Yes |
882888

883-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
889+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
890+
891+
*返回 Promise,resolve 时包含响应结果*
884892

885893
---
886894

887895
### `http.head`
888896

889897
**Signature:** `head(url, options?)`
890898

891-
发送 HEAD 请求
899+
发送 HEAD 请求(异步,返回 Promise)
892900

893901
**Parameters:**
894902

895903
| Name | Type | Description | Optional |
896904
|------|------|-------------|----------|
897905
| `url` | `string` | 请求地址 | No |
898-
| `options` | `object` | 请求选项 { headers, timeout, insecure } | Yes |
906+
| `options` | `object` | 请求选项 { headers, timeout, insecure, sync } | Yes |
907+
908+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
899909

900-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
910+
*返回 Promise,resolve 时包含响应结果(HEAD 请求通常 data 为空)*
901911

902912
---
903913

904914
### `http.request`
905915

906916
**Signature:** `request(url, options)`
907917

908-
发送自定义请求
918+
发送自定义 HTTP 请求(异步,返回 Promise)
909919

910920
**Parameters:**
911921

912922
| Name | Type | Description | Optional |
913923
|------|------|-------------|----------|
914924
| `url` | `string` | 请求地址 | No |
915-
| `options` | `object` | 请求选项 { method, body, headers, timeout, insecure } | No |
925+
| `options` | `object` | 请求选项 { method, body, headers, timeout, insecure, sync } | No |
916926

917-
**Returns:** `{ success: boolean, status?: number, data?: string, headers?: object, error?: string }`
927+
**Returns:** `Promise<{ success: boolean, status?: number, data?: string, headers?: object, error?: string }>`
928+
929+
*返回 Promise,resolve 时包含响应结果*
918930

919931
---
920932

921933
### `http.download`
922934

923935
**Signature:** `download(url, path, options?)`
924936

925-
下载文件
937+
下载文件(异步,返回 Promise)
926938

927939
**Parameters:**
928940

929941
| Name | Type | Description | Optional |
930942
|------|------|-------------|----------|
931943
| `url` | `string` | 下载地址 | No |
932944
| `path` | `string` | 保存路径 | No |
933-
| `options` | `object` | 请求选项 { insecure } | Yes |
945+
| `options` | `object` | 请求选项 { insecure, sync } | Yes |
934946

935-
**Returns:** `{ success: boolean, path?: string, error?: string }`
947+
**Returns:** `Promise<{ success: boolean, path?: string, error?: string }>`
936948

937-
*包含成功状态和本地文件路径的对象*
949+
*返回 Promise,resolve 时包含成功状态和本地文件路径*
938950

939951
---
940952

TrollScript-Private

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 4dd043ce327a005f1a85c1b9483394a73980f44a
1+
Subproject commit 29672407719922111be9edcdd11764bc9d4eae36

0 commit comments

Comments
 (0)