npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gotify-client

v0.4.2

Published

[![gotify-client](https://raw.githubusercontent.com/hywax/gotify-client/main/public/cover.jpg)](https://github.com/hywax/vitepress-yandex-metrika)

Downloads

78

Readme

gotify-client

Gotify Client

npm version npm downloads License

Full-featured HTTP client to work with Gotify API.

🎯 Features

  • 🔥 Code gen. The client is fully compliant with the official documentation.
  • 👌 Slim. Zero dependencies.
  • Runner. Browser and Node support.
  • 🌐 Custom Http. If you need a custom http client, you can swap it out.
  • 🌳 Tree shaking. Only use what you need.
  • 🪄️ TypeScript. The library is entirely made in typescript

✨ Installation

# Using pnpm
pnpm add gotify-client -D

# Using yarn
yarn add gotify-client -D

# Using npm
npm install gotify-client -D

⚡ Usage

🚀 Base

import { GotifyClient } from 'gotify-client'

const client = new GotifyClient('http://gotify.home', {
    // You must specify at least 1 key
    app: 'app_api_key',
    client: 'client_api_key'
})

const message = await gotify.message.createMessage({
  message: "Test message!"
})

⚙️ Configuration

To execute requests, you need to specify a link to the host gotify, as well as pass api keys.

In Gotify there are two token types:

  • app: an application is something that sends messages.
  • client: a client is something that receives message and manages stuff like creating new tokens or delete messages.
constructor(host: string, authKeys: {
  app?: string
  client?: string
})

🤖 API

The source documentation is fully described in swagger on the official website.

ApplicationApi

| Method | Description | Http request | |--------|-------------|--------------| | getApps | Return all applications. | GET /application | | createApp | Create an application. | POST /application | | updateApplication | Update an application. | PUT /application/${id} | | deleteApp | Delete an application. | DELETE /application/${id} | | uploadAppImage | Upload an image for an application. | POST /application/${id}/image | | removeAppImage | Deletes an image of an application. | DELETE /application/${id}/image | | getAppMessages | Return all messages from a specific application. | GET /application/${id}/message | | deleteAppMessages | Delete all messages from a specific application. | DELETE /application/${id}/message |

ClientApi

| Method | Description | Http request | |--------|-------------|--------------| | getClients | Return all clients. | GET /client | | createClient | Create a client. | POST /client | | updateClient | Update a client. | PUT /client/${id} | | deleteClient | Delete a client. | DELETE /client/${id} |

CurrentApi

| Method | Description | Http request | |--------|-------------|--------------| | currentUser | Return the current user. | GET /current/user | | updateCurrentUser | Update the password of the current user. | POST /current/user/password |

HealthApi

| Method | Description | Http request | |--------|-------------|--------------| | getHealth | Get health information. | GET /health |

MessageApi

| Method | Description | Http request | |--------|-------------|--------------| | getMessages | Return all messages. | GET /message | | createMessage | Create a message. | POST /message | | deleteMessages | Delete all messages. | DELETE /message | | deleteMessage | Deletes a message with an id. | DELETE /message/${id} |

PluginApi

| Method | Description | Http request | |--------|-------------|--------------| | getPlugins | Return all plugins. | GET /plugin | | getPluginConfig | Get YAML configuration for Configurer plugin. | GET /plugin/${id}/config | | updatePluginConfig | Update YAML configuration for Configurer plugin. | POST /plugin/${id}/config | | disablePlugin | Disable a plugin. | POST /plugin/${id}/disable | | getPluginDisplay | Get display info for a Displayer plugin. | GET /plugin/${id}/display | | enablePlugin | Enable a plugin. | POST /plugin/${id}/enable |

StreamApi

| Method | Description | Http request | |--------|-------------|--------------| | streamMessages | Websocket, return newly created messages. | GET /stream |

UserApi

| Method | Description | Http request | |--------|-------------|--------------| | getUsers | Return all users. | GET /user | | createUser | Create a user. | POST /user | | getUser | Get a user. | GET /user/${id} | | updateUser | Update a user. | POST /user/${id} | | deleteUser | Deletes a user. | DELETE /user/${id} |

VersionApi

| Method | Description | Http request | |--------|-------------|--------------| | getVersion | Get version information. | GET /version |

⚡ Advanced

🪄 Custom client

import { MessageApi } from 'gotify-client'

const httpClient = new CustomHttpClient()
const messageApi = new MessageApi(httpClient)

const message = await messageApi.createMessage({
    message: "Test message!"
})

📄 License

This template was created under the MIT License.