From 7f44cb7876e11dfbb8d383fa482ded970f9207e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=92=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=BD=D1=86=D0=BE=D0=B2?= Date: Mon, 1 Mar 2021 21:48:27 +0300 Subject: [PATCH] Add xml Documentation --- .gitignore | 2 +- .../Operations/CreateChatApiInstance.md | 2 +- .../Operations/GetChatApiInstances.md | 2 +- {Src => Images}/ChatApi.png | Bin Src/ChatApi.Core/ChatApi.Core.csproj | 89 ++++++++++------ .../Collections/WhatsAppApiCollection.cs | 89 +++++++++++++--- .../Interfaces/IChatApiInstanceConnect.cs | 1 + .../Connect/Interfaces/IConnect.cs | 1 + .../Connect/Interfaces/IWhatsAppConnect.cs | 10 ++ Src/ChatApi.Core/Connect/WhatsAppConnect.cs | 19 +++- .../InterfaceCollectionConverter.cs | 4 + .../Converters/InterfacesConverter.cs | 3 + .../Converters/NegativeBoolConverter.cs | 3 + .../Converters/PhoneCollectionConverter.cs | 3 + Src/ChatApi.Core/Converters/PhoneConverter.cs | 7 +- .../Converters/UnixDateTimeConverter.cs | 25 ++++- Src/ChatApi.Core/Helpers/ConversionHelper.cs | 6 +- Src/ChatApi.Core/Helpers/EquatableHelper.cs | 2 + Src/ChatApi.Core/Helpers/HttpRequests.cs | 9 ++ Src/ChatApi.Core/Models/ActionType.cs | 12 +++ .../Models/ChatApiStatusOperation.cs | 11 ++ .../Models/Interfaces/IChatApiKey.cs | 4 + Src/ChatApi.Core/Models/Interfaces/IChatId.cs | 1 + .../Models/Interfaces/IErrorResponse.cs | 3 + .../Models/Interfaces/IMessageRequest.cs | 1 + .../Models/Interfaces/IOperationResponse.cs | 20 +--- .../Models/Interfaces/IOperationResult.cs | 15 +++ .../Models/Interfaces/IOperationSuccess.cs | 15 +++ .../Models/Interfaces/IParameters.cs | 4 + Src/ChatApi.Core/Models/Interfaces/IPhone.cs | 1 + .../Models/Interfaces/IPrintable.cs | 77 ++++++++++++++ Src/ChatApi.Core/Models/MessageType.cs | 25 ++++- Src/ChatApi.Core/Models/Printable.cs | 29 ++++-- Src/ChatApi.Core/Models/Protocol.cs | 3 + Src/ChatApi.Core/Response/ChatApiResponse.cs | 25 +++-- .../Response/Errors/ActionError.cs | 4 + .../Response/Errors/ChatApiBadResponse.cs | 7 ++ .../Response/Errors/ChatApiResultError.cs | 7 ++ .../Response/Errors/WhatsAppBadResponse.cs | 6 -- .../Response/Errors/WhatsAppResultError.cs | 6 -- .../Response/Interfaces/IChatApiResponse.cs | 15 +++ .../Response/Interfaces/IResponseSettings.cs | 1 + .../Response/WhatsAppResponseSettings.cs | 6 ++ .../ChatApi.Instances.csproj | 84 ++++++++++------ .../ChatApiInstanceOperations.cs | 12 ++- .../Collections/ChatApiInstanceCollection.cs | 1 + .../Connect/ChatApiInstanceConnect.cs | 3 + .../IChatApiInstanceOperations.cs | 3 +- .../Models/ChatApiCreateInstanceResult.cs | 8 ++ .../Models/ChatApiInstance.cs | 26 ++++- .../Models/ChatApiInstanceParameters.cs | 61 +++++++++++ .../Models/ChatApiInstanceType.cs | 10 ++ .../IChatApiCreateInstanceResult.cs | 7 ++ .../Models/Interfaces/IChatApiInstance.cs | 35 ++++--- .../Models/Interfaces/IChatApiInstanceId.cs | 6 ++ .../Interfaces/IChatApiInstanceParameters.cs | 41 ++------ .../Models/Interfaces/IChatApiInstanceType.cs | 16 +++ .../Models/Interfaces/IChatApiInstanceUrl.cs | 4 + .../Requests/ChatApiCreateInstanceRequest.cs | 21 ++-- .../Requests/ChatApiRemoveInstanceRequest.cs | 10 ++ .../IChatApiCreateInstanceRequest.cs | 14 +-- .../IChatApiRemoveInstanceRequest.cs | 4 + .../ChatApiCreateInstanceResponse.cs | 8 ++ .../ChatApiInstanceCollectionResponse.cs | 11 +- .../ChatApiRemoveInstanceResponse.cs | 8 ++ .../IChatApiCreateInstanceResponse.cs | 6 +- .../IChatApiInstanceCollectionResponse.cs | 6 +- .../IChatApiRemoveInstanceResponse.cs | 4 + Src/ChatApi.WA.Account/AccountOperation.cs | 34 +++++-- .../ChatApi.WA.Account.csproj | 85 ++++++++++------ Src/ChatApi.WA.Account/IAccountOperation.cs | 1 + .../Models/AccountSettings.cs | 23 +++++ .../Models/AccountStatusData.cs | 17 +++- .../Models/AccountStatusType.cs | 24 +++++ .../Models/DeviceCharacteristic.cs | 10 ++ .../Models/InstanceConnectionStatusType.cs | 11 ++ .../Models/InstanceStatus.cs | 10 ++ .../Models/InstanceStatusActionType.cs | 11 ++ .../Models/InstanceStatusType.cs | 23 +++++ .../Models/Interfaces/IAccountSettings.cs | 3 +- .../Models/Interfaces/IAccountStatus.cs | 1 + .../Models/Interfaces/IAccountStatusData.cs | 5 +- .../Interfaces/IDeviceCharacteristic.cs | 1 + .../Models/Interfaces/IExpiry.cs | 1 + .../Models/Interfaces/IInstanceStatus.cs | 3 +- .../Models/Interfaces/ILearnMore.cs | 1 + .../Models/Interfaces/ILogout.cs | 1 + .../Models/Interfaces/IRetry.cs | 1 + .../Models/Interfaces/ITakeover.cs | 1 + .../Requests/AccountSettingsRequest.cs | 1 + .../Requests/AccountStatusRequest.cs | 12 ++- .../Requests/ChangeAccountNameRequest.cs | 9 +- .../Requests/ChangeAccountStatusRequest.cs | 9 +- .../Interfaces/IAccountSettingsRequest.cs | 1 + .../Interfaces/IAccountStatusRequest.cs | 3 +- .../Interfaces/IChangeAccountNameRequest.cs | 1 + .../Interfaces/IChangeAccountStatusRequest.cs | 1 + .../Responses/AccountInformationResponse.cs | 14 +++ .../Responses/AccountRebootResponse.cs | 1 + .../Responses/AccountSettingsResponse.cs | 8 ++ .../Responses/AccountStatusResponse.cs | 17 +++- .../Responses/AdditionInformationStatus.cs | 12 +++ .../Responses/ExpiryResponse.cs | 1 + .../Responses/InstanceStatusResponse.cs | 11 ++ .../Interfaces/IAccountInformationResponse.cs | 3 +- .../Interfaces/IAccountRebootResponse.cs | 1 + .../Interfaces/IAccountSettingsResponse.cs | 1 + .../Interfaces/IAccountStatusResponse.cs | 1 + .../Interfaces/IAdditionInformationStatus.cs | 9 +- .../Interfaces/IChangeAccountNameResponse.cs | 7 +- .../IChangeAccountStatusResponse.cs | 1 + .../Responses/Interfaces/IExpiryResponse.cs | 1 + .../Interfaces/IInstanceStatusResponse.cs | 1 + .../Interfaces/ILearnMoreResponse.cs | 1 + .../Responses/Interfaces/ILogoutResponse.cs | 1 + .../Interfaces/IOutputIPAddressResponse.cs | 3 +- .../Responses/Interfaces/IQrCodeResponse.cs | 3 + .../Interfaces/IRetrySynchronizeResponse.cs | 1 + .../Responses/Interfaces/ITakeoverResponse.cs | 1 + .../Responses/LearnMoreResponse.cs | 1 + .../Responses/LogoutResponse.cs | 1 + .../Responses/OutputIPAddressResponse.cs | 14 ++- .../Responses/QrCodeResponse.cs | 10 ++ .../Responses/RetrySynchronizeResponse.cs | 1 + .../Responses/TakeoverResponse.cs | 1 + Src/ChatApi.WA.Ban/BanOperations.cs | 8 ++ Src/ChatApi.WA.Ban/ChatApi.WA.Ban.csproj | 85 ++++++++++------ Src/ChatApi.WA.Ban/IBanOperations.cs | 1 + Src/ChatApi.WA.Ban/Models/BanSettings.cs | 12 +++ .../Models/Interfaces/IBanSettings.cs | 1 + .../Requests/BanSettingRequest.cs | 1 + .../Requests/CheckBanRequest.cs | 17 +++- .../Interfaces/IBanSettingsRequest.cs | 1 + .../Requests/Interfaces/ICheckBanRequest.cs | 1 + .../Responses/BanSettingsResponse.cs | 2 + .../Responses/CheckBanResponse.cs | 16 +++ .../Interfaces/IBanSettingsResponse.cs | 1 + .../Responses/Interfaces/ICheckBanResponse.cs | 7 +- .../ChatApi.WA.Dialogs.csproj | 95 ++++++++++-------- Src/ChatApi.WA.Dialogs/DialogOperations.cs | 22 ++-- .../Helpers/Abstract/MessageRequest.cs | 17 ++++ .../Helpers/ChatIdSplitter.cs | 2 +- .../Helpers/Collections/ChatIdsCollection.cs | 2 + .../Helpers/Collections/DialogCollection.cs | 2 + .../Helpers/Collections/LabelCollection.cs | 2 + .../Collections/ParticipantsCollection.cs | 2 + .../Helpers/Collections/PhonesCollection.cs | 2 + .../Models/AdditionalChatInfo.cs | 17 ++++ .../Models/DialogStatusOperation.cs | 13 ++- .../Models/Interfaces/IAdditionalChatInfo.cs | 1 + .../Models/Interfaces/IDialogSendStatus.cs | 5 +- .../Interfaces/IDialogStatusOperation.cs | 1 + .../Models/Interfaces/ILabel.cs | 7 +- .../Interfaces/IOperationMessageResult.cs | 3 + .../Models/Interfaces/IParticipantRequest.cs | 19 ++-- Src/ChatApi.WA.Dialogs/Models/Label.cs | 40 ++++++-- .../Models/OperationMessageResult.cs | 8 ++ .../Models/ParticipantRequest.cs | 19 ++++ .../Operations/GroupOperations.cs | 21 ++-- .../Operations/GroupParticipantOperations.cs | 26 +++-- .../Interfaces/IGroupParticipantOperations.cs | 1 + .../Interfaces/IWhatsAppBusinessOperations.cs | 1 + .../Operations/UserInterfaceOperations.cs | 40 +++++--- .../Operations/WhatsAppBusinessOperations.cs | 40 +++++--- ...urse.Designer.cs => Resources.Designer.cs} | 6 +- .../{Resourse.resx => Resources.resx} | 0 .../Requests/AddGroupParticipantRequest.cs | 1 + .../Requests/CreateGroupRequest.cs | 13 +++ .../Requests/DemoteGroupParticipantRequest.cs | 1 + .../Requests/DialogCollectionRequest.cs | 38 +++++-- .../Requests/DialogRequest.cs | 18 +++- .../Interfaces/IAddGroupParticipantRequest.cs | 1 + .../IDemoteGroupParticipantRequest.cs | 1 + .../Interfaces/IDialogCollectionRequest.cs | 1 + .../Requests/Interfaces/IDialogRequest.cs | 3 +- .../Requests/Interfaces/IJoinGroupRequest.cs | 1 + .../Requests/Interfaces/ILeaveGroupRequest.cs | 1 + .../IPromoteGroupParticipantRequest.cs | 1 + .../Interfaces/IRemoveDialogRequest.cs | 1 + .../IRemoveGroupParticipantRequest.cs | 1 + .../Requests/JoinGroupRequest.cs | 16 +++ .../Requests/LeaveGroupRequest.cs | 1 + .../PromoteGroupParticipantRequest.cs | 1 + .../Requests/RemoveDialogRequest.cs | 1 + .../Requests/RemoveGroupParticipantRequest.cs | 1 + .../Requests/UI/ChatOperationsRequest.cs | 18 +++- .../UI/DialogSendStatusOperationsRequest.cs | 21 +++- .../UI/Interfaces/IChatOperationsRequest.cs | 1 + .../IDialogSendStatusOperationsRequest.cs | 1 + .../UI/Interfaces/ILabelCollectionRequest.cs | 1 + .../UI/Interfaces/ILabelCreateRequest.cs | 3 + .../UI/Interfaces/ILabelOperationsRequest.cs | 3 +- .../UI/Interfaces/ILabelRemoveRequest.cs | 3 + .../UI/Interfaces/ILabelUpdateRequest.cs | 3 + .../UI/Interfaces/ILabeledChatRequest.cs | 1 + .../Requests/UI/Interfaces/IPinChatRequest.cs | 1 + .../UI/Interfaces/IReadChatRequest.cs | 1 + .../Requests/UI/Interfaces/ITypingRequest.cs | 1 + .../UI/Interfaces/IUnlabeledChatRequest.cs | 1 + .../UI/Interfaces/IUnpinChatRequest.cs | 1 + .../UI/Interfaces/IUnreadChatRequest.cs | 1 + .../UI/Interfaces/IVoiceRecordingRequest.cs | 1 + .../Requests/UI/LabelCollectionRequest.cs | 10 ++ .../Requests/UI/LabelCreateRequest.cs | 15 +++ .../Requests/UI/LabelOperationsRequest.cs | 15 +++ .../Requests/UI/LabelRemoveRequest.cs | 2 + .../Requests/UI/LabelUpdateRequest.cs | 10 ++ .../Requests/UI/LabeledChatRequest.cs | 1 + .../Requests/UI/PinChatRequest.cs | 1 + .../Requests/UI/ReadChatRequest.cs | 1 + .../Requests/UI/SendStatusOperations.cs | 3 + .../Requests/UI/UnlabeledChatRequest.cs | 1 + .../Requests/UI/UnpinChatRequest.cs | 1 + .../Requests/UI/UnreadChatRequest.cs | 1 + .../Responses/AddGroupParticipantResponse.cs | 1 + .../Responses/CreateGroupResponse.cs | 16 +++ .../DemoteGroupParticipantResponse.cs | 1 + .../Responses/DialogCollectionResponse.cs | 10 ++ .../Responses/DialogResponse.cs | 28 +++++- .../Responses/GroupOperationResponse.cs | 14 +++ .../IAddGroupParticipantResponse.cs | 1 + .../Interfaces/ICreateGroupResponse.cs | 3 +- .../IDemoteGroupParticipantResponse.cs | 1 + .../Interfaces/IDialogCollectionResponse.cs | 3 +- .../Responses/Interfaces/IDialogResponse.cs | 3 +- .../Interfaces/IGroupOperationResponse.cs | 7 +- .../Interfaces/IJoinGroupResponse.cs | 1 + .../Interfaces/ILeaveGroupResponse.cs | 5 +- .../IPromoteGroupParticipantResponse.cs | 1 + .../Interfaces/IRemoveDialogResponse.cs | 5 +- .../IRemoveGroupParticipantResponse.cs | 1 + .../Responses/JoinGroupResponse.cs | 10 ++ .../Responses/LeaveGroupResponse.cs | 10 ++ .../PromoteGroupParticipantResponse.cs | 1 + .../Responses/RemoveDialogResponse.cs | 9 ++ .../RemoveGroupParticipantResponse.cs | 1 + .../Responses/UI/ChatOperationResponse.cs | 10 ++ .../UI/Interfaces/IChatOperationResponse.cs | 5 +- .../UI/Interfaces/ILabelCollectionResponse.cs | 5 +- .../UI/Interfaces/ILabelCreateResponse.cs | 5 +- .../UI/Interfaces/ILabelRemoveResponse.cs | 1 + .../UI/Interfaces/ILabelUpdateResponse.cs | 1 + .../UI/Interfaces/ILabeledChatResponse.cs | 1 + .../UI/Interfaces/IPinChatResponse.cs | 1 + .../UI/Interfaces/IReadChatResponse.cs | 7 +- .../UI/Interfaces/ITypingResponse.cs | 1 + .../UI/Interfaces/IUnlabeledChatResponse.cs | 1 + .../UI/Interfaces/IUnpinChatResponse.cs | 1 + .../UI/Interfaces/IUnreadChatResponse.cs | 1 + .../UI/Interfaces/IVoiceRecordingResponse.cs | 1 + .../Responses/UI/LabelCollectionResponse.cs | 11 +- .../Responses/UI/LabelCreateResponse.cs | 12 ++- .../Responses/UI/LabelRemoveResponse.cs | 13 ++- .../Responses/UI/LabelUpdateResponse.cs | 17 +++- .../Responses/UI/LabeledChatResponse.cs | 1 + .../Responses/UI/PinChatResponse.cs | 1 + .../Responses/UI/ReadChatResponse.cs | 17 +++- .../Responses/UI/TypingResponse.cs | 1 + .../Responses/UI/UnlabeledChatResponse.cs | 1 + .../Responses/UI/UnpinChatResponse.cs | 1 + .../Responses/UI/UnreadChatResponse.cs | 1 + .../Responses/UI/VoiceRecordingResponse.cs | 1 + .../ChatApi.WA.Messages.csproj | 86 ++++++++++------ .../Collections/ContactCollection.cs | 2 + .../Collections/ForwardMessagesCollection.cs | 2 + .../Collections/MentionedPhonesCollection.cs | 2 + .../Collections/MessageCollection.cs | 2 + Src/ChatApi.WA.Messages/IMessagesOperation.cs | 1 + Src/ChatApi.WA.Messages/MessagesOperation.cs | 22 ++++ .../Models/Interfaces/ILastMessageNumber.cs | 3 +- .../Models/Interfaces/IMessage.cs | 6 +- .../Models/Interfaces/IMessages.cs | 10 +- .../Models/Interfaces/IPage.cs | 1 + .../Models/Interfaces/IQuotedMessage.cs | 1 + Src/ChatApi.WA.Messages/Models/Message.cs | 46 ++++++++- .../Requests/ContactMessageRequest.cs | 11 +- .../Requests/FileMessageRequest.cs | 14 +++ .../Requests/ForwardMessageRequest.cs | 9 ++ .../Interfaces/IContactMessageRequest.cs | 4 +- .../Interfaces/IFileMessageRequest.cs | 4 +- .../Interfaces/IForwardMessageRequest.cs | 4 +- .../Interfaces/ILinkMessageRequest.cs | 4 +- .../Interfaces/ILocationMessageRequest.cs | 4 +- .../Requests/Interfaces/IMentionedPhones.cs | 5 +- .../Requests/Interfaces/IMessageRequest.cs | 6 +- .../Interfaces/IMessagesHistoryRequest.cs | 3 +- .../Requests/Interfaces/IMessagesRequest.cs | 3 +- .../Interfaces/ITextMessageRequest.cs | 4 +- .../Interfaces/IVoiceMessageRequest.cs | 4 +- .../Requests/LinkMessageRequest.cs | 14 +++ .../Requests/LocationMessageRequest.cs | 12 +++ .../Requests/MessagesHistoryRequest.cs | 12 +++ .../Requests/MessagesRequest.cs | 22 +++- .../Requests/TextMessageRequest.cs | 11 ++ .../Requests/VoiceMessageRequest.cs | 11 ++ .../Responses/Interfaces/IMessageResponse.cs | 3 +- .../Interfaces/IMessagesHistoryResponse.cs | 3 +- .../Responses/Interfaces/IMessagesResponse.cs | 3 +- .../Responses/MessageResponse.cs | 14 +++ .../Responses/MessagesHistoryResponse.cs | 12 +++ .../Responses/MessagesResponse.cs | 14 ++- .../ChatApi.WA.Queues.csproj | 85 ++++++++++------ .../Collections/ActionOperationsCollection.cs | 2 + .../Collections/MessageTextBodyCollection.cs | 2 + .../Collections/OutboundActionCollection.cs | 2 + .../Collections/OutboundMessageCollection.cs | 2 + Src/ChatApi.WA.Queues/IQueueOperations.cs | 1 + Src/ChatApi.WA.Queues/QueueOperations.cs | 10 ++ .../Interfaces/IQueueOperationsResponse.cs | 3 +- .../Abstract/QueueOperationsResponse.cs | 25 ++++- .../Responses/ActionQueue.cs | 10 ++ .../Responses/ClearActionsQueueResponse.cs | 13 ++- .../Responses/ClearMessagesQueueResponse.cs | 10 ++ .../Responses/Interfaces/IActionQueue.cs | 6 +- .../Interfaces/IClearActionsQueueResponse.cs | 3 +- .../Interfaces/IClearMessagesQueueResponse.cs | 3 +- .../Responses/Interfaces/IMessageQueue.cs | 1 + .../Interfaces/IShowActionsQueueResponse.cs | 6 +- .../Interfaces/IShowMessagesQueueResponse.cs | 9 +- .../Responses/MessageQueue.cs | 24 ++++- .../Responses/ShowActionsQueueResponse.cs | 13 ++- .../Responses/ShowMessagesQueueResponse.cs | 13 ++- 322 files changed, 2525 insertions(+), 569 deletions(-) rename {Src => Images}/ChatApi.png (100%) create mode 100644 Src/ChatApi.Core/Models/Interfaces/IOperationResult.cs create mode 100644 Src/ChatApi.Core/Models/Interfaces/IOperationSuccess.cs create mode 100644 Src/ChatApi.Core/Response/Errors/ChatApiBadResponse.cs create mode 100644 Src/ChatApi.Core/Response/Errors/ChatApiResultError.cs delete mode 100644 Src/ChatApi.Core/Response/Errors/WhatsAppBadResponse.cs delete mode 100644 Src/ChatApi.Core/Response/Errors/WhatsAppResultError.cs create mode 100644 Src/ChatApi.Instances/Models/ChatApiInstanceParameters.cs create mode 100644 Src/ChatApi.Instances/Models/Interfaces/IChatApiInstanceType.cs rename Src/ChatApi.WA.Dialogs/Properties/{Resourse.Designer.cs => Resources.Designer.cs} (98%) rename Src/ChatApi.WA.Dialogs/Properties/{Resourse.resx => Resources.resx} (100%) 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/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..062fa18 100644 --- a/Src/ChatApi.Core/Models/ChatApiStatusOperation.cs +++ b/Src/ChatApi.Core/Models/ChatApiStatusOperation.cs @@ -2,16 +2,27 @@ namespace ChatApi.Core.Models { + //Need description:chatApi + /// 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..bcd6001 100644 --- a/Src/ChatApi.Core/Models/Interfaces/IErrorResponse.cs +++ b/Src/ChatApi.Core/Models/Interfaces/IErrorResponse.cs @@ -2,8 +2,11 @@ namespace ChatApi.Core.Models.Interfaces { + //Need description:chatApi + /// 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..578bd67 --- /dev/null +++ b/Src/ChatApi.Core/Models/Interfaces/IOperationResult.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + +namespace ChatApi.Core.Models.Interfaces +{ + //Need description:chatApi + /// + public interface IOperationResult + { + /// + /// + /// + [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..b132db0 --- /dev/null +++ b/Src/ChatApi.Core/Models/Interfaces/IOperationSuccess.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; + +namespace ChatApi.Core.Models.Interfaces +{ + //Need description:chatApi + /// + public interface IOperationSuccess + { + /// + /// + /// + [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..e3cd147 100644 --- a/Src/ChatApi.Core/Models/MessageType.cs +++ b/Src/ChatApi.Core/Models/MessageType.cs @@ -2,27 +2,50 @@ namespace ChatApi.Core.Models { + //Need description:chatApi + /// 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..f1a6b56 100644 --- a/Src/ChatApi.WA.Account/Models/InstanceStatus.cs +++ b/Src/ChatApi.WA.Account/Models/InstanceStatus.cs @@ -5,18 +5,23 @@ 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; } #endregion #region Equatable + /// public bool Equals(IInstanceStatus? other) { return other is not null && Action == other.Action && @@ -24,9 +29,11 @@ public bool Equals(IInstanceStatus? other) 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 @@ -38,13 +45,16 @@ public override int GetHashCode() } } + /// 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); 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..c8cded8 100644 --- a/Src/ChatApi.WA.Account/Models/Interfaces/IInstanceStatus.cs +++ b/Src/ChatApi.WA.Account/Models/Interfaces/IInstanceStatus.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 IInstanceStatus : IEquatable, IPrintable { /// 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..761cdb3 100644 --- a/Src/ChatApi.WA.Account/Responses/Interfaces/IAdditionInformationStatus.cs +++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IAdditionInformationStatus.cs @@ -1,30 +1,37 @@ 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 { + //Need description:chatApi + /// public interface IAdditionInformationStatus : IEquatable, IPrintable { + /// [JsonConverter(typeof(InterfacesConverter))] [JsonProperty("expiry", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] IInstanceStatus? Expiry { get; set; } + /// [JsonConverter(typeof(InterfacesConverter))] [JsonProperty("retry", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] IInstanceStatus? Retry { get; set; } + /// [JsonConverter(typeof(InterfacesConverter))] [JsonProperty("logout", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] IInstanceStatus? Logout { get; set; } + /// [JsonConverter(typeof(InterfacesConverter))] [JsonProperty("takeover", Required = Required.DisallowNull, NullValueHandling = NullValueHandling.Ignore)] IInstanceStatus? Takeover { get; set; } + /// [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..4a62b2b 100644 --- a/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountNameResponse.cs +++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IChangeAccountNameResponse.cs @@ -1,10 +1,13 @@ -using Newtonsoft.Json; -using ChatApi.Core.Models.Interfaces; +using ChatApi.Core.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Account.Responses.Interfaces { + //Need description:chatApi + /// 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..6268b23 100644 --- a/Src/ChatApi.WA.Account/Responses/Interfaces/IQrCodeResponse.cs +++ b/Src/ChatApi.WA.Account/Responses/Interfaces/IQrCodeResponse.cs @@ -3,8 +3,11 @@ namespace ChatApi.WA.Account.Responses.Interfaces { + //Need description:chatApi + /// public interface IQrCodeResponse : IErrorResponse, IEquatable, IPrintable { + /// 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..49a9278 100644 --- a/Src/ChatApi.WA.Ban/Responses/Interfaces/ICheckBanResponse.cs +++ b/Src/ChatApi.WA.Ban/Responses/Interfaces/ICheckBanResponse.cs @@ -1,17 +1,22 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Ban.Responses.Interfaces { + //Need description:chatApi + /// public interface ICheckBanResponse : IErrorResponse, IPhone, IEquatable, IPrintable { + /// [JsonProperty("banned", NullValueHandling = NullValueHandling.Ignore)] bool? IsBanned { get; set; } + /// [JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)] string? Message { get; set; } + /// [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..af83301 100644 --- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/ChatIdsCollection.cs +++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/ChatIdsCollection.cs @@ -2,5 +2,7 @@ namespace ChatApi.WA.Dialogs.Helpers.Collections { + //Need description:chatApi + /// 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..1fac8e9 100644 --- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/DialogCollection.cs +++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/DialogCollection.cs @@ -3,5 +3,7 @@ namespace ChatApi.WA.Dialogs.Helpers.Collections { + //Need description:chatApi + /// 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..85ffd66 100644 --- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/LabelCollection.cs +++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/LabelCollection.cs @@ -3,5 +3,7 @@ namespace ChatApi.WA.Dialogs.Helpers.Collections { + //Need description:chatApi + /// 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..226ed25 100644 --- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/ParticipantsCollection.cs +++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/ParticipantsCollection.cs @@ -2,5 +2,7 @@ namespace ChatApi.WA.Dialogs.Helpers.Collections { + //Need description:chatApi + /// 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..b33fa30 100644 --- a/Src/ChatApi.WA.Dialogs/Helpers/Collections/PhonesCollection.cs +++ b/Src/ChatApi.WA.Dialogs/Helpers/Collections/PhonesCollection.cs @@ -2,5 +2,7 @@ namespace ChatApi.WA.Dialogs.Helpers.Collections { + //Need description:chatApi + /// 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..f910014 100644 --- a/Src/ChatApi.WA.Dialogs/Models/Interfaces/ILabel.cs +++ b/Src/ChatApi.WA.Dialogs/Models/Interfaces/ILabel.cs @@ -1,17 +1,22 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Models.Interfaces { + //Need description:chatApi + /// public interface ILabel : IEquatable, IPrintable { + /// [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] public string? LabelId { get; set; } + /// [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)] public string? LabelName { get; set; } + /// [JsonProperty("hexColor", NullValueHandling = NullValueHandling.Ignore)] public string? HexColor { get; set; } } diff --git a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IOperationMessageResult.cs b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IOperationMessageResult.cs index 9322e79..271c7c0 100644 --- a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IOperationMessageResult.cs +++ b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IOperationMessageResult.cs @@ -4,8 +4,11 @@ namespace ChatApi.WA.Dialogs.Models.Interfaces { + //Need description:chatApi + /// public interface IOperationMessageResult : IEquatable, IPrintable { + /// [JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)] string? Message { get; set; } } diff --git a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IParticipantRequest.cs index 46ae9f7..01026ee 100644 --- a/Src/ChatApi.WA.Dialogs/Models/Interfaces/IParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Models/Interfaces/IParticipantRequest.cs @@ -4,6 +4,7 @@ namespace ChatApi.WA.Dialogs.Models.Interfaces { + /// public interface IParticipantRequest : IEquatable { /// @@ -12,15 +13,7 @@ public interface IParticipantRequest : IEquatable /// 19680561234-1479621234@g.us for the group [JsonProperty("groupId", NullValueHandling = NullValueHandling.Ignore)] string? GroupId { get; set; } - - /// - /// Chat ID from the message list. - /// - /// 17633123456@c.us. Used instead of the ParticipantPhone parameter - /// Required if participantPhone is not set - [JsonProperty("participantChatId", NullValueHandling = NullValueHandling.Ignore)] - string? ParticipantChatId { get; set; } - + /// /// A phone number starting with the country code. You do not need to add your number. /// @@ -29,5 +22,13 @@ public interface IParticipantRequest : IEquatable [JsonConverter(typeof(PhoneConverter))] [JsonProperty("participantPhone", NullValueHandling = NullValueHandling.Ignore)] string? ParticipantPhone { get; set; } + + /// + /// Chat ID from the message list. + /// + /// 17633123456@c.us. Used instead of the ParticipantPhone parameter + /// Required if participantPhone is not set + [JsonProperty("participantChatId", NullValueHandling = NullValueHandling.Ignore)] + string? ParticipantChatId { get; set; } } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Models/Label.cs b/Src/ChatApi.WA.Dialogs/Models/Label.cs index c9423c1..b29977c 100644 --- a/Src/ChatApi.WA.Dialogs/Models/Label.cs +++ b/Src/ChatApi.WA.Dialogs/Models/Label.cs @@ -5,19 +5,25 @@ namespace ChatApi.WA.Dialogs.Models { + /// public class Label : Printable, ILabel { + #region Properties + + /// public string? LabelId { get; set; } + + /// public string? LabelName { get; set; } + + /// public string? HexColor { get; set; } - protected override void PrintContent(int shift) - { - AddMember(nameof(LabelId), LabelId, shift); - AddMember(nameof(LabelName), LabelName, shift); - AddMember(nameof(HexColor), HexColor, shift); - } - + #endregion + + #region Equatable + + /// public bool Equals(ILabel? other) { return other is not null && @@ -26,11 +32,13 @@ public bool Equals(ILabel? other) string.Equals(HexColor, other.HexColor, StringComparison.Ordinal); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is ILabel other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -42,10 +50,24 @@ public override int GetHashCode() } } - - + /// public static bool operator == (Label? left, Label? right) => EquatableHelper.IsEquatable(left, right); + + /// public static bool operator != (Label? left, Label? right) => !EquatableHelper.IsEquatable(left, right); + #endregion + + #region Printable + + /// + protected override void PrintContent(int shift) + { + AddMember(nameof(LabelId), LabelId, shift); + AddMember(nameof(LabelName), LabelName, shift); + AddMember(nameof(HexColor), HexColor, shift); + } + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Models/OperationMessageResult.cs b/Src/ChatApi.WA.Dialogs/Models/OperationMessageResult.cs index 176cb4e..f9a7bef 100644 --- a/Src/ChatApi.WA.Dialogs/Models/OperationMessageResult.cs +++ b/Src/ChatApi.WA.Dialogs/Models/OperationMessageResult.cs @@ -5,27 +5,35 @@ namespace ChatApi.WA.Dialogs.Models { + /// public sealed class OperationMessageResult : Printable, IOperationMessageResult { #region Properties + /// public string? Message { get; set; } #endregion #region Equatable + /// public override int GetHashCode() => Message != null ? Message.GetHashCode() : 0; + /// public bool Equals(IOperationMessageResult? other) => other is not null && string.Equals(Message, other.Message, StringComparison.Ordinal); + /// public override bool Equals(object? obj) => Equals(null, obj) || obj is IOperationMessageResult other && Equals(other); + /// public static bool operator == (OperationMessageResult? left, OperationMessageResult? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (OperationMessageResult? left, OperationMessageResult? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(Message), Message, shift); diff --git a/Src/ChatApi.WA.Dialogs/Models/ParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Models/ParticipantRequest.cs index cd525e5..45b8083 100644 --- a/Src/ChatApi.WA.Dialogs/Models/ParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Models/ParticipantRequest.cs @@ -4,12 +4,25 @@ namespace ChatApi.WA.Dialogs.Models { + /// public abstract class ParticipantRequest : IParticipantRequest { + #region Properties + + /// public string? GroupId { get; set; } + + /// public string? ParticipantChatId { get; set; } + + /// public string? ParticipantPhone { get; set; } + #endregion + + #region Equatable + + /// public bool Equals(IParticipantRequest? other) { return other is not null && @@ -18,11 +31,13 @@ public bool Equals(IParticipantRequest? other) string.Equals(ParticipantChatId, other.ParticipantChatId, StringComparison.Ordinal); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is IParticipantRequest other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -34,7 +49,11 @@ public override int GetHashCode() } } + /// public static bool operator == (ParticipantRequest? left, ParticipantRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (ParticipantRequest? left, ParticipantRequest? right) => !EquatableHelper.IsEquatable(left, right); + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Operations/GroupOperations.cs b/Src/ChatApi.WA.Dialogs/Operations/GroupOperations.cs index dc2660c..fdce1c3 100644 --- a/Src/ChatApi.WA.Dialogs/Operations/GroupOperations.cs +++ b/Src/ChatApi.WA.Dialogs/Operations/GroupOperations.cs @@ -11,11 +11,14 @@ namespace ChatApi.WA.Dialogs.Operations { + /// public sealed class GroupOperations : IGroupOperations { private readonly IWhatsAppConnect _connect; + /// public Lazy GroupParticipantOperations { get; } + /// public GroupOperations(IWhatsAppConnect connect) { _connect = connect; @@ -26,32 +29,38 @@ public GroupOperations(IWhatsAppConnect connect) #region JoinGroup + /// public IChatApiResponse JoinGroup(IJoinGroupRequest joinGroup, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.JoinGroup, joinGroup.Serialize(), responseSettings); + _connect.Post(Resources.JoinGroup, joinGroup.Serialize(), responseSettings); + /// public Task> JoinGroupAsync(IJoinGroupRequest joinGroup, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.JoinGroup, joinGroup.Serialize(), responseSettings); + _connect.PostAsync(Resources.JoinGroup, joinGroup.Serialize(), responseSettings); #endregion #region LeaveGroup + /// public IChatApiResponse LeaveGroup(ILeaveGroupRequest leaveGroup, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.LeaveGroup, leaveGroup.Serialize(), responseSettings); + _connect.Post(Resources.LeaveGroup, leaveGroup.Serialize(), responseSettings); + /// public Task> LeaveGroupAsync(ILeaveGroupRequest leaveGroup, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.LeaveGroup, leaveGroup.Serialize(), responseSettings); + _connect.PostAsync(Resources.LeaveGroup, leaveGroup.Serialize(), responseSettings); #endregion #region CreateGroup + /// public IChatApiResponse CreateGroup(ICreateGroupRequest createGroup, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.CreateGroup, createGroup.Serialize(), responseSettings); + _connect.Post(Resources.CreateGroup, createGroup.Serialize(), responseSettings); + /// public Task> CreateGroupAsync(ICreateGroupRequest createGroup, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.CreateGroup, createGroup.Serialize(), responseSettings); + _connect.PostAsync(Resources.CreateGroup, createGroup.Serialize(), responseSettings); #endregion diff --git a/Src/ChatApi.WA.Dialogs/Operations/GroupParticipantOperations.cs b/Src/ChatApi.WA.Dialogs/Operations/GroupParticipantOperations.cs index cd3af32..03da4bf 100644 --- a/Src/ChatApi.WA.Dialogs/Operations/GroupParticipantOperations.cs +++ b/Src/ChatApi.WA.Dialogs/Operations/GroupParticipantOperations.cs @@ -10,50 +10,60 @@ namespace ChatApi.WA.Dialogs.Operations { + /// public class GroupParticipantOperations : IGroupParticipantOperations { private readonly IWhatsAppConnect _connect; + /// public GroupParticipantOperations(IWhatsAppConnect connect) => _connect = connect; #region Participant operations API #region Add + /// public IChatApiResponse AddParticipant(IAddGroupParticipantRequest addParticipant, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.AddParticipant, addParticipant.Serialize(), responseSettings); + _connect.Post(Resources.AddParticipant, addParticipant.Serialize(), responseSettings); + /// public Task> AddParticipantAsync(IAddGroupParticipantRequest addParticipant, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.AddParticipant, addParticipant.Serialize(), responseSettings); + _connect.PostAsync(Resources.AddParticipant, addParticipant.Serialize(), responseSettings); #endregion #region Remove + /// public IChatApiResponse RemoveParticipant(IRemoveGroupParticipantRequest removeParticipant, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.RemoveParticipant, removeParticipant.Serialize(), responseSettings); + _connect.Post(Resources.RemoveParticipant, removeParticipant.Serialize(), responseSettings); + /// public Task> RemoveParticipantAsync(IRemoveGroupParticipantRequest removeParticipant, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.RemoveParticipant, removeParticipant.Serialize(), responseSettings); + _connect.PostAsync(Resources.RemoveParticipant, removeParticipant.Serialize(), responseSettings); #endregion #region Demote + /// public IChatApiResponse DemoteParticipant(IDemoteGroupParticipantRequest demoteParticipant, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.DemoteParticipant, demoteParticipant.Serialize(), responseSettings); + _connect.Post(Resources.DemoteParticipant, demoteParticipant.Serialize(), responseSettings); + /// public Task> DemoteParticipantAsync(IDemoteGroupParticipantRequest demoteParticipant, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.DemoteParticipant, demoteParticipant.Serialize(), responseSettings); + _connect.PostAsync(Resources.DemoteParticipant, demoteParticipant.Serialize(), responseSettings); #endregion #region Promote + /// public IChatApiResponse PromoteParticipant(IPromoteGroupParticipantRequest promoteParticipant, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.PromoteParticipant, promoteParticipant.Serialize(), responseSettings); + _connect.Post(Resources.PromoteParticipant, promoteParticipant.Serialize(), responseSettings); + /// public Task> PromoteParticipantAsync(IPromoteGroupParticipantRequest promoteParticipant, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.PromoteParticipant, promoteParticipant.Serialize(), responseSettings); + _connect.PostAsync(Resources.PromoteParticipant, promoteParticipant.Serialize(), responseSettings); #endregion diff --git a/Src/ChatApi.WA.Dialogs/Operations/Interfaces/IGroupParticipantOperations.cs b/Src/ChatApi.WA.Dialogs/Operations/Interfaces/IGroupParticipantOperations.cs index 6a7a408..b4cd491 100644 --- a/Src/ChatApi.WA.Dialogs/Operations/Interfaces/IGroupParticipantOperations.cs +++ b/Src/ChatApi.WA.Dialogs/Operations/Interfaces/IGroupParticipantOperations.cs @@ -5,6 +5,7 @@ namespace ChatApi.WA.Dialogs.Operations.Interfaces { + /// public interface IGroupParticipantOperations { diff --git a/Src/ChatApi.WA.Dialogs/Operations/Interfaces/IWhatsAppBusinessOperations.cs b/Src/ChatApi.WA.Dialogs/Operations/Interfaces/IWhatsAppBusinessOperations.cs index 2db1a5e..dfedcab 100644 --- a/Src/ChatApi.WA.Dialogs/Operations/Interfaces/IWhatsAppBusinessOperations.cs +++ b/Src/ChatApi.WA.Dialogs/Operations/Interfaces/IWhatsAppBusinessOperations.cs @@ -5,6 +5,7 @@ namespace ChatApi.WA.Dialogs.Operations.Interfaces { + /// public interface IWhatsAppBusinessOperations { /// diff --git a/Src/ChatApi.WA.Dialogs/Operations/UserInterfaceOperations.cs b/Src/ChatApi.WA.Dialogs/Operations/UserInterfaceOperations.cs index de8f1a9..56b986d 100644 --- a/Src/ChatApi.WA.Dialogs/Operations/UserInterfaceOperations.cs +++ b/Src/ChatApi.WA.Dialogs/Operations/UserInterfaceOperations.cs @@ -11,79 +11,93 @@ namespace ChatApi.WA.Dialogs.Operations { + /// public sealed class UserInterfaceOperations : IUserInterfaceOperations { private readonly IWhatsAppConnect _connect; + /// public Lazy WhatsAppBusinessOperations { get; } + /// public UserInterfaceOperations(IWhatsAppConnect connect) { _connect = connect; WhatsAppBusinessOperations = new Lazy(() => new WhatsAppBusinessOperations(connect)); } - #region User Interface API #region PinChat + /// public IChatApiResponse PinChat(IPinChatRequest pinChat, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.PinChat, pinChat.Serialize(), responseSettings); + _connect.Post(Resources.PinChat, pinChat.Serialize(), responseSettings); + /// public Task> PinChatAsync(IPinChatRequest pinChat, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.PinChat, pinChat.Serialize(), responseSettings); + _connect.PostAsync(Resources.PinChat, pinChat.Serialize(), responseSettings); #endregion #region UnpinChat + /// public IChatApiResponse UnpinChat(IUnpinChatRequest unpinChat, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.UnpinChat, unpinChat.Serialize(), responseSettings); + _connect.Post(Resources.UnpinChat, unpinChat.Serialize(), responseSettings); + /// public Task> UnpinChatAsync(IUnpinChatRequest unpinChat, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.UnpinChat, unpinChat.Serialize(), responseSettings); + _connect.PostAsync(Resources.UnpinChat, unpinChat.Serialize(), responseSettings); #endregion #region ReadChat + /// public IChatApiResponse ReadChat(IReadChatRequest readChat, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.ReadChat, readChat.Serialize(), responseSettings); + _connect.Post(Resources.ReadChat, readChat.Serialize(), responseSettings); + /// public Task> ReadChatAsync(IReadChatRequest readChat, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.ReadChat, readChat.Serialize(), responseSettings); + _connect.PostAsync(Resources.ReadChat, readChat.Serialize(), responseSettings); #endregion #region UnreadChat + /// public IChatApiResponse UnreadChat(IUnreadChatRequest unreadChat, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.UnReadChat, unreadChat.Serialize(), responseSettings); + _connect.Post(Resources.UnReadChat, unreadChat.Serialize(), responseSettings); + /// public Task> UnReadChatAsync(IUnreadChatRequest unreadChat, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.UnReadChat, unreadChat.Serialize(), responseSettings); + _connect.PostAsync(Resources.UnReadChat, unreadChat.Serialize(), responseSettings); #endregion #region SendTypingStatus + /// public IChatApiResponse SendTypingStatus(ITypingRequest typing, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.SendTypingStatus, typing.Serialize(), responseSettings); + _connect.Post(Resources.SendTypingStatus, typing.Serialize(), responseSettings); + /// public Task> SendTypingStatusAsync(ITypingRequest typing, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.SendTypingStatus, typing.Serialize(), responseSettings); + _connect.PostAsync(Resources.SendTypingStatus, typing.Serialize(), responseSettings); #endregion #region SendVoiceRecordingStatus + /// public IChatApiResponse SendVoiceRecordingStatus(IVoiceRecordingRequest voiceRecording, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.SendVoiceRecordingStatus, voiceRecording.Serialize(), responseSettings); + _connect.Post(Resources.SendVoiceRecordingStatus, voiceRecording.Serialize(), responseSettings); + /// public Task> SendVoiceRecordingStatusAsync(IVoiceRecordingRequest voiceRecording, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.SendVoiceRecordingStatus, voiceRecording.Serialize(), responseSettings); + _connect.PostAsync(Resources.SendVoiceRecordingStatus, voiceRecording.Serialize(), responseSettings); #endregion diff --git a/Src/ChatApi.WA.Dialogs/Operations/WhatsAppBusinessOperations.cs b/Src/ChatApi.WA.Dialogs/Operations/WhatsAppBusinessOperations.cs index 434e762..d332c78 100644 --- a/Src/ChatApi.WA.Dialogs/Operations/WhatsAppBusinessOperations.cs +++ b/Src/ChatApi.WA.Dialogs/Operations/WhatsAppBusinessOperations.cs @@ -10,73 +10,87 @@ namespace ChatApi.WA.Dialogs.Operations { + /// public class WhatsAppBusinessOperations : IWhatsAppBusinessOperations { private readonly IWhatsAppConnect _connect; + /// public WhatsAppBusinessOperations(IWhatsAppConnect connect) => _connect = connect; #region WhatsApp Business API #region Get labels + /// public IChatApiResponse GetLabels(ILabelCollectionRequest? labelCollectionRequest = null, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.GetLabels, string.Empty, responseSettings); + _connect.Post(Resources.GetLabels, string.Empty, responseSettings); + /// public Task> GetLabelsAsync(ILabelCollectionRequest? labelCollectionRequest = null, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.GetLabels, string.Empty, responseSettings); + _connect.PostAsync(Resources.GetLabels, string.Empty, responseSettings); #endregion #region Create label + /// public IChatApiResponse CreateLabel(ILabelCreateRequest labelCreateRequest, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.CreateLabel, labelCreateRequest.Serialize(), responseSettings); + _connect.Post(Resources.CreateLabel, labelCreateRequest.Serialize(), responseSettings); + /// public Task> CreateLabelAsync(ILabelCreateRequest labelCreateRequest, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.CreateLabel, labelCreateRequest.Serialize(), responseSettings); + _connect.PostAsync(Resources.CreateLabel, labelCreateRequest.Serialize(), responseSettings); #endregion #region Update label + /// public IChatApiResponse UpdateLabel(ILabelUpdateRequest labelUpdateRequest, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.UpdateLabel, labelUpdateRequest.Serialize(), responseSettings); + _connect.Post(Resources.UpdateLabel, labelUpdateRequest.Serialize(), responseSettings); + /// public Task> UpdateLabelAsync(ILabelUpdateRequest labelUpdateRequest, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.UpdateLabel, labelUpdateRequest.Serialize(), responseSettings); + _connect.PostAsync(Resources.UpdateLabel, labelUpdateRequest.Serialize(), responseSettings); #endregion #region Remove label + /// public IChatApiResponse RemoveLabel(ILabelRemoveRequest labelRemoveRequest, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.RemoveLabel, labelRemoveRequest.Serialize(), responseSettings); + _connect.Post(Resources.RemoveLabel, labelRemoveRequest.Serialize(), responseSettings); + /// public Task> RemoveLabelAsync(ILabelRemoveRequest labelRemoveRequest, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.RemoveLabel, labelRemoveRequest.Serialize(), responseSettings); + _connect.PostAsync(Resources.RemoveLabel, labelRemoveRequest.Serialize(), responseSettings); #endregion #region LabeledChat + /// public IChatApiResponse LabeledChat(ILabeledChatRequest labelChat, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.LabeledChat, labelChat.Serialize(), responseSettings); + _connect.Post(Resources.LabeledChat, labelChat.Serialize(), responseSettings); + /// public Task> LabeledChatAsync(ILabeledChatRequest labelChat, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.LabeledChat, labelChat.Serialize(), responseSettings); + _connect.PostAsync(Resources.LabeledChat, labelChat.Serialize(), responseSettings); #endregion #region UnlabeledChat + /// public IChatApiResponse UnlabeledChat(IUnlabeledChatRequest unlabeledChat, IResponseSettings? responseSettings = null) => - _connect.Post(Resourse.UnlabeledChat, unlabeledChat.Serialize(), responseSettings); + _connect.Post(Resources.UnlabeledChat, unlabeledChat.Serialize(), responseSettings); + /// public Task> UnlabeledChatAsync(IUnlabeledChatRequest unlabeledChat, IResponseSettings? responseSettings = null) => - _connect.PostAsync(Resourse.UnlabeledChat, unlabeledChat.Serialize(), responseSettings); + _connect.PostAsync(Resources.UnlabeledChat, unlabeledChat.Serialize(), responseSettings); -#endregion + #endregion #endregion } diff --git a/Src/ChatApi.WA.Dialogs/Properties/Resourse.Designer.cs b/Src/ChatApi.WA.Dialogs/Properties/Resources.Designer.cs similarity index 98% rename from Src/ChatApi.WA.Dialogs/Properties/Resourse.Designer.cs rename to Src/ChatApi.WA.Dialogs/Properties/Resources.Designer.cs index 3a3c241..31379c8 100644 --- a/Src/ChatApi.WA.Dialogs/Properties/Resourse.Designer.cs +++ b/Src/ChatApi.WA.Dialogs/Properties/Resources.Designer.cs @@ -22,14 +22,14 @@ namespace ChatApi.WA.Dialogs.Properties { [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resourse { + internal class Resources { private static global::System.Resources.ResourceManager resourceMan; private static global::System.Globalization.CultureInfo resourceCulture; [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resourse() { + internal Resources() { } /// @@ -39,7 +39,7 @@ internal Resourse() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChatApi.WA.Dialogs.Properties.Resourse", typeof(Resourse).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChatApi.WA.Dialogs.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Src/ChatApi.WA.Dialogs/Properties/Resourse.resx b/Src/ChatApi.WA.Dialogs/Properties/Resources.resx similarity index 100% rename from Src/ChatApi.WA.Dialogs/Properties/Resourse.resx rename to Src/ChatApi.WA.Dialogs/Properties/Resources.resx diff --git a/Src/ChatApi.WA.Dialogs/Requests/AddGroupParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/AddGroupParticipantRequest.cs index 0d115f0..a981a30 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/AddGroupParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/AddGroupParticipantRequest.cs @@ -3,5 +3,6 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public class AddGroupParticipantRequest : ParticipantRequest, IAddGroupParticipantRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/CreateGroupRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/CreateGroupRequest.cs index 4d43e47..ab393a0 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/CreateGroupRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/CreateGroupRequest.cs @@ -5,21 +5,29 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public sealed class CreateGroupRequest : Printable, ICreateGroupRequest { #region Properties + /// public string? Avatar { get; set; } + /// public string? Preview { get; set; } + /// public string? GroupName { get; set; } + /// public string? MessageText { get; set; } + /// public PhonesCollection? Phones { get; set; } + /// public ChatIdsCollection? ChatIds { get; set; } #endregion #region Equatable + /// public bool Equals(ICreateGroupRequest? other) { return other is not null && @@ -32,11 +40,13 @@ public bool Equals(ICreateGroupRequest? other) MessageText == other.MessageText; } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is ICreateGroupRequest other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -53,13 +63,16 @@ public override int GetHashCode() } } + /// public static bool operator == (CreateGroupRequest? left, CreateGroupRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (CreateGroupRequest? left, CreateGroupRequest? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(Avatar), Avatar, shift); diff --git a/Src/ChatApi.WA.Dialogs/Requests/DemoteGroupParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/DemoteGroupParticipantRequest.cs index fad4ff9..3424032 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/DemoteGroupParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/DemoteGroupParticipantRequest.cs @@ -3,5 +3,6 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public class DemoteGroupParticipantRequest : ParticipantRequest, IDemoteGroupParticipantRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/DialogCollectionRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/DialogCollectionRequest.cs index a264258..7a3c8ce 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/DialogCollectionRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/DialogCollectionRequest.cs @@ -4,15 +4,17 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public sealed class DialogCollectionRequest : IDialogCollectionRequest { + #region Properties + + /// public int Page { get; set; } + /// public int Limit { get; set; } - public DialogCollectionRequest() { } - public DialogCollectionRequest(int limit) => Limit = limit; - public DialogCollectionRequest(int limit, int page) => (Limit, Page) = (limit, page); - + /// public string Parameters { get @@ -22,8 +24,26 @@ public string Parameters stringBuilder.Append(string.Concat("&", nameof(Page).ToLower(), "=", Page)); return stringBuilder.ToString(); } - } - + } + + #endregion + + #region Constructors + + /// + public DialogCollectionRequest() { } + + /// + public DialogCollectionRequest(int limit) => Limit = limit; + + /// + public DialogCollectionRequest(int limit, int page) => (Limit, Page) = (limit, page); + + #endregion + + #region Equatable + + /// public bool Equals(IDialogCollectionRequest? other) { return other is not null && @@ -31,11 +51,13 @@ public bool Equals(IDialogCollectionRequest? other) Limit == other.Limit; } + /// public override bool Equals(object obj) { return ReferenceEquals(this, obj) || obj is DialogCollectionRequest other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -44,9 +66,11 @@ public override int GetHashCode() } } + /// public static bool operator == (DialogCollectionRequest? left, DialogCollectionRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (DialogCollectionRequest? left, DialogCollectionRequest? right) => !EquatableHelper.IsEquatable(left, right); - + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/DialogRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/DialogRequest.cs index ab9fa90..40782be 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/DialogRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/DialogRequest.cs @@ -4,17 +4,33 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public sealed class DialogRequest : IDialogRequest { + #region Properties + + /// public string? ChatId { get; set; } + /// public string Parameters => string.Concat("&chatId=", ChatId); + #endregion + + #region Equatable + + /// public bool Equals(IDialogRequest? other) => other is not null && - string.Equals(ChatId, other.ChatId, StringComparison.Ordinal); + string.Equals(ChatId, other.ChatId, StringComparison.Ordinal); + /// public override int GetHashCode() => ChatId != null ? ChatId.GetHashCode() : 0; + /// public static bool operator ==(DialogRequest? left, DialogRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator !=(DialogRequest? left, DialogRequest? right) => !EquatableHelper.IsEquatable(left, right); + /// public override bool Equals(object? obj) => ReferenceEquals(null, obj) || obj is IDialogRequest other && Equals(other); + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IAddGroupParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IAddGroupParticipantRequest.cs index d71fc02..abd388d 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IAddGroupParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IAddGroupParticipantRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface IAddGroupParticipantRequest : IParticipantRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDemoteGroupParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDemoteGroupParticipantRequest.cs index 7a9784f..50c2155 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDemoteGroupParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDemoteGroupParticipantRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface IDemoteGroupParticipantRequest : IParticipantRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDialogCollectionRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDialogCollectionRequest.cs index bd4314d..3e1016e 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDialogCollectionRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDialogCollectionRequest.cs @@ -3,6 +3,7 @@ namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface IDialogCollectionRequest : IEquatable, IParameters { /// diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDialogRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDialogRequest.cs index a74851c..6d01d99 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDialogRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IDialogRequest.cs @@ -1,9 +1,10 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface IDialogRequest : IChatId, IParameters, IEquatable { /// diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IJoinGroupRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IJoinGroupRequest.cs index 988ab06..5d925a9 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IJoinGroupRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IJoinGroupRequest.cs @@ -3,6 +3,7 @@ namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface IJoinGroupRequest : IEquatable { /// diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/ILeaveGroupRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/ILeaveGroupRequest.cs index da721d4..d641ee2 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/ILeaveGroupRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/ILeaveGroupRequest.cs @@ -3,5 +3,6 @@ namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface ILeaveGroupRequest : IMessageRequest, IEquatable { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IPromoteGroupParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IPromoteGroupParticipantRequest.cs index e20a31e..5ad8bcb 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IPromoteGroupParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IPromoteGroupParticipantRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface IPromoteGroupParticipantRequest : IParticipantRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IRemoveDialogRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IRemoveDialogRequest.cs index dd336ec..2bf7d94 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IRemoveDialogRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IRemoveDialogRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface IRemoveDialogRequest : IChatOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IRemoveGroupParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IRemoveGroupParticipantRequest.cs index c52890f..be2d6d0 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IRemoveGroupParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/Interfaces/IRemoveGroupParticipantRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.Interfaces { + /// public interface IRemoveGroupParticipantRequest : IParticipantRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/JoinGroupRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/JoinGroupRequest.cs index 3ab4c47..6b636f4 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/JoinGroupRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/JoinGroupRequest.cs @@ -4,11 +4,21 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public sealed class JoinGroupRequest : IJoinGroupRequest { + #region Properties + + /// public string? InvitationLink { get; set; } + /// public string? InvitationCode { get; set; } + #endregion + + #region Equatable + + /// public bool Equals(IJoinGroupRequest? other) { return other is not null && @@ -16,11 +26,13 @@ public bool Equals(IJoinGroupRequest? other) string.Equals(InvitationCode, other.InvitationCode, StringComparison.Ordinal); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is IJoinGroupRequest other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -30,7 +42,11 @@ public override int GetHashCode() } } + /// public static bool operator == (JoinGroupRequest? left, JoinGroupRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (JoinGroupRequest? left, JoinGroupRequest? right) => !EquatableHelper.IsEquatable(left, right); + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/LeaveGroupRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/LeaveGroupRequest.cs index 32d47c7..46b2dde 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/LeaveGroupRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/LeaveGroupRequest.cs @@ -3,5 +3,6 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public sealed class LeaveGroupRequest : MessageRequest, ILeaveGroupRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/PromoteGroupParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/PromoteGroupParticipantRequest.cs index b3f4399..dbd9bcf 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/PromoteGroupParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/PromoteGroupParticipantRequest.cs @@ -3,5 +3,6 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public class PromoteGroupParticipantRequest : ParticipantRequest, IPromoteGroupParticipantRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/RemoveDialogRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/RemoveDialogRequest.cs index 236eef7..af271bb 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/RemoveDialogRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/RemoveDialogRequest.cs @@ -3,5 +3,6 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public sealed class RemoveDialogRequest : ChatOperationsRequest, IRemoveDialogRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/RemoveGroupParticipantRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/RemoveGroupParticipantRequest.cs index 1c6faa1..fa408fb 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/RemoveGroupParticipantRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/RemoveGroupParticipantRequest.cs @@ -3,5 +3,6 @@ namespace ChatApi.WA.Dialogs.Requests { + /// public class RemoveGroupParticipantRequest : ParticipantRequest, IRemoveGroupParticipantRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/ChatOperationsRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/ChatOperationsRequest.cs index 3a218b7..6b8c0d8 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/ChatOperationsRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/ChatOperationsRequest.cs @@ -5,11 +5,21 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public abstract class ChatOperationsRequest : IChatOperationsRequest { + #region Properties + + /// public string? ChatId { get; set; } + /// public string? Phone { get; set; } + #endregion + + #region Equatable + + /// public bool Equals(IMessageRequest? other) { return other is IChatOperationsRequest chatOperationsRequest && @@ -17,21 +27,27 @@ public bool Equals(IMessageRequest? other) string.Equals(Phone, chatOperationsRequest.Phone, StringComparison.Ordinal); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is IChatOperationsRequest other && Equals(other); } + /// public override int GetHashCode() { unchecked { return ((ChatId is null ? 0 : ChatId.GetHashCode()) * 397) ^ - (Phone is null ? 0 : Phone.GetHashCode()); + (Phone is null ? 0 : Phone.GetHashCode()); } } + /// public static bool operator == (ChatOperationsRequest? left, ChatOperationsRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (ChatOperationsRequest? left, ChatOperationsRequest? right) => !EquatableHelper.IsEquatable(left, right); + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/DialogSendStatusOperationsRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/DialogSendStatusOperationsRequest.cs index 74c1e4f..a23e19a 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/DialogSendStatusOperationsRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/DialogSendStatusOperationsRequest.cs @@ -1,29 +1,38 @@ using System; - using ChatApi.Core.Helpers; using ChatApi.Core.Models; using ChatApi.WA.Dialogs.Requests.UI.Interfaces; namespace ChatApi.WA.Dialogs.Requests.UI { + /// public abstract class DialogSendStatusOperationsRequest : Printable, IDialogSendStatusOperationsRequest { #region Properties + /// public string? Phone { get; set; } + + /// public string? ChatId { get; set; } + + /// public uint? Duration { get; set; } + + /// public bool? EnableStatusDisplay { get; set; } #endregion #region Equatable + /// public bool Equals(IDialogSendStatusOperationsRequest? other) => other is not null && - string.Equals(Phone, other.Phone, StringComparison.Ordinal) && - string.Equals(ChatId, other.ChatId, StringComparison.Ordinal) && - Duration == other.Duration && EnableStatusDisplay == other.EnableStatusDisplay; + string.Equals(Phone, other.Phone, StringComparison.Ordinal) && + string.Equals(ChatId, other.ChatId, StringComparison.Ordinal) && + Duration == other.Duration && EnableStatusDisplay == other.EnableStatusDisplay; + /// public override bool Equals(object? obj) { if (ReferenceEquals(null, obj)) return false; @@ -31,6 +40,7 @@ public override bool Equals(object? obj) return ReferenceEquals(this, obj) || obj is IDialogSendStatusOperationsRequest other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -43,13 +53,16 @@ public override int GetHashCode() } } + /// public static bool operator == (DialogSendStatusOperationsRequest? left, DialogSendStatusOperationsRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (DialogSendStatusOperationsRequest? left, DialogSendStatusOperationsRequest? 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.Dialogs/Requests/UI/Interfaces/IChatOperationsRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IChatOperationsRequest.cs index fb58d46..7ff8f31 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IChatOperationsRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IChatOperationsRequest.cs @@ -3,5 +3,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface IChatOperationsRequest : IMessageRequest, IEquatable { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IDialogSendStatusOperationsRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IDialogSendStatusOperationsRequest.cs index ba4d5c1..ffdd47a 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IDialogSendStatusOperationsRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IDialogSendStatusOperationsRequest.cs @@ -4,5 +4,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface IDialogSendStatusOperationsRequest : IMessageRequest, IDialogSendStatus, IEquatable, IPrintable { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelCollectionRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelCollectionRequest.cs index c41d40c..28b4425 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelCollectionRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelCollectionRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface ILabelCollectionRequest : IEquatable { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelCreateRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelCreateRequest.cs index 9ba14f5..3473809 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelCreateRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelCreateRequest.cs @@ -3,8 +3,11 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + //Need description:chatApi + /// public interface ILabelCreateRequest : IEquatable { + /// [JsonProperty("name")] string? Name { get; set; } } diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelOperationsRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelOperationsRequest.cs index 64f2a87..db6e807 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelOperationsRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelOperationsRequest.cs @@ -3,10 +3,11 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface ILabelOperationsRequest : IChatOperationsRequest, IEquatable { /// - /// Label ID + /// Label ID /// [JsonProperty("labelId", NullValueHandling = NullValueHandling.Ignore)] string? LabelId { get; set; } diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelRemoveRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelRemoveRequest.cs index ab3e589..eeafc5b 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelRemoveRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelRemoveRequest.cs @@ -2,8 +2,11 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + //Need description:chatApi + /// public interface ILabelRemoveRequest { + /// [JsonProperty("labelId")] string? LabelId { get; set; } } diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelUpdateRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelUpdateRequest.cs index 2f8c0d2..18050f6 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelUpdateRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabelUpdateRequest.cs @@ -4,8 +4,11 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + //Need description:chatApi + /// public interface ILabelUpdateRequest : ILabel, IEquatable { + /// [JsonProperty("labelId", Required = Required.Always)] new string? LabelId { get; set; } } diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabeledChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabeledChatRequest.cs index 310f493..f1629cb 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabeledChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ILabeledChatRequest.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface ILabeledChatRequest : ILabelOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IPinChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IPinChatRequest.cs index 314b010..24172d2 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IPinChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IPinChatRequest.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface IPinChatRequest : IChatOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IReadChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IReadChatRequest.cs index 16dcce0..9157410 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IReadChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IReadChatRequest.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface IReadChatRequest : IChatOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ITypingRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ITypingRequest.cs index a9fb618..fc6d25d 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ITypingRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/ITypingRequest.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface ITypingRequest : IDialogSendStatusOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnlabeledChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnlabeledChatRequest.cs index ae0c1f2..7909dd7 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnlabeledChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnlabeledChatRequest.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface IUnlabeledChatRequest : ILabelOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnpinChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnpinChatRequest.cs index cc04168..94a88f1 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnpinChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnpinChatRequest.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface IUnpinChatRequest : IChatOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnreadChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnreadChatRequest.cs index 53ac588..c8f5a30 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnreadChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IUnreadChatRequest.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface IUnreadChatRequest : IChatOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IVoiceRecordingRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IVoiceRecordingRequest.cs index cc4f54e..2daddcb 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IVoiceRecordingRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/Interfaces/IVoiceRecordingRequest.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Requests.UI.Interfaces { + /// public interface IVoiceRecordingRequest : IDialogSendStatusOperationsRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelCollectionRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelCollectionRequest.cs index e1e70fc..df75430 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelCollectionRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelCollectionRequest.cs @@ -3,12 +3,22 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public class LabelCollectionRequest : ILabelCollectionRequest { + #region Equatable + + /// public override int GetHashCode() => 0; + /// public bool Equals(ILabelCollectionRequest? other) => other is not null; + /// public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is ILabelCollectionRequest other && Equals(other); + /// public static bool operator == (LabelCollectionRequest? left, LabelCollectionRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (LabelCollectionRequest? left, LabelCollectionRequest? right) => !EquatableHelper.IsEquatable(left, right); + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelCreateRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelCreateRequest.cs index 2d04a6b..c05ef32 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelCreateRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelCreateRequest.cs @@ -4,15 +4,30 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class LabelCreateRequest : ILabelCreateRequest { + #region Properties + + /// public string? Name { get; set; } + #endregion + + #region Equatable + + /// public override int GetHashCode() => Name != null ? Name.GetHashCode() : 0; + /// public bool Equals(ILabelCreateRequest? other) => other is not null && string.Equals(Name, other.Name, StringComparison.Ordinal); + /// public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is ILabelCreateRequest other && Equals(other); + /// public static bool operator == (LabelCreateRequest? left, LabelCreateRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (LabelCreateRequest? left, LabelCreateRequest? right) => !EquatableHelper.IsEquatable(left, right); + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelOperationsRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelOperationsRequest.cs index 3379d04..585debb 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelOperationsRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelOperationsRequest.cs @@ -4,10 +4,19 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public abstract class LabelOperationsRequest : ChatOperationsRequest, ILabelOperationsRequest { + #region Properties + + /// public string? LabelId { get; set; } + #endregion + + #region Equatable + + /// public bool Equals(ILabelOperationsRequest? other) { return other is not null && @@ -15,11 +24,13 @@ public bool Equals(ILabelOperationsRequest? other) base.Equals(other); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is ILabelOperationsRequest other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -28,7 +39,11 @@ public override int GetHashCode() } } + /// public static bool operator == (LabelOperationsRequest? left, LabelOperationsRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (LabelOperationsRequest? left, LabelOperationsRequest? right) => !EquatableHelper.IsEquatable(left, right); + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelRemoveRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelRemoveRequest.cs index 134f69c..1729631 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelRemoveRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelRemoveRequest.cs @@ -2,8 +2,10 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class LabelRemoveRequest : ILabelRemoveRequest { + /// public string? LabelId { get; set; } } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelUpdateRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelUpdateRequest.cs index 660193f..bc74394 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/LabelUpdateRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/LabelUpdateRequest.cs @@ -5,12 +5,22 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class LabelUpdateRequest : Label, ILabelUpdateRequest { + #region Equatable + + /// public bool Equals(ILabelUpdateRequest? other) => other is ILabel label && base.Equals(label); + /// public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is LabelUpdateRequest other && Equals(other); + /// public override int GetHashCode() => base.GetHashCode(); + /// public static bool operator == (LabelUpdateRequest? left, LabelUpdateRequest? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (LabelUpdateRequest? left, LabelUpdateRequest? right) => !EquatableHelper.IsEquatable(left, right); + + #endregion } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/LabeledChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/LabeledChatRequest.cs index 253615d..6da1f86 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/LabeledChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/LabeledChatRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class LabeledChatRequest : LabelOperationsRequest, ILabeledChatRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/PinChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/PinChatRequest.cs index 39b6a91..76377ef 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/PinChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/PinChatRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class PinChatRequest : ChatOperationsRequest, IPinChatRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/ReadChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/ReadChatRequest.cs index 990d42c..2208071 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/ReadChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/ReadChatRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class ReadChatRequest : ChatOperationsRequest, IReadChatRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/SendStatusOperations.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/SendStatusOperations.cs index 46e3a61..6b8b8b6 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/SendStatusOperations.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/SendStatusOperations.cs @@ -2,6 +2,9 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public class VoiceRecordingRequest : DialogSendStatusOperationsRequest, IVoiceRecordingRequest { } + + /// public class TypingRequest : DialogSendStatusOperationsRequest, ITypingRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/UnlabeledChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/UnlabeledChatRequest.cs index cb98542..bfd3076 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/UnlabeledChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/UnlabeledChatRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class UnlabeledChatRequest : LabelOperationsRequest, IUnlabeledChatRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/UnpinChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/UnpinChatRequest.cs index ea6cb6a..c9a683c 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/UnpinChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/UnpinChatRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class UnpinChatRequest : ChatOperationsRequest, IUnpinChatRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Requests/UI/UnreadChatRequest.cs b/Src/ChatApi.WA.Dialogs/Requests/UI/UnreadChatRequest.cs index 47bb331..2012cb4 100644 --- a/Src/ChatApi.WA.Dialogs/Requests/UI/UnreadChatRequest.cs +++ b/Src/ChatApi.WA.Dialogs/Requests/UI/UnreadChatRequest.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Requests.UI { + /// public sealed class UnreadChatRequest : ChatOperationsRequest, IUnreadChatRequest { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/AddGroupParticipantResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/AddGroupParticipantResponse.cs index b6cebd7..34e902b 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/AddGroupParticipantResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/AddGroupParticipantResponse.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public class AddGroupParticipantResponse : GroupOperationResponse, IAddGroupParticipantResponse { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/CreateGroupResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/CreateGroupResponse.cs index 491d7ec..c0c461c 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/CreateGroupResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/CreateGroupResponse.cs @@ -5,20 +5,31 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public sealed class CreateGroupResponse : Printable, ICreateGroupResponse { #region Properties + /// public bool? Created { get; set; } + + /// public string? ChatId { get; set; } + + /// public string? Message { get; set; } + + /// public string? ErrorMessage { get; set; } + + /// public string? GroupInviteLink { get; set; } #endregion #region Equatable + /// public bool Equals(ICreateGroupResponse? other) { return other is not null && Created == other.Created && @@ -28,11 +39,13 @@ public bool Equals(ICreateGroupResponse? other) string.Equals(ErrorMessage, other.ErrorMessage, StringComparison.Ordinal); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is CreateGroupResponse other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -46,13 +59,16 @@ public override int GetHashCode() } } + /// public static bool operator == (CreateGroupResponse? left, CreateGroupResponse? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (CreateGroupResponse? left, CreateGroupResponse? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(Created), Created, shift); diff --git a/Src/ChatApi.WA.Dialogs/Responses/DemoteGroupParticipantResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/DemoteGroupParticipantResponse.cs index 8fb0f6a..a2638a8 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/DemoteGroupParticipantResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/DemoteGroupParticipantResponse.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public class DemoteGroupParticipantResponse : GroupOperationResponse, IDemoteGroupParticipantResponse { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/DialogCollectionResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/DialogCollectionResponse.cs index e2e1e6a..be78e38 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/DialogCollectionResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/DialogCollectionResponse.cs @@ -5,17 +5,22 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public sealed class DialogCollectionResponse : Printable, IDialogCollectionResponse { #region Properties + /// public DialogCollection? Dialogs { get; set; } + + /// public string? ErrorMessage { get; set; } #endregion #region Equatable + /// public bool Equals(IDialogCollectionResponse? other) { return other is not null && @@ -23,11 +28,13 @@ public bool Equals(IDialogCollectionResponse? other) ErrorMessage == other.ErrorMessage; } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is IDialogCollectionResponse other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -37,13 +44,16 @@ public override int GetHashCode() } } + /// public static bool operator == (DialogCollectionResponse? left, DialogCollectionResponse? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (DialogCollectionResponse? left, DialogCollectionResponse? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(Dialogs), Dialogs?.PrintMembers(3, shift), shift); diff --git a/Src/ChatApi.WA.Dialogs/Responses/DialogResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/DialogResponse.cs index a74d42c..1dd7073 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/DialogResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/DialogResponse.cs @@ -7,6 +7,7 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public sealed class DialogResponse : Printable, IDialogResponse { #region Backing fields @@ -19,6 +20,7 @@ public sealed class DialogResponse : Printable, IDialogResponse #region Properties + /// public string? ChatId { get => _chatId; @@ -28,18 +30,33 @@ public string? ChatId _splitter = new ChatIdSplitter(value); } } - public string? ChatName { get; set; } - public string? ChatCreator => Splitter?.GetChatCreator(); - public DateTime? ChatCreationDate => Splitter?.GetChatCreationDate(); + + /// public string? Image { get; set; } + + /// + public string? ChatName { get; set; } + + /// public DateTime? LastMessageTime { get; set; } + + /// + public string? ChatCreator => Splitter?.GetChatCreator(); + + /// public IAdditionalChatInfo? AdditionalChatInfo { get; set; } + + /// + public DateTime? ChatCreationDate => Splitter?.GetChatCreationDate(); + + /// public string? ErrorMessage { get; set; } #endregion #region Equatable + /// public bool Equals(IDialogResponse? other) { return other is not null && @@ -53,11 +70,13 @@ public bool Equals(IDialogResponse? other) AdditionalChatInfo == other.AdditionalChatInfo; } + /// public override bool Equals(object? obj) { return Equals(this, obj) || obj is IDialogResponse other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -72,13 +91,16 @@ public override int GetHashCode() } } + /// public static bool operator == (DialogResponse? left, DialogResponse? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (DialogResponse? left, DialogResponse? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(ChatId), ChatId, shift); diff --git a/Src/ChatApi.WA.Dialogs/Responses/GroupOperationResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/GroupOperationResponse.cs index bedd3a7..4a7caab 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/GroupOperationResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/GroupOperationResponse.cs @@ -5,19 +5,28 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public abstract class GroupOperationResponse : Printable, IGroupOperationResponse { #region Properties + /// public bool? IsSuccess { get; set; } + + /// public string? GroupId { get; set; } + + /// public string? ErrorMessage { get; set; } + + /// public string? StatusMessage { get; set; } #endregion #region Equatable + /// public bool Equals(IGroupOperationResponse? other) { return other is not null && IsSuccess == other.IsSuccess && @@ -26,11 +35,13 @@ public bool Equals(IGroupOperationResponse? other) string.Equals(StatusMessage, other.StatusMessage, StringComparison.Ordinal); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is IGroupOperationResponse other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -43,13 +54,16 @@ public override int GetHashCode() } } + /// public static bool operator == (GroupOperationResponse? left, GroupOperationResponse? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (GroupOperationResponse? left, GroupOperationResponse? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(IsSuccess), IsSuccess, shift); diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IAddGroupParticipantResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IAddGroupParticipantResponse.cs index 92fea88..ed62acf 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IAddGroupParticipantResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IAddGroupParticipantResponse.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Responses.Interfaces { + /// public interface IAddGroupParticipantResponse : IGroupOperationResponse { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/ICreateGroupResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/ICreateGroupResponse.cs index 54145b6..adabad0 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/ICreateGroupResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/ICreateGroupResponse.cs @@ -1,9 +1,10 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.Interfaces { + /// public interface ICreateGroupResponse : IChatId, IErrorResponse, IEquatable, IPrintable { /// diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDemoteGroupParticipantResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDemoteGroupParticipantResponse.cs index 3d84b8e..54e2409 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDemoteGroupParticipantResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDemoteGroupParticipantResponse.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Responses.Interfaces { + /// public interface IDemoteGroupParticipantResponse : IGroupOperationResponse { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDialogCollectionResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDialogCollectionResponse.cs index 330534d..e226993 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDialogCollectionResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDialogCollectionResponse.cs @@ -1,11 +1,12 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Converters; using ChatApi.Core.Models.Interfaces; using ChatApi.WA.Dialogs.Helpers.Collections; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.Interfaces { + /// public interface IDialogCollectionResponse : IErrorResponse, IEquatable, IPrintable { /// diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDialogResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDialogResponse.cs index 402295e..e0edb91 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDialogResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IDialogResponse.cs @@ -1,12 +1,13 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Converters; using ChatApi.Core.Models.Interfaces; using ChatApi.WA.Dialogs.Models; using ChatApi.WA.Dialogs.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.Interfaces { + /// public interface IDialogResponse : IErrorResponse, IEquatable, IPrintable { /// diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IGroupOperationResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IGroupOperationResponse.cs index 4a92c1c..1108fea 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IGroupOperationResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IGroupOperationResponse.cs @@ -1,17 +1,22 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.Interfaces { + //Need description:chatApi + /// public interface IGroupOperationResponse : IErrorResponse, IEquatable, IPrintable { + /// [JsonProperty("add", NullValueHandling = NullValueHandling.Ignore)] bool? IsSuccess { get; set; } + /// [JsonProperty("message", NullValueHandling = NullValueHandling.Ignore)] string? StatusMessage { get; set; } + /// [JsonProperty("groupId", NullValueHandling = NullValueHandling.Ignore)] string? GroupId { get; set; } } diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IJoinGroupResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IJoinGroupResponse.cs index 1a121e5..1a067bc 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IJoinGroupResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IJoinGroupResponse.cs @@ -3,6 +3,7 @@ namespace ChatApi.WA.Dialogs.Responses.Interfaces { + /// public interface IJoinGroupResponse : IChatId, IErrorResponse, IEquatable, IPrintable { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/ILeaveGroupResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/ILeaveGroupResponse.cs index 05c9252..ac2979f 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/ILeaveGroupResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/ILeaveGroupResponse.cs @@ -1,14 +1,17 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Converters; using ChatApi.Core.Models.Interfaces; using ChatApi.WA.Dialogs.Models; using ChatApi.WA.Dialogs.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.Interfaces { + //Need description:chatApi + /// public interface ILeaveGroupResponse : IErrorResponse, IEquatable, IPrintable { + /// [JsonConverter(typeof(InterfacesConverter))] [JsonProperty("result", NullValueHandling = NullValueHandling.Ignore)] IOperationMessageResult? Result { get; set; } diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IPromoteGroupParticipantResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IPromoteGroupParticipantResponse.cs index ba1afd4..64c9045 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IPromoteGroupParticipantResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IPromoteGroupParticipantResponse.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Responses.Interfaces { + /// public interface IPromoteGroupParticipantResponse : IGroupOperationResponse { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IRemoveDialogResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IRemoveDialogResponse.cs index b310fc5..eb0066f 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IRemoveDialogResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IRemoveDialogResponse.cs @@ -1,14 +1,17 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Converters; using ChatApi.Core.Models.Interfaces; using ChatApi.WA.Dialogs.Models; using ChatApi.WA.Dialogs.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.Interfaces { + //Need description:chatApi + /// public interface IRemoveDialogResponse : IErrorResponse, IEquatable, IPrintable { + /// [JsonConverter(typeof(InterfacesConverter))] [JsonProperty("result", NullValueHandling = NullValueHandling.Ignore)] IOperationMessageResult? Result { get; set; } diff --git a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IRemoveGroupParticipantResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IRemoveGroupParticipantResponse.cs index d6e6a91..6dd1483 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IRemoveGroupParticipantResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/Interfaces/IRemoveGroupParticipantResponse.cs @@ -1,4 +1,5 @@ namespace ChatApi.WA.Dialogs.Responses.Interfaces { + /// public interface IRemoveGroupParticipantResponse : IGroupOperationResponse { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/JoinGroupResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/JoinGroupResponse.cs index d6356b3..b086549 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/JoinGroupResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/JoinGroupResponse.cs @@ -5,17 +5,22 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public sealed class JoinGroupResponse : Printable, IJoinGroupResponse { #region Properies + /// public string? ChatId { get; set; } + + /// public string? ErrorMessage { get; set; } #endregion #region Equatable + /// public bool Equals(IJoinGroupResponse? other) { return @@ -24,11 +29,13 @@ other is not null && string.Equals(ErrorMessage, other.ErrorMessage, StringComparison.Ordinal); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is JoinGroupResponse other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -37,13 +44,16 @@ public override int GetHashCode() } } + /// public static bool operator == (JoinGroupResponse? left, JoinGroupResponse? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (JoinGroupResponse? left, JoinGroupResponse? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(ChatId), ChatId, shift); diff --git a/Src/ChatApi.WA.Dialogs/Responses/LeaveGroupResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/LeaveGroupResponse.cs index 66041b8..3bb37f5 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/LeaveGroupResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/LeaveGroupResponse.cs @@ -6,17 +6,22 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public sealed class LeaveGroupResponse : Printable, ILeaveGroupResponse { #region Properties + /// public string? ErrorMessage { get; set; } + + /// public IOperationMessageResult? Result { get; set; } #endregion #region Equatable + /// public bool Equals(ILeaveGroupResponse? other) { return other is not null && @@ -24,11 +29,13 @@ public bool Equals(ILeaveGroupResponse? other) Result == other.Result; } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is ILeaveGroupResponse other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -37,13 +44,16 @@ public override int GetHashCode() } } + /// public static bool operator == (LeaveGroupResponse? left, LeaveGroupResponse? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (LeaveGroupResponse? left, LeaveGroupResponse? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(Result), Result, shift); diff --git a/Src/ChatApi.WA.Dialogs/Responses/PromoteGroupParticipantResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/PromoteGroupParticipantResponse.cs index 6f9f137..f366e7c 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/PromoteGroupParticipantResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/PromoteGroupParticipantResponse.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public class PromoteGroupParticipantResponse : GroupOperationResponse, IPromoteGroupParticipantResponse { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/RemoveDialogResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/RemoveDialogResponse.cs index 402ff70..ac4558c 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/RemoveDialogResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/RemoveDialogResponse.cs @@ -5,17 +5,21 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public sealed class RemoveDialogResponse : Printable, IRemoveDialogResponse { #region Properties + /// public string? ErrorMessage { get; set; } + /// public IOperationMessageResult? Result { get; set; } #endregion #region Equatable + /// public bool Equals(IRemoveDialogResponse? other) { return other is not null && @@ -23,11 +27,13 @@ public bool Equals(IRemoveDialogResponse? other) Result == other.Result; } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is IRemoveDialogResponse other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -37,13 +43,16 @@ public override int GetHashCode() } } + /// public static bool operator == (RemoveDialogResponse? left, RemoveDialogResponse? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (RemoveDialogResponse? left, RemoveDialogResponse? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(Result), Result, shift); diff --git a/Src/ChatApi.WA.Dialogs/Responses/RemoveGroupParticipantResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/RemoveGroupParticipantResponse.cs index 4059ada..c344449 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/RemoveGroupParticipantResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/RemoveGroupParticipantResponse.cs @@ -2,5 +2,6 @@ namespace ChatApi.WA.Dialogs.Responses { + /// public class RemoveGroupParticipantResponse : GroupOperationResponse, IRemoveGroupParticipantResponse { } } \ No newline at end of file diff --git a/Src/ChatApi.WA.Dialogs/Responses/UI/ChatOperationResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/UI/ChatOperationResponse.cs index 6952aaa..328846f 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/UI/ChatOperationResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/UI/ChatOperationResponse.cs @@ -5,18 +5,23 @@ namespace ChatApi.WA.Dialogs.Responses.UI { + /// public abstract class ChatOperationResponse : Printable, IChatOperationResponse { #region Properties + /// public string? ChatId { get; set; } + /// public ChatApiStatusOperation? Result { get; set; } + /// public string? ErrorMessage { get; set; } #endregion #region Equatable + /// public bool Equals(IChatOperationResponse? other) { return other is not null && Result == other.Result && @@ -24,11 +29,13 @@ public bool Equals(IChatOperationResponse? other) string.Equals(ErrorMessage, other.ErrorMessage, StringComparison.Ordinal); } + /// public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is IChatOperationResponse other && Equals(other); } + /// public override int GetHashCode() { unchecked @@ -40,13 +47,16 @@ public override int GetHashCode() } } + /// public static bool operator == (ChatOperationResponse? left, ChatOperationResponse? right) => EquatableHelper.IsEquatable(left, right); + /// public static bool operator != (ChatOperationResponse? left, ChatOperationResponse? right) => !EquatableHelper.IsEquatable(left, right); #endregion #region Printable + /// protected override void PrintContent(int shift) { AddMember(nameof(ChatId), ChatId, shift); diff --git a/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/IChatOperationResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/IChatOperationResponse.cs index 8aa6d9f..bd87a26 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/IChatOperationResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/IChatOperationResponse.cs @@ -1,12 +1,15 @@ using System; using ChatApi.Core.Models; -using Newtonsoft.Json; using ChatApi.Core.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.UI.Interfaces { + //Need description:chatApi + /// public interface IChatOperationResponse : IChatId, IErrorResponse, IEquatable, IPrintable { + /// [JsonProperty("result", NullValueHandling = NullValueHandling.Ignore)] ChatApiStatusOperation? Result { get; set; } } diff --git a/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/ILabelCollectionResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/ILabelCollectionResponse.cs index 81b92b8..fb98a5f 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/ILabelCollectionResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/ILabelCollectionResponse.cs @@ -1,12 +1,15 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Models.Interfaces; using ChatApi.WA.Dialogs.Helpers.Collections; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.UI.Interfaces { + //Need description:chatApi + /// public interface ILabelCollectionResponse : IErrorResponse, IEquatable, IPrintable { + /// [JsonProperty("labels", NullValueHandling = NullValueHandling.Ignore)] LabelCollection? LabelCollection { get; set; } } diff --git a/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/ILabelCreateResponse.cs b/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/ILabelCreateResponse.cs index e1198b3..62f041b 100644 --- a/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/ILabelCreateResponse.cs +++ b/Src/ChatApi.WA.Dialogs/Responses/UI/Interfaces/ILabelCreateResponse.cs @@ -1,14 +1,17 @@ using System; -using Newtonsoft.Json; using ChatApi.Core.Converters; using ChatApi.Core.Models.Interfaces; using ChatApi.WA.Dialogs.Models; using ChatApi.WA.Dialogs.Models.Interfaces; +using Newtonsoft.Json; namespace ChatApi.WA.Dialogs.Responses.UI.Interfaces { + //Need description:chatApi + /// public interface ILabelCreateResponse : IOperationResponse, IEquatable, IPrintable { + /// [JsonProperty("label")] [JsonConverter(typeof(InterfacesConverter