Skip to content

Replace samples with examples and add ASP.NET Core project - #8

Open
rohit-fastpix wants to merge 2 commits into
mainfrom
feature/examples
Open

Replace samples with examples and add ASP.NET Core project#8
rohit-fastpix wants to merge 2 commits into
mainfrom
feature/examples

Conversation

@rohit-fastpix

Copy link
Copy Markdown
Collaborator

FastPix C# SDK - Documentation PR

Documentation Changes

What Changed

  • New documentation added
  • Existing documentation updated
  • Documentation errors fixed
  • Code examples updated
  • Links and references updated
  • Other — renamed samples/examples/, added a runnable ASP.NET Core project

Files Modified

  • README.md
  • docs/ files
  • USAGE.md
  • CONTRIBUTING.md
  • Other: examples/ (new folder, replaces samples/) — example programs, AspNetCore/ project, README.md, .env.example, .gitignore

Summary

Brief description of changes:

Replaced the old samples/ folder with a runnable examples/ project. The previous
samples referenced an API that doesn't exist (FastPix.Builder(), Security.AccessToken,
client.Videos.Upload) and wouldn't compile. Every example is rewritten against the
real SDK and run via `dotnet run -- <name>`:

  create-upload, verify-webhook (offline), sdk-init, video-management,
  playback, live-streaming, ai-features, playlist, error-handling

Added examples/AspNetCore/ — a minimal web integration with two endpoints:
POST /uploads (mints a signed upload URL) and POST /webhooks (verifies the
FastPix-Signature on the raw body, then dispatches the event). Each area has a
README, .env.example, and env-var-based credentials (no secrets in code).

Code Examples (if Applicable)

// Construct the client, then mint a signed direct-upload URL.
// The client PUTs the file straight to that URL — bytes never touch your server.
using Fastpix;
using Fastpix.Models.Components;
using Fastpix.Models.Requests;

var sdk = new FastpixSDK(security: new Security
{
    Username = Environment.GetEnvironmentVariable("FASTPIX_USERNAME"),
    Password = Environment.GetEnvironmentVariable("FASTPIX_PASSWORD"),
});

var res = await sdk.InputVideo.UploadAsync(new DirectUploadVideoMediaRequest
{
    CorsOrigin = "*", // tighten for production
    PushMediaSettings = new PushMediaSettings(),
});

var upload = res.Object?.Data;
Console.WriteLine($"uploadId: {upload?.UploadId}");
Console.WriteLine($"url:      {upload?.Url}");

Testing

  • All code examples tested — built with 0 warnings; live-verified against api.fastpix.com. Real end-to-end upload confirmed (mint URL → PUT a 42,953-byte mp4 → HTTP 200, x-goog-stored-content-length: 42953) for both the CLI example and the ASP.NET /uploads endpoint.
  • Links verified
  • Grammar checked
  • Formatting consistent

Review Checklist

  • Content is accurate
  • Code examples work
  • Links are working
  • Grammar is correct
  • Formatting is consistent

Ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants