-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Add Elixir code generation target #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mikehostetler
wants to merge
6
commits into
xdevplatform:main
Choose a base branch
from
mikehostetler:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds Elixir/Req-based SDK generation support to the XDK generator. This includes templates, codegen module, and build integration. Testing will begin shortly — not ready for a PR. Amp-Thread-ID: https://ampcode.com/threads/T-019c38bc-09ad-7772-aabf-6ad3cbde05cb Co-authored-by: Amp <[email protected]>
- Remove supervision tree (application.j2) — library no longer owns OTP processes
- Remove unused Zoi dependency
- Restructure errors: add RateLimitError, DecodeError, TransportError with context
- Add Xdk.Query module for proper CSV list encoding in query params
- Generate request body params for POST/PUT/DELETE endpoints (json: body)
- Generate streaming functions using Finch.stream/5 for stream endpoints
- Add Xdk.Streaming module for NDJSON stream consumption
- Add Xdk.Paginator module for cursor-based pagination
- Improve auth: support {:bearer, _} and {:oauth2, _}, per-request override
- Fix typespecs: default to String.t() instead of any() for path params
- Add Bypass-based integration tests (auth, error handling, rate limits)
- Update .gitignore to exclude generated elixir output
Amp-Thread-ID: https://ampcode.com/threads/T-019c38d2-bcb5-7195-927a-2787451bdcb5
Co-authored-by: Amp <[email protected]>
…plate Amp-Thread-ID: https://ampcode.com/threads/T-019c38ef-224f-775a-b955-714dfa4e5243 Co-authored-by: Amp <[email protected]>
- Add {:oauth1, credentials} auth type to client
- Sign requests with HMAC-SHA1 inside request/4 where method+URL are known
- Add oauther ~> 1.3 as dependency
- Add .env to gitignore template
Amp-Thread-ID: https://ampcode.com/threads/T-019c38ef-224f-775a-b955-714dfa4e5243
Co-authored-by: Amp <[email protected]>
- mix_exs.j2: add Hex metadata, dialyzer, credo, ex_doc, quality alias, rename to xdk_elixir - errors.j2: add @moduledoc to all modules - gitignore.j2: add PLT, coverage, editor entries - Bump elixir version to 1.0.0 in xdk-config.toml Amp-Thread-ID: https://ampcode.com/threads/T-019c390a-abe3-726d-a4a1-9cfc2522667b Co-authored-by: Amp <[email protected]>
- streaming.j2: add @moduledoc (was hidden) - errors.j2: use Exception.t() instead of Splode macro types, drop UnknownError from typedoc Amp-Thread-ID: https://ampcode.com/threads/T-019c390a-abe3-726d-a4a1-9cfc2522667b Co-authored-by: Amp <[email protected]>
Contributor
|
Woah this is sick! Will review. Thanks for doing this |
Contributor
|
@mikehostetler can u fix formatting plz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Human here, super excited to try this API. I work in Elixir, so took it on myself to whip up a generated API client this morning. Went really well and I'm already integrating it with my stack!
Thanks for doing this!
AI Summary
Adds an Elixir target to the XDK generator, producing a complete, publishable Elixir SDK for the X API v2.
The generated package is published on Hex: xdk_elixir
What's included
Generator (Rust)
xdk-gen/src/elixir/— Generator module using thelanguage!macro with Elixir-appropriate casingxdk-build/src/elixir.rs— CLI module (generates + runsmix format)xdk-gen/templates/elixir/— 12 Jinja2 templates:main_client.j2— CoreXdkclient module (Finch-based HTTP, auth, response handling)client_class.j2— Per-tag API modules (Users, Posts, Lists, etc.)errors.j2— Structured error types via Splodequery.j2— Query parameter encoding with CSV list supportpaginator.j2— Cursor-based pagination viaStream.resource/3streaming.j2— NDJSON streaming for filtered/sample streamstest_structure.j2/test_helper.j2— Bypass-based test scaffoldingmix_exs.j2— Full mix.exs with Hex metadata, dialyzer, credo, quality aliasGenerated SDK features
mix qualityalias (compile warnings-as-errors, format, credo --strict, dialyzer)Testing
mix qualitypasses clean (compile, format, credo, dialyzer)mix docsgenerates with zero warningsUsage