diff --git a/.optimize-cache.json b/.optimize-cache.json index 9eb3fa11ae..ce3696453f 100644 --- a/.optimize-cache.json +++ b/.optimize-cache.json @@ -162,6 +162,7 @@ "images/blog/announcing-appwrite-pro/credits.png": "285905e1fd8b8282cb45a4f2259debd851812c23665145d865e141f5133c0be0", "images/blog/announcing-appwrite-pro/header.png": "ab709ff45870607ec4472bd4dc9e4a028e320bbfb89009ec04c98ec69248a15a", "images/blog/announcing-appwrite-pro/pro.png": "01427f30610de4d6d19cd9160154d8849ffa75da04d063d12bf3e9bba481b4e7", + "images/blog/announcing-appwrite-rust-sdk/cover.png": "b5b69e19f4fc1ac5eb985016c1b058bb9ed308680197f315f3b9b861f3377310", "images/blog/announcing-atomic-numeric-operations/cover.png": "9fbe339856b8040eb49fb01ca4353b5600609962ab8044dcfc34ffbe0e8a9738", "images/blog/announcing-auto-increment-support/cover.png": "83a7b1dd0e31ae86e49fa873cde0b6c0319a552b27dc447b4a214efd7f3fd534", "images/blog/announcing-bulk-api/cover.png": "78a0fdf3b54ce8412bf6be1880eb4a42bcac2cb04420045a60bce888c8999c6f", diff --git a/src/icons/optimized/rust.svg b/src/icons/optimized/rust.svg new file mode 100644 index 0000000000..350ce08d06 --- /dev/null +++ b/src/icons/optimized/rust.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/output/_variables.scss b/src/icons/output/_variables.scss index dcaa908c0a..2a0a56c17d 100644 --- a/src/icons/output/_variables.scss +++ b/src/icons/output/_variables.scss @@ -5,63 +5,64 @@ $web-icon-refine: "\ea04"; $web-icon-microsoft: "\ea05"; $web-icon-platform: "\ea06"; $web-icon-vue: "\ea07"; -$web-icon-chevron-down: "\ea08"; -$web-icon-firebase: "\ea09"; -$web-icon-github: "\ea0a"; -$web-icon-ticket: "\ea0b"; -$web-icon-sparkle: "\ea0c"; -$web-icon-divider-vertical: "\ea0d"; -$web-icon-nuxt: "\ea0e"; -$web-icon-chevron-up: "\ea0f"; -$web-icon-ycombinator: "\ea10"; -$web-icon-x: "\ea11"; -$web-icon-textmagic: "\ea12"; -$web-icon-daily-dev: "\ea13"; -$web-icon-chevron-right: "\ea14"; -$web-icon-instagram: "\ea15"; -$web-icon-ext-link: "\ea16"; -$web-icon-arrow-right: "\ea17"; -$web-icon-edge: "\ea18"; -$web-icon-download: "\ea19"; -$web-icon-dark: "\ea1a"; -$web-icon-bluesky: "\ea1b"; -$web-icon-plus: "\ea1c"; -$web-icon-check: "\ea1d"; -$web-icon-close: "\ea1e"; -$web-icon-copy: "\ea1f"; -$web-icon-message: "\ea20"; -$web-icon-play: "\ea21"; -$web-icon-remix: "\ea22"; -$web-icon-skills: "\ea23"; -$web-icon-hamburger-menu: "\ea24"; -$web-icon-google: "\ea25"; -$web-icon-rest: "\ea26"; -$web-icon-star: "\ea27"; -$web-icon-mailgun: "\ea28"; -$web-icon-regions: "\ea29"; -$web-icon-youtube: "\ea2a"; -$web-icon-command: "\ea2b"; -$web-icon-logout-right: "\ea2c"; -$web-icon-tanstack: "\ea2d"; -$web-icon-location: "\ea2e"; -$web-icon-arrow-up: "\ea2f"; -$web-icon-linkedin: "\ea30"; -$web-icon-arena: "\ea31"; -$web-icon-twitter: "\ea32"; -$web-icon-customize: "\ea33"; -$web-icon-discord: "\ea34"; -$web-icon-calendar: "\ea35"; -$web-icon-arrow-left: "\ea36"; -$web-icon-sendgrid: "\ea37"; -$web-icon-pop-locations: "\ea38"; -$web-icon-product-hunt: "\ea39"; -$web-icon-appwrite: "\ea3a"; -$web-icon-arrow-ext-link: "\ea3b"; -$web-icon-logout-left: "\ea3c"; -$web-icon-external-icon: "\ea3d"; -$web-icon-apple: "\ea3e"; -$web-icon-tiktok: "\ea3f"; -$web-icon-minus: "\ea40"; -$web-icon-chevron-left: "\ea41"; -$web-icon-light: "\ea42"; -$web-icon-mcp: "\ea43"; +$web-icon-rust: "\ea08"; +$web-icon-chevron-down: "\ea09"; +$web-icon-firebase: "\ea0a"; +$web-icon-github: "\ea0b"; +$web-icon-ticket: "\ea0c"; +$web-icon-sparkle: "\ea0d"; +$web-icon-divider-vertical: "\ea0e"; +$web-icon-nuxt: "\ea0f"; +$web-icon-chevron-up: "\ea10"; +$web-icon-ycombinator: "\ea11"; +$web-icon-x: "\ea12"; +$web-icon-textmagic: "\ea13"; +$web-icon-daily-dev: "\ea14"; +$web-icon-chevron-right: "\ea15"; +$web-icon-instagram: "\ea16"; +$web-icon-ext-link: "\ea17"; +$web-icon-arrow-right: "\ea18"; +$web-icon-edge: "\ea19"; +$web-icon-download: "\ea1a"; +$web-icon-dark: "\ea1b"; +$web-icon-bluesky: "\ea1c"; +$web-icon-plus: "\ea1d"; +$web-icon-check: "\ea1e"; +$web-icon-close: "\ea1f"; +$web-icon-copy: "\ea20"; +$web-icon-message: "\ea21"; +$web-icon-play: "\ea22"; +$web-icon-remix: "\ea23"; +$web-icon-skills: "\ea24"; +$web-icon-hamburger-menu: "\ea25"; +$web-icon-google: "\ea26"; +$web-icon-rest: "\ea27"; +$web-icon-star: "\ea28"; +$web-icon-mailgun: "\ea29"; +$web-icon-regions: "\ea2a"; +$web-icon-youtube: "\ea2b"; +$web-icon-command: "\ea2c"; +$web-icon-logout-right: "\ea2d"; +$web-icon-tanstack: "\ea2e"; +$web-icon-location: "\ea2f"; +$web-icon-arrow-up: "\ea30"; +$web-icon-linkedin: "\ea31"; +$web-icon-arena: "\ea32"; +$web-icon-twitter: "\ea33"; +$web-icon-customize: "\ea34"; +$web-icon-discord: "\ea35"; +$web-icon-calendar: "\ea36"; +$web-icon-arrow-left: "\ea37"; +$web-icon-sendgrid: "\ea38"; +$web-icon-pop-locations: "\ea39"; +$web-icon-product-hunt: "\ea3a"; +$web-icon-appwrite: "\ea3b"; +$web-icon-arrow-ext-link: "\ea3c"; +$web-icon-logout-left: "\ea3d"; +$web-icon-external-icon: "\ea3e"; +$web-icon-apple: "\ea3f"; +$web-icon-tiktok: "\ea40"; +$web-icon-minus: "\ea41"; +$web-icon-chevron-left: "\ea42"; +$web-icon-light: "\ea43"; +$web-icon-mcp: "\ea44"; diff --git a/src/icons/output/info.json b/src/icons/output/info.json index d978b129ba..49f9c070ed 100644 --- a/src/icons/output/info.json +++ b/src/icons/output/info.json @@ -41,364 +41,370 @@ "className": "web-icon-vue", "unicode": "" }, - "chevron-down": { + "rust": { "encodedCode": "\\ea08", "prefix": "web-icon", - "className": "web-icon-chevron-down", + "className": "web-icon-rust", "unicode": "" }, - "firebase": { + "chevron-down": { "encodedCode": "\\ea09", "prefix": "web-icon", - "className": "web-icon-firebase", + "className": "web-icon-chevron-down", "unicode": "" }, - "github": { + "firebase": { "encodedCode": "\\ea0a", "prefix": "web-icon", - "className": "web-icon-github", + "className": "web-icon-firebase", "unicode": "" }, - "ticket": { + "github": { "encodedCode": "\\ea0b", "prefix": "web-icon", - "className": "web-icon-ticket", + "className": "web-icon-github", "unicode": "" }, - "sparkle": { + "ticket": { "encodedCode": "\\ea0c", "prefix": "web-icon", - "className": "web-icon-sparkle", + "className": "web-icon-ticket", "unicode": "" }, - "divider-vertical": { + "sparkle": { "encodedCode": "\\ea0d", "prefix": "web-icon", - "className": "web-icon-divider-vertical", + "className": "web-icon-sparkle", "unicode": "" }, - "nuxt": { + "divider-vertical": { "encodedCode": "\\ea0e", "prefix": "web-icon", - "className": "web-icon-nuxt", + "className": "web-icon-divider-vertical", "unicode": "" }, - "chevron-up": { + "nuxt": { "encodedCode": "\\ea0f", "prefix": "web-icon", - "className": "web-icon-chevron-up", + "className": "web-icon-nuxt", "unicode": "" }, - "ycombinator": { + "chevron-up": { "encodedCode": "\\ea10", "prefix": "web-icon", - "className": "web-icon-ycombinator", + "className": "web-icon-chevron-up", "unicode": "" }, - "x": { + "ycombinator": { "encodedCode": "\\ea11", "prefix": "web-icon", - "className": "web-icon-x", + "className": "web-icon-ycombinator", "unicode": "" }, - "textmagic": { + "x": { "encodedCode": "\\ea12", "prefix": "web-icon", - "className": "web-icon-textmagic", + "className": "web-icon-x", "unicode": "" }, - "daily-dev": { + "textmagic": { "encodedCode": "\\ea13", "prefix": "web-icon", - "className": "web-icon-daily-dev", + "className": "web-icon-textmagic", "unicode": "" }, - "chevron-right": { + "daily-dev": { "encodedCode": "\\ea14", "prefix": "web-icon", - "className": "web-icon-chevron-right", + "className": "web-icon-daily-dev", "unicode": "" }, - "instagram": { + "chevron-right": { "encodedCode": "\\ea15", "prefix": "web-icon", - "className": "web-icon-instagram", + "className": "web-icon-chevron-right", "unicode": "" }, - "ext-link": { + "instagram": { "encodedCode": "\\ea16", "prefix": "web-icon", - "className": "web-icon-ext-link", + "className": "web-icon-instagram", "unicode": "" }, - "arrow-right": { + "ext-link": { "encodedCode": "\\ea17", "prefix": "web-icon", - "className": "web-icon-arrow-right", + "className": "web-icon-ext-link", "unicode": "" }, - "edge": { + "arrow-right": { "encodedCode": "\\ea18", "prefix": "web-icon", - "className": "web-icon-edge", + "className": "web-icon-arrow-right", "unicode": "" }, - "download": { + "edge": { "encodedCode": "\\ea19", "prefix": "web-icon", - "className": "web-icon-download", + "className": "web-icon-edge", "unicode": "" }, - "dark": { + "download": { "encodedCode": "\\ea1a", "prefix": "web-icon", - "className": "web-icon-dark", + "className": "web-icon-download", "unicode": "" }, - "bluesky": { + "dark": { "encodedCode": "\\ea1b", "prefix": "web-icon", - "className": "web-icon-bluesky", + "className": "web-icon-dark", "unicode": "" }, - "plus": { + "bluesky": { "encodedCode": "\\ea1c", "prefix": "web-icon", - "className": "web-icon-plus", + "className": "web-icon-bluesky", "unicode": "" }, - "check": { + "plus": { "encodedCode": "\\ea1d", "prefix": "web-icon", - "className": "web-icon-check", + "className": "web-icon-plus", "unicode": "" }, - "close": { + "check": { "encodedCode": "\\ea1e", "prefix": "web-icon", - "className": "web-icon-close", + "className": "web-icon-check", "unicode": "" }, - "copy": { + "close": { "encodedCode": "\\ea1f", "prefix": "web-icon", - "className": "web-icon-copy", + "className": "web-icon-close", "unicode": "" }, - "message": { + "copy": { "encodedCode": "\\ea20", "prefix": "web-icon", - "className": "web-icon-message", + "className": "web-icon-copy", "unicode": "" }, - "play": { + "message": { "encodedCode": "\\ea21", "prefix": "web-icon", - "className": "web-icon-play", + "className": "web-icon-message", "unicode": "" }, - "remix": { + "play": { "encodedCode": "\\ea22", "prefix": "web-icon", - "className": "web-icon-remix", + "className": "web-icon-play", "unicode": "" }, - "skills": { + "remix": { "encodedCode": "\\ea23", "prefix": "web-icon", - "className": "web-icon-skills", + "className": "web-icon-remix", "unicode": "" }, - "hamburger-menu": { + "skills": { "encodedCode": "\\ea24", "prefix": "web-icon", - "className": "web-icon-hamburger-menu", + "className": "web-icon-skills", "unicode": "" }, - "google": { + "hamburger-menu": { "encodedCode": "\\ea25", "prefix": "web-icon", - "className": "web-icon-google", + "className": "web-icon-hamburger-menu", "unicode": "" }, - "rest": { + "google": { "encodedCode": "\\ea26", "prefix": "web-icon", - "className": "web-icon-rest", + "className": "web-icon-google", "unicode": "" }, - "star": { + "rest": { "encodedCode": "\\ea27", "prefix": "web-icon", - "className": "web-icon-star", + "className": "web-icon-rest", "unicode": "" }, - "mailgun": { + "star": { "encodedCode": "\\ea28", "prefix": "web-icon", - "className": "web-icon-mailgun", + "className": "web-icon-star", "unicode": "" }, - "regions": { + "mailgun": { "encodedCode": "\\ea29", "prefix": "web-icon", - "className": "web-icon-regions", + "className": "web-icon-mailgun", "unicode": "" }, - "youtube": { + "regions": { "encodedCode": "\\ea2a", "prefix": "web-icon", - "className": "web-icon-youtube", + "className": "web-icon-regions", "unicode": "" }, - "command": { + "youtube": { "encodedCode": "\\ea2b", "prefix": "web-icon", - "className": "web-icon-command", + "className": "web-icon-youtube", "unicode": "" }, - "logout-right": { + "command": { "encodedCode": "\\ea2c", "prefix": "web-icon", - "className": "web-icon-logout-right", + "className": "web-icon-command", "unicode": "" }, - "tanstack": { + "logout-right": { "encodedCode": "\\ea2d", "prefix": "web-icon", - "className": "web-icon-tanstack", + "className": "web-icon-logout-right", "unicode": "" }, - "location": { + "tanstack": { "encodedCode": "\\ea2e", "prefix": "web-icon", - "className": "web-icon-location", + "className": "web-icon-tanstack", "unicode": "" }, - "arrow-up": { + "location": { "encodedCode": "\\ea2f", "prefix": "web-icon", - "className": "web-icon-arrow-up", + "className": "web-icon-location", "unicode": "" }, - "linkedin": { + "arrow-up": { "encodedCode": "\\ea30", "prefix": "web-icon", - "className": "web-icon-linkedin", + "className": "web-icon-arrow-up", "unicode": "" }, - "arena": { + "linkedin": { "encodedCode": "\\ea31", "prefix": "web-icon", - "className": "web-icon-arena", + "className": "web-icon-linkedin", "unicode": "" }, - "twitter": { + "arena": { "encodedCode": "\\ea32", "prefix": "web-icon", - "className": "web-icon-twitter", + "className": "web-icon-arena", "unicode": "" }, - "customize": { + "twitter": { "encodedCode": "\\ea33", "prefix": "web-icon", - "className": "web-icon-customize", + "className": "web-icon-twitter", "unicode": "" }, - "discord": { + "customize": { "encodedCode": "\\ea34", "prefix": "web-icon", - "className": "web-icon-discord", + "className": "web-icon-customize", "unicode": "" }, - "calendar": { + "discord": { "encodedCode": "\\ea35", "prefix": "web-icon", - "className": "web-icon-calendar", + "className": "web-icon-discord", "unicode": "" }, - "arrow-left": { + "calendar": { "encodedCode": "\\ea36", "prefix": "web-icon", - "className": "web-icon-arrow-left", + "className": "web-icon-calendar", "unicode": "" }, - "sendgrid": { + "arrow-left": { "encodedCode": "\\ea37", "prefix": "web-icon", - "className": "web-icon-sendgrid", + "className": "web-icon-arrow-left", "unicode": "" }, - "pop-locations": { + "sendgrid": { "encodedCode": "\\ea38", "prefix": "web-icon", - "className": "web-icon-pop-locations", + "className": "web-icon-sendgrid", "unicode": "" }, - "product-hunt": { + "pop-locations": { "encodedCode": "\\ea39", "prefix": "web-icon", - "className": "web-icon-product-hunt", + "className": "web-icon-pop-locations", "unicode": "" }, - "appwrite": { + "product-hunt": { "encodedCode": "\\ea3a", "prefix": "web-icon", - "className": "web-icon-appwrite", + "className": "web-icon-product-hunt", "unicode": "" }, - "arrow-ext-link": { + "appwrite": { "encodedCode": "\\ea3b", "prefix": "web-icon", - "className": "web-icon-arrow-ext-link", + "className": "web-icon-appwrite", "unicode": "" }, - "logout-left": { + "arrow-ext-link": { "encodedCode": "\\ea3c", "prefix": "web-icon", - "className": "web-icon-logout-left", + "className": "web-icon-arrow-ext-link", "unicode": "" }, - "external-icon": { + "logout-left": { "encodedCode": "\\ea3d", "prefix": "web-icon", - "className": "web-icon-external-icon", + "className": "web-icon-logout-left", "unicode": "" }, - "apple": { + "external-icon": { "encodedCode": "\\ea3e", "prefix": "web-icon", - "className": "web-icon-apple", + "className": "web-icon-external-icon", "unicode": "" }, - "tiktok": { + "apple": { "encodedCode": "\\ea3f", "prefix": "web-icon", - "className": "web-icon-tiktok", + "className": "web-icon-apple", "unicode": "" }, - "minus": { + "tiktok": { "encodedCode": "\\ea40", "prefix": "web-icon", - "className": "web-icon-minus", + "className": "web-icon-tiktok", "unicode": "" }, - "chevron-left": { + "minus": { "encodedCode": "\\ea41", "prefix": "web-icon", - "className": "web-icon-chevron-left", + "className": "web-icon-minus", "unicode": "" }, - "light": { + "chevron-left": { "encodedCode": "\\ea42", "prefix": "web-icon", - "className": "web-icon-light", + "className": "web-icon-chevron-left", "unicode": "" }, - "mcp": { + "light": { "encodedCode": "\\ea43", "prefix": "web-icon", - "className": "web-icon-mcp", + "className": "web-icon-light", "unicode": "" + }, + "mcp": { + "encodedCode": "\\ea44", + "prefix": "web-icon", + "className": "web-icon-mcp", + "unicode": "" } } diff --git a/src/icons/output/web-icon.css b/src/icons/output/web-icon.css index 5ecbd31caa..914702986b 100644 --- a/src/icons/output/web-icon.css +++ b/src/icons/output/web-icon.css @@ -41,183 +41,186 @@ .web-icon-vue:before { content: '\ea07'; } -.web-icon-chevron-down:before { +.web-icon-rust:before { content: '\ea08'; } -.web-icon-firebase:before { +.web-icon-chevron-down:before { content: '\ea09'; } -.web-icon-github:before { +.web-icon-firebase:before { content: '\ea0a'; } -.web-icon-ticket:before { +.web-icon-github:before { content: '\ea0b'; } -.web-icon-sparkle:before { +.web-icon-ticket:before { content: '\ea0c'; } -.web-icon-divider-vertical:before { +.web-icon-sparkle:before { content: '\ea0d'; } -.web-icon-nuxt:before { +.web-icon-divider-vertical:before { content: '\ea0e'; } -.web-icon-chevron-up:before { +.web-icon-nuxt:before { content: '\ea0f'; } -.web-icon-ycombinator:before { +.web-icon-chevron-up:before { content: '\ea10'; } -.web-icon-x:before { +.web-icon-ycombinator:before { content: '\ea11'; } -.web-icon-textmagic:before { +.web-icon-x:before { content: '\ea12'; } -.web-icon-daily-dev:before { +.web-icon-textmagic:before { content: '\ea13'; } -.web-icon-chevron-right:before { +.web-icon-daily-dev:before { content: '\ea14'; } -.web-icon-instagram:before { +.web-icon-chevron-right:before { content: '\ea15'; } -.web-icon-ext-link:before { +.web-icon-instagram:before { content: '\ea16'; } -.web-icon-arrow-right:before { +.web-icon-ext-link:before { content: '\ea17'; } -.web-icon-edge:before { +.web-icon-arrow-right:before { content: '\ea18'; } -.web-icon-download:before { +.web-icon-edge:before { content: '\ea19'; } -.web-icon-dark:before { +.web-icon-download:before { content: '\ea1a'; } -.web-icon-bluesky:before { +.web-icon-dark:before { content: '\ea1b'; } -.web-icon-plus:before { +.web-icon-bluesky:before { content: '\ea1c'; } -.web-icon-check:before { +.web-icon-plus:before { content: '\ea1d'; } -.web-icon-close:before { +.web-icon-check:before { content: '\ea1e'; } -.web-icon-copy:before { +.web-icon-close:before { content: '\ea1f'; } -.web-icon-message:before { +.web-icon-copy:before { content: '\ea20'; } -.web-icon-play:before { +.web-icon-message:before { content: '\ea21'; } -.web-icon-remix:before { +.web-icon-play:before { content: '\ea22'; } -.web-icon-skills:before { +.web-icon-remix:before { content: '\ea23'; } -.web-icon-hamburger-menu:before { +.web-icon-skills:before { content: '\ea24'; } -.web-icon-google:before { +.web-icon-hamburger-menu:before { content: '\ea25'; } -.web-icon-rest:before { +.web-icon-google:before { content: '\ea26'; } -.web-icon-star:before { +.web-icon-rest:before { content: '\ea27'; } -.web-icon-mailgun:before { +.web-icon-star:before { content: '\ea28'; } -.web-icon-regions:before { +.web-icon-mailgun:before { content: '\ea29'; } -.web-icon-youtube:before { +.web-icon-regions:before { content: '\ea2a'; } -.web-icon-command:before { +.web-icon-youtube:before { content: '\ea2b'; } -.web-icon-logout-right:before { +.web-icon-command:before { content: '\ea2c'; } -.web-icon-tanstack:before { +.web-icon-logout-right:before { content: '\ea2d'; } -.web-icon-location:before { +.web-icon-tanstack:before { content: '\ea2e'; } -.web-icon-arrow-up:before { +.web-icon-location:before { content: '\ea2f'; } -.web-icon-linkedin:before { +.web-icon-arrow-up:before { content: '\ea30'; } -.web-icon-arena:before { +.web-icon-linkedin:before { content: '\ea31'; } -.web-icon-twitter:before { +.web-icon-arena:before { content: '\ea32'; } -.web-icon-customize:before { +.web-icon-twitter:before { content: '\ea33'; } -.web-icon-discord:before { +.web-icon-customize:before { content: '\ea34'; } -.web-icon-calendar:before { +.web-icon-discord:before { content: '\ea35'; } -.web-icon-arrow-left:before { +.web-icon-calendar:before { content: '\ea36'; } -.web-icon-sendgrid:before { +.web-icon-arrow-left:before { content: '\ea37'; } -.web-icon-pop-locations:before { +.web-icon-sendgrid:before { content: '\ea38'; } -.web-icon-product-hunt:before { +.web-icon-pop-locations:before { content: '\ea39'; } -.web-icon-appwrite:before { +.web-icon-product-hunt:before { content: '\ea3a'; } -.web-icon-arrow-ext-link:before { +.web-icon-appwrite:before { content: '\ea3b'; } -.web-icon-logout-left:before { +.web-icon-arrow-ext-link:before { content: '\ea3c'; } -.web-icon-external-icon:before { +.web-icon-logout-left:before { content: '\ea3d'; } -.web-icon-apple:before { +.web-icon-external-icon:before { content: '\ea3e'; } -.web-icon-tiktok:before { +.web-icon-apple:before { content: '\ea3f'; } -.web-icon-minus:before { +.web-icon-tiktok:before { content: '\ea40'; } -.web-icon-chevron-left:before { +.web-icon-minus:before { content: '\ea41'; } -.web-icon-light:before { +.web-icon-chevron-left:before { content: '\ea42'; } -.web-icon-mcp:before { +.web-icon-light:before { content: '\ea43'; } +.web-icon-mcp:before { + content: '\ea44'; +} diff --git a/src/icons/output/web-icon.eot b/src/icons/output/web-icon.eot index cc7fe4355c..428dc6f998 100644 Binary files a/src/icons/output/web-icon.eot and b/src/icons/output/web-icon.eot differ diff --git a/src/icons/output/web-icon.scss b/src/icons/output/web-icon.scss index 8e3eeef38b..0913ae9ad4 100644 --- a/src/icons/output/web-icon.scss +++ b/src/icons/output/web-icon.scss @@ -23,66 +23,67 @@ .web-icon-microsoft:before { content: "\ea05"; } .web-icon-platform:before { content: "\ea06"; } .web-icon-vue:before { content: "\ea07"; } -.web-icon-chevron-down:before { content: "\ea08"; } -.web-icon-firebase:before { content: "\ea09"; } -.web-icon-github:before { content: "\ea0a"; } -.web-icon-ticket:before { content: "\ea0b"; } -.web-icon-sparkle:before { content: "\ea0c"; } -.web-icon-divider-vertical:before { content: "\ea0d"; } -.web-icon-nuxt:before { content: "\ea0e"; } -.web-icon-chevron-up:before { content: "\ea0f"; } -.web-icon-ycombinator:before { content: "\ea10"; } -.web-icon-x:before { content: "\ea11"; } -.web-icon-textmagic:before { content: "\ea12"; } -.web-icon-daily-dev:before { content: "\ea13"; } -.web-icon-chevron-right:before { content: "\ea14"; } -.web-icon-instagram:before { content: "\ea15"; } -.web-icon-ext-link:before { content: "\ea16"; } -.web-icon-arrow-right:before { content: "\ea17"; } -.web-icon-edge:before { content: "\ea18"; } -.web-icon-download:before { content: "\ea19"; } -.web-icon-dark:before { content: "\ea1a"; } -.web-icon-bluesky:before { content: "\ea1b"; } -.web-icon-plus:before { content: "\ea1c"; } -.web-icon-check:before { content: "\ea1d"; } -.web-icon-close:before { content: "\ea1e"; } -.web-icon-copy:before { content: "\ea1f"; } -.web-icon-message:before { content: "\ea20"; } -.web-icon-play:before { content: "\ea21"; } -.web-icon-remix:before { content: "\ea22"; } -.web-icon-skills:before { content: "\ea23"; } -.web-icon-hamburger-menu:before { content: "\ea24"; } -.web-icon-google:before { content: "\ea25"; } -.web-icon-rest:before { content: "\ea26"; } -.web-icon-star:before { content: "\ea27"; } -.web-icon-mailgun:before { content: "\ea28"; } -.web-icon-regions:before { content: "\ea29"; } -.web-icon-youtube:before { content: "\ea2a"; } -.web-icon-command:before { content: "\ea2b"; } -.web-icon-logout-right:before { content: "\ea2c"; } -.web-icon-tanstack:before { content: "\ea2d"; } -.web-icon-location:before { content: "\ea2e"; } -.web-icon-arrow-up:before { content: "\ea2f"; } -.web-icon-linkedin:before { content: "\ea30"; } -.web-icon-arena:before { content: "\ea31"; } -.web-icon-twitter:before { content: "\ea32"; } -.web-icon-customize:before { content: "\ea33"; } -.web-icon-discord:before { content: "\ea34"; } -.web-icon-calendar:before { content: "\ea35"; } -.web-icon-arrow-left:before { content: "\ea36"; } -.web-icon-sendgrid:before { content: "\ea37"; } -.web-icon-pop-locations:before { content: "\ea38"; } -.web-icon-product-hunt:before { content: "\ea39"; } -.web-icon-appwrite:before { content: "\ea3a"; } -.web-icon-arrow-ext-link:before { content: "\ea3b"; } -.web-icon-logout-left:before { content: "\ea3c"; } -.web-icon-external-icon:before { content: "\ea3d"; } -.web-icon-apple:before { content: "\ea3e"; } -.web-icon-tiktok:before { content: "\ea3f"; } -.web-icon-minus:before { content: "\ea40"; } -.web-icon-chevron-left:before { content: "\ea41"; } -.web-icon-light:before { content: "\ea42"; } -.web-icon-mcp:before { content: "\ea43"; } +.web-icon-rust:before { content: "\ea08"; } +.web-icon-chevron-down:before { content: "\ea09"; } +.web-icon-firebase:before { content: "\ea0a"; } +.web-icon-github:before { content: "\ea0b"; } +.web-icon-ticket:before { content: "\ea0c"; } +.web-icon-sparkle:before { content: "\ea0d"; } +.web-icon-divider-vertical:before { content: "\ea0e"; } +.web-icon-nuxt:before { content: "\ea0f"; } +.web-icon-chevron-up:before { content: "\ea10"; } +.web-icon-ycombinator:before { content: "\ea11"; } +.web-icon-x:before { content: "\ea12"; } +.web-icon-textmagic:before { content: "\ea13"; } +.web-icon-daily-dev:before { content: "\ea14"; } +.web-icon-chevron-right:before { content: "\ea15"; } +.web-icon-instagram:before { content: "\ea16"; } +.web-icon-ext-link:before { content: "\ea17"; } +.web-icon-arrow-right:before { content: "\ea18"; } +.web-icon-edge:before { content: "\ea19"; } +.web-icon-download:before { content: "\ea1a"; } +.web-icon-dark:before { content: "\ea1b"; } +.web-icon-bluesky:before { content: "\ea1c"; } +.web-icon-plus:before { content: "\ea1d"; } +.web-icon-check:before { content: "\ea1e"; } +.web-icon-close:before { content: "\ea1f"; } +.web-icon-copy:before { content: "\ea20"; } +.web-icon-message:before { content: "\ea21"; } +.web-icon-play:before { content: "\ea22"; } +.web-icon-remix:before { content: "\ea23"; } +.web-icon-skills:before { content: "\ea24"; } +.web-icon-hamburger-menu:before { content: "\ea25"; } +.web-icon-google:before { content: "\ea26"; } +.web-icon-rest:before { content: "\ea27"; } +.web-icon-star:before { content: "\ea28"; } +.web-icon-mailgun:before { content: "\ea29"; } +.web-icon-regions:before { content: "\ea2a"; } +.web-icon-youtube:before { content: "\ea2b"; } +.web-icon-command:before { content: "\ea2c"; } +.web-icon-logout-right:before { content: "\ea2d"; } +.web-icon-tanstack:before { content: "\ea2e"; } +.web-icon-location:before { content: "\ea2f"; } +.web-icon-arrow-up:before { content: "\ea30"; } +.web-icon-linkedin:before { content: "\ea31"; } +.web-icon-arena:before { content: "\ea32"; } +.web-icon-twitter:before { content: "\ea33"; } +.web-icon-customize:before { content: "\ea34"; } +.web-icon-discord:before { content: "\ea35"; } +.web-icon-calendar:before { content: "\ea36"; } +.web-icon-arrow-left:before { content: "\ea37"; } +.web-icon-sendgrid:before { content: "\ea38"; } +.web-icon-pop-locations:before { content: "\ea39"; } +.web-icon-product-hunt:before { content: "\ea3a"; } +.web-icon-appwrite:before { content: "\ea3b"; } +.web-icon-arrow-ext-link:before { content: "\ea3c"; } +.web-icon-logout-left:before { content: "\ea3d"; } +.web-icon-external-icon:before { content: "\ea3e"; } +.web-icon-apple:before { content: "\ea3f"; } +.web-icon-tiktok:before { content: "\ea40"; } +.web-icon-minus:before { content: "\ea41"; } +.web-icon-chevron-left:before { content: "\ea42"; } +.web-icon-light:before { content: "\ea43"; } +.web-icon-mcp:before { content: "\ea44"; } $web-icon-search: "\ea01"; $web-icon-arrow-down: "\ea02"; @@ -91,63 +92,64 @@ $web-icon-refine: "\ea04"; $web-icon-microsoft: "\ea05"; $web-icon-platform: "\ea06"; $web-icon-vue: "\ea07"; -$web-icon-chevron-down: "\ea08"; -$web-icon-firebase: "\ea09"; -$web-icon-github: "\ea0a"; -$web-icon-ticket: "\ea0b"; -$web-icon-sparkle: "\ea0c"; -$web-icon-divider-vertical: "\ea0d"; -$web-icon-nuxt: "\ea0e"; -$web-icon-chevron-up: "\ea0f"; -$web-icon-ycombinator: "\ea10"; -$web-icon-x: "\ea11"; -$web-icon-textmagic: "\ea12"; -$web-icon-daily-dev: "\ea13"; -$web-icon-chevron-right: "\ea14"; -$web-icon-instagram: "\ea15"; -$web-icon-ext-link: "\ea16"; -$web-icon-arrow-right: "\ea17"; -$web-icon-edge: "\ea18"; -$web-icon-download: "\ea19"; -$web-icon-dark: "\ea1a"; -$web-icon-bluesky: "\ea1b"; -$web-icon-plus: "\ea1c"; -$web-icon-check: "\ea1d"; -$web-icon-close: "\ea1e"; -$web-icon-copy: "\ea1f"; -$web-icon-message: "\ea20"; -$web-icon-play: "\ea21"; -$web-icon-remix: "\ea22"; -$web-icon-skills: "\ea23"; -$web-icon-hamburger-menu: "\ea24"; -$web-icon-google: "\ea25"; -$web-icon-rest: "\ea26"; -$web-icon-star: "\ea27"; -$web-icon-mailgun: "\ea28"; -$web-icon-regions: "\ea29"; -$web-icon-youtube: "\ea2a"; -$web-icon-command: "\ea2b"; -$web-icon-logout-right: "\ea2c"; -$web-icon-tanstack: "\ea2d"; -$web-icon-location: "\ea2e"; -$web-icon-arrow-up: "\ea2f"; -$web-icon-linkedin: "\ea30"; -$web-icon-arena: "\ea31"; -$web-icon-twitter: "\ea32"; -$web-icon-customize: "\ea33"; -$web-icon-discord: "\ea34"; -$web-icon-calendar: "\ea35"; -$web-icon-arrow-left: "\ea36"; -$web-icon-sendgrid: "\ea37"; -$web-icon-pop-locations: "\ea38"; -$web-icon-product-hunt: "\ea39"; -$web-icon-appwrite: "\ea3a"; -$web-icon-arrow-ext-link: "\ea3b"; -$web-icon-logout-left: "\ea3c"; -$web-icon-external-icon: "\ea3d"; -$web-icon-apple: "\ea3e"; -$web-icon-tiktok: "\ea3f"; -$web-icon-minus: "\ea40"; -$web-icon-chevron-left: "\ea41"; -$web-icon-light: "\ea42"; -$web-icon-mcp: "\ea43"; +$web-icon-rust: "\ea08"; +$web-icon-chevron-down: "\ea09"; +$web-icon-firebase: "\ea0a"; +$web-icon-github: "\ea0b"; +$web-icon-ticket: "\ea0c"; +$web-icon-sparkle: "\ea0d"; +$web-icon-divider-vertical: "\ea0e"; +$web-icon-nuxt: "\ea0f"; +$web-icon-chevron-up: "\ea10"; +$web-icon-ycombinator: "\ea11"; +$web-icon-x: "\ea12"; +$web-icon-textmagic: "\ea13"; +$web-icon-daily-dev: "\ea14"; +$web-icon-chevron-right: "\ea15"; +$web-icon-instagram: "\ea16"; +$web-icon-ext-link: "\ea17"; +$web-icon-arrow-right: "\ea18"; +$web-icon-edge: "\ea19"; +$web-icon-download: "\ea1a"; +$web-icon-dark: "\ea1b"; +$web-icon-bluesky: "\ea1c"; +$web-icon-plus: "\ea1d"; +$web-icon-check: "\ea1e"; +$web-icon-close: "\ea1f"; +$web-icon-copy: "\ea20"; +$web-icon-message: "\ea21"; +$web-icon-play: "\ea22"; +$web-icon-remix: "\ea23"; +$web-icon-skills: "\ea24"; +$web-icon-hamburger-menu: "\ea25"; +$web-icon-google: "\ea26"; +$web-icon-rest: "\ea27"; +$web-icon-star: "\ea28"; +$web-icon-mailgun: "\ea29"; +$web-icon-regions: "\ea2a"; +$web-icon-youtube: "\ea2b"; +$web-icon-command: "\ea2c"; +$web-icon-logout-right: "\ea2d"; +$web-icon-tanstack: "\ea2e"; +$web-icon-location: "\ea2f"; +$web-icon-arrow-up: "\ea30"; +$web-icon-linkedin: "\ea31"; +$web-icon-arena: "\ea32"; +$web-icon-twitter: "\ea33"; +$web-icon-customize: "\ea34"; +$web-icon-discord: "\ea35"; +$web-icon-calendar: "\ea36"; +$web-icon-arrow-left: "\ea37"; +$web-icon-sendgrid: "\ea38"; +$web-icon-pop-locations: "\ea39"; +$web-icon-product-hunt: "\ea3a"; +$web-icon-appwrite: "\ea3b"; +$web-icon-arrow-ext-link: "\ea3c"; +$web-icon-logout-left: "\ea3d"; +$web-icon-external-icon: "\ea3e"; +$web-icon-apple: "\ea3f"; +$web-icon-tiktok: "\ea40"; +$web-icon-minus: "\ea41"; +$web-icon-chevron-left: "\ea42"; +$web-icon-light: "\ea43"; +$web-icon-mcp: "\ea44"; diff --git a/src/icons/output/web-icon.svg b/src/icons/output/web-icon.svg index b896fa4515..d8dd9ef6d6 100644 --- a/src/icons/output/web-icon.svg +++ b/src/icons/output/web-icon.svg @@ -28,185 +28,188 @@ - + diff --git a/src/icons/output/web-icon.symbol.svg b/src/icons/output/web-icon.symbol.svg index f8db3f3aa7..88d28b1b88 100644 --- a/src/icons/output/web-icon.symbol.svg +++ b/src/icons/output/web-icon.symbol.svg @@ -3,4 +3,4 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/src/icons/output/web-icon.ttf b/src/icons/output/web-icon.ttf index b08109fe00..f2ae1b364d 100644 Binary files a/src/icons/output/web-icon.ttf and b/src/icons/output/web-icon.ttf differ diff --git a/src/icons/output/web-icon.woff b/src/icons/output/web-icon.woff index dd1fb629d8..b82ea54832 100644 Binary files a/src/icons/output/web-icon.woff and b/src/icons/output/web-icon.woff differ diff --git a/src/icons/output/web-icon.woff2 b/src/icons/output/web-icon.woff2 index b8d37b9248..96501b8097 100644 Binary files a/src/icons/output/web-icon.woff2 and b/src/icons/output/web-icon.woff2 differ diff --git a/src/icons/svg/rust.svg b/src/icons/svg/rust.svg new file mode 100644 index 0000000000..1cf4dafe68 --- /dev/null +++ b/src/icons/svg/rust.svg @@ -0,0 +1 @@ + diff --git a/src/lib/components/ui/icon/sprite/sprite.svelte b/src/lib/components/ui/icon/sprite/sprite.svelte index fd69fc81bd..b5628b191e 100644 --- a/src/lib/components/ui/icon/sprite/sprite.svelte +++ b/src/lib/components/ui/icon/sprite/sprite.svelte @@ -57,6 +57,14 @@ fill="currentColor" > + + + = { [Platform.ServerGraphql]: 'graphql', [Platform.ServerRest]: 'http', [Platform.ServerGo]: 'go', + [Platform.ServerRust]: 'rust', vue: 'html', svelte: 'html' }; diff --git a/src/lib/utils/references.ts b/src/lib/utils/references.ts index be37059f1f..3a4fe4f3fd 100644 --- a/src/lib/utils/references.ts +++ b/src/lib/utils/references.ts @@ -61,6 +61,7 @@ export const Platform = { ServerGo: 'server-go', ServerSwift: 'server-swift', ServerKotlin: 'server-kotlin', + ServerRust: 'server-rust', ServerJava: 'server-java', ServerGraphql: 'server-graphql', ServerRest: 'server-rest' @@ -100,6 +101,7 @@ export const platformMap: Record = { [Platform.ServerJava]: 'Java', [Platform.ServerGraphql]: 'GraphQL', [Platform.ServerRest]: 'REST', + [Platform.ServerRust]: 'Rust', [Platform.ServerGo]: 'Go', sh: 'Shell', js: 'JavaScript', @@ -138,6 +140,7 @@ export const platformMap: Record = { svelte: 'Svelte', groovy: 'Groovy', go: 'Go', + rust: 'Rust', dockerfile: 'Dockerfile', docker: 'Dockerfile', ini: 'INI', diff --git a/src/routes/(marketing)/(assets)/icons/light/rust.svg b/src/routes/(marketing)/(assets)/icons/light/rust.svg new file mode 100644 index 0000000000..9367109a2e --- /dev/null +++ b/src/routes/(marketing)/(assets)/icons/light/rust.svg @@ -0,0 +1 @@ + diff --git a/src/routes/(marketing)/(assets)/icons/rust.svg b/src/routes/(marketing)/(assets)/icons/rust.svg new file mode 100644 index 0000000000..eb2b2d28a7 --- /dev/null +++ b/src/routes/(marketing)/(assets)/icons/rust.svg @@ -0,0 +1 @@ + diff --git a/src/routes/(marketing)/(components)/platforms.svelte b/src/routes/(marketing)/(components)/platforms.svelte index 5913dad655..70d7f6814e 100644 --- a/src/routes/(marketing)/(components)/platforms.svelte +++ b/src/routes/(marketing)/(components)/platforms.svelte @@ -25,6 +25,8 @@ import ReactNative from '../(assets)/icons/react-native.svg'; import TanStack from '../(assets)/icons/tanstack.svg'; import TanStackLight from '../(assets)/icons/light/tanstack.svg'; + import Rust from '../(assets)/icons/rust.svg'; + import RustLight from '../(assets)/icons/light/rust.svg'; import GradientText from '$lib/components/fancy/gradient-text.svelte'; import Noise from '$lib/components/fancy/noise.svelte'; import { Tooltip } from 'bits-ui'; @@ -115,6 +117,13 @@ href: '/docs/quick-starts/dart', primary: '#01579B', secondary: '#29B6F6' + }, + { + name: 'Rust', + dark: Rust, + light: RustLight, + href: '/docs/quick-starts/rust', + primary: '#CE422B' } ]; diff --git a/src/routes/blog/post/announcing-appwrite-rust-sdk/+page.markdoc b/src/routes/blog/post/announcing-appwrite-rust-sdk/+page.markdoc new file mode 100644 index 0000000000..9da32d09ff --- /dev/null +++ b/src/routes/blog/post/announcing-appwrite-rust-sdk/+page.markdoc @@ -0,0 +1,118 @@ +--- +layout: post +title: "Introducing the Appwrite Rust SDK" +description: Appwrite now has an official Rust SDK, bringing type-safe, async-first Appwrite integration to the Rust ecosystem. +date: 2026-04-08 +cover: /images/blog/announcing-appwrite-rust-sdk/cover.png +timeToRead: 4 +author: chirag-aggarwal +category: announcement +featured: false +--- + +Appwrite now supports Rust as an official server SDK. The SDK provides async, type-safe access to all Appwrite server-side APIs and is available on [crates.io](https://crates.io/crates/appwrite). + +# Why Rust + +Rust is one of the fastest-growing languages in backend development. Memory safety without garbage collection, zero-cost abstractions, and built-in concurrency make it well-suited for backend services, CLI tools, and infrastructure. With the Rust SDK, developers no longer need to use raw HTTP calls to integrate Appwrite into Rust applications. + +The SDK follows the same conventions as existing Appwrite server SDKs for Node.js, Python, and Go, with an idiomatic Rust API surface. + +# What's included + +The SDK supports every Appwrite server-side service: + +| Service | What you can do | +|---------|----------------| +| **TablesDB** | Create databases, tables, columns, rows. Query with filters, sorting, and pagination. | +| **Account** | Manage sessions, OAuth, MFA, and user preferences. | +| **Users** | Manage users, targets, and labels. | +| **Teams** | Manage teams, memberships, and invites. | +| **Storage** | Create buckets, upload and download files. | +| **Tokens** | Create and manage file tokens for secure file access. | +| **Functions** | Create, deploy, and manage serverless functions. | +| **Messaging** | Send emails, SMS, and push notifications through providers like Twilio, Sendgrid, and more. | +| **Sites** | Create, deploy, and manage web applications. | +| **Locale** | Get user locale, list languages, currencies, countries, and continent information. | +| **Avatars** | Generate user initials, QR codes, country flags, browser icons, favicons, and webpage screenshots. | + +The SDK also includes utility modules for building queries, generating IDs, constructing permissions, and working with operators for atomic database updates. + +# Getting started + +## Step 1: Set up Appwrite + +Set up an Appwrite project by [creating an Appwrite Cloud account](https://cloud.appwrite.io) or [self-hosting Appwrite](/docs/advanced/self-hosting). + +## Step 2: Install the Rust SDK + +Add the SDK and its dependencies to your project: + +```sh +cargo add appwrite +cargo add tokio -F full +cargo add serde_json +``` + +## Step 3: Start building + +Initialize the client and make API calls: + +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::id::ID; +use appwrite::query::Query; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://fra.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + // Create a database and table + let db = tables_db.create(ID::unique(), "MyDB", None).await?; + let table = tables_db.create_table( + &db.id, ID::unique(), "Tasks", + None, None, None, None, None, + ).await?; + + // Create a row + tables_db.create_row( + &db.id, &table.id, ID::unique(), + json!({"title": "Ship Rust SDK", "status": "done"}), + None, None, + ).await?; + + // Query rows + let tasks = tables_db.list_rows( + &db.id, &table.id, + Some(vec![ + Query::equal("status", "done").to_string(), + Query::order_desc("$createdAt").to_string(), + ]), + None, None, None, + ).await?; + + println!("Found {} tasks", tasks.total); + Ok(()) +} +``` + +All service methods are async, return a typed `Result`, and use positional parameters with `Option` for optional fields. The SDK handles authentication headers, request serialization, and error parsing automatically. + +## Step 4: Explore the documentation + +Follow the [Rust quick start guide](/docs/quick-starts/rust) for a step-by-step walkthrough. You can also use the [AI quickstart prompt](/docs/tooling/ai/quickstart-prompts/rust) with tools like Cursor, Claude Code, or Windsurf to set up a project with AI assistance. Rust examples are available across all server SDK documentation pages. + +# Resources + +- [Rust quick start](/docs/quick-starts/rust) +- [SDK on crates.io](https://crates.io/crates/appwrite) +- [SDK repository on GitHub](https://github.com/appwrite/sdk-for-rust) +- [SDKs documentation](/docs/sdks) +- [Discord](https://appwrite.io/discord) diff --git a/src/routes/changelog/(entries)/2026-04-08-1.markdoc b/src/routes/changelog/(entries)/2026-04-08-1.markdoc new file mode 100644 index 0000000000..663ade6d9e --- /dev/null +++ b/src/routes/changelog/(entries)/2026-04-08-1.markdoc @@ -0,0 +1,12 @@ +--- +layout: changelog +title: "Introducing the Appwrite Rust SDK" +date: 2026-04-08 +cover: /images/blog/announcing-appwrite-rust-sdk/cover.png +--- + +Appwrite now supports Rust as an official server SDK. The SDK provides async, type-safe access to all Appwrite server-side APIs, including Databases, Auth, Storage, Functions, and Messaging. It is available on [crates.io](https://crates.io/crates/appwrite). + +{% arrow_link href="/blog/post/announcing-appwrite-rust-sdk" %} +Read the announcement +{% /arrow_link %} diff --git a/src/routes/docs/advanced/platform/api-keys/+page.markdoc b/src/routes/docs/advanced/platform/api-keys/+page.markdoc index 8810f1d424..5faf72dbd4 100644 --- a/src/routes/docs/advanced/platform/api-keys/+page.markdoc +++ b/src/routes/docs/advanced/platform/api-keys/+page.markdoc @@ -137,6 +137,15 @@ Client client = new Client() .setProject("") .setKey(""); // Your API key ``` + +```server-rust +use appwrite::Client; + +let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); // Your API key +``` {% /multicode %} When adding a new API Key, you can choose which [scopes](#scopes) to grant your application. diff --git a/src/routes/docs/products/auth/custom-token/+page.markdoc b/src/routes/docs/products/auth/custom-token/+page.markdoc index 472024b173..9ff8a435a8 100644 --- a/src/routes/docs/products/auth/custom-token/+page.markdoc +++ b/src/routes/docs/products/auth/custom-token/+page.markdoc @@ -150,6 +150,31 @@ var users = new Users(client); var token = await users.CreateToken(""); var secret = token.secret; ``` + +```server-rust +use appwrite::Client; +use appwrite::services::users::Users; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key(""); // Your project API key + + let users = Users::new(&client); + + let token = users.create_token( + "", + None, // length (optional) + None, // expire (optional) + ).await?; + + let secret = token.secret; + println!("{}", secret); + Ok(()) +} +``` {% /multicode %} The newly created token includes a `secret` which is 6 character long hexadecimal string. You can configure length of the secret and expiry when creating a token. diff --git a/src/routes/docs/products/auth/impersonation/+page.markdoc b/src/routes/docs/products/auth/impersonation/+page.markdoc index 11bb76baae..433945c140 100644 --- a/src/routes/docs/products/auth/impersonation/+page.markdoc +++ b/src/routes/docs/products/auth/impersonation/+page.markdoc @@ -212,6 +212,29 @@ users.updateImpersonator( }) ); ``` + +```server-rust +use appwrite::Client; +use appwrite::services::users::Users; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key(""); // Your secret API key + + let users = Users::new(&client); + + let result = users.update_impersonator( + "", + true, + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` {% /multicode %} Only grant this capability to internal users (support agents, QA engineers, or operations staff) who need to see the app exactly as a specific end user would. diff --git a/src/routes/docs/products/auth/labels/+page.markdoc b/src/routes/docs/products/auth/labels/+page.markdoc index 3232ae3312..1a209b272a 100644 --- a/src/routes/docs/products/auth/labels/+page.markdoc +++ b/src/routes/docs/products/auth/labels/+page.markdoc @@ -172,6 +172,29 @@ var response = await users.UpdateLabels( labels: [ 'subscriber' ] ); ``` + +```server-rust +use appwrite::Client; +use appwrite::services::users::Users; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key("98fd4...a2ad2"); // Your secret API key + + let users = Users::new(&client); + + let response = users.update_labels( + "", + vec!["subscriber"], + ).await?; + + println!("{:?}", response); + Ok(()) +} +``` {% /multicode %} This would correspond with the permissions below. diff --git a/src/routes/docs/products/auth/server-side-rendering/+page.markdoc b/src/routes/docs/products/auth/server-side-rendering/+page.markdoc index c203375989..e73c9560f6 100644 --- a/src/routes/docs/products/auth/server-side-rendering/+page.markdoc +++ b/src/routes/docs/products/auth/server-side-rendering/+page.markdoc @@ -83,6 +83,14 @@ admin_client = (Client() ) +``` +```rust +use appwrite::Client; + +let admin_client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key(""); // Your secret API key ``` {% /multicode %} @@ -133,6 +141,18 @@ session = request.cookies.get('a_session_') if session: session_client.set_session(session) +``` +```rust +use appwrite::Client; + +let session_client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project(""); // Your project ID + +let session = req.cookie("a_session_"); // Get the session cookie from the request +if let Some(session) = session { + session_client.set_session(session); +} ``` {% /multicode %} @@ -243,6 +263,32 @@ def login(): except Exception as e: return jsonify({'success': False, 'error': str(e)}), 400 ``` +```rust +use appwrite::Client; +use appwrite::services::account::Account; + +// Initialize admin client here +// ... + +async fn login(admin_client: &Client, email: &str, password: &str) -> Result<(), Box> { + let account = Account::new(admin_client); + + // Create the session using the Appwrite client + let session = account.create_email_password_session( + email, + password, + ).await?; + + // Set the session cookie using the session secret + // Use your framework's cookie API to set: + // name: "a_session_" + // value: session.secret + // httpOnly: true, secure: true, sameSite: strict + // expires: session.expire + + Ok(()) +} +``` {% /multicode %} We also recommend using the `httpOnly`, `secure`, and `sameSite` cookie options to ensure that the cookie is only sent over HTTPS, @@ -331,6 +377,31 @@ def get_user(): except Exception as e: return jsonify({'success': False, 'error': str(e)}), 400 +``` +```rust +use appwrite::Client; +use appwrite::services::account::Account; + +// Initialize the session client here + +// First, read the session cookie from the request +// This depends on your HTTP framework (e.g. actix-web, axum, rocket) +let session = req.cookie("a_session_"); + +// If the session cookie is not present, return an error +if session.is_none() { + // return 401 Unauthorized +} + +// Pass the session cookie to the Appwrite client +let session_client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project(""); +session_client.set_session(session.unwrap()); + +// Now, you can make authenticated requests to the Appwrite API +let account = Account::new(&session_client); +let user = account.get().await?; ``` {% /multicode %} @@ -421,6 +492,18 @@ account = Account(client) result = account.create_anonymous_session() ``` +```rust +use appwrite::Client; +use appwrite::services::account::Account; + +let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project(""); // Your project ID + +let account = Account::new(&client); + +let result = account.create_anonymous_session().await?; +``` {% /multicode %} # Forwarding user agent {% #forwarding-user-agent %} @@ -438,6 +521,11 @@ $client->setForwardedUserAgent($_SERVER['HTTP_USER_AGENT']); ```python client.set_forwarded_user_agent(request.headers.get('user-agent')) ``` +```rust +// This depends on your HTTP framework (e.g. actix-web, axum, rocket) +let user_agent = req.header("user-agent"); +client.add_header("x-forwarded-user-agent", user_agent); +``` {% /multicode %} # OAuth2 {% #oauth2 %} @@ -511,6 +599,27 @@ def oauth(): return redirect(redirect_url) ``` +```rust +use appwrite::Client; +use appwrite::services::account::Account; +use appwrite::enums::OAuthProvider; + +let admin_client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + +let account = Account::new(&admin_client); + +let redirect_url = account.create_o_auth2_token( + OAuthProvider::Github, // Provider + Some("https://example.com/oauth/success"), // Success URL + Some("https://example.com/oauth/failure"), // Failure URL + None, // Scopes +).await?; + +// Redirect the user to redirect_url +``` {% /multicode %} Next, create a success callback endpoint that receives the `userId` and `secret` URL parameters, and then calls `createSession` on the server side. This endpoint returns a session object, which you can store in a cookie. @@ -611,6 +720,35 @@ def oauth_success(): except Exception as e: return jsonify({'success': False, 'error': str(e)}), 400 ``` +```rust +use appwrite::Client; +use appwrite::services::account::Account; + +let admin_client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key(""); // Your secret API key + +let account = Account::new(&admin_client); + +// Get the userId and secret from the URL parameters +// This depends on your HTTP framework (e.g. actix-web, axum, rocket) +let user_id = req.query("userId"); +let secret = req.query("secret"); + +// Create the session using the Appwrite client +let session = account.create_session( + &user_id, + &secret, +).await?; + +// Set the session cookie using the session secret +// Use your framework's cookie API to set: +// name: "a_session_" +// value: session.secret +// httpOnly: true, secure: true, sameSite: strict +// expires: session.expire +``` {% /multicode %} Now the cookie is set, it will be passed to the server with subsequent requests, and you can use it to make authenticated requests to the Appwrite API on behalf of the end-user. diff --git a/src/routes/docs/products/auth/team-invites/+page.markdoc b/src/routes/docs/products/auth/team-invites/+page.markdoc index 0da801e4c8..c16614d1f3 100644 --- a/src/routes/docs/products/auth/team-invites/+page.markdoc +++ b/src/routes/docs/products/auth/team-invites/+page.markdoc @@ -256,6 +256,34 @@ val response = teams.createMembership( name = "John Doe" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::teams::Teams; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let teams = Teams::new(&client); + + // Create membership directly with userId + let membership = teams.create_membership( + "", // teamId + vec!["developer"], // roles + None, // email (optional) + Some(""), // userId (optional) + None, // phone (optional) + None, // url (optional) + Some("John Doe"), // name (optional) + ).await?; + + println!("{:?}", membership); + Ok(()) +} +``` {% /multicode %} # Manage memberships @@ -499,6 +527,46 @@ teamsList.teams.forEach { team -> } } ``` +```server-rust +use appwrite::Client; +use appwrite::services::teams::Teams; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let teams = Teams::new(&client); + + // Get all teams + let teams_list = teams.list( + None, // queries (optional) + None, // search (optional) + None, // total (optional) + ).await?; + + // Iterate through teams to find memberships + for team in &teams_list.teams { + let response = teams.list_memberships( + &team.id, // teamId + None, // queries (optional) + None, // search (optional) + None, // total (optional) + ).await?; + + // Find membership for specific user + if let Some(membership) = response.memberships.iter().find(|m| m.user_id == "") { + println!("Team: {}", team.name); + println!("Joined: {:?}", membership.joined); // None if invited, timestamp if joined + println!("Roles: {:?}", membership.roles); + } + } + + Ok(()) +} +``` {% /multicode %} ## Remove members diff --git a/src/routes/docs/products/databases/atomic-numeric-operations/+page.markdoc b/src/routes/docs/products/databases/atomic-numeric-operations/+page.markdoc index 1333dc0e26..7ff801c48e 100644 --- a/src/routes/docs/products/databases/atomic-numeric-operations/+page.markdoc +++ b/src/routes/docs/products/databases/atomic-numeric-operations/+page.markdoc @@ -144,6 +144,27 @@ result = tablesDB.increment_row_column( value = 1 # value ) ``` +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; + +let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + +let tables_db = TablesDB::new(&client); + +let result = tables_db.increment_row_column( + "", + "", + "", + "likes", // column + Some(1.0), // value + None, // max + None, // transaction_id +).await?; +``` ```graphql mutation { databasesIncrementRowColumn( @@ -277,6 +298,27 @@ result = tablesDB.decrement_row_column( value = 5 # value ) ``` +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; + +let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + +let tables_db = TablesDB::new(&client); + +let result = tables_db.decrement_row_column( + "", + "", + "", + "credits", // column + Some(5.0), // value + None, // min + None, // transaction_id +).await?; +``` ```graphql mutation { databasesDecrementRowColumn( @@ -431,6 +473,29 @@ result2 = tablesDB.decrement_row_column( min = 0 # min (optional) ) ``` +```rust +// Increment with maximum constraint +let result = tables_db.increment_row_column( + "", + "", + "", + "credits", // column + Some(100.0), // value + Some(1000.0), // max (optional) + None, // transaction_id +).await?; + +// Decrement with minimum constraint +let result2 = tables_db.decrement_row_column( + "", + "", + "", + "credits", // column + Some(50.0), // value + Some(0.0), // min (optional) + None, // transaction_id +).await?; +``` {% /multicode %} # Follow best practices {% #follow-best-practices %} @@ -570,6 +635,33 @@ update_result = tablesDB.update_row( } ) ``` +```rust +use serde_json::json; + +// First, increment the likes atomically +let like_result = tables_db.increment_row_column( + "", + "", + "", + "likes", // column + Some(1.0), // value + None, // max + None, // transaction_id +).await?; + +// Then, update other fields +let update_result = tables_db.update_row( + "", + "", + "", + Some(json!({ + "lastLikedBy": user_id, + "lastLikedAt": chrono::Utc::now().to_rfc3339() + })), + None, // permissions + None, // transaction_id +).await?; +``` {% /multicode %} # Use transactions {% #use-transactions %} @@ -675,6 +767,17 @@ tablesDB.increment_row_column( transaction_id = '' ) ``` +```rust +tables_db.increment_row_column( + "", + "", + "", + "likes", + Some(1.0), + None, // max + Some(""), // transaction_id +).await?; +``` ```server-php $tablesDB->incrementRowColumn( databaseId: '', diff --git a/src/routes/docs/products/databases/bulk-operations/+page.markdoc b/src/routes/docs/products/databases/bulk-operations/+page.markdoc index 2b04fa59d4..07a93db88c 100644 --- a/src/routes/docs/products/databases/bulk-operations/+page.markdoc +++ b/src/routes/docs/products/databases/bulk-operations/+page.markdoc @@ -98,6 +98,41 @@ result = tablesDB.create_rows( ] ) ``` + +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let result = tables_db.create_rows( + "", + "", + vec![ + json!({ + "$id": ID::unique(), + "name": "Row 1" + }), + json!({ + "$id": ID::unique(), + "name": "Row 2" + }), + ], + None, + ).await?; + + Ok(()) +} +``` {% /multicode %} # Update rows {% #update-rows %} @@ -154,6 +189,37 @@ result = tablesDB.update_rows( ] ) ``` + +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::query::Query; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let result = tables_db.update_rows( + "", + "", + Some(json!({ + "status": "published" + })), + Some(vec![ + Query::equal("status", "draft").to_string(), + ]), + None, + ).await?; + + Ok(()) +} +``` {% /multicode %} # Upsert rows {% #upsert-rows %} @@ -219,6 +285,41 @@ result = tablesDB.upsert_rows( ] ) ``` + +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let result = tables_db.upsert_rows( + "", + "", + vec![ + json!({ + "$id": ID::unique(), + "name": "New Row 1" + }), + json!({ + "$id": "row-id-2", // Existing row ID + "name": "New Row 2" + }), + ], + None, + ).await?; + + Ok(()) +} +``` {% /multicode %} # Delete rows {% #delete-rows %} @@ -270,6 +371,33 @@ result = tablesDB.delete_rows( ] ) ``` + +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::query::Query; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let result = tables_db.delete_rows( + "", + "", + Some(vec![ + Query::equal("status", "archived").to_string(), + ]), + None, + ).await?; + + Ok(()) +} +``` {% /multicode %} {% info title="Queries for deletion" %} @@ -418,4 +546,21 @@ tablesDB.createRows( }) ); ``` +```rust +let result = tables_db.create_rows( + "", + "", + vec![ + json!({ + "$id": ID::unique(), + "name": "One" + }), + json!({ + "$id": ID::unique(), + "name": "Two" + }), + ], + Some(""), +).await?; +``` {% /multicode %} diff --git a/src/routes/docs/products/databases/databases/+page.markdoc b/src/routes/docs/products/databases/databases/+page.markdoc index ef98f07201..cc3147838b 100644 --- a/src/routes/docs/products/databases/databases/+page.markdoc +++ b/src/routes/docs/products/databases/databases/+page.markdoc @@ -217,4 +217,28 @@ let response = try await tablesDB.create( ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + + let databases = Databases::new(&client); + + let response = databases.create( + "", + "", + None, // enabled (optional) + ).await?; + + println!("{:?}", response); + Ok(()) +} +``` + {% /multicode %} diff --git a/src/routes/docs/products/databases/legacy/atomic-numeric-operations/+page.markdoc b/src/routes/docs/products/databases/legacy/atomic-numeric-operations/+page.markdoc index 961743326e..ba0059935c 100644 --- a/src/routes/docs/products/databases/legacy/atomic-numeric-operations/+page.markdoc +++ b/src/routes/docs/products/databases/legacy/atomic-numeric-operations/+page.markdoc @@ -144,6 +144,33 @@ result = databases.increment_document_column( value = 1 # value ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.increment_document_attribute( + "", + "", + "", + "likes", // attribute + Some(1.0), // value + None, // max (optional) + None, // transaction_id (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` ```graphql mutation { databasesIncrementDocumentColumn( @@ -277,6 +304,33 @@ result = databases.decrement_document_column( value = 5 # value ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.decrement_document_attribute( + "", + "", + "", + "credits", // attribute + Some(5.0), // value + None, // min (optional) + None, // transaction_id (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` ```graphql mutation { databasesDecrementDocumentColumn( @@ -431,6 +485,46 @@ result2 = databases.decrement_document_column( min = 0 # min (optional) ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + // Increment with maximum constraint + let result = databases.increment_document_attribute( + "", + "", + "", + "credits", // attribute + Some(100.0), // value + Some(1000.0), // max (optional) + None, // transaction_id (optional) + ).await?; + + // Decrement with minimum constraint + let result2 = databases.decrement_document_attribute( + "", + "", + "", + "credits", // attribute + Some(50.0), // value + Some(0.0), // min (optional) + None, // transaction_id (optional) + ).await?; + + println!("{:?}", result); + println!("{:?}", result2); + Ok(()) +} +``` {% /multicode %} # Follow best practices {% #follow-best-practices %} @@ -570,6 +664,49 @@ update_result = databases.update_document( } ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + // First, increment the likes atomically + let like_result = databases.increment_document_attribute( + "", + "", + "", + "likes", // attribute + Some(1.0), // value + None, // max (optional) + None, // transaction_id (optional) + ).await?; + + // Then, update other fields + let update_result = databases.update_document( + "", + "", + "", + Some(json!({ + "lastLikedBy": "", + "lastLikedAt": "" + })), + None, // permissions (optional) + None, // transaction_id (optional) + ).await?; + + println!("{:?}", like_result); + println!("{:?}", update_result); + Ok(()) +} +``` {% /multicode %} ## Explore related features diff --git a/src/routes/docs/products/databases/legacy/bulk-operations/+page.markdoc b/src/routes/docs/products/databases/legacy/bulk-operations/+page.markdoc index 496f433a5f..80f666a41a 100644 --- a/src/routes/docs/products/databases/legacy/bulk-operations/+page.markdoc +++ b/src/routes/docs/products/databases/legacy/bulk-operations/+page.markdoc @@ -98,6 +98,41 @@ result = databases.create_documents( ] ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.create_documents( + "", + "", + vec![ + json!({ + "$id": ID::unique(), + "name": "Document 1" + }), + json!({ + "$id": ID::unique(), + "name": "Document 2" + }), + ], + None, // transaction_id (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` {% /multicode %} # Update documents {% #update-documents %} @@ -155,6 +190,37 @@ result = databases.update_documents( ] ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::query::Query; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.update_documents( + "", + "", + Some(json!({ + "status": "published" + })), + Some(vec![ + Query::equal("status", "draft").to_string() + ]), + None, // transaction_id (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` {% /multicode %} # Upsert documents {% #upsert-documents %} @@ -220,6 +286,41 @@ result = databases.upsert_documents( ] ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.upsert_documents( + "", + "", + vec![ + json!({ + "$id": ID::unique(), + "name": "New Document 1" + }), + json!({ + "$id": "document-id-2", + "name": "New Document 2" + }), + ], + None, // transaction_id (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` {% /multicode %} # Delete documents {% #delete-documents %} @@ -271,6 +372,33 @@ result = databases.delete_documents( ] ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::query::Query; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.delete_documents( + "", + "", + Some(vec![ + Query::equal("status", "archived").to_string() + ]), + None, // transaction_id (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` {% /multicode %} {% info title="Queries for deletion" %} diff --git a/src/routes/docs/products/databases/legacy/collections/+page.markdoc b/src/routes/docs/products/databases/legacy/collections/+page.markdoc index 0569f20b47..11bb32ee43 100644 --- a/src/routes/docs/products/databases/legacy/collections/+page.markdoc +++ b/src/routes/docs/products/databases/legacy/collections/+page.markdoc @@ -228,6 +228,34 @@ let collection = try await databases.createCollection( name: "[NAME]" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + + let databases = Databases::new(&client); + + let collection = databases.create_collection( + "", + "", + "[NAME]", + None, // permissions + None, // document_security + None, // enabled + None, // attributes + None, // indexes + ).await?; + + println!("{:?}", collection); + Ok(()) +} +``` {% /multicode %} You can also configure **permissions** in the `createCollection` method, learn more about the `createCollection` in the [API references](/docs/references). diff --git a/src/routes/docs/products/databases/legacy/databases/+page.markdoc b/src/routes/docs/products/databases/legacy/databases/+page.markdoc index 9acf8323be..084d49064b 100644 --- a/src/routes/docs/products/databases/legacy/databases/+page.markdoc +++ b/src/routes/docs/products/databases/legacy/databases/+page.markdoc @@ -210,5 +210,28 @@ let response = try await databases.create( name: "" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::databases::Databases; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + + let databases = Databases::new(&client); + + let response = databases.create( + "", + "", + None, // enabled + ).await?; + + println!("{:?}", response); + Ok(()) +} +``` {% /multicode %} diff --git a/src/routes/docs/products/databases/legacy/queries/+page.markdoc b/src/routes/docs/products/databases/legacy/queries/+page.markdoc index 89e37df7c8..6a72e6de3e 100644 --- a/src/routes/docs/products/databases/legacy/queries/+page.markdoc +++ b/src/routes/docs/products/databases/legacy/queries/+page.markdoc @@ -218,6 +218,38 @@ GET /v1/databases//collections//documents?queries[]= Content-Type: application/json X-Appwrite-Project: ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::query::Query; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.list_documents( + "", + "", + Some(vec![ + Query::equal("title", json!(["Avatar", "Lord of the Rings"])).to_string(), + Query::greater_than("year", 1999).to_string(), + ]), + None, + None, + None, + ).await?; + + println!("{:?}", result); + + Ok(()) +} +``` {% /multicode %} # Query operators {% #query-operators %} @@ -251,6 +283,9 @@ Query.select(["name", "title"]) ```http {"method":"select","values":["name","title"]} ``` +```rust +Query::select(vec!["name", "title"]) +``` {% /multicode %} ### Select relationship data {% #relationship-select %} @@ -312,6 +347,17 @@ GET /v1/databases//collections//documents/ ``` +```rust +let doc = databases.get_document( + "", + "", + "", + Some(vec![ + Query::select(vec!["name", "age"]).to_string(), + ]), + None, +).await?; +``` {% /multicode %} #### Load all relationship data @@ -370,6 +416,17 @@ Content-Type: application/json X-Appwrite-Project: {"method":"select","values":["*","reviews.*"]} ``` +```rust +let doc = databases.get_document( + "", + "", + "", + Some(vec![ + Query::select(vec!["*", "reviews.*"]).to_string(), + ]), + None, +).await?; +``` {% /multicode %} #### Select specific relationship fields @@ -427,6 +484,17 @@ let doc = try await databases.getDocument( # Load specific fields from main and related documents {"method":"select","values":["name","age","reviews.author","reviews.rating"]} ``` +```rust +let doc = databases.get_document( + "", + "", + "", + Some(vec![ + Query::select(vec!["name", "age", "reviews.author", "reviews.rating"]).to_string(), + ]), + None, +).await?; +``` {% /multicode %} #### Load nested relationships @@ -457,6 +525,9 @@ Query.select(["*", "reviews.*", "reviews.author.*"]) ```http {"method":"select","values":["*","reviews.*","reviews.author.*"]} ``` +```rust +Query::select(vec!["*", "reviews.*", "reviews.author.*"]) +``` {% /multicode %} ### Use selection patterns {% #select-patterns %} @@ -515,6 +586,9 @@ Query.equal("title", value: ["Iron Man"]) ```http {"method":"equal","attribute":"title","values":["Iron Man"]} ``` +```rust +Query::equal("title", json!(["Iron Man"])) +``` {% /multicode %} ### Not equal {% #not-equal %} @@ -546,6 +620,9 @@ Query.notEqual("title", value: "Iron Man") ```http {"method":"notEqual","attribute":"title","values":"Iron Man"} ``` +```rust +Query::not_equal("title", "Iron Man") +``` {% /multicode %} ### Less than {% #less-than %} @@ -577,6 +654,9 @@ Query.lessThan("score", value: 10) ```http {"method":"lessThan","attribute":"score","values":[10]} ``` +```rust +Query::less_than("score", 10) +``` {% /multicode %} ### Less than or equal {% #less-than-equal %} @@ -608,6 +688,9 @@ Query.lessThanEqual("score", value: 10) ```http {"method":"lessThanEqual","attribute":"score","values":[10]} ``` +```rust +Query::less_than_equal("score", 10) +``` {% /multicode %} ### Greater than {% #greater-than %} @@ -639,6 +722,9 @@ Query.greaterThan("score", value: 10) ```http {"method":"greaterThan","attribute":"score","values":[10]} ``` +```rust +Query::greater_than("score", 10) +``` {% /multicode %} ### Greater than or equal {% #greater-than-equal %} @@ -670,6 +756,9 @@ Query.greaterThanEqual("score", value: 10) ```http {"method":"greaterThanEqual","attribute":"score","values":[10]} ``` +```rust +Query::greater_than_equal("score", 10) +``` {% /multicode %} ### Between {% #between %} @@ -701,6 +790,9 @@ Query.between("price", start: 5, end: 10) ```http {"method":"between","attribute":"price","values":[5,10]} ``` +```rust +Query::between("price", 5, 10) +``` {% /multicode %} ## Null checks {% #null-checks %} @@ -734,6 +826,9 @@ Query.isNull("name") ```http {"method":"isNull","attribute":"name"} ``` +```rust +Query::is_null("name") +``` {% /multicode %} ### Is not null {% #is-not-null %} @@ -765,6 +860,9 @@ Query.isNotNull("name") ```http {"method":"isNotNull","attribute":"name"} ``` +```rust +Query::is_not_null("name") +``` {% /multicode %} ## String operations {% #string-operations %} @@ -798,6 +896,9 @@ Query.startsWith("name", value: "Once upon a time") ```http {"method":"startsWith","attribute":"name","values":["Once upon a time"]} ``` +```rust +Query::starts_with("name", "Once upon a time") +``` {% /multicode %} ### Ends with {% #ends-with %} @@ -829,6 +930,9 @@ Query.endsWith("name", value: "happily ever after.") ```http {"method":"endsWith","attribute":"name","values":["happily ever after."]} ``` +```rust +Query::ends_with("name", "happily ever after.") +``` {% /multicode %} ### Contains {% #contains %} @@ -892,6 +996,13 @@ Query.contains("name", value: "Tom") # For strings {"method":"contains","attribute":"name","values":["Tom"]} ``` +```rust +// For arrays +Query::contains("ingredients", json!(["apple", "banana"])) + +// For strings +Query::contains("name", "Tom") +``` {% /multicode %} ### Search {% #search %} @@ -927,6 +1038,9 @@ Query.search("text", value: "key words") ```http {"method":"search","attribute":"text","values":["key words"]} ``` +```rust +Query::search("text", "key words") +``` {% /multicode %} ## Logical operators {% #logical-operators %} @@ -981,6 +1095,12 @@ Query.and([ ```http {"method":"and","values":[{"method":"lessThan","attribute":"size","values":[10]},{"method":"greaterThan","attribute":"size","values":[5]}]} ``` +```rust +Query::and(vec![ + Query::less_than("size", 10).to_string(), + Query::greater_than("size", 5).to_string(), +]) +``` {% /multicode %} ### OR {% #or %} @@ -1033,6 +1153,12 @@ Query.or([ ```http {"method":"or","values":[{"method":"lessThan","attribute":"size","values":[5]},{"method":"greaterThan","attribute":"size","values":[10]}]} ``` +```rust +Query::or(vec![ + Query::less_than("size", 5).to_string(), + Query::greater_than("size", 10).to_string(), +]) +``` {% /multicode %} ## Ordering {% #ordering %} @@ -1066,6 +1192,9 @@ Query.orderDesc("attribute") ```http {"method":"orderDesc","attribute":"attribute"} ``` +```rust +Query::order_desc("attribute") +``` {% /multicode %} ### Order ascending {% #order-asc %} @@ -1097,6 +1226,9 @@ Query.orderAsc("attribute") ```http {"method":"orderAsc","attribute":"attribute"} ``` +```rust +Query::order_asc("attribute") +``` {% /multicode %} ## Pagination {% #pagination %} @@ -1130,6 +1262,9 @@ Query.limit(25) ```http {"method":"limit","values":[25]} ``` +```rust +Query::limit(25) +``` {% /multicode %} ### Offset {% #offset %} @@ -1161,6 +1296,9 @@ Query.offset(0) ```http {"method":"offset","values":[0]} ``` +```rust +Query::offset(0) +``` {% /multicode %} ### Cursor after {% #cursor-after %} @@ -1192,6 +1330,9 @@ Query.cursorAfter("62a7...f620") ```http {"method":"cursorAfter","values":["62a7...f620"]} ``` +```rust +Query::cursor_after("62a7...f620") +``` {% /multicode %} ### Cursor before {% #cursor-before %} @@ -1223,6 +1364,9 @@ Query.cursorBefore("62a7...a600") ```http {"method":"cursorBefore","values":["62a7...a600"]} ``` +```rust +Query::cursor_before("62a7...a600") +``` {% /multicode %} # Complex queries {% #complex-queries %} @@ -1287,6 +1431,39 @@ results = databases.list_documents( ```http {"method":"or","values":[{"method":"and","values":[{"method":"equal","attribute":"category","values":["books"]},{"method":"lessThan","attribute":"price","values":[20]}]},{"method":"and","values":[{"method":"equal","attribute":"category","values":["magazines"]},{"method":"lessThan","attribute":"price","values":[10]}]}]} ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::query::Query; +use serde_json::json; + +let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + +let databases = Databases::new(&client); + +let results = databases.list_documents( + "", + "", + Some(vec![ + Query::or(vec![ + Query::and(vec![ + Query::equal("category", json!(["books"])).to_string(), + Query::less_than("price", 20).to_string(), + ]).to_string(), + Query::and(vec![ + Query::equal("category", json!(["magazines"])).to_string(), + Query::less_than("price", 10).to_string(), + ]).to_string(), + ]).to_string(), + ]), + None, + None, + None, +).await?; +``` {% /multicode %} This example demonstrates how to combine `OR` and `AND` operations. The query uses `Query.or()` to match either condition: books under $20 OR magazines under $10. diff --git a/src/routes/docs/products/databases/operators/+page.markdoc b/src/routes/docs/products/databases/operators/+page.markdoc index c45b995729..53ebfaa1ed 100644 --- a/src/routes/docs/products/databases/operators/+page.markdoc +++ b/src/routes/docs/products/databases/operators/+page.markdoc @@ -280,6 +280,35 @@ tablesDB.updateRow( }) ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::operator; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let result = tables_db.update_row( + "", + "", + "", + Some(json!({ + "letters": operator::array_append(&["c"]) + })), + None, + None, + ).await?; + + Ok(()) +} +``` {% /multicode %} @@ -337,6 +366,9 @@ Operator.increment(1) ```server-java Operator.increment(1) ``` +```server-rust +operator::increment_by(1) +``` {% /multicode %} ### decrement {% #decrement %} @@ -374,6 +406,9 @@ Operator.decrement(1) ```server-java Operator.decrement(1) ``` +```server-rust +operator::decrement_by(1) +``` {% /multicode %} ### multiply {% #multiply %} @@ -411,6 +446,9 @@ Operator.multiply(2) ```server-java Operator.multiply(2) ``` +```server-rust +operator::multiply(2) +``` {% /multicode %} ### divide {% #divide %} @@ -448,6 +486,9 @@ Operator.divide(5) ```server-java Operator.divide(5) ``` +```server-rust +operator::divide(5) +``` {% /multicode %} ### modulo {% #modulo %} @@ -485,6 +526,9 @@ Operator.modulo(3) ```server-java Operator.modulo(3) ``` +```server-rust +operator::modulo(3) +``` {% /multicode %} ### power {% #power %} @@ -522,6 +566,9 @@ Operator.power(2) ```server-java Operator.power(2) ``` +```server-rust +operator::power(2) +``` {% /multicode %} ## Array {% #array %} @@ -563,6 +610,9 @@ Operator.arrayAppend(['c']) ```server-java Operator.arrayAppend(List.of("c")) ``` +```server-rust +operator::array_append(&["c"]) +``` {% /multicode %} ### arrayPrepend {% #array-prepend %} @@ -600,6 +650,9 @@ Operator.arrayPrepend(['z']) ```server-java Operator.arrayPrepend(List.of("z")) ``` +```server-rust +operator::array_prepend(&["z"]) +``` {% /multicode %} ### arrayInsert {% #array-insert %} @@ -637,6 +690,9 @@ Operator.arrayInsert(1, 'x') ```server-java Operator.arrayInsert(1, "x") ``` +```server-rust +operator::array_insert(1, "x") +``` {% /multicode %} ### arrayRemove {% #array-remove %} @@ -674,6 +730,9 @@ Operator.arrayRemove('b') ```server-java Operator.arrayRemove("b") ``` +```server-rust +operator::array_remove("b") +``` {% /multicode %} ### arrayUnique {% #array-unique %} @@ -711,6 +770,9 @@ Operator.arrayUnique() ```server-java Operator.arrayUnique() ``` +```server-rust +operator::array_unique() +``` {% /multicode %} ### arrayIntersect {% #array-intersect %} @@ -748,6 +810,9 @@ Operator.arrayIntersect(['news', 'tech']) ```server-java Operator.arrayIntersect(new String[] {"news", "tech"}) ``` +```server-rust +operator::array_intersect(&["news", "tech"]) +``` {% /multicode %} ### arrayDiff {% #array-diff %} @@ -785,6 +850,9 @@ Operator.arrayDiff(['old']) ```server-java Operator.arrayDiff(new String[] {"old"}) ``` +```server-rust +operator::array_diff(&["old"]) +``` {% /multicode %} ### arrayFilter {% #array-filter %} @@ -822,6 +890,9 @@ Operator.arrayFilter(Condition.GreaterThan, 10) ```server-java Operator.arrayFilter(Condition.GreaterThan, 10) ``` +```server-rust +operator::array_filter_with_value(operator::Condition::GreaterThan, 10) +``` {% /multicode %} ## String {% #string %} @@ -863,6 +934,9 @@ Operator.stringConcat('!') ```server-java Operator.stringConcat("!") ``` +```server-rust +operator::string_concat("!") +``` {% /multicode %} ### stringReplace {% #string-replace %} @@ -900,6 +974,9 @@ Operator.stringReplace('old', 'new') ```server-java Operator.stringReplace("old", "new") ``` +```server-rust +operator::string_replace("old", "new") +``` {% /multicode %} ## Date {% #date %} @@ -941,6 +1018,9 @@ Operator.dateAddDays(7) ```server-java Operator.dateAddDays(7) ``` +```server-rust +operator::date_add_days(7) +``` {% /multicode %} ### dateSubDays {% #date-sub-days %} @@ -978,6 +1058,9 @@ Operator.dateSubDays(3) ```server-java Operator.dateSubDays(3) ``` +```server-rust +operator::date_sub_days(3) +``` {% /multicode %} ### dateSetNow {% #date-set-now %} @@ -1015,6 +1098,9 @@ Operator.dateSetNow() ```server-java Operator.dateSetNow() ``` +```server-rust +operator::date_set_now() +``` {% /multicode %} ## Boolean {% #boolean %} @@ -1056,6 +1142,9 @@ Operator.toggle() ```server-java Operator.toggle() ``` +```server-rust +operator::toggle() +``` {% /multicode %} # Examples {% #examples %} @@ -1318,6 +1407,35 @@ tablesDB.updateRow( }) ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::operator; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let result = tables_db.update_row( + "", + "", + "", + Some(json!({ + "upvotes": operator::increment_by(1) + })), + None, + None, + ).await?; + + Ok(()) +} +``` {% /multicode %} ## Add a book to a list @@ -1576,6 +1694,35 @@ tablesDB.updateRow( }) ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::operator; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let result = tables_db.update_row( + "", + "", + "", + Some(json!({ + "books": operator::array_append(&["The Great Gatsby"]) + })), + None, + None, + ).await?; + + Ok(()) +} +``` {% /multicode %} ## Update the date field in a deletion table @@ -1834,6 +1981,35 @@ tablesDB.updateRow( }) ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::operator; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let result = tables_db.update_row( + "", + "", + "", + Some(json!({ + "scheduledDeletion": operator::date_add_days(30) + })), + None, + None, + ).await?; + + Ok(()) +} +``` {% /multicode %} ## Update a single row in a transaction @@ -2222,6 +2398,43 @@ tablesDB.createTransaction(new CoroutineCallback<>((tx, txError) -> { ); })); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::operator; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + // Create a transaction + let tx = tables_db.create_transaction(None).await?; + + // Update row with operators inside the transaction + let result = tables_db.update_row( + "", + "", + "", + Some(json!({ + "upvotes": operator::increment_by(1), + "lastModified": operator::date_set_now() + })), + None, + Some(&tx.id), + ).await?; + + // Commit the transaction + tables_db.update_transaction(&tx.id, Some(true), None).await?; + + Ok(()) +} +``` {% /multicode %} ## Update multiple rows in a transaction @@ -2772,4 +2985,54 @@ tablesDB.createTransaction(new CoroutineCallback<>((tx, txError) -> { ); })); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::operator; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + // Create a transaction + let tx = tables_db.create_transaction(None).await?; + + // Stage multiple operations at once using createOperations + tables_db.create_operations( + &tx.id, + Some(vec![ + json!({ + "action": "update", + "databaseId": "", + "tableId": "", + "rowId": "", + "data": { + "lastActivity": operator::date_set_now() + } + }), + json!({ + "action": "update", + "databaseId": "", + "tableId": "", + "rowId": "", + "data": { + "amount": operator::increment_by(10), + "events": operator::array_append(&["credit_added"]) + } + }), + ]), + ).await?; + + // Commit the transaction + tables_db.update_transaction(&tx.id, Some(true), None).await?; + + Ok(()) +} +``` {% /multicode %} \ No newline at end of file diff --git a/src/routes/docs/products/databases/pagination/+page.markdoc b/src/routes/docs/products/databases/pagination/+page.markdoc index f34b5dea36..310c4dc970 100644 --- a/src/routes/docs/products/databases/pagination/+page.markdoc +++ b/src/routes/docs/products/databases/pagination/+page.markdoc @@ -502,6 +502,35 @@ suspend fun main() { ) } ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::query::Query; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let page = tables_db.list_rows( + "", + "", + Some(vec![ + Query::limit(25).to_string(), + ]), + None, // transaction_id + Some(false), // total - Skip computing total count + None, // ttl + ).await?; + + println!("{:?}", page); + Ok(()) +} +``` ```server-java import io.appwrite.Client; import io.appwrite.Query; diff --git a/src/routes/docs/products/databases/queries/+page.markdoc b/src/routes/docs/products/databases/queries/+page.markdoc index 341fbb5a3b..48628e4df8 100644 --- a/src/routes/docs/products/databases/queries/+page.markdoc +++ b/src/routes/docs/products/databases/queries/+page.markdoc @@ -180,6 +180,40 @@ func main() { fmt.Printf("Rows: %+v\n", rows) } ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::query::Query; +use serde_json::Value; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let tables_db = TablesDB::new(&client); + + let rows = tables_db.list_rows( + "", + "", + Some(vec![ + Query::equal("title", Value::Array(vec![ + Value::String("Avatar".to_string()), + Value::String("Lord of the Rings".to_string()), + ])).to_string(), + Query::greater_than("year", 1999).to_string(), + ]), + None, + None, + None, + ).await?; + + println!("{:?}", rows); + Ok(()) +} +``` ```server-php getRow( [Query::select(["name", "age"])] ); ``` +```server-rust +let doc = tables_db.get_row( + "", + "", + "", + Some(vec![Query::select(vec!["name", "age"]).to_string()]), + None, +).await?; +``` ```client-apple let doc = try await tablesDB.getRow( databaseId: "", @@ -402,6 +448,15 @@ $doc = $tablesDB->getRow( [Query::select(["*", "reviews.*"])] ); ``` +```server-rust +let doc = tables_db.get_row( + "", + "", + "", + Some(vec![Query::select(vec!["*", "reviews.*"]).to_string()]), + None, +).await?; +``` ```client-apple let doc = try await tablesDB.getRow( databaseId: "", @@ -465,6 +520,15 @@ $doc = $tablesDB->getRow( [Query::select(["name", "age", "reviews.author", "reviews.rating"])] ); ``` +```server-rust +let doc = tables_db.get_row( + "", + "", + "", + Some(vec![Query::select(vec!["name", "age", "reviews.author", "reviews.rating"]).to_string()]), + None, +).await?; +``` ```client-apple let doc = try await tablesDB.getRow( databaseId: "", @@ -501,6 +565,9 @@ Query.select(["*", "reviews.*", "reviews.author.*"]) ```server-php Query::select(["*", "reviews.*", "reviews.author.*"]) ``` +```server-rust +Query::select(vec!["*", "reviews.*", "reviews.author.*"]).to_string() +``` ```client-apple Query.select(["*", "reviews.*", "reviews.author.*"]) ``` @@ -565,6 +632,9 @@ Query.equal("title", value: ["Iron Man"]) ```server-go query.Equal("title", []string{"Iron Man"}) ``` +```server-rust +Query::equal("title", Value::Array(vec![Value::String("Iron Man".to_string())])).to_string() +``` ```http {"method":"equal","column":"title","values":["Iron Man"]} ``` @@ -599,6 +669,9 @@ Query.notEqual("title", value: "Iron Man") ```server-go query.NotEqual("title", "Iron Man") ``` +```server-rust +Query::not_equal("title", "Iron Man").to_string() +``` ```http {"method":"notEqual","column":"title","values":"Iron Man"} ``` @@ -633,6 +706,9 @@ Query.lessThan("score", value: 10) ```server-go query.LessThan("score", 10) ``` +```server-rust +Query::less_than("score", 10).to_string() +``` ```http {"method":"lessThan","column":"score","values":[10]} ``` @@ -667,6 +743,9 @@ Query.lessThanEqual("score", value: 10) ```server-go query.LessThanEqual("score", 10) ``` +```server-rust +Query::less_than_equal("score", 10).to_string() +``` ```http {"method":"lessThanEqual","column":"score","values":[10]} ``` @@ -701,6 +780,9 @@ Query.greaterThan("score", value: 10) ```server-go query.GreaterThan("score", 10) ``` +```server-rust +Query::greater_than("score", 10).to_string() +``` ```http {"method":"greaterThan","column":"score","values":[10]} ``` @@ -735,6 +817,9 @@ Query.greaterThanEqual("score", value: 10) ```server-go query.GreaterThanEqual("score", 10) ``` +```server-rust +Query::greater_than_equal("score", 10).to_string() +``` ```http {"method":"greaterThanEqual","column":"score","values":[10]} ``` @@ -769,6 +854,9 @@ Query.between("price", start: 5, end: 10) ```server-go query.Between("price", 5, 10) ``` +```server-rust +Query::between("price", 5, 10).to_string() +``` ```http {"method":"between","column":"price","values":[5,10]} ``` @@ -813,6 +901,9 @@ Query::notBetween("price", 5, 10) ```server-swift Query.notBetween("price", start: 5, end: 10) ``` +```server-rust +Query::not_between("price", 5, 10).to_string() +``` ```http {"method":"notBetween","column":"price","values":[5,10]} ``` @@ -849,6 +940,9 @@ Query.isNull("name") ```server-go query.IsNull("name") ``` +```server-rust +Query::is_null("name").to_string() +``` ```http {"method":"isNull","column":"name"} ``` @@ -883,6 +977,9 @@ Query.isNotNull("name") ```server-go query.IsNotNull("name") ``` +```server-rust +Query::is_not_null("name").to_string() +``` ```http {"method":"isNotNull","column":"name"} ``` @@ -919,6 +1016,9 @@ Query.startsWith("name", value: "Once upon a time") ```server-go query.StartsWith("name", "Once upon a time") ``` +```server-rust +Query::starts_with("name", "Once upon a time").to_string() +``` ```http {"method":"startsWith","column":"name","values":["Once upon a time"]} ``` @@ -962,6 +1062,9 @@ Query::notStartsWith("name", "Once upon a time") ```server-swift Query.notStartsWith("name", value: "Once upon a time") ``` +```server-rust +Query::not_starts_with("name", "Once upon a time").to_string() +``` ```http {"method":"notStartsWith","column":"name","values":["Once upon a time"]} ``` @@ -996,6 +1099,9 @@ Query.endsWith("name", value: "happily ever after.") ```server-go query.EndsWith("name", "happily ever after.") ``` +```server-rust +Query::ends_with("name", "happily ever after.").to_string() +``` ```http {"method":"endsWith","column":"name","values":["happily ever after."]} ``` @@ -1039,6 +1145,9 @@ Query::notEndsWith("name", "happily ever after.") ```server-swift Query.notEndsWith("name", value: "happily ever after.") ``` +```server-rust +Query::not_ends_with("name", "happily ever after.").to_string() +``` ```http {"method":"notEndsWith","column":"name","values":["happily ever after."]} ``` @@ -1104,6 +1213,16 @@ query.Contains("ingredients", []string{"apple", "banana"}) // For strings query.Contains("name", "Tom") ``` +```server-rust +// For arrays +Query::contains("ingredients", Value::Array(vec![ + Value::String("apple".to_string()), + Value::String("banana".to_string()), +])).to_string() + +// For strings +Query::contains("name", "Tom").to_string() +``` ```http # For arrays {"method":"contains","column":"ingredients","values":["apple","banana"]} @@ -1231,6 +1350,16 @@ Query.notContains("ingredients", listOf("apple", "banana")) // For strings Query.notContains("name", "Tom") ``` +```server-rust +// For arrays +Query::not_contains("ingredients", Value::Array(vec![ + Value::String("apple".to_string()), + Value::String("banana".to_string()), +])).to_string() + +// For strings +Query::not_contains("name", "Tom").to_string() +``` ```http # For arrays {"method":"notContains","column":"ingredients","values":["apple","banana"]} @@ -1273,6 +1402,9 @@ Query.search("text", value: "key words") ```server-go query.Search("text", "key words") ``` +```server-rust +Query::search("text", "key words").to_string() +``` ```http {"method":"search","column":"text","values":["key words"]} ``` @@ -1322,6 +1454,9 @@ Query::notSearch("text", "key words") ```server-swift Query.notSearch("text", value: "key words") ``` +```server-rust +Query::not_search("text", "key words").to_string() +``` ```http {"method":"notSearch","column":"text","values":["key words"]} ``` @@ -1382,6 +1517,12 @@ query.And([]string{ query.GreaterThan("size", 5), }) ``` +```server-rust +Query::and(vec![ + Query::less_than("size", 10).to_string(), + Query::greater_than("size", 5).to_string(), +]).to_string() +``` ```http {"method":"and","values":[{"method":"lessThan","column":"size","values":[10]},{"method":"greaterThan","column":"size","values":[5]}]} ``` @@ -1440,6 +1581,12 @@ query.Or([]string{ query.GreaterThan("size", 10), }) ``` +```server-rust +Query::or(vec![ + Query::less_than("size", 5).to_string(), + Query::greater_than("size", 10).to_string(), +]).to_string() +``` ```http {"method":"or","values":[{"method":"lessThan","column":"size","values":[5]},{"method":"greaterThan","column":"size","values":[10]}]} ``` @@ -1476,6 +1623,9 @@ Query.orderDesc("column") ```server-go query.OrderDesc("attribute") ``` +```server-rust +Query::order_desc("column").to_string() +``` ```http {"method":"orderDesc","column":"column"} ``` @@ -1510,6 +1660,9 @@ Query.orderAsc("column") ```server-go query.OrderAsc("attribute") ``` +```server-rust +Query::order_asc("column").to_string() +``` ```http {"method":"orderAsc","column":"column"} ``` @@ -1544,6 +1697,9 @@ Query.orderRandom() ```server-go query.OrderRandom() ``` +```server-rust +Query::order_random().to_string() +``` ```http {"method":"orderRandom"} ``` @@ -1580,6 +1736,9 @@ Query.limit(25) ```server-go query.Limit(25) ``` +```server-rust +Query::limit(25).to_string() +``` ```http {"method":"limit","values":[25]} ``` @@ -1614,6 +1773,9 @@ Query.offset(0) ```server-go query.Offset(0) ``` +```server-rust +Query::offset(0).to_string() +``` ```http {"method":"offset","values":[0]} ``` @@ -1648,6 +1810,9 @@ Query.cursorAfter("62a7...f620") ```server-go query.CursorAfter("62a7...f620") ``` +```server-rust +Query::cursor_after("62a7...f620").to_string() +``` ```http {"method":"cursorAfter","values":["62a7...f620"]} ``` @@ -1682,6 +1847,9 @@ Query.cursorBefore("62a7...a600") ```server-go query.CursorBefore("62a7...a600") ``` +```server-rust +Query::cursor_before("62a7...a600").to_string() +``` ```http {"method":"cursorBefore","values":["62a7...a600"]} ``` @@ -1730,6 +1898,9 @@ Query::createdBefore("2025-01-01T00:00:00Z") ```server-swift Query.createdBefore("2025-01-01T00:00:00Z") ``` +```server-rust +Query::created_before("2025-01-01T00:00:00Z").to_string() +``` ```http {"method":"createdBefore","values":["2025-01-01T00:00:00Z"]} ``` @@ -1773,6 +1944,9 @@ Query::createdAfter("2025-01-01T00:00:00Z") ```server-swift Query.createdAfter("2025-01-01T00:00:00Z") ``` +```server-rust +Query::created_after("2025-01-01T00:00:00Z").to_string() +``` ```http {"method":"createdAfter","values":["2025-01-01T00:00:00Z"]} ``` @@ -1816,6 +1990,9 @@ Query::updatedBefore("2025-01-01T00:00:00Z") ```server-swift Query.updatedBefore("2025-01-01T00:00:00Z") ``` +```server-rust +Query::updated_before("2025-01-01T00:00:00Z").to_string() +``` ```http {"method":"updatedBefore","values":["2025-01-01T00:00:00Z"]} ``` @@ -1859,6 +2036,9 @@ Query::updatedAfter("2025-01-01T00:00:00Z") ```server-swift Query.updatedAfter("2025-01-01T00:00:00Z") ``` +```server-rust +Query::updated_after("2025-01-01T00:00:00Z").to_string() +``` ```http {"method":"updatedAfter","values":["2025-01-01T00:00:00Z"]} ``` @@ -1933,6 +2113,14 @@ Query.distanceEqual("location", listOf(-73.9851, 40.7589), 200) ```server-java Query.distanceEqual("location", Arrays.asList(-73.9851, 40.7589), 200) ``` +```server-rust +Query::distance_equal( + "location", + Value::Array(vec![Value::from(-73.9851), Value::from(40.7589)]), + 200, + true, +).to_string() +``` ```http {"method":"distanceEqual","column":"location","values":[[-73.9851, 40.7589], 200]} ``` @@ -1997,6 +2185,14 @@ Query.distanceNotEqual("location", listOf(-73.9851, 40.7589), 200) ```server-java Query.distanceNotEqual("location", Arrays.asList(-73.9851, 40.7589), 200) ``` +```server-rust +Query::distance_not_equal( + "location", + Value::Array(vec![Value::from(-73.9851), Value::from(40.7589)]), + 200, + true, +).to_string() +``` ```http {"method":"distanceNotEqual","column":"location","values":[[-73.9851, 40.7589], 200]} ``` @@ -2058,6 +2254,14 @@ Query.distanceGreaterThan("location", [-73.9851, 40.7589], 200) ```server-kotlin Query.distanceGreaterThan("location", listOf(-73.9851, 40.7589), 200) ``` +```server-rust +Query::distance_greater_than( + "location", + Value::Array(vec![Value::from(-73.9851), Value::from(40.7589)]), + 200, + true, +).to_string() +``` ```http {"method":"distanceGreaterThan","column":"location","values":[[-73.9851, 40.7589], 200]} ``` @@ -2119,6 +2323,14 @@ Query.distanceLessThan("location", [-73.9851, 40.7589], 200) ```server-kotlin Query.distanceLessThan("location", listOf(-73.9851, 40.7589), 200) ``` +```server-rust +Query::distance_less_than( + "location", + Value::Array(vec![Value::from(-73.9851), Value::from(40.7589)]), + 200, + true, +).to_string() +``` ```http {"method":"distanceLessThan","column":"location","values":[[-73.9851, 40.7589], 200]} ``` @@ -2191,6 +2403,14 @@ Query.intersects("area", [[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, 4 ```server-kotlin Query.intersects("area", listOf(listOf(-73.9851, 40.7589), listOf(-73.9776, 40.7614), listOf(-73.9733, 40.7505), listOf(-73.9851, 40.7589))) ``` +```server-rust +Query::intersects("area", serde_json::json!([ + [-73.9851, 40.7589], + [-73.9776, 40.7614], + [-73.9733, 40.7505], + [-73.9851, 40.7589] +])).to_string() +``` ```http {"method":"intersects","column":"area","values":[[[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, 40.7505], [-73.9851, 40.7589]]]} ``` @@ -2263,6 +2483,14 @@ Query.notIntersects("area", [[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733 ```server-kotlin Query.notIntersects("area", listOf(listOf(-73.9851, 40.7589), listOf(-73.9776, 40.7614), listOf(-73.9733, 40.7505), listOf(-73.9851, 40.7589))) ``` +```server-rust +Query::not_intersects("area", serde_json::json!([ + [-73.9851, 40.7589], + [-73.9776, 40.7614], + [-73.9733, 40.7505], + [-73.9851, 40.7589] +])).to_string() +``` ```http {"method":"notIntersects","column":"area","values":[[[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, 40.7505], [-73.9851, 40.7589]]]} ``` @@ -2335,6 +2563,14 @@ Query.overlaps("zone", [[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, 40. ```server-kotlin Query.overlaps("zone", listOf(listOf(-73.9851, 40.7589), listOf(-73.9776, 40.7614), listOf(-73.9733, 40.7505), listOf(-73.9851, 40.7589))) ``` +```server-rust +Query::overlaps("zone", serde_json::json!([ + [-73.9851, 40.7589], + [-73.9776, 40.7614], + [-73.9733, 40.7505], + [-73.9851, 40.7589] +])).to_string() +``` ```http {"method":"overlaps","column":"zone","values":[[[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, 40.7505], [-73.9851, 40.7589]]]} ``` @@ -2407,6 +2643,14 @@ Query.notOverlaps("zone", [[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, ```server-kotlin Query.notOverlaps("zone", listOf(listOf(-73.9851, 40.7589), listOf(-73.9776, 40.7614), listOf(-73.9733, 40.7505), listOf(-73.9851, 40.7589))) ``` +```server-rust +Query::not_overlaps("zone", serde_json::json!([ + [-73.9851, 40.7589], + [-73.9776, 40.7614], + [-73.9733, 40.7505], + [-73.9851, 40.7589] +])).to_string() +``` ```http {"method":"notOverlaps","column":"zone","values":[[[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, 40.7505], [-73.9851, 40.7589]]]} ``` @@ -2479,6 +2723,14 @@ Query.touches("boundary", [[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, ```server-kotlin Query.touches("boundary", listOf(listOf(-73.9851, 40.7589), listOf(-73.9776, 40.7614), listOf(-73.9733, 40.7505), listOf(-73.9851, 40.7589))) ``` +```server-rust +Query::touches("boundary", serde_json::json!([ + [-73.9851, 40.7589], + [-73.9776, 40.7614], + [-73.9733, 40.7505], + [-73.9851, 40.7589] +])).to_string() +``` ```http {"method":"touches","column":"boundary","values":[[[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, 40.7505], [-73.9851, 40.7589]]]} ``` @@ -2551,6 +2803,14 @@ Query.notTouches("boundary", [[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.973 ```server-kotlin Query.notTouches("boundary", listOf(listOf(-73.9851, 40.7589), listOf(-73.9776, 40.7614), listOf(-73.9733, 40.7505), listOf(-73.9851, 40.7589))) ``` +```server-rust +Query::not_touches("boundary", serde_json::json!([ + [-73.9851, 40.7589], + [-73.9776, 40.7614], + [-73.9733, 40.7505], + [-73.9851, 40.7589] +])).to_string() +``` ```http {"method":"notTouches","column":"boundary","values":[[[-73.9851, 40.7589], [-73.9776, 40.7614], [-73.9733, 40.7505], [-73.9851, 40.7589]]]} ``` @@ -2619,6 +2879,12 @@ Query.crosses("route", [[-73.9851, 40.7589], [-73.9776, 40.7614]]) ```server-kotlin Query.crosses("route", listOf(listOf(-73.9851, 40.7589), listOf(-73.9776, 40.7614))) ``` +```server-rust +Query::crosses("route", serde_json::json!([ + [-73.9851, 40.7589], + [-73.9776, 40.7614] +])).to_string() +``` ```http {"method":"crosses","column":"route","values":[[[-73.9851, 40.7589], [-73.9776, 40.7614]]]} ``` @@ -2687,6 +2953,12 @@ Query.notCrosses("route", [[-73.9851, 40.7589], [-73.9776, 40.7614]]) ```server-kotlin Query.notCrosses("route", listOf(listOf(-73.9851, 40.7589), listOf(-73.9776, 40.7614))) ``` +```server-rust +Query::not_crosses("route", serde_json::json!([ + [-73.9851, 40.7589], + [-73.9776, 40.7614] +])).to_string() +``` ```http {"method":"notCrosses","column":"route","values":[[[-73.9851, 40.7589], [-73.9776, 40.7614]]]} ``` @@ -2772,6 +3044,27 @@ if err != nil { log.Fatal(err) } ``` +```server-rust +let rows = tables_db.list_rows( + "", + "", + Some(vec![ + Query::or(vec![ + Query::and(vec![ + Query::equal("category", Value::Array(vec![Value::String("books".to_string())])).to_string(), + Query::less_than("price", 20).to_string(), + ]).to_string(), + Query::and(vec![ + Query::equal("category", Value::Array(vec![Value::String("magazines".to_string())])).to_string(), + Query::less_than("price", 10).to_string(), + ]).to_string(), + ]).to_string(), + ]), + None, + None, + None, +).await?; +``` ```http {"method":"or","values":[{"method":"and","values":[{"method":"equal","column":"category","values":["books"]},{"method":"lessThan","column":"price","values":[20]}]},{"method":"and","values":[{"method":"equal","column":"category","values":["magazines"]},{"method":"lessThan","column":"price","values":[10]}]}]} ``` diff --git a/src/routes/docs/products/databases/rows/+page.markdoc b/src/routes/docs/products/databases/rows/+page.markdoc index 84901cb967..17d5ad9c39 100644 --- a/src/routes/docs/products/databases/rows/+page.markdoc +++ b/src/routes/docs/products/databases/rows/+page.markdoc @@ -966,6 +966,26 @@ tablesDB.deleteRow( }) ); ``` + +```server-rust +// Delete row inside a transaction +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; + +let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + +let tables_db = TablesDB::new(&client); + +tables_db.delete_row( + "", + "", + "", + Some(""), +).await?; +``` {% /multicode %} # Next steps {% #next-steps %} diff --git a/src/routes/docs/products/databases/tables/+page.markdoc b/src/routes/docs/products/databases/tables/+page.markdoc index b6e0ad86e9..9083db8898 100644 --- a/src/routes/docs/products/databases/tables/+page.markdoc +++ b/src/routes/docs/products/databases/tables/+page.markdoc @@ -1325,6 +1325,139 @@ let table = try await tablesDB.createTable( ] ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("") // Your project ID + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + + let tables_db = TablesDB::new(&client); + + let table = tables_db.create_table( + "", + "", + "", + None, // permissions + None, // row_security + None, // enabled + Some(vec![ + json!({ + "key": "email", + "type": "email", + "required": true + }), + json!({ + "key": "name", + "type": "varchar", + "size": 255, + "required": true + }), + json!({ + "key": "bio", + "type": "text", + "required": false + }), + json!({ + "key": "content", + "type": "mediumtext", + "required": false + }), + json!({ + "key": "data", + "type": "longtext", + "required": false + }), + json!({ + "key": "age", + "type": "integer", + "required": false + }), + json!({ + "key": "score", + "type": "float", + "required": false + }), + json!({ + "key": "is_active", + "type": "boolean", + "required": true + }), + json!({ + "key": "created_at", + "type": "datetime", + "required": false + }), + json!({ + "key": "status", + "type": "enum", + "elements": ["draft", "published", "archived"], + "required": true + }), + json!({ + "key": "ip_address", + "type": "ip", + "required": false + }), + json!({ + "key": "website", + "type": "url", + "required": false + }), + json!({ + "key": "location", + "type": "point", + "required": false + }), + json!({ + "key": "path", + "type": "line", + "required": false + }), + json!({ + "key": "area", + "type": "polygon", + "required": false + }), + json!({ + "key": "related_items", + "type": "relationship", + "relatedTableId": "", + "relationType": "manyToMany", + "twoWay": true, + "twoWayKey": "items", + "onDelete": "cascade", + "required": false + }), + ]), + Some(vec![ + json!({ + "key": "idx_email", + "type": "unique", + "attributes": ["email"] + }), + json!({ + "key": "idx_name", + "type": "key", + "attributes": ["name"] + }), + json!({ + "key": "idx_name_fulltext", + "type": "fulltext", + "attributes": ["name"] + }), + ]), + ).await?; + + println!("{:?}", table); + Ok(()) +} +``` {% /multicode %} You can also configure **permissions** in the `createTable` method. Learn more about the `createTable` method in the [API references](/docs/references). diff --git a/src/routes/docs/products/databases/timestamp-overrides/+page.markdoc b/src/routes/docs/products/databases/timestamp-overrides/+page.markdoc index 733c344196..5c32f39389 100644 --- a/src/routes/docs/products/databases/timestamp-overrides/+page.markdoc +++ b/src/routes/docs/products/databases/timestamp-overrides/+page.markdoc @@ -201,6 +201,38 @@ await databases.createDocument( }, ); ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.create_document( + "", + "", + &ID::unique(), + json!({ + "$createdAt": "2025-08-10T12:34:56.000Z", + "$updatedAt": "2025-08-10T12:34:56.000Z" + // ...your attributes + }), + None, + None, + ).await?; + + println!("Created: {:?}", result); + Ok(()) +} +``` {% /multicode %} ### Update with custom timestamps {% #update-custom %} @@ -344,6 +376,36 @@ await databases.updateDocument( }, ); ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.update_document( + "", + "", + "", + Some(json!({ + "$updatedAt": "2025-08-10T12:34:56.000Z" + // ...your attributes + })), + None, + None, + ).await?; + + println!("Updated: {:?}", result); + Ok(()) +} +``` {% /multicode %} ## Bulk operations {% #bulk-operations %} @@ -568,6 +630,45 @@ await databases.createDocuments( ], ); ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.create_documents( + "", + "", + vec![ + json!({ + "$id": ID::unique(), + "$createdAt": "2024-01-01T00:00:00.000Z", + "$updatedAt": "2024-01-01T00:00:00.000Z" + // ...your attributes + }), + json!({ + "$id": ID::unique(), + "$createdAt": "2024-02-01T00:00:00.000Z", + "$updatedAt": "2024-02-01T00:00:00.000Z" + // ...your attributes + }), + ], + None, + ).await?; + + println!("Bulk create: {:?}", result); + Ok(()) +} +``` {% /multicode %} ### Bulk upsert {% #bulk-upsert %} @@ -744,6 +845,38 @@ await databases.upsertDocuments( ], ); ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.upsert_documents( + "", + "", + vec![ + json!({ + "$id": "", + "$createdAt": "2024-01-01T00:00:00.000Z", + "$updatedAt": "2025-01-01T00:00:00.000Z" + // ...your attributes + }), + ], + None, + ).await?; + + println!("Bulk upsert: {:?}", result); + Ok(()) +} +``` {% /multicode %} # Common use cases {% #use-cases %} @@ -847,6 +980,39 @@ await databases.createDocument( }, ); ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new() + .set_endpoint("https://.cloud.appwrite.io/v1") + .set_project("") + .set_key(""); + + let databases = Databases::new(&client); + + let result = databases.create_document( + "", + "blog_posts", + &ID::unique(), + json!({ + "$createdAt": "", + "$updatedAt": "", + "title": "", + "content": "<CONTENT>" + }), + None, + None, + ).await?; + + println!("Created: {:?}", result); + Ok(()) +} +``` {% /multicode %} ## Backdating records {% #backdating %} @@ -945,6 +1111,39 @@ await databases.createDocument( }, ); ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let databases = Databases::new(&client); + + let result = databases.create_document( + "<DATABASE_ID>", + "transactions", + &ID::unique(), + json!({ + "$createdAt": "2023-12-31T23:59:59.000Z", + "$updatedAt": "2023-12-31T23:59:59.000Z", + "amount": 1000, + "type": "year-end-bonus" + }), + None, + None, + ).await?; + + println!("Created: {:?}", result); + Ok(()) +} +``` {% /multicode %} ## Synchronization {% #synchronization %} @@ -1029,6 +1228,36 @@ await databases.upsertDocument( }, ); ``` +```rust +use appwrite::Client; +use appwrite::services::databases::Databases; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let databases = Databases::new(&client); + + let result = databases.upsert_document( + "<DATABASE_ID>", + "users", + "<DOCUMENT_ID_OR_NEW_ID>", + Some(json!({ + "$updatedAt": "<EXTERNAL_LAST_MODIFIED_ISO>", + "profile": "<PROFILE_DATA>" + })), + None, + None, + ).await?; + + println!("Upserted: {:?}", result); + Ok(()) +} +``` {% /multicode %} {% info title="Timestamp format and usage" %} diff --git a/src/routes/docs/products/databases/transactions/+page.markdoc b/src/routes/docs/products/databases/transactions/+page.markdoc index 12602c3dbb..ccba413fea 100644 --- a/src/routes/docs/products/databases/transactions/+page.markdoc +++ b/src/routes/docs/products/databases/transactions/+page.markdoc @@ -286,6 +286,25 @@ tablesDB.createTransaction(new CoroutineCallback<>((result, error) -> { System.out.println(result); })); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let tables_db = TablesDB::new(&client); + + let tx = tables_db.create_transaction(None).await?; + // tx.id is your transaction_id + + Ok(()) +} +``` {% /multicode %} # Stage operations {% #stage-operations %} @@ -593,6 +612,43 @@ try await tablesDB.incrementRowColumn( transactionId: tx.$id ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let tables_db = TablesDB::new(&client); + + let tx = tables_db.create_transaction(None).await?; + + // Update inside a transaction + tables_db.update_row( + "<DATABASE_ID>", + "<TABLE_ID>", + "<ROW_ID>", + Some(json!({ "plan": "pro" })), + None, + Some(&tx.id), + ).await?; + + // Delete inside a transaction + tables_db.delete_row( + "<DATABASE_ID>", + "<TABLE_ID>", + "<ROW_ID>", + Some(&tx.id), + ).await?; + + Ok(()) +} +``` {% /multicode %} ## Stage many with createOperations {% #create-operations %} @@ -953,6 +1009,46 @@ try await tablesDB.createOperations( ] ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let tables_db = TablesDB::new(&client); + + let tx = tables_db.create_transaction(None).await?; + + // Stage multiple operations at once + tables_db.create_operations( + &tx.id, + Some(vec![ + json!({ + "action": "create", + "databaseId": "<DB_A>", + "tableId": "<TABLE_1>", + "rowId": "u1", + "data": { "name": "Walter" } + }), + json!({ + "action": "increment", + "databaseId": "<DB_B>", + "tableId": "<TABLE_2>", + "rowId": "u2", + "data": { "value": 1, "min": 0, "column": "credits" } + }), + ]), + ).await?; + + Ok(()) +} +``` {% /multicode %} # Commit or roll back {% #commit-or-rollback %} @@ -1134,6 +1230,36 @@ await tablesDB.updateTransaction( rollback: true ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let tables_db = TablesDB::new(&client); + + // Commit + tables_db.update_transaction( + "<TRANSACTION_ID>", + Some(true), + None, + ).await?; + + // Roll back + tables_db.update_transaction( + "<TRANSACTION_ID>", + None, + Some(true), + ).await?; + + Ok(()) +} +``` {% /multicode %} # Handle conflicts {% #handle-conflicts %} diff --git a/src/routes/docs/products/functions/develop/+page.markdoc b/src/routes/docs/products/functions/develop/+page.markdoc index d2414257d7..348f99b288 100644 --- a/src/routes/docs/products/functions/develop/+page.markdoc +++ b/src/routes/docs/products/functions/develop/+page.markdoc @@ -2539,4 +2539,5 @@ public class Main { } ``` {% /tabsitem %} + {% /tabs %} diff --git a/src/routes/docs/products/functions/execute/+page.markdoc b/src/routes/docs/products/functions/execute/+page.markdoc index b4c532f6fd..489232117b 100644 --- a/src/routes/docs/products/functions/execute/+page.markdoc +++ b/src/routes/docs/products/functions/execute/+page.markdoc @@ -468,6 +468,33 @@ let execution = try await functions.createExecution( headers: [:] // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::functions::Functions; +use appwrite::enums::execution_method::ExecutionMethod; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_project("<PROJECT_ID>"); + + let functions = Functions::new(&client); + + let execution = functions.create_execution( + "<FUNCTION_ID>", // functionId + Some("<BODY>"), // body (optional) + Some(false), // async (optional) + Some("<PATH>"), // path (optional) + Some(ExecutionMethod::GET), // method (optional) + Some(json!({})), // headers (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", execution); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -994,6 +1021,33 @@ let execution = try await functions.createExecution( scheduledAt: "2020-10-15T06:38:00.000+00:00" // Schedule execution (optional) ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::functions::Functions; +use appwrite::enums::execution_method::ExecutionMethod; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_project("<PROJECT_ID>"); + + let functions = Functions::new(&client); + + let execution = functions.create_execution( + "<FUNCTION_ID>", // functionId + Some("<BODY>"), // body (optional) + Some(true), // async - scheduled executions need to be async + Some("<PATH>"), // path (optional) + Some(ExecutionMethod::GET), // method (optional) + Some(json!({})), // headers (optional) + Some("2020-10-15T06:38:00.000+00:00"), // scheduledAt (optional) + ).await?; + + println!("{:?}", execution); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} diff --git a/src/routes/docs/products/messaging/apns/+page.markdoc b/src/routes/docs/products/messaging/apns/+page.markdoc index 41d85d1c96..f4690d7e05 100644 --- a/src/routes/docs/products/messaging/apns/+page.markdoc +++ b/src/routes/docs/products/messaging/apns/+page.markdoc @@ -357,6 +357,34 @@ let provider = try await messaging.updateApnsProvider( bundleId: "<BUNDLE_ID>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_apns_provider( + "<PROVIDER_ID>", // providerId + Some("<NAME>"), // name (optional) + Some(false), // enabled (optional) + Some("<AUTH_KEY>"), // authKey (optional) + Some("<AUTH_KEY_ID>"), // authKeyId (optional) + Some("<TEAM_ID>"), // teamId (optional) + Some("<BUNDLE_ID>"), // bundleId (optional) + None, // sandbox (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/fcm/+page.markdoc b/src/routes/docs/products/messaging/fcm/+page.markdoc index 839bbd7d69..c6918d670c 100644 --- a/src/routes/docs/products/messaging/fcm/+page.markdoc +++ b/src/routes/docs/products/messaging/fcm/+page.markdoc @@ -350,6 +350,31 @@ let provider = try await messaging.updateFCMProvider( serviceAccountJSON: [:] // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_fcm_provider( + "<PROVIDER_ID>", // providerId + Some("<NAME>"), // name (optional) + Some(false), // enabled (optional) + Some(json!({})), // serviceAccountJSON (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/mailgun/+page.markdoc b/src/routes/docs/products/messaging/mailgun/+page.markdoc index ade4e67323..72f43a5fd0 100644 --- a/src/routes/docs/products/messaging/mailgun/+page.markdoc +++ b/src/routes/docs/products/messaging/mailgun/+page.markdoc @@ -283,6 +283,38 @@ let message = try await messaging.createEmail( content: "<CONTENT>" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_email( + "<MESSAGE_ID>", // messageId + "<SUBJECT>", // subject + "<CONTENT>", // content + None, // topics (optional) + None, // users (optional) + None, // targets (optional) + None, // cc (optional) + None, // bcc (optional) + None, // attachments (optional) + None, // draft (optional) + None, // html (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -602,6 +634,36 @@ let provider = try await messaging.updateSendgridProvider( enabled: "<ENABLED?>", ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_mailgun_provider( + "<PROVIDER_ID>", // providerId + Some("<PROVIDER_NAME>"), // name (optional) + Some("<API_KEY>"), // apiKey (optional) + Some("<DOMAIN>"), // domain (optional) + Some(false), // isEuRegion (optional) + Some(true), // enabled (optional) + Some("<SENDER_NAME>"), // fromName (optional) + Some("<SENDER_EMAIL>"), // fromEmail (optional) + Some("<REPLY_TO_NAME>"), // replyToName (optional) + Some("<REPLY_TO_EMAIL>"), // replyToEmail (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/messages/+page.markdoc b/src/routes/docs/products/messaging/messages/+page.markdoc index 8699359c8c..7d1a812c82 100644 --- a/src/routes/docs/products/messaging/messages/+page.markdoc +++ b/src/routes/docs/products/messaging/messages/+page.markdoc @@ -596,6 +596,47 @@ let message = try await messaging.createPush( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; +use appwrite::enums::MessagePriority; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_push( + "<MESSAGE_ID>", // messageId + Some("<TITLE>"), // title (optional) + Some("<BODY>"), // body (optional) + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(json!({})), // data (optional) + Some("<ACTION>"), // action (optional) + None, // image (optional) + Some("<ICON>"), // icon (optional) + Some("<SOUND>"), // sound (optional) + Some("<COLOR>"), // color (optional) + Some("<TAG>"), // tag (optional) + Some(1), // badge (optional) + Some(true), // draft (optional) + None, // scheduledAt (optional) + Some(false), // contentAvailable (optional) + Some(false), // critical (optional) + Some(MessagePriority::Normal), // priority (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% arrow_link href="/docs/products/messaging/send-push-notifications" %} @@ -901,6 +942,38 @@ let message = try await messaging.createEmail( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_email( + "<MESSAGE_ID>", // messageId + "<SUBJECT>", // subject + "<CONTENT>", // content + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(vec![]), // cc (optional) + Some(vec![]), // bcc (optional) + None, // attachments (optional) + Some(true), // draft (optional) + Some(false), // html (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% arrow_link href="/docs/products/messaging/send-email-messages" %} @@ -1166,6 +1239,33 @@ let message = try await messaging.createSms( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_sms( + "<MESSAGE_ID>", // messageId + "<CONTENT>", // content + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(true), // draft (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% arrow_link href="/docs/products/messaging/send-sms-messages" %} diff --git a/src/routes/docs/products/messaging/msg91/+page.markdoc b/src/routes/docs/products/messaging/msg91/+page.markdoc index 912d590310..27a267913f 100644 --- a/src/routes/docs/products/messaging/msg91/+page.markdoc +++ b/src/routes/docs/products/messaging/msg91/+page.markdoc @@ -322,6 +322,33 @@ let message = try await messaging.createSms( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_sms( + "<MESSAGE_ID>", // messageId + "<CONTENT>", // content + None, // topics (optional) + None, // users (optional) + None, // targets (optional) + Some(true), // draft (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -588,6 +615,32 @@ let provider = try await messaging.updateMsg91Provider( from: "<FROM>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_msg91_provider( + "<PROVIDER_ID>", // providerId + Some("<NAME>"), // name (optional) + Some(false), // enabled (optional) + Some("<TEMPLATE_ID>"), // templateId (optional) + Some("<SENDER_ID>"), // senderId (optional) + Some("<AUTH_KEY>"), // authKey (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/send-email-messages/+page.markdoc b/src/routes/docs/products/messaging/send-email-messages/+page.markdoc index d728fa93e3..58793dae37 100644 --- a/src/routes/docs/products/messaging/send-email-messages/+page.markdoc +++ b/src/routes/docs/products/messaging/send-email-messages/+page.markdoc @@ -263,6 +263,33 @@ let target = try await users.createTarget( name: "<NAME>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::users::Users; +use appwrite::enums::messaging_provider_type::MessagingProviderType; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let users = Users::new(&client); + + let target = users.create_target( + "<USER_ID>", + "<TARGET_ID>", + MessagingProviderType::Email, + "<IDENTIFIER>", + Some("<PROVIDER_ID>"), // optional + Some("<NAME>"), // optional + ).await?; + + println!("{:?}", target); + Ok(()) +} +``` {% /multicode %} # Create topics (optional) {% #create-topics %} You can use topics to organize targets that should receive the same messages, so you can send emails to groups of targets instead of one at time. @@ -484,6 +511,29 @@ let topic = try await messaging.createTopic( name: "<NAME>" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let topic = messaging.create_topic( + "<TOPIC_ID>", + "<NAME>", + None, // subscribe (optional) + ).await?; + + println!("{:?}", topic); + Ok(()) +} +``` {% /multicode %} # Send emails {% #send-emails %} @@ -788,6 +838,38 @@ let message = try await messaging.createEmail( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_email( + "<MESSAGE_ID>", + "<SUBJECT>", + "<CONTENT>", + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(vec![]), // cc (optional) + Some(vec![]), // bcc (optional) + None, // attachments (optional) + Some(false), // draft (optional) + Some(false), // html (optional) + None, // scheduled_at (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} @@ -1087,7 +1169,39 @@ let message = try await messaging.createEmail( bcc: [], // optional draft: false, // optional html: xfalse, // optional - scheduledAt: "2025-02-13T22:01:00+0000" + scheduledAt: "2025-02-13T22:01:00+0000" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_email( + "<MESSAGE_ID>", + "<SUBJECT>", + "<CONTENT>", + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(vec![]), // cc (optional) + Some(vec![]), // bcc (optional) + None, // attachments (optional) + Some(false), // draft (optional) + Some(false), // html (optional) + Some("2025-02-13T22:01:00+0000"), // scheduled_at (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} diff --git a/src/routes/docs/products/messaging/send-push-notifications/+page.markdoc b/src/routes/docs/products/messaging/send-push-notifications/+page.markdoc index 8f36e0e67e..b8d24b08ed 100644 --- a/src/routes/docs/products/messaging/send-push-notifications/+page.markdoc +++ b/src/routes/docs/products/messaging/send-push-notifications/+page.markdoc @@ -662,6 +662,46 @@ let message = try await messaging.createPush( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>") // Your project ID + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + + let messaging = Messaging::new(&client); + + let message = messaging.create_push( + "<MESSAGE_ID>", + Some("<TITLE>"), // title (optional) + Some("<BODY>"), // body (optional) + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(json!({})), // data (optional) + Some("<ACTION>"), // action (optional) + Some("<IMAGE>"), // image (optional) + Some("<ICON>"), // icon (optional) + Some("<SOUND>"), // sound (optional) + Some("<COLOR>"), // color (optional) + Some("<TAG>"), // tag (optional) + Some(1), // badge (optional) + Some(false), // draft (optional) + None, // scheduled_at (optional) + None, // content_available (optional) + None, // critical (optional) + None, // priority (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/send-sms-messages/+page.markdoc b/src/routes/docs/products/messaging/send-sms-messages/+page.markdoc index 4f0cb4ade8..016bab3fdb 100644 --- a/src/routes/docs/products/messaging/send-sms-messages/+page.markdoc +++ b/src/routes/docs/products/messaging/send-sms-messages/+page.markdoc @@ -272,6 +272,33 @@ let target = try await users.createTarget( name: "<NAME>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::users::Users; +use appwrite::enums::messaging_provider_type::MessagingProviderType; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let users = Users::new(&client); + + let target = users.create_target( + "<USER_ID>", + "<TARGET_ID>", + MessagingProviderType::Sms, + "<IDENTIFIER>", + Some("<PROVIDER_ID>"), // optional + Some("<NAME>"), // optional + ).await?; + + println!("{:?}", target); + Ok(()) +} +``` {% /multicode %} # Create topics (optional) {% #create-topics %} @@ -459,6 +486,29 @@ let topic = try await messaging.createTopic( name: "<NAME>" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let topic = messaging.create_topic( + "<TOPIC_ID>", + "<NAME>", + None, // subscribe (optional) + ).await?; + + println!("{:?}", topic); + Ok(()) +} +``` {% /multicode %} # Send SMS messages {% #send-sms %} @@ -690,6 +740,33 @@ let message = try await messaging.createSms( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_sms( + "<MESSAGE_ID>", + "<CONTENT>", + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(false), // draft (optional) + None, // scheduled_at (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} # Schedule SMS message {% #schedule-sms %} @@ -919,4 +996,31 @@ let message = try await messaging.createSms( scheduledAt: "2025-02-13T22:01:00+0000" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_sms( + "<MESSAGE_ID>", + "<CONTENT>", + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(false), // draft (optional) + Some("2025-02-13T22:01:00+0000"), // scheduled_at (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} \ No newline at end of file diff --git a/src/routes/docs/products/messaging/sendgrid/+page.markdoc b/src/routes/docs/products/messaging/sendgrid/+page.markdoc index 6a0ebb416b..6394cd76f6 100644 --- a/src/routes/docs/products/messaging/sendgrid/+page.markdoc +++ b/src/routes/docs/products/messaging/sendgrid/+page.markdoc @@ -276,6 +276,38 @@ let message = try await messaging.createEmail( content: "<CONTENT>" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_email( + "<MESSAGE_ID>", // messageId + "<SUBJECT>", // subject + "<CONTENT>", // content + None, // topics (optional) + None, // users (optional) + None, // targets (optional) + None, // cc (optional) + None, // bcc (optional) + None, // attachments (optional) + None, // draft (optional) + None, // html (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -561,6 +593,34 @@ let provider = try await messaging.updateSendgridProvider( replyToEmail: "<REPLY_TO_EMAIL>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<YOUR_API_KEY>"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_sendgrid_provider( + "<PROVIDER_ID>", // providerId + Some("<NAME>"), // name (optional) + Some(false), // enabled (optional) + Some("<API_KEY>"), // apiKey (optional) + Some("<FROM_NAME>"), // fromName (optional) + Some("email@example.com"), // fromEmail (optional) + Some("<REPLY_TO_NAME>"), // replyToName (optional) + Some("<REPLY_TO_EMAIL>"), // replyToEmail (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/smtp/+page.markdoc b/src/routes/docs/products/messaging/smtp/+page.markdoc index d1e111b526..5439926fcf 100644 --- a/src/routes/docs/products/messaging/smtp/+page.markdoc +++ b/src/routes/docs/products/messaging/smtp/+page.markdoc @@ -285,6 +285,38 @@ let message = try await messaging.createEmail( content: "<CONTENT>" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_email( + "<MESSAGE_ID>", // messageId + "<SUBJECT>", // subject + "<CONTENT>", // content + None, // topics (optional) + None, // users (optional) + None, // targets (optional) + None, // cc (optional) + None, // bcc (optional) + None, // attachments (optional) + None, // draft (optional) + None, // html (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -604,6 +636,44 @@ let provider = try await messaging.updateSendgridProvider( enabled: "<ENABLED?>", ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let messaging = Messaging::new(&client); + + // update provider + let provider = messaging.update_smtp_provider( + "<PROVIDER_ID>", // providerId + Some("<PROVIDER_NAME>"), // name (optional) + Some("<HOST>"), // host (optional) + Some(587), // port (optional) + Some("<USERNAME>"), // username (optional) + Some("<PASSWORD>"), // password (optional) + None, // encryption (optional) + Some(true), // autoTLS (optional) + Some("<MAILER>"), // mailer (optional) + Some("<SENDER_NAME>"), // fromName (optional) + Some("<SENDER_EMAIL>"), // fromEmail (optional) + Some("<REPLY_TO_NAME>"), // replyToName (optional) + Some("<REPLY_TO_EMAIL>"), // replyToEmail (optional) + Some(true), // enabled (optional) + ).await?; + + // delete provider + messaging.delete_provider("<PROVIDER_ID>").await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/telesign/+page.markdoc b/src/routes/docs/products/messaging/telesign/+page.markdoc index ef21dba362..613a679f4e 100644 --- a/src/routes/docs/products/messaging/telesign/+page.markdoc +++ b/src/routes/docs/products/messaging/telesign/+page.markdoc @@ -321,6 +321,33 @@ let message = try await messaging.createSms( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_sms( + "<MESSAGE_ID>", // messageId + "<CONTENT>", // content + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(true), // draft (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -586,6 +613,32 @@ let provider = try await messaging.updateTelesignProvider( from: "<FROM>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_telesign_provider( + "<PROVIDER_ID>", // providerId + Some("<NAME>"), // name (optional) + Some(false), // enabled (optional) + Some("<CUSTOMER_ID>"), // customerId (optional) + Some("<API_KEY>"), // apiKey (optional) + Some("<FROM>"), // from (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/textmagic/+page.markdoc b/src/routes/docs/products/messaging/textmagic/+page.markdoc index 8bbfea999b..833cb51a6a 100644 --- a/src/routes/docs/products/messaging/textmagic/+page.markdoc +++ b/src/routes/docs/products/messaging/textmagic/+page.markdoc @@ -321,6 +321,33 @@ let message = try await messaging.createSms( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_sms( + "<MESSAGE_ID>", // messageId + "<CONTENT>", // content + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(true), // draft (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -586,6 +613,32 @@ let provider = try await messaging.updateTextmagicProvider( from: "<FROM>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_textmagic_provider( + "<PROVIDER_ID>", // providerId + Some("<NAME>"), // name (optional) + Some(false), // enabled (optional) + Some("<USERNAME>"), // username (optional) + Some("<API_KEY>"), // apiKey (optional) + Some("<FROM>"), // from (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/topics/+page.markdoc b/src/routes/docs/products/messaging/topics/+page.markdoc index 61789c2c45..dc743993ad 100644 --- a/src/routes/docs/products/messaging/topics/+page.markdoc +++ b/src/routes/docs/products/messaging/topics/+page.markdoc @@ -267,6 +267,29 @@ let topic = try await messaging.createTopic( subscribe: "<ROLES>" // permission roles for who can subscribe ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let topic = messaging.create_topic( + "<TOPIC_ID>", // topicId + "<NAME>", // name + Some(vec!["<ROLES>".to_string()]), // subscribe (optional) + ).await?; + + println!("{:?}", topic); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} @@ -506,6 +529,29 @@ let subscriber = try await messaging.createSubscriber( targetId: "<TARGET_ID>" ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_jwt("eyJhbVCJ9.eyJ..."); + + let messaging = Messaging::new(&client); + + let subscriber = messaging.create_subscriber( + "<TOPIC_ID>", // topicId + "<SUBSCRIBER_ID>", // subscriberId + "<TARGET_ID>", // targetId + ).await?; + + println!("{:?}", subscriber); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/twilio/+page.markdoc b/src/routes/docs/products/messaging/twilio/+page.markdoc index 5921af45f5..a1243b8250 100644 --- a/src/routes/docs/products/messaging/twilio/+page.markdoc +++ b/src/routes/docs/products/messaging/twilio/+page.markdoc @@ -323,6 +323,33 @@ let message = try await messaging.createSms( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_sms( + "<MESSAGE_ID>", // messageId + "<CONTENT>", // content + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(true), // draft (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -586,6 +613,32 @@ let provider = try await messaging.updateTwilioProvider( from: "<FROM>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_twilio_provider( + "<PROVIDER_ID>", // providerId + Some("<NAME>"), // name (optional) + Some(false), // enabled (optional) + Some("<ACCOUNT_SID>"), // accountSid (optional) + Some("<AUTH_TOKEN>"), // authToken (optional) + Some("<FROM>"), // from (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/messaging/vonage/+page.markdoc b/src/routes/docs/products/messaging/vonage/+page.markdoc index 15d2cbddfa..e80381648a 100644 --- a/src/routes/docs/products/messaging/vonage/+page.markdoc +++ b/src/routes/docs/products/messaging/vonage/+page.markdoc @@ -323,6 +323,33 @@ let message = try await messaging.createSms( scheduledAt: "" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let message = messaging.create_sms( + "<MESSAGE_ID>", // messageId + "<CONTENT>", // content + Some(vec![]), // topics (optional) + Some(vec![]), // users (optional) + Some(vec![]), // targets (optional) + Some(true), // draft (optional) + None, // scheduledAt (optional) + ).await?; + + println!("{:?}", message); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -588,6 +615,32 @@ let provider = try await messaging.updateVonageProvider( from: "<FROM>" // optional ) ``` +```server-rust +use appwrite::Client; +use appwrite::services::messaging::Messaging; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); + + let messaging = Messaging::new(&client); + + let provider = messaging.update_vonage_provider( + "<PROVIDER_ID>", // providerId + Some("<NAME>"), // name (optional) + Some(false), // enabled (optional) + Some("<API_KEY>"), // apiKey (optional) + Some("<API_SECRET>"), // apiSecret (optional) + Some("<FROM>"), // from (optional) + ).await?; + + println!("{:?}", provider); + Ok(()) +} +``` {% /multicode %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/products/storage/buckets/+page.markdoc b/src/routes/docs/products/storage/buckets/+page.markdoc index dc6bcde47d..87488f4891 100644 --- a/src/routes/docs/products/storage/buckets/+page.markdoc +++ b/src/routes/docs/products/storage/buckets/+page.markdoc @@ -226,6 +226,37 @@ let bucket = try await storage.createBucket( name: "<NAME>" ) +``` +```server-rust +use appwrite::Client; +use appwrite::services::storage::Storage; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>") // Your project ID + .set_key("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key + + let storage = Storage::new(&client); + + let bucket = storage.create_bucket( + "<BUCKET_ID>", + "<NAME>", + None, // permissions (optional) + None, // file_security (optional) + None, // enabled (optional) + None, // maximum_file_size (optional) + None, // allowed_file_extensions (optional) + None, // compression (optional) + None, // encryption (optional) + None, // antivirus (optional) + None, // transformations (optional) + ).await?; + + println!("{:?}", bucket); + Ok(()) +} ``` {% /multicode %} diff --git a/src/routes/docs/products/storage/file-tokens/+page.markdoc b/src/routes/docs/products/storage/file-tokens/+page.markdoc index 9309cfcf05..46be762ece 100644 --- a/src/routes/docs/products/storage/file-tokens/+page.markdoc +++ b/src/routes/docs/products/storage/file-tokens/+page.markdoc @@ -265,6 +265,30 @@ tokens.createFileToken( ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tokens::Tokens; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>") // Your project ID + .set_key("<YOUR_API_KEY>"); // Your secret API key + + let tokens = Tokens::new(&client); + + let result = tokens.create_file_token( + "<BUCKET_ID>", + "<FILE_ID>", + Some(""), // expire (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` + ```server-graphql mutation { tokensCreateFileToken( @@ -545,6 +569,31 @@ tokens.list( ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tokens::Tokens; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>") // Your project ID + .set_key("<YOUR_API_KEY>"); // Your secret API key + + let tokens = Tokens::new(&client); + + let result = tokens.list( + "<BUCKET_ID>", + "<FILE_ID>", + None, // queries (optional) + None, // total (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` + ```server-rest GET /v1/tokens/buckets/{bucketId}/files/{fileId} HTTP/1.1 Host: cloud.appwrite.io @@ -635,6 +684,12 @@ tokens.get( }) );``` +```server-rust +let token = tokens.get( + "<TOKEN_ID>", +).await?; +``` + ```server-rest GET /v1/tokens/{tokenId} HTTP/1.1 Host: cloud.appwrite.io @@ -882,6 +937,29 @@ tokens.update( ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tokens::Tokens; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>") // Your project ID + .set_key("<YOUR_API_KEY>"); // Your secret API key + + let tokens = Tokens::new(&client); + + let result = tokens.update( + "<TOKEN_ID>", + Some(""), // expire (optional) + ).await?; + + println!("{:?}", result); + Ok(()) +} +``` + ```server-graphql mutation { tokensUpdate( @@ -1138,6 +1216,28 @@ tokens.delete( ); ``` +```server-rust +use appwrite::Client; +use appwrite::services::tokens::Tokens; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>") // Your project ID + .set_key("<YOUR_API_KEY>"); // Your secret API key + + let tokens = Tokens::new(&client); + + tokens.delete( + "<TOKEN_ID>", + ).await?; + + println!("Token deleted successfully"); + Ok(()) +} +``` + ```server-graphql mutation { tokensDelete( diff --git a/src/routes/docs/products/storage/quick-start/+page.markdoc b/src/routes/docs/products/storage/quick-start/+page.markdoc index 5e530a184e..667fa00b62 100644 --- a/src/routes/docs/products/storage/quick-start/+page.markdoc +++ b/src/routes/docs/products/storage/quick-start/+page.markdoc @@ -143,6 +143,34 @@ To upload a file, add this to your app. For web apps, you can use the File objec }); ``` + ```server-rust + use appwrite::Client; + use appwrite::services::storage::Storage; + use appwrite::input_file::InputFile; + use appwrite::id::ID; + + #[tokio::main] + async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let storage = Storage::new(&client); + + let file = InputFile::from_path("/path/to/file.jpg", None).await?; + let result = storage.create_file( + "<BUCKET_ID>", + ID::unique(), + file, + None, // permissions (optional) + ).await?; + + println!("{:?}", result); + Ok(()) + } + ``` + ```http POST /v1/storage/buckets/{bucketId}/files HTTP/1.1 Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" diff --git a/src/routes/docs/products/storage/upload-download/+page.markdoc b/src/routes/docs/products/storage/upload-download/+page.markdoc index 1b8f8601ea..518f3450fb 100644 --- a/src/routes/docs/products/storage/upload-download/+page.markdoc +++ b/src/routes/docs/products/storage/upload-download/+page.markdoc @@ -150,6 +150,34 @@ You can also upload files programmatically using our SDKs: } ``` + ```server-rust + use appwrite::Client; + use appwrite::services::storage::Storage; + use appwrite::input_file::InputFile; + use appwrite::id::ID; + + #[tokio::main] + async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<API_KEY>"); + + let storage = Storage::new(&client); + + let file = InputFile::from_path("/path/to/file.jpg", None).await?; + let result = storage.create_file( + "<BUCKET_ID>", + ID::unique(), + file, + None, // permissions (optional) + ).await?; + + println!("{:?}", result); + Ok(()) + } + ``` + ```http POST /v1/storage/buckets/{bucketId}/files HTTP/1.1 Content-Type: multipart/form-data; boundary="cec8e8123c05ba25" diff --git a/src/routes/docs/quick-starts/+page.svelte b/src/routes/docs/quick-starts/+page.svelte index a20ddb00f2..95009f50bd 100644 --- a/src/routes/docs/quick-starts/+page.svelte +++ b/src/routes/docs/quick-starts/+page.svelte @@ -172,6 +172,12 @@ icon: 'icon-kotlin', image: '/images/blog/placeholder.png', href: 'kotlin' + }, + { + title: 'Rust', + icon: 'web-icon-rust', + image: '/images/blog/placeholder.png', + href: 'rust' } ] } diff --git a/src/routes/docs/quick-starts/rust/+page.markdoc b/src/routes/docs/quick-starts/rust/+page.markdoc new file mode 100644 index 0000000000..6a38495796 --- /dev/null +++ b/src/routes/docs/quick-starts/rust/+page.markdoc @@ -0,0 +1,307 @@ +--- +layout: article +title: Start with Rust +description: Learn to get started with server integrations with Appwrite Rust SDK. +difficulty: beginner +readtime: 5 +back: /docs/quick-starts +--- +Learn how to setup your first Rust project powered by Appwrite. +{% section #step-1 step=1 title="Create project" %} +Head to the [Appwrite Console](https://cloud.appwrite.io/console). + +If this is your first time using Appwrite, create an account and create your first project. + +{% only_dark %} +![Create project screen](/images/docs/quick-starts/dark/create-project.png) +{% /only_dark %} +{% only_light %} +![Create project screen](/images/docs/quick-starts/create-project.png) +{% /only_light %} + +Then, under **Integrate with your server**, add an **API Key** with the following scopes. + +{% only_dark %} +![Server integrations](/images/docs/quick-starts/dark/integrate-server.png) +{% /only_dark %} +{% only_light %} +![Server integrations](/images/docs/quick-starts/integrate-server.png) +{% /only_light %} + +| Category {% width=120 %} | Required scopes | Purpose | +|-----------|-----------------------|---------| +| Database | `databases.write` | Allows API key to create, update, and delete [databases](/docs/products/databases/databases). | +| | `tables.write` | Allows API key to create, update, and delete [tables](/docs/products/databases/tables). | +| | `columns.write` | Allows API key to create, update, and delete [columns](/docs/products/databases/tables#columns). | +| | `rows.read` | Allows API key to read [rows](/docs/products/databases/rows). | +| | `rows.write` | Allows API key to create, update, and delete [rows](/docs/products/databases/rows). | + +Other scopes are optional. + +{% only_dark %} +![Project settings screen](/images/docs/quick-starts/dark/project-id.png) +{% /only_dark %} +{% only_light %} +![Project settings screen](/images/docs/quick-starts/project-id.png) +{% /only_light %} + +{% /section %} +{% section #step-2 step=2 title="Create Rust project" %} + +Create a new Rust application. + +```sh +cargo new my_app +cd my_app +``` + +{% /section %} +{% section #step-3 step=3 title="Install Appwrite" %} + +Install the Rust Appwrite SDK and its dependencies. + +```sh +cargo add appwrite +cargo add tokio -F full +cargo add serde_json +``` + +{% /section %} +{% section #step-4 step=4 title="Import Appwrite" %} + +Find your project ID in the **Settings** page. Also, click on the **View API Keys** button to find the API key that was created earlier. + +{% only_dark %} +![Project settings screen](/images/docs/quick-starts/dark/project-id.png) +{% /only_dark %} +{% only_light %} +![Project settings screen](/images/docs/quick-starts/project-id.png) +{% /only_light %} + +Open `src/main.rs` and initialize the Appwrite Client. Replace `<PROJECT_ID>` with your project ID and `<YOUR_API_KEY>` with your API key. + +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<YOUR_API_KEY>"); + + Ok(()) +} +``` + +{% /section %} +{% section #step-5 step=5 title="Initialize database" %} + +Once the Appwrite Client is initialized, create a function to configure a todo table. + +```rust +async fn prepare_database( + tables_db: &TablesDB, +) -> Result<(String, String), Box<dyn std::error::Error>> { + let todo_database = tables_db.create( + ID::unique(), + "TodosDB", + None, + ).await?; + + let todo_table = tables_db.create_table( + &todo_database.id, + ID::unique(), + "Todos", + None, None, None, None, None, + ).await?; + + tables_db.create_varchar_column( + &todo_database.id, + &todo_table.id, + "title", + 255, + true, + None, None, None, + ).await?; + + tables_db.create_text_column( + &todo_database.id, + &todo_table.id, + "description", + false, + Some("This is a test description."), + None, None, + ).await?; + + tables_db.create_boolean_column( + &todo_database.id, + &todo_table.id, + "isComplete", + true, + None, None, + ).await?; + + Ok((todo_database.id, todo_table.id)) +} +``` + +{% /section %} +{% section #step-6 step=6 title="Add rows" %} +Create a function to add some mock data into your new table. + +```rust +async fn seed_database( + tables_db: &TablesDB, + database_id: &str, + table_id: &str, +) -> Result<(), Box<dyn std::error::Error>> { + tables_db.create_row( + database_id, + table_id, + ID::unique(), + json!({ + "title": "Buy apples", + "description": "At least 2KGs", + "isComplete": true + }), + None, None, + ).await?; + + tables_db.create_row( + database_id, + table_id, + ID::unique(), + json!({ + "title": "Wash the apples", + "isComplete": true + }), + None, None, + ).await?; + + tables_db.create_row( + database_id, + table_id, + ID::unique(), + json!({ + "title": "Cut the apples", + "description": "Don't forget to pack them in a box", + "isComplete": false + }), + None, None, + ).await?; + + Ok(()) +} +``` + +{% /section %} +{% section #step-7 step=7 title="Retrieve rows" %} + +Create a function to retrieve the mock todo data and execute the functions in `main`. + +```rust +use appwrite::query::Query; + +async fn get_todos( + tables_db: &TablesDB, + database_id: &str, + table_id: &str, +) -> Result<(), Box<dyn std::error::Error>> { + // Retrieve rows (default limit is 25) + let todos = tables_db.list_rows( + database_id, + table_id, + None, None, None, None, + ).await?; + + println!("Todos:"); + for todo in &todos.rows { + println!("Title: {}\nDescription: {}\nIs Todo Complete: {}\n", + todo.get::<String>("title").unwrap_or_default(), + todo.get::<String>("description").unwrap_or_default(), + todo.get::<bool>("isComplete").unwrap_or_default(), + ); + } + + // Use queries to filter completed todos with pagination + let completed_todos = tables_db.list_rows( + database_id, + table_id, + Some(vec![ + Query::equal("isComplete", true).to_string(), + Query::order_desc("$createdAt").to_string(), + Query::limit(5).to_string(), + ]), + None, None, None, + ).await?; + + println!("Completed todos (limited to 5):"); + for todo in &completed_todos.rows { + println!("Title: {}\nDescription: {}\nIs Todo Complete: {}\n", + todo.get::<String>("title").unwrap_or_default(), + todo.get::<String>("description").unwrap_or_default(), + todo.get::<bool>("isComplete").unwrap_or_default(), + ); + } + + // Query for incomplete todos + let incomplete_todos = tables_db.list_rows( + database_id, + table_id, + Some(vec![ + Query::equal("isComplete", false).to_string(), + Query::order_asc("title").to_string(), + ]), + None, None, None, + ).await?; + + println!("Incomplete todos (ordered by title):"); + for todo in &incomplete_todos.rows { + println!("Title: {}\nDescription: {}\nIs Todo Complete: {}\n", + todo.get::<String>("title").unwrap_or_default(), + todo.get::<String>("description").unwrap_or_default(), + todo.get::<bool>("isComplete").unwrap_or_default(), + ); + } + + Ok(()) +} +``` + +Make sure to update `main()` with the functions you created. Your `main()` function should look something like this: + +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::id::ID; +use appwrite::query::Query; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<YOUR_API_KEY>"); + + let tables_db = TablesDB::new(&client); + + let (database_id, table_id) = prepare_database(&tables_db).await?; + seed_database(&tables_db, &database_id, &table_id).await?; + get_todos(&tables_db, &database_id, &table_id).await?; + + Ok(()) +} +``` + +{% /section %} + +{% section #step-8 step=8 title="All set" %} + +Run your project with `cargo run` and view the response in your console. + +{% /section %} diff --git a/src/routes/docs/quick-starts/rust/prompt.md b/src/routes/docs/quick-starts/rust/prompt.md new file mode 100644 index 0000000000..434cdd0261 --- /dev/null +++ b/src/routes/docs/quick-starts/rust/prompt.md @@ -0,0 +1,267 @@ +## Create a Rust app with Appwrite server integration + +Create a Rust app with Appwrite server integration that creates a todo database, seeds it with data, and retrieves rows. + +Do exactly these steps in order. Confirm each step succeeds before continuing. If any command fails, show the error and fix it automatically. + +## Step 1: Create project in Appwrite Console + +- If this is the user's first time using Appwrite, guide them to create an account and project at https://cloud.appwrite.io/console +- Under **Integrate with your server**, add an **API Key** with the following scopes: + +| Category | Required scopes | Purpose | +| -------- | ----------------- | ------------------------------------------------------ | +| Database | `databases.write` | Allows API key to create, update, and delete databases | +| | `tables.write` | Allows API key to create, update, and delete tables | +| | `columns.write` | Allows API key to create, update, and delete columns | +| | `rows.read` | Allows API key to read rows | +| | `rows.write` | Allows API key to create, update, and delete rows | + +- Other scopes are optional. + +## Step 2: Create Rust project + +- If you already have a Rust project open, stay in it and use it. +- Otherwise, run: + +```sh +cargo new my_app +cd my_app +``` + +## Step 3: Install Appwrite SDK + +- Run: + +```sh +cargo add appwrite +cargo add tokio -F full +cargo add serde_json +``` + +## Step 4: Import Appwrite and initialize client (ask user for details; never assume) + +- Ask the user for: + - Appwrite Cloud Region (e.g. `fra`, `nyc`) + - **Project ID** (from Console -> Settings) + - **API Key** (from Console -> View API Keys) +- Open `src/main.rs` and initialize the Appwrite Client: + +```rust +use appwrite::Client; +use appwrite::services::tables_db::TablesDB; +use appwrite::id::ID; +use serde_json::json; + +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<YOUR_API_KEY>"); + + Ok(()) +} +``` + +## Step 5: Initialize database + +- Create a function to configure a todo table: + +```rust +async fn prepare_database( + tables_db: &TablesDB, +) -> Result<(String, String), Box<dyn std::error::Error>> { + let todo_database = tables_db.create( + ID::unique(), + "TodosDB", + None, + ).await?; + + let todo_table = tables_db.create_table( + &todo_database.id, + ID::unique(), + "Todos", + None, None, None, None, None, + ).await?; + + tables_db.create_varchar_column( + &todo_database.id, + &todo_table.id, + "title", + 255, + true, + None, None, None, + ).await?; + + tables_db.create_text_column( + &todo_database.id, + &todo_table.id, + "description", + false, + Some("This is a test description."), + None, None, + ).await?; + + tables_db.create_boolean_column( + &todo_database.id, + &todo_table.id, + "isComplete", + true, + None, None, + ).await?; + + Ok((todo_database.id, todo_table.id)) +} +``` + +## Step 6: Add rows (seed database) + +- Create a function to add mock data into the table: + +```rust +async fn seed_database( + tables_db: &TablesDB, + database_id: &str, + table_id: &str, +) -> Result<(), Box<dyn std::error::Error>> { + tables_db.create_row( + database_id, + table_id, + ID::unique(), + json!({ + "title": "Buy apples", + "description": "At least 2KGs", + "isComplete": true + }), + None, None, + ).await?; + + tables_db.create_row( + database_id, + table_id, + ID::unique(), + json!({ + "title": "Wash the apples", + "isComplete": true + }), + None, None, + ).await?; + + tables_db.create_row( + database_id, + table_id, + ID::unique(), + json!({ + "title": "Cut the apples", + "description": "Don't forget to pack them in a box", + "isComplete": false + }), + None, None, + ).await?; + + Ok(()) +} +``` + +## Step 7: Retrieve rows + +- Add the query import and create functions to retrieve todos: + +```rust +use appwrite::query::Query; + +async fn get_todos( + tables_db: &TablesDB, + database_id: &str, + table_id: &str, +) -> Result<(), Box<dyn std::error::Error>> { + let todos = tables_db.list_rows( + database_id, + table_id, + None, None, None, None, + ).await?; + + println!("Todos:"); + for todo in &todos.rows { + println!("Title: {}\nDescription: {}\nIs Todo Complete: {}\n", + todo.get::<String>("title").unwrap_or_default(), + todo.get::<String>("description").unwrap_or_default(), + todo.get::<bool>("isComplete").unwrap_or_default(), + ); + } + + let completed_todos = tables_db.list_rows( + database_id, + table_id, + Some(vec![ + Query::equal("isComplete", true).to_string(), + Query::order_desc("$createdAt").to_string(), + Query::limit(5).to_string(), + ]), + None, None, None, + ).await?; + + println!("Completed todos (limited to 5):"); + for todo in &completed_todos.rows { + println!("Title: {}\nDescription: {}\nIs Todo Complete: {}\n", + todo.get::<String>("title").unwrap_or_default(), + todo.get::<String>("description").unwrap_or_default(), + todo.get::<bool>("isComplete").unwrap_or_default(), + ); + } + + let incomplete_todos = tables_db.list_rows( + database_id, + table_id, + Some(vec![ + Query::equal("isComplete", false).to_string(), + Query::order_asc("title").to_string(), + ]), + None, None, None, + ).await?; + + println!("Incomplete todos (ordered by title):"); + for todo in &incomplete_todos.rows { + println!("Title: {}\nDescription: {}\nIs Todo Complete: {}\n", + todo.get::<String>("title").unwrap_or_default(), + todo.get::<String>("description").unwrap_or_default(), + todo.get::<bool>("isComplete").unwrap_or_default(), + ); + } + + Ok(()) +} +``` + +## Step 8: Update main function and run + +- Update `main()` to call all functions: + +```rust +#[tokio::main] +async fn main() -> Result<(), Box<dyn std::error::Error>> { + let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") + .set_project("<PROJECT_ID>") + .set_key("<YOUR_API_KEY>"); + + let tables_db = TablesDB::new(&client); + + let (database_id, table_id) = prepare_database(&tables_db).await?; + seed_database(&tables_db, &database_id, &table_id).await?; + get_todos(&tables_db, &database_id, &table_id).await?; + + Ok(()) +} +``` + +- Run: `cargo run` +- View the response in the console + +## Deliverables + +- A running Rust app with working Appwrite server integration +- Files created: `Cargo.toml`, `src/main.rs` +- A **TodosDB** database with a **Todos** table containing `title`, `description`, and `isComplete` columns +- Three seeded todo rows with the ability to query and filter them diff --git a/src/routes/docs/references/quick-start/+page.markdoc b/src/routes/docs/references/quick-start/+page.markdoc index 08446fba17..4835645866 100644 --- a/src/routes/docs/references/quick-start/+page.markdoc +++ b/src/routes/docs/references/quick-start/+page.markdoc @@ -238,6 +238,14 @@ let client = Client() .setProject("<PROJECT_ID>") // Your project ID .setJWT("<YOUR_API_KEY>") // Your secret JSON Web Token ``` +```server-rust +use appwrite::Client; + +let client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>") // Your project ID + .set_jwt("<YOUR_API_KEY>"); // Your secret JSON Web Token +``` {% /multicode %} {% /tabsitem %} @@ -276,6 +284,14 @@ $adminClient = (new Client()) ->setKey('<YOUR_API_KEY>'); // Your secret API key +``` +```server-rust +use appwrite::Client; + +let admin_client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>") // Your project ID + .set_key("<YOUR_API_KEY>"); // Your secret API key ``` {% /multicode %} @@ -309,6 +325,18 @@ if ($session) { $sessionClient->setSession($session); } ``` +```server-rust +use appwrite::Client; + +let session_client = Client::new() + .set_endpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint + .set_project("<PROJECT_ID>"); // Your project ID + +// Get the session cookie from the request +// This depends on your HTTP framework (e.g. actix-web, axum, rocket) +let session = req.cookie("a_session_<PROJECT_ID>"); +session_client.set_session(session); +``` {% /multicode %} {% /tabsitem %} diff --git a/src/routes/docs/sdks/+page.markdoc b/src/routes/docs/sdks/+page.markdoc index be34b6aa3b..61340e024b 100644 --- a/src/routes/docs/sdks/+page.markdoc +++ b/src/routes/docs/sdks/+page.markdoc @@ -111,7 +111,13 @@ Server libraries for integrating with Appwrite to build server side integrations {% only_light %}{% icon_image src="/images/platforms/kotlin.svg" alt="Kotlin logo" size="m" /%}{% /only_light %} * Kotlin SDK `14.1.0` * [appwrite/sdk-for-kotlin](https://github.com/appwrite/sdk-for-kotlin) -* +* +--- +* {% only_dark %}{% icon_image src="/images/platforms/dark/rust.svg" alt="Rust logo" size="m" /%}{% /only_dark %} +{% only_light %}{% icon_image src="/images/platforms/rust.svg" alt="Rust logo" size="m" /%}{% /only_light %} +* Rust SDK `0.2.0` +* [appwrite/sdk-for-rust](https://github.com/appwrite/sdk-for-rust) +* {% /table %} If you would like to help us extend our platforms and SDKs stack, you are more than welcome to contact us or contribute to the [Appwrite SDK Generator](https://github.com/appwrite/sdk-generator) project GitHub repository and read our contribution guide. @@ -278,6 +284,15 @@ ID.unique() // Generate a custom ID ID.custom("my-custom-id") ``` +```rust +use appwrite::id::ID; + +// Generate a unique ID +ID::unique() + +// Generate a custom ID +ID::custom("my-custom-id") +``` {% /multicode %} {% /tabsitem %} {% /tabs %} @@ -397,6 +412,12 @@ You can discover the available enums in each SDK at the source. * Kotlin SDK `14.1.0` * [appwrite/sdk-for-kotlin](https://github.com/appwrite/sdk-for-kotlin/tree/dev/src/main/kotlin/io/appwrite/enums) * +--- +* {% only_dark %}{% icon_image src="/images/platforms/dark/rust.svg" alt="Rust logo" size="m" /%}{% /only_dark %} +{% only_light %}{% icon_image src="/images/platforms/rust.svg" alt="Rust logo" size="m" /%}{% /only_light %} +* Rust SDK `0.2.0` +* [appwrite/sdk-for-rust](https://github.com/appwrite/sdk-for-rust/tree/dev/src/enums) +* {% /table %} {% /tabsitem %} {% /tabs %} diff --git a/src/routes/docs/tooling/ai/quickstart-prompts/+page.markdoc b/src/routes/docs/tooling/ai/quickstart-prompts/+page.markdoc index 3f6ef4a975..e4d89499ea 100644 --- a/src/routes/docs/tooling/ai/quickstart-prompts/+page.markdoc +++ b/src/routes/docs/tooling/ai/quickstart-prompts/+page.markdoc @@ -119,4 +119,7 @@ Use the following quick start prompts with your preferred AI assistant to integr {% cards_item href="/docs/tooling/ai/quickstart-prompts/kotlin" title="Kotlin" icon="icon-kotlin" %} {% /cards_item %} +{% cards_item href="/docs/tooling/ai/quickstart-prompts/rust" title="Rust" icon="web-icon-rust" %} +{% /cards_item %} + {% /cards %} diff --git a/src/routes/docs/tooling/ai/quickstart-prompts/rust/+page.markdoc b/src/routes/docs/tooling/ai/quickstart-prompts/rust/+page.markdoc new file mode 100644 index 0000000000..28c2793318 --- /dev/null +++ b/src/routes/docs/tooling/ai/quickstart-prompts/rust/+page.markdoc @@ -0,0 +1,8 @@ +--- +layout: article +title: Rust +description: Quickstart prompt for integrating Appwrite with Rust. +prompt: /docs/quick-starts/rust +--- + +{% prompt_content /%} diff --git a/static/images/blog/announcing-appwrite-rust-sdk/cover.png b/static/images/blog/announcing-appwrite-rust-sdk/cover.png new file mode 100644 index 0000000000..da6be73337 Binary files /dev/null and b/static/images/blog/announcing-appwrite-rust-sdk/cover.png differ diff --git a/static/images/platforms/dark/rust.svg b/static/images/platforms/dark/rust.svg new file mode 100644 index 0000000000..56058cdb7a --- /dev/null +++ b/static/images/platforms/dark/rust.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z" fill="#e4e4e7"/></svg> diff --git a/static/images/platforms/rust.svg b/static/images/platforms/rust.svg new file mode 100644 index 0000000000..7364d9ede6 --- /dev/null +++ b/static/images/platforms/rust.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M23.8346 11.7033l-1.0073-.6236a13.7268 13.7268 0 00-.0283-.2936l.8656-.8069a.3483.3483 0 00-.1154-.578l-1.1066-.414a8.4958 8.4958 0 00-.087-.2856l.6904-.9587a.3462.3462 0 00-.2257-.5446l-1.1663-.1894a9.3574 9.3574 0 00-.1407-.2622l.49-1.0761a.3437.3437 0 00-.0274-.3361.3486.3486 0 00-.3006-.154l-1.1845.0416a6.7444 6.7444 0 00-.1873-.2268l.2723-1.153a.3472.3472 0 00-.417-.4172l-1.1532.2724a14.0183 14.0183 0 00-.2278-.1873l.0415-1.1845a.3442.3442 0 00-.49-.328l-1.076.491c-.0872-.0476-.1742-.0952-.2623-.1407l-.1903-1.1673A.3483.3483 0 0016.256.955l-.9597.6905a8.4867 8.4867 0 00-.2855-.086l-.414-1.1066a.3483.3483 0 00-.5781-.1154l-.8069.8666a9.2936 9.2936 0 00-.2936-.0284L12.2946.1683a.3462.3462 0 00-.5892 0l-.6236 1.0073a13.7383 13.7383 0 00-.2936.0284L9.9803.3374a.3462.3462 0 00-.578.1154l-.4141 1.1065c-.0962.0274-.1903.0567-.2855.086L7.744.955a.3483.3483 0 00-.5447.2258L7.009 2.348a9.3574 9.3574 0 00-.2622.1407l-1.0762-.491a.3462.3462 0 00-.49.328l.0416 1.1845a7.9826 7.9826 0 00-.2278.1873L3.8413 3.425a.3472.3472 0 00-.4171.4171l.2713 1.1531c-.0628.075-.1255.1509-.1863.2268l-1.1845-.0415a.3462.3462 0 00-.328.49l.491 1.0761a9.167 9.167 0 00-.1407.2622l-1.1662.1894a.3483.3483 0 00-.2258.5446l.6904.9587a13.303 13.303 0 00-.087.2855l-1.1065.414a.3483.3483 0 00-.1155.5781l.8656.807a9.2936 9.2936 0 00-.0283.2935l-1.0073.6236a.3442.3442 0 000 .5892l1.0073.6236c.008.0982.0182.1964.0283.2936l-.8656.8079a.3462.3462 0 00.1155.578l1.1065.4141c.0273.0962.0567.1914.087.2855l-.6904.9587a.3452.3452 0 00.2268.5447l1.1662.1893c.0456.088.0922.1751.1408.2622l-.491 1.0762a.3462.3462 0 00.328.49l1.1834-.0415c.0618.0769.1235.1528.1873.2277l-.2713 1.1541a.3462.3462 0 00.4171.4161l1.153-.2713c.075.0638.151.1255.2279.1863l-.0415 1.1845a.3442.3442 0 00.49.327l1.0761-.49c.087.0486.1741.0951.2622.1407l.1903 1.1662a.3483.3483 0 00.5447.2268l.9587-.6904a9.299 9.299 0 00.2855.087l.414 1.1066a.3452.3452 0 00.5781.1154l.8079-.8656c.0972.0111.1954.0203.2936.0294l.6236 1.0073a.3472.3472 0 00.5892 0l.6236-1.0073c.0982-.0091.1964-.0183.2936-.0294l.8069.8656a.3483.3483 0 00.578-.1154l.4141-1.1066a8.4626 8.4626 0 00.2855-.087l.9587.6904a.3452.3452 0 00.5447-.2268l.1903-1.1662c.088-.0456.1751-.0931.2622-.1407l1.0762.49a.3472.3472 0 00.49-.327l-.0415-1.1845a6.7267 6.7267 0 00.2267-.1863l1.1531.2713a.3472.3472 0 00.4171-.416l-.2713-1.1542c.0628-.0749.1255-.1508.1863-.2278l1.1845.0415a.3442.3442 0 00.328-.49l-.49-1.076c.0475-.0872.0951-.1742.1407-.2623l1.1662-.1893a.3483.3483 0 00.2258-.5447l-.6904-.9587.087-.2855 1.1066-.414a.3462.3462 0 00.1154-.5781l-.8656-.8079c.0101-.0972.0202-.1954.0283-.2936l1.0073-.6236a.3442.3442 0 000-.5892zm-6.7413 8.3551a.7138.7138 0 01.2986-1.396.714.714 0 11-.2997 1.396zm-.3422-2.3142a.649.649 0 00-.7715.5l-.3573 1.6685c-1.1035.501-2.3285.7795-3.6193.7795a8.7368 8.7368 0 01-3.6951-.814l-.3574-1.6684a.648.648 0 00-.7714-.499l-1.473.3158a8.7216 8.7216 0 01-.7613-.898h7.1676c.081 0 .1356-.0141.1356-.088v-2.536c0-.074-.0536-.0881-.1356-.0881h-2.0966v-1.6077h2.2677c.2065 0 1.1065.0587 1.394 1.2088.0901.3533.2875 1.5044.4232 1.8729.1346.413.6833 1.2381 1.2685 1.2381h3.5716a.7492.7492 0 00.1296-.0131 8.7874 8.7874 0 01-.8119.9526zM6.8369 20.024a.714.714 0 11-.2997-1.396.714.714 0 01.2997 1.396zM4.1177 8.9972a.7137.7137 0 11-1.304.5791.7137.7137 0 011.304-.579zm-.8352 1.9813l1.5347-.6824a.65.65 0 00.33-.8585l-.3158-.7147h1.2432v5.6025H3.5669a8.7753 8.7753 0 01-.2834-3.348zm6.7343-.5437V8.7836h2.9601c.153 0 1.0792.1772 1.0792.8697 0 .575-.7107.7815-1.2948.7815zm10.7574 1.4862c0 .2187-.008.4363-.0243.651h-.9c-.09 0-.1265.0586-.1265.1477v.413c0 .973-.5487 1.1846-1.0296 1.2382-.4576.0517-.9648-.1913-1.0275-.4717-.2704-1.5186-.7198-1.8436-1.4305-2.4034.8817-.5599 1.799-1.386 1.799-2.4915 0-1.1936-.819-1.9458-1.3769-2.3153-.7825-.5163-1.6491-.6195-1.883-.6195H5.4682a8.7651 8.7651 0 014.907-2.7699l1.0974 1.151a.648.648 0 00.9182.0213l1.227-1.1743a8.7753 8.7753 0 016.0044 4.2762l-.8403 1.8982a.652.652 0 00.33.8585l1.6178.7188c.0283.2875.0425.577.0425.8717zm-9.3006-9.5993a.7128.7128 0 11.984 1.0316.7137.7137 0 01-.984-1.0316zm8.3389 6.71a.7107.7107 0 01.9395-.3625.7137.7137 0 11-.9405.3635z" fill="#CE422B"/></svg>