Skip to content

Commit

Permalink
Fixed project listing
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalii-bezuhlyi committed Jun 18, 2024
1 parent b1ffd8b commit 650c013
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
6 changes: 1 addition & 5 deletions Apps.Crowdin/Actions/ProjectActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ public async Task<ListProjectsResponse> ListProjects([ActionParameter] ListProje
var client = new CrowdinClient(Creds);

var items = await Paginator.Paginate((lim, offset)
=> client.ProjectsGroups.ListProjects<ProjectBase>(userId, groupId, input.HasManagerAccess ?? false, ProjectType.FileBased, offset));
var stringBasedItems = await Paginator.Paginate((lim, offset)
=> client.ProjectsGroups.ListProjects<ProjectBase>(userId, groupId, input.HasManagerAccess ?? false, ProjectType.StringBased, offset));
=> client.ProjectsGroups.ListProjects<ProjectBase>(userId, groupId, input.HasManagerAccess ?? false, null, lim, offset));

items = items.Concat(stringBasedItems).ToList();
var projects = items.Select(x => new ProjectEntity(x)).ToArray();

return new(projects);
}

Expand Down
8 changes: 2 additions & 6 deletions Apps.Crowdin/DataSourceHandlers/ProjectDataHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ public async Task<Dictionary<string, string>> GetDataAsync(DataSourceContext con
{
var client = new CrowdinClient(Creds);

var fileBasedItems = await Paginator.Paginate((lim, offset)
=> client.ProjectsGroups.ListProjects<ProjectBase>(null, null, false, ProjectType.FileBased, offset));
var stringBasedItems = await Paginator.Paginate((lim, offset)
=> client.ProjectsGroups.ListProjects<ProjectBase>(null, null, false, ProjectType.StringBased, offset));

var items = fileBasedItems.Concat(stringBasedItems).ToArray();
var items = await Paginator.Paginate((lim, offset)
=> client.ProjectsGroups.ListProjects<ProjectBase>(null, null, false, null, lim, offset));
return items
.Where(x => context.SearchString == null ||
x.Name.Contains(context.SearchString, StringComparison.OrdinalIgnoreCase))
Expand Down

0 comments on commit 650c013

Please sign in to comment.