Posty5.Core 2.0.0

dotnet add package Posty5.Core --version 2.0.0
                    
NuGet\Install-Package Posty5.Core -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Posty5.Core" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Posty5.Core" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Posty5.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Posty5.Core --version 2.0.0
                    
#r "nuget: Posty5.Core, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Posty5.Core@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Posty5.Core&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Posty5.Core&version=2.0.0
                    
Install as a Cake Tool

Posty5.Core

Core HTTP client and utilities for the Posty5 .NET SDK ecosystem. This package provides the foundational infrastructure that powers all other Posty5 SDK modules.


🌟 What is Posty5?

Posty5 is a comprehensive suite of free online tools designed to enhance your digital marketing and social media presence. With over 4+ powerful tools and counting, Posty5 provides everything you need to:

  • πŸ”— Shorten URLs - Create memorable, trackable short links
  • πŸ“± Generate QR Codes - Transform URLs, WiFi credentials, contact cards, and more into scannable codes
  • 🌐 Host HTML Pages - Deploy static HTML pages with dynamic variables and form submission handling
  • πŸ“’ Automate Social Media - Schedule and manage social media posts across multiple platforms
  • πŸ“Š Track Performance - Monitor and analyze your digital marketing efforts

Posty5 empowers businesses, marketers, and developers to streamline their online workflowsβ€”all from a unified control panel.

Learn more: https://posty5.com


πŸ“¦ About This Package

Posty5.Core is the foundation package for the entire Posty5 .NET SDK ecosystem. It provides:

  • HTTP Client - System.Net.Http-based client with built-in retry logic using Polly
  • Authentication - API key management for secure API communication
  • Error Handling - Typed exception classes for robust error management
  • Type Definitions - Full C# type support with comprehensive models
  • Configuration - Flexible configuration options with dependency injection support
  • .NET 8.0 Support - Built with the latest .NET features

Role in the Posty5 Ecosystem

This package serves as the core dependency for all Posty5 SDK modules. It handles:

  • API authentication and request management
  • Network communication with the Posty5 API
  • Standardized error handling across all SDK packages
  • Retry logic with exponential backoff for transient failures

πŸ“₯ Installation

Install via NuGet Package Manager:

dotnet add package Posty5.Core

Or via Package Manager Console:

Install-Package Posty5.Core

⚠️ Important: Not a Standalone Package

This package is NOT designed to work as a standalone solution.

Posty5.Core provides the foundational infrastructure and utilities that other Posty5 SDK packages depend on. While it can be used directly for low-level API interactions, it is primarily intended to be used in combination with other Posty5 tool packages such as:

  • Posty5.ShortLink - For URL shortening
  • Posty5.QRCode - For QR code generation
  • Posty5.HtmlHosting - For HTML page hosting
  • Posty5.SocialPublisher - For social media workspace and task management

For most use cases, you should install the specific tool package you need, which will automatically include Posty5.Core as a dependency.


🎯 Why This Package Matters

The Value of Posty5.Core

  1. Unified API Communication

    • Provides a single, consistent HTTP client for all Posty5 SDK packages
    • Eliminates the need for each package to implement its own API communication layer
  2. Automatic Retry Logic

    • Built-in retry mechanism using Polly for transient network failures
    • Configurable retry policies with exponential backoff
  3. Type Safety

    • Strong typing with C# generics for all API responses
    • Nullable reference types enabled for compile-time null safety
  4. Error Handling

    • Custom exception hierarchy for specific error scenarios
    • Detailed error messages with HTTP status codes
  5. Performance

    • Efficient JSON serialization with System.Text.Json
    • Connection pooling and HTTP/2 support

πŸš€ Quick Start

Basic Usage

using Posty5.Core.Configuration;
using Posty5.Core.Http;

// Initialize the HTTP client with your API key
var options = new Posty5Options
{
    ApiKey = "your-api-key", // Get from https://studio.posty5.com/account/settings?tab=APIKeys
    Debug = false // Set to true for debugging
};

var httpClient = new Posty5HttpClient(options);

// The client is now ready to be used by other Posty5 packages

With Dependency Injection

using Microsoft.Extensions.DependencyInjection;
using Posty5.Core.Configuration;
using Posty5.Core.Http;

var services = new ServiceCollection();

// Register Posty5 HTTP client
services.AddSingleton(sp =>
{
    var options = new Posty5Options
    {
        ApiKey = Environment.GetEnvironmentVariable("POSTY5_API_KEY") ?? "",
    };
    return new Posty5HttpClient(options);
});

var serviceProvider = services.BuildServiceProvider();
var httpClient = serviceProvider.GetRequiredService<Posty5HttpClient>();

πŸ“– Configuration Options

Posty5Options

Property Type Default Description
ApiKey string "" Your Posty5 API key (required)
Debug bool false Enable debug logging

πŸ”’ Error Handling

The package includes a comprehensive exception hierarchy:

Exception Types

  • Posty5Exception - Base exception for all Posty5 errors
  • Posty5AuthenticationException - Authentication failures (401)
  • Posty5NotFoundException - Resource not found (404)
  • Posty5ValidationException - Validation errors (400)
  • Posty5RateLimitException - Rate limit exceeded (429)

Example

using Posty5.Core.Exceptions;

try
{
    var response = await httpClient.GetAsync<MyModel>("/api/endpoint");
    var result = response.Result;
}
catch (Posty5AuthenticationException ex)
{
    Console.WriteLine("Authentication failed: " + ex.Message);
}
catch (Posty5NotFoundException ex)
{
    Console.WriteLine("Resource not found: " + ex.Message);
}
catch (Posty5Exception ex)
{
    Console.WriteLine($"API error: {ex.Message} (Status: {ex.StatusCode})");
}

πŸ“š API Reference

Posty5HttpClient

The main HTTP client for making API requests.

Methods

GetAsync<T>(string path, Dictionary<string, object?>? queryParams, CancellationToken cancellationToken)

  • Performs a GET request
  • Returns ApiResponse<T> with the result

PostAsync<T>(string path, object? body, CancellationToken cancellationToken)

  • Performs a POST request
  • Returns ApiResponse<T> with the result

PutAsync<T>(string path, object? body, CancellationToken cancellationToken)

  • Performs a PUT request
  • Returns ApiResponse<T> with the result

DeleteAsync(string path, CancellationToken cancellationToken)

  • Performs a DELETE request
  • Returns bool indicating success

SetApiKey(string apiKey)

  • Updates the API key for subsequent requests

πŸ”§ Advanced Usage

Custom Retry Policy

The client uses Polly for retry logic with the following defaults:

  • Maximum 3 retry attempts
  • Exponential backoff: 2^attempt seconds
  • Retries on 408, 429, 500, 502, 503, 504 status codes

Debug Logging

Enable debug logging to see request/response details:

var options = new Posty5Options
{
    ApiKey = "your-api-key",
    Debug = true // Logs to Console
};

πŸ“– Resources


πŸ“¦ Packages

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.SocialPublisherTask Social publishing task client 1.0.0 πŸ“¦ NuGet

πŸ†˜ Support

We're here to help you succeed with Posty5!

Get Help


πŸ“„ License

MIT License - see LICENSE file for details.



Made with ❀️ by the Posty5 Team

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (8)

Showing the top 5 NuGet packages that depend on Posty5.Core:

Package Downloads
Posty5.QRCode

QR Code management client for Posty5 .NET SDK - Create and manage dynamic QR codes for email, WiFi, phone calls, SMS, URLs, and geolocation

Posty5.ShortLink

Short Link management client for Posty5 .NET SDK

Posty5.HtmlHosting

HTML Hosting management client for Posty5 .NET SDK

Posty5.SocialPublisher

Social Publisher Task and Workspace management client for Posty5 .NET SDK

Posty5.HtmlHostingVariables

HTML Hosting Variables management client for Posty5 .NET SDK - manage environment variables for hosted HTML pages

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 205 2/1/2026
1.0.0 158 1/21/2026