Skip to main content

ResQ.Storage

PinataOptions Class

Configuration options for the Pinata IPFS client.
public class PinataOptions
Inheritance System.Object → PinataOptions

Example

// Configuration in appsettings.json
{
  "PinataOptions": {
    "ApiUrl": "https://api.pinata.cloud",
    "GatewayUrl": "https://gateway.pinata.cloud/ipfs",
    "JwtToken": "${PINATA_JWT}",
    "MockMode": false,
    "MaxFileSizeBytes": 104857600,
    "TimeoutSeconds": 60
  }
}

// Registration with dependency injection
services.Configure<PinataOptions>(configuration.GetSection("PinataOptions"));

// Or configure in code
services.Configure<PinataOptions>(options =>
{
    options.JwtToken = Environment.GetEnvironmentVariable("PINATA_JWT");
    options.MockMode = false;
});

Remarks

This class provides configuration settings for the Pinata IPFS pinning service, including API endpoints, authentication credentials, and operational parameters. Authentication can be configured using either a JWT token (preferred) or API key/secret pair. If both are provided, the JWT token takes precedence. For development and testing, set MockMode to true to avoid making actual API calls. Configuration can be loaded from appsettings.json, environment variables, or code. Sensitive values like JWT tokens and API secrets should be stored securely (e.g., in environment variables or secret managers) and not committed to source control.
Properties
ApiKeyGets or sets the Pinata API key for authentication.
ApiSecretGets or sets the Pinata API secret for authentication.
ApiUrlGets or sets the Pinata API endpoint URL.
GatewayUrlGets or sets the IPFS gateway URL for retrieving content.
JwtTokenGets or sets the Pinata JWT token for authentication.
MaxFileSizeBytesGets or sets the maximum file size allowed for uploads.
MockModeGets or sets a value indicating whether to use mock mode for testing.
TimeoutSecondsGets or sets the HTTP request timeout in seconds.