Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): add String-based API support #235

Merged
merged 9 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Crowdin.Api/AI/AiPromptConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class BasicModeAiPromptConfiguration : AiPromptConfiguration
public bool PublicProjectDescription { get; set; }

[PublicAPI]
public class OtherLanguageTranslationsConfig // TODO: to outer?
public class OtherLanguageTranslationsConfig
{
[JsonProperty("isEnabled")]
public bool IsEnabled { get; set; }
Expand Down
20 changes: 20 additions & 0 deletions src/Crowdin.Api/Branches/AddBranchRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

using JetBrains.Annotations;
using Newtonsoft.Json;

#nullable enable

namespace Crowdin.Api.Branches
{
[PublicAPI]
public class AddBranchRequest
{
[JsonProperty("name")]
#pragma warning disable CS8618
public string Name { get; set; }
#pragma warning restore CS8618

[JsonProperty("title")]
public string? Title { get; set; }
}
}
29 changes: 29 additions & 0 deletions src/Crowdin.Api/Branches/Branch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

using System;
using JetBrains.Annotations;
using Newtonsoft.Json;

namespace Crowdin.Api.Branches
{
[PublicAPI]
public class Branch
innomaxx marked this conversation as resolved.
Show resolved Hide resolved
innomaxx marked this conversation as resolved.
Show resolved Hide resolved
{
[JsonProperty("id")]
public int Id { get; set; }

[JsonProperty("projectId")]
public int ProjectId { get; set; }

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("title")]
public string Title { get; set; }

[JsonProperty("createdAt")]
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("updatedAt")]
public DateTimeOffset? UpdatedAt { get; set; }
}
}
35 changes: 35 additions & 0 deletions src/Crowdin.Api/Branches/BranchCloneStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

using System;
using JetBrains.Annotations;
using Newtonsoft.Json;

namespace Crowdin.Api.Branches
{
[PublicAPI]
public class BranchCloneStatus
{
[JsonProperty("identifier")]
public string Identifier { get; set; }

[JsonProperty("status")]
public OperationStatus Status { get; set; }

[JsonProperty("progress")]
public int Progress { get; set; }

[JsonProperty("attributes")]
public object Attributes { get; set; }

[JsonProperty("createdAt")]
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("updatedAt")]
public DateTimeOffset? UpdatedAt { get; set; }

[JsonProperty("startedAt")]
public DateTimeOffset? StartedAt { get; set; }

[JsonProperty("finishedAt")]
public DateTimeOffset? FinishedAt { get; set; }
}
}
45 changes: 45 additions & 0 deletions src/Crowdin.Api/Branches/BranchMergeStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

using System;
using JetBrains.Annotations;
using Newtonsoft.Json;

namespace Crowdin.Api.Branches
{
[PublicAPI]
public class BranchMergeStatus
{
[JsonProperty("identifier")]
public string Identifier { get; set; }

[JsonProperty("status")]
public OperationStatus Status { get; set; }

[JsonProperty("progress")]
public int Progress { get; set; }

[JsonProperty("attributes")]
public AttributesData Attributes { get; set; }

[JsonProperty("createdAt")]
public DateTimeOffset CreatedAt { get; set; }

[JsonProperty("updatedAt")]
public DateTimeOffset? UpdatedAt { get; set; }

[JsonProperty("startedAt")]
public DateTimeOffset? StartedAt { get; set; }

[JsonProperty("finishedAt")]
public DateTimeOffset FinishedAt { get; set; }

[PublicAPI]
public class AttributesData
{
[JsonProperty("sourceBranchId")]
public int SourceBranchId { get; set; }

[JsonProperty("deleteAfterMerge")]
public bool DeleteAfterMerge { get; set; }
}
}
}
22 changes: 22 additions & 0 deletions src/Crowdin.Api/Branches/BranchMergeStatusId.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

using System.ComponentModel;
using JetBrains.Annotations;

namespace Crowdin.Api.Branches
{
[PublicAPI]
public enum BranchMergeStatusId
{
[Description("conflict")]
Conflict,

[Description("failed")]
Failed,

[Description("inProgress")]
InProgress,

[Description("merged")]
Merged
}
}
41 changes: 41 additions & 0 deletions src/Crowdin.Api/Branches/BranchMergeSummary.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

using JetBrains.Annotations;
using Newtonsoft.Json;

namespace Crowdin.Api.Branches
{
[PublicAPI]
public class BranchMergeSummary
{
[JsonProperty("status")]
public BranchMergeStatusId Status { get; set; }

[JsonProperty("sourceBranchId")]
public int SourceBranchId { get; set; }

[JsonProperty("targetBranchId")]
public int TargetBranchId { get; set; }

[JsonProperty("dryRun")]
public bool DryRun { get; set; }

[JsonProperty("details")]
public DetailsData Details { get; set; }

[PublicAPI]
public class DetailsData
{
[JsonProperty("added")]
public int Added { get; set; }

[JsonProperty("deleted")]
public int Deleted { get; set; }

[JsonProperty("updated")]
public int Updated { get; set; }

[JsonProperty("conflicted")]
public int Conflicted { get; set; }
}
}
}
30 changes: 30 additions & 0 deletions src/Crowdin.Api/Branches/BranchPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

using System.ComponentModel;
using JetBrains.Annotations;
using Newtonsoft.Json;

namespace Crowdin.Api.Branches
{
[PublicAPI]
public class BranchPatch : PatchEntry
{
[JsonProperty("path")]
public BranchPatchPath Path { get; set; }
}

[PublicAPI]
public enum BranchPatchPath
innomaxx marked this conversation as resolved.
Show resolved Hide resolved
{
[Description("/name")]
Name,

[Description("/title")]
Title,

[Description("/exportPattern")]
ExportPattern,

[Description("/priority")]
Priority
}
}
Loading
Loading