BoxCastAPIWrapper 1.0.3
dotnet add package BoxCastAPIWrapper --version 1.0.3
NuGet\Install-Package BoxCastAPIWrapper -Version 1.0.3
<PackageReference Include="BoxCastAPIWrapper" Version="1.0.3" />
paket add BoxCastAPIWrapper --version 1.0.3
#r "nuget: BoxCastAPIWrapper, 1.0.3"
// Install BoxCastAPIWrapper as a Cake Addin
#addin nuget:?package=BoxCastAPIWrapper&version=1.0.3
// Install BoxCastAPIWrapper as a Cake Tool
#tool nuget:?package=BoxCastAPIWrapper&version=1.0.3
BoxCast .NET API Wrapper
Basic Use
Authentication
//supply API credentials to the API wrapper
BoxCast.SetAPICredentials(clientId, secret);
//authenticate using the oAuth password flow
await BoxCast.Authenticate(username, password);
Get a Single Resource
// Create a request to send to the API
var request = new BoxCastRequest()
{
Resource = "account"
};
// Request the resource from the API
BoxCastResponse<Dictionary<string, object>> account;
account = await BoxCast.Get<Dictionary<string, object>>(request);
Get a List of Resources
// Create a request to send to the API
var request = new BoxCastRequest()
{
Resource = "broadcasts"
};
// Request the resources from the API
BoxCastResponse<List<Dictionary<string, object>>> broadcasts;
broadcasts = await BoxCast.Get<List<Dictionary<string, object>>>(request);
Request Parameters
var request = new BoxCastRequest()
{
Resource = "broadcasts"
Search = "timeframe:future",
SortBy = "starts_at",
SortDescending = true,
PageNumber = 1,
PageSizeLimit = 5,
ETag = entityTag
};
//add undocumented or expanded query parameters
request.QueryParameters.Add("since", "2018-02-03T00:00:00-05:00");
request.QueryParameters.Add("until", "2018-02-04T00:00:00-05:00");
Create a Resource
var content = new Dictionary<string, object>();
BoxCastResponse<Dictionary<string, object>> response;
response = await BoxCast.Post("Broadcasts/" + broadcastId, content);
Update a Resource
var content = new Dictionary<string, object>();
BoxCastResponse<Dictionary<string, object>> response;
response = await BoxCast.Put("Broadcasts/" + broadcastId, content);
Delete a Resource
await BoxCast.Delete("Broadcasts/" + broadcastId);
API Responses
Responses returned from the api come as a BoxCastResponse<T>
object with the following information:
ETag - an entity tag returned from the api for making conditional requests using the ETag field on requests Pagination - an object containing pagination data
- First
- Previous
- Next
- Last
- Total
RateLimit - an object containing rate limit related data
- Limit
- Remaining
- Reset
Headers - a dictionary of all headers returned with the response
ResponseCode - the HTTP response code returned
ResponsePhrase - the response phrase returned
Content - the content returned deserialized into the supplied type for the generic response
Error Handling
try
{
if(!BoxCast.HasToken)
{
await BoxCast.Authenticate(username, password);
}
// Do some things...
}
catch(BoxCastAPIException ex)
{
if (ex.BoxCastError.Content.Error == "invalid_token" || ex.BoxCastError.Content.Error == "unauthorized")
{
BoxCast.ClearToken(); //clear the oAuth token so we'll grab a new one next time.
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 11.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Added client credentials OAuth flow