-
Notifications
You must be signed in to change notification settings - Fork 1
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/conversation contact #33
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
023fe39
refactor(verification): set app sign as default param to authStrategy…
Dovchik 1fe0bc4
refactor: makes app plural
Dovchik 7a960ff
feat: init ISinchConversationContacts
Dovchik c24fbc3
feat: implement get contact
Dovchik e7e83cc
feat: implement create contact
Dovchik a57f28d
feat(tests): add create and get contact tests
Dovchik 6a2b88a
feat: add list test
Dovchik ebcade8
feat: implement list auto
Dovchik a6c9987
feat: implement delete
Dovchik 0051915
feat: implement GetChannelProfile
Dovchik 8658ebb
ci: add map for 6042 doppleganger port
Dovchik a8a4fa0
chore: add voice to REEADME.md
Dovchik 2f7067a
feat: implement Update endpoint
Dovchik 50c2974
feat: implement merge
Dovchik 0f23470
feat: update contact now provides update_mask
Dovchik 76edf11
merge main
Dovchik 93d9cbc
fix: check null or empty for page token
Dovchik 5b4118a
feat: use enumrecord for contact.language
Dovchik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ jobs: | |
- 6039:6039 | ||
- 6040:6040 | ||
- 6041:6041 | ||
- 6042:6042 | ||
- 6043:6043 | ||
- 6044:6044 | ||
|
||
|
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
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
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,166 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Sinch.Conversation.Messages; | ||
using Sinch.Core; | ||
|
||
namespace Sinch.Conversation.Contacts | ||
{ | ||
public sealed class Contact | ||
{ | ||
/// <summary> | ||
/// Tracks the fields which where initialized. | ||
/// </summary> | ||
private readonly ISet<string> _setFields = new HashSet<string>(); | ||
|
||
private List<ChannelIdentity> _channelIdentities; | ||
private List<ConversationChannel> _channelPriority; | ||
private string _displayName; | ||
private string _email; | ||
private string _externalId; | ||
private string _id; | ||
private ConversationLanguage _language; | ||
private string _metadata; | ||
|
||
/// <summary> | ||
/// List of channel identities. | ||
/// </summary> | ||
public List<ChannelIdentity> ChannelIdentities | ||
{ | ||
get => _channelIdentities; | ||
set | ||
{ | ||
_setFields.Add(nameof(ChannelIdentities)); | ||
_channelIdentities = value; | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// List of channels defining the channel priority. | ||
/// </summary> | ||
public List<ConversationChannel> ChannelPriority | ||
{ | ||
get => _channelPriority; | ||
set | ||
{ | ||
_setFields.Add(nameof(ChannelPriority)); | ||
_channelPriority = value; | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// The display name. A default 'Unknown' will be assigned if left empty. | ||
/// </summary> | ||
public string DisplayName | ||
{ | ||
get => _displayName; | ||
set | ||
{ | ||
_setFields.Add(nameof(DisplayName)); | ||
_displayName = value; | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Email of the contact. | ||
/// </summary> | ||
public string Email | ||
{ | ||
get => _email; | ||
set | ||
{ | ||
_setFields.Add(nameof(Email)); | ||
_email = value; | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Contact identifier in an external system. | ||
/// </summary> | ||
public string ExternalId | ||
{ | ||
get => _externalId; | ||
set | ||
{ | ||
_setFields.Add(nameof(ExternalId)); | ||
_externalId = value; | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// The ID of the contact. | ||
/// </summary> | ||
public string Id | ||
{ | ||
get => _id; | ||
set | ||
{ | ||
_setFields.Add(nameof(Id)); | ||
_id = value; | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Gets or Sets Language | ||
/// </summary> | ||
public ConversationLanguage Language | ||
{ | ||
get => _language; | ||
set | ||
{ | ||
_setFields.Add(nameof(Language)); | ||
_language = value; | ||
} | ||
} | ||
|
||
|
||
/// <summary> | ||
/// Metadata associated with the contact. Up to 1024 characters long. | ||
/// </summary> | ||
public string Metadata | ||
{ | ||
get => _metadata; | ||
set | ||
{ | ||
_setFields.Add(nameof(Metadata)); | ||
_metadata = value; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Get the comma separated snake_case list of properties which were directly initialized in this object. | ||
/// If, for example, DisplayName and Metadata were set, will return <example>display_name,metadata</example> | ||
/// </summary> | ||
/// <returns></returns> | ||
internal string GetPropertiesMask() | ||
{ | ||
return string.Join(',', _setFields.Select(StringUtils.ToSnakeCase)); | ||
} | ||
|
||
/// <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 Contact {\n"); | ||
sb.Append(" ChannelIdentities: ").Append(ChannelIdentities).Append("\n"); | ||
sb.Append(" ChannelPriority: ").Append(ChannelPriority).Append("\n"); | ||
sb.Append(" DisplayName: ").Append(DisplayName).Append("\n"); | ||
sb.Append(" Email: ").Append(Email).Append("\n"); | ||
sb.Append(" ExternalId: ").Append(ExternalId).Append("\n"); | ||
sb.Append(" Id: ").Append(Id).Append("\n"); | ||
sb.Append(" Language: ").Append(Language).Append("\n"); | ||
sb.Append(" Metadata: ").Append(Metadata).Append("\n"); | ||
sb.Append("}\n"); | ||
return sb.ToString(); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this logic could be dynamic and dependent of OAS description based onto
style
andexplode
specs.This, to avoid hard coded logic here and logic/helper shared across domains
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, why to avoid makes sense but how, you mean add helpers for that?
I had an idea for that but in a other task where i see the pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Java SDK is based onto this: https://github.com/sinch/sinch-sdk-java/blob/feat/voice/core/src/main/com/sinch/sdk/core/http/URLParameterUtils.java
And thanks to generator tool using OAS file description, generated sources contains directives about parameters format to be used (e.g. https://github.com/sinch/sinch-sdk-java/blob/feat/voice/openapi-contracts/src/main/com/sinch/sdk/domains/numbers/adapters/api/v1/ActiveNumberApi.java#L278)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay, I'll refactor in other task