Skip to content

Instantly share code, notes, and snippets.

@eandre
Created December 11, 2023 16:23
Show Gist options
  • Save eandre/f4cdc209a4e6d91592e271862b8551a2 to your computer and use it in GitHub Desktop.
Save eandre/f4cdc209a4e6d91592e271862b8551a2 to your computer and use it in GitHub Desktop.
{
"components": {
"responses": {
"APIError": {
"content": {
"application/json": {
"schema": {
"externalDocs": {
"url": "https://pkg.go.dev/encore.dev/beta/errs#Error"
},
"properties": {
"code": {
"description": "Error code",
"example": "not_found",
"externalDocs": {
"url": "https://pkg.go.dev/encore.dev/beta/errs#ErrCode"
},
"type": "string"
},
"details": {
"description": "Error details",
"type": "object"
},
"message": {
"description": "Error message",
"type": "string"
}
},
"title": "APIError",
"type": "object"
}
}
},
"description": "Error response"
}
},
"schemas": {
"monitor.SiteStatus": {
"properties": {
"checked_at": {
"format": "date-time",
"type": "string"
},
"up": {
"type": "boolean"
}
},
"type": "object"
},
"site.Site": {
"properties": {
"id": {
"format": "int64",
"title": "ID is a unique ID for the site.\n",
"type": "integer"
},
"url": {
"title": "URL is the site's URL.\n",
"type": "string"
}
},
"type": "object"
}
}
},
"info": {
"description": "Generated by encore",
"title": "API for uptime-7chi",
"version": "1",
"x-logo": {
"altText": "Encore logo",
"backgroundColor": "#EEEEE1",
"url": "https://encore.dev/assets/branding/logo/logo-black.png"
}
},
"openapi": "3.0.0",
"paths": {
"/check-all": {
"post": {
"operationId": "POST:monitor.CheckAll",
"responses": {
"200": {
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "CheckAll checks all sites.\n"
}
},
"/check/{siteID}": {
"post": {
"description": "and recording the result in the database. If the website transitions from up-\u003edown or vice versa it publishes an event to notify Slack.\n",
"operationId": "POST:monitor.CheckOne",
"parameters": [
{
"allowEmptyValue": true,
"explode": false,
"in": "path",
"name": "siteID",
"required": true,
"schema": {
"format": "int64",
"type": "integer"
},
"style": "simple"
}
],
"responses": {
"200": {
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "CheckOne checks a single site, pinging the website\n"
}
},
"/ping/{url}": {
"get": {
"operationId": "GET:monitor.Ping",
"parameters": [
{
"allowEmptyValue": true,
"explode": false,
"in": "path",
"name": "url",
"required": true,
"schema": {
"type": "string"
},
"style": "simple"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"up": {
"type": "boolean"
}
},
"type": "object"
}
}
},
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Ping pings a specific site and determines whether it's up or down right now.\n"
},
"post": {
"operationId": "POST:monitor.Ping",
"parameters": [
{
"allowEmptyValue": true,
"explode": false,
"in": "path",
"name": "url",
"required": true,
"schema": {
"type": "string"
},
"style": "simple"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"up": {
"type": "boolean"
}
},
"type": "object"
}
}
},
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Ping pings a specific site and determines whether it's up or down right now.\n"
}
},
"/site": {
"get": {
"operationId": "GET:site.List",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"sites": {
"items": {
"$ref": "#/components/schemas/site.Site"
},
"title": "Sites is the list of monitored sites.\n",
"type": "array"
}
},
"type": "object"
}
}
},
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "List lists the monitored websites.\n"
},
"post": {
"operationId": "POST:site.Add",
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"url": {
"description": "(like \"http:\" or \"https:\") it defaults to \"https:\".\n",
"title": "URL is the URL of the site. If it doesn't contain a scheme\n",
"type": "string"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"id": {
"format": "int64",
"title": "ID is a unique ID for the site.\n",
"type": "integer"
},
"url": {
"title": "URL is the site's URL.\n",
"type": "string"
}
},
"type": "object"
}
}
},
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Add adds a new site to the list of monitored websites.\n"
}
},
"/site.Reset": {
"get": {
"operationId": "GET:site.Reset",
"responses": {
"200": {
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Reset resets the database to a known state to prevent abuse.\n"
},
"post": {
"operationId": "POST:site.Reset",
"responses": {
"200": {
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Reset resets the database to a known state to prevent abuse.\n"
}
},
"/site/{siteID}": {
"delete": {
"operationId": "DELETE:site.Delete",
"parameters": [
{
"allowEmptyValue": true,
"explode": false,
"in": "path",
"name": "siteID",
"required": true,
"schema": {
"format": "int64",
"type": "integer"
},
"style": "simple"
}
],
"responses": {
"200": {
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Delete deletes a site by id.\n"
},
"get": {
"operationId": "GET:site.Get",
"parameters": [
{
"allowEmptyValue": true,
"explode": false,
"in": "path",
"name": "siteID",
"required": true,
"schema": {
"format": "int64",
"type": "integer"
},
"style": "simple"
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"id": {
"format": "int64",
"title": "ID is a unique ID for the site.\n",
"type": "integer"
},
"url": {
"title": "URL is the site's URL.\n",
"type": "string"
}
},
"type": "object"
}
}
},
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Get gets a site by id.\n"
}
},
"/slack.Notify": {
"post": {
"operationId": "POST:slack.Notify",
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"text": {
"title": "Text is the Slack message text to send.\n",
"type": "string"
}
},
"type": "object"
}
}
}
},
"responses": {
"200": {
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Notify sends a Slack message to a pre-configured channel.\n"
}
},
"/status": {
"get": {
"operationId": "GET:monitor.Status",
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"properties": {
"sites": {
"additionalProperties": {
"$ref": "#/components/schemas/monitor.SiteStatus"
},
"description": "keyed by the site ID.\n",
"title": "Sites contains the current status of all sites,\n",
"type": "object"
}
},
"type": "object"
}
}
},
"description": "Success response"
},
"default": {
"$ref": "#/components/responses/APIError"
}
},
"summary": "Status checks the current up/down status of all monitored sites.\n"
}
}
},
"servers": [
{
"description": "Encore local dev environment",
"url": "http://localhost:4000"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment