forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_downgrade.h
32 lines (26 loc) · 2.04 KB
/
api_downgrade.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef NMOS_API_DOWNGRADE_H
#define NMOS_API_DOWNGRADE_H
#include "cpprest/json.h"
// "Downgrade queries permit old-versioned responses to be provided to clients which are confident
// that they can handle any missing attributes between the specified API versions."
// See https://specs.amwa.tv/is-04/releases/v1.2.0/docs/2.5._APIs_-_Query_Parameters.html#downgrade-queries
namespace nmos
{
struct api_version;
struct resource;
struct type;
bool is_permitted_downgrade(const nmos::resource& resource, const nmos::api_version& version);
bool is_permitted_downgrade(const nmos::resource& resource, const nmos::api_version& version, const nmos::api_version& downgrade_version);
bool is_permitted_downgrade(const nmos::api_version& resource_version, const nmos::api_version& resource_downgrade_version, const nmos::type& resource_type, const nmos::api_version& version, const nmos::api_version& downgrade_version);
namespace details
{
// make user error information (to be used with status_codes::NotFound)
utility::string_t make_permitted_downgrade_error(const nmos::resource& resource, const nmos::api_version& version);
utility::string_t make_permitted_downgrade_error(const nmos::resource& resource, const nmos::api_version& version, const nmos::api_version& downgrade_version);
utility::string_t make_permitted_downgrade_error(const nmos::api_version& resource_version, const nmos::type& resource_type, const nmos::api_version& version, const nmos::api_version& downgrade_version);
}
web::json::value downgrade(const nmos::resource& resource, const nmos::api_version& version);
web::json::value downgrade(const nmos::resource& resource, const nmos::api_version& version, const nmos::api_version& downgrade_version);
web::json::value downgrade(const nmos::api_version& resource_version, const nmos::api_version& resource_downgrade_version, const nmos::type& resource_type, const web::json::value& resource_data, const nmos::api_version& version, const nmos::api_version& downgrade_version);
}
#endif