Skip to content

Commit

Permalink
feat(api): add String-based API support (#235)
Browse files Browse the repository at this point in the history
* feat(api): add String-based API support

* chore: deprecate branch methods in Source Files section
  • Loading branch information
innomaxx authored May 30, 2024
1 parent 87bb10a commit 1b0d3b4
Show file tree
Hide file tree
Showing 54 changed files with 1,885 additions and 72 deletions.
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
{
[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
{
[Description("/name")]
Name,

[Description("/title")]
Title,

[Description("/exportPattern")]
ExportPattern,

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

0 comments on commit 1b0d3b4

Please sign in to comment.