Skip to content

Commit

Permalink
Fixed issue in generate files
Browse files Browse the repository at this point in the history
  • Loading branch information
mathijs-bb committed Aug 14, 2024
1 parent a025912 commit 0587ddf
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 6 deletions.
12 changes: 10 additions & 2 deletions Apps.XTM/Actions/FileActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,21 @@ public FileActions(InvocationContext invocationContext, IFileManagementClient fi
[Action("Generate files", Description = "Generate project files")]
public async Task<ListGeneratedFilesResponse> GenerateFiles(
[ActionParameter] ProjectRequest project,
[ActionParameter] GenerateFileRequest query)
[ActionParameter] GenerateFileRequest query,
[ActionParameter] [Display("Job IDs")] IEnumerable<string>? jobIds)
{
var endpoint = $"{ApiEndpoints.Projects}/{project.ProjectId}/files/generate";

if (jobIds == null)
{
var projectActions = new ProjectActions(InvocationContext, _fileManagementClient);
var projectCompletion = await projectActions.GetProjectCompletion(project);
jobIds = projectCompletion.JobIds;
}

var request = new XTMRequest(new()
{
Url = Creds.Get(CredsNames.Url) + endpoint.WithQuery(query),
Url = Creds.Get(CredsNames.Url) + endpoint.WithQuery(query).SetQueryParameter("jobIds", string.Join(',', jobIds)),
Method = Method.Post
}, await Client.GetToken(Creds));

Expand Down
2 changes: 1 addition & 1 deletion Apps.XTM/Apps.XTM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Product>XTM</Product>
<Version>3.2.1</Version>
<Version>3.2.2</Version>
<Description>Translation management system that centralizes localization assets and enables fast, accurate translation and deployment of content tailored to any audience in any territory</Description>
<AssemblyName>Apps.XTM</AssemblyName>
<LangVersion>12</LangVersion>
Expand Down
6 changes: 6 additions & 0 deletions Apps.XTM/Models/Response/Files/GeneratedFileResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ public class GeneratedFileResponse
{
[Display("File ID")]
public string FileId { get; set; }

[Display("Job ID")]
public string JobId { get; set; }

[Display("File type")]
public string FileType { get; set; }
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
namespace Apps.XTM.Models.Response.Projects;
using Blackbird.Applications.Sdk.Common;

namespace Apps.XTM.Models.Response.Projects;

public class ProjectCompletionResponse
{
public string Activity { get; set; }
public List<JobResponse> Jobs { get; set; }

[Display("Job IDs")]
public IEnumerable<string> JobIds { get; set; }

public ProjectCompletionResponse()
{
Activity = string.Empty;
Expand All @@ -15,6 +20,7 @@ public ProjectCompletionResponse(checkProjectCompletionResponse response)
{
Activity = response.@return.project.activity.ToString();
Jobs = new();
JobIds = response.@return.project.jobs.Select(x => x.jobDescriptor.id.ToString()).ToList();

foreach (var job in response.@return.project.jobs)
{
Expand Down
4 changes: 2 additions & 2 deletions Apps.XTM/RestUtilities/XTMClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task<RestResponse> ExecuteXtmWithJson(string endpoint, Method metho

var request = new XTMRequest(new()
{
Url = creds.GetUrl() + endpoint,
Url = creds.Get(CredsNames.Url) + endpoint,
Method = method
}, token);

Expand Down Expand Up @@ -88,7 +88,7 @@ public async Task<T> ExecuteXtm<T>(XTMRequest request)

public async Task<string> GetToken(AuthenticationCredentialsProvider[] creds)
{
var url = creds.GetUrl();
var url = creds.Get(CredsNames.Url);

var client = creds.Get(CredsNames.Client);
var userId = creds.Get(CredsNames.UserId);
Expand Down
6 changes: 6 additions & 0 deletions XTM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.5.33424.131
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apps.XTM", "Apps.XTM\Apps.XTM.csproj", "{6486035A-C63F-4071-A691-873C085B50AD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp1", "ConsoleApp1\ConsoleApp1.csproj", "{396BDD9B-347B-470B-BFFE-180D4942D111}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -15,6 +17,10 @@ Global
{6486035A-C63F-4071-A691-873C085B50AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6486035A-C63F-4071-A691-873C085B50AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6486035A-C63F-4071-A691-873C085B50AD}.Release|Any CPU.Build.0 = Release|Any CPU
{396BDD9B-347B-470B-BFFE-180D4942D111}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{396BDD9B-347B-470B-BFFE-180D4942D111}.Debug|Any CPU.Build.0 = Debug|Any CPU
{396BDD9B-347B-470B-BFFE-180D4942D111}.Release|Any CPU.ActiveCfg = Release|Any CPU
{396BDD9B-347B-470B-BFFE-180D4942D111}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down

0 comments on commit 0587ddf

Please sign in to comment.