diff --git a/.gitignore b/.gitignore
index 8cf48e1..683c584 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,4 +15,4 @@
*.nuget.props
*.nuget.targets
*.orig
-*.DS_Store
\ No newline at end of file
+*.DS_Store
diff --git a/Documentation/en-EN/ChatApi.Instances/Operations/CreateChatApiInstance.md b/Documentation/en-EN/ChatApi.Instances/Operations/CreateChatApiInstance.md
index f875c08..d2f2d44 100644
--- a/Documentation/en-EN/ChatApi.Instances/Operations/CreateChatApiInstance.md
+++ b/Documentation/en-EN/ChatApi.Instances/Operations/CreateChatApiInstance.md
@@ -10,7 +10,7 @@ This method is available in both synchronous and asynchronous implementations.
## Response
| `Parameter` | `Description` | `The data type of the parameter` |
|:---------------------:|:---------------------------|:--------------------------------:|
-| `Result` | Execution result | `IChatApiCreateInstanceResult`
+| `Result` | Result of creating a Chat Api instance | `IChatApiCreateInstanceResult`
## Parameters of the `IChatApiCreateInstanceResult`
| `Parameter` | `Description` | `The data type of the parameter` |
diff --git a/Documentation/en-EN/ChatApi.Instances/Operations/GetChatApiInstances.md b/Documentation/en-EN/ChatApi.Instances/Operations/GetChatApiInstances.md
index bcf83d6..eed13c9 100644
--- a/Documentation/en-EN/ChatApi.Instances/Operations/GetChatApiInstances.md
+++ b/Documentation/en-EN/ChatApi.Instances/Operations/GetChatApiInstances.md
@@ -15,7 +15,7 @@ This method is available in both synchronous and asynchronous implementations.
| `PaidTill` | End date of the paid period | `DateTime`
| `Instance` | The unique identifier of the instance | `String`
| `IsActive` | An indicator of the activity instance | `Boolean`
-| `TypeInstance` | Instance t ype | `ChatApiInstanceType`
+| `TypeInstance` | Instance type | `ChatApiInstanceType`
| `PaymentsCount` | Number of paid months | `Integer`
## Example
diff --git a/Documentation/en-EN/WhatsApp/ChatApi.WA.Account/Operations/Expiry.md b/Documentation/en-EN/WhatsApp/ChatApi.WA.Account/Operations/Expiry.md
index 539aad6..824ccdc 100644
--- a/Documentation/en-EN/WhatsApp/ChatApi.WA.Account/Operations/Expiry.md
+++ b/Documentation/en-EN/WhatsApp/ChatApi.WA.Account/Operations/Expiry.md
@@ -1,4 +1,4 @@
-# Updates the QR code after its expired
+# Updates the QR code after its expired.
**Implementation notes**
This method is available in both synchronous and asynchronous implementations
diff --git a/Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/ReadChat.md b/Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/ReadChat.md
index b9299bf..8e6339f 100644
--- a/Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/ReadChat.md
+++ b/Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/ReadChat.md
@@ -12,7 +12,7 @@ This method is available in both synchronous and asynchronous implementations.
## Response
| `Parameter` | `Description` | `The data type of the parameter` |
|:---------------------:|:--------------------------------------------------------|:--------------------------------:|
-| `Read` | The status of the request. | `Boolean` |
+| `Read` | Message readability indicator | `Boolean` |
| `ChatId` | Unique ID of the dialog. | `String` |
| `Message` | Dialog reading status | `String` |
diff --git a/Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/SendTypingStatus.md b/Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/SendTypingStatus.md
index bc76226..a13b7e8 100644
--- a/Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/SendTypingStatus.md
+++ b/Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/SendTypingStatus.md
@@ -48,8 +48,8 @@ namespace ChatApiClient
var chatApiResponse = userInterfaceOperations.SendTypingStatus(request);
if (!chatApiResponse.IsSuccess) throw chatApiResponse.Exception!;
+
var response = chatApiResponse.GetResult();
-
Console.WriteLine(response?.PrintMembers());
}
}
diff --git a/Src/ChatApi.png b/Images/ChatApi.png
similarity index 100%
rename from Src/ChatApi.png
rename to Images/ChatApi.png
diff --git a/Src/ChatApi.Core/ChatApi.Core.csproj b/Src/ChatApi.Core/ChatApi.Core.csproj
index 0ca69ed..5c4d0b7 100644
--- a/Src/ChatApi.Core/ChatApi.Core.csproj
+++ b/Src/ChatApi.Core/ChatApi.Core.csproj
@@ -1,48 +1,71 @@
- netstandard2.0
- 9
+
+
enable
+ 9
+ netstandard2.0
+
+
true
+ true
+ bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
+
+
ChatApi.Core
Roman Vorontsov
- ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
-
- https://github.com/Zodt/ChatApi
- GitHub
+ en
+ ChatApi.png
+ 1.0.1-alpha
ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp
-
+
+ ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
+
+
+ 1. Refactoring code
+ 2. Add xml doc
+
+
+
MIT
false
- ChatApi.png
- en
-
-
-
-
-
-
-
- True
- True
- Resources.resx
-
-
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
+
+ GitHub
+ https://github.com/Zodt/ChatApi
+
+
-
- True
-
-
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+ True
+
+
+
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Collections/WhatsAppApiCollection.cs b/Src/ChatApi.Core/Collections/WhatsAppApiCollection.cs
index 41a43e8..4547a7b 100644
--- a/Src/ChatApi.Core/Collections/WhatsAppApiCollection.cs
+++ b/Src/ChatApi.Core/Collections/WhatsAppApiCollection.cs
@@ -10,10 +10,16 @@
namespace ChatApi.Core.Collections
{
+ /// Provides the base class for a generic WhatsApp-collection.
+ /// The type of elements in the collection.
public abstract class WhatsAppApiCollection : Collection, IPrintableCollection, IEquatable?> where T : class, IEquatable
{
#region Overridden collection methods
+ ///
+ /// Adds an object to the end of the .
+ ///
+ /// The object to be added to the end of the . The value can be null for reference types.
public new void Add(T item)
{
if (Items.Contains(item)) return;
@@ -22,39 +28,71 @@ public abstract class WhatsAppApiCollection : Collection, IPrintableColle
#region AddRange
- public void AddRange(IEnumerable enumerable)
+ ///
+ /// Adds the elements of the specified collection to the end of the .
+ ///
+ /// The collection whose elements should be added to the end of the . The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.
+ /// collection is null.
+ public void AddRange(IEnumerable collection)
{
- IList list = enumerable.ToList();
+ if (collection is null) throw new ArgumentNullException(nameof(collection));
+
+ IList list = collection.ToList();
// ReSharper disable once ForCanBeConvertedToForeach
for (int i = 0; i < list.Count; i++)
if (!Items.Contains(list[i]))
base.Add(list[i]);
}
- public void AddRange(IList enumerable)
+
+ ///
+ /// Adds the elements of the specified collection to the end of the .
+ ///
+ /// The collection whose elements should be added to the end of the . The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.
+ /// collection is null.
+ public void AddRange(IList? collection)
{
+ if (collection is null) throw new ArgumentNullException(nameof(collection));
+
// ReSharper disable once ForCanBeConvertedToForeach
- for (int i = 0; i < enumerable.Count; i++)
- if (!Items.Contains(enumerable[i]))
- base.Add(enumerable[i]);
+ for (int i = 0; i < collection.Count; i++)
+ if (!Items.Contains(collection[i]))
+ base.Add(collection[i]);
}
- public void AddRange(ICollection enumerable)
+ ///
+ /// Adds the elements of the specified collection to the end of the .
+ ///
+ /// The collection whose elements should be added to the end of the . The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.
+ /// collection is null.
+ public void AddRange(ICollection collection)
{
- IList list = enumerable.ToList();
+ if (collection is null) throw new ArgumentNullException(nameof(collection));
+ IList list = collection.ToList();
// ReSharper disable once ForCanBeConvertedToForeach
for (int i = 0; i < list.Count; i++)
if (!Items.Contains(list[i]))
base.Add(list[i]);
}
- public void AddRange(IReadOnlyList enumerable)
+ ///
+ /// Adds the elements of the specified collection to the end of the .
+ ///
+ /// The collection whose elements should be added to the end of the . The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.
+ /// collection is null.
+ public void AddRange(IReadOnlyList collection)
{
+ if (collection is null) throw new ArgumentNullException(nameof(collection));
// ReSharper disable once ForCanBeConvertedToForeach
- for (int i = 0; i < enumerable.Count; i++)
- if (!Items.Contains(enumerable[i]))
- base.Add(enumerable[i]);
+ for (int i = 0; i < collection.Count; i++)
+ if (!Items.Contains(collection[i]))
+ base.Add(collection[i]);
}
- public void AddRange(IReadOnlyCollection enumerable)
+ ///
+ /// Adds the elements of the specified collection to the end of the .
+ ///
+ /// The collection whose elements should be added to the end of the . The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.
+ /// collection is null.
+ public void AddRange(IReadOnlyCollection collection)
{
- IList list = enumerable.ToList();
+ IList list = collection.ToList();
// ReSharper disable once ForCanBeConvertedToForeach
for (int i = 0; i < list.Count; i++)
if (!Items.Contains(list[i]))
@@ -68,6 +106,7 @@ public void AddRange(IReadOnlyCollection enumerable)
#region Equatable
+ ///
public bool Equals(Collection? other)
{
if (other is null || other.Count != Count) return false;
@@ -88,6 +127,7 @@ public bool Equals(Collection? other)
return true;
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -102,8 +142,22 @@ public override int GetHashCode()
}
}
+ ///
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is Collection self && Equals(self);
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static bool operator == (WhatsAppApiCollection? left, WhatsAppApiCollection? right) => EquatableHelper.IsEquatable(left, right);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public static bool operator != (WhatsAppApiCollection? left, WhatsAppApiCollection? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
@@ -128,6 +182,7 @@ private static string GetShift(int? shiftValue)
return stringBuilder.ToString();
}
+ ///
public string PrintMembers()
{
int shift = default;
@@ -155,6 +210,7 @@ public string PrintMembers()
return _stringBuilder.ToString();
}
+ ///
public string PrintMembers(int shift)
{
_stringBuilder.AppendLine("[");
@@ -167,11 +223,11 @@ public string PrintMembers(int shift)
int maxPrint = Count >= 3 ? 3 : Count;
string currentShift = GetShift(++shift);
- if (this[0] is Printable)
+ if (this[0] is IPrintable)
for (int i = 0; i <= maxPrint - 1; i++)
_stringBuilder.AppendLine(string.Concat((this[i] as Printable)!.PrintMembers(shift-1), ", "));
- else if (this[0] is string || !typeof(T).IsInterface)
+ else if (!typeof(T).IsInterface || !typeof(T).IsClass)
for (int i = 0; i <= maxPrint - 1; i++)
_stringBuilder.AppendLine(string.Concat(currentShift, this[i], ", "));
@@ -184,6 +240,7 @@ public string PrintMembers(int shift)
return _stringBuilder.ToString();
}
+ ///
public string PrintMembers(int countElementPrint, int shift)
{
_stringBuilder.AppendLine("[");
diff --git a/Src/ChatApi.Core/Connect/Interfaces/IChatApiInstanceConnect.cs b/Src/ChatApi.Core/Connect/Interfaces/IChatApiInstanceConnect.cs
index 472b369..75b927b 100644
--- a/Src/ChatApi.Core/Connect/Interfaces/IChatApiInstanceConnect.cs
+++ b/Src/ChatApi.Core/Connect/Interfaces/IChatApiInstanceConnect.cs
@@ -2,5 +2,6 @@
namespace ChatApi.Core.Connect.Interfaces
{
+ ///
public interface IChatApiInstanceConnect : IConnect, IChatApiKey { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Connect/Interfaces/IConnect.cs b/Src/ChatApi.Core/Connect/Interfaces/IConnect.cs
index cfe6642..4427ea6 100644
--- a/Src/ChatApi.Core/Connect/Interfaces/IConnect.cs
+++ b/Src/ChatApi.Core/Connect/Interfaces/IConnect.cs
@@ -1,4 +1,5 @@
namespace ChatApi.Core.Connect.Interfaces
{
+ ///
public interface IConnect { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Connect/Interfaces/IWhatsAppConnect.cs b/Src/ChatApi.Core/Connect/Interfaces/IWhatsAppConnect.cs
index 98b7d6a..5296f8f 100644
--- a/Src/ChatApi.Core/Connect/Interfaces/IWhatsAppConnect.cs
+++ b/Src/ChatApi.Core/Connect/Interfaces/IWhatsAppConnect.cs
@@ -2,10 +2,20 @@
namespace ChatApi.Core.Connect.Interfaces
{
+ ///
public interface IWhatsAppConnect : IConnect, IEquatable
{
+ ///
+ /// The unique identifier of the instance
+ ///
string? Token { get; }
+ ///
+ /// The prefix of the server. The old logic
+ ///
string? Server { get; }
+ ///
+ /// A unique token for accessing the server for this instance
+ ///
string? Instance { get; }
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Connect/WhatsAppConnect.cs b/Src/ChatApi.Core/Connect/WhatsAppConnect.cs
index c4cc401..f4334b1 100644
--- a/Src/ChatApi.Core/Connect/WhatsAppConnect.cs
+++ b/Src/ChatApi.Core/Connect/WhatsAppConnect.cs
@@ -4,28 +4,37 @@
namespace ChatApi.Core.Connect
{
+ ///
public class WhatsAppConnect : IWhatsAppConnect
{
+ ///
public string Token { get; }
+ ///
public string Server { get; }
+ ///
public string Instance { get; }
// ReSharper disable once MemberCanBePrivate.Global
+ ///
public WhatsAppConnect(string server, string instance, string token) =>
(Server, Instance, Token) = (server, instance, token);
+ ///
public WhatsAppConnect(string server, int instance, string token) :
this(server, instance.ToString(), token) { }
#region Equatable
+ ///
public bool Equals(IWhatsAppConnect? other) => other is not null &&
- string.Equals(Token, other.Token, StringComparison.Ordinal) &&
- string.Equals(Server, other.Server, StringComparison.Ordinal) &&
- string.Equals(Instance, other.Instance, StringComparison.Ordinal);
+ string.Equals(Token, other.Token, StringComparison.Ordinal) &&
+ string.Equals(Server, other.Server, StringComparison.Ordinal) &&
+ string.Equals(Instance, other.Instance, StringComparison.Ordinal);
+ ///
public override bool Equals(object? obj) => ReferenceEquals(this, obj) ||
- obj is IWhatsAppConnect other && Equals(other);
+ obj is IWhatsAppConnect other && Equals(other);
+ ///
public override int GetHashCode()
{
unchecked
@@ -37,7 +46,9 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (WhatsAppConnect? left, WhatsAppConnect? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (WhatsAppConnect? left, WhatsAppConnect? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
diff --git a/Src/ChatApi.Core/Converters/InterfaceCollectionConverter.cs b/Src/ChatApi.Core/Converters/InterfaceCollectionConverter.cs
index 4a904c9..e83dc6d 100644
--- a/Src/ChatApi.Core/Converters/InterfaceCollectionConverter.cs
+++ b/Src/ChatApi.Core/Converters/InterfaceCollectionConverter.cs
@@ -5,17 +5,20 @@
namespace ChatApi.Core.Converters
{
+ ///
public class InterfaceCollectionConverter : JsonConverter
where TClass : class, TInterface
where TInterface : IEquatable
where TCollection : Collection, new()
{
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void WriteJson(JsonWriter writer, TCollection? value, JsonSerializer serializer)
{
writer.WriteRawValue(JsonConvert.SerializeObject(value));
}
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override TCollection? ReadJson(JsonReader reader, Type objectType, TCollection? existingValue, bool hasExistingValue, JsonSerializer serializer)
{
@@ -25,6 +28,7 @@ public override void WriteJson(JsonWriter writer, TCollection? value, JsonSerial
serializer.Populate(reader, value);
TCollection interfaces = new();
+ // ReSharper disable once ForCanBeConvertedToForeach
for (int i = 0; i < value.Count; i++) interfaces.Add(value[i]);
return interfaces;
diff --git a/Src/ChatApi.Core/Converters/InterfacesConverter.cs b/Src/ChatApi.Core/Converters/InterfacesConverter.cs
index 6935c93..e59fa95 100644
--- a/Src/ChatApi.Core/Converters/InterfacesConverter.cs
+++ b/Src/ChatApi.Core/Converters/InterfacesConverter.cs
@@ -4,14 +4,17 @@
namespace ChatApi.Core.Converters
{
+ ///
public class InterfacesConverter : JsonConverter where T: class
{
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void WriteJson(JsonWriter writer, T? value, JsonSerializer serializer)
{
if (value != null) serializer.Serialize(writer, value);
}
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override T? ReadJson(JsonReader reader, Type objectType, T? existingValue, bool hasExistingValue, JsonSerializer serializer)
{
diff --git a/Src/ChatApi.Core/Converters/NegativeBoolConverter.cs b/Src/ChatApi.Core/Converters/NegativeBoolConverter.cs
index b2ddf89..820ee06 100644
--- a/Src/ChatApi.Core/Converters/NegativeBoolConverter.cs
+++ b/Src/ChatApi.Core/Converters/NegativeBoolConverter.cs
@@ -3,14 +3,17 @@
namespace ChatApi.Core.Converters
{
+ ///
public class NegativeBoolConverter : JsonConverter
{
+ ///
public override void WriteJson(JsonWriter writer, bool? value, JsonSerializer serializer)
{
if (value is not null)
writer.WriteRawValue((!value).ToString());
}
+ ///
public override bool? ReadJson(JsonReader reader, Type objectType, bool? existingValue, bool hasExistingValue, JsonSerializer serializer)
{
if (reader.TokenType != JsonToken.Boolean || (bool?)reader.Value is null ) return null;
diff --git a/Src/ChatApi.Core/Converters/PhoneCollectionConverter.cs b/Src/ChatApi.Core/Converters/PhoneCollectionConverter.cs
index 80e0ccb..534e936 100644
--- a/Src/ChatApi.Core/Converters/PhoneCollectionConverter.cs
+++ b/Src/ChatApi.Core/Converters/PhoneCollectionConverter.cs
@@ -6,8 +6,10 @@
namespace ChatApi.Core.Converters
{
+ ///
public class PhoneCollectionConverter : JsonConverter?>
{
+ ///
public override void WriteJson(JsonWriter writer, WhatsAppApiCollection? value, JsonSerializer serializer)
{
if (value is null || !value.Any()) return;
@@ -24,6 +26,7 @@ public override void WriteJson(JsonWriter writer, WhatsAppApiCollection?
writer.WriteRawValue(JsonConvert.SerializeObject(value));
}
+ ///
public override WhatsAppApiCollection? ReadJson(JsonReader reader, Type objectType, WhatsAppApiCollection? existingValue,
bool hasExistingValue, JsonSerializer serializer)
{
diff --git a/Src/ChatApi.Core/Converters/PhoneConverter.cs b/Src/ChatApi.Core/Converters/PhoneConverter.cs
index 477461b..d192ec7 100644
--- a/Src/ChatApi.Core/Converters/PhoneConverter.cs
+++ b/Src/ChatApi.Core/Converters/PhoneConverter.cs
@@ -1,14 +1,16 @@
using System;
using System.Linq;
-using Newtonsoft.Json;
-using System.Text.RegularExpressions;
using System.Runtime.CompilerServices;
+using System.Text.RegularExpressions;
+using Newtonsoft.Json;
namespace ChatApi.Core.Converters
{
+ ///
public class PhoneConverter : JsonConverter
{
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void WriteJson(JsonWriter writer, string? value, JsonSerializer serializer)
{
@@ -22,6 +24,7 @@ public override void WriteJson(JsonWriter writer, string? value, JsonSerializer
.Aggregate(string.Concat)));
}
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override string? ReadJson(JsonReader reader, Type objectType, string? existingValue,
bool hasExistingValue, JsonSerializer serializer)
diff --git a/Src/ChatApi.Core/Converters/UnixDateTimeConverter.cs b/Src/ChatApi.Core/Converters/UnixDateTimeConverter.cs
index ede2c8e..7b1e0c0 100644
--- a/Src/ChatApi.Core/Converters/UnixDateTimeConverter.cs
+++ b/Src/ChatApi.Core/Converters/UnixDateTimeConverter.cs
@@ -1,19 +1,27 @@
using System;
using System.Linq;
using System.Runtime.CompilerServices;
-
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace ChatApi.Core.Converters
{
+ ///
public class UnixDateTimeConverter : DateTimeConverterBase
{
+ ///
+ /// Time-zone offset.
Default: current time zone offset
+ ///
public TimeSpan? Offset { get; set; }
private static readonly DateTime Epoch = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+ ///
+ /// Convert a date to UTC format
+ ///
+ /// date
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static string? ConvertWrite(DateTime? value)
+ public static string? Convert(DateTime? value)
{
if (value is null) return null;
@@ -26,8 +34,13 @@ public class UnixDateTimeConverter : DateTimeConverterBase
return seconds.ToString();
}
+ ///
+ /// Convert a UTC format value to date
+ ///
+ /// UTC format value
+ /// Time-zone offset. Default: current time zone offset
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static DateTime ConvertRead(long value, TimeSpan? offset = null)
+ public static DateTime Convert(long value, TimeSpan? offset = null)
{
DateTime dateTime;
try
@@ -43,20 +56,22 @@ public static DateTime ConvertRead(long value, TimeSpan? offset = null)
.DateTime;
}
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
{
if (value is not DateTime dateTime) return;
- writer.WriteRawValue(ConvertWrite(dateTime));
+ writer.WriteRawValue(Convert(dateTime));
}
+ ///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
{
if (reader.Value is null) return null;
var firstOrDefault = serializer.Converters
.FirstOrDefault(x => x is UnixDateTimeConverter) as UnixDateTimeConverter;
- return ConvertRead((long) reader.Value, firstOrDefault?.Offset);
+ return Convert((long) reader.Value, firstOrDefault?.Offset);
}
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Helpers/ConversionHelper.cs b/Src/ChatApi.Core/Helpers/ConversionHelper.cs
index 160f562..33a6a71 100644
--- a/Src/ChatApi.Core/Helpers/ConversionHelper.cs
+++ b/Src/ChatApi.Core/Helpers/ConversionHelper.cs
@@ -1,16 +1,17 @@
using System;
using System.Text;
-
-using Newtonsoft.Json;
using ChatApi.Core.Response.Interfaces;
+using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using UnixDateTimeConverter = ChatApi.Core.Converters.UnixDateTimeConverter;
namespace ChatApi.Core.Helpers
{
+ ///
public static class ConversionHelper
{
+ ///
public static string Serialize(this T self, IResponseSettings? responseSettings = null) where T : class
{
if (self is null) throw new JsonSerializationException();
@@ -30,6 +31,7 @@ public static string Serialize(this T self, IResponseSettings? responseSettin
return serialize;
}
+ ///
public static T Deserialize(this string json, IResponseSettings? responseSettings = null) where T : class
{
if (string.IsNullOrEmpty(json)) throw new JsonReaderException();
diff --git a/Src/ChatApi.Core/Helpers/EquatableHelper.cs b/Src/ChatApi.Core/Helpers/EquatableHelper.cs
index d54d508..7220033 100644
--- a/Src/ChatApi.Core/Helpers/EquatableHelper.cs
+++ b/Src/ChatApi.Core/Helpers/EquatableHelper.cs
@@ -1,7 +1,9 @@
namespace ChatApi.Core.Helpers
{
+ ///
public static class EquatableHelper
{
+ ///
public static bool IsEquatable(T? left, T? right) where T : class =>
right?.Equals(left) ?? left is null;
}
diff --git a/Src/ChatApi.Core/Helpers/HttpRequests.cs b/Src/ChatApi.Core/Helpers/HttpRequests.cs
index e4cbc65..5284d64 100644
--- a/Src/ChatApi.Core/Helpers/HttpRequests.cs
+++ b/Src/ChatApi.Core/Helpers/HttpRequests.cs
@@ -10,12 +10,14 @@
namespace ChatApi.Core.Helpers
{
+ ///
public static class HttpRequests
{
#region Get
#region Synchronous get
+ ///
public static IChatApiResponse Get(this IConnect connect, string operationName,
IResponseSettings? responseSettings = null, string? parameters = null)
where TClass : class, IErrorResponse, new()
@@ -24,6 +26,7 @@ public static class HttpRequests
x => x.Deserialize(responseSettings), responseSettings, parameters);
}
+ ///
public static IChatApiResponse Get(this IConnect connect, string operationName,
Func deserialization,
IResponseSettings? responseSettings = null, string? parameters = null)
@@ -45,6 +48,7 @@ public static class HttpRequests
#region Asynchronous get
+ ///
public static Task> GetAsync(this IConnect connect,
string operationName, IResponseSettings? responseSettings = null, string? parameters = null)
where TClass : class, TInterface, IErrorResponse, new()
@@ -55,6 +59,7 @@ public static class HttpRequests
responseSettings, parameters);
}
+ ///
public static Task> GetAsync(this IConnect connect,
string operationName, Func deserialization,
IResponseSettings? responseSettings = null, string? parameters = null)
@@ -80,12 +85,14 @@ public static class HttpRequests
#region Synchronous post
+ ///
public static IChatApiResponse Post(this IConnect connect, string operationName, string? json = null,
IResponseSettings? responseSettings = null) where T : class, IErrorResponse, new()
{
return Post(connect, operationName, x => x.Deserialize(responseSettings), json, responseSettings);
}
+ ///
public static IChatApiResponse Post(this IConnect connect, string operationName, Func deserialization, string? json = null,
IResponseSettings? responseSettings = null) where TClass : class, IErrorResponse, new()
{
@@ -107,6 +114,7 @@ public static class HttpRequests
#region Asynchronous post
+ ///
public static Task> PostAsync(this IConnect connect,
string operationName, string? json = null, IResponseSettings? responseSettings = null)
where TClass : class, TInterface, IErrorResponse, new()
@@ -117,6 +125,7 @@ public static class HttpRequests
json, responseSettings);
}
+ ///
public static Task> PostAsync(this IConnect connect,
string operationName, Func deserialization, string? json = null,
IResponseSettings? responseSettings = null)
diff --git a/Src/ChatApi.Core/Models/ActionType.cs b/Src/ChatApi.Core/Models/ActionType.cs
index 5c68f2a..d0eff25 100644
--- a/Src/ChatApi.Core/Models/ActionType.cs
+++ b/Src/ChatApi.Core/Models/ActionType.cs
@@ -2,18 +2,30 @@
namespace ChatApi.Core.Models
{
+ ///
public enum ActionType : byte
{
+ ///
[EnumMember(Value = "create group")]
CreateGroup = 1,
+
+ ///
[EnumMember(Value = "read chat")]
ReadDialog = 2,
+
+ ///
[EnumMember(Value = "add group participant")]
AddParticipant = 3,
+
+ ///
[EnumMember(Value = "remove group participant")]
RemoveParticipant = 4,
+
+ ///
[EnumMember(Value = "promote group participant")]
PromoteParticipant = 5,
+
+ ///
[EnumMember(Value = "demote group participant")]
DemoteParticipant = 6
}
diff --git a/Src/ChatApi.Core/Models/ChatApiStatusOperation.cs b/Src/ChatApi.Core/Models/ChatApiStatusOperation.cs
index 8da4860..15d58e5 100644
--- a/Src/ChatApi.Core/Models/ChatApiStatusOperation.cs
+++ b/Src/ChatApi.Core/Models/ChatApiStatusOperation.cs
@@ -2,16 +2,26 @@
namespace ChatApi.Core.Models
{
+ ///
public enum ChatApiStatusOperation : byte
{
+ ///
[EnumMember(Value = "error")]
Error = 0,
+
+ ///
[EnumMember(Value = "success")]
Success = 1,
+
+ ///
[EnumMember(Value = "created")]
Created = 2,
+
+ ///
[EnumMember(Value = "deleted")]
Deleted = 3,
+
+ ///
[EnumMember(Value = "exists")]
Exists = 4,
diff --git a/Src/ChatApi.Core/Models/Interfaces/IChatApiKey.cs b/Src/ChatApi.Core/Models/Interfaces/IChatApiKey.cs
index d25566e..25a7e54 100644
--- a/Src/ChatApi.Core/Models/Interfaces/IChatApiKey.cs
+++ b/Src/ChatApi.Core/Models/Interfaces/IChatApiKey.cs
@@ -2,8 +2,12 @@
namespace ChatApi.Core.Models.Interfaces
{
+ ///
public interface IChatApiKey
{
+ ///
+ /// Chat-Api Account Key
+ ///
[JsonProperty("uid")]
string? ApiKey { get; }
}
diff --git a/Src/ChatApi.Core/Models/Interfaces/IChatId.cs b/Src/ChatApi.Core/Models/Interfaces/IChatId.cs
index 893c078..301d709 100644
--- a/Src/ChatApi.Core/Models/Interfaces/IChatId.cs
+++ b/Src/ChatApi.Core/Models/Interfaces/IChatId.cs
@@ -2,6 +2,7 @@
namespace ChatApi.Core.Models.Interfaces
{
+ ///
public interface IChatId
{
///
diff --git a/Src/ChatApi.Core/Models/Interfaces/IErrorResponse.cs b/Src/ChatApi.Core/Models/Interfaces/IErrorResponse.cs
index 67532cb..6ef0375 100644
--- a/Src/ChatApi.Core/Models/Interfaces/IErrorResponse.cs
+++ b/Src/ChatApi.Core/Models/Interfaces/IErrorResponse.cs
@@ -2,8 +2,10 @@
namespace ChatApi.Core.Models.Interfaces
{
+ ///
public interface IErrorResponse
{
+ ///
[JsonProperty("error", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
string? ErrorMessage { get; set; }
}
diff --git a/Src/ChatApi.Core/Models/Interfaces/IMessageRequest.cs b/Src/ChatApi.Core/Models/Interfaces/IMessageRequest.cs
index 8dd5fa1..cfbfc77 100644
--- a/Src/ChatApi.Core/Models/Interfaces/IMessageRequest.cs
+++ b/Src/ChatApi.Core/Models/Interfaces/IMessageRequest.cs
@@ -1,4 +1,5 @@
namespace ChatApi.Core.Models.Interfaces
{
+ ///
public interface IMessageRequest : IChatId, IPhone { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Models/Interfaces/IOperationResponse.cs b/Src/ChatApi.Core/Models/Interfaces/IOperationResponse.cs
index f3a9a46..6427fa2 100644
--- a/Src/ChatApi.Core/Models/Interfaces/IOperationResponse.cs
+++ b/Src/ChatApi.Core/Models/Interfaces/IOperationResponse.cs
@@ -1,19 +1,5 @@
-using Newtonsoft.Json;
-
-namespace ChatApi.Core.Models.Interfaces
+namespace ChatApi.Core.Models.Interfaces
{
- public interface IOperationResponse : IErrorResponse
- {
- ///
- ///
- ///
- [JsonProperty("result", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
- string? Result { get; set; }
-
- ///
- ///
- ///
- [JsonProperty("success", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
- bool? Success { get; set; }
- }
+ ///
+ public interface IOperationResponse : IOperationSuccess, IOperationResult, IErrorResponse { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Models/Interfaces/IOperationResult.cs b/Src/ChatApi.Core/Models/Interfaces/IOperationResult.cs
new file mode 100644
index 0000000..2adb2b5
--- /dev/null
+++ b/Src/ChatApi.Core/Models/Interfaces/IOperationResult.cs
@@ -0,0 +1,14 @@
+using Newtonsoft.Json;
+
+namespace ChatApi.Core.Models.Interfaces
+{
+ ///
+ public interface IOperationResult
+ {
+ ///
+ /// The status of the request.
+ ///
+ [JsonProperty("result", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
+ string? Result { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Models/Interfaces/IOperationSuccess.cs b/Src/ChatApi.Core/Models/Interfaces/IOperationSuccess.cs
new file mode 100644
index 0000000..576daa5
--- /dev/null
+++ b/Src/ChatApi.Core/Models/Interfaces/IOperationSuccess.cs
@@ -0,0 +1,14 @@
+using Newtonsoft.Json;
+
+namespace ChatApi.Core.Models.Interfaces
+{
+ ///
+ public interface IOperationSuccess
+ {
+ ///
+ /// Flag of the success of the request
+ ///
+ [JsonProperty("success", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
+ bool? Success { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Models/Interfaces/IParameters.cs b/Src/ChatApi.Core/Models/Interfaces/IParameters.cs
index ac68431..884471f 100644
--- a/Src/ChatApi.Core/Models/Interfaces/IParameters.cs
+++ b/Src/ChatApi.Core/Models/Interfaces/IParameters.cs
@@ -2,8 +2,12 @@
namespace ChatApi.Core.Models.Interfaces
{
+ ///
public interface IParameters
{
+ ///
+ /// Get Request Parameter Generator
+ ///
[JsonIgnore]
string Parameters { get; }
}
diff --git a/Src/ChatApi.Core/Models/Interfaces/IPhone.cs b/Src/ChatApi.Core/Models/Interfaces/IPhone.cs
index 07b3411..a18a7c3 100644
--- a/Src/ChatApi.Core/Models/Interfaces/IPhone.cs
+++ b/Src/ChatApi.Core/Models/Interfaces/IPhone.cs
@@ -3,6 +3,7 @@
namespace ChatApi.Core.Models.Interfaces
{
+ ///
public interface IPhone
{
///
diff --git a/Src/ChatApi.Core/Models/Interfaces/IPrintable.cs b/Src/ChatApi.Core/Models/Interfaces/IPrintable.cs
index f30d1d2..1b1f7b2 100644
--- a/Src/ChatApi.Core/Models/Interfaces/IPrintable.cs
+++ b/Src/ChatApi.Core/Models/Interfaces/IPrintable.cs
@@ -1,8 +1,85 @@
namespace ChatApi.Core.Models.Interfaces
{
+ ///
+ /// Output of class data
+ ///
public interface IPrintable
{
+ ///
+ /// Output of all of the class data
+ ///
+ ///
+ /// {
+ /// LastMessageNumber: 10587,
+ /// Messages: [
+ /// {
+ /// Id: true_17472822486@c.us_DF38E6A25B42CC8CCE57EC40F,
+ /// ChatId: 17633123456@c.us,
+ /// ChatName: +1 763 312-34-56,
+ /// Time: 23.02.2021 11:57:23,
+ /// Type: Contacts,
+ /// Body: BEGIN:VCARD|VERSION:3.0...,
+ /// Self: 0,
+ /// FromMe: True,
+ /// Author: 17633123456@c.us,
+ /// IsForwarded: 1,
+ /// MessageNumber: 10489
+ /// },
+ /// {
+ /// Id: true_17472822486@c.us_DF38E57EC40FE6AE57EC40F2,
+ /// ChatId: 17633123456@c.us,
+ /// ChatName: +1 763 312-34-56,
+ /// Time: 23.02.2021 12:02:28,
+ /// Type: TextMessage,
+ /// Body: That message was sended from `ChatApi.WA.Messages`,
+ /// Self: 0,
+ /// FromMe: True,
+ /// Author: 17633123456@c.us,
+ /// QuotedMessageId: true_17633123456@c.us_3A00F2C036324861D1AF_out,
+ /// QuotedMessageType: Contacts,
+ /// MessageNumber: 10503
+ /// }, ... ]
+ ///}
+ ///
string PrintMembers();
+
+ ///
+ /// Output of all of the class data with shift
+ ///
+ /// The measure of displacement of the carriage on the level of nesting
+ ///
+ /// {
+ /// LastMessageNumber: 10587,
+ /// Messages: [
+ /// {
+ /// Id: true_17472822486@c.us_DF38E6A25B42CC8CCE57EC40F,
+ /// ChatId: 17633123456@c.us,
+ /// ChatName: +1 763 312-34-56,
+ /// Time: 23.02.2021 11:57:23,
+ /// Type: Contacts,
+ /// Body: BEGIN:VCARD|VERSION:3.0...,
+ /// Self: 0,
+ /// FromMe: True,
+ /// Author: 17633123456@c.us,
+ /// IsForwarded: 1,
+ /// MessageNumber: 10489
+ /// },
+ /// {
+ /// Id: true_17472822486@c.us_DF38E57EC40FE6AE57EC40F2,
+ /// ChatId: 17633123456@c.us,
+ /// ChatName: +1 763 312-34-56,
+ /// Time: 23.02.2021 12:02:28,
+ /// Type: TextMessage,
+ /// Body: That message was sended from `ChatApi.WA.Messages`,
+ /// Self: 0,
+ /// FromMe: True,
+ /// Author: 17633123456@c.us,
+ /// QuotedMessageId: true_17633123456@c.us_3A00F2C036324861D1AF_out,
+ /// QuotedMessageType: Contacts,
+ /// MessageNumber: 10503
+ /// }, ... ]
+ ///}
+ ///
string PrintMembers(int shift);
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Models/MessageType.cs b/Src/ChatApi.Core/Models/MessageType.cs
index 86edfb1..1d6944b 100644
--- a/Src/ChatApi.Core/Models/MessageType.cs
+++ b/Src/ChatApi.Core/Models/MessageType.cs
@@ -2,27 +2,51 @@
namespace ChatApi.Core.Models
{
+ ///
+ /// Type of the message
+ ///
public enum MessageType : byte
{
+ ///
NotFoundType,
+
+ ///
[EnumMember(Value = "chat")]
- Chat = 1,
+ TextMessage = 1,
+
+ ///
[EnumMember(Value = "image")]
Image = 2,
+
+ ///
[EnumMember(Value = "ptt")]
Voice = 3,
+
+ ///
[EnumMember(Value = "document")]
Document = 4,
+
+ ///
[EnumMember(Value = "audio")]
Audio = 5,
+
+ ///
[EnumMember(Value = "video")]
Video = 6,
+
+ ///
[EnumMember(Value = "location")]
Location = 7,
+
+ ///
[EnumMember(Value = "vcard")]
Contact = 8,
+
+ ///
[EnumMember(Value = "multi_vcard")]
Contacts = 9,
+
+ ///
[EnumMember(Value = "call_log")]
CallLog = 10
}
diff --git a/Src/ChatApi.Core/Models/Printable.cs b/Src/ChatApi.Core/Models/Printable.cs
index cf80e13..ead923b 100644
--- a/Src/ChatApi.Core/Models/Printable.cs
+++ b/Src/ChatApi.Core/Models/Printable.cs
@@ -1,23 +1,38 @@
-using System.Text;
-using System.Runtime.CompilerServices;
+using System.Runtime.CompilerServices;
+using System.Text;
using ChatApi.Core.Models.Interfaces;
namespace ChatApi.Core.Models
{
+ // Rewrite in the future
+ ///
public abstract class Printable : IPrintable
{
private const string Shift = " ";
private readonly StringBuilder _stringBuilder = new ();
+ ///
+ /// Description of the properties contained by the class
+ ///
+ ///
+ /// To describe the properties contained in the class, use the
+ ///
+ /// The measure of displacement of the carriage on the level of nesting
protected abstract void PrintContent(int shift);
private void AddMember(string memberName, string? value, int shift)
{
- if (!string.IsNullOrWhiteSpace(value))
- _stringBuilder.AppendLine(string.Concat(GetShift(shift), memberName, ": ", value));
+ if (string.IsNullOrWhiteSpace(value)) return;
+ _stringBuilder.AppendLine(string.Concat(GetShift(shift), memberName, ": ", value, ","));
}
/*ReSharper disable once HeapView.PossibleBoxingAllocation*/
+ ///
+ /// Writing data of the property for the template
+ ///
+ /// Name of property
+ /// Value of property
+ /// The measure of displacement of the carriage on the level of nesting
protected void AddMember(string memberName, T value, int shift) { switch (value)
{
case string stringValue: AddMember(memberName, stringValue, shift); return;
@@ -40,6 +55,7 @@ private static string GetShift(int? shiftValue)
return shift;
}
+ ///
public string PrintMembers()
{
int shift = default;
@@ -49,11 +65,12 @@ public string PrintMembers()
return _stringBuilder.ToString();
}
+ ///
public string PrintMembers(int shift)
{
- _stringBuilder.AppendLine("{");
+ _stringBuilder.AppendLine(GetShift(shift-1) + "{");
PrintContent(++shift);
- _stringBuilder.Append(string.Concat(GetShift(--shift), "}"));
+ _stringBuilder.Append(string.Concat(GetShift(--shift-1), "}"));
return _stringBuilder.ToString();
}
}
diff --git a/Src/ChatApi.Core/Models/Protocol.cs b/Src/ChatApi.Core/Models/Protocol.cs
index ae1e127..339f3ae 100644
--- a/Src/ChatApi.Core/Models/Protocol.cs
+++ b/Src/ChatApi.Core/Models/Protocol.cs
@@ -1,8 +1,11 @@
namespace ChatApi.Core.Models
{
+ ///
public enum Protocol : byte
{
+ ///
Http = 0,
+ ///
Https = 1
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Response/ChatApiResponse.cs b/Src/ChatApi.Core/Response/ChatApiResponse.cs
index b48c302..c3c7767 100644
--- a/Src/ChatApi.Core/Response/ChatApiResponse.cs
+++ b/Src/ChatApi.Core/Response/ChatApiResponse.cs
@@ -6,17 +6,25 @@
namespace ChatApi.Core.Response
{
+ ///
public readonly struct ChatApiResponse : IChatApiResponse
{
private readonly T? _value;
+ ///
public bool IsSuccess => true;
+ ///
public Exception? Exception => null;
private ChatApiResponse(T? value) => _value = value;
+ ///
public T? GetResult() => _value;
+ ///
+ /// The creation of a intermediary
+ ///
+ /// Client operation
public static IChatApiResponse CreateInstance(Func resultFunc)
{
T? value;
@@ -29,16 +37,21 @@ namespace ChatApi.Core.Response
{
for (int index = 0; index < e.InnerExceptions.Count; index++)
if (e.InnerExceptions[index] is WebException webException)
- return new WhatsAppBadResponse(webException);
- return new WhatsAppResultError(e);
+ return new ChatApiBadResponse(webException);
+ return new ChatApiResultError(e);
}
- catch (WebException e) { return new WhatsAppBadResponse(e); }
- catch (Exception e) { return new WhatsAppResultError(e); }
+ catch (WebException e) { return new ChatApiBadResponse(e); }
+ catch (Exception e) { return new ChatApiResultError(e); }
ChatApiResponse chatApiResponse = new(value);
return chatApiResponse;
}
+ ///
+ /// The creation of a intermediary
+ ///
+ /// Client operation
+ /// Continuation of the client's operation
public static Task> CreateInstanceAsync(
Func> responseFuncAsync,
Func continuation)
@@ -57,8 +70,8 @@ namespace ChatApi.Core.Response
return task;
}
- catch (WebException e) { task = new Task>(() => new WhatsAppBadResponse(e)); }
- catch (Exception e) { task = new Task>(() => new WhatsAppResultError(e)); }
+ catch (WebException e) { task = new Task>(() => new ChatApiBadResponse(e)); }
+ catch (Exception e) { task = new Task>(() => new ChatApiResultError(e)); }
return task;
}
diff --git a/Src/ChatApi.Core/Response/Errors/ActionError.cs b/Src/ChatApi.Core/Response/Errors/ActionError.cs
index c5a03c9..2809b72 100644
--- a/Src/ChatApi.Core/Response/Errors/ActionError.cs
+++ b/Src/ChatApi.Core/Response/Errors/ActionError.cs
@@ -3,13 +3,17 @@
namespace ChatApi.Core.Response.Errors
{
+ ///
public abstract class ActionError : IChatApiResponse
{
+ ///
public bool IsSuccess => false;
+ ///
public Exception? Exception { get; }
private protected ActionError(Exception? exception) => Exception = exception;
+ ///
public T? GetResult() => default;
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Response/Errors/ChatApiBadResponse.cs b/Src/ChatApi.Core/Response/Errors/ChatApiBadResponse.cs
new file mode 100644
index 0000000..7f945a7
--- /dev/null
+++ b/Src/ChatApi.Core/Response/Errors/ChatApiBadResponse.cs
@@ -0,0 +1,7 @@
+using System;
+
+namespace ChatApi.Core.Response.Errors
+{
+ ///
+ public class ChatApiBadResponse : ActionError { internal ChatApiBadResponse(Exception? exception) : base(exception) { } }
+}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Response/Errors/ChatApiResultError.cs b/Src/ChatApi.Core/Response/Errors/ChatApiResultError.cs
new file mode 100644
index 0000000..4b2e189
--- /dev/null
+++ b/Src/ChatApi.Core/Response/Errors/ChatApiResultError.cs
@@ -0,0 +1,7 @@
+using System;
+
+namespace ChatApi.Core.Response.Errors
+{
+ ///
+ public class ChatApiResultError : ActionError { internal ChatApiResultError(Exception? exception) : base(exception) { } }
+}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Response/Errors/WhatsAppBadResponse.cs b/Src/ChatApi.Core/Response/Errors/WhatsAppBadResponse.cs
deleted file mode 100644
index be79a4f..0000000
--- a/Src/ChatApi.Core/Response/Errors/WhatsAppBadResponse.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-using System;
-
-namespace ChatApi.Core.Response.Errors
-{
- public class WhatsAppBadResponse : ActionError { internal WhatsAppBadResponse(Exception? exception) : base(exception) { } }
-}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Response/Errors/WhatsAppResultError.cs b/Src/ChatApi.Core/Response/Errors/WhatsAppResultError.cs
deleted file mode 100644
index 8e6322b..0000000
--- a/Src/ChatApi.Core/Response/Errors/WhatsAppResultError.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-using System;
-
-namespace ChatApi.Core.Response.Errors
-{
- public class WhatsAppResultError : ActionError { internal WhatsAppResultError(Exception? exception) : base(exception) { } }
-}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Response/Interfaces/IChatApiResponse.cs b/Src/ChatApi.Core/Response/Interfaces/IChatApiResponse.cs
index 528ac84..f0d6aca 100644
--- a/Src/ChatApi.Core/Response/Interfaces/IChatApiResponse.cs
+++ b/Src/ChatApi.Core/Response/Interfaces/IChatApiResponse.cs
@@ -2,11 +2,26 @@
namespace ChatApi.Core.Response.Interfaces
{
+ ///
+ /// Intermediary between the client and the service.
+ /// Checks and catches errors.
+ ///
+ /// Operation response
public interface IChatApiResponse
{
+ ///
+ /// Success rate of the operation completion
+ ///
bool IsSuccess { get; }
+
+ ///
+ /// Error about receiving a response from the service.
+ ///
Exception? Exception { get; }
+ ///
+ /// Getting the query result
+ ///
T? GetResult();
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Core/Response/Interfaces/IResponseSettings.cs b/Src/ChatApi.Core/Response/Interfaces/IResponseSettings.cs
index 7eb02c7..d3e3efe 100644
--- a/Src/ChatApi.Core/Response/Interfaces/IResponseSettings.cs
+++ b/Src/ChatApi.Core/Response/Interfaces/IResponseSettings.cs
@@ -4,6 +4,7 @@
namespace ChatApi.Core.Response.Interfaces
{
+ ///
public interface IResponseSettings
{
///
diff --git a/Src/ChatApi.Core/Response/WhatsAppResponseSettings.cs b/Src/ChatApi.Core/Response/WhatsAppResponseSettings.cs
index 46d2652..b3c9063 100644
--- a/Src/ChatApi.Core/Response/WhatsAppResponseSettings.cs
+++ b/Src/ChatApi.Core/Response/WhatsAppResponseSettings.cs
@@ -10,12 +10,17 @@ namespace ChatApi.Core.Response
///
public sealed class WhatsAppResponseSettings : IResponseSettings
{
+ ///
public bool IsNewSchema { get; set; }
+ ///
public Encoding Encoding { get; set; }
+ ///
public Protocol TypeProtocol { get; set; }
+ ///
public TimeSpan TimeZoneOffset { get; set; }
// ReSharper disable once MemberCanBePrivate.Global
+ ///
public WhatsAppResponseSettings()
{
IsNewSchema = true;
@@ -24,6 +29,7 @@ public WhatsAppResponseSettings()
TimeZoneOffset = new DateTimeOffset(DateTime.Now).Offset;
}
+ ///
public static readonly WhatsAppResponseSettings Default;
static WhatsAppResponseSettings() => Default = new WhatsAppResponseSettings
{
diff --git a/Src/ChatApi.Instances/ChatApi.Instances.csproj b/Src/ChatApi.Instances/ChatApi.Instances.csproj
index 2b6b2b6..7fa212f 100644
--- a/Src/ChatApi.Instances/ChatApi.Instances.csproj
+++ b/Src/ChatApi.Instances/ChatApi.Instances.csproj
@@ -1,45 +1,71 @@
- netstandard2.0
- default
+
+
enable
+ 9
+ netstandard2.0
+
+
+ true
+ true
+ bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
+
+
ChatApi.Instances
Roman Vorontsov
- ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
-
-
- https://github.com/Zodt/ChatApi
- GitHub
- ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp
- false
-
- true
- ChatApi.png
en
+ ChatApi.png
+ 1.0.1-alpha
+ ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp
+
+ ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
+
+
+ 1. Refactoring code
+ 2. Add xml doc
+
+
+
MIT
+ false
+
+
+ GitHub
+ https://github.com/Zodt/ChatApi
+
-
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
+
+
-
-
-
+
+
+ True
+ True
+ Resources.resx
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
-
-
- True
-
-
+
+
+ True
+
+
+
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/ChatApiInstanceOperations.cs b/Src/ChatApi.Instances/ChatApiInstanceOperations.cs
index cae9d6d..c66db86 100644
--- a/Src/ChatApi.Instances/ChatApiInstanceOperations.cs
+++ b/Src/ChatApi.Instances/ChatApiInstanceOperations.cs
@@ -1,9 +1,7 @@
using System.Threading.Tasks;
-
-using ChatApi.Core.Helpers;
using ChatApi.Core.Connect.Interfaces;
+using ChatApi.Core.Helpers;
using ChatApi.Core.Response.Interfaces;
-
using ChatApi.Instances.Properties;
using ChatApi.Instances.Requests.Interfaces;
using ChatApi.Instances.Responses;
@@ -11,20 +9,24 @@
namespace ChatApi.Instances
{
+ ///
public class ChatApiInstanceOperations : IChatApiInstanceOperations
{
private readonly IChatApiInstanceConnect _connect;
+ ///
public ChatApiInstanceOperations(IChatApiInstanceConnect connect) => _connect = connect;
#region ChatApi instance API
#region Get ChatApi instances
+ ///
public IChatApiResponse GetChatApiInstances(IResponseSettings? responseSettings = null) =>
_connect.Get(
Resources.GetChatApiInstances, responseSettings, string.Concat("?uid=", _connect.ApiKey));
+ ///
public Task> GetChatApiInstancesAsync(IResponseSettings? responseSettings = null) =>
_connect.GetAsync(
Resources.GetChatApiInstances, responseSettings, string.Concat("?uid=", _connect.ApiKey));
@@ -33,6 +35,7 @@ public class ChatApiInstanceOperations : IChatApiInstanceOperations
#region Create ChatApi instance
+ ///
public IChatApiResponse CreateChatApiInstance(IChatApiCreateInstanceRequest request, IResponseSettings? responseSettings = null)
{
request.ApiKey ??= _connect.ApiKey;
@@ -40,6 +43,7 @@ public class ChatApiInstanceOperations : IChatApiInstanceOperations
Resources.CreateChatApiInstance, request.Serialize(), responseSettings);
}
+ ///
public Task> CreateChatApiInstanceAsync(IChatApiCreateInstanceRequest request, IResponseSettings? responseSettings = null)
{
request.ApiKey ??= _connect.ApiKey;
@@ -51,6 +55,7 @@ public class ChatApiInstanceOperations : IChatApiInstanceOperations
#region Remove ChatApi instance
+ ///
public IChatApiResponse RemoveChatApiInstance(IChatApiRemoveInstanceRequest request, IResponseSettings? responseSettings = null)
{
request.ApiKey ??= _connect.ApiKey;
@@ -58,6 +63,7 @@ public class ChatApiInstanceOperations : IChatApiInstanceOperations
Resources.DeleteChatApiInstance, request.Serialize(), responseSettings);
}
+ ///
public Task> RemoveChatApiInstanceAsync(IChatApiRemoveInstanceRequest request, IResponseSettings? responseSettings = null)
{
request.ApiKey ??= _connect.ApiKey;
diff --git a/Src/ChatApi.Instances/Collections/ChatApiInstanceCollection.cs b/Src/ChatApi.Instances/Collections/ChatApiInstanceCollection.cs
index ae7865d..4ec9020 100644
--- a/Src/ChatApi.Instances/Collections/ChatApiInstanceCollection.cs
+++ b/Src/ChatApi.Instances/Collections/ChatApiInstanceCollection.cs
@@ -3,5 +3,6 @@
namespace ChatApi.Instances.Collections
{
+ ///
public sealed class ChatApiInstanceCollection : WhatsAppApiCollection { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Connect/ChatApiInstanceConnect.cs b/Src/ChatApi.Instances/Connect/ChatApiInstanceConnect.cs
index b74acf6..0ecf598 100644
--- a/Src/ChatApi.Instances/Connect/ChatApiInstanceConnect.cs
+++ b/Src/ChatApi.Instances/Connect/ChatApiInstanceConnect.cs
@@ -2,10 +2,13 @@
namespace ChatApi.Instances.Connect
{
+ ///
public class ChatApiInstanceConnect : IChatApiInstanceConnect
{
+ ///
public string ApiKey { get; }
+ ///
public ChatApiInstanceConnect(string apiKey)
{
ApiKey = apiKey;
diff --git a/Src/ChatApi.Instances/IChatApiInstanceOperations.cs b/Src/ChatApi.Instances/IChatApiInstanceOperations.cs
index 9eb3bfc..b874adc 100644
--- a/Src/ChatApi.Instances/IChatApiInstanceOperations.cs
+++ b/Src/ChatApi.Instances/IChatApiInstanceOperations.cs
@@ -1,10 +1,11 @@
using System.Threading.Tasks;
using ChatApi.Core.Response.Interfaces;
-using ChatApi.Instances.Responses.Interfaces;
using ChatApi.Instances.Requests.Interfaces;
+using ChatApi.Instances.Responses.Interfaces;
namespace ChatApi.Instances
{
+ ///
public interface IChatApiInstanceOperations
{
///
diff --git a/Src/ChatApi.Instances/Models/ChatApiCreateInstanceResult.cs b/Src/ChatApi.Instances/Models/ChatApiCreateInstanceResult.cs
index 385ce80..4932cc1 100644
--- a/Src/ChatApi.Instances/Models/ChatApiCreateInstanceResult.cs
+++ b/Src/ChatApi.Instances/Models/ChatApiCreateInstanceResult.cs
@@ -4,22 +4,28 @@
namespace ChatApi.Instances.Models
{
+ ///
public sealed class ChatApiCreateInstanceResult : IChatApiCreateInstanceResult
{
+ ///
public ChatApiStatusOperation? Status { get; set; }
+ ///
public IChatApiInstanceParameters? InstanceParameters { get; set; }
+ ///
public bool Equals(IChatApiCreateInstanceResult? other)
{
return other is not null && Status == other.Status &&
InstanceParameters == other.InstanceParameters;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IChatApiCreateInstanceResult other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -27,7 +33,9 @@ public override int GetHashCode()
return ((InstanceParameters != null ? InstanceParameters.GetHashCode() : 0) * 397) ^ Status.GetHashCode();
}
}
+ ///
public static bool operator == (ChatApiCreateInstanceResult? left, ChatApiCreateInstanceResult? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChatApiCreateInstanceResult? left, ChatApiCreateInstanceResult? right) => !EquatableHelper.IsEquatable(left, right);
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Models/ChatApiInstance.cs b/Src/ChatApi.Instances/Models/ChatApiInstance.cs
index 7eb167b..cbe7797 100644
--- a/Src/ChatApi.Instances/Models/ChatApiInstance.cs
+++ b/Src/ChatApi.Instances/Models/ChatApiInstance.cs
@@ -4,21 +4,37 @@
namespace ChatApi.Instances.Models
{
+ ///
public sealed class ChatApiInstance : IChatApiInstance
{
#region Properties
- public string? Instance { get; set; }
+ ///
+ public string? Name { get; set; }
+
+ ///
+ public bool? IsActive { get; set; }
+
+ ///
public string? ApiUrl { get; set; }
+
+ ///
+ public string? Instance { get; set; }
+
+ ///
public DateTime? PaidTill { get; set; }
+
+ ///
public int? PaymentsCount { get; set; }
- public bool? IsActive { get; set; }
+
+ ///
public ChatApiInstanceType? TypeInstance { get; set; }
- public string? Name { get; set; }
#endregion
#region Equatable
+
+ ///
public bool Equals(IChatApiInstance? other)
{
return other is not null && PaidTill == other.PaidTill && IsActive == other.IsActive &&
@@ -28,8 +44,10 @@ public bool Equals(IChatApiInstance? other)
TypeInstance == other.TypeInstance && PaymentsCount == other.PaymentsCount;
}
+ ///
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is IChatApiInstance other && Equals(other);
+ ///
public override int GetHashCode()
{
unchecked
@@ -45,7 +63,9 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (ChatApiInstance? left, ChatApiInstance? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChatApiInstance? left, ChatApiInstance? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
diff --git a/Src/ChatApi.Instances/Models/ChatApiInstanceParameters.cs b/Src/ChatApi.Instances/Models/ChatApiInstanceParameters.cs
new file mode 100644
index 0000000..b4ff653
--- /dev/null
+++ b/Src/ChatApi.Instances/Models/ChatApiInstanceParameters.cs
@@ -0,0 +1,61 @@
+using System;
+using ChatApi.Core.Helpers;
+using ChatApi.Instances.Models.Interfaces;
+
+namespace ChatApi.Instances.Models
+{
+ ///
+ public sealed class ChatApiInstanceParameters : IChatApiInstanceParameters
+ {
+ ///
+ public string? Token { get; set; }
+
+ ///
+ public string? ApiUrl { get; set; }
+
+ ///
+ public string? Instance { get; set; }
+
+ ///
+ public bool Equals(IChatApiInstanceParameters? other)
+ {
+ return other is not null &&
+ string.Equals(Token, other.Token, StringComparison.Ordinal) &&
+ string.Equals(ApiUrl, other.ApiUrl, StringComparison.Ordinal) &&
+ string.Equals(Instance, other.Instance, StringComparison.Ordinal);
+ }
+
+ ///
+ public override bool Equals(object? obj)
+ {
+ return ReferenceEquals(this, obj) || obj is IChatApiInstanceParameters other && Equals(other);
+ }
+
+ ///
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = (Instance != null ? Instance.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (ApiUrl != null ? ApiUrl.GetHashCode() : 0);
+ hashCode = (hashCode * 397) ^ (Token != null ? Token.GetHashCode() : 0);
+ return hashCode;
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool operator == (ChatApiInstanceParameters? left, ChatApiInstanceParameters? right) => EquatableHelper.IsEquatable(left, right);
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool operator != (ChatApiInstanceParameters? left, ChatApiInstanceParameters? right) => !EquatableHelper.IsEquatable(left, right);
+ }
+}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Models/ChatApiInstanceType.cs b/Src/ChatApi.Instances/Models/ChatApiInstanceType.cs
index acbf990..1d216d6 100644
--- a/Src/ChatApi.Instances/Models/ChatApiInstanceType.cs
+++ b/Src/ChatApi.Instances/Models/ChatApiInstanceType.cs
@@ -2,10 +2,20 @@
namespace ChatApi.Instances.Models
{
+ ///
+ /// Type of ChatApi instance
+ ///
public enum ChatApiInstanceType : byte
{
+ ///
+ /// WhatsApp production instance type
+ ///
[EnumMember(Value = "whatsapp")]
WhatsApp = 1,
+
+ ///
+ /// WhatsApp development instance type
+ ///
[EnumMember(Value = "whatsapp_dev")]
WhatsAppDev = 2,
}
diff --git a/Src/ChatApi.Instances/Models/Interfaces/IChatApiCreateInstanceResult.cs b/Src/ChatApi.Instances/Models/Interfaces/IChatApiCreateInstanceResult.cs
index b7f9f59..5ebad4b 100644
--- a/Src/ChatApi.Instances/Models/Interfaces/IChatApiCreateInstanceResult.cs
+++ b/Src/ChatApi.Instances/Models/Interfaces/IChatApiCreateInstanceResult.cs
@@ -5,11 +5,18 @@
namespace ChatApi.Instances.Models.Interfaces
{
+ ///
public interface IChatApiCreateInstanceResult : IEquatable
{
+ ///
+ /// The status of the operation
+ ///
[JsonProperty("status")]
ChatApiStatusOperation? Status { get; set; }
+ ///
+ /// Parameters of the instance
+ ///
[JsonProperty("instance")]
[JsonConverter(typeof(InterfacesConverter))]
IChatApiInstanceParameters? InstanceParameters { get; set; }
diff --git a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstance.cs b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstance.cs
index 1f0073c..18c6384 100644
--- a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstance.cs
+++ b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstance.cs
@@ -1,29 +1,36 @@
using System;
using ChatApi.Core.Converters;
using Newtonsoft.Json;
-using Newtonsoft.Json.Converters;
-using UnixDateTimeConverter = ChatApi.Core.Converters.UnixDateTimeConverter;
namespace ChatApi.Instances.Models.Interfaces
{
- public interface IChatApiInstance : IChatApiInstanceId, IChatApiInstanceUrl, IEquatable
+ ///
+ public interface IChatApiInstance : IChatApiInstanceId, IChatApiInstanceUrl, IChatApiInstanceType, IEquatable
{
- [JsonProperty("paidTill")]
- [JsonConverter(typeof(UnixDateTimeConverter))]
- DateTime? PaidTill { get; set; }
-
- [JsonProperty("paymentsCount")]
- int? PaymentsCount { get; set; }
+ ///
+ /// The name of the instance
Can be empty
+ ///
+ [JsonProperty("name")]
+ string? Name { get; set; }
+ ///
+ /// An indicator of the activity instance
+ ///
[JsonProperty("stopped")]
[JsonConverter(typeof(NegativeBoolConverter))]
bool? IsActive { get; set; }
- [JsonProperty("type")]
- [JsonConverter(typeof(StringEnumConverter))]
- ChatApiInstanceType? TypeInstance { get; set; }
+ ///
+ /// Number of paid months
+ ///
+ [JsonProperty("paymentsCount")]
+ int? PaymentsCount { get; set; }
- [JsonProperty("name")]
- string? Name { get; set; }
+ ///
+ /// End date of the paid period
+ ///
+ [JsonProperty("paidTill")]
+ [JsonConverter(typeof(UnixDateTimeConverter))]
+ DateTime? PaidTill { get; set; }
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceId.cs b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceId.cs
index f4ce1e7..b4c58e8 100644
--- a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceId.cs
+++ b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceId.cs
@@ -2,8 +2,14 @@
namespace ChatApi.Instances.Models.Interfaces
{
+ ///
+ /// Chat-api instance unique id
+ ///
public interface IChatApiInstanceId
{
+ ///
+ /// The unique identifier of the instance
+ ///
[JsonProperty("id")]
string? Instance { get; set; }
}
diff --git a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceParameters.cs b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceParameters.cs
index 17cfadb..1c32329 100644
--- a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceParameters.cs
+++ b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceParameters.cs
@@ -1,46 +1,17 @@
using System;
-using ChatApi.Core.Helpers;
using Newtonsoft.Json;
namespace ChatApi.Instances.Models.Interfaces
{
+ ///
+ /// Chat-api instance parameters
+ ///
public interface IChatApiInstanceParameters : IChatApiInstanceId, IChatApiInstanceUrl, IEquatable
{
+ ///
+ /// A unique token for accessing the server for this instance
+ ///
[JsonProperty("token")]
string? Token { get; set; }
}
-
- public sealed class ChatApiInstanceParameters : IChatApiInstanceParameters
- {
- public string? Token { get; set; }
- public string? ApiUrl { get; set; }
- public string? Instance { get; set; }
-
- public bool Equals(IChatApiInstanceParameters? other)
- {
- return other is not null &&
- string.Equals(Token, other.Token, StringComparison.Ordinal) &&
- string.Equals(ApiUrl, other.ApiUrl, StringComparison.Ordinal) &&
- string.Equals(Instance, other.Instance, StringComparison.Ordinal);
- }
-
- public override bool Equals(object? obj)
- {
- return ReferenceEquals(this, obj) || obj is IChatApiInstanceParameters other && Equals(other);
- }
-
- public override int GetHashCode()
- {
- unchecked
- {
- int hashCode = (Instance != null ? Instance.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (ApiUrl != null ? ApiUrl.GetHashCode() : 0);
- hashCode = (hashCode * 397) ^ (Token != null ? Token.GetHashCode() : 0);
- return hashCode;
- }
- }
-
- public static bool operator == (ChatApiInstanceParameters? left, ChatApiInstanceParameters? right) => EquatableHelper.IsEquatable(left, right);
- public static bool operator != (ChatApiInstanceParameters? left, ChatApiInstanceParameters? right) => !EquatableHelper.IsEquatable(left, right);
- }
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceType.cs b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceType.cs
new file mode 100644
index 0000000..6947db6
--- /dev/null
+++ b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceType.cs
@@ -0,0 +1,16 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+
+namespace ChatApi.Instances.Models.Interfaces
+{
+ ///
+ public interface IChatApiInstanceType
+ {
+ ///
+ /// Instance type
+ ///
+ [JsonProperty("type")]
+ [JsonConverter(typeof(StringEnumConverter))]
+ ChatApiInstanceType? TypeInstance { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceUrl.cs b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceUrl.cs
index 845ec14..77bb8c0 100644
--- a/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceUrl.cs
+++ b/Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceUrl.cs
@@ -2,8 +2,12 @@
namespace ChatApi.Instances.Models.Interfaces
{
+ ///
public interface IChatApiInstanceUrl
{
+ ///
+ /// Link for accessing the server
+ ///
[JsonProperty("apiUrl")]
string? ApiUrl { get; set; }
}
diff --git a/Src/ChatApi.Instances/Requests/ChatApiCreateInstanceRequest.cs b/Src/ChatApi.Instances/Requests/ChatApiCreateInstanceRequest.cs
index 1e487f8..99b9123 100644
--- a/Src/ChatApi.Instances/Requests/ChatApiCreateInstanceRequest.cs
+++ b/Src/ChatApi.Instances/Requests/ChatApiCreateInstanceRequest.cs
@@ -1,15 +1,15 @@
using System;
-
using ChatApi.Core.Helpers;
-
-using ChatApi.Instances.Models;
using ChatApi.Instances.Connect;
+using ChatApi.Instances.Models;
using ChatApi.Instances.Requests.Interfaces;
namespace ChatApi.Instances.Requests
{
+ ///
public sealed class ChatApiCreateInstanceRequest : IChatApiCreateInstanceRequest
{
+ ///
public string? ApiKey { get; internal set; }
string? IChatApiCreateInstanceRequest.ApiKey
{
@@ -17,36 +17,43 @@ public sealed class ChatApiCreateInstanceRequest : IChatApiCreateInstanceRequest
set => ApiKey = value;
}
- public ChatApiInstanceType Type { get; set; }
+ ///
+ public ChatApiInstanceType? TypeInstance { get; set; }
+ ///
public static implicit operator ChatApiCreateInstanceRequest(ChatApiInstanceConnect x)
{
return new()
{
ApiKey = x.ApiKey,
- Type = ChatApiInstanceType.WhatsApp
+ TypeInstance = ChatApiInstanceType.WhatsApp
};
}
+ ///
public bool Equals(IChatApiCreateInstanceRequest? other)
{
- return other is not null && Type == other.Type &&
+ return other is not null && TypeInstance == other.TypeInstance &&
string.Equals(ApiKey, other.ApiKey, StringComparison.Ordinal);
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IChatApiCreateInstanceRequest other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
{
- return ((ApiKey != null ? ApiKey.GetHashCode() : 0) * 397) ^ (int) Type;
+ return ((ApiKey != null ? ApiKey.GetHashCode() : 0) * 397) ^ (TypeInstance?.GetHashCode() ?? 0);
}
}
+ ///
public static bool operator == (ChatApiCreateInstanceRequest? left, ChatApiCreateInstanceRequest? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChatApiCreateInstanceRequest? left, ChatApiCreateInstanceRequest? right) => !EquatableHelper.IsEquatable(left, right);
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Requests/ChatApiRemoveInstanceRequest.cs b/Src/ChatApi.Instances/Requests/ChatApiRemoveInstanceRequest.cs
index 04c1959..32e56d2 100644
--- a/Src/ChatApi.Instances/Requests/ChatApiRemoveInstanceRequest.cs
+++ b/Src/ChatApi.Instances/Requests/ChatApiRemoveInstanceRequest.cs
@@ -5,31 +5,39 @@
namespace ChatApi.Instances.Requests
{
+ ///
public sealed class ChatApiRemoveInstanceRequest : IChatApiRemoveInstanceRequest
{
+ ///
public string? ApiKey { get; internal set; }
string? IChatApiRemoveInstanceRequest.ApiKey
{
get => ApiKey;
set => ApiKey = value;
}
+
+ ///
public string? Instance { get; set; }
+ ///
public static implicit operator ChatApiRemoveInstanceRequest(ChatApiInstanceConnect x) => new()
{
ApiKey = x.ApiKey
};
+ ///
public bool Equals(IChatApiRemoveInstanceRequest? other)
{
return other is not null &&
string.Equals(ApiKey, other.ApiKey, StringComparison.Ordinal) &&
string.Equals(Instance, other.Instance, StringComparison.Ordinal);
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IChatApiRemoveInstanceRequest other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -37,7 +45,9 @@ public override int GetHashCode()
return ((ApiKey != null ? ApiKey.GetHashCode() : 0) * 397) ^ (Instance != null ? Instance.GetHashCode() : 0);
}
}
+ ///
public static bool operator == (ChatApiRemoveInstanceRequest? left, ChatApiRemoveInstanceRequest? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChatApiRemoveInstanceRequest? left, ChatApiRemoveInstanceRequest? right) => !EquatableHelper.IsEquatable(left, right);
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Requests/Interfaces/IChatApiCreateInstanceRequest.cs b/Src/ChatApi.Instances/Requests/Interfaces/IChatApiCreateInstanceRequest.cs
index a98c01e..94f9f43 100644
--- a/Src/ChatApi.Instances/Requests/Interfaces/IChatApiCreateInstanceRequest.cs
+++ b/Src/ChatApi.Instances/Requests/Interfaces/IChatApiCreateInstanceRequest.cs
@@ -1,19 +1,13 @@
using System;
-
-using Newtonsoft.Json;
-using Newtonsoft.Json.Converters;
using ChatApi.Core.Models.Interfaces;
-
-using ChatApi.Instances.Models;
+using ChatApi.Instances.Models.Interfaces;
namespace ChatApi.Instances.Requests.Interfaces
{
- public interface IChatApiCreateInstanceRequest : IChatApiKey, IEquatable
+ ///
+ public interface IChatApiCreateInstanceRequest : IChatApiKey, IChatApiInstanceType, IEquatable
{
+ ///
new string? ApiKey { get; internal set; }
-
- [JsonProperty("type")]
- [JsonConverter(typeof(StringEnumConverter))]
- public ChatApiInstanceType Type { get; set; }
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Requests/Interfaces/IChatApiRemoveInstanceRequest.cs b/Src/ChatApi.Instances/Requests/Interfaces/IChatApiRemoveInstanceRequest.cs
index 6949148..fdb545f 100644
--- a/Src/ChatApi.Instances/Requests/Interfaces/IChatApiRemoveInstanceRequest.cs
+++ b/Src/ChatApi.Instances/Requests/Interfaces/IChatApiRemoveInstanceRequest.cs
@@ -5,9 +5,13 @@
namespace ChatApi.Instances.Requests.Interfaces
{
+ ///
public interface IChatApiRemoveInstanceRequest : IChatApiKey, IChatApiInstanceId, IEquatable
{
+ ///
new string? ApiKey { get; internal set; }
+
+ ///
[JsonProperty("instanceId")]
new string? Instance { get; set; }
}
diff --git a/Src/ChatApi.Instances/Responses/ChatApiCreateInstanceResponse.cs b/Src/ChatApi.Instances/Responses/ChatApiCreateInstanceResponse.cs
index 6000755..c4b3727 100644
--- a/Src/ChatApi.Instances/Responses/ChatApiCreateInstanceResponse.cs
+++ b/Src/ChatApi.Instances/Responses/ChatApiCreateInstanceResponse.cs
@@ -5,22 +5,28 @@
namespace ChatApi.Instances.Responses
{
+ ///
public sealed class ChatApiCreateInstanceResponse : IChatApiCreateInstanceResponse
{
+ ///
public string? ErrorMessage { get; set; }
+ ///
public IChatApiCreateInstanceResult? Result { get; set; }
+ ///
public bool Equals(IChatApiCreateInstanceResponse? other)
{
return other is not null && Result == other.Result &&
string.Equals(ErrorMessage, other.ErrorMessage, StringComparison.Ordinal);
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IChatApiCreateInstanceResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -28,7 +34,9 @@ public override int GetHashCode()
return ((ErrorMessage != null ? ErrorMessage.GetHashCode() : 0) * 397) ^ (Result != null ? Result.GetHashCode() : 0);
}
}
+ ///
public static bool operator == (ChatApiCreateInstanceResponse? left, ChatApiCreateInstanceResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChatApiCreateInstanceResponse? left, ChatApiCreateInstanceResponse? right) => !EquatableHelper.IsEquatable(left, right);
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Responses/ChatApiInstanceCollectionResponse.cs b/Src/ChatApi.Instances/Responses/ChatApiInstanceCollectionResponse.cs
index 2fa17a4..555c3d8 100644
--- a/Src/ChatApi.Instances/Responses/ChatApiInstanceCollectionResponse.cs
+++ b/Src/ChatApi.Instances/Responses/ChatApiInstanceCollectionResponse.cs
@@ -4,19 +4,28 @@
namespace ChatApi.Instances.Responses
{
+ ///
public class ChatApiInstanceCollectionResponse : IChatApiInstanceCollectionResponse
{
- public ChatApiInstanceCollection? InstanceCollection { get; set; }
+ ///
public string? ErrorMessage { get; set; }
+ ///
+ public ChatApiInstanceCollection? InstanceCollection { get; set; }
+
#region Equatable
+ ///
public bool Equals(IChatApiInstanceCollectionResponse? other) => other is not null &&
InstanceCollection == other.InstanceCollection;
+ ///
public override bool Equals(object? obj) => ReferenceEquals(this, obj) ||
obj is IChatApiInstanceCollectionResponse other && Equals(other);
+ ///
public override int GetHashCode() => InstanceCollection is null ? 0 : InstanceCollection.GetHashCode();
+ ///
public static bool operator == (ChatApiInstanceCollectionResponse? left, ChatApiInstanceCollectionResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChatApiInstanceCollectionResponse? left, ChatApiInstanceCollectionResponse? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
diff --git a/Src/ChatApi.Instances/Responses/ChatApiRemoveInstanceResponse.cs b/Src/ChatApi.Instances/Responses/ChatApiRemoveInstanceResponse.cs
index 972a667..a8bbe21 100644
--- a/Src/ChatApi.Instances/Responses/ChatApiRemoveInstanceResponse.cs
+++ b/Src/ChatApi.Instances/Responses/ChatApiRemoveInstanceResponse.cs
@@ -5,22 +5,28 @@
namespace ChatApi.Instances.Responses
{
+ ///
public sealed class ChatApiRemoveInstanceResponse : IChatApiRemoveInstanceResponse
{
+ ///
public string? ErrorMessage { get; set; }
+ ///
public ChatApiStatusOperation Status { get; set; }
+ ///
public bool Equals(IChatApiRemoveInstanceResponse? other)
{
return other is not null && Status == other.Status &&
string.Equals(ErrorMessage, other.ErrorMessage, StringComparison.Ordinal);
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IChatApiRemoveInstanceResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -29,7 +35,9 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (ChatApiRemoveInstanceResponse? left, ChatApiRemoveInstanceResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChatApiRemoveInstanceResponse? left, ChatApiRemoveInstanceResponse? right) => !EquatableHelper.IsEquatable(left, right);
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.Instances/Responses/Interfaces/IChatApiCreateInstanceResponse.cs b/Src/ChatApi.Instances/Responses/Interfaces/IChatApiCreateInstanceResponse.cs
index 2ab0653..d85b6ab 100644
--- a/Src/ChatApi.Instances/Responses/Interfaces/IChatApiCreateInstanceResponse.cs
+++ b/Src/ChatApi.Instances/Responses/Interfaces/IChatApiCreateInstanceResponse.cs
@@ -1,14 +1,18 @@
using System;
using ChatApi.Core.Converters;
-using Newtonsoft.Json;
using ChatApi.Core.Models.Interfaces;
using ChatApi.Instances.Models;
using ChatApi.Instances.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.Instances.Responses.Interfaces
{
+ ///
public interface IChatApiCreateInstanceResponse : IErrorResponse, IEquatable
{
+ ///
+ /// Result of creating a Chat Api instance
+ ///
[JsonProperty("result")]
[JsonConverter(typeof(InterfacesConverter))]
IChatApiCreateInstanceResult? Result { get; set; }
diff --git a/Src/ChatApi.Instances/Responses/Interfaces/IChatApiInstanceCollectionResponse.cs b/Src/ChatApi.Instances/Responses/Interfaces/IChatApiInstanceCollectionResponse.cs
index d5be69e..db8789f 100644
--- a/Src/ChatApi.Instances/Responses/Interfaces/IChatApiInstanceCollectionResponse.cs
+++ b/Src/ChatApi.Instances/Responses/Interfaces/IChatApiInstanceCollectionResponse.cs
@@ -1,15 +1,19 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Converters;
using ChatApi.Core.Models.Interfaces;
using ChatApi.Instances.Collections;
using ChatApi.Instances.Models;
using ChatApi.Instances.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.Instances.Responses.Interfaces
{
+ ///
public interface IChatApiInstanceCollectionResponse : IEquatable, IErrorResponse
{
+ ///
+ /// Collection of ChatApi instances
+ ///
[JsonProperty("result")]
[JsonConverter(typeof(InterfaceCollectionConverter))]
public ChatApiInstanceCollection? InstanceCollection { get; set; }
diff --git a/Src/ChatApi.Instances/Responses/Interfaces/IChatApiRemoveInstanceResponse.cs b/Src/ChatApi.Instances/Responses/Interfaces/IChatApiRemoveInstanceResponse.cs
index 3e2a149..04172fd 100644
--- a/Src/ChatApi.Instances/Responses/Interfaces/IChatApiRemoveInstanceResponse.cs
+++ b/Src/ChatApi.Instances/Responses/Interfaces/IChatApiRemoveInstanceResponse.cs
@@ -5,8 +5,12 @@
namespace ChatApi.Instances.Responses.Interfaces
{
+ ///
public interface IChatApiRemoveInstanceResponse : IErrorResponse, IEquatable
{
+ ///
+ /// The status of the operation
+ ///
[JsonProperty("result")]
ChatApiStatusOperation Status { get; set; }
}
diff --git a/Src/ChatApi.WA.Account/AccountOperation.cs b/Src/ChatApi.WA.Account/AccountOperation.cs
index 2a1f179..8194438 100644
--- a/Src/ChatApi.WA.Account/AccountOperation.cs
+++ b/Src/ChatApi.WA.Account/AccountOperation.cs
@@ -1,8 +1,7 @@
using System;
using System.Threading.Tasks;
-
-using ChatApi.Core.Helpers;
using ChatApi.Core.Connect.Interfaces;
+using ChatApi.Core.Helpers;
using ChatApi.Core.Response.Interfaces;
using ChatApi.WA.Account.Properties;
using ChatApi.WA.Account.Requests.Interfaces;
@@ -11,16 +10,19 @@
namespace ChatApi.WA.Account
{
+ ///
public sealed class AccountOperation : IAccountOperation
{
private readonly IWhatsAppConnect _connect;
+ ///
public AccountOperation(IWhatsAppConnect connect) => _connect = connect;
#region Instance API
#region GetQrCode
+ ///
public Task> GetQrCodeAsync() =>
_connect.GetAsync(Resources.GetQrCode, x => new QrCodeResponse {QrCodeImage = x});
@@ -28,8 +30,10 @@ public sealed class AccountOperation : IAccountOperation
#region GetSettings
+ ///
public IChatApiResponse GetSettings(IResponseSettings? responseSettings = null) =>
_connect.Get(Resources.GetSettings, responseSettings);
+ ///
public Task> GetSettingsAsync(IResponseSettings? responseSettings = null) =>
_connect.GetAsync(Resources.GetSettings, responseSettings);
@@ -37,8 +41,10 @@ public sealed class AccountOperation : IAccountOperation
#region GetOutputIPAddress
+ ///
public IChatApiResponse GetOutputIPAddress(IResponseSettings? responseSettings = null) =>
_connect.Get(Resources.GetOutputIP, responseSettings);
+ ///
public Task> GetOutputIPAddressAsync(IResponseSettings? responseSettings = null) =>
_connect.GetAsync(Resources.GetOutputIP, responseSettings);
@@ -46,8 +52,10 @@ public sealed class AccountOperation : IAccountOperation
#region GetAccountInformation
+ ///
public IChatApiResponse GetAccountInformation(IResponseSettings? responseSettings = null) =>
_connect.Get(Resources.GetAccountInformation, responseSettings);
+ ///
public Task> GetAccountInformationAsync(IResponseSettings? responseSettings = null) =>
_connect.GetAsync(Resources.GetAccountInformation, responseSettings);
@@ -55,9 +63,11 @@ public sealed class AccountOperation : IAccountOperation
#region GetStatus
+ ///
public IChatApiResponse GetStatus(IAccountStatusRequest request, IResponseSettings? responseSettings = null) =>
_connect.Get(Resources.GetStatus, responseSettings, request.Parameters);
+ ///
public Task> GetStatusAsync(IAccountStatusRequest request, IResponseSettings? responseSettings = null) =>
_connect.GetAsync(Resources.GetStatus, responseSettings, request.Parameters);
@@ -66,8 +76,10 @@ public sealed class AccountOperation : IAccountOperation
#region Expiry
+ ///
public IChatApiResponse Expiry(IResponseSettings? responseSettings = null) =>
_connect.Post(Resources.Expiry, string.Empty, responseSettings);
+ ///
public Task> ExpiryAsync(IResponseSettings? responseSettings = null) =>
_connect.PostAsync(Resources.Expiry, string.Empty, responseSettings);
@@ -75,8 +87,10 @@ public sealed class AccountOperation : IAccountOperation
#region Logout
+ ///
public IChatApiResponse Logout(IResponseSettings? responseSettings = null) =>
_connect.Post(Resources.Logout, string.Empty, responseSettings);
+ ///
public Task> LogoutAsync(IResponseSettings? responseSettings = null) =>
_connect.PostAsync(Resources.Logout, string.Empty, responseSettings);
@@ -84,8 +98,10 @@ public sealed class AccountOperation : IAccountOperation
#region Takeover
+ ///
public IChatApiResponse Takeover(IResponseSettings? responseSettings = null) =>
_connect.Post(Resources.Takeover, string.Empty, responseSettings);
+ ///
public Task> TakeoverAsync(IResponseSettings? responseSettings = null) =>
_connect.PostAsync(Resources.Takeover, string.Empty, responseSettings);
@@ -93,8 +109,10 @@ public sealed class AccountOperation : IAccountOperation
#region AccountReboot
+ ///
public IChatApiResponse AccountReboot(IResponseSettings? responseSettings = null) =>
_connect.Post(Resources.AccountReboot, string.Empty, responseSettings);
+ ///
public Task> AccountRebootAsync(IResponseSettings? responseSettings = null) =>
_connect.PostAsync(Resources.AccountReboot, string.Empty, responseSettings);
@@ -102,9 +120,11 @@ public sealed class AccountOperation : IAccountOperation
#region RetrySynchronize
+ ///
public IChatApiResponse RetrySynchronize(IResponseSettings? responseSettings = null) =>
_connect.Post(Resources.RetrySynchronize, string.Empty, responseSettings);
+ ///
public Task> RetrySynchronizeAsync(IResponseSettings? responseSettings = null) =>
_connect.PostAsync(Resources.RetrySynchronize, string.Empty, responseSettings);
@@ -112,9 +132,11 @@ public sealed class AccountOperation : IAccountOperation
#region ChangeSettings
+ ///
public IChatApiResponse ChangeSettings(IAccountSettingsRequest settingsRequest, IResponseSettings? responseSettings = null) =>
_connect.Post(Resources.ChangeSettings, settingsRequest.Serialize(), responseSettings);
+ ///
public Task> ChangeSettingsAsync(IAccountSettingsRequest settingsRequest, IResponseSettings? responseSettings = null) =>
_connect.PostAsync(Resources.ChangeSettings, settingsRequest.Serialize(), responseSettings);
@@ -123,11 +145,11 @@ public sealed class AccountOperation : IAccountOperation
#region ChangeAccountName
- //POST
+ ///
public IChatApiResponse ChangeAccountName(IChangeAccountNameRequest changeAccountNameRequest, IResponseSettings? responseSettings = null) =>
throw new NotImplementedException();
- //POST
+ ///
public Task> ChangeAccountNameAsync(IChangeAccountNameRequest changeAccountNameRequest, IResponseSettings? responseSettings = null) =>
throw new NotImplementedException();
@@ -135,11 +157,11 @@ public sealed class AccountOperation : IAccountOperation
#region ChangeAccountStatus
- //POST
+ ///
public IChatApiResponse ChangeAccountStatus(IChangeAccountStatusRequest changeAccountStatusRequest, IResponseSettings? responseSettings = null) =>
throw new NotImplementedException();
- //POST
+ ///
public Task> ChangeAccountStatusAsync(IChangeAccountStatusRequest changeAccountStatusRequest, IResponseSettings? responseSettings = null) =>
throw new NotImplementedException();
diff --git a/Src/ChatApi.WA.Account/ChatApi.WA.Account.csproj b/Src/ChatApi.WA.Account/ChatApi.WA.Account.csproj
index ca177e7..0ccab5c 100644
--- a/Src/ChatApi.WA.Account/ChatApi.WA.Account.csproj
+++ b/Src/ChatApi.WA.Account/ChatApi.WA.Account.csproj
@@ -1,48 +1,71 @@
- netstandard2.0
- latest
+
+
enable
+ 9
+ netstandard2.0
+
+
true
+ true
+ bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
+
+
ChatApi.WA.Instance
Roman Vorontsov
- ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
-
- false
- https://github.com/Zodt/ChatApi
- GitHub
- ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp
-
+ en
ChatApi.png
+ 1.0.1-alpha
+ ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp
+
+ ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
+
+
+ 1. Refactoring code
+ 2. Add xml doc
+
+
+
MIT
- en
+ false
+
+
+ GitHub
+ https://github.com/Zodt/ChatApi
+
-
- True
- True
- Resources.resx
-
-
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
+
+
-
-
-
+
+
+ True
+ True
+ Resources.resx
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
-
-
- True
-
-
+
+
+ True
+
+
+
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/IAccountOperation.cs b/Src/ChatApi.WA.Account/IAccountOperation.cs
index 32280f9..e3f22f2 100644
--- a/Src/ChatApi.WA.Account/IAccountOperation.cs
+++ b/Src/ChatApi.WA.Account/IAccountOperation.cs
@@ -5,6 +5,7 @@
namespace ChatApi.WA.Account
{
+ ///
public interface IAccountOperation
{
///
diff --git a/Src/ChatApi.WA.Account/Models/AccountSettings.cs b/Src/ChatApi.WA.Account/Models/AccountSettings.cs
index e18c330..3dd3b75 100644
--- a/Src/ChatApi.WA.Account/Models/AccountSettings.cs
+++ b/Src/ChatApi.WA.Account/Models/AccountSettings.cs
@@ -4,31 +4,49 @@
namespace ChatApi.WA.Account.Models
{
+ ///
public class AccountSettings : Printable, IAccountSettings
{
#region Properties
+ ///
public string? ErrorMessage { get; set; }
+ ///
public int? SendDelay { get; set; }
+ ///
public string? WebhookUrl { get; set; }
+ ///
public bool? InstanceStatuses { get; set; }
+ ///
public bool? WebhookStatuses { get; set; }
+ ///
public bool? StatusNotificationsOn { get; set; }
+ ///
public bool? AckNotificationsOn { get; set; }
+ ///
public bool? ChatUpdateOn { get; set; }
+ ///
public bool? VideoUploadOn { get; set; }
+ ///
public string? Proxy { get; set; }
+ ///
public bool? GuaranteedHooks { get; set; }
+ ///
public bool? IgnoreOldMessages { get; set; }
+ ///
public int? OldMessagesPeriod { get; set; }
+ ///
public bool? ProcessArchive { get; set; }
+ ///
public bool? DisableDialogsArchive { get; set; }
+ ///
public bool? ParallelHooks { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IAccountSettings? other)
{
return other is not null &&
@@ -50,11 +68,13 @@ public bool Equals(IAccountSettings? other)
ParallelHooks == other.ParallelHooks;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IAccountSettings other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -79,13 +99,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (AccountSettings? left, AccountSettings? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (AccountSettings? left, AccountSettings? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(SendDelay), SendDelay, shift);
diff --git a/Src/ChatApi.WA.Account/Models/AccountStatusData.cs b/Src/ChatApi.WA.Account/Models/AccountStatusData.cs
index 9f63ef9..30844ef 100644
--- a/Src/ChatApi.WA.Account/Models/AccountStatusData.cs
+++ b/Src/ChatApi.WA.Account/Models/AccountStatusData.cs
@@ -1,25 +1,33 @@
-using ChatApi.Core.Models;
-using ChatApi.Core.Helpers;
+using ChatApi.Core.Helpers;
+using ChatApi.Core.Models;
using ChatApi.WA.Account.Models.Interfaces;
using ChatApi.WA.Account.Responses.Interfaces;
namespace ChatApi.WA.Account.Models
{
+ ///
public sealed class AccountStatusData : Printable, IAccountStatusData
{
#region Properties
+ ///
public string? Title { get; set; }
+ ///
public string? Message { get; set; }
+ ///
public string? SubMessage { get; set; }
+ ///
public InstanceStatusType? SubStatus { get; set; }
+ ///
public IAdditionInformationStatus? Actions { get; set; }
+ ///
public InstanceConnectionStatusType? Reason { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IAccountStatusData other)
{
return Title == other.Title &&
@@ -30,11 +38,13 @@ public bool Equals(IAccountStatusData other)
Actions == other.Actions;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IAccountStatusData other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -49,13 +59,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (AccountStatusData? left, AccountStatusData? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (AccountStatusData? left, AccountStatusData? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(Title), Title, shift);
diff --git a/Src/ChatApi.WA.Account/Models/AccountStatusType.cs b/Src/ChatApi.WA.Account/Models/AccountStatusType.cs
index fff7508..98b7c9e 100644
--- a/Src/ChatApi.WA.Account/Models/AccountStatusType.cs
+++ b/Src/ChatApi.WA.Account/Models/AccountStatusType.cs
@@ -2,41 +2,65 @@
namespace ChatApi.WA.Account.Models
{
+ ///
public enum AccountStatusType : byte
{
+ ///
+ /// There is a QR code and you need to take a picture of it in the Whatsapp application by going to Menu -> WhatsApp Web -> Add.
+ /// QR code is valid for one minute.
+ ///
[EnumMember(Value = "got qr code")]
GotQrCode = 1,
+ ///
+ /// Authorization passed successfully
+ ///
[EnumMember(Value = "authenticated")]
Authenticated = 2,
+ ///
+ /// The system is still loading, try again in 1 minute
+ ///
[EnumMember(Value = "loading")]
Loading = 3,
+ ///
+ /// Initial status
+ ///
[EnumMember(Value = "init")]
Init = 4,
+ ///
+ /// The rate of pay for your ChatApi account
+ ///
[EnumMember(Value = "not_paid")]
NotPaid = 5,
+ ///
[EnumMember(Value = "Expiry request sent to WhatsApp")]
ExpiryOk = 6,
+ ///
[EnumMember(Value = "Expiry request not sent because substatus don't equals \"expired\"")]
ExpiryError = 7,
+ ///
[EnumMember(Value = "Takeover request sent to WhatsApp")]
TakeoverOk = 8,
+ ///
[EnumMember(Value = "Takeover request not sent because substatus don't equals \"conflict\"")]
TakeoverError = 9,
+ ///
[EnumMember(Value = "Logout request sent to WhatsApp")]
LogoutOk = 10,
+ ///
[EnumMember(Value = "Retry request sent to WhatsApp")]
RetrySynchronizeOk = 11,
+ ///
[EnumMember(Value = "Retry request not sent because reason don't equals \"syncing\"")]
RetrySynchronizeError = 12,
diff --git a/Src/ChatApi.WA.Account/Models/DeviceCharacteristic.cs b/Src/ChatApi.WA.Account/Models/DeviceCharacteristic.cs
index 594cb9e..d2cd59c 100644
--- a/Src/ChatApi.WA.Account/Models/DeviceCharacteristic.cs
+++ b/Src/ChatApi.WA.Account/Models/DeviceCharacteristic.cs
@@ -4,18 +4,23 @@
namespace ChatApi.WA.Account.Models
{
+ ///
public sealed class DeviceCharacteristic : Printable, IDeviceCharacteristic
{
#region Properties
+ ///
public string? Model { get; set; }
+ ///
public string? OsVersion { get; set; }
+ ///
public string? Manufacturer { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IDeviceCharacteristic? other)
{
return other is not null &&
@@ -24,11 +29,13 @@ public bool Equals(IDeviceCharacteristic? other)
Model == other.Model;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IDeviceCharacteristic other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -40,13 +47,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator ==(DeviceCharacteristic? left, DeviceCharacteristic? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator !=(DeviceCharacteristic? left, DeviceCharacteristic? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(Manufacturer), Manufacturer, shift);
diff --git a/Src/ChatApi.WA.Account/Models/InstanceConnectionStatusType.cs b/Src/ChatApi.WA.Account/Models/InstanceConnectionStatusType.cs
index 61c2619..e74b3c0 100644
--- a/Src/ChatApi.WA.Account/Models/InstanceConnectionStatusType.cs
+++ b/Src/ChatApi.WA.Account/Models/InstanceConnectionStatusType.cs
@@ -2,16 +2,27 @@
namespace ChatApi.WA.Account.Models
{
+ //Need description:chatApi
+ ///
public enum InstanceConnectionStatusType : byte
{
+ ///
[EnumMember(Value = "connecting")]
Connecting = 1,
+
+ ///
[EnumMember(Value = "syncing")]
Syncing = 1,
+
+ ///
[EnumMember(Value = "offline")]
Offline = 1,
+
+ ///
[EnumMember(Value = "proxyblock")]
ProxyBlock = 1,
+
+ ///
[EnumMember(Value = "conflict")]
Conflict = 1
}
diff --git a/Src/ChatApi.WA.Account/Models/InstanceStatus.cs b/Src/ChatApi.WA.Account/Models/InstanceStatus.cs
index b29e2d6..a26d911 100644
--- a/Src/ChatApi.WA.Account/Models/InstanceStatus.cs
+++ b/Src/ChatApi.WA.Account/Models/InstanceStatus.cs
@@ -5,49 +5,59 @@
namespace ChatApi.WA.Account.Models
{
+ ///
public class InstanceStatus : Printable, IExpiry, ILogout, IRetry, ITakeover, ILearnMore
{
#region Properties
+ ///
public string? Link { get; set; }
+ ///
public string? Label { get; set; }
- public InstanceStatusActionType? Action { get; set; }
+ ///
+ public InstanceStatusActionType? ActionType { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IInstanceStatus? other)
{
- return other is not null && Action == other.Action &&
+ return other is not null && ActionType == other.ActionType &&
string.Equals(Link, other.Link, StringComparison.Ordinal) &&
string.Equals(Label, other.Label, StringComparison.Ordinal);
}
+ ///
public override bool Equals(object? obj) =>
ReferenceEquals(this, obj) || obj is IInstanceStatus other && Equals(other);
+ ///
public override int GetHashCode()
{
unchecked
{
- int hashCode = Action is not null ? Action.GetHashCode() : 0;
+ int hashCode = ActionType is not null ? ActionType.GetHashCode() : 0;
hashCode = (hashCode * 397) ^ (Label is not null ? Label.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ (Link is not null ? Link.GetHashCode() : 0);
return hashCode;
}
}
+ ///
public static bool operator == (InstanceStatus? left, InstanceStatus? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (InstanceStatus? left, InstanceStatus? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
- AddMember(nameof(Action), Action, shift);
+ AddMember(nameof(ActionType), ActionType, shift);
AddMember(nameof(Label), Label, shift);
AddMember(nameof(Link), Link, shift);
}
diff --git a/Src/ChatApi.WA.Account/Models/InstanceStatusActionType.cs b/Src/ChatApi.WA.Account/Models/InstanceStatusActionType.cs
index 49a6dcb..1616fd1 100644
--- a/Src/ChatApi.WA.Account/Models/InstanceStatusActionType.cs
+++ b/Src/ChatApi.WA.Account/Models/InstanceStatusActionType.cs
@@ -2,16 +2,27 @@
namespace ChatApi.WA.Account.Models
{
+ //Need description:chatApi
+ ///
public enum InstanceStatusActionType : byte
{
+ ///
[EnumMember(Value = "learn_more")]
LearnMore = 0,
+
+ ///
[EnumMember(Value = "expiry")]
Expiry = 1,
+
+ ///
[EnumMember(Value = "retry")]
Retry = 2,
+
+ ///
[EnumMember(Value = "takeover")]
Takeover = 3,
+
+ ///
[EnumMember(Value = "logout")]
Logout = 4
}
diff --git a/Src/ChatApi.WA.Account/Models/InstanceStatusType.cs b/Src/ChatApi.WA.Account/Models/InstanceStatusType.cs
index 6647a4f..95ad08f 100644
--- a/Src/ChatApi.WA.Account/Models/InstanceStatusType.cs
+++ b/Src/ChatApi.WA.Account/Models/InstanceStatusType.cs
@@ -2,28 +2,51 @@
namespace ChatApi.WA.Account.Models
{
+ //Need description:chatApi
+ ///
public enum InstanceStatusType : byte
{
+ ///
[EnumMember(Value = "loading")]
Loading = 1,
+
+ ///
[EnumMember(Value = "normal")]
Online = 2,
+
+ ///
[EnumMember(Value = "offline")]
Offline = 3,
+
+ ///
[EnumMember(Value = "expired")]
Expired = 4,
+
+ ///
[EnumMember(Value = "opening")]
Opening = 5,
+
+ ///
[EnumMember(Value = "pairing")]
Pairing = 6,
+
+ ///
[EnumMember(Value = "timeout")]
Timeout = 7,
+
+ ///
[EnumMember(Value = "computer")]
Computer = 8,
+
+ ///
[EnumMember(Value = "phone")]
Phone = 9,
+
+ ///
[EnumMember(Value = "battery_low_1")]
BatteryLow = 10,
+
+ ///
[EnumMember(Value = "battery_low_2")]
BatteryExtremelyLow = 11
}
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/IAccountSettings.cs b/Src/ChatApi.WA.Account/Models/Interfaces/IAccountSettings.cs
index 39bb4d8..53bcbf1 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/IAccountSettings.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/IAccountSettings.cs
@@ -1,9 +1,10 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface IAccountSettings : IErrorResponse, IEquatable, IPrintable
{
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/IAccountStatus.cs b/Src/ChatApi.WA.Account/Models/Interfaces/IAccountStatus.cs
index 2c624d1..71fc8ec 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/IAccountStatus.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/IAccountStatus.cs
@@ -3,6 +3,7 @@
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface IAccountStatus : IOperationResponse, IPrintable
{
///
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/IAccountStatusData.cs b/Src/ChatApi.WA.Account/Models/Interfaces/IAccountStatusData.cs
index a09acda..147f62b 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/IAccountStatusData.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/IAccountStatusData.cs
@@ -1,14 +1,13 @@
using System;
-using Newtonsoft.Json;
-
using ChatApi.Core.Converters;
using ChatApi.Core.Models.Interfaces;
-
using ChatApi.WA.Account.Responses;
using ChatApi.WA.Account.Responses.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface IAccountStatusData : IEquatable, IPrintable
{
///
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/IDeviceCharacteristic.cs b/Src/ChatApi.WA.Account/Models/Interfaces/IDeviceCharacteristic.cs
index 3418ff2..0af0b5f 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/IDeviceCharacteristic.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/IDeviceCharacteristic.cs
@@ -4,6 +4,7 @@
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface IDeviceCharacteristic: IEquatable, IPrintable
{
///
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/IExpiry.cs b/Src/ChatApi.WA.Account/Models/Interfaces/IExpiry.cs
index c0ffc68..80e50f9 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/IExpiry.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/IExpiry.cs
@@ -1,4 +1,5 @@
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface IExpiry : IInstanceStatus { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/IInstanceStatus.cs b/Src/ChatApi.WA.Account/Models/Interfaces/IInstanceStatus.cs
index 18a9b74..8ac6ecf 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/IInstanceStatus.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/IInstanceStatus.cs
@@ -1,16 +1,17 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface IInstanceStatus : IEquatable, IPrintable
{
///
/// Method name
///
[JsonProperty("act", NullValueHandling = NullValueHandling.Ignore)]
- InstanceStatusActionType? Action { get; set; }
+ InstanceStatusActionType? ActionType { get; set; }
///
/// Action caption for the button
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/ILearnMore.cs b/Src/ChatApi.WA.Account/Models/Interfaces/ILearnMore.cs
index 2d1b539..345d2d9 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/ILearnMore.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/ILearnMore.cs
@@ -1,4 +1,5 @@
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface ILearnMore : IInstanceStatus { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/ILogout.cs b/Src/ChatApi.WA.Account/Models/Interfaces/ILogout.cs
index db9dba3..e8e3017 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/ILogout.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/ILogout.cs
@@ -1,4 +1,5 @@
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface ILogout : IInstanceStatus { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/IRetry.cs b/Src/ChatApi.WA.Account/Models/Interfaces/IRetry.cs
index 6538e8e..2dcdb88 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/IRetry.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/IRetry.cs
@@ -1,4 +1,5 @@
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface IRetry : IInstanceStatus { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Models/Interfaces/ITakeover.cs b/Src/ChatApi.WA.Account/Models/Interfaces/ITakeover.cs
index 67bae37..5ec5f7b 100644
--- a/Src/ChatApi.WA.Account/Models/Interfaces/ITakeover.cs
+++ b/Src/ChatApi.WA.Account/Models/Interfaces/ITakeover.cs
@@ -1,4 +1,5 @@
namespace ChatApi.WA.Account.Models.Interfaces
{
+ ///
public interface ITakeover : IInstanceStatus { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Requests/AccountSettingsRequest.cs b/Src/ChatApi.WA.Account/Requests/AccountSettingsRequest.cs
index 2cde089..d54071b 100644
--- a/Src/ChatApi.WA.Account/Requests/AccountSettingsRequest.cs
+++ b/Src/ChatApi.WA.Account/Requests/AccountSettingsRequest.cs
@@ -3,5 +3,6 @@
namespace ChatApi.WA.Account.Requests
{
+ ///
public class AccountSettingsRequest : AccountSettings, IAccountSettingsRequest { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Requests/AccountStatusRequest.cs b/Src/ChatApi.WA.Account/Requests/AccountStatusRequest.cs
index 2463d60..5103af5 100644
--- a/Src/ChatApi.WA.Account/Requests/AccountStatusRequest.cs
+++ b/Src/ChatApi.WA.Account/Requests/AccountStatusRequest.cs
@@ -1,14 +1,16 @@
using System.Text;
-using ChatApi.Core.Models;
using ChatApi.Core.Helpers;
+using ChatApi.Core.Models;
using ChatApi.WA.Account.Requests.Interfaces;
namespace ChatApi.WA.Account.Requests
{
+ ///
public class AccountStatusRequest : Printable, IAccountStatusRequest
{
#region Properties
+ ///
public string Parameters
{
get
@@ -30,13 +32,16 @@ public string Parameters
}
}
+ ///
public bool? NoWakeup { get; set; }
+ ///
public bool? GetFullInformation { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IAccountStatusRequest? other)
{
return other is not null &&
@@ -44,11 +49,13 @@ public bool Equals(IAccountStatusRequest? other)
GetFullInformation == other.GetFullInformation;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IAccountStatusRequest other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -60,13 +67,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (AccountStatusRequest? left, AccountStatusRequest? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (AccountStatusRequest? left, AccountStatusRequest? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(NoWakeup), NoWakeup, shift);
diff --git a/Src/ChatApi.WA.Account/Requests/ChangeAccountNameRequest.cs b/Src/ChatApi.WA.Account/Requests/ChangeAccountNameRequest.cs
index d5777cd..9786cb1 100644
--- a/Src/ChatApi.WA.Account/Requests/ChangeAccountNameRequest.cs
+++ b/Src/ChatApi.WA.Account/Requests/ChangeAccountNameRequest.cs
@@ -4,15 +4,22 @@
namespace ChatApi.WA.Account.Requests
{
+ ///
public sealed class ChangeAccountNameRequest : IChangeAccountNameRequest
{
+ ///
public string? AccountName { get; set; }
+ ///
public bool Equals(IChangeAccountNameRequest? other) => other is not null &&
- string.Equals(AccountName, other.AccountName, StringComparison.Ordinal);
+ string.Equals(AccountName, other.AccountName, StringComparison.Ordinal);
+ ///
public override int GetHashCode() => AccountName != null ? AccountName.GetHashCode() : 0;
+ ///
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is IChangeAccountNameRequest other && Equals(other);
+ ///
public static bool operator == (ChangeAccountNameRequest? left, ChangeAccountNameRequest? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChangeAccountNameRequest? left, ChangeAccountNameRequest? right) => !EquatableHelper.IsEquatable(left, right);
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Requests/ChangeAccountStatusRequest.cs b/Src/ChatApi.WA.Account/Requests/ChangeAccountStatusRequest.cs
index de45ae6..34cd48e 100644
--- a/Src/ChatApi.WA.Account/Requests/ChangeAccountStatusRequest.cs
+++ b/Src/ChatApi.WA.Account/Requests/ChangeAccountStatusRequest.cs
@@ -4,15 +4,22 @@
namespace ChatApi.WA.Account.Requests
{
+ ///
public sealed class ChangeAccountStatusRequest : IChangeAccountStatusRequest
{
+ ///
public string? AccountStatus { get; set; }
+ ///
public bool Equals(IChangeAccountStatusRequest? other) => other is not null &&
- string.Equals(AccountStatus, other.AccountStatus, StringComparison.Ordinal);
+ string.Equals(AccountStatus, other.AccountStatus, StringComparison.Ordinal);
+ ///
public override int GetHashCode() => AccountStatus != null ? AccountStatus.GetHashCode() : 0;
+ ///
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is IChangeAccountStatusRequest other && Equals(other);
+ ///
public static bool operator == (ChangeAccountStatusRequest? left, ChangeAccountStatusRequest? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (ChangeAccountStatusRequest? left, ChangeAccountStatusRequest? right) => !EquatableHelper.IsEquatable(left, right);
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Requests/Interfaces/IAccountSettingsRequest.cs b/Src/ChatApi.WA.Account/Requests/Interfaces/IAccountSettingsRequest.cs
index 2a99589..44de953 100644
--- a/Src/ChatApi.WA.Account/Requests/Interfaces/IAccountSettingsRequest.cs
+++ b/Src/ChatApi.WA.Account/Requests/Interfaces/IAccountSettingsRequest.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Requests.Interfaces
{
+ ///
public interface IAccountSettingsRequest : IAccountSettings { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Requests/Interfaces/IAccountStatusRequest.cs b/Src/ChatApi.WA.Account/Requests/Interfaces/IAccountStatusRequest.cs
index 642062e..61aabee 100644
--- a/Src/ChatApi.WA.Account/Requests/Interfaces/IAccountStatusRequest.cs
+++ b/Src/ChatApi.WA.Account/Requests/Interfaces/IAccountStatusRequest.cs
@@ -1,9 +1,10 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Account.Requests.Interfaces
{
+ ///
public interface IAccountStatusRequest : IParameters, IEquatable, IPrintable
{
///
diff --git a/Src/ChatApi.WA.Account/Requests/Interfaces/IChangeAccountNameRequest.cs b/Src/ChatApi.WA.Account/Requests/Interfaces/IChangeAccountNameRequest.cs
index abf0d97..18abf42 100644
--- a/Src/ChatApi.WA.Account/Requests/Interfaces/IChangeAccountNameRequest.cs
+++ b/Src/ChatApi.WA.Account/Requests/Interfaces/IChangeAccountNameRequest.cs
@@ -3,6 +3,7 @@
namespace ChatApi.WA.Account.Requests.Interfaces
{
+ ///
public interface IChangeAccountNameRequest : IEquatable
{
///
diff --git a/Src/ChatApi.WA.Account/Requests/Interfaces/IChangeAccountStatusRequest.cs b/Src/ChatApi.WA.Account/Requests/Interfaces/IChangeAccountStatusRequest.cs
index 98ce901..05a2789 100644
--- a/Src/ChatApi.WA.Account/Requests/Interfaces/IChangeAccountStatusRequest.cs
+++ b/Src/ChatApi.WA.Account/Requests/Interfaces/IChangeAccountStatusRequest.cs
@@ -3,6 +3,7 @@
namespace ChatApi.WA.Account.Requests.Interfaces
{
+ ///
public interface IChangeAccountStatusRequest : IEquatable
{
///
diff --git a/Src/ChatApi.WA.Account/Responses/AccountInformationResponse.cs b/Src/ChatApi.WA.Account/Responses/AccountInformationResponse.cs
index 56d5456..4d61739 100644
--- a/Src/ChatApi.WA.Account/Responses/AccountInformationResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/AccountInformationResponse.cs
@@ -5,22 +5,31 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public sealed class AccountInformationResponse : Printable, IAccountInformationResponse
{
#region Properties
+ ///
public string? Id { get; set; }
+ ///
public string? Battery { get; set; }
+ ///
public string? Locale { get; set; }
+ ///
public string? Name { get; set; }
+ ///
public string? WhatsAppVersion { get; set; }
+ ///
public IDeviceCharacteristic? Device { get; set; }
+ ///
public string? ErrorMessage { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IAccountInformationResponse? other)
{
return other is not null &&
@@ -33,11 +42,13 @@ public bool Equals(IAccountInformationResponse? other)
Device == other.Device;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IAccountInformationResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -53,13 +64,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (AccountInformationResponse? left, AccountInformationResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (AccountInformationResponse? left, AccountInformationResponse? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(Id), Id, shift);
diff --git a/Src/ChatApi.WA.Account/Responses/AccountRebootResponse.cs b/Src/ChatApi.WA.Account/Responses/AccountRebootResponse.cs
index dc52def..3eaf044 100644
--- a/Src/ChatApi.WA.Account/Responses/AccountRebootResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/AccountRebootResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public class AccountRebootResponse : InstanceStatusResponse, IAccountRebootResponse { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/AccountSettingsResponse.cs b/Src/ChatApi.WA.Account/Responses/AccountSettingsResponse.cs
index 5b06117..738b7ad 100644
--- a/Src/ChatApi.WA.Account/Responses/AccountSettingsResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/AccountSettingsResponse.cs
@@ -5,16 +5,19 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public sealed class AccountSettingsResponse : AccountSettings, IAccountSettingsResponse
{
#region Properties
+ ///
public IAccountSettings? Update { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IAccountSettingsResponse? other)
{
return other is not null &&
@@ -22,10 +25,12 @@ public bool Equals(IAccountSettingsResponse? other)
Update == other.Update;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IAccountSettingsResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -34,13 +39,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (AccountSettingsResponse? left, AccountSettingsResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (AccountSettingsResponse? left, AccountSettingsResponse? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(Update), Update, shift);
diff --git a/Src/ChatApi.WA.Account/Responses/AccountStatusResponse.cs b/Src/ChatApi.WA.Account/Responses/AccountStatusResponse.cs
index 8a29fbb..3edd405 100644
--- a/Src/ChatApi.WA.Account/Responses/AccountStatusResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/AccountStatusResponse.cs
@@ -1,27 +1,35 @@
-using ChatApi.Core.Models;
-using ChatApi.Core.Helpers;
+using ChatApi.Core.Helpers;
+using ChatApi.Core.Models;
using ChatApi.WA.Account.Models;
using ChatApi.WA.Account.Models.Interfaces;
using ChatApi.WA.Account.Responses.Interfaces;
namespace ChatApi.WA.Account.Responses
{
+ ///
public sealed class AccountStatusResponse : Printable, IAccountStatusResponse
{
#region Properties
+ ///
public string? QrCode { get; set; }
+ ///
public AccountStatusType? AccountStatus { get; set; }
+ ///
public IAccountStatusData? StatusData { get; set; }
+ ///
public bool? Success { get; set; }
+ ///
public string? Result { get; set; }
+ ///
public string? ErrorMessage { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IAccountStatusResponse? other)
{
return other is not null &&
@@ -34,11 +42,13 @@ public bool Equals(IAccountStatusResponse? other)
Equals(StatusData, other.StatusData);
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IAccountStatusResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -53,13 +63,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (AccountStatusResponse? left, AccountStatusResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (AccountStatusResponse? left, AccountStatusResponse? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(QrCode), QrCode?.Substring(0, 20), shift);
diff --git a/Src/ChatApi.WA.Account/Responses/AdditionInformationStatus.cs b/Src/ChatApi.WA.Account/Responses/AdditionInformationStatus.cs
index cd34c2c..023ec45 100644
--- a/Src/ChatApi.WA.Account/Responses/AdditionInformationStatus.cs
+++ b/Src/ChatApi.WA.Account/Responses/AdditionInformationStatus.cs
@@ -5,20 +5,27 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public sealed class AdditionInformationStatus : Printable, IAdditionInformationStatus
{
#region Properties
+ ///
public IInstanceStatus? Retry { get; set; }
+ ///
public IInstanceStatus? Expiry { get; set; }
+ ///
public IInstanceStatus? Logout { get; set; }
+ ///
public IInstanceStatus? Takeover { get; set; }
+ ///
public IInstanceStatus? LearnMore { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IAdditionInformationStatus? other)
{
return other is not null &&
@@ -29,11 +36,13 @@ public bool Equals(IAdditionInformationStatus? other)
LearnMore == other.LearnMore;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IAdditionInformationStatus other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -47,13 +56,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (AdditionInformationStatus? left, AdditionInformationStatus? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (AdditionInformationStatus? left, AdditionInformationStatus? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(Retry), Retry, shift);
diff --git a/Src/ChatApi.WA.Account/Responses/ExpiryResponse.cs b/Src/ChatApi.WA.Account/Responses/ExpiryResponse.cs
index 6d4c649..b1fc56b 100644
--- a/Src/ChatApi.WA.Account/Responses/ExpiryResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/ExpiryResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public class ExpiryResponse : InstanceStatusResponse, IExpiryResponse { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/InstanceStatusResponse.cs b/Src/ChatApi.WA.Account/Responses/InstanceStatusResponse.cs
index 190c560..9aa8be0 100644
--- a/Src/ChatApi.WA.Account/Responses/InstanceStatusResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/InstanceStatusResponse.cs
@@ -4,19 +4,25 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public class InstanceStatusResponse : InstanceStatus, IInstanceStatusResponse
{
#region Properties
+ ///
public string? Result { get; set; }
+ ///
public bool? Success { get; set; }
+ ///
public string? ErrorMessage { get; set; }
+ ///
public AccountStatusType? AccountStatus { get; set; }
#endregion
#region Methods
+ ///
public bool Equals(IInstanceStatusResponse? other)
{
return base.Equals(other) &&
@@ -27,11 +33,13 @@ public bool Equals(IInstanceStatusResponse? other)
AccountStatus == other.AccountStatus;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IInstanceStatusResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -45,13 +53,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (InstanceStatusResponse? left, InstanceStatusResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (InstanceStatusResponse? left, InstanceStatusResponse? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(AccountStatus), AccountStatus, shift);
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountInformationResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountInformationResponse.cs
index 6c862ad..0bd6870 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountInformationResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountInformationResponse.cs
@@ -1,12 +1,13 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Converters;
using ChatApi.Core.Models.Interfaces;
using ChatApi.WA.Account.Models;
using ChatApi.WA.Account.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IAccountInformationResponse : IErrorResponse, IEquatable, IPrintable
{
///
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountRebootResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountRebootResponse.cs
index 34ebf91..91f793a 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountRebootResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountRebootResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IAccountRebootResponse : IOperationResponse, IPrintable { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountSettingsResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountSettingsResponse.cs
index 98b6b3c..b795e25 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountSettingsResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountSettingsResponse.cs
@@ -6,6 +6,7 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IAccountSettingsResponse : IAccountSettings, IEquatable
{
///
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountStatusResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountStatusResponse.cs
index 85ec9a3..fd8ff1c 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountStatusResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IAccountStatusResponse.cs
@@ -6,6 +6,7 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IAccountStatusResponse : IAccountStatus, IEquatable
{
///
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IAdditionInformationStatus.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IAdditionInformationStatus.cs
index 75208f9..02cecf7 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IAdditionInformationStatus.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IAdditionInformationStatus.cs
@@ -1,30 +1,48 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Converters;
using ChatApi.Core.Models.Interfaces;
using ChatApi.WA.Account.Models;
using ChatApi.WA.Account.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
+ /// Represents the current state of the account
+ ///
public interface IAdditionInformationStatus : IEquatable, IPrintable
{
+ ///
+ /// Indicates the need to update the QR code since it has expired.
+ ///
[JsonConverter(typeof(InterfacesConverter))]
[JsonProperty("expiry", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
IInstanceStatus? Expiry { get; set; }
+ ///
+ /// Indicates that the manual synchronization attempt with the device must be repeated.
+ ///
[JsonConverter(typeof(InterfacesConverter))]
[JsonProperty("retry", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
IInstanceStatus? Retry { get; set; }
+ ///
+ /// Indicates that you need to log out of WhatsApp Web to get a new QR code.
+ ///
[JsonConverter(typeof(InterfacesConverter))]
[JsonProperty("logout", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
IInstanceStatus? Logout { get; set; }
+ ///
+ /// Indicates the need to return the active session.
+ ///
[JsonConverter(typeof(InterfacesConverter))]
[JsonProperty("takeover", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
IInstanceStatus? Takeover { get; set; }
+ ///
+ /// Providing advanced information
+ ///
[JsonConverter(typeof(InterfacesConverter))]
[JsonProperty("learn_more", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
IInstanceStatus? LearnMore { get; set; }
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountNameResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountNameResponse.cs
index 3e05ad8..e29ab7a 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountNameResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountNameResponse.cs
@@ -1,10 +1,12 @@
-using Newtonsoft.Json;
-using ChatApi.Core.Models.Interfaces;
+using ChatApi.Core.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IChangeAccountNameResponse : IOperationResponse
{
+ ///
[JsonProperty("pushname", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)]
string PushName { get; set; }
}
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountStatusResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountStatusResponse.cs
index 1ec2e35..a38a5b1 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountStatusResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountStatusResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IChangeAccountStatusResponse : IOperationResponse { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IExpiryResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IExpiryResponse.cs
index 7548238..7e88fde 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IExpiryResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IExpiryResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IExpiryResponse : IAccountStatus, IExpiry { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IInstanceStatusResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IInstanceStatusResponse.cs
index ee81495..da41cc3 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IInstanceStatusResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IInstanceStatusResponse.cs
@@ -3,5 +3,6 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IInstanceStatusResponse : IInstanceStatus, IAccountStatus, IEquatable { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/ILearnMoreResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/ILearnMoreResponse.cs
index 3ca44f8..d0bc072 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/ILearnMoreResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/ILearnMoreResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface ILearnMoreResponse : IAccountStatus, IExpiry { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/ILogoutResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/ILogoutResponse.cs
index 56df577..7b047d3 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/ILogoutResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/ILogoutResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface ILogoutResponse : IAccountStatus { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IOutputIPAddressResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IOutputIPAddressResponse.cs
index d4d0519..e990e09 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IOutputIPAddressResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IOutputIPAddressResponse.cs
@@ -1,10 +1,11 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Account.Responses.Interfaces
{ /* ReSharper disable once InconsistentNaming */
+ ///
public interface IOutputIPAddressResponse : IErrorResponse, IEquatable, IPrintable
{
///
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IQrCodeResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IQrCodeResponse.cs
index e456e1e..ad9ab1e 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IQrCodeResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IQrCodeResponse.cs
@@ -3,8 +3,12 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IQrCodeResponse : IErrorResponse, IEquatable, IPrintable
{
+ ///
+ /// Image of the QR code in PNG format
+ ///
string? QrCodeImage { get; }
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/IRetrySynchronizeResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/IRetrySynchronizeResponse.cs
index 8403857..d19134c 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/IRetrySynchronizeResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IRetrySynchronizeResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface IRetrySynchronizeResponse : IAccountStatus { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/Interfaces/ITakeoverResponse.cs b/Src/ChatApi.WA.Account/Responses/Interfaces/ITakeoverResponse.cs
index 87234bc..4069035 100644
--- a/Src/ChatApi.WA.Account/Responses/Interfaces/ITakeoverResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/Interfaces/ITakeoverResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses.Interfaces
{
+ ///
public interface ITakeoverResponse : IAccountStatus { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/LearnMoreResponse.cs b/Src/ChatApi.WA.Account/Responses/LearnMoreResponse.cs
index fa3fb4f..4135a9d 100644
--- a/Src/ChatApi.WA.Account/Responses/LearnMoreResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/LearnMoreResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public class LearnMoreResponse : InstanceStatusResponse, ILearnMoreResponse { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/LogoutResponse.cs b/Src/ChatApi.WA.Account/Responses/LogoutResponse.cs
index 7227823..fd9a729 100644
--- a/Src/ChatApi.WA.Account/Responses/LogoutResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/LogoutResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public class LogoutResponse : InstanceStatusResponse, ILogoutResponse { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/OutputIPAddressResponse.cs b/Src/ChatApi.WA.Account/Responses/OutputIPAddressResponse.cs
index a9e50bc..236fa36 100644
--- a/Src/ChatApi.WA.Account/Responses/OutputIPAddressResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/OutputIPAddressResponse.cs
@@ -1,30 +1,37 @@
-using ChatApi.Core.Models;
-using ChatApi.Core.Helpers;
+using ChatApi.Core.Helpers;
+using ChatApi.Core.Models;
using ChatApi.WA.Account.Responses.Interfaces;
namespace ChatApi.WA.Account.Responses
{ /* ReSharper disable once InconsistentNaming */
+ ///
public sealed class OutputIPAddressResponse : Printable, IOutputIPAddressResponse
{
#region Properties
+ ///
public string? Address { get; set; }
+
+ ///
public string? ErrorMessage { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IOutputIPAddressResponse? other)
{
return other is not null && ErrorMessage == other.ErrorMessage && Address == other.Address;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IOutputIPAddressResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -34,13 +41,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (OutputIPAddressResponse? left, OutputIPAddressResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (OutputIPAddressResponse? left, OutputIPAddressResponse? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(Address), Address, shift);
diff --git a/Src/ChatApi.WA.Account/Responses/QrCodeResponse.cs b/Src/ChatApi.WA.Account/Responses/QrCodeResponse.cs
index ac15690..17ddcc2 100644
--- a/Src/ChatApi.WA.Account/Responses/QrCodeResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/QrCodeResponse.cs
@@ -4,27 +4,34 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public sealed class QrCodeResponse : Printable, IQrCodeResponse
{
#region Properties
+ ///
public string? QrCodeImage { get; set; }
+
+ ///
public string? ErrorMessage { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IQrCodeResponse? other)
{
return other is not null && ErrorMessage == other.ErrorMessage && QrCodeImage == other.QrCodeImage;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IQrCodeResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -33,13 +40,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (QrCodeResponse? left, QrCodeResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (QrCodeResponse? left, QrCodeResponse? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(QrCodeImage), string.IsNullOrWhiteSpace(QrCodeImage) ? string.Empty : QrCodeImage?.Substring(0,50) + "...", shift);
diff --git a/Src/ChatApi.WA.Account/Responses/RetrySynchronizeResponse.cs b/Src/ChatApi.WA.Account/Responses/RetrySynchronizeResponse.cs
index c9f77b6..32415c5 100644
--- a/Src/ChatApi.WA.Account/Responses/RetrySynchronizeResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/RetrySynchronizeResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public class RetrySynchronizeResponse : InstanceStatusResponse, IRetrySynchronizeResponse { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Account/Responses/TakeoverResponse.cs b/Src/ChatApi.WA.Account/Responses/TakeoverResponse.cs
index c697b14..47ca963 100644
--- a/Src/ChatApi.WA.Account/Responses/TakeoverResponse.cs
+++ b/Src/ChatApi.WA.Account/Responses/TakeoverResponse.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Account.Responses
{
+ ///
public class TakeoverResponse : InstanceStatusResponse, ITakeoverResponse { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Ban/BanOperations.cs b/Src/ChatApi.WA.Ban/BanOperations.cs
index fb53ae8..a89682a 100644
--- a/Src/ChatApi.WA.Ban/BanOperations.cs
+++ b/Src/ChatApi.WA.Ban/BanOperations.cs
@@ -9,18 +9,22 @@
namespace ChatApi.WA.Ban
{
+ ///
public sealed class BanOperations : IBanOperations
{
private readonly IWhatsAppConnect _connect;
+ ///
public BanOperations(IWhatsAppConnect connect) => _connect = connect;
#region Ban API
#region CheckBan
+ ///
public IChatApiResponse CheckBan(ICheckBanRequest checkBan, IResponseSettings? responseSettings = null) =>
_connect.Post(Resources.CheckBan, checkBan.Serialize(), responseSettings);
+ ///
public Task> CheckBanAsync(ICheckBanRequest checkBan, IResponseSettings? responseSettings = null) =>
_connect.PostAsync(Resources.CheckBan, checkBan.Serialize(), responseSettings);
@@ -28,8 +32,10 @@ public sealed class BanOperations : IBanOperations
#region GetBanSettings
+ ///
public IChatApiResponse GetBanSettings(IResponseSettings? responseSettings = null) =>
_connect.Get(Resources.BanSettings, responseSettings);
+ ///
public Task> GetBanSettingsAsync(IResponseSettings? responseSettings = null) =>
_connect.GetAsync(Resources.BanSettings, responseSettings);
@@ -37,8 +43,10 @@ public sealed class BanOperations : IBanOperations
#region SetBanSettings
+ ///
public IChatApiResponse SetBanSettings(IBanSettingsRequest banSettings, IResponseSettings? responseSettings = null) =>
_connect.Post(Resources.BanSettings, banSettings.Serialize(), responseSettings);
+ ///
public Task> SetBanSettingsAsync(IBanSettingsRequest banSettings, IResponseSettings? responseSettings = null) =>
_connect.PostAsync(Resources.BanSettings, banSettings.Serialize(), responseSettings);
diff --git a/Src/ChatApi.WA.Ban/ChatApi.WA.Ban.csproj b/Src/ChatApi.WA.Ban/ChatApi.WA.Ban.csproj
index 88764a2..2c31844 100644
--- a/Src/ChatApi.WA.Ban/ChatApi.WA.Ban.csproj
+++ b/Src/ChatApi.WA.Ban/ChatApi.WA.Ban.csproj
@@ -1,48 +1,71 @@
- netstandard2.0
- latest
+
+
enable
+ 9
+ netstandard2.0
+
+
true
+ true
+ bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
+
+
ChatApi.WA.Ban
Roman Vorontsov
- ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
-
- false
- https://github.com/Zodt/ChatApi
- GitHub
- ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp
-
+ en
ChatApi.png
+ 1.0.1-alpha
+ ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp
+
+ ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
+
+
+ 1. Refactoring code
+ 2. Add xml doc
+
+
+
MIT
- en
+ false
+
+
+ GitHub
+ https://github.com/Zodt/ChatApi
+
-
- ResXFileCodeGenerator
- Resources.Designer.cs
-
-
-
-
- True
- True
- Resources.resx
-
-
+
+
-
-
-
+
+
+ True
+ True
+ Resources.resx
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
-
-
- True
-
-
+
+
+ True
+
+
+
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Ban/IBanOperations.cs b/Src/ChatApi.WA.Ban/IBanOperations.cs
index f35de8e..30da87e 100644
--- a/Src/ChatApi.WA.Ban/IBanOperations.cs
+++ b/Src/ChatApi.WA.Ban/IBanOperations.cs
@@ -5,6 +5,7 @@
namespace ChatApi.WA.Ban
{
+ ///
public interface IBanOperations
{
///
diff --git a/Src/ChatApi.WA.Ban/Models/BanSettings.cs b/Src/ChatApi.WA.Ban/Models/BanSettings.cs
index 5a3f251..1583c29 100644
--- a/Src/ChatApi.WA.Ban/Models/BanSettings.cs
+++ b/Src/ChatApi.WA.Ban/Models/BanSettings.cs
@@ -4,18 +4,25 @@
namespace ChatApi.WA.Ban.Models
{
+ ///
public abstract class BanSettings : Printable, IBanSettings
{
#region Properties
+ ///
public bool? IsSet { get; set; }
+
+ ///
public string? BanPhoneMask { get; set; }
+
+ ///
public string? PreBanMessage { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IBanSettings? other)
{
return other is not null &&
@@ -24,11 +31,13 @@ public bool Equals(IBanSettings? other)
PreBanMessage == other.PreBanMessage;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IBanSettings self && Equals(self);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -40,13 +49,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (BanSettings? left, BanSettings? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (BanSettings? left, BanSettings? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(IsSet), IsSet, shift);
diff --git a/Src/ChatApi.WA.Ban/Models/Interfaces/IBanSettings.cs b/Src/ChatApi.WA.Ban/Models/Interfaces/IBanSettings.cs
index a7fb004..4bad847 100644
--- a/Src/ChatApi.WA.Ban/Models/Interfaces/IBanSettings.cs
+++ b/Src/ChatApi.WA.Ban/Models/Interfaces/IBanSettings.cs
@@ -4,6 +4,7 @@
namespace ChatApi.WA.Ban.Models.Interfaces
{
+ ///
public interface IBanSettings : IEquatable, IPrintable
{
///
diff --git a/Src/ChatApi.WA.Ban/Requests/BanSettingRequest.cs b/Src/ChatApi.WA.Ban/Requests/BanSettingRequest.cs
index 64b68ff..8f67fac 100644
--- a/Src/ChatApi.WA.Ban/Requests/BanSettingRequest.cs
+++ b/Src/ChatApi.WA.Ban/Requests/BanSettingRequest.cs
@@ -3,5 +3,6 @@
namespace ChatApi.WA.Ban.Requests
{
+ ///
public class BanSettingRequest : BanSettings, IBanSettingsRequest { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Ban/Requests/CheckBanRequest.cs b/Src/ChatApi.WA.Ban/Requests/CheckBanRequest.cs
index 5bbdf1b..961bea6 100644
--- a/Src/ChatApi.WA.Ban/Requests/CheckBanRequest.cs
+++ b/Src/ChatApi.WA.Ban/Requests/CheckBanRequest.cs
@@ -3,27 +3,42 @@
namespace ChatApi.WA.Ban.Requests
{
+ ///
public class CheckBanRequest : ICheckBanRequest
{
+ #region Properties
+
+ ///
public string? Phone { get; set; }
+ #endregion
+
+ #region Equatable
+
+ ///
public bool Equals(ICheckBanRequest? other)
{
return other is not null &&
- Phone == other.Phone;
+ Phone == other.Phone;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is ICheckBanRequest self && Equals(self);
}
+ ///
public override int GetHashCode()
{
return Phone != null ? Phone.GetHashCode() : 0;
}
+ ///
public static bool operator == (CheckBanRequest? left, CheckBanRequest? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (CheckBanRequest? left, CheckBanRequest? right) => !EquatableHelper.IsEquatable(left, right);
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Ban/Requests/Interfaces/IBanSettingsRequest.cs b/Src/ChatApi.WA.Ban/Requests/Interfaces/IBanSettingsRequest.cs
index 1d1173e..0bad68c 100644
--- a/Src/ChatApi.WA.Ban/Requests/Interfaces/IBanSettingsRequest.cs
+++ b/Src/ChatApi.WA.Ban/Requests/Interfaces/IBanSettingsRequest.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Ban.Requests.Interfaces
{
+ ///
public interface IBanSettingsRequest : IBanSettings { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Ban/Requests/Interfaces/ICheckBanRequest.cs b/Src/ChatApi.WA.Ban/Requests/Interfaces/ICheckBanRequest.cs
index 0fe3e75..a4264fa 100644
--- a/Src/ChatApi.WA.Ban/Requests/Interfaces/ICheckBanRequest.cs
+++ b/Src/ChatApi.WA.Ban/Requests/Interfaces/ICheckBanRequest.cs
@@ -3,5 +3,6 @@
namespace ChatApi.WA.Ban.Requests.Interfaces
{
+ ///
public interface ICheckBanRequest : IPhone, IEquatable { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Ban/Responses/BanSettingsResponse.cs b/Src/ChatApi.WA.Ban/Responses/BanSettingsResponse.cs
index d120d1a..83ed1ec 100644
--- a/Src/ChatApi.WA.Ban/Responses/BanSettingsResponse.cs
+++ b/Src/ChatApi.WA.Ban/Responses/BanSettingsResponse.cs
@@ -3,8 +3,10 @@
namespace ChatApi.WA.Ban.Responses
{
+ ///
public sealed class BanSettingsResponse : BanSettings, IBanSettingsResponse
{
+ ///
public string? ErrorMessage { get; set; }
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Ban/Responses/CheckBanResponse.cs b/Src/ChatApi.WA.Ban/Responses/CheckBanResponse.cs
index e508190..9904f31 100644
--- a/Src/ChatApi.WA.Ban/Responses/CheckBanResponse.cs
+++ b/Src/ChatApi.WA.Ban/Responses/CheckBanResponse.cs
@@ -4,14 +4,24 @@
namespace ChatApi.WA.Ban.Responses
{
+ ///
public sealed class CheckBanResponse : Printable, ICheckBanResponse
{
#region Properties
+ ///
public string? Phone { get; set; }
+
+ ///
public bool? IsBanned { get; set; }
+
+ ///
public string? Message { get; set; }
+
+ ///
public string? BanPhoneMask { get; set; }
+
+ ///
public string? ErrorMessage { get; set; }
@@ -19,6 +29,7 @@ public sealed class CheckBanResponse : Printable, ICheckBanResponse
#region Equatable
+ ///
public bool Equals(ICheckBanResponse? other)
{
return other is not null &&
@@ -29,11 +40,13 @@ public bool Equals(ICheckBanResponse? other)
BanPhoneMask == other.BanPhoneMask;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is ICheckBanResponse other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -47,13 +60,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (CheckBanResponse? left, CheckBanResponse? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (CheckBanResponse? left, CheckBanResponse? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(Phone), Phone, shift);
diff --git a/Src/ChatApi.WA.Ban/Responses/Interfaces/IBanSettingsResponse.cs b/Src/ChatApi.WA.Ban/Responses/Interfaces/IBanSettingsResponse.cs
index 8bb2ede..0a9e97b 100644
--- a/Src/ChatApi.WA.Ban/Responses/Interfaces/IBanSettingsResponse.cs
+++ b/Src/ChatApi.WA.Ban/Responses/Interfaces/IBanSettingsResponse.cs
@@ -3,5 +3,6 @@
namespace ChatApi.WA.Ban.Responses.Interfaces
{
+ ///
public interface IBanSettingsResponse : IErrorResponse, IBanSettings { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Ban/Responses/Interfaces/ICheckBanResponse.cs b/Src/ChatApi.WA.Ban/Responses/Interfaces/ICheckBanResponse.cs
index ae8cddc..7314fb5 100644
--- a/Src/ChatApi.WA.Ban/Responses/Interfaces/ICheckBanResponse.cs
+++ b/Src/ChatApi.WA.Ban/Responses/Interfaces/ICheckBanResponse.cs
@@ -1,17 +1,27 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Ban.Responses.Interfaces
{
+ ///
public interface ICheckBanResponse : IErrorResponse, IPhone, IEquatable, IPrintable
{
+ ///
+ /// Blocking indicator
+ ///
[JsonProperty("banned", NullValueHandling = NullValueHandling.Ignore)]
bool? IsBanned { get; set; }
+ ///
+ /// Message received by the owner of the blocked phone number
+ ///
[JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)]
string? Message { get; set; }
+ ///
+ /// Property for a test regular expression
+ ///
[JsonProperty("banPhoneMask", NullValueHandling = NullValueHandling.Ignore)]
string? BanPhoneMask { get; set; }
}
diff --git a/Src/ChatApi.WA.Dialogs/ChatApi.WA.Dialogs.csproj b/Src/ChatApi.WA.Dialogs/ChatApi.WA.Dialogs.csproj
index 1b782b5..3729a6b 100644
--- a/Src/ChatApi.WA.Dialogs/ChatApi.WA.Dialogs.csproj
+++ b/Src/ChatApi.WA.Dialogs/ChatApi.WA.Dialogs.csproj
@@ -1,58 +1,71 @@
- netstandard2.0
- 9
+
+
enable
+ 9
+ netstandard2.0
+
+
true
+ true
+ bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml
+
+
ChatApi.WA.Dialogs
Roman Vorontsov
- ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
-
- false
- https://github.com/Zodt/ChatApi
- GitHub
+ en
+ ChatApi.png
+ 1.0.1-alpha
ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp
-
+
+ ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
+
+
+ 1. Refactoring code
+ 2. Add xml doc
+
+
+
MIT
- ChatApi.png
- en
-
+ false
-
-
-
+
+ GitHub
+ https://github.com/Zodt/ChatApi
-
-
- ResXFileCodeGenerator
- Resourse.Designer.cs
-
-
-
-
+
-
- True
- True
- Resourse.resx
-
-
-
-
-
-
-
+
+
-
-
-
-
- True
-
-
+
+
+ True
+ True
+ Resourse.resx
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+ True
+
+
+
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/DialogOperations.cs b/Src/ChatApi.WA.Dialogs/DialogOperations.cs
index 4389575..8965413 100644
--- a/Src/ChatApi.WA.Dialogs/DialogOperations.cs
+++ b/Src/ChatApi.WA.Dialogs/DialogOperations.cs
@@ -12,13 +12,17 @@
namespace ChatApi.WA.Dialogs
{
+ ///
public sealed class DialogOperations : IDialogOperations
{
private readonly IWhatsAppConnect _connect;
+ ///
public Lazy GroupOperations { get; }
+ ///
public Lazy UserInterfaceOperations { get; }
+ ///
public DialogOperations(IWhatsAppConnect connect)
{
_connect = connect;
@@ -31,31 +35,37 @@ public DialogOperations(IWhatsAppConnect connect)
#region GetDialog
+ ///
public IChatApiResponse GetDialog(IDialogRequest dialogRequest, IResponseSettings? responseSettings = null) =>
- _connect.Get(Resourse.GetDialog, responseSettings, dialogRequest.Parameters);
+ _connect.Get(Resources.GetDialog, responseSettings, dialogRequest.Parameters);
+ ///
public Task> GetDialogAsync(IDialogRequest dialogRequest, IResponseSettings? responseSettings = null) =>
- _connect.GetAsync(Resourse.GetDialog, responseSettings, dialogRequest.Parameters);
+ _connect.GetAsync(Resources.GetDialog, responseSettings, dialogRequest.Parameters);
#endregion
#region GetDialogs
+ ///
public IChatApiResponse GetDialogs(IDialogCollectionRequest dialogCollectionRequest, IResponseSettings? responseSettings = null) =>
- _connect.Get(Resourse.GetDialogs, responseSettings, dialogCollectionRequest.Parameters);
+ _connect.Get(Resources.GetDialogs, responseSettings, dialogCollectionRequest.Parameters);
+ ///
public Task> GetDialogsAsync(IDialogCollectionRequest dialogCollectionRequest, IResponseSettings? responseSettings = null) =>
- _connect.GetAsync(Resourse.GetDialogs, responseSettings, dialogCollectionRequest.Parameters);
+ _connect.GetAsync(Resources.GetDialogs, responseSettings, dialogCollectionRequest.Parameters);
#endregion
#region RemoveDialog
+ ///
public IChatApiResponse RemoveDialog(IRemoveDialogRequest removeDialog, IResponseSettings? responseSettings = null) =>
- _connect.Post(Resourse.RemoveDialog, removeDialog.Serialize(), responseSettings);
+ _connect.Post(Resources.RemoveDialog, removeDialog.Serialize(), responseSettings);
+ ///
public Task> RemoveDialogAsync(IRemoveDialogRequest removeDialog, IResponseSettings? responseSettings = null) =>
- _connect.PostAsync(Resourse.RemoveDialog, removeDialog.Serialize(), responseSettings);
+ _connect.PostAsync(Resources.RemoveDialog, removeDialog.Serialize(), responseSettings);
#endregion
diff --git a/Src/ChatApi.WA.Dialogs/Helpers/Abstract/MessageRequest.cs b/Src/ChatApi.WA.Dialogs/Helpers/Abstract/MessageRequest.cs
index 3bf90cb..9789f46 100644
--- a/Src/ChatApi.WA.Dialogs/Helpers/Abstract/MessageRequest.cs
+++ b/Src/ChatApi.WA.Dialogs/Helpers/Abstract/MessageRequest.cs
@@ -4,11 +4,22 @@
namespace ChatApi.WA.Dialogs.Helpers.Abstract
{
+ ///
public abstract class MessageRequest : IMessageRequest, IEquatable
{
+ #region Properties
+
+ ///
public string? Phone { get; set; }
+
+ ///
public string? ChatId { get; set; }
+ #endregion
+
+ #region Equatable
+
+ ///
public bool Equals(IMessageRequest? other)
{
return
@@ -17,8 +28,10 @@ other is not null &&
Phone == other.Phone;
}
+ ///
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is IMessageRequest self && Equals(self);
+ ///
public override int GetHashCode()
{
unchecked
@@ -28,7 +41,11 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (MessageRequest? left, MessageRequest? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (MessageRequest? left, MessageRequest? right) => !EquatableHelper.IsEquatable(left, right);
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Helpers/ChatIdSplitter.cs b/Src/ChatApi.WA.Dialogs/Helpers/ChatIdSplitter.cs
index 4b90f09..b40ca1f 100644
--- a/Src/ChatApi.WA.Dialogs/Helpers/ChatIdSplitter.cs
+++ b/Src/ChatApi.WA.Dialogs/Helpers/ChatIdSplitter.cs
@@ -33,7 +33,7 @@ public ChatIdSplitter(string? chatId)
return null;
if (ChatIds?.Count != 2 || !long.TryParse(ChatIds[1], out var dateUtc))
return null;
- return UnixDateTimeConverter.ConvertRead(dateUtc);
+ return UnixDateTimeConverter.Convert(dateUtc);
}
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Helpers/Collections/ChatIdsCollection.cs b/Src/ChatApi.WA.Dialogs/Helpers/Collections/ChatIdsCollection.cs
index 5a113e7..6328f2e 100644
--- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/ChatIdsCollection.cs
+++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/ChatIdsCollection.cs
@@ -2,5 +2,8 @@
namespace ChatApi.WA.Dialogs.Helpers.Collections
{
+ ///
+ /// The collection's unique identifier of chats
+ ///
public class ChatIdsCollection : WhatsAppApiCollection { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Helpers/Collections/DialogCollection.cs b/Src/ChatApi.WA.Dialogs/Helpers/Collections/DialogCollection.cs
index ebb8c48..b7b2697 100644
--- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/DialogCollection.cs
+++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/DialogCollection.cs
@@ -3,5 +3,6 @@
namespace ChatApi.WA.Dialogs.Helpers.Collections
{
+ ///
public class DialogCollection : WhatsAppApiCollection { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Helpers/Collections/LabelCollection.cs b/Src/ChatApi.WA.Dialogs/Helpers/Collections/LabelCollection.cs
index 0113305..20b1356 100644
--- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/LabelCollection.cs
+++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/LabelCollection.cs
@@ -3,5 +3,6 @@
namespace ChatApi.WA.Dialogs.Helpers.Collections
{
+ ///
public class LabelCollection : WhatsAppApiCollection { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Helpers/Collections/ParticipantsCollection.cs b/Src/ChatApi.WA.Dialogs/Helpers/Collections/ParticipantsCollection.cs
index 3763b06..3ad4a8f 100644
--- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/ParticipantsCollection.cs
+++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/ParticipantsCollection.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Dialogs.Helpers.Collections
{
+ ///
public class ParticipantsCollection : WhatsAppApiCollection { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Helpers/Collections/PhonesCollection.cs b/Src/ChatApi.WA.Dialogs/Helpers/Collections/PhonesCollection.cs
index 7a5ad20..9092956 100644
--- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/PhonesCollection.cs
+++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/PhonesCollection.cs
@@ -2,5 +2,6 @@
namespace ChatApi.WA.Dialogs.Helpers.Collections
{
+ ///
public class PhonesCollection : WhatsAppApiCollection { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Models/AdditionalChatInfo.cs b/Src/ChatApi.WA.Dialogs/Models/AdditionalChatInfo.cs
index 07e1c6b..e38daa1 100644
--- a/Src/ChatApi.WA.Dialogs/Models/AdditionalChatInfo.cs
+++ b/Src/ChatApi.WA.Dialogs/Models/AdditionalChatInfo.cs
@@ -6,18 +6,25 @@
namespace ChatApi.WA.Dialogs.Models
{
+ ///
public sealed class AdditionalChatInfo : Printable, IAdditionalChatInfo
{
#region Properties
+ ///
public bool? IsGroup { get; set; }
+
+ ///
public string? GroupInviteLink { get; set; }
+
+ ///
public ParticipantsCollection? Participants { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IAdditionalChatInfo? other)
{
return
@@ -27,11 +34,13 @@ other is not null &&
Participants == other.Participants;
}
+ ///
public override bool Equals(object? obj)
{
return ReferenceEquals(this, obj) || obj is IAdditionalChatInfo other && Equals(other);
}
+ ///
public override int GetHashCode()
{
unchecked
@@ -43,15 +52,23 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (AdditionalChatInfo? left, AdditionalChatInfo? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (AdditionalChatInfo? left, AdditionalChatInfo? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
+
+ #region Printable
+
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(IsGroup), IsGroup, shift);
AddMember(nameof(GroupInviteLink), GroupInviteLink, shift);
AddMember(nameof(Participants), Participants?.PrintMembers(3, shift), shift);
}
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Models/DialogStatusOperation.cs b/Src/ChatApi.WA.Dialogs/Models/DialogStatusOperation.cs
index a5eccd8..2a809bd 100644
--- a/Src/ChatApi.WA.Dialogs/Models/DialogStatusOperation.cs
+++ b/Src/ChatApi.WA.Dialogs/Models/DialogStatusOperation.cs
@@ -1,23 +1,29 @@
using System;
-
using ChatApi.Core.Helpers;
using ChatApi.Core.Models;
using ChatApi.WA.Dialogs.Models.Interfaces;
namespace ChatApi.WA.Dialogs.Models
{
+ ///
public abstract class DialogStatusOperation : Printable, IDialogStatusOperation
{
#region Properties
+ ///
public bool? Success { get; set; }
+
+ ///
public string? Result { get; set; }
+
+ ///
public string? ErrorMessage { get; set; }
#endregion
#region Equatable
+ ///
public bool Equals(IDialogStatusOperation? other)
{
return other is not null && Success == other.Success &&
@@ -25,8 +31,10 @@ public bool Equals(IDialogStatusOperation? other)
string.Equals(ErrorMessage, other.ErrorMessage, StringComparison.Ordinal);
}
+ ///
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is IDialogStatusOperation self && Equals(self);
+ ///
public override int GetHashCode()
{
unchecked
@@ -38,13 +46,16 @@ public override int GetHashCode()
}
}
+ ///
public static bool operator == (DialogStatusOperation? left, DialogStatusOperation? right) => EquatableHelper.IsEquatable(left, right);
+ ///
public static bool operator != (DialogStatusOperation? left, DialogStatusOperation? right) => !EquatableHelper.IsEquatable(left, right);
#endregion
#region Printable
+ ///
protected override void PrintContent(int shift)
{
AddMember(nameof(Success), Success, shift);
diff --git a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IAdditionalChatInfo.cs b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IAdditionalChatInfo.cs
index f0c9600..bc0a60c 100644
--- a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IAdditionalChatInfo.cs
+++ b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IAdditionalChatInfo.cs
@@ -5,6 +5,7 @@
namespace ChatApi.WA.Dialogs.Models.Interfaces
{
+ ///
public interface IAdditionalChatInfo : IEquatable, IPrintable
{
///
diff --git a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IDialogSendStatus.cs b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IDialogSendStatus.cs
index d566742..de53aa0 100644
--- a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IDialogSendStatus.cs
+++ b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IDialogSendStatus.cs
@@ -2,16 +2,17 @@
namespace ChatApi.WA.Dialogs.Models.Interfaces
{
+ ///
public interface IDialogSendStatus
{
///
- /// Start or stop status.
+ /// Start or stop status.
///
[JsonProperty("on", NullValueHandling = NullValueHandling.Ignore)]
bool? EnableStatusDisplay { get; set; }
///
- /// Time in seconds. Use if you want set status and cancel it automatically after N seconds.
+ /// Time in seconds. Use if you want set status and cancel it automatically after N seconds.
///
[JsonProperty("duration", NullValueHandling = NullValueHandling.Ignore)]
uint? Duration { get; set; }
diff --git a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IDialogStatusOperation.cs b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IDialogStatusOperation.cs
index 3e7ab91..a24a186 100644
--- a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IDialogStatusOperation.cs
+++ b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IDialogStatusOperation.cs
@@ -3,5 +3,6 @@
namespace ChatApi.WA.Dialogs.Models.Interfaces
{
+ ///
public interface IDialogStatusOperation : IOperationResponse, IEquatable, IPrintable { }
}
\ No newline at end of file
diff --git a/Src/ChatApi.WA.Dialogs/Models/Interfaces/ILabel.cs b/Src/ChatApi.WA.Dialogs/Models/Interfaces/ILabel.cs
index abc6f80..9a4926e 100644
--- a/Src/ChatApi.WA.Dialogs/Models/Interfaces/ILabel.cs
+++ b/Src/ChatApi.WA.Dialogs/Models/Interfaces/ILabel.cs
@@ -1,17 +1,27 @@
using System;
-using Newtonsoft.Json;
using ChatApi.Core.Models.Interfaces;
+using Newtonsoft.Json;
namespace ChatApi.WA.Dialogs.Models.Interfaces
{
+ ///