{
  "consumes": [
    "application/json"
  ],
  "definitions": {
    "Description": {
      "example": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus lectus erat, cursus a maximus eu, aliquam dictum lorem. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Fusce posuere lectus sed metus euismod finibus. Donec turpis justo, tempus non lobortis quis, lacinia quis nibh. Donec at tellus iaculis, bibendum nunc nec, pulvinar purus. Praesent ultrices eros a quam elementum, faucibus egestas neque egestas. Morbi cursus mattis magna ac rhoncus.",
      "maxLength": 1024,
      "type": "string"
    },
    "Email": {
      "example": "bond007@example.org",
      "type": "string",
      "format": "email"
    },
    "Lib": {
      "properties": {
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "contributors": {
          "items": {
            "$ref": "#/definitions/Username"
          },
          "type": "array",
          "uniqueItems": true
        },
        "description": {
          "$ref": "#/definitions/Description"
        },
        "libname": {
          "$ref": "#/definitions/Libname"
        },
        "owner": {
          "$ref": "#/definitions/Username"
        },
        "uuid": {
          "$ref": "#/definitions/Uuid"
        },
        "versions": {
          "items": {
            "$ref": "#/definitions/Semver"
          },
          "type": "array",
          "uniqueItems": true
        },
        "unlisted": {
          "type": "boolean"
        }
      },
      "required": [
        "contributors",
        "description",
        "libname",
        "owner",
        "uuid",
        "versions"
      ],
      "type": "object"
    },
    "LibVersion": {
      "properties": {
        "author": {
          "$ref": "#/definitions/Username"
        },
        "description": {
          "$ref": "#/definitions/Description"
        },
        "semver": {
          "$ref": "#/definitions/Semver"
        },
        "time": {
          "format": "date-time",
          "type": "string"
        },
        "uuid": {
          "$ref": "#/definitions/Uuid"
        }
      },
      "required": [
        "author",
        "description",
        "semver",
        "time",
        "uuid"
      ],
      "type": "object"
    },
    "Libname": {
      "example": "core",
      "maxLength": 63,
      "minLength": 1,
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "type": "string"
    },
    "Password": {
      "example": "Crazy@Thing$Called1Love",
      "maxLength": 64,
      "minLength": 8,
      "type": "string",
      "format": "password"
    },
    "Page": {
      "properties": {
        "count": {
          "description": "Total records count",
          "example": 123,
          "format": "int32",
          "maximum": 2147483647,
          "minimum": 0,
          "type": "integer"
        },
        "first": {
          "description": "First page number",
          "example": 1,
          "format": "int32",
          "maximum": 2147483647,
          "minimum": 1,
          "type": "integer"
        },
        "last": {
          "description": "Last page number",
          "example": 13,
          "format": "int32",
          "maximum": 2147483647,
          "minimum": 1,
          "type": "integer"
        },
        "next": {
          "description": "Next page number",
          "example": 8,
          "format": "int32",
          "maximum": 2147483647,
          "minimum": 1,
          "type": "integer"
        },
        "prev": {
          "description": "Previous page number",
          "example": 6,
          "format": "int32",
          "maximum": 2147483647,
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "count",
        "first",
        "last"
      ],
      "type": "object"
    },
    "Semver": {
      "example": "v0.1.2",
      "maxLength": 32,
      "minLength": 5,
      "pattern": "^v(0|[^0\\D]\\d{0,9})\\.(0|[^0\\D]\\d{0,9})\\.(0|[^0\\D]\\d{0,9})$",
      "type": "string"
    },
    "User": {
      "allOf": [
        {
          "$ref": "#/definitions/UserAttributes"
        },
        {
          "properties": {
            "created": {
              "format": "date-time",
              "readOnly": true,
              "type": "string"
            },
            "type": {
              "default": "person",
              "enum": [
                "organization",
                "person"
              ],
              "type": "string"
            },
            "username": {
              "$ref": "#/definitions/Username"
            },
            "uuid": {
              "$ref": "#/definitions/Uuid"
            }
          }
        }
      ],
      "required": [
        "created",
        "type",
        "username",
        "uuid"
      ],
      "type": "object"
    },
    "UserAttributes": {
      "properties": {
        "avatar_200x200": {
          "example": "https://storage.googleapis.com/pm.xod.show/AVATARS/xod/200x200.jpeg?1513169660795648=",
          "format": "url",
          "type": "string"
        },
        "avatar_20x20": {
          "example": "https://storage.googleapis.com/pm.xod.show/AVATARS/xod/20x20.jpeg?1513169660879234=",
          "format": "url",
          "type": "string"
        },
        "avatar_50x50": {
          "example": "https://storage.googleapis.com/pm.xod.show/AVATARS/xod/50x50.jpeg?1513169660836020=",
          "format": "url",
          "type": "string"
        },
        "avatar_original": {
          "example": "https://storage.googleapis.com/pm.xod.show/AVATARS/xod/original.jpeg?1513169660698208=",
          "format": "url",
          "type": "string"
        },
        "bio": {
          "example": "Praesent pretium id sem sed pellentesque. Nunc faucibus elit quis enim volutpat ullamcorper. Nulla non feugiat augue. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.",
          "maxLength": 300,
          "type": "string"
        },
        "first_name": {
          "example": "XOD",
          "maxLength": 50,
          "type": "string"
        },
        "last_name": {
          "example": "Developers",
          "maxLength": 50,
          "type": "string"
        },
        "link_arduino": {
          "example": "https://id.arduino.cc/xod",
          "format": "url",
          "type": "string"
        },
        "link_facebook": {
          "example": "https://www.facebook.com/xod",
          "format": "url",
          "type": "string"
        },
        "link_github": {
          "example": "https://github.com/xod",
          "format": "url",
          "type": "string"
        },
        "link_personal": {
          "example": "https://xod.io",
          "format": "url",
          "type": "string"
        },
        "link_stackoverflow": {
          "example": "https://stackoverflow.com/users/1234567/xod",
          "format": "url",
          "type": "string"
        },
        "link_twitter": {
          "example": "https://twitter.com/xod",
          "format": "url",
          "type": "string"
        },
        "location": {
          "example": "Moscow, Russia",
          "maxLength": 100,
          "type": "string"
        }
      },
      "type": "object"
    },
    "UserAttributesWithEmailUsernamePassword": {
      "allOf": [
        {
          "$ref": "#/definitions/UserAttributes"
        },
        {
          "properties": {
            "email": {
              "$ref": "#/definitions/Email"
            },
            "username": {
              "$ref": "#/definitions/Username"
            },
            "password": {
              "$ref": "#/definitions/Password"
            }
          },
          "required": [
            "email",
            "username",
            "password"
          ],
          "type": "object"
        }
      ],
      "type": "object"
    },
    "Username": {
      "maxLength": 63,
      "minLength": 1,
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "type": "string"
    },
    "Uuid": {
      "example": "ac9f5d9d-6fef-4d53-bd37-5c65c0f4d70b",
      "format": "uuid",
      "maxLength": 36,
      "minLength": 36,
      "type": "string"
    }
  },
  "info": {
    "contact": {
      "email": "dev@xod.io",
      "name": "XOD Developers"
    },
    "description": "# pm.xod.io service",
    "title": "pm",
    "version": "1.16.0"
  },
  "parameters": {
    "Libname": {
      "description": "URL-safe library name",
      "in": "path",
      "maxLength": 63,
      "minLength": 1,
      "name": "libname",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "required": true,
      "type": "string"
    },
    "Orgname": {
      "description": "URL-safe organization name",
      "in": "path",
      "maxLength": 63,
      "minLength": 1,
      "name": "orgname",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "required": true,
      "type": "string"
    },
    "Page": {
      "default": 1,
      "description": "Page number",
      "format": "int32",
      "in": "query",
      "maximum": 2147483647,
      "minimum": 1,
      "name": "page",
      "type": "integer"
    },
    "PerPage": {
      "default": 10,
      "description": "Entries per page",
      "format": "int32",
      "in": "query",
      "maximum": 100,
      "minimum": 1,
      "name": "per_page",
      "type": "integer"
    },
    "SemverOrLatest": {
      "description": "Semantic version number or `latest` tag",
      "in": "path",
      "maxLength": 32,
      "minLength": 5,
      "name": "semver_or_latest",
      "pattern": "^(v(0|[^0\\D]\\d{0,9})\\.(0|[^0\\D]\\d{0,9})\\.(0|[^0\\D]\\d{0,9})|latest)$",
      "required": true,
      "type": "string"
    },
    "TrusteeName": {
      "description": "URL-safe trusted user name",
      "in": "path",
      "maxLength": 63,
      "minLength": 1,
      "name": "trustee",
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "required": true,
      "type": "string"
    },
    "Username": {
      "maxLength": 63,
      "minLength": 1,
      "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$",
      "type": "string",
      "description": "URL-safe user name",
      "in": "path",
      "name": "username",
      "required": true
    }
  },
  "paths": {
    "/auth": {
      "post": {
        "operationId": "getDirectGrant",
        "parameters": [
          {
            "description": "User credentials",
            "in": "body",
            "name": "user",
            "required": true,
            "schema": {
              "additionalProperties": false,
              "properties": {
                "password": {
                  "format": "password",
                  "type": "string"
                },
                "username": {
                  "$ref": "#/definitions/Username"
                }
              },
              "required": [
                "password",
                "username"
              ],
              "type": "object"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Authorization grant",
            "schema": {
              "properties": {
                "access_token": {
                  "type": "string"
                },
                "refresh_token": {
                  "type": "string"
                }
              },
              "required": [
                "access_token",
                "refresh_token"
              ],
              "type": "object"
            }
          },
          "403": {
            "description": "Authorization is not granted"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns authorization grant",
        "tags": [
          "Auth"
        ]
      }
    },
    "/libs": {
      "get": {
        "operationId": "getLibs",
        "parameters": [
          {
            "$ref": "#/parameters/Page"
          },
          {
            "$ref": "#/parameters/PerPage"
          },
          {
            "name": "order",
            "in": "query",
            "description": "Order by field fields",
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "owner",
                "-owner",
                "libname",
                "-libname",
                "created_at",
                "-created_at",
                "updated_at",
                "-updated_at"
              ]
            },
            "default": [
              "-updated_at"
            ]
          },
          {
            "name": "q",
            "in": "query",
            "description": "Search terms to filter libraries by name/owner/description/etc",
            "type": "string"
          }
        ],
        "responses": {
          "200": {
            "description": "Enlisted libraries page",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/Page"
                },
                {
                  "properties": {
                    "records": {
                      "items": {
                        "$ref": "#/definitions/Lib"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "records"
                  ],
                  "type": "object"
                }
              ],
              "type": "object"
            }
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns enlisted libraries page-by-page",
        "tags": [
          "Library"
        ]
      }
    },
    "/orgs": {
      "get": {
        "deprecated": true,
        "operationId": "getOrgs",
        "parameters": [
          {
            "$ref": "#/parameters/Page"
          },
          {
            "$ref": "#/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/Page"
                },
                {
                  "properties": {
                    "records": {
                      "items": {
                        "$ref": "#/definitions/User"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "records"
                  ],
                  "type": "object"
                }
              ],
              "type": "object"
            }
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Reads organizations page-by-page",
        "tags": [
          "Organization"
        ]
      }
    },
    "/orgs/{orgname}": {
      "get": {
        "deprecated": true,
        "operationId": "getOrg",
        "parameters": [
          {
            "$ref": "#/parameters/Orgname"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/User"
            }
          },
          "404": {
            "$ref": "#/responses/NotFound"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Reads organization",
        "tags": [
          "Organization"
        ]
      }
    },
    "/orgs/{orgname}/libs/{libname}": {
      "get": {
        "deprecated": true,
        "operationId": "getOrgLib",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Orgname"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/Lib"
            }
          },
          "404": {
            "$ref": "#/responses/NotFound"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Reads organization library",
        "tags": [
          "Library"
        ]
      },
      "put": {
        "deprecated": true,
        "operationId": "putOrgLib",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "description": "Library properties",
            "in": "body",
            "name": "lib",
            "required": true,
            "schema": {
              "type": "object"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Organization library has been created"
          },
          "204": {
            "description": "Organization library has been updated"
          },
          "403": {
            "description": "Either user is not authenticated or not permitted to create/update organization library"
          },
          "404": {
            "description": "User or organization is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Creates/updates organization library",
        "tags": [
          "Library"
        ]
      }
    },
    "/orgs/{orgname}/libs/{libname}/publish": {
      "put": {
        "deprecated": true,
        "operationId": "publishOrgLib",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "description": "Make organization library private?",
            "in": "body",
            "name": "private",
            "required": true,
            "schema": {
              "additionalProperties": false,
              "properties": {
                "private": {
                  "type": "boolean"
                }
              },
              "required": [
                "private"
              ],
              "type": "object"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Organization library has been (un)published"
          },
          "403": {
            "description": "Either user is not authenticated or not permitted to (un)publish organization library"
          },
          "404": {
            "description": "User, organization or library is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "(Un)publishes organization library",
        "tags": [
          "Library"
        ]
      }
    },
    "/orgs/{orgname}/libs/{libname}/versions": {
      "get": {
        "deprecated": true,
        "operationId": "getLibVersions",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "$ref": "#/parameters/Page"
          },
          {
            "$ref": "#/parameters/PerPage"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/Page"
                },
                {
                  "properties": {
                    "records": {
                      "items": {
                        "$ref": "#/definitions/LibVersion"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "records"
                  ],
                  "type": "object"
                }
              ],
              "type": "object"
            }
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Reads library versions",
        "tags": [
          "Version"
        ]
      },
      "post": {
        "deprecated": true,
        "operationId": "postLibVersion",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "description": "Version properties",
            "in": "body",
            "name": "version",
            "required": true,
            "schema": {
              "additionalProperties": false,
              "properties": {
                "description": {
                  "$ref": "#/definitions/Description"
                },
                "folder": {
                  "type": "object"
                },
                "semver": {
                  "$ref": "#/definitions/Semver"
                }
              },
              "required": [
                "description",
                "folder",
                "semver"
              ],
              "type": "object"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Library version has been created"
          },
          "403": {
            "description": "Either user is not authenticated or not permitted to create library versions"
          },
          "404": {
            "description": "User, organization or library is not found"
          },
          "409": {
            "description": "Library version already exists"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Creates library version",
        "tags": [
          "Version"
        ]
      }
    },
    "/orgs/{orgname}/libs/{libname}/versions/{semver_or_latest}": {
      "get": {
        "deprecated": true,
        "operationId": "getLibVersion",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "$ref": "#/parameters/SemverOrLatest"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/LibVersion"
                },
                {
                  "properties": {
                    "folder": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "folder"
                  ],
                  "type": "object"
                }
              ],
              "type": "object"
            }
          },
          "404": {
            "description": "User, organization, library or version is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Reads library version",
        "tags": [
          "Version"
        ]
      }
    },
    "/orgs/{orgname}/libs/{libname}/versions/{semver_or_latest}/xodball": {
      "get": {
        "deprecated": true,
        "operationId": "getLibVersionXodball",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "$ref": "#/parameters/SemverOrLatest"
          }
        ],
        "responses": {
          "303": {
            "description": "See Other",
            "schema": {
              "type": "string"
            }
          },
          "404": {
            "description": "User, organization, library or version is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Reads version xodball",
        "tags": [
          "Version"
        ]
      }
    },
    "/orgs/{orgname}/members/{username}": {
      "delete": {
        "deprecated": true,
        "operationId": "deleteOrgMember",
        "parameters": [
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "$ref": "#/parameters/Username"
          }
        ],
        "responses": {
          "204": {
            "description": "Member has been removed from the organization"
          },
          "403": {
            "description": "Either user is not authenticated or not permitted to remove members from the organization"
          },
          "404": {
            "description": "User, member or organization is not found"
          },
          "409": {
            "description": "Either member is the same as user or the organization founder"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Removes member from organization",
        "tags": [
          "Organization"
        ]
      },
      "put": {
        "deprecated": true,
        "operationId": "putOrgMember",
        "parameters": [
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "$ref": "#/parameters/Username"
          },
          {
            "description": "Grant admin to member?",
            "in": "body",
            "name": "admin",
            "required": true,
            "schema": {
              "additionalProperties": false,
              "properties": {
                "admin": {
                  "type": "boolean"
                }
              },
              "required": [
                "admin"
              ],
              "type": "object"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Member has been added to the organization"
          },
          "403": {
            "description": "Either user is not authenticated or not permitted to add members to the organization"
          },
          "404": {
            "description": "User, member or organization is not found"
          },
          "409": {
            "description": "Either member is the same as user or the organization founder"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Adds member to organization",
        "tags": [
          "Organization"
        ]
      }
    },
    "/swagger": {
      "get": {
        "responses": {
          "200": {
            "description": "Swagger Schema",
            "schema": {
              "type": "object"
            }
          }
        }
      }
    },
    "/users": {
      "get": {
        "operationId": "getUsers",
        "parameters": [
          {
            "$ref": "#/parameters/Page"
          },
          {
            "$ref": "#/parameters/PerPage"
          },
          {
            "name": "term",
            "in": "query",
            "description": "Search users by string",
            "type": "string",
            "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
          }
        ],
        "responses": {
          "200": {
            "description": "Users page",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/Page"
                },
                {
                  "properties": {
                    "records": {
                      "items": {
                        "$ref": "#/definitions/User"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "records"
                  ],
                  "type": "object"
                }
              ],
              "type": "object"
            }
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns users page-by-page",
        "tags": [
          "User"
        ]
      },
      "post": {
        "operationId": "postUsers",
        "parameters": [
          {
            "description": "User attributes with required username, email, and password",
            "in": "body",
            "name": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UserAttributesWithEmailUsernamePassword"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "User created"
          },
          "409": {
            "$ref": "#/responses/SwaggerValidationErrorTyped"
          },
          "500": {
            "$ref": "#/responses/InternalServerError"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationErrorTyped"
          }
        },
        "summary": "Create user",
        "tags": [
          "User"
        ]
      }
    },
    "/users/{username}": {
      "get": {
        "operationId": "getUser",
        "parameters": [
          {
            "$ref": "#/parameters/Username"
          }
        ],
        "responses": {
          "200": {
            "description": "User",
            "schema": {
              "$ref": "#/definitions/User"
            }
          },
          "404": {
            "description": "User is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns user",
        "tags": [
          "User"
        ]
      },
      "patch": {
        "operationId": "patchUser",
        "parameters": [
          {
            "$ref": "#/parameters/Username"
          },
          {
            "in": "body",
            "name": "user",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UserAttributes"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "User has been updated"
          },
          "403": {
            "description": "Either user is not authenticated or does not match username"
          },
          "404": {
            "description": "User is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Updates user",
        "tags": [
          "User"
        ]
      }
    },
    "/users/{username}/avatar": {
      "get": {
        "operationId": "getAvatar",
        "parameters": [
          {
            "$ref": "#/parameters/Username"
          },
          {
            "description": "Image size",
            "enum": [
              "20x20",
              "50x50",
              "200x200"
            ],
            "in": "query",
            "name": "size",
            "type": "string"
          }
        ],
        "responses": {
          "303": {
            "description": "User avatar location",
            "schema": {
              "type": "string"
            }
          },
          "404": {
            "description": "User or avatar is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns user avatar",
        "tags": [
          "Avatar"
        ]
      },
      "put": {
        "consumes": [
          "multipart/form-data"
        ],
        "operationId": "putAvatar",
        "parameters": [
          {
            "$ref": "#/parameters/Username"
          },
          {
            "description": "Image file",
            "in": "formData",
            "name": "avatar",
            "required": true,
            "type": "file"
          }
        ],
        "responses": {
          "204": {
            "description": "User avatar is set"
          },
          "403": {
            "description": "Either user is not authenticated or does not match username"
          },
          "404": {
            "description": "User is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Sets user avatar",
        "tags": [
          "Avatar"
        ]
      }
    },
    "/users/{username}/libs/{libname}": {
      "get": {
        "operationId": "getLib",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Username"
          }
        ],
        "responses": {
          "200": {
            "description": "User library",
            "schema": {
              "$ref": "#/definitions/Lib"
            }
          },
          "404": {
            "$ref": "#/responses/NotFound"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns user library",
        "tags": [
          "Library"
        ]
      },
      "put": {
        "operationId": "putLib",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Username"
          }
        ],
        "responses": {
          "201": {
            "description": "Library has been created"
          },
          "204": {
            "description": "Library has been updated"
          },
          "403": {
            "description": "Either user is not authenticated or not a library owner/trustee"
          },
          "404": {
            "description": "User is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Creates or updates user library",
        "tags": [
          "Library"
        ]
      }
    },
    "/users/{username}/libs/{libname}/enlist": {
      "put": {
        "operationId": "enlistLib",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Username"
          },
          {
            "description": "Enlist user library?",
            "in": "body",
            "name": "lib",
            "required": true,
            "schema": {
              "properties": {
                "unlisted": {
                  "type": "boolean"
                }
              },
              "required": [
                "unlisted"
              ],
              "type": "object"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Library has been enlisted/unlisted"
          },
          "403": {
            "description": "Either user is not authenticated or not a library owner/trustee"
          },
          "404": {
            "description": "User or library is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Enlists or unlists user library",
        "tags": [
          "Library"
        ]
      }
    },
    "/users/{username}/libs/{libname}/versions": {
      "get": {
        "operationId": "getLibVersionsNew",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Page"
          },
          {
            "$ref": "#/parameters/PerPage"
          },
          {
            "$ref": "#/parameters/Username"
          }
        ],
        "responses": {
          "200": {
            "description": "Library versions page",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/Page"
                },
                {
                  "properties": {
                    "records": {
                      "items": {
                        "$ref": "#/definitions/LibVersion"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "records"
                  ],
                  "type": "object"
                }
              ],
              "type": "object"
            }
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns library versions page-by-page",
        "tags": [
          "LibVersion"
        ]
      },
      "post": {
        "operationId": "postLibVersionNew",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/Username"
          },
          {
            "description": "Library version",
            "in": "body",
            "name": "version",
            "required": true,
            "schema": {
              "additionalProperties": false,
              "properties": {
                "description": {
                  "$ref": "#/definitions/Description"
                },
                "folder": {
                  "type": "object"
                },
                "semver": {
                  "$ref": "#/definitions/Semver"
                }
              },
              "required": [
                "description",
                "folder",
                "semver"
              ],
              "type": "object"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Library version has been created"
          },
          "403": {
            "description": "Either user is not authenticated or not a library owner/trustee"
          },
          "404": {
            "description": "User or library is not found"
          },
          "409": {
            "description": "Library version already exists"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Creates library version",
        "tags": [
          "LibVersion"
        ]
      }
    },
    "/users/{username}/libs/{libname}/versions/{semver_or_latest}": {
      "get": {
        "operationId": "getLibVersionNew",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/SemverOrLatest"
          },
          {
            "$ref": "#/parameters/Username"
          }
        ],
        "responses": {
          "200": {
            "description": "Library version",
            "schema": {
              "allOf": [
                {
                  "$ref": "#/definitions/LibVersion"
                },
                {
                  "properties": {
                    "folder": {
                      "type": "object"
                    }
                  },
                  "required": [
                    "folder"
                  ],
                  "type": "object"
                }
              ],
              "type": "object"
            }
          },
          "404": {
            "description": "User, library or version is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns library version",
        "tags": [
          "LibVersion"
        ]
      }
    },
    "/users/{username}/libs/{libname}/versions/{semver_or_latest}/xodball": {
      "get": {
        "operationId": "getLibVersionXodballNew",
        "parameters": [
          {
            "$ref": "#/parameters/Libname"
          },
          {
            "$ref": "#/parameters/SemverOrLatest"
          },
          {
            "$ref": "#/parameters/Username"
          }
        ],
        "responses": {
          "303": {
            "description": "Library version xodball location",
            "schema": {
              "type": "string"
            }
          },
          "404": {
            "description": "User, library or version is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Returns library version xodball",
        "tags": [
          "LibVersion"
        ]
      }
    },
    "/users/{username}/orgs/{orgname}": {
      "put": {
        "deprecated": true,
        "operationId": "putUserOrg",
        "parameters": [
          {
            "$ref": "#/parameters/Orgname"
          },
          {
            "$ref": "#/parameters/Username"
          },
          {
            "description": "Organization properties",
            "in": "body",
            "name": "org",
            "required": true,
            "schema": {
              "type": "object"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "User organization has been updated"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "summary": "Creates or updates user organization",
        "tags": [
          "User"
        ]
      }
    },
    "/users/{username}/trust/{trustee}": {
      "delete": {
        "operationId": "deleteTrust",
        "parameters": [
          {
            "$ref": "#/parameters/Username"
          },
          {
            "$ref": "#/parameters/TrusteeName"
          }
        ],
        "responses": {
          "204": {
            "description": "User trust has been revoked"
          },
          "403": {
            "description": "Either user is not authenticated or does not match username"
          },
          "404": {
            "description": "User or trustee is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Revokes user trust",
        "tags": [
          "User"
        ]
      },
      "put": {
        "operationId": "putTrust",
        "parameters": [
          {
            "$ref": "#/parameters/Username"
          },
          {
            "$ref": "#/parameters/TrusteeName"
          }
        ],
        "responses": {
          "204": {
            "description": "User trust has been established"
          },
          "403": {
            "description": "Either user is not authenticated or does not match username"
          },
          "404": {
            "description": "User or trustee is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Establishes user trust",
        "tags": [
          "User"
        ]
      }
    },
    "/users/{username}/type": {
      "put": {
        "operationId": "switchType",
        "parameters": [
          {
            "$ref": "#/parameters/Username"
          },
          {
            "in": "body",
            "name": "user",
            "required": true,
            "schema": {
              "properties": {
                "type": {
                  "enum": [
                    "organization",
                    "person"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "type"
              ],
              "type": "object"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "User type has been switched"
          },
          "403": {
            "description": "Either user is not authenticated or does not match username"
          },
          "404": {
            "description": "User is not found"
          },
          "default": {
            "$ref": "#/responses/SwaggerValidationError"
          }
        },
        "security": [
          {
            "bearer_token": []
          }
        ],
        "summary": "Switches user type",
        "tags": [
          "User"
        ]
      }
    }
  },
  "produces": [
    "application/json"
  ],
  "responses": {
    "NotFound": {
      "description": "Not Found"
    },
    "InternalServerError": {
      "description": "Internal Server Error"
    },
    "SwaggerValidationError": {
      "description": "Swagger validation error"
    },
    "SwaggerValidationErrorTyped": {
      "description": "Swagger validation error",
      "schema": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "in": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "path": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "errors": {
                  "type": "object",
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "params": {
                      "type": "array",
                      "items": {}
                    },
                    "message": {
                      "type": "string"
                    },
                    "path": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "securityDefinitions": {
    "bearer_token": {
      "in": "header",
      "name": "Authorization",
      "type": "apiKey"
    }
  },
  "swagger": "2.0",
  "tags": [
    {
      "name": "Auth"
    },
    {
      "name": "Avatar"
    },
    {
      "name": "Library"
    },
    {
      "name": "LibVersion"
    },
    {
      "name": "Organization"
    },
    {
      "name": "User"
    },
    {
      "name": "Version"
    }
  ]
}