Skip to content

Official C# client library for 42videobricks API.

Notifications You must be signed in to change notification settings

42videobricks/42videobricks-csharp-client

Repository files navigation

Api42Vb - the C# library for the 42videobricks

42videobricks is a Video Platform As A Service (VPaaS)

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: 1.2
  • SDK version: 1.2.0
  • Build package: org.openapitools.codegen.languages.CSharpClientCodegen

Frameworks supported

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package System.ComponentModel.Annotations

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Run the following command to generate the DLL

  • [Mac/Linux] /bin/sh build.sh
  • [Windows] build.bat

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using Api42Vb.Api;
using Api42Vb.Client;
using Api42Vb.Model;

Packaging

A .nuspec is included with the project. You can follow the Nuget quickstart to create and publish packages.

This .nuspec uses placeholders from the .csproj, so build the .csproj directly:

nuget pack -Build -OutputDirectory out Api42Vb.csproj

Then, publish to a local feed or other host and consume the new package via Nuget as usual.

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using Api42Vb.Api;
using Api42Vb.Client;
using Api42Vb.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api-sbx.42videobricks.com";
            // Configure API key authorization: api_key
            config.ApiKey.Add("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("x-api-key", "Bearer");

            var apiInstance = new DataApi(config);
            var limit = 56;  // int? | Number of elements to return (default=10) (optional) 
            var offset = 56;  // int? | offset for pagination (optional) 
            var interval = {{interval}};  // string? | Period unit (day|week|month) (optional) 
            var startDate = {{starDate}};  // string? | Start date for the period (optional) 
            var endDate = {{endDate}};  // string? | End date for the period (optional) 

            try
            {
                // List Video Usage KPIs
                DataVideoUsageList result = apiInstance.GetDataVideoUsage(limit, offset, interval, startDate, endDate);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling DataApi.GetDataVideoUsage: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api-sbx.42videobricks.com

Class Method HTTP request Description
DataApi GetDataVideoUsage GET /data/videos/usage List Video Usage KPIs
PlaylistsApi AddPlaylist POST /playlists Add a new playlist
PlaylistsApi DeletePlaylistById DELETE /playlists/{playlistId} Delete a playlist
PlaylistsApi GetPlaylistById GET /playlists/{playlistId} Retun a single playlist
PlaylistsApi GetPlaylists GET /playlists List playlists
PlaylistsApi UpdatePlaylistById PUT /playlists/{playlistId} Update an existing playlist
TagsApi GetTags GET /tags List Video Tags
VideosApi AddAttachmentByVideoId POST /videos/{videoId}/attachments/{attachmentType}/{locale} Upload an attachement
VideosApi AddThumbnailByVideoId POST /videos/{videoId}/thumbnail Upload a thumbnail
VideosApi AddVideo POST /videos Add a new video
VideosApi DeleteAttachmentByVideoId DELETE /videos/{videoId}/attachments/{attachmentType}/{locale} Delete an attachment
VideosApi DeleteThumbnailByVideoId DELETE /videos/{videoId}/thumbnail Delete a thumbnail
VideosApi DeleteVideoById DELETE /videos/{videoId} Delete a video
VideosApi FinalizeMultipartUploadVideoById POST /videos/{videoId}/multipart-upload/finalize Multipart upload finalization
VideosApi FinalizeUploadVideoById PUT /videos/{videoId}/upload/finalize Single file upload finalization
VideosApi GetAttachmentByVideoId GET /videos/{videoId}/attachments/{attachmentType}/{locale} Get the attachment
VideosApi GetAttachmentFileByVideoId GET /videos/{videoId}/attachments/{attachmentType}/{locale}/file Get attachement file
VideosApi GetAttachmentsByVideoId GET /videos/{videoId}/attachments List of attachments
VideosApi GetVideoById GET /videos/{videoId} Retun a single video
VideosApi GetVideoStatusById GET /videos/{videoId}/status Retun the detailed status of the video
VideosApi GetVideos GET /videos List videos
VideosApi InitMultipartUploadVideoById POST /videos/{videoId}/multipart-upload/init Multipart upload intialization
VideosApi InitUploadVideoById GET /videos/{videoId}/upload/init Single file upload intialization
VideosApi UpdateVideoById PUT /videos/{videoId} Update an existing video
WebhooksApi AddWebhook POST /webhooks Add a new webhook
WebhooksApi DeleteWebhookById DELETE /webhooks/{webhookId} Delete a webhook
WebhooksApi GetWebhookById GET /webhooks/{webhookId} Retun a single webhook
WebhooksApi GetWebhooks GET /webhooks List webhooks
WebhooksApi UpdateWebhookById PUT /webhooks/{webhookId} Update an existing webhook

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

api_key

  • Type: API key
  • API key parameter name: x-api-key
  • Location: HTTP header

About

Official C# client library for 42videobricks API.

Resources

Stars

Watchers

Forks

Packages

No packages published