| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429 |
- 'use strict'
- const Blob = require('overleaf-editor-core').Blob
- exports.paths = {
- '/projects': {
- post: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'initializeProject',
- tags: ['Project'],
- description: 'Initialize project.',
- parameters: [
- {
- name: 'body',
- in: 'body',
- schema: {
- type: 'object',
- properties: {
- projectId: { type: 'string' },
- },
- },
- },
- ],
- responses: {
- 200: {
- description: 'Initialized',
- schema: {
- $ref: '#/definitions/Project',
- },
- },
- },
- security: [
- {
- basic: [],
- },
- ],
- },
- },
- '/projects/{project_id}': {
- delete: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'deleteProject',
- tags: ['Project'],
- description: "Delete a project's history",
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- ],
- responses: {
- 204: {
- description: 'Success',
- },
- },
- security: [
- {
- basic: [],
- },
- ],
- },
- },
- '/projects/{project_id}/blobs/{hash}': {
- get: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'getProjectBlob',
- tags: ['Project'],
- description: 'Fetch blob content by its project id and hash.',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- {
- name: 'hash',
- in: 'path',
- description: 'Hexadecimal SHA-1 hash',
- required: true,
- type: 'string',
- pattern: Blob.HEX_HASH_RX_STRING,
- },
- ],
- produces: ['application/octet-stream'],
- responses: {
- 200: {
- description: 'Success',
- schema: {
- type: 'file',
- },
- },
- 404: {
- description: 'Not Found',
- schema: {
- $ref: '#/definitions/Error',
- },
- },
- },
- security: [{ jwt: [] }, { token: [] }],
- },
- put: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'createProjectBlob',
- tags: ['Project'],
- description:
- 'Create blob to be used in a file addition operation when importing a' +
- ' snapshot or changes',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- {
- name: 'hash',
- in: 'path',
- description: 'Hexadecimal SHA-1 hash',
- required: true,
- type: 'string',
- pattern: Blob.HEX_HASH_RX_STRING,
- },
- ],
- responses: {
- 201: {
- description: 'Created',
- },
- },
- },
- },
- '/projects/{project_id}/latest/content': {
- get: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'getLatestContent',
- tags: ['Project'],
- description:
- 'Get full content of the latest version. Text file ' +
- 'content is included, but binary files are just linked by hash.',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- ],
- responses: {
- 200: {
- description: 'Success',
- schema: {
- $ref: '#/definitions/Snapshot',
- },
- },
- 404: {
- description: 'Not Found',
- schema: {
- $ref: '#/definitions/Error',
- },
- },
- },
- },
- },
- '/projects/{project_id}/latest/hashed_content': {
- get: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'getLatestHashedContent',
- tags: ['Project'],
- description:
- 'Get a snapshot of a project at the latest version ' +
- 'with the hashes for the contents each file',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- ],
- responses: {
- 200: {
- description: 'Success',
- schema: {
- $ref: '#/definitions/Snapshot',
- },
- },
- 404: {
- description: 'Not Found',
- schema: {
- $ref: '#/definitions/Error',
- },
- },
- },
- security: [
- {
- basic: [],
- },
- ],
- },
- },
- '/projects/{project_id}/latest/history': {
- get: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'getLatestHistory',
- tags: ['Project'],
- description:
- 'Get the latest sequence of changes.' +
- ' TODO probably want a configurable depth.',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- ],
- responses: {
- 200: {
- description: 'Success',
- schema: {
- $ref: '#/definitions/ChunkResponse',
- },
- },
- 404: {
- description: 'Not Found',
- schema: {
- $ref: '#/definitions/Error',
- },
- },
- },
- },
- },
- '/projects/{project_id}/latest/persistedHistory': {
- get: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'getLatestPersistedHistory',
- tags: ['Project'],
- description: 'Get the latest sequence of changes.',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- ],
- responses: {
- 200: {
- description: 'Success',
- schema: {
- $ref: '#/definitions/ChunkResponse',
- },
- },
- 404: {
- description: 'Not Found',
- schema: {
- $ref: '#/definitions/Error',
- },
- },
- },
- },
- },
- '/projects/{project_id}/versions/{version}/history': {
- get: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'getHistory',
- tags: ['Project'],
- description:
- 'Get the sequence of changes that includes the given version.',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- {
- name: 'version',
- in: 'path',
- description: 'numeric version',
- required: true,
- type: 'number',
- },
- ],
- responses: {
- 200: {
- description: 'Success',
- schema: {
- $ref: '#/definitions/ChunkResponse',
- },
- },
- 404: {
- description: 'Not Found',
- schema: {
- $ref: '#/definitions/Error',
- },
- },
- },
- },
- },
- '/projects/{project_id}/timestamp/{timestamp}/history': {
- get: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'getHistoryBefore',
- tags: ['Project'],
- description:
- 'Get the sequence of changes. ' + ' before the given timestamp',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- {
- name: 'timestamp',
- in: 'path',
- description: 'timestamp',
- required: true,
- type: 'string',
- format: 'date-time',
- },
- ],
- responses: {
- 200: {
- description: 'Success',
- schema: {
- $ref: '#/definitions/ChunkResponse',
- },
- },
- 404: {
- description: 'Not Found',
- schema: {
- $ref: '#/definitions/Error',
- },
- },
- },
- },
- },
- '/projects/{project_id}/version/{version}/zip': {
- get: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'getZip',
- tags: ['Project'],
- description: 'Download zip with project content',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- {
- name: 'version',
- in: 'path',
- description: 'numeric version',
- required: true,
- type: 'number',
- },
- ],
- produces: ['application/octet-stream'],
- responses: {
- 200: {
- description: 'success',
- },
- 404: {
- description: 'not found',
- },
- },
- security: [
- {
- token: [],
- },
- ],
- },
- post: {
- 'x-swagger-router-controller': 'projects',
- operationId: 'createZip',
- tags: ['Project'],
- description:
- 'Create a zip file with project content. Returns a link to be polled.',
- parameters: [
- {
- name: 'project_id',
- in: 'path',
- description: 'project id',
- required: true,
- type: 'string',
- },
- {
- name: 'version',
- in: 'path',
- description: 'numeric version',
- required: true,
- type: 'number',
- },
- ],
- responses: {
- 200: {
- description: 'success',
- schema: {
- $ref: '#/definitions/ZipInfo',
- },
- },
- 404: {
- description: 'not found',
- },
- },
- security: [
- {
- basic: [],
- },
- ],
- },
- },
- }
|