release: WRNexusJS 0.8.0
Quality / quality (ubuntu-latest) (push) Failing after 21s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-02 23:18:51 +05:30
parent 87507edf59
commit 586a6db8ff
625 changed files with 243608 additions and 11210 deletions
@@ -0,0 +1,67 @@
# API examples
## postWebhooksPayment
```bash
curl -X POST "http://localhost:3000/api/webhooks/payment"
```
## getUsersCsr
```bash
curl -X GET "http://localhost:3000/api/users/csr"
```
## getUsersSsr
```bash
curl -X GET "http://localhost:3000/api/users/ssr"
```
## postGraphqlExample
```bash
curl -X POST "http://localhost:3000/api/graphql-example"
```
## postTypedUser
```bash
curl -X POST "http://localhost:3000/api/typed-user"
```
## postLogout
```bash
curl -X POST "http://localhost:3000/api/logout"
```
## getHello
```bash
curl -X GET "http://localhost:3000/api/hello"
```
## postLogin
```bash
curl -X POST "http://localhost:3000/api/login"
```
## getEcho
```bash
curl -X GET "http://localhost:3000/api/echo"
```
## postEcho
```bash
curl -X POST "http://localhost:3000/api/echo"
```
## getMe
```bash
curl -X GET "http://localhost:3000/api/me"
```
@@ -0,0 +1,79 @@
<!doctype html><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>
basic-app API</title
><style>
body {
font: 16px system-ui;
max-width: 960px;
margin: auto;
padding: 2rem;
}
code,
pre {
background: #f4f4f5;
padding: 0.2rem 0.4rem;
}
article {
border-bottom: 1px solid #ddd;
padding: 1rem 0;
}
</style>
<h1>basic-app API</h1>
<p>OpenAPI 3.1 · 11 operations · <a href="openapi.json">specification</a></p>
<article>
<h2><code>POST</code> /api/webhooks/payment</h2>
<p>Payment completed</p>
<p>Sent after a payment reaches its settled state.</p>
<p>Webhook event: <code>payment.completed</code> · signature: <code>x-payment-signature</code></p>
<small>app/api/webhooks/payment.ts</small>
</article>
<article>
<h2><code>GET</code> /api/users/csr</h2>
<p>getUsersCsr</p>
<small>app/api/users/csr.ts</small>
</article>
<article>
<h2><code>GET</code> /api/users/ssr</h2>
<p>getUsersSsr</p>
<small>app/api/users/ssr.ts</small>
</article>
<article>
<h2><code>POST</code> /api/graphql-example</h2>
<p>postGraphqlExample</p>
<small>app/api/graphql-example.ts</small>
</article>
<article>
<h2><code>POST</code> /api/typed-user</h2>
<p>postTypedUser</p>
<p>Validate and echo a typed user payload.</p>
<small>app/api/typed-user.ts</small>
</article>
<article>
<h2><code>POST</code> /api/logout</h2>
<p>postLogout</p>
<small>app/api/logout.ts</small>
</article>
<article>
<h2><code>GET</code> /api/hello</h2>
<p>getHello</p>
<small>app/api/hello.ts</small>
</article>
<article>
<h2><code>POST</code> /api/login</h2>
<p>postLogin</p>
<small>app/api/login.ts</small>
</article>
<article>
<h2><code>GET</code> /api/echo</h2>
<p>getEcho</p>
<small>app/api/echo.ts</small>
</article>
<article>
<h2><code>POST</code> /api/echo</h2>
<p>postEcho</p>
<small>app/api/echo.ts</small>
</article>
<article>
<h2><code>GET</code> /api/me</h2>
<p>getMe</p>
<small>app/api/me.ts</small>
</article>
@@ -0,0 +1,318 @@
{
"openapi": "3.1.0",
"info": {
"title": "basic-app API",
"version": "0.8.0"
},
"paths": {
"/api/webhooks/payment": {
"post": {
"operationId": "postWebhooksPayment",
"summary": "Payment completed",
"description": "Sent after a payment reaches its settled state.",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/webhooks/payment.ts"
}
},
"/api/users/csr": {
"get": {
"operationId": "getUsersCsr",
"summary": "GET /api/users/csr",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/users/csr.ts"
}
},
"/api/users/ssr": {
"get": {
"operationId": "getUsersSsr",
"summary": "GET /api/users/ssr",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/users/ssr.ts"
}
},
"/api/graphql-example": {
"post": {
"operationId": "postGraphqlExample",
"summary": "POST /api/graphql-example",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/graphql-example.ts"
}
},
"/api/typed-user": {
"post": {
"operationId": "postTypedUser",
"summary": "POST /api/typed-user",
"description": "Validate and echo a typed user payload.",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/typed-user.ts"
}
},
"/api/logout": {
"post": {
"operationId": "postLogout",
"summary": "POST /api/logout",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/logout.ts"
}
},
"/api/hello": {
"get": {
"operationId": "getHello",
"summary": "GET /api/hello",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/hello.ts"
}
},
"/api/login": {
"post": {
"operationId": "postLogin",
"summary": "POST /api/login",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/login.ts"
}
},
"/api/echo": {
"get": {
"operationId": "getEcho",
"summary": "GET /api/echo",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/echo.ts"
},
"post": {
"operationId": "postEcho",
"summary": "POST /api/echo",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/echo.ts"
}
},
"/api/me": {
"get": {
"operationId": "getMe",
"summary": "GET /api/me",
"tags": ["API"],
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {}
}
}
},
"400": {
"description": "Invalid request"
},
"500": {
"description": "Internal error"
}
},
"x-wrnexus-source": "app/api/me.ts"
}
}
},
"webhooks": {
"payment.completed": {
"post": {
"summary": "Payment completed",
"description": "Sent after a payment reaches its settled state.",
"parameters": [
{
"name": "x-payment-signature",
"in": "header",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PaymentCompleted"
}
}
}
},
"responses": {
"200": {
"description": "Webhook accepted"
}
},
"x-wrnexus-source": "app/api/webhooks/payment.ts"
}
}
}
}
@@ -0,0 +1,91 @@
{
"info": {
"name": "basic-app API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "postWebhooksPayment",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/webhooks/payment"
}
},
{
"name": "getUsersCsr",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/users/csr"
}
},
{
"name": "getUsersSsr",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/users/ssr"
}
},
{
"name": "postGraphqlExample",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/graphql-example"
}
},
{
"name": "postTypedUser",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/typed-user"
}
},
{
"name": "postLogout",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/logout"
}
},
{
"name": "getHello",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/hello"
}
},
{
"name": "postLogin",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/login"
}
},
{
"name": "getEcho",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/echo"
}
},
{
"name": "postEcho",
"request": {
"method": "POST",
"url": "{{baseUrl}}/api/echo"
}
},
{
"name": "getMe",
"request": {
"method": "GET",
"url": "{{baseUrl}}/api/me"
}
}
],
"variable": [
{
"key": "baseUrl",
"value": "http://localhost:3000"
}
]
}
@@ -0,0 +1,5 @@
package wrnexussdk
import ("bytes"; "encoding/json"; "fmt"; "net/http")
type Client struct { BaseURL string; HTTP *http.Client }
func (c *Client) Request(method, path string, body any) (map[string]any, error) { data,_:=json.Marshal(body); req,_:=http.NewRequest(method,c.BaseURL+path,bytes.NewReader(data)); req.Header.Set("content-type","application/json"); client:=c.HTTP;if client==nil{client=http.DefaultClient};res,err:=client.Do(req);if err!=nil{return nil,err};defer res.Body.Close();if res.StatusCode>=400{return nil,fmt.Errorf("API status %d",res.StatusCode)};var out map[string]any;err=json.NewDecoder(res.Body).Decode(&out);return out,err }
@@ -0,0 +1,3 @@
package dev.wrnexus.sdk;
import java.net.URI; import java.net.http.*;
public final class WrnexusApi { private final String baseUrl; private final HttpClient http = HttpClient.newHttpClient(); public WrnexusApi(String baseUrl){this.baseUrl=baseUrl;} public String request(String method,String path,String json)throws Exception{var request=HttpRequest.newBuilder(URI.create(baseUrl+path)).header("content-type","application/json").method(method,HttpRequest.BodyPublishers.ofString(json==null?"":json)).build();var response=http.send(request,HttpResponse.BodyHandlers.ofString());if(response.statusCode()>=400)throw new IllegalStateException("API status "+response.statusCode());return response.body();} }
@@ -0,0 +1,58 @@
const request = async (method, path, body, options = {}) => {
const response = await globalThis.fetch((options.baseUrl || "") + path, {
method,
headers: { "content-type": "application/json", ...(options.headers || {}) },
body: body === undefined ? undefined : JSON.stringify(body),
});
const value = await response.json();
if (!response.ok)
throw Object.assign(new Error(value?.error?.message || "API request failed"), {
status: response.status,
body: value,
});
return value.data ?? value;
};
export const postWebhooksPayment = (params = {}, body, options = {}) => {
void params;
return request("POST", `/api/webhooks/payment`, body, options);
};
export const getUsersCsr = (params = {}, body, options = {}) => {
void params;
return request("GET", `/api/users/csr`, body, options);
};
export const getUsersSsr = (params = {}, body, options = {}) => {
void params;
return request("GET", `/api/users/ssr`, body, options);
};
export const postGraphqlExample = (params = {}, body, options = {}) => {
void params;
return request("POST", `/api/graphql-example`, body, options);
};
export const postTypedUser = (params = {}, body, options = {}) => {
void params;
return request("POST", `/api/typed-user`, body, options);
};
export const postLogout = (params = {}, body, options = {}) => {
void params;
return request("POST", `/api/logout`, body, options);
};
export const getHello = (params = {}, body, options = {}) => {
void params;
return request("GET", `/api/hello`, body, options);
};
export const postLogin = (params = {}, body, options = {}) => {
void params;
return request("POST", `/api/login`, body, options);
};
export const getEcho = (params = {}, body, options = {}) => {
void params;
return request("GET", `/api/echo`, body, options);
};
export const postEcho = (params = {}, body, options = {}) => {
void params;
return request("POST", `/api/echo`, body, options);
};
export const getMe = (params = {}, body, options = {}) => {
void params;
return request("GET", `/api/me`, body, options);
};
@@ -0,0 +1,19 @@
import json, urllib.request
class WrnexusApi:
def __init__(self, base_url): self.base_url = base_url.rstrip('/')
def request(self, method, path, body=None):
data = None if body is None else json.dumps(body).encode()
request = urllib.request.Request(self.base_url + path, data=data, method=method, headers={'content-type':'application/json'})
with urllib.request.urlopen(request) as response: return json.load(response)
def postWebhooksPayment(self, path, body=None): return self.request('POST', path, body)
def getUsersCsr(self, path, body=None): return self.request('GET', path, body)
def getUsersSsr(self, path, body=None): return self.request('GET', path, body)
def postGraphqlExample(self, path, body=None): return self.request('POST', path, body)
def postTypedUser(self, path, body=None): return self.request('POST', path, body)
def postLogout(self, path, body=None): return self.request('POST', path, body)
def getHello(self, path, body=None): return self.request('GET', path, body)
def postLogin(self, path, body=None): return self.request('POST', path, body)
def getEcho(self, path, body=None): return self.request('GET', path, body)
def postEcho(self, path, body=None): return self.request('POST', path, body)
def getMe(self, path, body=None): return self.request('GET', path, body)
@@ -0,0 +1,109 @@
export type RequestOptions = { baseUrl?: string; headers?: HeadersInit };
type ApiEnvelope = { data?: unknown; error?: { message?: string } };
const request = async (
method: string,
path: string,
body: unknown,
options: RequestOptions = {},
) => {
const response = await globalThis.fetch((options.baseUrl || "") + path, {
method,
headers: { "content-type": "application/json", ...(options.headers || {}) },
body: body === undefined ? undefined : JSON.stringify(body),
});
const value: ApiEnvelope = await response.json();
if (!response.ok)
throw Object.assign(new Error(value?.error?.message || "API request failed"), {
status: response.status,
body: value,
});
return value.data ?? value;
};
export const postWebhooksPayment = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("POST", `/api/webhooks/payment`, body, options);
};
export const getUsersCsr = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("GET", `/api/users/csr`, body, options);
};
export const getUsersSsr = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("GET", `/api/users/ssr`, body, options);
};
export const postGraphqlExample = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("POST", `/api/graphql-example`, body, options);
};
export const postTypedUser = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("POST", `/api/typed-user`, body, options);
};
export const postLogout = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("POST", `/api/logout`, body, options);
};
export const getHello = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("GET", `/api/hello`, body, options);
};
export const postLogin = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("POST", `/api/login`, body, options);
};
export const getEcho = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("GET", `/api/echo`, body, options);
};
export const postEcho = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("POST", `/api/echo`, body, options);
};
export const getMe = (
params: Record<string, string> = {},
body: unknown,
options: RequestOptions = {},
) => {
void params;
return request("GET", `/api/me`, body, options);
};