UNPKG

@readme/oas-examples

Version:

A collection of example OpenAPI 3.x and Swagger 2.0 documents.

229 lines (228 loc) 5.35 kB
{ "openapi": "3.0.0", "info": { "version": "1.0", "title": "Hoot", "license": { "name": "ISC" } }, "servers": [ { "url": "https://hoot.at/api" } ], "paths": { "/hoot": { "post": { "summary": "Create a hoot", "description": "Post a new hoot to the site", "tags": ["Hoots"], "requestBody": { "description": "The hoot you want to post", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Hoot" } } } }, "security": [ { "basicAuth": [] } ], "responses": { "200": { "description": "Successful response" } } } }, "/hoot/{id}": { "get": { "summary": "Get a hoot", "tags": ["Hoots"], "description": "Get a specific hoot", "parameters": [ { "in": "path", "name": "id", "required": true, "description": "The id of the hoot you want", "schema": { "type": "string" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Hoot" } } } }, "404": { "description": "hoot not found" } }, "security": [ { "basicAuth": [] } ] } }, "/hoot/{id}/like": { "post": { "summary": "Like a hoot", "tags": ["Hoots"], "description": "Add a like to a hoot", "requestBody": { "content": { "application/json": { "schema": { "type": "object", "properties": { "liked": { "type": "boolean", "description": "Boolean based on if you're adding/removing a like (defaults to toggle)" } } } } } }, "parameters": [ { "in": "path", "name": "id", "required": true, "description": "The id of the hoot you want", "schema": { "type": "string" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Hoot" } } } }, "404": { "description": "hoot not found" }, "500": { "description": "server error" } }, "security": [ { "basicAuth": [] } ] } }, "/timeline": { "get": { "summary": "List hoots", "description": "Get a list of all hoots in reverse chronological order", "tags": ["Timeline"], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Hoot" } } } } } }, "security": [ { "basicAuth": [] } ] } }, "/timeline/{username}": { "get": { "summary": "List user's hoots", "description": "Get a list of all tweets from a user", "tags": ["Timeline"], "parameters": [ { "in": "path", "name": "username", "required": true, "description": "The username you want to see hoots for", "schema": { "type": "string" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/Hoot" } } } } } }, "security": [ { "basicAuth": [] } ] } } }, "components": { "securitySchemes": { "basicAuth": { "type": "http", "scheme": "basic" } }, "schemas": { "Hoot": { "type": "object", "required": ["post"], "properties": { "post": { "type": "string", "description": "The under-280-character content you want to hoot" }, "replyto": { "type": "string", "description": "Optional id of the hoot you're replying to" } } } } } }