Code Monkey home page Code Monkey logo

assemblyai-csharp-sdk's Introduction

WIP! AssemblyAI C# SDK

NuGet fern shield GitHub License AssemblyAI Twitter AssemblyAI YouTube Discord

Warning

We are actively working on the .NET SDK for AssemblyAI. Watch the C# SDK repo, specifically the releases, so you get notified when we have our first release.

Screenshot 2024-01-25 at 2 27 59 PM

The official AssemblyAI C# library, supporting .NET Standard 3.0+, .NET Core 3.0+, and .NET Framework 4.6.1+.

Documentation

API reference documentation is available here.

Installation

Using the .NET Core command-line interface (CLI) tools:

dotnet add package AssemblyAI.Client

Using the NuGet Command Line Interface (CLI):

nuget install AssemblyAI.Client

Using the Package Manager Console:

Install-Package AssemblyAI.Client

Usage

Instantiate the SDK using the AssemblyAI class. Note that all of the SDK methods are awaitable!

  using AssemblyaAI;

  AssemblyAI aai = new AssemblyAI("YOUR_API_KEY")
  TranscriptResponse transcript = 
      await aai.Transcript.get("transcript_id");
  System.Console.WriteLine("Received transcript!", transcript);

HTTP Client

You can override the HttpClient by passing in ClientOptions.

aai = new AssemblyAI("YOUR_API_KEY", new ClientOptions{
    HttpClient = ... // Override the Http Client
    BaseURL = ... // Override the Base URL
})

Exception Handling

When the API returns a non-zero status code, (4xx or 5xx response), a subclass of AssemblyAIException will be thrown:

try {
  aai.transcript.create(...);    
} catch (AssemblyAIException e) {
  System.Console.WriteLine(e.Message) 
  System.Console.WriteLine(e.StatusCode) 
}

Retries

409 Conflict, 429 Rate Limit, and >=500 Internal errors will all be retried twice with exponential backoff. You can override this behavior globally or per-request.

var aai = new AssemblyAI("...", new ClientOptions{
    MaxRetries = 1 // Only retry once
});
aai.transcript.create(new TranscriptCreateParams{ ... }, new RequestOptions {
    MaxRetries = 0 // Disable retries
});

Timeouts

The SDK defaults to a 60s timeout. You can override this behaviour globally or per-request.

var aai = new AssemblyAI("...", new ClientOptions{
    TimeoutInSeconds = 20 // Lower timeout
});
aai.transcript.create(new TranscriptCreateParams{ ... }, new RequestOptions {
    TimeoutInSeconds = 90 // Raise timeout
});

Contributing

While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

assemblyai-csharp-sdk's People

Contributors

swimburger avatar dsinghvi avatar fern-api[bot] avatar

Stargazers

Egor Fedorov avatar Wiesław Šoltés avatar Ranjan Dailata avatar  avatar

Watchers

Ranjan Dailata avatar  avatar Dylan Fox avatar Michael Nguyen avatar  avatar  avatar

Forkers

dsinghvi

assemblyai-csharp-sdk's Issues

Clean up of bin, obj

  • Please do no check-in bin, obj
  • Have a .gitignore file and remove unwanted things

Detailed Documentation

Please come up with the detailed documentation explaining the end to end aspects of the library with the code samples.

Samples, Demo Apps

Please plan on coming up with a ton of code samples. It could be a console, winform, web etc. Having an end to end sample makes more sense for the consumers.

SessionBegins issues

  • JSON prop name sessionId should be session_id
  • JSON prop name expiresAt should be expires_at
  • ExpiresAt should be a DateTime

Unit, Integration Tests

Please plan on writing a ton of unit and integration tests. Hence, benefits you and the developers to deep dive and test the functionalities.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.