The creator of this fantastic library need a job tel, email
This is javascript client interface for djira
Project still in development, We use this library in production ready projects. We are not liable for any problem encountered using this library
For the python server library check Djira
Create or initialize a socketio client
import { client } from "jira";
client(...args); // a socketio client is initialize
Note: This is required to be called in middleware, plugin or main / root project file
For example
React in App.tsx
or main.tsx
file the client is initialized
Nuxt in a client plugin file, jira.client.ts
Send request to the server using .create
,.get
, .list
, update
, patch
action
To send custom action use the request
method
Send create action to the server
Returns new created data
import { create } from "jira";
create("users", { username: "lyonkvalid", email: "email"}).then(console.log);
Send list action to the server
Returns a paginated response or an array use the
PaginatedResponse<T>
when expecting paginated response from the server
import { list } from "jira";
list("users").then(console.log);
// optional pass custom query params for filtering
list("users", { username__icontains: "lyon" }).then(console.log);
Send get action to the server
Return a response from the server
import { get } from "jira";
get("users", 1).then(console.log);
// optional pass custom query params
get("users", 1, { email_verified: true }).then(console.log);
Send an update or patch action to the server
Return a response from the server
import { update, patch } from "jira";
// full update
update("users", 1, { username: "lyonkvalid", email: "payouk.mytre@gmail.com", displayName: "Oguntunde Caleb Fiyinfoluwa"});
// partial update
patch("users", 1, { username: "lyonkvalid" });
// both method also have an optional arg `query`
Send a request to a custom namespace
import { request } from "jira";
request(
"users",
"get",
{
namespace:"current", // optional
data: {}, // optional,
query: {}, // optional
}).then(console.log); // this is equivalent to /users/current/ in http path
A subscription observe changes to query from database, You can listen or subscribe to changes based on your preference
Subscribe to observers on a server
import { subscribe } from "jira";
const { unsubscribe } = subscribe("user", snapshot => console.log(snapshot), {
namespace: "subscribe_user", // optional, defaults to event name,
query, // optional
data, // optional
});
Listen to a request return value changes
import { listen, list } from "jira";
const { unsubscribe } = listen(
list("users"),
snapshot => console.log(snapshot),
{
namespace, // optional, defaults to event name
query, // optional
data, // optional
}
);