Skip to content

Commit ba789f2

Browse files
committed
feat(xdks): revamp SDK docs for Python, TypeScript, Java & C# with OpenAPI code samples overlay
1 parent 3f5b0c6 commit ba789f2

540 files changed

Lines changed: 58174 additions & 31375 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/update-docs.yml‎

Lines changed: 36 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Update Documentation
22

33
on:
44
workflow_dispatch:
5+
repository_dispatch:
6+
types: [xdk-released]
57
schedule:
68
- cron: '0 17 * * *' # 9am PT
79
- cron: '0 20 * * *' # 12pm PT
@@ -14,83 +16,57 @@ jobs:
1416
permissions:
1517
contents: write
1618
steps:
17-
- name: Checkout Repository
18-
uses: actions/checkout@v3
19+
- name: Checkout Docs Repository
20+
uses: actions/checkout@v4
21+
22+
- name: Checkout XDK Generator
23+
uses: actions/checkout@v4
24+
with:
25+
repository: xdevplatform/xdk
26+
ref: main
27+
path: .xdk-gen
1928

2029
- name: Set Up Node.js
21-
uses: actions/setup-node@v3
30+
uses: actions/setup-node@v4
2231
with:
2332
node-version: '20'
2433

34+
- name: Set Up Rust
35+
uses: dtolnay/rust-toolchain@stable
36+
37+
- name: Cache XDK Rust Build
38+
uses: Swatinem/rust-cache@v2
39+
with:
40+
workspaces: .xdk-gen
41+
2542
- name: Fetch Latest OpenAPI Specification
2643
run: |
2744
curl --fail --silent --show-error --location \
2845
--retry 3 --retry-delay 5 --max-time 120 \
2946
-o openapi.json \
3047
https://api.x.com/2/openapi.json
31-
# Fail early if the response is not valid JSON (e.g. an error page)
3248
jq -e .openapi openapi.json > /dev/null
3349
34-
- name: Remove Existing api-reference Directory
35-
run: rm -rf api-reference
36-
37-
- name: Generate MDX Files
38-
run: npx @mintlify/scraping@latest openapi-file ./openapi.json -o api-reference
39-
40-
- name: Rename Subdirectories
50+
- name: Sync XDK Reference, OpenAPI Code Samples Overlay, and Endpoint Stubs
4151
run: |
42-
if [ -d "api-reference/tweets" ]; then
43-
mv api-reference/tweets api-reference/posts
44-
fi
45-
# Add more rename commands here if needed, e.g.:
46-
# if [ -d "api-reference/other" ]; then
47-
# mv api-reference/other api-reference/newname
48-
# fi
49-
- name: Rename Files Containing '%'
50-
run: |
51-
find api-reference -type f -name '*%*.mdx' -exec bash -c '
52-
new_name="${0//%/}"
53-
if [ ! -f "$new_name" ]; then
54-
mv "$0" "$new_name"
55-
else
56-
echo "Cannot rename $0 to $new_name: file already exists"
57-
fi
58-
' {} \;
59-
- name: Move Files to x-api
60-
run: |
61-
# Function to move files from api-reference to x-api
62-
move_files() {
63-
local src_dir=$1
64-
local dest_dir=$2
65-
for item in "$src_dir"/*; do
66-
if [ -d "$item" ]; then
67-
# Handle subdirectories
68-
local base_name=$(basename "$item")
69-
local new_dest="$dest_dir/$base_name"
70-
mkdir -p "$new_dest" # Create subdirectory in x-api if it doesn’t exist
71-
move_files "$item" "$new_dest" # Recursively move contents
72-
elif [ -f "$item" ]; then
73-
# Move individual files
74-
local file_name=$(basename "$item")
75-
local dest_file="$dest_dir/$file_name"
76-
mv "$item" "$dest_file" # Move file to x-api subdirectory
77-
fi
78-
done
79-
}
80-
81-
# Start moving files from api-reference to x-api
82-
move_files "api-reference" "x-api"
52+
cargo run --manifest-path .xdk-gen/Cargo.toml --bin xdk-build -- \
53+
docs --spec ./openapi.json --output . --sync-endpoint-stubs
54+
rm -rf .xdk-gen
8355
84-
- name: Remove api-reference Directory
85-
run: rm -rf api-reference
56+
- name: Validate Mintlify Build & XDK Docs
57+
run: |
58+
npx --yes mint@latest validate --no-build --files "xdks/**" "tools/**" "tools-and-libraries.mdx"
59+
npx --yes mint@latest validate --no-build --disable unknown-component
60+
npx --yes mint@latest broken-links --files "xdks/**" "tools/**" "tools-and-libraries.mdx"
8661
8762
- name: Commit and Push Changes
8863
run: |
89-
git config --local user.email "action@github.com"
90-
git config --local user.name "GitHub Action"
91-
git add openapi.json x-api
92-
if git commit -m "Update documentation with latest OpenAPI spec"; then
93-
git push
64+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
65+
git config --local user.name "github-actions[bot]"
66+
git add openapi.json overlays/xdk-code-samples.json docs.json xdks tools tools-and-libraries.mdx x-api
67+
if git diff --cached --quiet; then
68+
echo "No documentation changes to commit."
9469
else
95-
echo "No changes to commit"
70+
git commit -m "chore: sync OpenAPI spec, XDK reference, and code samples overlay"
71+
git push
9672
fi
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Validate Docs
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
jobs:
9+
validate:
10+
name: Mintlify Validation
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set Up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
20+
- name: Validate XDK & Tools Pages
21+
run: npx --yes mint@latest validate --no-build --files "xdks/**" "tools/**" "tools-and-libraries.mdx"
22+
23+
- name: Validate OpenAPI Spec, Overlay, and Navigation
24+
run: npx --yes mint@latest validate --no-build --disable unknown-component
25+
26+
- name: Check XDK & Tools Internal Links
27+
run: npx --yes mint@latest broken-links --files "xdks/**" "tools/**" "tools-and-libraries.mdx"

‎.well-known/llms.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
- [X API v2 — Full Index](https://docs.x.com/x-api/llms.txt): 370+ reference pages (Posts, Users, DMs, Lists, Spaces, Streams, Compliance, Webhooks, Media, etc.)
1616
- [Enterprise APIs — Full Index](https://docs.x.com/enterprise-api/llms.txt): Account Activity, X Activity (XAA), Compliance, Chat, Communities, Direct Messages, News, Trends, Webhooks, and historical GNIP/PowerTrack
1717
- [Ads API — Full Index](https://docs.x.com/x-ads-api/llms.txt): Campaign management, creatives, audiences, analytics, lead generation, measurement, and conversions
18-
- [Python SDK (XDK) — Full Index](https://docs.x.com/xdks/python/llms.txt): Complete Python client, models, paginators, and streaming reference
19-
- [TypeScript SDK (XDK) — Full Index](https://docs.x.com/xdks/typescript/llms.txt): Full TypeScript/JavaScript client and 300+ model/interface references
18+
- [SDKs (XDKs) — Full Index](https://docs.x.com/xdks/llms.txt): Official Python, TypeScript, Java, and C# (.NET) SDK clients, guides, and references
19+
- [Python XDK](https://docs.x.com/xdks/python/llms.txt) · [TypeScript XDK](https://docs.x.com/xdks/typescript/llms.txt) · [Java XDK](https://docs.x.com/xdks/java/llms.txt) · [C# XDK](https://docs.x.com/xdks/csharp/llms.txt)
2020

2121
## Key Fundamentals & Tools
2222

‎AGENT.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This document provides guidance for AI agents, coding assistants, and LLM-based
1212
- https://docs.x.com/x-api/llms.txt (X API v2 — 370+ pages)
1313
- https://docs.x.com/enterprise-api/llms.txt
1414
- https://docs.x.com/x-ads-api/llms.txt
15-
- https://docs.x.com/xdks/llms.txt (Python + TypeScript XDKs)
15+
- https://docs.x.com/xdks/llms.txt (Official Python, TypeScript, Java, and C# XDKs)
1616

1717
2. **llms-full.txt** — Complete documentation as a single Markdown file for maximum context:
1818
- https://docs.x.com/llms-full.txt
@@ -33,7 +33,7 @@ This document provides guidance for AI agents, coding assistants, and LLM-based
3333
- **X API v2** (`/x-api/...`): Posts, Users, Direct Messages, Lists, Spaces, Media, Streams (filtered + volume), Compliance, Webhooks, Account Activity, Trends, News, Usage, Connections.
3434
- **Enterprise APIs** (`/enterprise-api/...`): Account Activity (webhooks), X Activity (XAA), GNIP/PowerTrack historical & real-time, Compliance.
3535
- **Ads API** (`/x-ads-api/...`): Campaign Management, Creatives, Audiences, Analytics, Measurement, Catalog, Lead Generation.
36-
- **SDKs (XDKs)** (`/xdks/python/...` and `/xdks/typescript/...`): Official client libraries with full type coverage, pagination, and streaming helpers.
36+
- **SDKs (XDKs)** (`/xdks/overview`, `/xdks/{python,typescript,java,csharp}/...`): Official client libraries in Python, TypeScript, Java, and C# with full type coverage, pagination, and streaming helpers.
3737
- **Fundamentals**: Authentication, rate limits, data dictionary, expansions, fields, pagination, versioning, consistency.
3838
- **AI & Agent Tools** (`/tools/ai`, `/tools/llms-txt`, `/tools/skill-md`, `/tools/mcp`).
3939

@@ -54,7 +54,7 @@ All pages are available in the navigation tree defined in `docs.json`.
5454
- For deep context on the entire platform, load `llms-full.txt`.
5555
- For structured capabilities (what actions are possible), load `skill.md`.
5656
- For live tool calling against the X API, use the MCP server.
57-
- When writing code, prefer the official Python or TypeScript XDKs (full references available in their `llms.txt` files).
57+
- When writing code, prefer the official Python, TypeScript, Java, or C# XDKs (full references available in `/xdks/llms.txt` and per-language `llms.txt` files).
5858

5959
## Do Not
6060

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This document provides guidance for AI agents, coding assistants, and LLM-based
1212
- https://docs.x.com/x-api/llms.txt (X API v2 — 370+ pages)
1313
- https://docs.x.com/enterprise-api/llms.txt
1414
- https://docs.x.com/x-ads-api/llms.txt
15-
- https://docs.x.com/xdks/llms.txt (Python + TypeScript XDKs)
15+
- https://docs.x.com/xdks/llms.txt (Official Python, TypeScript, Java, and C# XDKs)
1616

1717
2. **llms-full.txt** — Complete documentation as a single Markdown file for maximum context:
1818
- https://docs.x.com/llms-full.txt
@@ -33,7 +33,7 @@ This document provides guidance for AI agents, coding assistants, and LLM-based
3333
- **X API v2** (`/x-api/...`): Posts, Users, Direct Messages, Lists, Spaces, Media, Streams (filtered + volume), Compliance, Webhooks, Account Activity, Trends, News, Usage, Connections.
3434
- **Enterprise APIs** (`/enterprise-api/...`): Account Activity (webhooks), X Activity (XAA), GNIP/PowerTrack historical & real-time, Compliance.
3535
- **Ads API** (`/x-ads-api/...`): Campaign Management, Creatives, Audiences, Analytics, Measurement, Catalog, Lead Generation.
36-
- **SDKs (XDKs)** (`/xdks/python/...` and `/xdks/typescript/...`): Official client libraries with full type coverage, pagination, and streaming helpers.
36+
- **SDKs (XDKs)** (`/xdks/overview`, `/xdks/{python,typescript,java,csharp}/...`): Official client libraries in Python, TypeScript, Java, and C# with full type coverage, pagination, and streaming helpers.
3737
- **Fundamentals**: Authentication, rate limits, data dictionary, expansions, fields, pagination, versioning, consistency.
3838
- **AI & Agent Tools** (`/tools/ai`, `/tools/llms-txt`, `/tools/skill-md`, `/tools/mcp`).
3939

@@ -54,7 +54,7 @@ All pages are available in the navigation tree defined in `docs.json`.
5454
- For deep context on the entire platform, load `llms-full.txt`.
5555
- For structured capabilities (what actions are possible), load `skill.md`.
5656
- For live tool calling against the X API, use the MCP server.
57-
- When writing code, prefer the official Python or TypeScript XDKs (full references available in their `llms.txt` files).
57+
- When writing code, prefer the official Python, TypeScript, Java, or C# XDKs (full references available in `/xdks/llms.txt` and per-language `llms.txt` files).
5858

5959
## Do Not
6060

0 commit comments

Comments
 (0)