Class JsonApiDocument
Represents a JSON API Document returned from a JSON API REST endpoint.
public class JsonApiDocument : JsonObject, ICloneable
- Inheritance
-
JsonApiDocument
- Implements
- Inherited Members
Constructors
JsonApiDocument(IJsonApiObjectFactory)
public JsonApiDocument(IJsonApiObjectFactory aObjectFactory)
Parameters
aObjectFactory
IJsonApiObjectFactoryOptional object factory that will be used the create the resource objects that may be contained in this document. If this is
null
, then a plain JsonObject will be used for resource objects.
Properties
DataAsArray
Provides the JSON API document data as a JSON array.
public JsonApiResourceObject[] DataAsArray { get; }
Property Value
Remarks
If the actual JSON API document data is a JSON array, then this property provides
that array data. If the actual JSON API document data is a single JSON object, then
this property returns an array containing that single object. In all other cases an
empty array is returned.
null
.
DataAsObject
If the JSON API document data is represented as single JSON object, then this property provides that object.
public JsonApiResourceObject DataAsObject { get; }
Property Value
Remarks
If the JSON API document data is a JSON array, then this property is null
.
DataCount
Returns the number of resource objects provided through the "data" field.
public int DataCount { get; }
Property Value
Errors
public JsonApiErrorObjects Errors { get; }
Property Value
Included
public JsonApiResourceObjects Included { get; }
Property Value
JsonApi
public JsonApiVersionObject JsonApi { get; }
Property Value
Meta
public JsonObject Meta { get; }
Property Value
Version
Provides the JSON API version from the JsonApi object.
public string Version { get; }
Property Value
Remarks
If there is no JsonApi object, then the default "1.0" is returned.
Methods
FindIncluded(string, string)
public JsonApiResourceObject FindIncluded(string sType, string sId)
Parameters
Returns
OnCreateChildArray(string)
protected override JsonArray OnCreateChildArray(string sFieldName)
Parameters
sFieldName
string
Returns
OnCreateChildObject(string)
protected override JsonObject OnCreateChildObject(string sFieldName)
Parameters
sFieldName
string
Returns
Remarks
The default implementation creates a JsonApiResourceObject for the "data" object. An override may create a more specialized type derived from JsonApiResourceObject.
The default implementation creates a plain JsonObject for the "meta" object. An override may create a more spezialized type.