Skip to content
Open

CPP SDK #1471

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5075c16
feat(cpp): implement C++ SDK generator class and type mapping
bhardwajparth51 Apr 23, 2026
ebc781d
feat(cpp): implement core SDK templates (Task, Result, Exception)
bhardwajparth51 Apr 23, 2026
7106529
feat(cpp): implement model and enum generation with topological sorting
bhardwajparth51 Apr 23, 2026
8bea339
feat(cpp): implement service generation with async dispatch
bhardwajparth51 Apr 23, 2026
9d0d53c
feat(cpp): implement robust transport layer (chunked upload, multipart)
bhardwajparth51 Apr 23, 2026
937d6e2
feat(cpp): implement query, permission, and ID builders
bhardwajparth51 Apr 23, 2026
cf42d17
feat(cpp): add CMake build system and GoogleTest infrastructure
bhardwajparth51 Apr 23, 2026
56a77ec
feat(cpp): implement integration test logic and mock-server support
bhardwajparth51 Apr 23, 2026
87e721d
feat(cpp): implement Cpp20Test harness and PHP verification suite
bhardwajparth51 Apr 23, 2026
3aec26b
docs(cpp): add production-ready README and usage examples
bhardwajparth51 Apr 23, 2026
151d52c
ci(cpp): implement build validation workflow and Docker environment
bhardwajparth51 Apr 23, 2026
7e0fbaf
feat(cpp): add repository hygiene templates (GitHub workflows and usa…
bhardwajparth51 Apr 23, 2026
7cf5365
docs(cpp): clarify Task thread-safety and sync/async semantics
bhardwajparth51 Apr 23, 2026
2656fec
fix(cpp): resolve realtime concurrency hazards, add Result<void>::err…
bhardwajparth51 Apr 23, 2026
65d0ea6
fix(cpp): resolve realtime reconnect bug, clarify upload retry semantics
bhardwajparth51 Apr 23, 2026
66abc59
fix(cpp): use inline for internal helpers, document cpr v1.10.5 pinni…
bhardwajparth51 Apr 23, 2026
0607aab
fix(cpp): move Dockerfile comment to valid position (no inline after …
bhardwajparth51 Apr 23, 2026
3daf4dd
fix(cpp): guard Task::get() against double-call, document enqueue bac…
bhardwajparth51 Apr 23, 2026
13aa726
fix(cpp): guard InputFile against nullopt default, eliminate p[0] UB …
bhardwajparth51 Apr 23, 2026
3d55053
fix(cpp): throw AppwriteException for InputFile errors, fix chunk upl…
bhardwajparth51 Apr 23, 2026
1c08852
fix(cpp): return getHeaders by value to prevent dangling reference in…
bhardwajparth51 Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/sdk-build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
- sdk: rust
platform: server

- sdk: cpp
platform: server

# Console SDKs
- sdk: cli
platform: console
Expand Down Expand Up @@ -161,6 +164,15 @@ jobs:
if: matrix.sdk == 'rust'
uses: dtolnay/rust-toolchain@1.83.0

- name: Setup C++
if: matrix.sdk == 'cpp'
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libcurl4-openssl-dev nlohmann-json3-dev libgtest-dev
git clone --depth 1 --branch 1.10.5 https://github.com/libcpr/cpr.git /tmp/cpr
cmake -S /tmp/cpr -B /tmp/cpr/build -DCPR_BUILD_TESTS=OFF -DCPR_USE_SYSTEM_CURL=ON -DCMAKE_INSTALL_PREFIX=/usr/local
sudo cmake --build /tmp/cpr/build --target install -j$(nproc)

- name: Build SDK
working-directory: examples/${{ matrix.sdk }}
run: |
Expand Down Expand Up @@ -238,6 +250,11 @@ jobs:
cargo build --release
cargo test --lib
;;
cpp)
cmake -S . -B build -DAPPWRITE_BUILD_TESTS=ON -DCMAKE_PREFIX_PATH=/usr/local
cmake --build build -j$(nproc)
ctest --test-dir build --output-on-failure
;;
*)
echo "Unknown SDK: ${{ matrix.sdk }}"
exit 1
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tests/tmp

# exception to the rule
!examples/.gitkeep
!examples/cpp/

**/.DS_Store
templates/swift/example/.build
Expand All @@ -28,3 +29,10 @@ go.sum
# exclude raw lock files in templates (use .twig versions instead)
templates/cli/package-lock.json
templates/cli/bun.lock
# exclude demo folder
demo/
integration_output.log
temp_master_workflow.yml
examples/*/build/
scratch/
rebase_todo.txt
36 changes: 36 additions & 0 deletions example.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Appwrite\SDK\Language\ClaudePlugin;
use Appwrite\SDK\Language\CursorPlugin;
use Appwrite\SDK\Language\Rust;
use Appwrite\SDK\Language\Cpp;

try {

Expand Down Expand Up @@ -345,6 +346,41 @@ function configureSDK($sdk, $overrides = []) {
configureSDK($sdk);
$sdk->generate(__DIR__ . '/examples/rust');
}

// C++
if (!$requestedSdk || $requestedSdk === 'cpp') {
$sdk = new SDK(new Cpp(), new Swagger2($spec));
configureSDK($sdk, [
'name' => 'cpp',
'version' => '0.0.1',
'platform' => $platform,
'namespace' => 'appwrite',
'exclude' => [
'services' => [
['name' => 'avatars'],
['name' => 'health'],
['name' => 'locale'],
['name' => 'messaging'],
['name' => 'migrations'],
['name' => 'graphql'],
['name' => 'vcs'],
['name' => 'assistant'],
['name' => 'activities'],
['name' => 'backups'],
['name' => 'console'],
['name' => 'domains'],
['name' => 'organizations'],
['name' => 'project'],
['name' => 'projects'],
['name' => 'proxy'],
['name' => 'sites'],
['name' => 'tables_db'],
['name' => 'tokens'],
]
]
]);
$sdk->generate(__DIR__ . '/examples/cpp');
}
}
catch (Exception $exception) {
echo 'Error: ' . $exception->getMessage() . ' on ' . $exception->getFile() . ':' . $exception->getLine() . "\n";
Expand Down
12 changes: 12 additions & 0 deletions examples/cpp/.github/workflows/autoclose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Auto-close External Pull Requests

on:
pull_request_target:
types: [opened, reopened]

jobs:
auto_close:
if: github.head_ref != 'dev'
uses: appwrite/.github/.github/workflows/autoclose.yml@main
secrets:
GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
35 changes: 35 additions & 0 deletions examples/cpp/.github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Release

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish:
name: Tag and publish release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup C++ build environment
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake libcurl4-openssl-dev

- name: Build and validate SDK
run: |
cmake -S . -B build -DAPPWRITE_BUILD_TESTS=ON
cmake --build build
ctest --test-dir build --output-on-failure

- name: Create GitHub Release archive
run: |
git archive --format=tar.gz --prefix=reponame/ HEAD \
> reponame-${{ github.ref_name }}.tar.gz

- name: Upload release artifact
uses: softprops/action-gh-release@v2
with:
files: reponame-${{ github.ref_name }}.tar.gz
9 changes: 9 additions & 0 deletions examples/cpp/.github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Mark stale issues

on:
schedule:
- cron: "0 0 * * *" # Midnight Runtime

jobs:
stale:
uses: appwrite/.github/.github/workflows/stale.yml@main
Loading
Loading