Skip to content

API clients for Node and Browser(based on this account API repositories).

License

Notifications You must be signed in to change notification settings

Walikuperek/API-clients

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Clients for Node and Browser

Based on API's from GitHub QUAK repositories.

Client examples usage:

import { api } from "./libs/api-client";
import fetch from "node-fetch"; // for NodeJS only

const newsletterAPI = api.newsletter(fetch, "localhost:3000") // or your prod Newsletter service url
const textToTextAI = new api.textToTextAI({ // chatgpt
  fetchFn: fetch,
  apiKey: "your-openai-api-key",
  n: 2 // 2 responses, 1 default
});

(async () => {
    // ChatGPT API
    const title = "Red Pillow 50cm x 50cm"
    const [description, description2] = await textToTextAI.prompt(`Take "${title}" and generate product description.`)

    // NewsletterAPI
    await newsletterAPI.subscribers.addNewSubscriber("[email protected]", "Full Name") // will send confirmation email
    const jwt = await newsletterAPI.auth.login("username", "password")
    await newsletterAPI.subscribers.sendNewsletter(jwt, "subject", "1st newsletter message 🎉🎂")
})();

Simple install into your project:

cd /path/to/repository
git submodule add https://github.com/Walikuperek/API-clients.git libs/api-client
git add .gitmodules libs/api-client
git commit -m "Added API clients"

Clients

Client Purpose
ChatGPT API generate response from prompt
Newsletter API append new subscribers, send Newsletter, etc. (NewsletterAPI link)

Author QUAK Kacper Walczak, visit website to see more details

About

API clients for Node and Browser(based on this account API repositories).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published