-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
583 additions
and
502 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,2 @@ | ||
### Added | ||
- Added support for partial schemas (require new partial schemas enable on tenant) |
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
54 changes: 0 additions & 54 deletions
54
src/Enterspeed.Cli/Api/MappingSchema/DeployMappingSchema.cs
This file was deleted.
Oops, something went wrong.
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
46 changes: 0 additions & 46 deletions
46
src/Enterspeed.Cli/Api/MappingSchema/ValidateMappingSchema.cs
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
using Enterspeed.Cli.Domain.Models; | ||
using Enterspeed.Cli.Services.EnterspeedClient; | ||
using MediatR; | ||
using RestSharp; | ||
using System.Text.Json; | ||
|
||
namespace Enterspeed.Cli.Api.Release; | ||
|
||
public class CreateReleaseRequest : IRequest<CreateReleaseResponse> | ||
{ | ||
public string EnvironmentId { get; set; } | ||
public SchemaVersionId[] Schemas { get; set; } | ||
} | ||
|
||
public class SchemaVersionId | ||
{ | ||
public string SchemaId { get; set; } | ||
public int? Version { get; set; } | ||
} | ||
|
||
public class CreateReleaseResponse | ||
{ | ||
public bool Success { get; set; } | ||
public ApiErrorBaseResponse Error { get; set; } | ||
} | ||
|
||
public class CreateReleaseRequestHandler : IRequestHandler<CreateReleaseRequest, CreateReleaseResponse> | ||
{ | ||
private readonly IEnterspeedClient _enterspeedClient; | ||
|
||
public CreateReleaseRequestHandler(IEnterspeedClient enterspeedClient) | ||
{ | ||
_enterspeedClient = enterspeedClient; | ||
} | ||
|
||
public async Task<CreateReleaseResponse> Handle(CreateReleaseRequest createRequest, CancellationToken cancellationToken) | ||
{ | ||
var request = new RestRequest("tenant/releases", Method.Post) | ||
.AddJsonBody(createRequest); | ||
|
||
var response = await _enterspeedClient.ExecuteAsync(request, cancellationToken); | ||
|
||
var createReleaseResponse = new CreateReleaseResponse { Success = response.IsSuccessful }; | ||
|
||
if (!response.IsSuccessful && !string.IsNullOrEmpty(response.Content)) | ||
{ | ||
var apiErrorBaseResponse = JsonSerializer.Deserialize<ApiErrorBaseResponse>(response.Content); | ||
|
||
if (apiErrorBaseResponse.Code == ErrorCode.FailedToCreateRelease) | ||
{ | ||
createReleaseResponse.Error = JsonSerializer.Deserialize<ApiGroupedErrorResponse>(response.Content); | ||
} | ||
else | ||
{ | ||
createReleaseResponse.Error = JsonSerializer.Deserialize<ApiErrorResponse>(response.Content); | ||
} | ||
} | ||
|
||
return createReleaseResponse; | ||
} | ||
} |
Oops, something went wrong.