Table of Contents

Interface IApiDataSerializer

Namespace
Tudormobile.OpenTrivia
Assembly
Tudormobile.OpenTrivia.dll

Defines methods for deserializing API responses from the Open Trivia Database.

public interface IApiDataSerializer

Methods

DeserializeSessionToken(JsonDocument)

Deserializes a session token from a JSON document.

ApiSessionToken DeserializeSessionToken(JsonDocument document)

Parameters

document JsonDocument

The JSON document containing the session token data.

Returns

ApiSessionToken

An ApiSessionToken object parsed from the response.

DeserializeTriviaCategories(JsonDocument)

Deserializes a collection of trivia categories from a JSON document.

List<TriviaCategory> DeserializeTriviaCategories(JsonDocument document)

Parameters

document JsonDocument

The JSON document containing the trivia categories data.

Returns

List<TriviaCategory>

A list of TriviaCategory objects parsed from the response.

DeserializeTriviaQuestionCount(JsonDocument)

Deserializes the count of trivia questions from a JSON document.

TriviaQuestionCount DeserializeTriviaQuestionCount(JsonDocument document)

Parameters

document JsonDocument

The JSON document containing the trivia questions count data.

Returns

TriviaQuestionCount

A TriviaQuestionCount object parsed from the response.

DeserializeTriviaQuestions(JsonDocument, ApiEncodingType?)

Deserializes a collection of trivia questions from a JSON document.

List<TriviaQuestion> DeserializeTriviaQuestions(JsonDocument document, ApiEncodingType? decodingType = null)

Parameters

document JsonDocument

The JSON document containing the trivia questions data.

decodingType ApiEncodingType?

The optional encoding type to use for decoding the trivia questions.

Returns

List<TriviaQuestion>

A list of TriviaQuestion objects parsed from the response.

GetResponseCode(JsonDocument)

Extracts the response code from an API response JSON document.

ApiResponseCode GetResponseCode(JsonDocument document)

Parameters

document JsonDocument

The JSON document containing the API response.

Returns

ApiResponseCode

The ApiResponseCode indicating the result of the API request.