public override NoAPIResponse getResponse() { BrimeAPIResponse response = doRequest(); BrimeAPIError.ThrowException(response); return(new NoAPIResponse(response.Data)); }
public override BrimeEmoteSet getResponse() { BrimeAPIResponse response = doRequest(); BrimeAPIError.ThrowException(response); return(new BrimeEmoteSet(response.Data)); }
} // No parameters public override int getResponse() { BrimeAPIResponse response = doRequest(); BrimeAPIError.ThrowException(response); return(response.Data.Value <int>("total")); }
public override List <BrimeClip> getResponse() { BrimeAPIResponse response = doRequest(); BrimeAPIError.ThrowException(response); JArray?clips = response.Data.Value <JArray>("clips"); if (clips != null) { List <BrimeClip> _result = new List <BrimeClip>(clips.Count); foreach (JToken?clip in clips) { if (clip != null) { _result.Add(new BrimeClip(clip)); } } return(_result); } else { return(new List <BrimeClip>()); } }
public override LivestreamsByCategoryResponse getResponse() { BrimeAPIResponse response = doRequest(); BrimeAPIError.ThrowException(response); return(new LivestreamsByCategoryResponse(response)); }
public override bool getResponse() { BrimeAPIResponse response = doRequest(); try { BrimeAPIError.ThrowException(response); } catch (BrimeAPIInvalidChannel) { return(false); } return(true); }
public override BrimeCategory getResponse() { // Trigger the request and process the JSON response. BrimeAPIResponse response = doRequest(); // Trigger exceptions for any detected errors in the response. BrimeAPIError.ThrowException(response); // Generate the new Category from the response. return(new BrimeCategory(response.Data)); }
public BrimeAPIResponse(string json) { // Process the JSON data JObject apiResponse = JObject.Parse(json); // Identify whether there is an actual API response, or just load empty data response if none present. JObject?data = apiResponse.Value <JObject>("data"); if (data == null) { Logger.Warn("Missing 'data' in JSON response"); Data = JObject.Parse("{}"); } else { Data = data; } // Identify whether there are any API errors. JArray?apiErrors = apiResponse.Value <JArray>("errors"); if (apiErrors != null) { Errors = new List <BrimeAPIError>(apiErrors.Count); foreach (JToken err in apiErrors) { string?eMessage = err.ToObject <string>(); if (eMessage == null) { Logger.Error("Unable to decode error in response"); throw new BrimeAPIMalformedResponse("Unable to decode error in response"); } Errors.Add(BrimeAPIError.lookupError(eMessage)); } } else { // No errors detected in response data Errors = new List <BrimeAPIError>(); } // Log a warning if any error identified. Logger.Warn(() => { return(String.Join <BrimeAPIError>(", ", Errors)); }); // Identify whether there is any Notice in the API response. By default this will be logged. string?notice = apiResponse.Value <string>("__notice"); __Notice = (notice == null) ? "" : notice; if (!string.IsNullOrWhiteSpace(__Notice)) { Logger.Info(() => { return("API-NOTICE: " + __Notice); }); } }
public GlobalEmotesResponse(BrimeAPIResponse apiResponse) { BrimeAPIError.ThrowException(apiResponse); try { JArray?emoteSets = apiResponse.Data.Value <JArray>("emoteSets"); GlobalEmoteSets = new List <BrimeEmoteSet>((emoteSets == null) ? 0 : emoteSets.Count); if (emoteSets != null) { foreach (JToken set in emoteSets) { GlobalEmoteSets.Add(new BrimeEmoteSet(set)); } } } catch (Exception e) { throw new BrimeAPIMalformedResponse(e.ToString()); } }
public override List <BrimeStream> getResponse() { BrimeAPIResponse response = doRequest(); BrimeAPIError.ThrowException(response); List <BrimeStream> _result; JArray? streams = response.Data.Value <JArray>("streams"); if (streams != null) { _result = new List <BrimeStream>(streams.Count); foreach (JToken item in streams) { _result.Add(new BrimeStream(item)); } } else { _result = new List <BrimeStream>(); } return(_result); }
public override List <LivestreamsByCategoryResponse> getResponse() { BrimeAPIResponse response = doRequest(); BrimeAPIError.ThrowException(response); JArray?items = response.Data.Value <JArray>("categories"); if (items != null) { List <LivestreamsByCategoryResponse> _result = new List <LivestreamsByCategoryResponse>(items.Count); foreach (JToken item in items) { if (item != null) { _result.Add(new LivestreamsByCategoryResponse(item)); } } return(_result); } else { return(new List <LivestreamsByCategoryResponse>()); } }
public BrimeAPIInternalError(BrimeAPIError error) : base(error) { }
public BrimeAPIRateLimitExceeded(BrimeAPIError error) : base(error) { }
public BrimeAPIInvalidChannel(BrimeAPIError error) : base(error) { }
public BrimeAPIMissingScope(BrimeAPIError error) : base(error) { }
public BrimeAPINotImplemented(BrimeAPIError error) : base(error) { }
public BrimeAPIInvalidClientID(BrimeAPIError error) : base(error) { }
public BrimeAPIMissingAccess(BrimeAPIError apiError) : base(apiError) { }
public BrimeAPIMissingParameter(BrimeAPIError error) : base(error) { }