Files
WRNexusJS/examples/basic-app/generated/api/sdk/javascript/wrnexus-api.js
T
Clintchiz 586a6db8ff
Quality / quality (ubuntu-latest) (push) Failing after 21s
Quality / quality (windows-latest) (push) Canceled after 0s
release: WRNexusJS 0.8.0
2026-08-02 23:18:51 +05:30

59 lines
2.0 KiB
JavaScript

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);
};