Skip to content

Commit af3b56c

Browse files
Merge pull request #52 from code0-tech/48-http-functions
Http Helper Functions
2 parents 2ef7e3e + 87c06ea commit af3b56c

File tree

11 files changed

+282
-6
lines changed

11 files changed

+282
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ npm i @code0-tech/code0-definition-reader --save-dev
8282
const features = Definition("./path/to/definitions")
8383

8484
for (const feature in features) {
85-
const name = feature.name; //name of the feature (e.g. rest)
85+
const name = feature.name; //name of the feature (e.g. http)
8686
const dataTypes = fearture.dataTypes; //dataTypes of this feature
8787
const flowTypes = fearture.flowTypes; //flowTypes of this feature
8888
const functions = fearture.runtimeFunctions; //runtimeFunctions of this feature
File renamed without changes.

definitions/rest/data_type/object/http_header_entry.json renamed to definitions/http/data_type/object/http_header_entry.json

File renamed without changes.

definitions/rest/data_type/object/http_request_object.json renamed to definitions/http/data_type/object/http_request.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"variant": 3,
3-
"identifier": "HTTP_REQUEST_OBJECT",
3+
"identifier": "HTTP_REQUEST",
44
"name": [
55
{
66
"code": "en-US",

definitions/rest/data_type/object/http_response_object.json renamed to definitions/http/data_type/object/http_response.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"variant": 3,
3-
"identifier": "HTTP_RESPONSE_OBJECT",
3+
"identifier": "HTTP_RESPONSE",
44
"name": [
55
{
66
"code": "en-US",
File renamed without changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"variant": 2,
3+
"identifier": "HTTP_STATUS_CODE",
4+
"name": [
5+
{
6+
"code": "en-US",
7+
"content": "HTTP Status Code"
8+
}
9+
],
10+
"rules": [
11+
{
12+
"config": {
13+
"NumberRange": {
14+
"from": 100,
15+
"to": 599
16+
}
17+
}
18+
}
19+
],
20+
"generic_keys": []
21+
}
File renamed without changes.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"identifier": "REST",
2+
"identifier": "HTTP",
33
"settings": [],
4-
"input_type_identifier": "HTTP_REQUEST_OBJECT",
5-
"return_type_identifier": "HTTP_RESPONSE_OBJECT",
4+
"input_type_identifier": "HTTP_REQUEST",
5+
"return_type_identifier": "HTTP_RESPONSE",
66
"editable": false,
77
"name": [
88
{
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
{
2+
"runtime_name": "http::request::create",
3+
"runtime_parameter_definitions": [
4+
{
5+
"data_type_identifier": {
6+
"type": {
7+
"DataTypeIdentifier": "HTTP_METHOD"
8+
}
9+
},
10+
"runtime_name": "http_method",
11+
"default_value": null,
12+
"name": [
13+
{
14+
"code": "en-US",
15+
"content": "HTTP Method"
16+
}
17+
],
18+
"description": [
19+
{
20+
"code": "en-US",
21+
"content": "Defines the HTTP method to be used, such as GET, POST, PUT, or DELETE."
22+
}
23+
],
24+
"documentation": [
25+
{
26+
"code": "en-US",
27+
"content": "Specifies the request method that determines the type of HTTP operation to perform."
28+
}
29+
]
30+
},
31+
{
32+
"data_type_identifier": {
33+
"type": {
34+
"DataTypeIdentifier": "HTTP_HEADER_MAP"
35+
}
36+
},
37+
"runtime_name": "headers",
38+
"default_value": null,
39+
"name": [
40+
{
41+
"code": "en-US",
42+
"content": "HTTP Headers"
43+
}
44+
],
45+
"description": [
46+
{
47+
"code": "en-US",
48+
"content": "A collection of key-value pairs containing additional request metadata."
49+
}
50+
],
51+
"documentation": [
52+
{
53+
"code": "en-US",
54+
"content": "Optional headers that can define content type, authorization, cookies, caching policies, and more."
55+
}
56+
]
57+
},
58+
{
59+
"data_type_identifier": {
60+
"type": {
61+
"DataTypeIdentifier": "HTTP_URL"
62+
}
63+
},
64+
"runtime_name": "url",
65+
"default_value": null,
66+
"name": [
67+
{
68+
"code": "en-US",
69+
"content": "Request URL"
70+
}
71+
],
72+
"description": [
73+
{
74+
"code": "en-US",
75+
"content": "The target URL to which the HTTP request will be sent."
76+
}
77+
],
78+
"documentation": [
79+
{
80+
"code": "en-US",
81+
"content": "Specifies the endpoint address, including protocol, host, path, and query parameters, where the request is directed."
82+
}
83+
]
84+
},
85+
{
86+
"data_type_identifier": {
87+
"type": {
88+
"GenericKey": "P"
89+
}
90+
},
91+
"runtime_name": "payload",
92+
"default_value": null,
93+
"name": [
94+
{
95+
"code": "en-US",
96+
"content": "Request Body"
97+
}
98+
],
99+
"description": [
100+
{
101+
"code": "en-US",
102+
"content": "The data to include in the body of the request, typically used with methods like POST or PUT."
103+
}
104+
],
105+
"documentation": [
106+
{
107+
"code": "en-US",
108+
"content": "Contains the request payload, such as JSON, XML, form data, or binary content, depending on the Content-Type header."
109+
}
110+
]
111+
}
112+
],
113+
"return_type_identifier": {
114+
"type": {
115+
"DataTypeIdentifier": "HTTP_REQUEST"
116+
}
117+
},
118+
"throws_error": false,
119+
"generic_keys": [
120+
"P"
121+
],
122+
"name": [
123+
{
124+
"code": "en-US",
125+
"content": "Construct HTTP Request"
126+
}
127+
],
128+
"description": [
129+
{
130+
"code": "en-US",
131+
"content": "Constructs an HTTP request object using the specified method, headers, URL, and payload."
132+
}
133+
],
134+
"documentation": [
135+
{
136+
"code": "en-US",
137+
"content": "Generates an HTTP request object that can be sent to a server. The request includes an HTTP method, optional headers, a destination URL, and an optional request body."
138+
}
139+
],
140+
"deprecation_message": []
141+
}

0 commit comments

Comments
 (0)