Skip to content

Commit dd1f432

Browse files
authored
feat: [PPT-2172] Add endpoint to retrieve repo folder tree (#411)
1 parent abdad4e commit dd1f432

3 files changed

Lines changed: 95 additions & 3 deletions

File tree

OPENAPI_DOC.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12322,6 +12322,83 @@ paths:
1232212322
application/json:
1232312323
schema:
1232412324
$ref: '#/components/schemas/PlaceOS__Api__Application__ContentError'
12325+
/api/engine/v2/repositories/{id}/folders:
12326+
get:
12327+
summary: lists the folders tree in a repository
12328+
tags:
12329+
- Repositories
12330+
operationId: PlaceOS::Api::Repositories_folders
12331+
parameters:
12332+
- name: id
12333+
in: path
12334+
required: true
12335+
schema:
12336+
type: string
12337+
- name: include_dots
12338+
in: query
12339+
description: include dots folders, default to false
12340+
example: "true"
12341+
schema:
12342+
type: boolean
12343+
responses:
12344+
200:
12345+
description: OK
12346+
content:
12347+
application/json:
12348+
schema:
12349+
type: array
12350+
items:
12351+
$ref: '#/components/schemas/String'
12352+
409:
12353+
description: Conflict
12354+
content:
12355+
application/json:
12356+
schema:
12357+
$ref: '#/components/schemas/PlaceOS__Api__Application__CommonError'
12358+
401:
12359+
description: Unauthorized
12360+
content:
12361+
application/json:
12362+
schema:
12363+
$ref: '#/components/schemas/PlaceOS__Api__Application__CommonError'
12364+
403:
12365+
description: Forbidden
12366+
404:
12367+
description: Not Found
12368+
content:
12369+
application/json:
12370+
schema:
12371+
$ref: '#/components/schemas/PlaceOS__Api__Application__CommonError'
12372+
408:
12373+
description: Request Timeout
12374+
content:
12375+
application/json:
12376+
schema:
12377+
$ref: '#/components/schemas/PlaceOS__Api__Application__CommonError'
12378+
400:
12379+
description: Bad Request
12380+
content:
12381+
application/json:
12382+
schema:
12383+
$ref: '#/components/schemas/PlaceOS__Api__Application__ParameterError'
12384+
422:
12385+
description: Unprocessable Entity
12386+
content:
12387+
application/json:
12388+
schema:
12389+
$ref: '#/components/schemas/PlaceOS__Api__Application__ParameterError'
12390+
406:
12391+
description: Not Acceptable
12392+
content:
12393+
application/json:
12394+
schema:
12395+
$ref: '#/components/schemas/PlaceOS__Api__Application__ContentError'
12396+
415:
12397+
description: Unsupported Media Type
12398+
content:
12399+
application/json:
12400+
schema:
12401+
$ref: '#/components/schemas/PlaceOS__Api__Application__ContentError'
1232512402
/api/engine/v2/repositories/{id}/commits:
1232612403
get:
1232712404
summary: Returns the commits for a repository or file
@@ -25156,6 +25233,9 @@ components:
2515625233
- driver
2515725234
- interface
2515825235
nullable: true
25236+
root_path:
25237+
type: string
25238+
nullable: true
2515925239
has_runtime_error:
2516025240
type: boolean
2516125241
nullable: true

shard.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ shards:
9595

9696
git-repository:
9797
git: https://github.com/place-labs/git-repository.git
98-
version: 1.5.0
98+
version: 1.6.0
9999

100100
google:
101101
git: https://github.com/placeos/google.git
@@ -207,15 +207,15 @@ shards:
207207

208208
placeos-frontend-loader:
209209
git: https://github.com/placeos/frontend-loader.git
210-
version: 2.7.1+git.commit.ed25c13e04403056f050998de9fd84eed530a24f
210+
version: 2.7.1+git.commit.0db3a335971e9837fa45eaecfa4877f7a1814a1b
211211

212212
placeos-log-backend:
213213
git: https://github.com/place-labs/log-backend.git
214214
version: 0.13.0
215215

216216
placeos-models:
217217
git: https://github.com/placeos/models.git
218-
version: 9.72.4
218+
version: 9.73.0
219219

220220
placeos-resource:
221221
git: https://github.com/place-labs/resource.git

src/placeos-rest-api/controllers/repositories.cr

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ module PlaceOS::Api
125125
end
126126
end
127127

128+
# lists the folders tree in a repository
129+
@[AC::Route::GET("/:id/folders")]
130+
def folders(
131+
@[AC::Param::Info(description: "include dots folders, default to false", example: "true")]
132+
include_dots : Bool = false,
133+
) : Array(String)
134+
FrontendLoader::Client.client(request_id: request_id) do |frontends_client|
135+
password = current_repo.decrypt_password if current_repo.password.presence
136+
frontends_client.folders(current_repo.uri, current_repo.branch, current_repo.username, password, include_dots)
137+
end
138+
end
139+
128140
# Returns the commits for a repository or file
129141
@[AC::Route::GET("/:id/commits")]
130142
def commits(

0 commit comments

Comments
 (0)