Content
API

About


The Gitignored API provides a platform for developers to retrieve valuable information pertaining to the supported templates

Usage


The URL to access the Gitignroed API can be found at

gitignored.vercel.app/api/v0

Some routes may include additional queries in the URL to filter responses appropriately

For instance, by accessing the URL

gitignored.vercel.app/api/v0/templates/ids=Laravel,Android

the API will return the corresponding templates for Laravel and Android based on the specified IDs

NOTE: Users who are currently accessing the API using the non-semantic versioned endpoint "/api" are encouraged to update their code to use the current versioned endpoint, "/api/v0"

Contents


Phyilosphy


The API response is structured in accordance with Tagged Union, or Discriminated Union. For more information on Tagged/Discriminated Union, please refer to this link

The subsequent presentation illustrates a standard response to enhance comprehension

type Response<T> = {
    status: 'succeed'
    data: T
} | {
    status: 'failed'
    reason: string
}

This design enables developers to parse responses effortlessly, eliminating the need to handle either a plain object denoting success or a string indicating failure

By affirming the status field within the response, one can definitively ascertain the success or failure of the response. Specifically, a "succeed" value indicates a successful response with a generic value of T, where T is contingent upon the field returned by the API. Conversely, a "failed" value signifies an unsuccessful response, accompanied by a reason to elucidate the failure or simply an error message