Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TreeApi
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Coscine
backend
apis
TreeApi
Commits
61ed84ba
Commit
61ed84ba
authored
Dec 2, 2021
by
L. Ellenbeck
Browse files
Options
Downloads
Patches
Plain Diff
Fix: added query parameter call (coscine/issues#1259)
parent
98447ddc
No related branches found
No related tags found
2 merge requests
!52
Sprint/2021 23
,
!51
Fix: added query parameter call (coscine/issues#1259)
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Tree.sln
+1
-2
1 addition, 2 deletions
src/Tree.sln
src/Tree/Controllers/TreeController.cs
+63
-2
63 additions, 2 deletions
src/Tree/Controllers/TreeController.cs
src/Tree/Tree.csproj
+1
-0
1 addition, 0 deletions
src/Tree/Tree.csproj
with
65 additions
and
4 deletions
src/Tree.sln
+
1
−
2
View file @
61ed84ba
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.156
MinimumVisualStudioVersion = 10.0.40219.1
Project("{
FAE04EC0-301F-11D3-BF4B-00C04F79EFBC
}") = "Tree", "Tree\Tree.csproj", "{AC8882D4-3F0C-4BBF-83CE-22A5B05ED3FB}"
Project("{
9A19103F-16F7-4668-BE54-9A1E7A4F7556
}") = "Tree", "Tree\Tree.csproj", "{AC8882D4-3F0C-4BBF-83CE-22A5B05ED3FB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
...
...
This diff is collapsed.
Click to expand it.
src/Tree/Controllers/TreeController.cs
+
63
−
2
View file @
61ed84ba
...
...
@@ -11,6 +11,7 @@ using Coscine.ResourceTypeBase;
using
Coscine.WaterbutlerHelper
;
using
Coscine.WaterbutlerHelper.ReturnObjects
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Logging
;
using
Newtonsoft.Json.Linq
;
...
...
@@ -83,6 +84,36 @@ namespace Coscine.Api.Tree.Controllers
/// <param name="path">Path to the file</param>
/// <returns> JSON Object with the metadata if OK, otherwise status code 400 or 401 or 404</returns>
[
HttpGet
(
"[controller]/{resourceId}/{*path}"
)]
[
ApiExplorerSettings
(
IgnoreApi
=
true
)]
public
async
Task
<
IActionResult
>
GetMetadataWithPath
(
string
resourceId
,
string
path
=
""
)
{
return
await
GetMetadata
(
resourceId
,
path
);
}
/// <summary>
/// This method retrieves the metadata
/// </summary>
/// <param name="resourceId"> Id of a resource</param>
/// <param name="path">Path to the file</param>
/// <returns> JSON Object with the metadata if OK, otherwise status code 400 or 401 or 404</returns>
[
HttpGet
(
"[controller]/{resourceId}/"
)]
public
async
Task
<
IActionResult
>
GetMetadataWithParameter
(
string
resourceId
,
[
System
.
Web
.
Http
.
FromUri
]
string
path
=
""
)
{
// Strip the first slash, to reuse the previous implementation.
if
(
path
.
StartsWith
(
"/"
))
{
path
=
path
[
1
..];
}
return
await
GetMetadata
(
resourceId
,
path
);
}
/// <summary>
/// This method retrieves the metadata
/// </summary>
/// <param name="resourceId"> Id of a resource</param>
/// <param name="path">Path to the file</param>
/// <returns> JSON Object with the metadata if OK, otherwise status code 400 or 401 or 404</returns>
public
async
Task
<
IActionResult
>
GetMetadata
(
string
resourceId
,
string
path
=
""
)
{
var
rawPath
=
path
;
...
...
@@ -195,9 +226,9 @@ namespace Coscine.Api.Tree.Controllers
return
Json
(
jObject
);
}
catch
(
Exception
e
)
catch
(
Exception
)
{
return
BadRequest
(
$
"Error in communication with the resource"
);
return
BadRequest
(
"Error in communication with the resource"
);
}
}
...
...
@@ -230,6 +261,36 @@ namespace Coscine.Api.Tree.Controllers
/// <param name="path">Path to the file</param>
/// <returns>If OK status code 204, otherwise status code 400 or 401</returns>
[
HttpPut
(
"[controller]/{resourceId}/{*path}"
)]
[
ApiExplorerSettings
(
IgnoreApi
=
true
)]
public
IActionResult
StoreMetadataForFileWithPath
(
string
resourceId
,
string
path
)
{
return
StoreMetadataForFile
(
resourceId
,
path
);
}
/// <summary>
/// This method stores the metadata of the file
/// </summary>
/// <param name="resourceId">Id of the resource</param>
/// <param name="path">Path to the file</param>
/// <returns>If OK status code 204, otherwise status code 400 or 401</returns>
[
HttpPut
(
"[controller]/{resourceId}/"
)]
public
IActionResult
StoreMetadataForFileWithParameter
(
string
resourceId
,
[
System
.
Web
.
Http
.
FromUri
]
string
path
=
""
)
{
// Strip the first slash, to reuse the previous implementation.
if
(
path
.
StartsWith
(
"/"
))
{
path
=
path
[
1
..];
}
return
StoreMetadataForFile
(
resourceId
,
path
);
}
/// <summary>
/// This method stores the metadata of the file
/// </summary>
/// <param name="resourceId">Id of the resource</param>
/// <param name="path">Path to the file</param>
/// <returns>If OK status code 204, otherwise status code 400 or 401</returns>
public
IActionResult
StoreMetadataForFile
(
string
resourceId
,
string
path
)
{
path
=
$"/
{
path
}
"
;
...
...
This diff is collapsed.
Click to expand it.
src/Tree/Tree.csproj
+
1
−
0
View file @
61ed84ba
...
...
@@ -24,5 +24,6 @@
<PackageReference Include="Coscine.ResourceLoader" Version="2.*-*" />
<PackageReference Include="Coscine.ResourceTypeBase" Version="2.*-*" />
<PackageReference Include="Coscine.WaterbutlerHelper" Version="2.*-*" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
</ItemGroup>
</Project>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment