Giter Site home page Giter Site logo

themesapi's Introduction

ThemeAPI

This API is used to retrieve themes used for the Theme Library.


Endpoints

Theme Related

Base: https://themes-delta.vercel.app/api

GET /[theme]

Wants theme as query

  • Returns information about a specific theme.

Example

fetch("https://themes-delta.vercel.app/api/Monocord")

Returns

  • Content-Type: text/css
  • Returns 200, 404 or 405
/**
* @name Monocord
* @author catpurrchino
* @description Discord Design based on the Monospace font
* @version 1.0.0
* @source https://github.com/faf4a/snippets
*/

@import url("https://raw.githubusercontent.com/Faf4a/snippets/main/Monocord/main.css");

GET /thumbnail/[theme]

Wants theme as query

  • Returns thumbnail from a theme.

Example

fetch("https://themes-delta.vercel.app/api/thumbnail/Monocord")

Returns

  • Content-Type: image/png, image/gif or image/webp
  • Returns 200, 404 or 405

preview

GET /themes

  • Returns all available themes.

Example

fetch("https://themes-delta.vercel.app/api/themes")

Returns

  • Content-Type: application/json
  • Cache-Control: max-age=1200
  • Returns 200 or 405

Note

Content is encoded in Base64

[
 {
  "id": Number,
  "name": String,
  "type": "theme" | "snippet",
  "description": String,
  "author": {
   "discord_snowflake": String | null,
   "discord_name": String | null,
   "github_name": String | null,
  },
  "tags": Array,
  "thumbnail_url": String,
  "release_date": Date,
  "guild": {
   "name": String | null,
   "invite_link": String | null,
   "snowflake": String | null,
  },
  "content": String,
  "source": String,
  "likes": Number
 }, {...}
]

GET /likes/get

  • Returns data about all liked themes.

Example

fetch("https://themes-delta.vercel.app/api/likes/get")

Returns

  • Content-Type: application/json
  • Returns 200 or 405
{
  "status": 200,
  "likes": [
    {
      "themeId": Number,
      "userIds": []
    },
    {
      "themeId": Number,
      "userIds": []
    },
    {...}
}

POST /likes/add

Wants token (unique user token, DO NOT PASS YOUR DISCORD ACCOUNT TOKEN) and themeId in body.

  • Adds likes to a given theme.
  • Requires to be authorized.

Example

fetch("https://themes-delta.vercel.app/api/likes/add", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({ token: "", themeId: 0 })
})

Returns

  • Content-Type: application/json
  • Returns 200, 401, 405, 409, or 500.
{
  "status": 200
}

POST /likes/remove

Wants token (unique user token, DO NOT PASS YOUR DISCORD ACCOUNT TOKEN) and themeId in body.

  • Removes likes from a given theme.
  • Requires to be authorized.

Example

fetch("https://themes-delta.vercel.app/api/likes/remove", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({ token: "", themeId: 0 })
})

Returns

  • Content-Type: application/json
  • 200 or 405
{
  "status": 200
}

POST /submit/theme

Wants token (unique user token, DO NOT PASS YOUR DISCORD ACCOUNT TOKEN) and content in body.

  • Removes likes from a given theme.
  • Requires to be authorized.
  • Content must be encoded in Base64, content must include metadata (name, author, description), can include others.

Example

fetch("https://themes-delta.vercel.app/api/submit/theme", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({ token: "", content: "" })
})

Returns

  • Content-Type: application/json
  • 200, 400 or 405
{
  "status": 200
}

Auth Related

Base: https://themes-delta.vercel.app/api/user

GET /auth

Wants code as query

  • Authenticates a user using their access token, this should be only done once. The token returned will be the "password" to your account.

Don't call the endpoint directly, it will return 401, use discord.

https://discord.com/oauth2/authorize?client_id=1257819493422465235&response_type=code&redirect_uri=https://themes-delta.vercel.app/api/user/auth&scope=identify

Example

fetch("https://themes-delta.vercel.app/api/user/auth?code=ACCESS_TOKEN")

Returns

  • Content-Type: application/json
  • 200, 400 or 405
{
  "status": 200,
  "token": "UNIQUE_USER_TOKEN"
}

POST /findUserByToken

Wants token (unique user token, DO NOT PASS YOUR DISCORD ACCOUNT TOKEN) in body.

  • Returns the user data based on the unique user token.

Example

fetch("https://themes-delta.vercel.app/api/user/findUserByToken", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({ token: "" })
})

Returns

  • Content-Type: application/json
  • 200, 401 or 405
{
  "status": 200,
  "user": {
    "id": User["id"]
    "createdAt": Date
  }
}

DELETE /revoke

Wants token (unique user token, DO NOT PASS YOUR DISCORD ACCOUNT TOKEN) and userId in body.

  • Deletes user data associated with the token.

Example

fetch("https://themes-delta.vercel.app/api/user/revoke", {
    method: "POST",
    headers: {
        "Content-Type": "application/json"
    },
    body: JSON.stringify({ token: "", userId: "" })
})

Returns

  • Content-Type: application/json
  • 200, 401 or 405
{
  "status": 200
}

themesapi's People

Contributors

faf4a avatar actions-user avatar

Watchers

Lucian avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.