@next2d/net 2.13.1 → 3.0.1

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.
Files changed (2) hide show
  1. package/README.md +85 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,11 +1,93 @@
1
1
  @next2d/net
2
2
  =============
3
3
 
4
- ## Installation
4
+ ## Overview / 概要
5
5
 
6
- ```
6
+ The `@next2d/net` package provides network request handling functionality for loading external resources in Next2D applications. It offers a flexible and type-safe way to make HTTP requests with various configurations.
7
+
8
+ `@next2d/net` パッケージは、Next2Dアプリケーションで外部リソースを読み込むためのネットワークリクエスト処理機能を提供します。様々な設定で柔軟かつ型安全にHTTPリクエストを行うことができます。
9
+
10
+ ## Installation / インストール
11
+
12
+ ```bash
7
13
  npm install @next2d/net
8
14
  ```
9
15
 
10
- ## License
16
+ ## Directory Structure / ディレクトリ構成
17
+
18
+ ```
19
+ src/
20
+ ├── URLRequest.ts # Main request class / メインリクエストクラス
21
+ └── interface/
22
+ ├── IURLLoaderDataFormat.ts # Response data format types / レスポンスデータフォーマット型
23
+ ├── IURLRequestHeader.ts # Request header interface / リクエストヘッダーインターフェース
24
+ └── IURLRequestMethod.ts # HTTP method types / HTTPメソッド型
25
+ ```
26
+
27
+ ## URLRequest Class / URLRequestクラス
28
+
29
+ The `URLRequest` class manages HTTP requests to external resources. It provides properties to configure URLs, HTTP methods, headers, request data, and response formats.
30
+
31
+ `URLRequest` クラスは、外部リソースへのHTTPリクエストを管理します。URL、HTTPメソッド、ヘッダー、リクエストデータ、レスポンスフォーマットを設定するプロパティを提供します。
32
+
33
+ ### Usage / 使用方法
34
+
35
+ ```typescript
36
+ import { URLRequest } from "@next2d/net";
37
+
38
+ // Basic GET request / 基本的なGETリクエスト
39
+ const request = new URLRequest("https://api.example.com/data");
40
+
41
+ // POST request with data / データを含むPOSTリクエスト
42
+ const postRequest = new URLRequest("https://api.example.com/users");
43
+ postRequest.method = "POST";
44
+ postRequest.contentType = "application/json";
45
+ postRequest.data = { name: "John Doe", email: "john@example.com" };
46
+
47
+ // Custom headers / カスタムヘッダー
48
+ postRequest.requestHeaders = [
49
+ { name: "Authorization", value: "Bearer token123" },
50
+ { name: "X-Custom-Header", value: "custom-value" }
51
+ ];
52
+
53
+ // Response format / レスポンスフォーマット
54
+ request.responseDataFormat = "json"; // "json" | "arraybuffer" | "text"
55
+ ```
56
+
57
+ ### Properties / プロパティ
58
+
59
+ | Property | Type | Default | Description (EN) | 説明 (JA) |
60
+ |----------|------|---------|------------------|-----------|
61
+ | `url` | `string` | `""` | The URL to be requested | リクエストするURL |
62
+ | `method` | `IURLRequestMethod` | `"GET"` | HTTP method (GET, POST, PUT, DELETE, HEAD, OPTIONS) | HTTPメソッド |
63
+ | `contentType` | `string` | `"application/json"` | MIME content type | MIMEコンテンツタイプ |
64
+ | `data` | `any` | `null` | Data to be transmitted with the request | リクエストと共に送信されるデータ |
65
+ | `requestHeaders` | `IURLRequestHeader[]` | `[]` | Array of custom HTTP request headers | カスタムHTTPリクエストヘッダーの配列 |
66
+ | `responseDataFormat` | `IURLLoaderDataFormat` | `"json"` | Expected response data format | 期待されるレスポンスデータフォーマット |
67
+ | `withCredentials` | `boolean` | `false` | Include credentials in cross-origin requests | クロスオリジンリクエストに資格情報を含める |
68
+
69
+ ### Interfaces and Types / インターフェースと型
70
+
71
+ #### IURLRequestMethod
72
+ ```typescript
73
+ type IURLRequestMethod = "DELETE" | "GET" | "HEAD" | "OPTIONS" | "POST" | "PUT";
74
+ ```
75
+
76
+ #### IURLRequestHeader
77
+ ```typescript
78
+ interface IURLRequestHeader {
79
+ name: string;
80
+ value: string;
81
+ }
82
+ ```
83
+
84
+ #### IURLLoaderDataFormat
85
+ ```typescript
86
+ type IURLLoaderDataFormat = "json" | "arraybuffer" | "text";
87
+ ```
88
+
89
+ ## License / ライセンス
90
+
11
91
  This project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - see the [LICENSE](LICENSE) file for details.
92
+
93
+ このプロジェクトは[MITライセンス](https://opensource.org/licenses/MIT)の下でライセンスされています。詳細は[LICENSE](LICENSE)ファイルをご覧ください。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next2d/net",
3
- "version": "2.13.1",
3
+ "version": "3.0.1",
4
4
  "description": "Next2D Net Package",
5
5
  "author": "Toshiyuki Ienaga<ienaga@next2d.app> (https://github.com/ienaga/)",
6
6
  "license": "MIT",