X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Frest%2Fmodel%2FSubscriptionResponse.h;fp=src%2Frest%2Fmodel%2FSubscriptionResponse.h;h=3d8e8d4fabca74a197154dd626101c0746903f40;hb=a0bada6bf7af92d281c381092e7d6881c67d905f;hp=0000000000000000000000000000000000000000;hpb=488447aed60cc52b06d71d50bee4ecf10025f7e1;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/src/rest/model/SubscriptionResponse.h b/src/rest/model/SubscriptionResponse.h new file mode 100644 index 0000000..3d8e8d4 --- /dev/null +++ b/src/rest/model/SubscriptionResponse.h @@ -0,0 +1,56 @@ +#ifndef XAPP_MODEL_SubscriptionResponse_H +#define XAPP_MODEL_SubscriptionResponse_H +#include "ModelBase.h" +#include "SubscriptionInstance.h" + +namespace xapp { +namespace model { + +struct SubscriptionResponse: ModelBase { + int SubscriptionID; + SubscriptionInstances m_SubscriptionInstances; + + json validator_schema = R"( + { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SubscriptionResponse", + "properties": { + "SubscriptionId": { + "description": "Indentification of Subscription", + "type": "integer" + }, + "SubscriptionInstances": { + "description": "List of Subscription Instance", + "type": "array" + } + }, + "required": [ + "SubscriptionId", + "SubscriptionInstances" + ], + "type": "object" + })"_json; + + virtual json get_validator_schema() const { return validator_schema; } +}; + +void from_json(const json& j, SubscriptionResponse& ref) { + + std::cout << __PRETTY_FUNCTION__ << std::endl; + ref.validate_json(j); + + j.at("SubscriptionId").get_to(ref.SubscriptionID); + j.at("SubscriptionInstances").get_to(ref.m_SubscriptionInstances); +} + +void to_json(json& j, const SubscriptionResponse& ref) { + + j = json { + {"SubscriptionId",ref.SubscriptionID}, + {"SubscriptionInstances", ref.m_SubscriptionInstances} + }; +} + +} /*model*/ +} /*xapp*/ +#endif /*XAPP_MODEL_SubscriptionResponse_H*/