TotoySDK 0.0.11

dotnet add package TotoySDK --version 0.0.11                
NuGet\Install-Package TotoySDK -Version 0.0.11                
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="TotoySDK" Version="0.0.11" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TotoySDK --version 0.0.11                
#r "nuget: TotoySDK, 0.0.11"                
#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.
// Install TotoySDK as a Cake Addin
#addin nuget:?package=TotoySDK&version=0.0.11

// Install TotoySDK as a Cake Tool
#tool nuget:?package=TotoySDK&version=0.0.11                

Totoy .NET API library

The official C# library for the Totoy API.

Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or thow an exception. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate type.

Error Object Status Code Content Type
TotoySDK.Models.Errors.Problem 4XX,5XX application/problem+json
TotoySDK.Models.Errors.SDKException 4xx-5xx /

Example

using TotoySDK;
using TotoySDK.Models.Components;
using System.Collections.Generic;
using System;
using TotoySDK.Models.Errors;

var sdk = new Totoy(apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>");

ExplanationRequest req = new ExplanationRequest() {
    OutputLanguage = TotoySDK.Models.Components.OutputLanguage.En,
    SourceId = "<value>",
    Messages = new List<Message>() {
        new Message() {
            Role = TotoySDK.Models.Components.Role.User,
            Content = "<value>",
            References = new List<Reference>() {
                new Reference() {
                    Text = "[R1]",
                    SourceId = "{\"source-id-example\":{\"value\":\"src_dmZ7imKLaPcQnv5ckvGlOEAA7\"}}",
                    PageNumber = 5,
                    Backlink = "https://www.example.com/text.pdf",
                },
            },
        },
    },
};

try
{
    var res = await sdk.Explanation.CreateAsync(req);
    // handle response
}
catch (Exception ex)
{
    if (ex is Problem)
    {
        // handle exception
    }
    else if (ex is TotoySDK.Models.Errors.SDKException)
    {
        // handle exception
    }
}

Server Selection

Select Server by Index

You can override the default server globally by passing a server index to the serverIndex: number optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:

# Server Variables
0 https://api.totoy.ai/v1 None
1 https://dev.api.totoy.ai/v1 None
2 https://0b3f7c7d-220a-4c12-9689-fa29bd0edd80.mock.pstmn.io None

Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the serverUrl: str optional parameter when initializing the SDK client instance. For example:

Authentication

Per-Client Security Schemes

This SDK supports the following security scheme globally:

Name Type Scheme
ApiKeyAuth http HTTP Bearer

To authenticate with the API the ApiKeyAuth parameter must be set when initializing the SDK client instance. For example:

using TotoySDK;
using TotoySDK.Models.Components;
using System.Collections.Generic;

var sdk = new Totoy(apiKeyAuth: "<YOUR_BEARER_TOKEN_HERE>");

ExplanationRequest req = new ExplanationRequest() {
    OutputLanguage = TotoySDK.Models.Components.OutputLanguage.En,
    SourceId = "<value>",
    Messages = new List<Message>() {
        new Message() {
            Role = TotoySDK.Models.Components.Role.User,
            Content = "<value>",
            References = new List<Reference>() {
                new Reference() {
                    Text = "[R1]",
                    SourceId = "{\"source-id-example\":{\"value\":\"src_dmZ7imKLaPcQnv5ckvGlOEAA7\"}}",
                    PageNumber = 5,
                    Backlink = "https://www.example.com/text.pdf",
                },
            },
        },
    },
};

var res = await sdk.Explanation.CreateAsync(req);

// handle response
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.11 1 7/11/2024