Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Different models for opt add and remove endpoints, few more live tests
  • Loading branch information
FarhadJabiyev committed Nov 28, 2024
commit e3ed05d14f4b85972bc8aa819875552b07808579
12 changes: 5 additions & 7 deletions sdk/communication/Azure.Communication.Sms/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# Release History

## 1.1.0-beta.2 (Unreleased)
## 1.1.0-beta.2

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
- Added support for Opt Out Management Api to:
- Opt-out the recipient.
- Opt-in the recipient.
- Check if the recpient is opted-out or not.

## 1.1.0-beta.1 (2024-05-07)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ namespace Azure.Communication.Sms
public partial class OptOutsClient
{
protected OptOutsClient() { }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem>> Add(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem>>> AddAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutAddResponseItem>> Add(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutAddResponseItem>>> AddAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutResponseItem>> Check(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutResponseItem>>> CheckAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem>> Remove(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem>>> RemoveAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutRemoveResponseItem>> Remove(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutRemoveResponseItem>>> RemoveAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class SmsClient
{
Expand Down Expand Up @@ -56,13 +56,13 @@ public static partial class CommunicationSmsModelFactory
public static Azure.Communication.Sms.Models.OptOutResponse OptOutResponse(System.Collections.Generic.IEnumerable<Azure.Communication.Sms.Models.OptOutResponseItem> value = null) { throw null; }
public static Azure.Communication.Sms.Models.OptOutResponseItem OptOutResponseItem(string to = null, int httpStatusCode = 0, bool? isOptedOut = default(bool?), string errorMessage = null) { throw null; }
}
public partial class OptOutChangeResponse
public partial class OptOutAddResponse
{
internal OptOutChangeResponse() { }
public System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem> Value { get { throw null; } }
internal OptOutAddResponse() { }
public System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutAddResponseItem> Value { get { throw null; } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct OptOutChangeResponseItem
public partial struct OptOutAddResponseItem
{
private object _dummy;
private int _dummyPrimitive;
Expand All @@ -75,6 +75,20 @@ public partial class OptOutRecipient
public OptOutRecipient(string to) { }
public string To { get { throw null; } }
}
public partial class OptOutRemoveResponse
{
internal OptOutRemoveResponse() { }
public System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutRemoveResponseItem> Value { get { throw null; } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct OptOutRemoveResponseItem
{
private object _dummy;
private int _dummyPrimitive;
public string ErrorMessage { get { throw null; } }
public int HttpStatusCode { get { throw null; } }
public string To { get { throw null; } }
}
public partial class OptOutResponse
{
internal OptOutResponse() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ namespace Azure.Communication.Sms
public partial class OptOutsClient
{
protected OptOutsClient() { }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem>> Add(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem>>> AddAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutAddResponseItem>> Add(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutAddResponseItem>>> AddAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutResponseItem>> Check(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutResponseItem>>> CheckAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem>> Remove(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem>>> RemoveAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutRemoveResponseItem>> Remove(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutRemoveResponseItem>>> RemoveAsync(string from, System.Collections.Generic.IEnumerable<string> to, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public partial class SmsClient
{
Expand Down Expand Up @@ -56,13 +56,13 @@ public static partial class CommunicationSmsModelFactory
public static Azure.Communication.Sms.Models.OptOutResponse OptOutResponse(System.Collections.Generic.IEnumerable<Azure.Communication.Sms.Models.OptOutResponseItem> value = null) { throw null; }
public static Azure.Communication.Sms.Models.OptOutResponseItem OptOutResponseItem(string to = null, int httpStatusCode = 0, bool? isOptedOut = default(bool?), string errorMessage = null) { throw null; }
}
public partial class OptOutChangeResponse
public partial class OptOutAddResponse
{
internal OptOutChangeResponse() { }
public System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutChangeResponseItem> Value { get { throw null; } }
internal OptOutAddResponse() { }
public System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutAddResponseItem> Value { get { throw null; } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct OptOutChangeResponseItem
public partial struct OptOutAddResponseItem
{
private object _dummy;
private int _dummyPrimitive;
Expand All @@ -75,6 +75,20 @@ public partial class OptOutRecipient
public OptOutRecipient(string to) { }
public string To { get { throw null; } }
}
public partial class OptOutRemoveResponse
{
internal OptOutRemoveResponse() { }
public System.Collections.Generic.IReadOnlyList<Azure.Communication.Sms.Models.OptOutRemoveResponseItem> Value { get { throw null; } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public partial struct OptOutRemoveResponseItem
{
private object _dummy;
private int _dummyPrimitive;
public string ErrorMessage { get { throw null; } }
public int HttpStatusCode { get { throw null; } }
public string To { get { throw null; } }
}
public partial class OptOutResponse
{
internal OptOutResponse() { }
Expand Down
2 changes: 1 addition & 1 deletion sdk/communication/Azure.Communication.Sms/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/communication/Azure.Communication.Sms",
"Tag": "net/communication/Azure.Communication.Sms_363bacad7d"
"Tag": "net/communication/Azure.Communication.Sms_b96598d9ba"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Linq;

namespace Azure.Communication.Sms.Models
{
/// <summary> Response for add opt out request. Validate the returned items in the response to see which recipients were successfully added to the opt outs list. </summary>
public partial class OptOutAddResponse
{
/// <summary> Initializes a new instance of <see cref="OptOutAddResponse"/>. </summary>
/// <param name="value"></param>
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
internal OptOutAddResponse(IEnumerable<OptOutAddResponseItem> value)
{
Argument.AssertNotNull(value, nameof(value));

Value = value.ToList();
}

/// <summary> Initializes a new instance of <see cref="OptOutAddResponse"/>. </summary>
/// <param name="value"></param>
internal OptOutAddResponse(IReadOnlyList<OptOutAddResponseItem> value)
{
Value = value;
}

/// <summary> Gets the value. </summary>
public IReadOnlyList<OptOutAddResponseItem> Value { get; }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;

namespace Azure.Communication.Sms.Models
{
/// <summary> The OptOutAddResponseItem. </summary>
public struct OptOutAddResponseItem
{
/// <summary> Initializes a new instance of <see cref="OptOutAddResponseItem"/>. </summary>
/// <param name="to"> The recipient phone number (in E.164 format). </param>
/// <param name="httpStatusCode"></param>
/// <exception cref="ArgumentNullException"> <paramref name="to"/> is null. </exception>
internal OptOutAddResponseItem(string to, int httpStatusCode)
{
Argument.AssertNotNull(to, nameof(to));

To = to;
HttpStatusCode = httpStatusCode;
}

/// <summary> Initializes a new instance of <see cref="OptOutAddResponseItem"/>. </summary>
/// <param name="to"> The recipient phone number (in E.164 format). </param>
/// <param name="httpStatusCode"></param>
/// <param name="errorMessage"> Optional error message in case of 4xx/5xx errors. </param>
internal OptOutAddResponseItem(string to, int httpStatusCode, string errorMessage)
{
To = to;
HttpStatusCode = httpStatusCode;
ErrorMessage = errorMessage;
}

/// <summary> The recipient phone number (in E.164 format). </summary>
public string To { get; }
/// <summary> Gets the http status code. </summary>
public int HttpStatusCode { get; }
/// <summary> Optional error message in case of 4xx/5xx errors. </summary>
public string ErrorMessage { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@

namespace Azure.Communication.Sms.Models
{
/// <summary> Response for an add and remove opt out request. Validate the returned items in the response to see which recipients were successfully added or removed from the opt outs list. </summary>
public partial class OptOutChangeResponse
/// <summary> Response for remove opt out request. Validate the returned items in the response to see which recipients were successfully removed from the opt outs list. </summary>
public partial class OptOutRemoveResponse
{
/// <summary> Initializes a new instance of <see cref="OptOutChangeResponse"/>. </summary>
/// <summary> Initializes a new instance of <see cref="OptOutAddResponse"/>. </summary>
/// <param name="value"></param>
/// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
internal OptOutChangeResponse(IEnumerable<OptOutChangeResponseItem> value)
internal OptOutRemoveResponse(IEnumerable<OptOutRemoveResponseItem> value)
{
Argument.AssertNotNull(value, nameof(value));

Value = value.ToList();
}

/// <summary> Initializes a new instance of <see cref="OptOutChangeResponse"/>. </summary>
/// <summary> Initializes a new instance of <see cref="OptOutAddResponse"/>. </summary>
/// <param name="value"></param>
internal OptOutChangeResponse(IReadOnlyList<OptOutChangeResponseItem> value)
internal OptOutRemoveResponse(IReadOnlyList<OptOutRemoveResponseItem> value)
{
Value = value;
}

/// <summary> Gets the value. </summary>
public IReadOnlyList<OptOutChangeResponseItem> Value { get; }
public IReadOnlyList<OptOutRemoveResponseItem> Value { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@

namespace Azure.Communication.Sms.Models
{
/// <summary> The OptOutChangeResponseItem. </summary>
public struct OptOutChangeResponseItem
/// <summary> The OptOutRemoveResponseItem. </summary>
public struct OptOutRemoveResponseItem
{
/// <summary> Initializes a new instance of <see cref="OptOutChangeResponseItem"/>. </summary>
/// <summary> Initializes a new instance of <see cref="OptOutRemoveResponseItem"/>. </summary>
/// <param name="to"> The recipient phone number (in E.164 format). </param>
/// <param name="httpStatusCode"></param>
/// <exception cref="ArgumentNullException"> <paramref name="to"/> is null. </exception>
internal OptOutChangeResponseItem(string to, int httpStatusCode)
internal OptOutRemoveResponseItem(string to, int httpStatusCode)
{
Argument.AssertNotNull(to, nameof(to));

To = to;
HttpStatusCode = httpStatusCode;
}

/// <summary> Initializes a new instance of <see cref="OptOutChangeResponseItem"/>. </summary>
/// <summary> Initializes a new instance of <see cref="OptOutRemoveResponseItem"/>. </summary>
/// <param name="to"> The recipient phone number (in E.164 format). </param>
/// <param name="httpStatusCode"></param>
/// <param name="errorMessage"> Optional error message in case of 4xx/5xx errors. </param>
internal OptOutChangeResponseItem(string to, int httpStatusCode, string errorMessage)
internal OptOutRemoveResponseItem(string to, int httpStatusCode, string errorMessage)
{
To = to;
HttpStatusCode = httpStatusCode;
Expand Down
Loading
Loading