-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(RecommendationController): Migrate to OCS
Signed-off-by: provokateurin <kate@provokateurin.de>
- Loading branch information
1 parent
e353055
commit 3ee463a
Showing
7 changed files
with
308 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
/** | ||
* @psalm-type RecommendationsRecommendedFile = array{ | ||
* id: string, | ||
* timestamp: int, | ||
* name: string, | ||
* directory: string, | ||
* extension: string, | ||
* mimeType: string, | ||
* hasPreview: bool, | ||
* reason: string, | ||
* } | ||
* | ||
* @psalm-suppress UnusedClass | ||
*/ | ||
class ResponseDefinitions { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,243 @@ | ||
{ | ||
"openapi": "3.0.3", | ||
"info": { | ||
"title": "recommendations", | ||
"version": "0.0.1", | ||
"description": "Shows recommended files", | ||
"license": { | ||
"name": "agpl" | ||
} | ||
}, | ||
"components": { | ||
"securitySchemes": { | ||
"basic_auth": { | ||
"type": "http", | ||
"scheme": "basic" | ||
}, | ||
"bearer_auth": { | ||
"type": "http", | ||
"scheme": "bearer" | ||
} | ||
}, | ||
"schemas": { | ||
"OCSMeta": { | ||
"type": "object", | ||
"required": [ | ||
"status", | ||
"statuscode" | ||
], | ||
"properties": { | ||
"status": { | ||
"type": "string" | ||
}, | ||
"statuscode": { | ||
"type": "integer" | ||
}, | ||
"message": { | ||
"type": "string" | ||
}, | ||
"totalitems": { | ||
"type": "string" | ||
}, | ||
"itemsperpage": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"RecommendedFile": { | ||
"type": "object", | ||
"required": [ | ||
"id", | ||
"timestamp", | ||
"name", | ||
"directory", | ||
"extension", | ||
"mimeType", | ||
"hasPreview", | ||
"reason" | ||
], | ||
"properties": { | ||
"id": { | ||
"type": "string" | ||
}, | ||
"timestamp": { | ||
"type": "integer", | ||
"format": "int64" | ||
}, | ||
"name": { | ||
"type": "string" | ||
}, | ||
"directory": { | ||
"type": "string" | ||
}, | ||
"extension": { | ||
"type": "string" | ||
}, | ||
"mimeType": { | ||
"type": "string" | ||
}, | ||
"hasPreview": { | ||
"type": "boolean" | ||
}, | ||
"reason": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"paths": { | ||
"/ocs/v2.php/apps/recommendations/api/v1/recommendations/always": { | ||
"get": { | ||
"operationId": "recommendation-always", | ||
"summary": "Get recommendations", | ||
"tags": [ | ||
"recommendation" | ||
], | ||
"security": [ | ||
{ | ||
"bearer_auth": [] | ||
}, | ||
{ | ||
"basic_auth": [] | ||
} | ||
], | ||
"parameters": [ | ||
{ | ||
"name": "OCS-APIRequest", | ||
"in": "header", | ||
"description": "Required to be true for the API request to pass", | ||
"required": true, | ||
"schema": { | ||
"type": "boolean", | ||
"default": true | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Recommendations returned", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"ocs" | ||
], | ||
"properties": { | ||
"ocs": { | ||
"type": "object", | ||
"required": [ | ||
"meta", | ||
"data" | ||
], | ||
"properties": { | ||
"meta": { | ||
"$ref": "#/components/schemas/OCSMeta" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"required": [ | ||
"enabled", | ||
"recommendations" | ||
], | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean" | ||
}, | ||
"recommendations": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/components/schemas/RecommendedFile" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"/ocs/v2.php/apps/recommendations/api/v1/recommendations": { | ||
"get": { | ||
"operationId": "recommendation-index", | ||
"summary": "Get recommendations, but only if enabled", | ||
"tags": [ | ||
"recommendation" | ||
], | ||
"security": [ | ||
{ | ||
"bearer_auth": [] | ||
}, | ||
{ | ||
"basic_auth": [] | ||
} | ||
], | ||
"parameters": [ | ||
{ | ||
"name": "OCS-APIRequest", | ||
"in": "header", | ||
"description": "Required to be true for the API request to pass", | ||
"required": true, | ||
"schema": { | ||
"type": "boolean", | ||
"default": true | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Recommendations returned", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"ocs" | ||
], | ||
"properties": { | ||
"ocs": { | ||
"type": "object", | ||
"required": [ | ||
"meta", | ||
"data" | ||
], | ||
"properties": { | ||
"meta": { | ||
"$ref": "#/components/schemas/OCSMeta" | ||
}, | ||
"data": { | ||
"type": "object", | ||
"required": [ | ||
"enabled" | ||
], | ||
"properties": { | ||
"enabled": { | ||
"type": "boolean" | ||
}, | ||
"recommendations": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "#/components/schemas/RecommendedFile" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"tags": [] | ||
} |
Oops, something went wrong.