Skip to content
This repository was archived by the owner on Dec 18, 2023. It is now read-only.

Commit fe653db

Browse files
authored
Release 1.0.1
2 parents 33fe31d + 9d2d8e1 commit fe653db

File tree

325 files changed

+2559
-577
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+2559
-577
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
*.nuget.props
1616
*.nuget.targets
1717
*.orig
18-
*.DS_Store
18+
*.DS_Store

Documentation/en-EN/ChatApi.Instances/Operations/CreateChatApiInstance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This method is available in both synchronous and asynchronous implementations.
1010
## Response
1111
| `Parameter` | `Description` | `The data type of the parameter` |
1212
|:---------------------:|:---------------------------|:--------------------------------:|
13-
| `Result` | Execution result | `IChatApiCreateInstanceResult`
13+
| `Result` | Result of creating a Chat Api instance | `IChatApiCreateInstanceResult`
1414

1515
## Parameters of the `IChatApiCreateInstanceResult`
1616
| `Parameter` | `Description` | `The data type of the parameter` |

Documentation/en-EN/ChatApi.Instances/Operations/GetChatApiInstances.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This method is available in both synchronous and asynchronous implementations.
1515
| `PaidTill` | End date of the paid period | `DateTime`
1616
| `Instance` | The unique identifier of the instance | `String`
1717
| `IsActive` | An indicator of the activity instance | `Boolean`
18-
| `TypeInstance` | Instance t ype | `ChatApiInstanceType`
18+
| `TypeInstance` | Instance type | `ChatApiInstanceType`
1919
| `PaymentsCount` | Number of paid months | `Integer`
2020

2121
## Example

Documentation/en-EN/WhatsApp/ChatApi.WA.Account/Operations/Expiry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Updates the QR code after its expired
1+
# Updates the QR code after its expired.
22
**<span style="color:green">Implementation notes</span>**<br/>
33
This method is available in both synchronous and asynchronous implementations
44

Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/ReadChat.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This method is available in both synchronous and asynchronous implementations.
1212
## Response
1313
| `Parameter` | `Description` | `The data type of the parameter` |
1414
|:---------------------:|:--------------------------------------------------------|:--------------------------------:|
15-
| `Read` | The status of the request. | `Boolean` |
15+
| `Read` | Message readability indicator | `Boolean` |
1616
| `ChatId` | Unique ID of the dialog. | `String` |
1717
| `Message` | Dialog reading status | `String` |
1818

Documentation/en-EN/WhatsApp/ChatApi.WA.Dialogs/UIOperations/SendTypingStatus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ namespace ChatApiClient
4848

4949
var chatApiResponse = userInterfaceOperations.SendTypingStatus(request);
5050
if (!chatApiResponse.IsSuccess) throw chatApiResponse.Exception!;
51+
5152
var response = chatApiResponse.GetResult();
52-
5353
Console.WriteLine(response?.PrintMembers());
5454
}
5555
}
File renamed without changes.

Src/ChatApi.Core/ChatApi.Core.csproj

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,71 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
5-
<LangVersion>9</LangVersion>
4+
5+
<!-- Basic technical information about the project -->
66
<Nullable>enable</Nullable>
7+
<LangVersion>9</LangVersion>
8+
<TargetFramework>netstandard2.0</TargetFramework>
9+
10+
<!-- Generating a NuGet package (with docs) -->
711
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
12+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
13+
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
14+
15+
<!-- Information about the NuGet package -->
816
<Title>ChatApi.Core</Title>
917
<Authors>Roman Vorontsov</Authors>
10-
<Description>ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com</Description>
11-
<PackageLicenseUrl></PackageLicenseUrl>
12-
<RepositoryUrl>https://github.com/Zodt/ChatApi</RepositoryUrl>
13-
<RepositoryType>GitHub</RepositoryType>
18+
<NeutralLanguage>en</NeutralLanguage>
19+
<PackageIcon>ChatApi.png</PackageIcon>
20+
<PackageVersion>1.0.1-alpha</PackageVersion>
1421
<PackageTags>ChatApi, WhatsAppApi, WhatsApp-Api, WhatsApp</PackageTags>
15-
<PackageProjectUrl></PackageProjectUrl>
22+
<Description>
23+
ChatApi is an unofficial cross-platform libraries for interacting with the chat-api.com
24+
</Description>
25+
<ReleaseNotes>
26+
1. Refactoring code
27+
2. Add xml doc
28+
</ReleaseNotes>
29+
30+
<!-- NuGet Package license information -->
1631
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1732
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
18-
<PackageIcon>ChatApi.png</PackageIcon>
19-
<NeutralLanguage>en</NeutralLanguage>
20-
</PropertyGroup>
2133

22-
<ItemGroup>
23-
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
24-
</ItemGroup>
25-
26-
<ItemGroup>
27-
<Compile Update="Properties\Resources.Designer.cs">
28-
<DesignTime>True</DesignTime>
29-
<AutoGen>True</AutoGen>
30-
<DependentUpon>Resources.resx</DependentUpon>
31-
</Compile>
32-
</ItemGroup>
33-
34-
<ItemGroup>
35-
<EmbeddedResource Update="Properties\Resources.resx">
36-
<Generator>ResXFileCodeGenerator</Generator>
37-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
38-
</EmbeddedResource>
39-
</ItemGroup>
34+
<!-- Information about the project repository -->
35+
<RepositoryType>GitHub</RepositoryType>
36+
<RepositoryUrl>https://github.com/Zodt/ChatApi</RepositoryUrl>
37+
38+
</PropertyGroup>
4039

4140
<ItemGroup>
42-
<None Include="..\ChatApi.png">
43-
<Pack>True</Pack>
44-
<PackagePath></PackagePath>
45-
</None>
41+
42+
<!-- References -->
43+
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
44+
45+
<!-- Resources -->
46+
<Compile Update="Properties\Resources.Designer.cs">
47+
<DesignTime>True</DesignTime>
48+
<AutoGen>True</AutoGen>
49+
<DependentUpon>Resources.resx</DependentUpon>
50+
</Compile>
51+
<EmbeddedResource Update="Properties\Resources.resx">
52+
<Generator>ResXFileCodeGenerator</Generator>
53+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
54+
</EmbeddedResource>
55+
56+
<!-- NuGet project logo -->
57+
<None Include="../../Images/ChatApi.png">
58+
<Pack>True</Pack>
59+
<PackagePath />
60+
</None>
61+
4662
</ItemGroup>
4763

48-
</Project>
64+
<!-- Copying a NuGet package to a specific directory -->
65+
<Target Name="CopyCustomContent" AfterTargets="AfterBuild"
66+
Condition="Exists('..\..\Src\$(ProjectName)\bin\$(Configuration)\$(ProjectName).$(PackageVersion).nupkg')">
67+
<Copy SourceFiles="..\..\Src\$(ProjectName)\bin\$(Configuration)\$(ProjectName).$(PackageVersion).nupkg"
68+
DestinationFolder="..\..\NuGet\$(PackageVersion)" SkipUnchangedFiles="false" ContinueOnError="true" />
69+
</Target>
70+
71+
</Project>

Src/ChatApi.Core/Collections/WhatsAppApiCollection.cs

Lines changed: 73 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@
1010

1111
namespace ChatApi.Core.Collections
1212
{
13+
/// <summary>Provides the base class for a generic WhatsApp-collection.</summary>
14+
/// <typeparam name="T">The type of elements in the collection.</typeparam>
1315
public abstract class WhatsAppApiCollection<T> : Collection<T?>, IPrintableCollection, IEquatable<Collection<T?>?> where T : class, IEquatable<T?>
1416
{
1517
#region Overridden collection methods
1618

19+
/// <summary>
20+
/// Adds an object to the end of the <see cref="T:System.Collections.ObjectModel.Collection`1"></see>.
21+
/// </summary>
22+
/// <param name="item">The object to be added to the end of the <see cref="T:System.Collections.ObjectModel.Collection`1"></see>. The value can be null for reference types.</param>
1723
public new void Add(T item)
1824
{
1925
if (Items.Contains(item)) return;
@@ -22,39 +28,71 @@ public abstract class WhatsAppApiCollection<T> : Collection<T?>, IPrintableColle
2228

2329
#region AddRange
2430

25-
public void AddRange(IEnumerable<T> enumerable)
31+
/// <summary>
32+
/// Adds the elements of the specified collection to the end of the <see cref="T:System.Collections.Generic.IEnumerable`1"></see>.
33+
/// </summary>
34+
/// <param name="collection">The collection whose elements should be added to the end of the <see cref="T:System.Collections.Generic.IEnumerable`1"></see>. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.</param>
35+
/// <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> is null.</exception>
36+
public void AddRange(IEnumerable<T> collection)
2637
{
27-
IList<T> list = enumerable.ToList();
38+
if (collection is null) throw new ArgumentNullException(nameof(collection));
39+
40+
IList<T> list = collection.ToList();
2841
// ReSharper disable once ForCanBeConvertedToForeach
2942
for (int i = 0; i < list.Count; i++)
3043
if (!Items.Contains(list[i]))
3144
base.Add(list[i]);
3245
}
33-
public void AddRange(IList<T> enumerable)
46+
47+
/// <summary>
48+
/// Adds the elements of the specified collection to the end of the <see cref="T:System.Collections.Generic.IList`1"></see>.
49+
/// </summary>
50+
/// <param name="collection">The collection whose elements should be added to the end of the <see cref="T:System.Collections.Generic.IList`1"></see>. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.</param>
51+
/// <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> is null.</exception>
52+
public void AddRange(IList<T>? collection)
3453
{
54+
if (collection is null) throw new ArgumentNullException(nameof(collection));
55+
3556
// ReSharper disable once ForCanBeConvertedToForeach
36-
for (int i = 0; i < enumerable.Count; i++)
37-
if (!Items.Contains(enumerable[i]))
38-
base.Add(enumerable[i]);
57+
for (int i = 0; i < collection.Count; i++)
58+
if (!Items.Contains(collection[i]))
59+
base.Add(collection[i]);
3960
}
40-
public void AddRange(ICollection<T> enumerable)
61+
/// <summary>
62+
/// Adds the elements of the specified collection to the end of the <see cref="T:System.Collections.Generic.ICollection`1"></see>.
63+
/// </summary>
64+
/// <param name="collection">The collection whose elements should be added to the end of the <see cref="T:System.Collections.Generic.ICollection`1"></see>. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.</param>
65+
/// <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> is null.</exception>
66+
public void AddRange(ICollection<T> collection)
4167
{
42-
IList<T> list = enumerable.ToList();
68+
if (collection is null) throw new ArgumentNullException(nameof(collection));
69+
IList<T> list = collection.ToList();
4370
// ReSharper disable once ForCanBeConvertedToForeach
4471
for (int i = 0; i < list.Count; i++)
4572
if (!Items.Contains(list[i]))
4673
base.Add(list[i]);
4774
}
48-
public void AddRange(IReadOnlyList<T> enumerable)
75+
/// <summary>
76+
/// Adds the elements of the specified collection to the end of the <see cref="T:System.Collections.Generic.IReadOnlyList`1"></see>.
77+
/// </summary>
78+
/// <param name="collection">The collection whose elements should be added to the end of the <see cref="T:System.Collections.Generic.IReadOnlyList`1"></see>. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.</param>
79+
/// <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> is null.</exception>
80+
public void AddRange(IReadOnlyList<T> collection)
4981
{
82+
if (collection is null) throw new ArgumentNullException(nameof(collection));
5083
// ReSharper disable once ForCanBeConvertedToForeach
51-
for (int i = 0; i < enumerable.Count; i++)
52-
if (!Items.Contains(enumerable[i]))
53-
base.Add(enumerable[i]);
84+
for (int i = 0; i < collection.Count; i++)
85+
if (!Items.Contains(collection[i]))
86+
base.Add(collection[i]);
5487
}
55-
public void AddRange(IReadOnlyCollection<T> enumerable)
88+
/// <summary>
89+
/// Adds the elements of the specified collection to the end of the <see cref="T:System.Collections.Generic.IReadOnlyCollection`1"></see>.
90+
/// </summary>
91+
/// <param name="collection">The collection whose elements should be added to the end of the <see cref="T:System.Collections.Generic.IReadOnlyCollection`1"></see>. The collection itself cannot be null, but it can contain elements that are null, if type T is a reference type.</param>
92+
/// <exception cref="T:System.ArgumentNullException"><paramref name="collection">collection</paramref> is null.</exception>
93+
public void AddRange(IReadOnlyCollection<T> collection)
5694
{
57-
IList<T> list = enumerable.ToList();
95+
IList<T> list = collection.ToList();
5896
// ReSharper disable once ForCanBeConvertedToForeach
5997
for (int i = 0; i < list.Count; i++)
6098
if (!Items.Contains(list[i]))
@@ -68,6 +106,7 @@ public void AddRange(IReadOnlyCollection<T> enumerable)
68106

69107
#region Equatable
70108

109+
/// <inheritdoc />
71110
public bool Equals(Collection<T?>? other)
72111
{
73112
if (other is null || other.Count != Count) return false;
@@ -88,6 +127,7 @@ public bool Equals(Collection<T?>? other)
88127
return true;
89128
}
90129

130+
/// <inheritdoc />
91131
public override int GetHashCode()
92132
{
93133
unchecked
@@ -102,8 +142,22 @@ public override int GetHashCode()
102142
}
103143
}
104144

145+
/// <inheritdoc />
105146
public override bool Equals(object? obj) => ReferenceEquals(this, obj) || obj is Collection<T?> self && Equals(self);
147+
148+
/// <summary>
149+
///
150+
/// </summary>
151+
/// <param name="left"></param>
152+
/// <param name="right"></param>
153+
/// <returns></returns>
106154
public static bool operator == (WhatsAppApiCollection<T>? left, WhatsAppApiCollection<T>? right) => EquatableHelper.IsEquatable(left, right);
155+
/// <summary>
156+
///
157+
/// </summary>
158+
/// <param name="left"></param>
159+
/// <param name="right"></param>
160+
/// <returns></returns>
107161
public static bool operator != (WhatsAppApiCollection<T>? left, WhatsAppApiCollection<T>? right) => !EquatableHelper.IsEquatable(left, right);
108162

109163
#endregion
@@ -128,6 +182,7 @@ private static string GetShift(int? shiftValue)
128182
return stringBuilder.ToString();
129183
}
130184

185+
/// <inheritdoc />
131186
public string PrintMembers()
132187
{
133188
int shift = default;
@@ -155,6 +210,7 @@ public string PrintMembers()
155210

156211
return _stringBuilder.ToString();
157212
}
213+
/// <inheritdoc />
158214
public string PrintMembers(int shift)
159215
{
160216
_stringBuilder.AppendLine("[");
@@ -167,11 +223,11 @@ public string PrintMembers(int shift)
167223
int maxPrint = Count >= 3 ? 3 : Count;
168224

169225
string currentShift = GetShift(++shift);
170-
if (this[0] is Printable)
226+
if (this[0] is IPrintable)
171227
for (int i = 0; i <= maxPrint - 1; i++)
172228
_stringBuilder.AppendLine(string.Concat((this[i] as Printable)!.PrintMembers(shift-1), ", "));
173229

174-
else if (this[0] is string || !typeof(T).IsInterface)
230+
else if (!typeof(T).IsInterface || !typeof(T).IsClass)
175231
for (int i = 0; i <= maxPrint - 1; i++)
176232
_stringBuilder.AppendLine(string.Concat(currentShift, this[i], ", "));
177233

@@ -184,6 +240,7 @@ public string PrintMembers(int shift)
184240
return _stringBuilder.ToString();
185241
}
186242

243+
/// <inheritdoc />
187244
public string PrintMembers(int countElementPrint, int shift)
188245
{
189246
_stringBuilder.AppendLine("[");

Src/ChatApi.Core/Connect/Interfaces/IChatApiInstanceConnect.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22

33
namespace ChatApi.Core.Connect.Interfaces
44
{
5+
/// <summary/>
56
public interface IChatApiInstanceConnect : IConnect, IChatApiKey { }
67
}

0 commit comments

Comments
 (0)