-
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/add methods to root of numbers #81
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5af7ff9
feat: add available numbers method to ISinchNumbers
Dovchik 686a5e1
feat: add active numbers method to ISinchNumbers
Dovchik 30a887f
feat: point test to not deprecated method
Dovchik df0dc0c
chore: point to actual methods
Dovchik 255ac3c
chore: point to actual in example
Dovchik 5b16f23
chore: cleanup using and mark null pass as intentional
Dovchik 43053e3
chore: throw exception if URI is null in AplicationSignedAuth
Dovchik 8da1e13
chore: add obsolete for Active and Available tags
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
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
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 |
---|---|---|
@@ -1,6 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Sinch.Core; | ||
using Sinch.Logger; | ||
using Sinch.Numbers.Active; | ||
using Sinch.Numbers.Active.List; | ||
using Sinch.Numbers.Active.Update; | ||
using Sinch.Numbers.Available; | ||
using Sinch.Numbers.Available.List; | ||
using Sinch.Numbers.Available.Rent; | ||
using Sinch.Numbers.Available.RentAny; | ||
|
||
namespace Sinch.Numbers | ||
{ | ||
|
@@ -11,20 +21,58 @@ namespace Sinch.Numbers | |
public interface ISinchNumbers | ||
{ | ||
/// <summary> | ||
/// You can use the Available Regions API to list all of the regions that have numbers assigned to a project. | ||
/// You can use the Available Regions API to list all the regions that have numbers assigned to a project. | ||
/// </summary> | ||
public ISinchNumbersRegions Regions { get; } | ||
|
||
/// <summary> | ||
/// You can use the Available Number API to search for available numbers or activate an available number. | ||
/// </summary> | ||
[Obsolete($"This property is obsolete, use methods of this ({nameof(ISinchNumbers)}) interface instead.")] | ||
public ISinchNumbersAvailable Available { get; } | ||
|
||
/// <summary> | ||
/// You can use the Active Number API to manage numbers you own. Assign numbers to projects, | ||
/// release numbers from projects, or list all numbers assigned to a project. | ||
/// </summary> | ||
[Obsolete($"This property is obsolete, use methods of this ({nameof(ISinchNumbers)}) interface instead.")] | ||
public ISinchNumbersActive Active { get; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may also mark this as obsolete before changing the visibility in the next major |
||
|
||
/// <inheritdoc cref="ISinchNumbersAvailable.RentAny" /> | ||
Task<ActiveNumber> RentAny(RentAnyNumberRequest request, | ||
CancellationToken cancellationToken = default); | ||
|
||
/// <inheritdoc cref="ISinchNumbersAvailable.Rent" /> | ||
Task<ActiveNumber> Rent(string phoneNumber, | ||
RentActiveNumberRequest request, CancellationToken cancellationToken = default); | ||
|
||
/// <inheritdoc cref="ISinchNumbersAvailable.List" /> | ||
Task<ListAvailableNumbersResponse> SearchForAvailableNumbers( | ||
ListAvailableNumbersRequest request, CancellationToken cancellationToken = default); | ||
|
||
/// <inheritdoc cref="ISinchNumbersAvailable.CheckAvailability" /> | ||
Task<AvailableNumber> CheckAvailability(string phoneNumber, | ||
CancellationToken cancellationToken = default); | ||
|
||
/// <inheritdoc cref="ISinchNumbersActive.Release" /> | ||
Task<ActiveNumber> Release( | ||
string phoneNumber, CancellationToken cancellationToken = default); | ||
|
||
/// <inheritdoc cref="ISinchNumbersActive.Get" /> | ||
Task<ActiveNumber> Get(string phoneNumber, | ||
CancellationToken cancellationToken = default); | ||
|
||
/// <inheritdoc cref="ISinchNumbersActive.Update" /> | ||
Task<ActiveNumber> Update(string phoneNumber, | ||
UpdateActiveNumberRequest request, CancellationToken cancellationToken = default); | ||
|
||
/// <inheritdoc cref="ISinchNumbersActive.List" /> | ||
Task<ListActiveNumbersResponse> List(ListActiveNumbersRequest request, | ||
CancellationToken cancellationToken = default); | ||
|
||
/// <inheritdoc cref="ISinchNumbersActive.ListAuto" /> | ||
IAsyncEnumerable<ActiveNumber> ListAuto(ListActiveNumbersRequest request, | ||
CancellationToken cancellationToken = default); | ||
} | ||
|
||
public sealed class Numbers : ISinchNumbers | ||
|
@@ -45,5 +93,69 @@ internal Numbers(string projectId, Uri baseAddress, | |
public ISinchNumbersActive Active { get; } | ||
|
||
public ISinchNumbersAvailable Available { get; } | ||
|
||
// disabling obsolete usage as in next major version, active and available interfaces will remain, | ||
// but visibility changed to internal, and public interface will be available only through this methods | ||
#pragma warning disable CS0618 // Type or member is obsolete | ||
/// <inheritdoc /> | ||
public Task<ActiveNumber> RentAny(RentAnyNumberRequest request, CancellationToken cancellationToken = default) | ||
{ | ||
return Available.RentAny(request, cancellationToken); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public Task<ActiveNumber> Rent(string phoneNumber, RentActiveNumberRequest request, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
return Available.Rent(phoneNumber, request, cancellationToken); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public Task<ListAvailableNumbersResponse> SearchForAvailableNumbers(ListAvailableNumbersRequest request, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
return Available.List(request, cancellationToken); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public Task<AvailableNumber> CheckAvailability(string phoneNumber, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
return Available.CheckAvailability(phoneNumber, cancellationToken); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public Task<ActiveNumber> Release(string phoneNumber, CancellationToken cancellationToken = default) | ||
{ | ||
return Active.Release(phoneNumber, cancellationToken); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public Task<ActiveNumber> Get(string phoneNumber, CancellationToken cancellationToken = default) | ||
{ | ||
return Active.Get(phoneNumber, cancellationToken); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public Task<ActiveNumber> Update(string phoneNumber, UpdateActiveNumberRequest request, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
return Active.Update(phoneNumber, request, cancellationToken); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public Task<ListActiveNumbersResponse> List(ListActiveNumbersRequest request, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
return Active.List(request, cancellationToken); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public IAsyncEnumerable<ActiveNumber> ListAuto(ListActiveNumbersRequest request, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
return Active.ListAuto(request, cancellationToken); | ||
} | ||
#pragma warning restore CS0618 // Type or member is obsolete | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using System; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Sinch.SMS.Inbounds | ||
{ | ||
|
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
Oops, something went wrong.
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.
I'm curious about why the formatting changed as there is no configuration change in this PR. Is it linked to the IDE? I just want to make sure this is intentional and won't be reverted by an auto-formatting in another PR.
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.
Auto formatted by IDE agnostic
dotnet format