| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613 |
- import * as p from "../../package.json";
- export default {
- openapi: "3.0.0",
- info: {
- title: "Kutt.it",
- description: "API reference for [http://kutt.it](http://kutt.it).\n",
- version: p.version
- },
- servers: [
- {
- url: "https://kutt.it/api/v2"
- }
- ],
- tags: [
- {
- name: "health"
- },
- {
- name: "links"
- },
- {
- name: "domains"
- },
- {
- name: "users"
- }
- ],
- paths: {
- "/health": {
- get: {
- tags: ["health"],
- summary: "API health",
- responses: {
- "200": {
- description: "Health",
- content: {
- "text/html": {
- example: "OK"
- }
- }
- }
- }
- }
- },
- "/links": {
- get: {
- tags: ["links"],
- description: "Get list of links",
- parameters: [
- {
- name: "limit",
- in: "query",
- description: "Limit",
- required: false,
- style: "form",
- explode: true,
- schema: {
- type: "number",
- example: 10
- }
- },
- {
- name: "skip",
- in: "query",
- description: "Skip",
- required: false,
- style: "form",
- explode: true,
- schema: {
- type: "number",
- example: 0
- }
- },
- {
- name: "all",
- in: "query",
- description: "All links (ADMIN only)",
- required: false,
- style: "form",
- explode: true,
- schema: {
- type: "boolean",
- example: false
- }
- }
- ],
- responses: {
- "200": {
- description: "List of links",
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/inline_response_200"
- }
- }
- }
- }
- },
- security: [
- {
- APIKeyAuth: []
- }
- ]
- },
- post: {
- tags: ["links"],
- description: "Create a short link",
- requestBody: {
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/body"
- }
- }
- }
- },
- responses: {
- "200": {
- description: "Created link",
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/Link"
- }
- }
- }
- }
- },
- security: [
- {
- APIKeyAuth: []
- }
- ]
- }
- },
- "/links/{id}": {
- delete: {
- tags: ["links"],
- description: "Delete a link",
- parameters: [
- {
- name: "id",
- in: "path",
- required: true,
- style: "simple",
- explode: false,
- schema: {
- type: "string",
- format: "uuid"
- }
- }
- ],
- responses: {
- "200": {
- description: "Deleted link successfully",
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/inline_response_200_1"
- }
- }
- }
- }
- },
- security: [
- {
- APIKeyAuth: []
- }
- ]
- },
- patch: {
- tags: ["links"],
- description: "Update a link",
- parameters: [
- {
- name: "id",
- in: "path",
- required: true,
- style: "simple",
- explode: false,
- schema: {
- type: "string",
- format: "uuid"
- }
- }
- ],
- requestBody: {
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/body_1"
- }
- }
- }
- },
- responses: {
- "200": {
- description: "Updated link successfully",
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/Link"
- }
- }
- }
- }
- },
- security: [
- {
- APIKeyAuth: []
- }
- ]
- }
- },
- "/links/{id}/stats": {
- get: {
- tags: ["links"],
- description: "Get link stats",
- parameters: [
- {
- name: "id",
- in: "path",
- required: true,
- style: "simple",
- explode: false,
- schema: {
- type: "string",
- format: "uuid"
- }
- }
- ],
- responses: {
- "200": {
- description: "Link stats",
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/Stats"
- }
- }
- }
- }
- },
- security: [
- {
- APIKeyAuth: []
- }
- ]
- }
- },
- "/domains": {
- post: {
- tags: ["domains"],
- description: "Create a domain",
- requestBody: {
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/body_2"
- }
- }
- }
- },
- responses: {
- "200": {
- description: "Created domain",
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/Domain"
- }
- }
- }
- }
- },
- security: [
- {
- APIKeyAuth: []
- }
- ]
- }
- },
- "/domains/{id}": {
- delete: {
- tags: ["domains"],
- description: "Delete a domain",
- parameters: [
- {
- name: "id",
- in: "path",
- required: true,
- style: "simple",
- explode: false,
- schema: {
- type: "string",
- format: "uuid"
- }
- }
- ],
- responses: {
- "200": {
- description: "Deleted domain successfully",
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/inline_response_200_1"
- }
- }
- }
- }
- },
- security: [
- {
- APIKeyAuth: []
- }
- ]
- }
- },
- "/users": {
- get: {
- tags: ["users"],
- description: "Get user info",
- responses: {
- "200": {
- description: "User info",
- content: {
- "application/json": {
- schema: {
- $ref: "#/components/schemas/User"
- }
- }
- }
- }
- },
- security: [
- {
- APIKeyAuth: []
- }
- ]
- }
- }
- },
- components: {
- schemas: {
- Link: {
- type: "object",
- properties: {
- address: {
- type: "string"
- },
- banned: {
- type: "boolean",
- default: false
- },
- created_at: {
- type: "string",
- format: "date-time"
- },
- id: {
- type: "string",
- format: "uuid"
- },
- link: {
- type: "string"
- },
- password: {
- type: "boolean",
- default: false
- },
- target: {
- type: "string"
- },
- updated_at: {
- type: "string",
- format: "date-time"
- },
- visit_count: {
- type: "number"
- }
- }
- },
- Domain: {
- type: "object",
- properties: {
- address: {
- type: "string"
- },
- banned: {
- type: "boolean",
- default: false
- },
- created_at: {
- type: "string",
- format: "date-time"
- },
- id: {
- type: "string",
- format: "uuid"
- },
- homepage: {
- type: "string"
- },
- updated_at: {
- type: "string",
- format: "date-time"
- }
- }
- },
- User: {
- type: "object",
- properties: {
- apikey: {
- type: "string"
- },
- email: {
- type: "string"
- },
- domains: {
- type: "array",
- items: {
- $ref: "#/components/schemas/Domain"
- }
- }
- }
- },
- StatsItem: {
- type: "object",
- properties: {
- stats: {
- $ref: "#/components/schemas/StatsItem_stats"
- },
- views: {
- type: "array",
- items: {
- type: "number"
- }
- }
- }
- },
- Stats: {
- type: "object",
- properties: {
- allTime: {
- $ref: "#/components/schemas/StatsItem"
- },
- lastDay: {
- $ref: "#/components/schemas/StatsItem"
- },
- lastMonth: {
- $ref: "#/components/schemas/StatsItem"
- },
- lastWeek: {
- $ref: "#/components/schemas/StatsItem"
- },
- updatedAt: {
- type: "string"
- },
- address: {
- type: "string"
- },
- banned: {
- type: "boolean",
- default: false
- },
- created_at: {
- type: "string",
- format: "date-time"
- },
- id: {
- type: "string",
- format: "uuid"
- },
- link: {
- type: "string"
- },
- password: {
- type: "boolean",
- default: false
- },
- target: {
- type: "string"
- },
- updated_at: {
- type: "string",
- format: "date-time"
- },
- visit_count: {
- type: "number"
- }
- }
- },
- inline_response_200: {
- properties: {
- limit: {
- type: "number",
- default: 10
- },
- skip: {
- type: "number",
- default: 0
- },
- total: {
- type: "number",
- default: 0
- },
- data: {
- type: "array",
- items: {
- $ref: "#/components/schemas/Link"
- }
- }
- }
- },
- body: {
- required: ["target"],
- properties: {
- target: {
- type: "string"
- },
- password: {
- type: "string"
- },
- customurl: {
- type: "string"
- },
- reuse: {
- type: "boolean",
- default: false
- },
- domain: {
- type: "string"
- }
- }
- },
- inline_response_200_1: {
- properties: {
- message: {
- type: "string"
- }
- }
- },
- body_1: {
- properties: {
- target: {
- type: "string"
- },
- address: {
- type: "string"
- }
- }
- },
- body_2: {
- required: ["address"],
- properties: {
- address: {
- type: "string"
- },
- homepage: {
- type: "string"
- }
- }
- },
- StatsItem_stats_browser: {
- type: "object",
- properties: {
- name: {
- type: "string"
- },
- value: {
- type: "number"
- }
- }
- },
- StatsItem_stats: {
- type: "object",
- properties: {
- browser: {
- type: "array",
- items: {
- $ref: "#/components/schemas/StatsItem_stats_browser"
- }
- },
- os: {
- type: "array",
- items: {
- $ref: "#/components/schemas/StatsItem_stats_browser"
- }
- },
- country: {
- type: "array",
- items: {
- $ref: "#/components/schemas/StatsItem_stats_browser"
- }
- },
- referrer: {
- type: "array",
- items: {
- $ref: "#/components/schemas/StatsItem_stats_browser"
- }
- }
- }
- }
- },
- securitySchemes: {
- APIKeyAuth: {
- type: "apiKey",
- name: "X-API-KEY",
- in: "header"
- }
- }
- }
- };
|