From ceee0a2c94e12b22911f49f7b5079405a64bb317 Mon Sep 17 00:00:00 2001 From: mathijs-bb Date: Tue, 14 May 2024 13:29:00 +0200 Subject: [PATCH] Updated json properties --- Apps.BWX/Apps.BWX.csproj | 2 +- Apps.BWX/Webhooks/Payload/NewOrgEvent.cs | 8 +++++ Apps.BWX/Webhooks/Payload/NewProjectEvent.cs | 25 +++++++++++++ Apps.BWX/Webhooks/Payload/NewUserEvent.cs | 15 ++++++++ .../Payload/ProjectStatusChangedPayload.cs | 29 +++++++++++++-- .../ProjectTranslationFinishedEvent.cs | 8 +++++ .../Webhooks/Payload/TaskAssignedEvent.cs | 35 +++++++++++++++++++ .../Payload/TaskStatusChangedPayload.cs | 3 ++ .../Payload/WorkUnitStatusChangedEvent.cs | 26 +++++++++++++- 9 files changed, 147 insertions(+), 4 deletions(-) diff --git a/Apps.BWX/Apps.BWX.csproj b/Apps.BWX/Apps.BWX.csproj index 5c1a05f..5e7c71e 100644 --- a/Apps.BWX/Apps.BWX.csproj +++ b/Apps.BWX/Apps.BWX.csproj @@ -5,7 +5,7 @@ enable enable Bureau Works - 1.0.6 + 1.0.7 Bureau Works is cutting edge translation software that helps its users translate at greater speeds and with an increased sense of authorship. Apps.BWX diff --git a/Apps.BWX/Webhooks/Payload/NewOrgEvent.cs b/Apps.BWX/Webhooks/Payload/NewOrgEvent.cs index d027543..bac5b24 100644 --- a/Apps.BWX/Webhooks/Payload/NewOrgEvent.cs +++ b/Apps.BWX/Webhooks/Payload/NewOrgEvent.cs @@ -1,18 +1,26 @@ using Blackbird.Applications.Sdk.Common; +using Newtonsoft.Json; namespace Apps.BWX.Webhooks.Payload; public class NewOrgEvent { [Display("Organization ID")] + [JsonProperty("uuid")] public string Uuid { get; set; } + + [JsonProperty("country")] public string Country { get; set; } [Display("Event type")] + [JsonProperty("event_type")] public string EventType { get; set; } + + //[JsonProperty("id")] //public int Id { get; set; } public string Name { get; set; } [Display("Custom fields")] + [JsonProperty("custom_fields")] public List CustomFields { get; set; } } \ No newline at end of file diff --git a/Apps.BWX/Webhooks/Payload/NewProjectEvent.cs b/Apps.BWX/Webhooks/Payload/NewProjectEvent.cs index a542b32..7cca2bd 100644 --- a/Apps.BWX/Webhooks/Payload/NewProjectEvent.cs +++ b/Apps.BWX/Webhooks/Payload/NewProjectEvent.cs @@ -1,38 +1,63 @@ using Blackbird.Applications.Sdk.Common; +using Newtonsoft.Json; namespace Apps.BWX.Webhooks.Payload; public class NewProjectEvent { [Display("Project ID")] + [JsonProperty("uuid")] public string Uuid { get; set; } //[Display("Creation timestamp")] + //[JsonProperty("creation_timestamp")] //public long CreationTimestamp { get; set; } + + [JsonProperty("creator")] public string Creator { get; set; } [Display("Creator email")] + [JsonProperty("creator_email")] public string CreatorEmail { get; set; } [Display("Event type")] + [JsonProperty("event_type")] public string EventType { get; set; } //[Display("ID")] + //[JsonProperty("id")] //public int Id { get; set; } + + [JsonProperty("instructions")] public string Instructions { get; set; } + + [JsonProperty("name")] public string Name { get; set; } + + [JsonProperty("notes")] public string Notes { get; set; } + + [JsonProperty("reference")] public string Reference { get; set; } [Display("Source locale")] + [JsonProperty("source_locale")] public string SourceLocale { get; set; } + + [JsonProperty("status")] public string Status { get; set; } + + [JsonProperty("tags")] public List Tags { get; set; } [Display("Target locales")] + [JsonProperty("target_locales")] public List TargetLocales { get; set; } + + [JsonProperty("workflows")] public List Workflows { get; set; } [Display("Custom fields")] + [JsonProperty("custom_fields")] public List CustomFields { get; set; } } \ No newline at end of file diff --git a/Apps.BWX/Webhooks/Payload/NewUserEvent.cs b/Apps.BWX/Webhooks/Payload/NewUserEvent.cs index 1e174f6..6b2c17a 100644 --- a/Apps.BWX/Webhooks/Payload/NewUserEvent.cs +++ b/Apps.BWX/Webhooks/Payload/NewUserEvent.cs @@ -1,24 +1,39 @@ using Blackbird.Applications.Sdk.Common; +using Newtonsoft.Json; namespace Apps.BWX.Webhooks.Payload; public class NewUserEvent { [Display("User ID")] + [JsonProperty("uuid")] public string Uuid { get; set; } + [JsonProperty("country")] public string Country { get; set; } [Display("Event type")] + [JsonProperty("event_type")] public string EventType { get; set; } //[Display("ID")] + //[JsonProperty("id")] //public int Id { get; set; } + + [JsonProperty("name")] public string Name { get; set; } + + [JsonProperty("email")] public string Email { get; set; } + + [Display("Roles")] + [JsonProperty("role")] public List Role { get; set; } + + [JsonProperty("status")] public string Status { get; set; } [Display("Custom fields")] + [JsonProperty("custom_fields")] public List CustomFields { get; set; } } \ No newline at end of file diff --git a/Apps.BWX/Webhooks/Payload/ProjectStatusChangedPayload.cs b/Apps.BWX/Webhooks/Payload/ProjectStatusChangedPayload.cs index e514bd2..7d6c338 100644 --- a/Apps.BWX/Webhooks/Payload/ProjectStatusChangedPayload.cs +++ b/Apps.BWX/Webhooks/Payload/ProjectStatusChangedPayload.cs @@ -1,44 +1,69 @@ using Blackbird.Applications.Sdk.Common; +using Newtonsoft.Json; namespace Apps.BWX.Webhooks.Payload; public class ProjectStatusChangedPayload { [Display("Project ID")] + [JsonProperty("uuid")] public string Uuid { get; set; } - [Display("Creation timestamp")] - public long CreationTimestamp { get; set; } + //[Display("Creation timestamp")] + //[JsonProperty("creation_timestamp")] + //public long CreationTimestamp { get; set; } public string Creator { get; set; } [Display("Creator email")] + [JsonProperty("creator_email")] public string CreatorEmail { get; set; } [Display("Event type")] + [JsonProperty("event_type")] public string EventType { get; set; } //[Display("ID")] + //[JsonProperty("id")] //public int Id { get; set; } + + [JsonProperty("instructions")] public string Instructions { get; set; } + + [JsonProperty("name")] public string Name { get; set; } [Display("New status")] + [JsonProperty("new_status")] public string NewStatus { get; set; } + + [JsonProperty("notes")] public string Notes { get; set; } [Display("Previous status")] + [JsonProperty("previous_status")] public string PreviousStatus { get; set; } + + [JsonProperty("reference")] public string Reference { get; set; } [Display("Source locale")] + [JsonProperty("source_locale")] public string SourceLocale { get; set; } + + [JsonProperty("status")] public string Status { get; set; } + + [JsonProperty("tags")] public List Tags { get; set; } [Display("Target locales")] + [JsonProperty("target_locales")] public List TargetLocales { get; set; } + + [JsonProperty("workflows")] public List Workflows { get; set; } [Display("Custom fields")] + [JsonProperty("custom_fields")] public List CustomFields { get; set; } } \ No newline at end of file diff --git a/Apps.BWX/Webhooks/Payload/ProjectTranslationFinishedEvent.cs b/Apps.BWX/Webhooks/Payload/ProjectTranslationFinishedEvent.cs index 076ef4a..cd4d80f 100644 --- a/Apps.BWX/Webhooks/Payload/ProjectTranslationFinishedEvent.cs +++ b/Apps.BWX/Webhooks/Payload/ProjectTranslationFinishedEvent.cs @@ -1,4 +1,5 @@ using Blackbird.Applications.Sdk.Common; +using Newtonsoft.Json; namespace Apps.BWX.Webhooks.Payload; @@ -6,23 +7,30 @@ public class ProjectTranslationFinishedEvent { //[Display("Project ID")] + //[JsonProperty("project_id")] //public int ProjectId { get; set; } [Display("Project ID")] + [JsonProperty("project_uuid")] public string ProjectUuid { get; set; } [Display("Project name")] + [JsonProperty("project_name")] public string ProjectName { get; set; } [Display("Total work units completed")] + [JsonProperty("total_work_units_completed")] public int TotalWorkUnitsCompleted { get; set; } [Display("Total work units failed")] + [JsonProperty("total_work_units_failed")] public int TotalWorkUnitsFailed { get; set; } [Display("Total work units")] + [JsonProperty("total_work_units")] public int TotalWorkUnits { get; set; } [Display("Event type")] + [JsonProperty("event_type")] public string EventType { get; set; } } \ No newline at end of file diff --git a/Apps.BWX/Webhooks/Payload/TaskAssignedEvent.cs b/Apps.BWX/Webhooks/Payload/TaskAssignedEvent.cs index 2c715e6..6bc699f 100644 --- a/Apps.BWX/Webhooks/Payload/TaskAssignedEvent.cs +++ b/Apps.BWX/Webhooks/Payload/TaskAssignedEvent.cs @@ -1,73 +1,108 @@ using Blackbird.Applications.Sdk.Common; +using Newtonsoft.Json; namespace Apps.BWX.Webhooks.Payload; public class TaskAssignedEvent { [Display("Task ID")] + [JsonProperty("uuid")] public string Uuid { get; set; } //[Display("Acceptance date")] + //[JsonProperty("acceptance_date")] //public long AcceptanceDate { get; set; } //[Display("Assign date")] + //[JsonProperty("assign_date")] //public long AssignDate { get; set; } [Display("Assigned by email")] + [JsonProperty("assigned_by_email")] public string AssignedByEmail { get; set; } [Display("Assigned by name")] + [JsonProperty("assigned_by_name")] public string AssignedByName { get; set; } + + [JsonProperty("assignee")] public string Assignee { get; set; } [Display("Assignee email")] + [JsonProperty("assignee_email")] public string AssigneeEmail { get; set; } [Display("Assignee word rate")] + [JsonProperty("assignee_word_rate")] public double AssigneeWordRate { get; set; } [Display("Begin index")] + [JsonProperty("begin_index")] public long BeginIndex { get; set; } //[Display("Creation timestamp")] + //[JsonProperty("creation_timestamp")] //public long CreationTimestamp { get; set; } + + [JsonProperty("creator")] public string Creator { get; set; } [Display("Creator email")] + [JsonProperty("creator_email")] public string CreatorEmail { get; set; } //[Display("Delivery date")] + //[JsonProperty("delivery_date")] //public long DeliveryDate { get; set; } //[Display("Due date")] + //[JsonProperty("due_date")] //public long DueDate { get; set; } //[Display("End index")] + //[JsonProperty("end_index")] //public long EndIndex { get; set; } [Display("Event type")] + [JsonProperty("event_type")] public string EventType { get; set; } + + [JsonProperty("files")] public List Files { get; set; } //[Display("ID")] + //[JsonProperty("id")] //public int Id { get; set; } + + [JsonProperty("instructions")] public string Instructions { get; set; } [Display("Minimum score required")] + [JsonProperty("minimum_score_required")] public double MinimumScoreRequired { get; set; } + + [JsonProperty("name")] public string Name { get; set; } [Display("Reference files")] + [JsonProperty("reference_files")] public List ReferenceFiles { get; set; } //[Display("Scheduled date")] + //[JsonProperty("scheduled_date")] //public long ScheduledDate { get; set; } //[Display("Skip date")] + //[JsonProperty("skip_date")] //public long SkipDate { get; set; } + + [JsonProperty("status")] public string Status { get; set; } + + [JsonProperty("workflow")] public string Workflow { get; set; } [Display("Custom fields")] + [JsonProperty("custom_fields")] public List CustomFields { get; set; } } \ No newline at end of file diff --git a/Apps.BWX/Webhooks/Payload/TaskStatusChangedPayload.cs b/Apps.BWX/Webhooks/Payload/TaskStatusChangedPayload.cs index 1895bea..4b10b1d 100644 --- a/Apps.BWX/Webhooks/Payload/TaskStatusChangedPayload.cs +++ b/Apps.BWX/Webhooks/Payload/TaskStatusChangedPayload.cs @@ -1,13 +1,16 @@ using Blackbird.Applications.Sdk.Common; +using Newtonsoft.Json; namespace Apps.BWX.Webhooks.Payload; public class TaskStatusChangedPayload : TaskAssignedEvent { [Display("New status")] + [JsonProperty("new_status")] public string NewStatus { get; set; } [Display("Previous status")] + [JsonProperty("previous_status")] public string PreviousStatus { get; set; } } \ No newline at end of file diff --git a/Apps.BWX/Webhooks/Payload/WorkUnitStatusChangedEvent.cs b/Apps.BWX/Webhooks/Payload/WorkUnitStatusChangedEvent.cs index 0a78b06..e5748ea 100644 --- a/Apps.BWX/Webhooks/Payload/WorkUnitStatusChangedEvent.cs +++ b/Apps.BWX/Webhooks/Payload/WorkUnitStatusChangedEvent.cs @@ -1,60 +1,84 @@ using Blackbird.Applications.Sdk.Common; +using Newtonsoft.Json; namespace Apps.BWX.Webhooks.Payload; public class WorkUnitStatusChangedEvent { [Display("Work unit ID")] + [JsonProperty("id")] public string Id { get; set; } [Display("Begin index")] + [JsonProperty("begin_index")] public int BeginIndex { get; set; } + + [JsonProperty("chars")] public int Chars { get; set; } [Display("Confirmed non translatable")] + [JsonProperty("confirmed_non_translatable")] public int ConfirmedNonTranslatable { get; set; } [Display("Confirmed segments")] + [JsonProperty("confirmed_segments")] public int ConfirmedSegments { get; set; } [Display("End index")] + [JsonProperty("end_index")] public int EndIndex { get; set; } [Display("Event type")] + [JsonProperty("event_type")] public string EventType { get; set; } [Display("New status")] + [JsonProperty("new_status")] public string NewStatus { get; set; } [Display("Previous status")] + [JsonProperty("previous_status")] public string PreviousStatus { get; set; } [Display("Project file ID")] + [JsonProperty("project_file_id")] public string ProjectFileId { get; set; } [Display("Project file name")] + [JsonProperty("project_file_name")] public string ProjectFileName { get; set; } [Display("Project step level")] + [JsonProperty("project_step_level")] public int ProjectStepLevel { get; set; } [Display("Source locale")] + [JsonProperty("source_locale")] public string SourceLocale { get; set; } [Display("Target locale")] + [JsonProperty("target_locale")] public string TargetLocale { get; set; } [Display("Total non translatable")] + [JsonProperty("total_non_translatable")] public int TotalNonTranslatable { get; set; } [Display("Total segments")] + [JsonProperty("total_segments")] public int TotalSegments { get; set; } [Display("Translated file url")] + [JsonProperty("translated_file_url")] public string TranslatedFileUrl { get; set; } + + [JsonProperty("words")] public int Words { get; set; } + + [JsonProperty("workflow")] public string Workflow { get; set; } - [Display("Is last workflow")] + [Display("Is last workflow?")] + [JsonProperty("is_last_workflow")] public bool IsLastWorkflow { get; set; } } \ No newline at end of file