Skip to content

About

Official C# (.NET 8) SDK for the X API v2

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

XDK C# / .NET SDK

Official C# / .NET SDK for the X API v2 (.NET 8+, zero external runtime dependencies).

Installation

dotnet add package XDevPlatform.Xdk --version 0.2.0

Quick Start

using Xdk;
using Xdk.Models;

var client = new XClient(new XClientOptions
{
    BearerToken = Environment.GetEnvironmentVariable("X_BEARER_TOKEN")
});

var response = await client.Users.GetByUsernameAsync("XDevelopers");
Console.WriteLine(response.Data);

Authentication

  • Bearer Token (App-Only): new XClient(new XClientOptions { BearerToken = "..." })
  • OAuth 2.0 PKCE & Refresh: OAuth2Pkce + new XClient(new XClientOptions { OAuth2 = oauth2 })
  • OAuth 1.0a User Context: OAuth1 + new XClient(new XClientOptions { OAuth1 = oauth1 })

Pagination & Streaming

  • Paginated endpoints expose *Pages(...) returning Paginator<T> (IAsyncEnumerable<T>), enabling await foreach (var page in client.Users.GetFollowersPages(id)).
  • Streaming endpoints return EventStream<T> (IAsyncEnumerable<T> and IAsyncDisposable) with incremental UTF-8 line decoding and exponential backoff reconnection.

Examples & Continuous Canary

  • Runnable Use-Case Examples: See examples/Xdk.Examples/ for end-to-end runnable workflows covering Posts, Search, Users, Bookmarks, Filtered & Sample Streaming, Chunked Media Upload, Direct Messages & XChat, Lists, Spaces, Communities, Community Notes, Trends, News, Webhooks, Compliance, Usage, and OAuth 1.0a / 2.0 PKCE.
  • Continuous Canary Runner: Run dotnet run --project examples/Xdk.Examples -- --canary --once (or --canary --daemon --port 8791 for an always-on /health, /status, and /metrics probe server against the built-in X API simulator or live X_BEARER_TOKEN).

About

Official C# (.NET 8) SDK for the X API v2

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages