Official .NET SDK for Posty5 - A comprehensive toolkit for C# developers to integrate Posty5 services into their applications.
The SDK is split into multiple packages for modularity:
- Posty5.Core - Core HTTP client and base classes
- Posty5.QRCode - QR Code generation and management
- Posty5.ShortLink - URL shortener functionality
- Posty5.HtmlHosting - HTML page hosting
- Posty5.SocialPublisher - Social media publishing tools
Install packages via NuGet Package Manager:
dotnet add package Posty5.Core
dotnet add package Posty5.QRCode
dotnet add package Posty5.ShortLink
dotnet add package Posty5.HtmlHosting
dotnet add package Posty5.SocialPublisherOr via Package Manager Console:
Install-Package Posty5.Core
Install-Package Posty5.QRCode
Install-Package Posty5.ShortLink
Install-Package Posty5.HtmlHosting
Install-Package Posty5.SocialPublisherusing Posty5.Core.Configuration;
using Posty5.Core.Http;
var options = new Posty5Options
{
ApiKey = "your-api-key-here",
Debug = false // Set to true for debugging
};
var httpClient = new Posty5HttpClient(options);using Posty5.QRCode;
using Posty5.QRCode.Models;
var qrCodeClient = new QRCodeClient(httpClient);
// Create a URL QR code
var qrCode = await qrCodeClient.CreateUrlAsync(new CreateUrlQRCodeRequest
{
Name = "My Website",
QrCodeTarget = new UrlQRTarget
{
Url = "https://example.com"
}
});
Console.WriteLine($"QR Code URL: {qrCode.QrCodeLandingPageURL}");
// Create a WiFi QR code
var wifiQr = await qrCodeClient.CreateWifiAsync(new CreateWifiQRCodeRequest
{
Name = "Office WiFi",
QrCodeTarget = new WifiQRTarget
{
Ssid = "MyNetwork",
Password = "mypassword123",
SecurityType = "WPA"
}
});
// List QR codes with pagination
var qrCodes = await qrCodeClient.ListAsync(
new ListQRCodesParams { Search = "website" },
new PaginationParams { PageNumber = 0, PageSize = 20 }
);
// Get a specific QR code
var existingQr = await qrCodeClient.GetAsync("qr-code-id");
// Delete a QR code
await qrCodeClient.DeleteAsync("qr-code-id");using Posty5.ShortLink;
using Posty5.ShortLink.Models;
var shortLinkClient = new ShortLinkClient(httpClient);
// Create a short link
var shortLink = await shortLinkClient.CreateAsync(new CreateShortLinkRequest
{
Name = "My Campaign Link",
TargetUrl = "https://example.com/long-url",
CustomSlug = "my-link" // Optional
});
Console.WriteLine($"Short URL: {shortLink.ShortUrl}");
// List short links
var shortLinks = await shortLinkClient.ListAsync(
new ListShortLinksParams { Search = "campaign" },
new PaginationParams { PageNumber = 0, PageSize = 20 }
);
// Update a short link
var updated = await shortLinkClient.UpdateAsync("link-id", new UpdateShortLinkRequest
{
TargetUrl = "https://example.com/new-url"
});
// Delete a short link
await shortLinkClient.DeleteAsync("link-id");using Posty5.HtmlHosting;
using Posty5.HtmlHosting.Models;
var htmlHostingClient = new HtmlHostingClient(httpClient);
// Create an HTML page
var htmlPage = await htmlHostingClient.CreateAsync(new CreateHtmlHostingRequest
{
Name = "Landing Page",
HtmlContent = "<html><body><h1>Hello World!</h1></body></html>"
});
Console.WriteLine($"Page URL: {htmlPage.PublicUrl}");
// Update HTML content
var updatedPage = await htmlHostingClient.UpdateAsync("page-id", new UpdateHtmlHostingRequest
{
HtmlContent = "<html><body><h1>Updated Content</h1></body></html>"
});
// List HTML pages
var pages = await htmlHostingClient.ListAsync();
// Delete a page
await htmlHostingClient.DeleteAsync("page-id");using Posty5.SocialPublisher;
using Posty5.SocialPublisher.Models;
var workspaceClient = new WorkspaceClient(httpClient);
var postClient = new PostClient(httpClient);
// Create a workspace
var workspace = await workspaceClient.CreateAsync(new CreateWorkspaceRequest
{
Name = "My Social Media Workspace",
Description = "Marketing campaigns"
});
// Create a publishing post
var post = await postClient.CreateAsync(new CreatePostRequest
{
WorkspaceId = workspace.Id!,
Title = "New Product Launch",
Content = "Check out our new product! π",
Platforms = new List<SocialPlatform>
{
SocialPlatform.Facebook,
SocialPlatform.Twitter
},
ScheduledAt = DateTime.UtcNow.AddHours(2)
});
// Publish immediately
await postClient.PublishAsync(post.Id!);
// List posts
var posts = await postClient.ListAsync(
new ListPostsParams
{
WorkspaceId = workspace.Id,
Status = PostStatus.Scheduled
}
);var options = new Posty5Options
{
ApiKey = "your-api-key",
Debug = true
};using Posty5.Core.Exceptions;
try
{
var qrCode = await qrCodeClient.GetAsync("invalid-id");
}
catch (Posty5NotFoundException ex)
{
Console.WriteLine($"Resource not found: {ex.Message}");
}
catch (Posty5AuthenticationException ex)
{
Console.WriteLine($"Authentication failed: {ex.Message}");
}
catch (Posty5ValidationException ex)
{
Console.WriteLine($"Validation error: {ex.Message}");
}
catch (Posty5RateLimitException ex)
{
Console.WriteLine($"Rate limit exceeded: {ex.Message}");
}
catch (Posty5Exception ex)
{
Console.WriteLine($"API error: {ex.Message}, Status: {ex.StatusCode}");
}// In Program.cs or Startup.cs
services.AddSingleton<Posty5Options>(new Posty5Options
{
ApiKey = configuration["Posty5:ApiKey"]
});
services.AddSingleton<Posty5.Core.Http.HttpClient>();
services.AddScoped<QRCodeClient>();
services.AddScoped<ShortLinkClient>();
services.AddScoped<HtmlHostingClient>();
services.AddScoped<WorkspaceClient>();
services.AddScoped<PostClient>();
// In your controller or service
public class MyService
{
private readonly QRCodeClient _qrCodeClient;
public MyService(QRCodeClient qrCodeClient)
{
_qrCodeClient = qrCodeClient;
}
public async Task<QRCodeModel> CreateQRCode()
{
return await _qrCodeClient.CreateUrlAsync(new CreateUrlQRCodeRequest
{
Name = "My QR Code",
QrCodeTarget = new UrlQRTarget { Url = "https://example.com" }
});
}
}For detailed API documentation, visit https://docs.posty5.com
git clone https://github.com/posty5/dotnet-sdk.git
cd posty5-dotnet-sdk
dotnet restore
dotnet builddotnet test- .NET 8.0 or higher
- C# 12.0 or higher
Contributions are welcome! Please feel free to submit a Pull Request.
- Official Guides: https://guide.posty5.com
- API Reference: https://docs.posty5.com
- Source Code: https://github.com/Posty5/dotnet-sdk
This SDK ecosystem contains the following tool packages:
| Package | Description | Version | NuGet |
|---|---|---|---|
| Posty5.Core | Core HTTP client and models | 1.0.0 | π¦ NuGet |
| Posty5.ShortLink | URL shortener client | 1.0.0 | π¦ NuGet |
| Posty5.QRCode | QR code generator client | 1.0.0 | π¦ NuGet |
| Posty5.HtmlHosting | HTML hosting client | 1.0.0 | π¦ NuGet |
| Posty5.HtmlHostingVariables | Variable management | 1.0.0 | π¦ NuGet |
| Posty5.HtmlHostingFormSubmission | Form submission management | 1.0.0 | π¦ NuGet |
| Posty5.SocialPublisherWorkspace | Social workspace management | 1.0.0 | π¦ NuGet |
| Posty5.SocialPublisherPost | Social publishing post client | 1.0.0 | π¦ NuGet |
We're here to help you succeed with Posty5!
- Documentation: https://guide.posty5.com
- Contact Us: https://posty5.com/contact-us
- GitHub Issues: Report bugs or request features
- API Status: Check API status and uptime at https://status.posty5.com
This project is licensed under the MIT License - see the LICENSE file for details.
- Website: https://posty5.com
- API Documentation: https://docs.posty5.com
- GitHub Repository: https://github.com/posty5/dotnet-sdk
- NuGet Gallery: https://www.nuget.org/packages/Posty5.Core
Made with β€οΈ by the Posty5 team