![]() |
Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
|
Helper class for json schema service descriptor based service descriptions for the json rpc API. More...
#include <JSONServiceDescription.h>
Static Public Member Functions | |
static bool | AddType (const std::string &jsonType) |
Parses the given json schema description and evaluates and stores the defined type. | |
static bool | AddMethod (const std::string &jsonMethod, MethodCall method) |
Parses the given json schema description and evaluates and stores the defined method. | |
static bool | AddBuiltinMethod (const std::string &jsonMethod) |
Parses the given json schema description and evaluates and stores the defined builtin method. | |
static bool | AddNotification (const std::string &jsonNotification) |
Parses the given json schema description and evaluates and stores the defined notification. | |
static bool | AddEnum (const std::string &name, const std::vector< CVariant > &values, CVariant::VariantType type=CVariant::VariantTypeNull, const CVariant &defaultValue=CVariant::ConstNullVariant) |
static bool | AddEnum (const std::string &name, const std::vector< std::string > &values) |
static bool | AddEnum (const std::string &name, const std::vector< int > &values) |
static const char * | GetVersion () |
Gets the version of the json schema description. | |
static JSONRPC_STATUS | Print (CVariant &result, ITransportLayer *transport, IClient *client, bool printDescriptions=true, bool printMetadata=false, bool filterByTransport=true, const std::string &filterByName="", const std::string &filterByType="", bool printReferences=true) |
Prints the json schema description into the given result object. | |
static JSONRPC_STATUS | CheckCall (const char *method, const CVariant &requestParameters, ITransportLayer *transport, IClient *client, bool notification, MethodCall &methodCall, CVariant &outputParameters) |
Checks the given parameters from the request against the json schema description for the given method. | |
static JSONSchemaTypeDefinitionPtr | GetType (const std::string &identification) |
static void | ResolveReferences () |
static void | Cleanup () |
![]() | |
static void | MillisecondsToTimeObject (int time, CVariant &result) |
Friends | |
class | JSONSchemaTypeDefinition |
class | JsonRpcMethod |
Additional Inherited Members | |
![]() | |
static void | HandleLimits (const CVariant ¶meterObject, CVariant &result, int size, int &start, int &end) |
static bool | ParseSorting (const CVariant ¶meterObject, SortBy &sortBy, SortOrder &sortOrder, SortAttribute &sortAttributes) |
static void | ParseLimits (const CVariant ¶meterObject, int &limitStart, int &limitEnd) |
static bool | ParameterExists (const CVariant ¶meterObject, const std::string &key, unsigned int position) |
Checks if the given object contains a parameter. | |
static bool | IsValueMember (const CVariant &value, const std::string &key) |
Checks if the given object contains a value with the given key. | |
static CVariant | GetParameter (const CVariant ¶meterObject, const std::string &key, unsigned int position) |
Returns the json value of a parameter. | |
static CVariant | GetParameter (const CVariant ¶meterObject, const std::string &key, unsigned int position, const CVariant &fallback) |
Returns the json value of a parameter or the given default value. | |
static std::string | GetString (const CVariant &value, const char *defaultValue) |
Returns the given json value as a string. | |
static TransportLayerCapability | StringToTransportLayer (const std::string &transport) |
Returns a TransportLayerCapability value of the given string representation. | |
static JSONSchemaType | StringToSchemaValueType (const std::string &valueType) |
Returns a JSONSchemaType value for the given string representation. | |
static std::string | SchemaValueTypeToString (JSONSchemaType valueType) |
Returns a string representation for the given JSONSchemaType. | |
static void | SchemaValueTypeToJson (JSONSchemaType valueType, CVariant &jsonObject) |
Converts the given json schema type into a json object. | |
static const char * | ValueTypeToString (CVariant::VariantType valueType) |
static bool | IsParameterType (const CVariant ¶meterObject, const char *key, unsigned int position, JSONSchemaType valueType) |
Checks if the parameter with the given name or at the given position is of a certain type. | |
static bool | IsType (const CVariant &value, JSONSchemaType valueType) |
Checks if the given json value is of the given type. | |
static void | SetDefaultValue (CVariant &value, JSONSchemaType valueType) |
Sets the value of the given json value to the default value of the given type. | |
static bool | HasType (JSONSchemaType typeObject, JSONSchemaType type) |
static bool | ParameterNotNull (const CVariant ¶meterObject, const std::string &key) |
static void | CopyStringArray (const CVariant &jsonStringArray, std::vector< std::string > &stringArray) |
Copies the values from the jsonStringArray to the stringArray. stringArray is cleared. | |
static void | SetFromDBDate (const CVariant &jsonDate, CDateTime &date) |
static void | SetFromDBDateTime (const CVariant &jsonDate, CDateTime &date) |
static bool | GetXspFiltering (const std::string &type, const CVariant &filter, std::string &xsp) |
Helper class for json schema service descriptor based service descriptions for the json rpc API.
Provides static functions to parse a complete json schema service descriptor of a published service containing json rpc methods, print the json schema service descriptor representation into a string (mainly for output purposes) and evaluate and verify parameters provided in a call to one of the publish json rpc methods against a parameter definition parsed from a json schema service descriptor.
|
static |
Parses the given json schema description and evaluates and stores the defined builtin method.
jsonMethod | json schema description to parse |
|
static |
|
static |
|
static |
|
static |
Parses the given json schema description and evaluates and stores the defined method.
jsonMethod | json schema description to parse |
method | pointer to the implementation |
|
static |
Parses the given json schema description and evaluates and stores the defined notification.
jsonNotification | json schema description to parse |
|
static |
Parses the given json schema description and evaluates and stores the defined type.
jsonType | json schema description to parse |
|
static |
Checks the given parameters from the request against the json schema description for the given method.
method | Called method |
requestParameters | Parameters from the request |
client | Client who sent the request |
notification | Whether the request was sent as a notification or not |
methodCall | Object which will contain the actual C/C++ method to be called |
outputParameters | Cleaned up parameter list |
Checks if the given method is a valid json rpc method, if the client has the permission to call this method, if the method can be called as a notification or not, assigns the actual C/C++ implementation of the method to the "methodCall" parameter and checks the given parameters from the request against the json schema description for the given method.
|
static |
|
static |
|
static |
Gets the version of the json schema description.
|
static |
Prints the json schema description into the given result object.
result | Object into which the json schema description is printed |
transport | Transport layer capabilities |
client | Client requesting a print |
printDescriptions | Whether to print descriptions or not |
printMetadata | Whether to print XBMC specific data or not |
filterByTransport | Whether to filter by transport or not |
|
static |
|
friend |
|
friend |