-
Notifications
You must be signed in to change notification settings - Fork 1
Refactor/sinch client entrypoint v2 #102
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
9fb5125
refactor: initial new entrypoint
Dovchik 6c6af58
refactor: make entrypoint changes compilable
Dovchik 5aece43
refactor verification entrypoint
Dovchik ff24278
refactor: verification entry point
Dovchik 0265d3b
refactor: init lazy as thread safe
Dovchik 2fe04d9
refactor: voice verification config tests
Dovchik c7224a4
refactor: url resolver -> configuration tests
Dovchik 9b99767
chore: remove url resolver
Dovchik 96c7213
refactor: lazy init http for conversation webhooks.parse event to wor…
Dovchik f818e66
fix(test): access to sinch domains
Dovchik bd4ae6a
chore: cleanup comment
Dovchik 98c5ef9
refactor: renamed common to unified credentials
Dovchik 439ed84
feat: add test for conversation configuration custom region
Dovchik 8d08eef
fix: check empty url override
Dovchik fc77f38
feat: remove log of unified credentials
Dovchik 604fa0a
fix: verify voice credentials before calling
Dovchik 1130d1d
refactor: configurations url check if null or empty
Dovchik cc7b731
refactor: coalesce UrlOverride into uri
Dovchik def6ec6
feat(test): add happy path for verification init
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,14 +1,24 @@ | ||
using DotNetEnv; | ||
using Sinch; | ||
using Sinch.Verification; | ||
|
||
// Assume .env file is present in your output directory | ||
Env.Load(); | ||
|
||
|
||
var sinch = new SinchClient(Environment.GetEnvironmentVariable("SINCH_PROJECT_ID")!, | ||
Environment.GetEnvironmentVariable("SINCH_KEY_ID")!, | ||
Environment.GetEnvironmentVariable("SINCH_KEY_SECRET")!); | ||
_ = sinch.Verification(Environment.GetEnvironmentVariable("SINCH_APP_KEY")!, | ||
Environment.GetEnvironmentVariable("SINCH_APP_SECRET")!); | ||
var sinch = new SinchClient(new SinchClientConfiguration() | ||
{ | ||
SinchUnifiedCredentials = new SinchUnifiedCredentials() | ||
{ | ||
ProjectId = Environment.GetEnvironmentVariable("SINCH_PROJECT_ID")!, | ||
KeyId = Environment.GetEnvironmentVariable("SINCH_KEY_ID")!, | ||
KeySecret = Environment.GetEnvironmentVariable("SINCH_KEY_SECRET")! | ||
}, | ||
VerificationConfiguration = new SinchVerificationConfiguration() | ||
{ | ||
AppKey = Environment.GetEnvironmentVariable("SINCH_APP_KEY")!, | ||
AppSecret = Environment.GetEnvironmentVariable("SINCH_APP_KEY_SECRET")! | ||
} | ||
}); | ||
|
||
Console.ReadLine(); |
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,17 +1,44 @@ | ||
using Sinch; | ||
using Sinch.Verification; | ||
using Sinch.Verification.Common; | ||
using Sinch.Verification.Start.Request; | ||
using Sinch.Voice; | ||
|
||
namespace Examples | ||
{ | ||
public class UseOnlyVoiceOrVerification | ||
{ | ||
/// <summary> | ||
/// If you want to use only voice and/or verification api, you can init sinch client without providing | ||
/// necessary credentials. But be aware that when you try to use other services which depends on the common credentials you will get an exception. | ||
/// unified credentials. But be aware that when you try to use other services which depends on the common credentials you will get an exception. | ||
/// </summary> | ||
public void Example() | ||
public async Task Example() | ||
{ | ||
var sinchVoiceClient = new SinchClient(null, null, null).Voice("appKey", "appSecret"); | ||
var sinchVerificationClient = new SinchClient(null, null, null).Verification("appKey", "appSecret"); | ||
var sinch = new SinchClient(new SinchClientConfiguration() | ||
{ | ||
VerificationConfiguration = new SinchVerificationConfiguration() | ||
{ | ||
AppKey = "verificationAppKey", | ||
AppSecret = "verificationAppSecret", | ||
}, | ||
VoiceConfiguration = new SinchVoiceConfiguration() | ||
{ | ||
AppKey = "voiceAppKey", | ||
AppSecret = "voiceAppSecret", | ||
} | ||
}); | ||
// example of voice use | ||
var voiceClient = sinch.Voice; | ||
var call = await voiceClient.Calls.Get("1"); | ||
// do smth with call response | ||
|
||
// example of verification use | ||
var verificationClient = sinch.Verification; | ||
var verificationStart = await verificationClient.Verification.StartSms(new StartSmsVerificationRequest() | ||
{ | ||
Identity = Identity.Number("+481123123123") | ||
}); | ||
// do smth with verification start response | ||
} | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.