From ccb35e2f0da40584d5f15eb94c9da3abb9ddb56c Mon Sep 17 00:00:00 2001 From: Eric Schubert Date: Fri, 20 May 2022 10:55:34 +0200 Subject: [PATCH] [#42552] first draft --- .../live_file_link_collection_model.yml | 98 ++++++++++++++++++ .../schemas/live_file_link_model.yml | 99 +++++++++++++++++++ docs/api/apiv3/openapi-spec.yml | 2 + docs/api/apiv3/paths/live_file_links.yml | 38 +++++++ 4 files changed, 237 insertions(+) create mode 100644 docs/api/apiv3/components/schemas/live_file_link_collection_model.yml create mode 100644 docs/api/apiv3/components/schemas/live_file_link_model.yml create mode 100644 docs/api/apiv3/paths/live_file_links.yml diff --git a/docs/api/apiv3/components/schemas/live_file_link_collection_model.yml b/docs/api/apiv3/components/schemas/live_file_link_collection_model.yml new file mode 100644 index 0000000000..4cb053cb87 --- /dev/null +++ b/docs/api/apiv3/components/schemas/live_file_link_collection_model.yml @@ -0,0 +1,98 @@ +# Schema: LiveFileLinkCollectionModel +--- +allOf: + - $ref: './collection_model.yml' + - type: object + required: + - _links + - _embedded + properties: + _links: + type: object + required: + - self + - storage + - connectionState + properties: + self: + allOf: + - $ref: "./link.yml" + - description: |- + This file links collection + + **Resource**: FileLinkCollectionReadModel + storage: + allOf: + - $ref: "./link.yml" + - description: |- + The storage resource of this live link collection + + **Resource**: Storage + connectionState: + allOf: + - $ref: "./link.yml" + - description: |- + The urn of the storage connection state. + + Can be one of: + + - connected + - missing authentication + - failed authentication + - connection error + + **Resource**: N/A + _embedded: + type: object + required: + - elements + properties: + elements: + type: array + items: + $ref: './live_file_link_model.yml' + +example: + _type: Collection + total: 2 + count: 2 + _links: + self: + href: '/api/v3/work_packages/42/file_links' + _embedded: + elements: + - id: 1337 + _type: FileLink + createdAt: '2021-12-20T13:37:00.211Z' + updatedAt: '2021-12-20T13:37:00.211Z' + originData: + id: 5503 + name: logo.png + mimeType: image/png + size: 16042 + createdAt: '2021-12-19T09:42:10.170Z' + lastModifiedAt: '2021-12-20T14:00:13.987Z' + createdByName: Luke Skywalker + lastModifiedByName: Anakin Skywalker + _links: + self: + href: /api/v3/work_package/17/file_links/1337 + title: file link + storage: + href: /api/v3/storage/42 + title: storage + container: + href: /api/v3/work_package/17 + title: work package + creator: + href: /api/v3/users/33 + title: Obi-Wan Kenobi + delete: + href: /api/v3/work_package/17/file_links/1337 + method: delete + originOpen: + href: https://nextcloud.deathstar.rocks/index.php/f?fileid=5503 + staticOriginOpen: + href: /api/v3/work_package/17/file_links/1337/open + - _hint: File Link resource shortened for brevity + id: 1338 diff --git a/docs/api/apiv3/components/schemas/live_file_link_model.yml b/docs/api/apiv3/components/schemas/live_file_link_model.yml new file mode 100644 index 0000000000..66cf199893 --- /dev/null +++ b/docs/api/apiv3/components/schemas/live_file_link_model.yml @@ -0,0 +1,99 @@ +# Schema: LiveFileLinkModel +--- +allOf: + - $ref: './file_link_read_model.yml' + - type: object + required: + - permission + properties: + _links: + type: object + required: + - permission + properties: + permission: + allOf: + - $ref: './link.yml' + - description: |- + The urn of the user specific file link permission on this storage. Can be: + + - urn:openproject-org:api:v3:file-links:permission:view + - urn:openproject-org:api:v3:file-links:permission:not-allowed + + **Resource**: N/A + +example: + id: 1337 + _type: FileLink + createdAt: '2021-12-20T13:37:00.211Z' + updatedAt: '2021-12-20T13:37:00.211Z' + originData: + id: 5503 + name: logo.png + mimeType: image/png + size: 16042 + createdAt: '2021-12-19T09:42:10.170Z' + lastModifiedAt: '2021-12-20T14:00:13.987Z' + createdByName: Luke Skywalker + lastModifiedByName: Anakin Skywalker + _embedded: + storage: + id: 1337 + _type: Storage + name: It's no moon + createdAt: '2021-12-20T13:37:00.211Z' + updatedAt: '2021-12-20T13:37:00.211Z' + _links: + self: + href: /api/v3/storages/1337 + title: It's no moon + type: + href: urn:openproject-org:api:v3:storages:nextcloud + title: Nextcloud + origin: + href: https://nextcloud.deathstar.rocks/ + container: + _hint: Work package resource shortened for brevity + _type: WorkPackage + _links: + self: + href: "/api/v3/work_packages/1528" + title: Develop API + schema: + href: "/api/v3/work_packages/schemas/11-2" + id: 1528 + subject: Develop API + description: + format: markdown + raw: Develop super cool OpenProject API. + html: "

Develop super cool OpenProject API.

" + scheduleManually: false + startDate: + dueDate: + createdAt: '2014-08-29T12:40:53Z' + updatedAt: '2014-08-29T12:44:41Z' + _links: + self: + href: /api/v3/work_package/17/file_links/1337 + storage: + href: /api/v3/storage/42 + title: It's no moon + container: + href: /api/v3/work_package/17 + title: Develop API + creator: + href: /api/v3/users/33 + title: Obi-Wan Kenobi + delete: + href: /api/v3/work_package/17/file_links/1337 + originOpen: + href: https://nextcloud.deathstar.rocks/index.php/f/5503?openfile=1 + staticOriginOpen: + href: /api/v3/work_package/17/file_links/1337/open + originOpenLocation: + href: https://nextcloud.deathstar.rocks/index.php/f/5503?openfile=0 + staticOriginOpenLocation: + href: /api/v3/work_package/17/file_links/1337/open?location=true + permission: + href: urn:openproject-org:api:v3:file-links:permission:not-allowed + title: Not Allowed diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml index a9841e7fef..64d75399d6 100644 --- a/docs/api/apiv3/openapi-spec.yml +++ b/docs/api/apiv3/openapi-spec.yml @@ -351,6 +351,8 @@ paths: "$ref": "./paths/status.yml" "/api/v3/storages/{id}": "$ref": "./paths/storage.yml" + "/api/v3/storages/{id}/live_file_links": + "$ref": "./paths/live_file_links.yml" "/api/v3/time_entries": "$ref": "./paths/time_entries.yml" "/api/v3/time_entries/{id}/form": diff --git a/docs/api/apiv3/paths/live_file_links.yml b/docs/api/apiv3/paths/live_file_links.yml new file mode 100644 index 0000000000..d2bef0418e --- /dev/null +++ b/docs/api/apiv3/paths/live_file_links.yml @@ -0,0 +1,38 @@ +# /api/v3/storages/{id}/live_file_links +--- +get: + summary: Gets a file link collection with live data. + operationId: list_storage_live_file_links + tags: + - File links + description: |- + Gets a storage resource. TBD + parameters: + - name: id + description: Storage id + in: path + required: true + schema: + type: integer + example: 1337 + responses: + '200': + description: OK + content: + application/hal+json: + schema: + $ref: '../components/schemas/storage_model.yml' + '404': + content: + application/hal+json: + schema: + $ref: "../components/schemas/error_response.yml" + example: + _type: Error + errorIdentifier: urn:openproject-org:api:v3:errors:NotFound + message: The requested resource could not be found. + description: |- + Returned if the storage does not exist or the client does not have sufficient permissions to see it. + + **Required permission:** view file links +