Skip to content
Snippets Groups Projects
embedded_spec.go 59.2 KiB
Newer Older
Christophe de Vienne's avatar
Christophe de Vienne committed
// Code generated by go-swagger; DO NOT EDIT.

package restapi

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"encoding/json"
)

var (
	// SwaggerJSON embedded version of the swagger document used at generation time
	SwaggerJSON json.RawMessage
	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
	FlatSwaggerJSON json.RawMessage
)

func init() {
	SwaggerJSON = json.RawMessage([]byte(`{
  "consumes": [
    "application/io.orus.rednerd.v1+json",
    "application/json"
  ],
  "produces": [
    "application/io.orus.rednerd.v1+json"
  ],
  "schemes": [
    "http",
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "description": "The Rednerd rendering server. For a list of available rendering engines\nand their options, see \u003ca href=\"/docs/engines\"\u003eRednerd Engines\u003c/a\u003e.\n",
Christophe de Vienne's avatar
Christophe de Vienne committed
    "title": "Rednerd API",
    "version": "0.3.5"
Christophe de Vienne's avatar
Christophe de Vienne committed
  },
  "basePath": "/api",
  "paths": {
    "/v1/auth/authenticate": {
      "post": {
        "security": [],
        "tags": [
          "auth"
        ],
        "operationId": "authenticate",
        "parameters": [
          {
            "name": "credentials",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/credentials"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A Json Web Token with a 5 minutes validity",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      }
    },
    "/v1/auth/refresh_token": {
      "post": {
        "tags": [
          "auth"
        ],
        "operationId": "refresh-token",
        "responses": {
          "200": {
            "description": "A Json Web Token with a 5 minutes validity",
            "schema": {
              "type": "string"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      }
    },
    "/v1/auth/userinfo": {
      "get": {
        "tags": [
          "auth"
        ],
        "operationId": "userinfo",
        "responses": {
          "200": {
            "description": "Returns the user information",
            "schema": {
              "$ref": "#/definitions/userinfo"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      }
    },
    "/v1/render": {
      "post": {
        "description": "Render a template.\n\nIf provided, the template can be a complete definition (without a \"account\"\nand a \"name\"), or only a \"account\" and a \"name\" corresponding to a template\npreviously created with the template management API. In both case the\ndata must be provided.\n\nAlternatively, a single document can be provided that will be renderer into\nanother type, without processing any template. In this case the \"data\" must\nnot be provided.\n",
        "tags": [
          "rendering"
        ],
        "operationId": "render",
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/render-request"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The rendered documents",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/document"
              }
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      }
    },
    "/v1/template": {
      "get": {
        "tags": [
          "template-management"
        ],
        "operationId": "template-list",
        "responses": {
          "200": {
            "description": "List the user templates and the shared templates it has access to\n",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/template"
              }
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      }
    },
Christophe de Vienne's avatar
Christophe de Vienne committed
    "/v1/template/{account}": {
      "get": {
        "tags": [
          "template-management"
        ],
        "operationId": "account-template-list",
        "responses": {
          "200": {
            "description": "List the user templates and the shared templates it has access to\n",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/template"
              }
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "post": {
        "tags": [
          "template-management"
        ],
        "operationId": "account-template-add",
        "parameters": [
          {
            "name": "template",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/template"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Successfully added the new template",
            "schema": {
              "$ref": "#/definitions/template"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "parameters": [
        {
          "type": "string",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "name": "account",
          "in": "path",
          "required": true
        }
      ]
    },
Christophe de Vienne's avatar
Christophe de Vienne committed
    "/v1/template/{account}/{id}/render": {
      "get": {
        "description": "Render an existing template into a single document",
        "tags": [
          "rendering"
        ],
        "operationId": "render-one",
        "parameters": [
          {
            "type": "string",
            "description": "A JSON object containing the variables to inject into the template.\n",
            "name": "data",
            "in": "query"
          },
          {
            "type": "string",
            "description": "The mimetype expected after a rendering.\n",
            "name": "accept",
            "in": "query"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "A list of metadata in the form \"Name: Value\"\n",
            "name": "meta",
            "in": "query"
          }
        ],
        "responses": {
          "200": {
            "description": "The rendered document",
            "schema": {}
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "post": {
        "description": "Render an existing template into a list of documents",
        "tags": [
          "rendering"
        ],
Christophe de Vienne's avatar
Christophe de Vienne committed
        "operationId": "template-render",
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/render-template-request"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The rendered documents",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/document"
              }
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "parameters": [
        {
          "type": "string",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "name": "account",
          "in": "path",
          "required": true
        },
        {
          "type": "string",
          "name": "id",
          "in": "path",
          "required": true
        }
      ]
    "/v1/template/{account}/{name}": {
      "get": {
        "tags": [
          "template-management"
        ],
        "operationId": "account-template-get",
        "responses": {
          "200": {
            "description": "The requested template",
            "schema": {
              "$ref": "#/definitions/template"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "put": {
        "tags": [
          "template-management"
        ],
        "operationId": "account-template-update",
        "parameters": [
          {
            "name": "template",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/template"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successfully updated the template",
            "schema": {
              "$ref": "#/definitions/template"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "delete": {
        "tags": [
          "template-management"
        ],
        "operationId": "account-template-delete",
        "responses": {
          "204": {
            "description": "Successfully deleted the template",
            "schema": {
              "$ref": "#/definitions/template"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "parameters": [
        {
          "type": "string",
          "name": "account",
          "in": "path",
          "required": true
        },
        {
          "type": "string",
          "name": "name",
          "in": "path",
          "required": true
        }
      ]
    },
    "/v1/user": {
      "get": {
        "tags": [
          "user-management"
        ],
        "operationId": "user-list",
        "responses": {
          "200": {
            "description": "List the users\n",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/userinfo"
              }
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "post": {
        "tags": [
          "user-management"
        ],
        "operationId": "user-add",
        "parameters": [
          {
            "name": "user",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/userinfo"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The created user\n",
            "schema": {
              "$ref": "#/definitions/userinfo"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      }
    },
    "/v1/user/{username}": {
      "get": {
        "tags": [
          "user-management"
        ],
        "operationId": "user-get",
        "responses": {
          "200": {
            "description": "The user information\n",
            "schema": {
              "$ref": "#/definitions/userinfo"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "404": {
            "description": "the user does not exist"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "put": {
        "tags": [
          "user-management"
        ],
        "operationId": "user-update",
        "parameters": [
          {
            "name": "user",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/userinfo"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The user information\n",
            "schema": {
              "$ref": "#/definitions/userinfo"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "404": {
            "description": "the user does not exist"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "delete": {
        "tags": [
          "user-management"
        ],
        "operationId": "user-delete",
        "responses": {
          "204": {
            "description": "The user was successfully deleted"
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "404": {
            "description": "the user does not exist"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "parameters": [
        {
          "type": "string",
          "in": "path",
          "required": true
        }
      ]
    "/v1/user/{username}/apikey": {
        "description": "List the user api keys. Only the 'admin' user can manipulate the API keys.",
        "tags": [
          "user-management"
        ],
        "operationId": "user-apikey-list",
        "responses": {
          "200": {
            "description": "The user api keys",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/definitions/apikey"
              }
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "404": {
            "description": "the user does not exist"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "post": {
        "description": "Create a new api key for the user. Only the 'admin' user can manipulate the API keys.",
        "tags": [
          "user-management"
        ],
        "operationId": "user-apikey-add",
        "parameters": [
          {
            "name": "apikey",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/apikey"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "The api key was successfully created",
            "schema": {
              "$ref": "#/definitions/apikey"
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "404": {
            "description": "the user does not exist"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "parameters": [
        {
          "type": "string",
          "in": "path",
          "required": true
        }
      ]
    },
    "/v1/user/{username}/apikey/{name}": {
      "delete": {
        "description": "Remove a API key. Only the 'admin' user can manipulate the API keys.",
        "tags": [
          "user-management"
        ],
        "operationId": "user-apikey-delete",
        "responses": {
          "204": {
            "description": "The api key was successfully deleted"
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "404": {
            "description": "the user or key does not exist"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "parameters": [
        {
          "type": "string",
          "in": "path",
          "required": true
        },
        {
          "type": "string",
          "name": "name",
          "in": "path",
          "required": true
        }
      ]
    },
    "/v1/user/{username}/password": {
      "post": {
        "tags": [
          "user-management"
        ],
        "operationId": "user-password-set",
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "schema": {
              "type": "object",
              "properties": {
                "password": {
                  "description": "The user new password",
                  "type": "string"
                }
              }
            }
          }
        ],
        "responses": {
          "204": {
            "description": "The password was successfully set"
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "404": {
            "description": "the user does not exist"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "delete": {
        "tags": [
          "user-management"
        ],
        "operationId": "user-password-delete",
        "responses": {
          "204": {
            "description": "The password was successfully deleted"
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "404": {
            "description": "the user does not exist"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      },
      "parameters": [
        {
          "type": "string",
          "in": "path",
          "required": true
        }
      ]
    },
    "/v1/varlist": {
      "post": {
        "description": "Extract the list of variables present in the template. The list is not\nquaranteed to be accurate depending on the template language.\n",
        "tags": [
          "template-management"
        ],
        "operationId": "template-varlist",
        "parameters": [
          {
            "name": "request",
            "in": "body",
            "schema": {
              "$ref": "#/definitions/template"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The list of variables found in the template",
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "401": {
            "$ref": "#/responses/unauthorized"
          },
          "default": {
            "$ref": "#/responses/default"
          }
        }
      }
Christophe de Vienne's avatar
Christophe de Vienne committed
    }
  },
  "definitions": {
    "accept": {
      "description": "The mimetype expected after a rendering.\n",
      "type": "string"
    },
    "apikey": {
      "description": "A user APIkey",
      "type": "object",
      "properties": {
        "description": {
          "type": "string",
          "x-go-custom-tag": "db:\"description\""
        },
        "name": {
          "type": "string",
          "x-go-custom-tag": "db:\"name\""
        },
        "value": {
          "type": "string",
          "x-go-custom-tag": "db:\"value\""
        }
      }
    },
Christophe de Vienne's avatar
Christophe de Vienne committed
    "credentials": {
      "description": "Credentials for authentication",
      "type": "object",
      "properties": {
        "password": {
          "type": "string"
        },
        "set-cookie": {
          "description": "if true, the response will set a cookie containing the web token",
          "type": "boolean"
        },
Christophe de Vienne's avatar
Christophe de Vienne committed
        "username": {
          "type": "string"
        }
      }
    },
    "dataset": {
      "description": "A list of records to render a template",
      "type": "array",
      "items": {
        "$ref": "#/definitions/record"
      }
    },
    "document": {
      "description": "A final document. Can be returned by a rendering, but also send to render\nfor a type conversion without rendering a template.\n",
      "type": "object",
      "properties": {
        "body": {
          "description": "Content",
          "type": "string"
        },
        "body-format": {
          "description": "The body attribute format. Can be 'text' or 'base64'. Default 'base64'",
          "type": "string"
        "metadata": {
          "$ref": "#/definitions/metadata"
        "render-errors": {
          "description": "A list of non-blocking errors that occured during rendering",
          "type": "array",
          "items": {
            "$ref": "#/definitions/render-error"
          }
        },
        "type": {
          "description": "The document mimetype",
          "type": "string",
          "example": "text/html"
Christophe de Vienne's avatar
Christophe de Vienne committed
    "error": {
      "description": "Generic error type",
      "type": "object",
      "properties": {
        "message": {
          "type": "string"
        }
      }
    },
      "description": "A template or document metadata. Some values are interpreted by the\nvarious engines. For more information about those values,\nsee \u003ca href=\"/docs/engines\"\u003eRednerd Engines\u003c/a\u003e.\n",
      "type": "object",
      "additionalProperties": {
        "type": "string"
      },
      "example": {
        "print-paper-size": "A4 landscape"
      "description": "A record is a set of variables meant to be injected into a template",
      "type": "object",
      "additionalProperties": true
    },
    "render-error": {
      "description": "An error that occured during rendering",
      "type": "object",
      "properties": {
        "engine": {
          "description": "The engine that produced the error",
          "type": "string"
        },
        "extra": {
          "description": "Extra context or data about the error, specific to the rendering engine\n",
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "line": {
          "description": "The line number on which the error occured",
          "type": "integer"
        },
        "message": {
          "description": "The error message",
          "type": "string"
        }
      },
      "x-isnullable": false
    },
    "render-request": {
      "type": "object",
      "properties": {
        "accept": {
          "$ref": "#/definitions/accept"
        },
        "data": {
          "$ref": "#/definitions/dataset"
        },
        "document": {
          "description": "Document to render. Incompatible with the 'template' and 'data' properties",
          "$ref": "#/definitions/document"
        },
        "metadata": {
          "$ref": "#/definitions/metadata"
        },
        "template": {
          "$ref": "#/definitions/template"
        }
      }
    },
    "render-template-request": {
      "type": "object",
      "properties": {
        "accept": {
          "$ref": "#/definitions/accept"
        },
        "data": {
          "$ref": "#/definitions/dataset"
        },
        "metadata": {
          "$ref": "#/definitions/metadata"
        }
      }
    },
    "template": {
      "description": "A template definition. At rendering time, the \"body\" and \"metadata\"\nfields will be processed by the rendering engine corresponding to the\ntemplate \"language\" to produce a new document.\nIf you need to add metadata that should not be be processed, use\n\"static-metadata\"\n",
      "type": "object",
      "properties": {
Christophe de Vienne's avatar
Christophe de Vienne committed
        "account": {
          "description": "The template owner account name",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "type": "string",
          "x-go-custom-tag": "db:\"account\""
        },
        "body": {
          "description": "Content",
          "type": "string",
          "x-go-custom-tag": "db:\"-\""
        },
        "body-format": {
          "description": "The body attribute format. Can be 'text' or 'base64'. Default 'base64'",
          "type": "string",
          "x-go-custom-tag": "db:\"-\""
        },
        "data-schema": {
          "description": "The json-schema that can validate the input data. Currently ignored.\n",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "additionalProperties": true,
          "x-go-custom-tag": "db:\"data_schema\""
        },
        "description": {
          "description": "A description of the template",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "type": "string",
          "x-go-custom-tag": "db:\"description\""
        },
        "language": {
          "description": "The templating language used. See\n\u003ca href=\"/docs/engines\"\u003eRednerd Engines\u003c/a\u003e for a list of possible\nvalues.\n",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "type": "string",
          "x-go-custom-tag": "db:\"language\"",
          "example": "mustache"
          "description": "The template default locale, in the i18n standard codification.\n",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "type": "string",
          "x-go-custom-tag": "db:\"locale\"",
          "example": "fr_FR"
Christophe de Vienne's avatar
Christophe de Vienne committed
          "x-go-custom-tag": "db:\"metadata\"",
          "$ref": "#/definitions/metadata"
        },
        "name": {
          "description": "The template name, must be unique in an account namespace,\nand should remain simple as it is used as a slug.\n",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "type": "string",
          "x-go-custom-tag": "db:\"name\""
        },
        "produces": {
          "description": "The mimetype of the data produced by the template. If the mimetype\nis known by any engine, it can be rendered to other types.\n",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "type": "string",
          "x-go-custom-tag": "db:\"produces\"",
          "example": "text/html"
        "static-metadata": {
Christophe de Vienne's avatar
Christophe de Vienne committed
          "x-go-custom-tag": "db:\"static_metadata\"",
          "$ref": "#/definitions/metadata"
Christophe de Vienne's avatar
Christophe de Vienne committed
        "title": {
          "description": "The template title.",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "type": "string",
          "x-go-custom-tag": "db:\"title\""
        },
        "version": {
          "description": "The template version. Can be any string, the consistency of version\nnumbers is the responsibility of the client.\n",
Christophe de Vienne's avatar
Christophe de Vienne committed
          "type": "string",
          "x-go-custom-tag": "db:\"version\""
Christophe de Vienne's avatar
Christophe de Vienne committed
    "userinfo": {
      "description": "Current user information",
      "type": "object",
      "properties": {
          "type": "boolean",
          "x-go-custom-tag": "db:\"is_admin\""