Skip to content

Commit

Permalink
Merge pull request #29 from appwrite/dev
Browse files Browse the repository at this point in the history
Fix between query output
  • Loading branch information
christyjacob4 authored Nov 20, 2023
2 parents 0d4f7b3 + 7f577e8 commit 5c20443
Show file tree
Hide file tree
Showing 20 changed files with 542 additions and 216 deletions.
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Appwrite .NET SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-dotnet.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.4.2-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.4.12-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand All @@ -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.6.0" />
<PackageReference Include="Appwrite" Version="0.7.0" />
```

You can install packages from the command line:

```powershell
# Package Manager
Install-Package Appwrite -Version 0.6.0
Install-Package Appwrite -Version 0.7.0
# or .NET CLI
dotnet add package Appwrite --version 0.6.0
dotnet add package Appwrite --version 0.7.0
```


Expand Down Expand Up @@ -86,10 +86,31 @@ You can use the following resources to learn more and get help
- 🚂 [Appwrite .NET Playground](https://github.com/appwrite/playground-for-dotnet)


### Preparing Models for Databases API

For the .NET SDK, we use the `Newtonsoft.Json` library for serialization/deserialization support. The default behavior converts property names from `PascalCase` to `camelCase` on serializing to JSON. In case the names of attributes in your Appwrite collection are not created in `camelCase`, this serializer behavior can cause errors due to mismatches in the names in the serialized JSON and the actual attribute names in your collection.

The way to fix this is to add the `JsonProperty` attribute to the properties in the POCO class you create for your model.

For e.g., if you have two attributes, `name` (`string` type) and `release_date` (`DateTime` type), your POCO class would be created as follows:

```csharp
public class TestModel
{
[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("release_date")]
public DateTime ReleaseDate { get; set; }
}
```

The `JsonProperty` attribute will ensure that your data object for the Appwrite database is serialized with the correct names.

## Contribution

This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.

## License

Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
12 changes: 12 additions & 0 deletions docs/examples/health/get-queue-builds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Appwrite;
using Appwrite.Services;
using Appwrite.Models;

var client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

var health = new Health(client);

HealthQueue result = await health.GetQueueBuilds();
12 changes: 12 additions & 0 deletions docs/examples/health/get-queue-databases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Appwrite;
using Appwrite.Services;
using Appwrite.Models;

var client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

var health = new Health(client);

HealthQueue result = await health.GetQueueDatabases();
12 changes: 12 additions & 0 deletions docs/examples/health/get-queue-deletes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Appwrite;
using Appwrite.Services;
using Appwrite.Models;

var client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

var health = new Health(client);

HealthQueue result = await health.GetQueueDeletes();
12 changes: 12 additions & 0 deletions docs/examples/health/get-queue-mails.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Appwrite;
using Appwrite.Services;
using Appwrite.Models;

var client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

var health = new Health(client);

HealthQueue result = await health.GetQueueMails();
12 changes: 12 additions & 0 deletions docs/examples/health/get-queue-messaging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Appwrite;
using Appwrite.Services;
using Appwrite.Models;

var client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

var health = new Health(client);

HealthQueue result = await health.GetQueueMessaging();
12 changes: 12 additions & 0 deletions docs/examples/health/get-queue-migrations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Appwrite;
using Appwrite.Services;
using Appwrite.Models;

var client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key

var health = new Health(client);

HealthQueue result = await health.GetQueueMigrations();
2 changes: 1 addition & 1 deletion src/Appwrite/Appwrite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<PackageId>Appwrite</PackageId>
<Version>0.6.0</Version>
<Version>0.7.0</Version>
<Authors>Appwrite Team</Authors>
<Company>Appwrite Team</Company>
<Description>
Expand Down
4 changes: 2 additions & 2 deletions src/Appwrite/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public Client(
_headers = new Dictionary<string, string>()
{
{ "content-type", "application/json" },
{ "user-agent" , "AppwriteDotNetSDK/0.6.0 (${Environment.OSVersion.Platform}; ${Environment.OSVersion.VersionString})"},
{ "user-agent" , "AppwriteDotNetSDK/0.7.0 (${Environment.OSVersion.Platform}; ${Environment.OSVersion.VersionString})"},
{ "x-sdk-name", ".NET" },
{ "x-sdk-platform", "server" },
{ "x-sdk-language", "dotnet" },
{ "x-sdk-version", "0.6.0"}, { "X-Appwrite-Response-Format", "1.4.0" }
{ "x-sdk-version", "0.7.0"}, { "X-Appwrite-Response-Format", "1.4.0" }
};

_config = new Dictionary<string, string>();
Expand Down
6 changes: 3 additions & 3 deletions src/Appwrite/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ public static string EndsWith(string attribute, string value)

public static string Between(string attribute, string start, string end)
{
return AddQuery(attribute, "between", new List<string> { start, end });
return $"between(\"{attribute}\", \"{start}\", \"{end}\")";
}

public static string Between(string attribute, int start, int end)
{
return AddQuery(attribute, "between", new List<int> { start, end });
return $"between(\"{attribute}\", {start}, {end})";
}

public static string Between(string attribute, double start, double end)
{
return AddQuery(attribute, "between", new List<double> { start, end });
return $"between(\"{attribute}\", {start}, {end})";
}

public static string Select(List<string> attributes)
Expand Down
Loading

0 comments on commit 5c20443

Please sign in to comment.