qateway
v1.0.4
Published
<h1 align="center">Qateway</h1> <h4 align="center">By Qrvey</h4> <div align="center"> <a href="https://packagephobia.now.sh/result?p=qateway"> <img src="https://packagephobia.now.sh/badge?p=qateway" alt="install size" /> </a> </div>
Downloads
292
Readme
Qateway is a lightweight and reliable companion for RESTful requests in Node.js applications. It works using native FETCH library (Node.js 18+), avoiding the need for external dependencies.
Installation
You can install the qateway package via npm. Run the following command in your terminal:
npm install qateway
API Documentation
Available Methods
get(endpoint: string, options: IHttpActionOptions): Promise<any>
: Performs an HTTP GET request.post(endpoint: string, body: unknown, options: IHttpActionOptions): Promise<any>
: Performs an HTTP POST request.put(endpoint: string, body: unknown, options: IHttpActionOptions): Promise<any>
: Performs an HTTP PUT request.patch(endpoint: string, body: unknown, options: IHttpActionOptions): Promise<any>
: Performs an HTTP PATCH request.delete(endpoint: string, body: unknown, options: IHttpActionOptions): Promise<any>
: Performs an HTTP DELETE request.
Example Usage
const { AbstractGatewayClientService } = require('qateway');
class DataViewGatewayClient extends AbstractGatewayClientService {
static groups({ userId, appId, qrveyId }, { body, queryParameters, headers }) {
const endpoint = `/devapi/v5/user/${userId}/app/${appId}/qrvey/${qrveyId}/analytics/results/groups`;
return this.post(endpoint, body, { headers, queryParameters });
}
static rows({ userId, appId, qrveyId }, { body, queryParameters, headers }) {
const endpoint = `/devapi/v5/user/${userId}/app/${appId}/qrvey/${qrveyId}/analytics/results/rows`;
return this.post(endpoint, body, { headers, queryParameters });
}
static model({ userId, appId, qrveyId }, { queryParameters, headers }) {
const endpoint = `/devapi/v4/user/${userId}/app/${appId}/qrvey/${qrveyId}/analytiq/model`;
return this.get(endpoint, { headers, queryParameters });
}
}
module.exports = DataViewGatewayClient;