From 306cd4af1a016a507ee52a125969b9b0d4be9d79 Mon Sep 17 00:00:00 2001
From: loks0n <22452787+loks0n@users.noreply.github.com>
Date: Fri, 21 Jul 2023 21:29:44 +0100
Subject: [PATCH 1/3] feat: dotnet starter
---
dotnet/starter-template/.gitignore | 0
dotnet/starter-template/README.md | 47 +++++++++++++++++++
.../starter-template/StarterTemplate.csproj | 8 ++++
dotnet/starter-template/src/Index.cs | 42 +++++++++++++++++
4 files changed, 97 insertions(+)
create mode 100644 dotnet/starter-template/.gitignore
create mode 100644 dotnet/starter-template/README.md
create mode 100644 dotnet/starter-template/StarterTemplate.csproj
create mode 100644 dotnet/starter-template/src/Index.cs
diff --git a/dotnet/starter-template/.gitignore b/dotnet/starter-template/.gitignore
new file mode 100644
index 00000000..e69de29b
diff --git a/dotnet/starter-template/README.md b/dotnet/starter-template/README.md
new file mode 100644
index 00000000..e66fcf0a
--- /dev/null
+++ b/dotnet/starter-template/README.md
@@ -0,0 +1,47 @@
+# ⚡ .NET Starter Function
+
+A simple starter function. Edit `src/Index.cs` to get started and create something awesome! 🚀
+
+## 🧰 Usage
+
+### `GET`
+
+- Returns a "Hello, World!" message.
+
+**Response**
+
+Sample `200` Response:
+
+```text
+Hello, World! 🌎
+```
+
+### `POST`, `PUT`, `PATCH`, `DELETE`
+
+- Returns a "Learn More" JSON response.
+
+**Response**
+
+Sample `200` Response:
+
+```json
+{
+ "motto": "Build Fast. Scale Big. All in One Place.",
+ "learn": "https://appwrite.io/docs",
+ "connect": "https://appwrite.io/discord",
+ "getInspired": "https://builtwith.appwrite.io"
+}
+```
+
+## ⚙️ Configuration
+
+| Setting | Value |
+|-------------------|----------------|
+| Runtime | dotnet (6.0) |
+| Entrypoint | `src/Index.cs` |
+| Permissions | `any` |
+| Timeout (Seconds) | 15 |
+
+## 🔒 Environment Variables
+
+No environment variables required.
diff --git a/dotnet/starter-template/StarterTemplate.csproj b/dotnet/starter-template/StarterTemplate.csproj
new file mode 100644
index 00000000..43e2d176
--- /dev/null
+++ b/dotnet/starter-template/StarterTemplate.csproj
@@ -0,0 +1,8 @@
+
+
+ net6.0
+ Exe
+ enable
+ enable
+
+
\ No newline at end of file
diff --git a/dotnet/starter-template/src/Index.cs b/dotnet/starter-template/src/Index.cs
new file mode 100644
index 00000000..c19d348a
--- /dev/null
+++ b/dotnet/starter-template/src/Index.cs
@@ -0,0 +1,42 @@
+namespace DotNetRuntime;
+
+using Appwrite;
+using Appwrite.Services;
+using Appwrite.Models;
+
+public class Handler {
+
+ // This is your Appwrite function
+ // It's executed each time we get a request
+ public async Task Main(RuntimeContext Context)
+ {
+ // Why not try the Appwrite SDK?
+ //
+ // var client = new Client()
+ // .SetEndpoint("http://cloud.appwrite.io/v1")
+ // .SetProject("5ff3379a01d25")
+ // .SetKey("cd868db89");
+
+ // You can log messages to the console
+ Context.Log('Hello, Logs! 👋');
+
+ // If something goes wrong, log an error
+ Context.Error('Hello, Errors! ⛔');
+
+ // The `Context.Req` object contains the request data
+ if (Context.Req.Method === 'GET') {
+ // Send a response with the res object helpers
+ // `Context.Res.Send()` dispatches a string back to the client
+ return Context.Req.Send('Hello, World! 🌎');
+ }
+
+ // `Context.Res.Json()` is a handy helper for sending JSON
+ return Context.Res.Json(new()
+ {
+ { 'motto': 'Build Fast. Scale Big. All in One Place.' },
+ { 'learn': 'https://appwrite.io/docs' },
+ { 'connect': 'https://appwrite.io/discord' },
+ { 'getInspired': 'https://builtwith.appwrite.io' },
+ });
+ }
+}
\ No newline at end of file
From 620f2e9129e991ce7a0a1122d730044602e3b5ed Mon Sep 17 00:00:00 2001
From: loks0n <22452787+loks0n@users.noreply.github.com>
Date: Sat, 22 Jul 2023 11:31:39 +0100
Subject: [PATCH 2/3] chore: matej review
---
dotnet/starter-template/.gitignore | 153 +++++++++++++++++++++++++++
dotnet/starter-template/src/Index.cs | 22 ++--
2 files changed, 164 insertions(+), 11 deletions(-)
diff --git a/dotnet/starter-template/.gitignore b/dotnet/starter-template/.gitignore
index e69de29b..f7392465 100644
--- a/dotnet/starter-template/.gitignore
+++ b/dotnet/starter-template/.gitignore
@@ -0,0 +1,153 @@
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+##
+## Visual studio for Mac
+##
+
+
+# globs
+Makefile.in
+*.userprefs
+*.usertasks
+config.make
+config.status
+aclocal.m4
+install-sh
+autom4te.cache/
+*.tar.gz
+tarballs/
+test-results/
+
+# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
+# General
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Files that might appear in the root of a volume
+.DocumentRevisions-V100
+.fseventsd
+.Spotlight-V100
+.TemporaryItems
+.Trashes
+.VolumeIcon.icns
+.com.apple.timemachine.donotpresent
+
+# Folder config file
+[Dd]esktop.ini
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+##
+## Visual Studio Code
+##
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
\ No newline at end of file
diff --git a/dotnet/starter-template/src/Index.cs b/dotnet/starter-template/src/Index.cs
index c19d348a..36fb7f7f 100644
--- a/dotnet/starter-template/src/Index.cs
+++ b/dotnet/starter-template/src/Index.cs
@@ -7,36 +7,36 @@ namespace DotNetRuntime;
public class Handler {
// This is your Appwrite function
- // It's executed each time we get a request
+ // It"s executed each time we get a request
public async Task Main(RuntimeContext Context)
{
// Why not try the Appwrite SDK?
//
// var client = new Client()
// .SetEndpoint("http://cloud.appwrite.io/v1")
- // .SetProject("5ff3379a01d25")
- // .SetKey("cd868db89");
+ // .SetProject(Environment.GetEnvironmentVariable("APPWRITE_PROJECT_ID"))
+ // .SetKey(Environment.GetEnvironmentVariable("APPWRITE_API_KEY"))
// You can log messages to the console
- Context.Log('Hello, Logs! 👋');
+ Context.Log("Hello, Logs! 👋");
// If something goes wrong, log an error
- Context.Error('Hello, Errors! ⛔');
+ Context.Error("Hello, Errors! ⛔");
// The `Context.Req` object contains the request data
- if (Context.Req.Method === 'GET') {
+ if (Context.Req.Method === "GET") {
// Send a response with the res object helpers
// `Context.Res.Send()` dispatches a string back to the client
- return Context.Req.Send('Hello, World! 🌎');
+ return Context.Req.Send("Hello, World! 🌎");
}
// `Context.Res.Json()` is a handy helper for sending JSON
return Context.Res.Json(new()
{
- { 'motto': 'Build Fast. Scale Big. All in One Place.' },
- { 'learn': 'https://appwrite.io/docs' },
- { 'connect': 'https://appwrite.io/discord' },
- { 'getInspired': 'https://builtwith.appwrite.io' },
+ { "motto": "Build Fast. Scale Big. All in One Place." },
+ { "learn": "https://appwrite.io/docs" },
+ { "connect": "https://appwrite.io/discord" },
+ { "getInspired": "https://builtwith.appwrite.io" },
});
}
}
\ No newline at end of file
From a8ccd3ab9b666b1b61d53d808d35b8777ea438b3 Mon Sep 17 00:00:00 2001
From: loks0n <22452787+loks0n@users.noreply.github.com>
Date: Sat, 22 Jul 2023 11:32:37 +0100
Subject: [PATCH 3/3] chore: write dotnet
---
dotnet/starter-template/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dotnet/starter-template/README.md b/dotnet/starter-template/README.md
index e66fcf0a..2e411f17 100644
--- a/dotnet/starter-template/README.md
+++ b/dotnet/starter-template/README.md
@@ -37,7 +37,7 @@ Sample `200` Response:
| Setting | Value |
|-------------------|----------------|
-| Runtime | dotnet (6.0) |
+| Runtime | .NET (6.0) |
| Entrypoint | `src/Index.cs` |
| Permissions | `any` |
| Timeout (Seconds) | 15 |