From 5ffe0d5232c4accbf903faccbfafa82bbb653173 Mon Sep 17 00:00:00 2001 From: Aditya Oberai Date: Thu, 13 Jul 2023 19:17:09 +0530 Subject: [PATCH 1/6] Update Getting Started for Server guide --- .../docs/getting-started-for-server.phtml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/app/views/docs/getting-started-for-server.phtml b/app/views/docs/getting-started-for-server.phtml index a5e1b2c3b..46eb7ec21 100644 --- a/app/views/docs/getting-started-for-server.phtml +++ b/app/views/docs/getting-started-for-server.phtml @@ -99,6 +99,12 @@ $swiftVersion = $versions['swift'] ?? ''; ] +
  • +

    .NET

    +
    +
    dotnet add package Appwrite
    +
    +
  • Create Your First Appwrite Project

    @@ -213,6 +219,18 @@ let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your Appwrite Endpoint .setProject("[PROJECT_ID]") // Your project ID .setKey("919c2db5d4...a2a3346ad2") // Your secret API key + + + +
  • +

    .NET

    +
    +
    using Appwrite;
    +
    +var client = new Client()
    +  .SetEndpoint("http://cloud.appwrite.io/v1")  // Your Appwrite Endpoint
    +  .SetProject("[PROJECT_ID]")               // Your project ID
    +  .SetKey("919c2db5d4...a2a3346ad2");                        // Your secret API Key
     
  • @@ -373,6 +391,18 @@ let client = Client() .setEndpoint("https://cloud.appwrite.io/v1") // Your Appwrite Endpoint .setProject("[PROJECT_ID]") // Your project ID .setJWT("919c2db5d4...a2a3346ad2") // Your secret JWT + + + +
  • +

    .NET

    +
    +
    using Appwrite;
    +
    +var client = new Client()
    +  .SetEndpoint("http://cloud.appwrite.io/v1")  // Your Appwrite Endpoint
    +  .SetProject("[PROJECT_ID]")               // Your project ID
    +  .SetJWT("919c2db5d4...a2a3346ad2");                        // Your secret JWT
     
  • @@ -521,6 +551,22 @@ let user = try await users.create( ) +
  • +

    .NET

    +
    +
    using Appwrite.Services;
    +using Appwrite.Models;
    +
    +var users = new Users(client);
    +
    +var user = await users.Create(
    +    userId: ID.Unique(),
    +    email: "email@example.com",
    +    phone: null,
    +    password: "password");
    +
    +
    +
  • Full Example

    @@ -711,6 +757,28 @@ let user = try await users.create( ) +
  • +

    .NET

    +
    +
    using Appwrite;
    +using Appwrite.Services;
    +using Appwrite.Models;
    +
    +var client = new Client()
    +  .SetEndpoint("http://cloud.appwrite.io/v1")    // Your Appwrite Endpoint
    +  .SetProject("[PROJECT_ID]")                 // Your project ID
    +  .SetKey("cd868db89");                         // Your secret API key
    +
    +var users = new Users(client);
    +
    +var user = await users.Create(
    +    userId: ID.Unique(),
    +    email: "email@example.com",
    +    phone: null,
    +    password: "password");
    +
    +
    +
  • Next Steps

    From 13f8dc2224031f086cb9e9e1b588a568dfb1afcf Mon Sep 17 00:00:00 2001 From: Aditya Oberai Date: Thu, 13 Jul 2023 20:24:22 +0530 Subject: [PATCH 2/6] Update Storage guide --- app/views/docs/storage.phtml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/views/docs/storage.phtml b/app/views/docs/storage.phtml index c54e98b3b..da51c3493 100644 --- a/app/views/docs/storage.phtml +++ b/app/views/docs/storage.phtml @@ -516,6 +516,33 @@ File content. +
  • +

    .NET

    +

    + The Appwrite .NET SDK expects an InputFile class for file inputs. +

    + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    InputFile.FromPath(string path)Used to upload files from a provided path.
    InputFile.FromStream(Stream stream, string filename, string mimeType)Used to upload files from a Stream object. Specify the file MIME type using the mimeType param.
    InputFile.FromBytes(byte[] bytes, string filename, string mimeType)Used to upload files from an array of bytes. Specify the file MIME type using the mimeType param.
  • From e3e8cdef7caa980d48e343ac33ba1e009238ab17 Mon Sep 17 00:00:00 2001 From: Aditya Oberai Date: Thu, 13 Jul 2023 20:40:37 +0530 Subject: [PATCH 3/6] Update Databases Relationships guide --- app/views/docs/databases-relationships.phtml | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/views/docs/databases-relationships.phtml b/app/views/docs/databases-relationships.phtml index d1fec05c4..5b0feb4c0 100644 --- a/app/views/docs/databases-relationships.phtml +++ b/app/views/docs/databases-relationships.phtml @@ -299,6 +299,29 @@ databases.createRelationshipAttribute( ) +
  • +

    .NET

    +
    +
    using Appwrite;
    +using Appwrite.Services;
    +
    +var client = new Client()
    +    .SetEndpoint("https://cloud.appwrite.io/v1")
    +    .SetProject("[PROJECT_ID]");
    +
    +var databases = new Databases(client);
    +
    +await databases.CreateRelationshipAttribute(
    +    databaseId: "marvel",
    +    collectionId: "movies",
    +    relatedCollectionId: "reviews",
    +    type: "oneToMany",
    +    twoWay: true,
    +    key: "reviews",
    +    twoWayKey: "movie",
    +    onDelete: "cascade");
    +
    +
  • The above example adds a relationship between the collections movies and reviews. A relationship attribute with the key reviews is added to the movies collection and another relationship attribute with the key movie is added to the reviews collection.

    From 094663ab116dc195b31e33706c65d51ef73b9d22 Mon Sep 17 00:00:00 2001 From: Aditya Oberai Date: Thu, 13 Jul 2023 21:09:32 +0530 Subject: [PATCH 4/6] Update Server Auth guide --- app/views/docs/authentication-server.phtml | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/app/views/docs/authentication-server.phtml b/app/views/docs/authentication-server.phtml index 6e345d2a0..0cd2012f0 100644 --- a/app/views/docs/authentication-server.phtml +++ b/app/views/docs/authentication-server.phtml @@ -204,6 +204,19 @@ client .setJWT("eyJJ9.eyJ...886ca") // Your secret JSON Web Token +
  • +

    .NET

    +
    +
    using Appwrite;
    +
    +var client = new Client();
    +
    +client
    +    .SetEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
    +    .SetProject("[PROJECT_ID]")                // Your project ID
    +    .SetJWT("eyJJ9.eyJ...886ca");               // Your secret JSON Web Token
    +
    +
  • When Should I Use JWT Auth?

    @@ -409,6 +422,29 @@ let documentList = try await databases.listDocuments( / ... More code to manipulate the results +
  • +

    .NET

    +
    +
    using Appwrite;
    +using Appwrite.Services;
    +using Appwrite.Models;
    +
    +var client = new Client();
    +
    +client
    +    .SetEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
    +    .SetProject("[PROJECT_ID]")                // Your project ID
    +    .SetJWT("eyJJ9.eyJ...886ca");               // Your secret JSON Web Token
    +
    +var databases = new Databases(client);
    +
    +var documentList = await databases.ListDocuments(
    +    databaseId: "642f358bf4084c662590",
    +    collectionId: "642f3592aa5fc856ad1e");
    +
    +// ... More code to manipulate the results
    +
    +
  • Only the birthday of Kevin is returned and documents where user-A has no permissions to access are not returned.

    @@ -590,6 +626,29 @@ client / ... More code to manipulate the results +
  • +

    .NET

    +
    +
    using Appwrite;
    +using Appwrite.Services;
    +using Appwrite.Models;
    +
    +var client = new Client();
    +
    +client
    +    .SetEndpoint("https://cloud.appwrite.io/v1")   // Your API Endpoint
    +    .SetProject("[PROJECT_ID]")                  // Your project ID
    +    .SetKey("919c2d18fb5d4...a2ae413da83346ad2");  // Your secret API key
    +
    +var databases = new Databases(client);
    +
    +var documentList = await databases.ListDocuments(
    +    databaseId: "642f358bf4084c662590",
    +    collectionId: "642f3592aa5fc856ad1e");
    +
    +// ... More code to manipulate the results
    +
    +
  • This will return every document regardless of permissions, which could lead to privacy and security problems.

    From fb6f9d7951a0f632581aa0fab1117cc5a25b45df Mon Sep 17 00:00:00 2001 From: Aditya Oberai Date: Wed, 19 Jul 2023 02:35:58 +0000 Subject: [PATCH 5/6] Remove extra line breaks --- app/views/docs/getting-started-for-server.phtml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/views/docs/getting-started-for-server.phtml b/app/views/docs/getting-started-for-server.phtml index 46eb7ec21..e5ede12fe 100644 --- a/app/views/docs/getting-started-for-server.phtml +++ b/app/views/docs/getting-started-for-server.phtml @@ -230,8 +230,7 @@ let client = Client() var client = new Client() .SetEndpoint("http://cloud.appwrite.io/v1") // Your Appwrite Endpoint .SetProject("[PROJECT_ID]") // Your project ID - .SetKey("919c2db5d4...a2a3346ad2"); // Your secret API Key - + .SetKey("919c2db5d4...a2a3346ad2"); // Your secret API Key @@ -563,8 +562,7 @@ var user = await users.Create( userId: ID.Unique(), email: "email@example.com", phone: null, - password: "password"); - + password: "password"); @@ -775,8 +773,7 @@ var user = await users.Create( userId: ID.Unique(), email: "email@example.com", phone: null, - password: "password"); - + password: "password"); From 23f2a5d9d81a37f39d9456d26049da8508019275 Mon Sep 17 00:00:00 2001 From: Aditya Oberai Date: Wed, 19 Jul 2023 02:37:23 +0000 Subject: [PATCH 6/6] Fix comment in Swift example --- app/views/docs/authentication-server.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/docs/authentication-server.phtml b/app/views/docs/authentication-server.phtml index 0cd2012f0..186b5eb5b 100644 --- a/app/views/docs/authentication-server.phtml +++ b/app/views/docs/authentication-server.phtml @@ -623,7 +623,7 @@ client databaseId: "642f358bf4084c662590", collectionId: "642f3592aa5fc856ad1e" ) - / ... More code to manipulate the results + // ... More code to manipulate the results