Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Appwrite/Appwrite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net462</TargetFrameworks>
<PackageId>Appwrite</PackageId>
<Version>0.19.0</Version>
<Version>0.20.0</Version>
<Authors>Appwrite Team</Authors>
<Company>Appwrite Team</Company>
<Description>
Expand Down
4 changes: 2 additions & 2 deletions Appwrite/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public Client(
_headers = new Dictionary<string, string>()
{
{ "content-type", "application/json" },
{ "user-agent" , $"AppwriteDotNetSDK/0.19.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"},
{ "user-agent" , $"AppwriteDotNetSDK/0.20.0 ({Environment.OSVersion.Platform}; {Environment.OSVersion.VersionString})"},
{ "x-sdk-name", ".NET" },
{ "x-sdk-platform", "server" },
{ "x-sdk-language", "dotnet" },
{ "x-sdk-version", "0.19.0"},
{ "x-sdk-version", "0.20.0"},
{ "X-Appwrite-Response-Format", "1.8.0" }
};

Expand Down
90 changes: 86 additions & 4 deletions Appwrite/Services/Account.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1673,9 +1673,55 @@ static Models.Token Convert(Dictionary<string, object> it) =>
///
/// </para>
/// </summary>
public Task<Models.Token> CreateEmailVerification(string url)
{
var apiPath = "/account/verifications/email";

var apiParameters = new Dictionary<string, object?>()
{
{ "url", url }
};

var apiHeaders = new Dictionary<string, string>()
{
{ "content-type", "application/json" }
};


static Models.Token Convert(Dictionary<string, object> it) =>
Models.Token.From(map: it);

return _client.Call<Models.Token>(
method: "POST",
path: apiPath,
headers: apiHeaders,
parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!,
convert: Convert);

}

/// <para>
/// Use this endpoint to send a verification message to your user email address
/// to confirm they are the valid owners of that address. Both the **userId**
/// and **secret** arguments will be passed as query parameters to the URL you
/// have provided to be attached to the verification email. The provided URL
/// should redirect the user back to your app and allow you to complete the
/// verification process by verifying both the **userId** and **secret**
/// parameters. Learn more about how to [complete the verification
/// process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification).
/// The verification link sent to the user's email address is valid for 7 days.
///
/// Please note that in order to avoid a [Redirect
/// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md),
/// the only valid redirect URLs are the ones from domains you have set when
/// adding your platforms in the console interface.
///
/// </para>
/// </summary>
[Obsolete("This API has been deprecated since 1.8.0. Please use `Account.createEmailVerification` instead.")]
public Task<Models.Token> CreateVerification(string url)
{
var apiPath = "/account/verification";
var apiPath = "/account/verifications/email";

var apiParameters = new Dictionary<string, object?>()
{
Expand Down Expand Up @@ -1707,9 +1753,45 @@ static Models.Token Convert(Dictionary<string, object> it) =>
/// 200 status code.
/// </para>
/// </summary>
public Task<Models.Token> UpdateEmailVerification(string userId, string secret)
{
var apiPath = "/account/verifications/email";

var apiParameters = new Dictionary<string, object?>()
{
{ "userId", userId },
{ "secret", secret }
};

var apiHeaders = new Dictionary<string, string>()
{
{ "content-type", "application/json" }
};


static Models.Token Convert(Dictionary<string, object> it) =>
Models.Token.From(map: it);

return _client.Call<Models.Token>(
method: "PUT",
path: apiPath,
headers: apiHeaders,
parameters: apiParameters.Where(it => it.Value != null).ToDictionary(it => it.Key, it => it.Value)!,
convert: Convert);

}

/// <para>
/// Use this endpoint to complete the user email verification process. Use both
/// the **userId** and **secret** parameters that were attached to your app URL
/// to verify the user email ownership. If confirmed this route will return a
/// 200 status code.
/// </para>
/// </summary>
[Obsolete("This API has been deprecated since 1.8.0. Please use `Account.updateEmailVerification` instead.")]
public Task<Models.Token> UpdateVerification(string userId, string secret)
{
var apiPath = "/account/verification";
var apiPath = "/account/verifications/email";

var apiParameters = new Dictionary<string, object?>()
{
Expand Down Expand Up @@ -1748,7 +1830,7 @@ static Models.Token Convert(Dictionary<string, object> it) =>
/// </summary>
public Task<Models.Token> CreatePhoneVerification()
{
var apiPath = "/account/verification/phone";
var apiPath = "/account/verifications/phone";

var apiParameters = new Dictionary<string, object?>()
{
Expand Down Expand Up @@ -1781,7 +1863,7 @@ static Models.Token Convert(Dictionary<string, object> it) =>
/// </summary>
public Task<Models.Token> UpdatePhoneVerification(string userId, string secret)
{
var apiPath = "/account/verification/phone";
var apiPath = "/account/verifications/phone";

var apiParameters = new Dictionary<string, object?>()
{
Expand Down
2 changes: 1 addition & 1 deletion Appwrite/Services/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ static Models.Deployment Convert(Dictionary<string, object> it) =>
/// Create a deployment based on a template.
///
/// Use this endpoint with combination of
/// [listTemplates](https://appwrite.io/docs/server/functions#listTemplates) to
/// [listTemplates](https://appwrite.io/docs/products/functions/templates) to
/// find the template details.
/// </para>
/// </summary>
Expand Down
4 changes: 2 additions & 2 deletions Appwrite/Services/Sites.cs
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ static Models.Deployment Convert(Dictionary<string, object> it) =>
/// Create a deployment based on a template.
///
/// Use this endpoint with combination of
/// [listTemplates](https://appwrite.io/docs/server/sites#listTemplates) to
/// find the template details.
/// [listTemplates](https://appwrite.io/docs/products/sites/templates) to find
/// the template details.
/// </para>
/// </summary>
public Task<Models.Deployment> CreateTemplateDeployment(string siteId, string repository, string owner, string rootDirectory, string version, bool? activate = null)
Expand Down
10 changes: 5 additions & 5 deletions Appwrite/Services/TablesDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ static Models.TableList Convert(Dictionary<string, object> it) =>
/// <para>
/// Create a new Table. Before using this route, you should create a new
/// database resource using either a [server
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
/// API or directly from your database console.
/// </para>
/// </summary>
Expand Down Expand Up @@ -1583,7 +1583,7 @@ static Models.RowList Convert(Dictionary<string, object> it) =>
/// <para>
/// Create a new Row. Before using this route, you should create a new table
/// resource using either a [server
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
/// API or directly from your database console.
/// </para>
/// </summary>
Expand Down Expand Up @@ -1621,7 +1621,7 @@ static Models.Row Convert(Dictionary<string, object> it) =>
/// <para>
/// Create new Rows. Before using this route, you should create a new table
/// resource using either a [server
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
/// API or directly from your database console.
/// </para>
/// </summary>
Expand Down Expand Up @@ -1657,7 +1657,7 @@ static Models.RowList Convert(Dictionary<string, object> it) =>
/// <para>
/// Create or update Rows. Before using this route, you should create a new
/// table resource using either a [server
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
/// API or directly from your database console.
///
/// </para>
Expand Down Expand Up @@ -1797,7 +1797,7 @@ static Models.Row Convert(Dictionary<string, object> it) =>
/// <para>
/// Create or update a Row. Before using this route, you should create a new
/// table resource using either a [server
/// integration](https://appwrite.io/docs/server/tablesdb#tablesDBCreateTable)
/// integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable)
/// API or directly from your database console.
/// </para>
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 0.20.0

* Deprecate `createVerification` method in `Account` service
* Add `createEmailVerification` method in `Account` service

## 0.15.0

* Add `incrementDocumentAttribute` and `decrementDocumentAttribute` support to `Databases` service
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ Appwrite is an open-source backend as a service server that abstract and simplif
Add this reference to your project's `.csproj` file:

```xml
<PackageReference Include="Appwrite" Version="0.19.0" />
<PackageReference Include="Appwrite" Version="0.20.0" />
```

You can install packages from the command line:

```powershell
# Package Manager
Install-Package Appwrite -Version 0.19.0
Install-Package Appwrite -Version 0.20.0

# or .NET CLI
dotnet add package Appwrite --version 0.19.0
dotnet add package Appwrite --version 0.20.0
```


Expand Down
14 changes: 14 additions & 0 deletions docs/examples/account/create-email-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;

Client client = new Client()
.SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("<YOUR_PROJECT_ID>") // Your project ID
.SetSession(""); // The user session to authenticate with

Account account = new Account(client);

Token result = await account.CreateEmailVerification(
url: "https://example.com"
);
15 changes: 15 additions & 0 deletions docs/examples/account/update-email-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;

Client client = new Client()
.SetEndPoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("<YOUR_PROJECT_ID>") // Your project ID
.SetSession(""); // The user session to authenticate with

Account account = new Account(client);

Token result = await account.UpdateEmailVerification(
userId: "<USER_ID>",
secret: "<SECRET>"
);