-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: implement get, list, create, delete, update, list translations endpoints * refactor: rename all VarVersion to Version in toString
- Loading branch information
Showing
18 changed files
with
875 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/Sinch/Conversation/TemplatesV2/ChannelTemplateOverride.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Text; | ||
using System.Text.Json.Serialization; | ||
using Sinch.Conversation.Messages.Message; | ||
|
||
namespace Sinch.Conversation.TemplatesV2 | ||
{ | ||
/// <summary> | ||
/// Optional field to override the omnichannel template by referring to a channel-specific template. | ||
/// </summary> | ||
public sealed class ChannelTemplateOverride | ||
{ | ||
/// <summary> | ||
/// Gets or Sets Whatsapp | ||
/// </summary> | ||
[JsonPropertyName("WHATSAPP")] | ||
public OverrideTemplateReference WhatsApp { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Gets or Sets Kakaotalk | ||
/// </summary> | ||
[JsonPropertyName("KAKAOTALK")] | ||
public OverrideTemplateReference KakaoTalk { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Returns the string presentation of the object | ||
/// </summary> | ||
/// <returns>String presentation of the object</returns> | ||
public override string ToString() | ||
{ | ||
var sb = new StringBuilder(); | ||
sb.Append("class ChannelTemplateOverride {\n"); | ||
sb.Append(" WHATSAPP: ").Append(WhatsApp).Append("\n"); | ||
sb.Append(" KAKOTALK: ").Append(KakaoTalk).Append("\n"); | ||
sb.Append("}\n"); | ||
return sb.ToString(); | ||
} | ||
|
||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/Sinch/Conversation/TemplatesV2/CreateTemplateRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Sinch.Conversation.TemplatesV2 | ||
{ | ||
public class CreateTemplateRequest | ||
{ | ||
/// <summary> | ||
/// The default translation to use if translation not specified. Specified as a BCP-47 `language_code` and the `language_code` must exist in the translations list. | ||
/// </summary> | ||
#if NET7_0_OR_GREATER | ||
public required string DefaultTranslation { get; set; } | ||
#else | ||
public string DefaultTranslation { get; set; } | ||
#endif | ||
|
||
/// <summary> | ||
/// Gets or Sets Translations | ||
/// </summary> | ||
#if NET7_0_OR_GREATER | ||
public required List<TemplateTranslation> Translations { get; set; } | ||
#else | ||
public List<TemplateTranslation> Translations { get; set; } | ||
#endif | ||
|
||
|
||
/// <summary> | ||
/// The description of the template. | ||
/// </summary> | ||
public string Description { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// The version of the template. While creating a template, this will be defaulted to 1. When updating a template, you must supply the latest version of the template in order for the update to be successful. | ||
/// </summary> | ||
public int Version { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Timestamp when the template was created. | ||
/// </summary> | ||
public DateTime CreateTime { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Timestamp when the template was updated. | ||
/// </summary> | ||
public DateTime UpdateTime { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Returns the string presentation of the object | ||
/// </summary> | ||
/// <returns>String presentation of the object</returns> | ||
public override string ToString() | ||
{ | ||
var sb = new StringBuilder(); | ||
sb.Append("class V2TemplateResponse {\n"); | ||
sb.Append(" Description: ").Append(Description).Append("\n"); | ||
sb.Append(" Version: ").Append(Version).Append("\n"); | ||
sb.Append(" DefaultTranslation: ").Append(DefaultTranslation).Append("\n"); | ||
sb.Append(" Translations: ").Append(Translations).Append("\n"); | ||
sb.Append(" CreateTime: ").Append(CreateTime).Append("\n"); | ||
sb.Append(" UpdateTime: ").Append(UpdateTime).Append("\n"); | ||
sb.Append("}\n"); | ||
return sb.ToString(); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/Sinch/Conversation/TemplatesV2/OverrideTemplateReference.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Text; | ||
using Sinch.Conversation.Messages.Message; | ||
|
||
namespace Sinch.Conversation.TemplatesV2 | ||
{ | ||
public class OverrideTemplateReference | ||
{ | ||
/// <summary> | ||
/// The referenced template can be an omnichannel template stored in Conversation API Template Store as AppMessage or it can reference external channel-specific template such as WhatsApp Business Template. | ||
/// </summary> | ||
public TemplateReference TemplateReference { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or Sets ParameterMappings | ||
/// </summary> | ||
public TemplateReferenceParameterMappings ParameterMappings { get; set; } | ||
|
||
/// <summary> | ||
/// Returns the string presentation of the object | ||
/// </summary> | ||
/// <returns>String presentation of the object</returns> | ||
public override string ToString() | ||
{ | ||
var sb = new StringBuilder(); | ||
sb.Append("class TemplateReference {\n"); | ||
sb.Append(" TemplateReference: ").Append(TemplateReference).Append("\n"); | ||
sb.Append(" ParameterMappings: ").Append(ParameterMappings).Append("\n"); | ||
sb.Append("}\n"); | ||
return sb.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Sinch.Conversation.TemplatesV2 | ||
{ | ||
public class Template | ||
{ | ||
/// <summary> | ||
/// The id of the template. Specify this yourself during creation. Otherwise, we will generate an ID for you. This must | ||
/// be unique for a given project. | ||
/// </summary> | ||
public string Id { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// The description of the template. | ||
/// </summary> | ||
public string Description { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// The version of the template. While creating a template, this will be defaulted to 1. When updating a template, you | ||
/// must supply the latest version of the template in order for the update to be successful. | ||
/// </summary> | ||
public int Version { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// The default translation to use if translation not specified. Specified as a BCP-47 `language_code` and | ||
/// the `language_code` must exist in the translations list. | ||
/// </summary> | ||
public string DefaultTranslation { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Gets or Sets Translations | ||
/// </summary> | ||
public List<TemplateTranslation> Translations { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Timestamp when the template was created. | ||
/// </summary> | ||
public DateTime CreateTime { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Timestamp when the template was updated. | ||
/// </summary> | ||
public DateTime UpdateTime { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Returns the string presentation of the object | ||
/// </summary> | ||
/// <returns>String presentation of the object</returns> | ||
public override string ToString() | ||
{ | ||
var sb = new StringBuilder(); | ||
sb.Append("class V2TemplateResponse {\n"); | ||
sb.Append(" Id: ").Append(Id).Append("\n"); | ||
sb.Append(" Description: ").Append(Description).Append("\n"); | ||
sb.Append(" Version: ").Append(Version).Append("\n"); | ||
sb.Append(" DefaultTranslation: ").Append(DefaultTranslation).Append("\n"); | ||
sb.Append(" Translations: ").Append(Translations).Append("\n"); | ||
sb.Append(" CreateTime: ").Append(CreateTime).Append("\n"); | ||
sb.Append(" UpdateTime: ").Append(UpdateTime).Append("\n"); | ||
sb.Append("}\n"); | ||
return sb.ToString(); | ||
} | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/Sinch/Conversation/TemplatesV2/TemplateReferenceParameterMappings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Text; | ||
|
||
namespace Sinch.Conversation.TemplatesV2 | ||
{ | ||
/// <summary> | ||
/// A mapping between omni-template variables and the channel specific parameters. | ||
/// </summary> | ||
public sealed class TemplateReferenceParameterMappings | ||
{ | ||
/// <summary> | ||
/// The mapping between the omni-template variable and the channel specific parameter. | ||
/// </summary> | ||
public string Name { get; set; } | ||
|
||
|
||
/// <summary> | ||
/// Returns the string presentation of the object | ||
/// </summary> | ||
/// <returns>String presentation of the object</returns> | ||
public override string ToString() | ||
{ | ||
var sb = new StringBuilder(); | ||
sb.Append("class TemplateReferenceParameterMappings {\n"); | ||
sb.Append(" Name: ").Append(Name).Append("\n"); | ||
sb.Append("}\n"); | ||
return sb.ToString(); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.