feat(restful): remove license api

This commit is contained in:
eeff
2022-10-28 15:44:33 +08:00
parent b0e290ea86
commit e528d2a70a
9 changed files with 6 additions and 1182 deletions
-133
View File
@@ -1,133 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#include <stdlib.h>
#include <string.h>
#include "json/json.h"
#include "neu_json_license.h"
int neu_json_encode_get_license_resp(void *json_object, void *param)
{
int ret = 0;
neu_json_get_license_resp_t *resp = (neu_json_get_license_resp_t *) param;
void *enabled_plugin_array = neu_json_array();
neu_json_get_license_resp_enabled_plugin_t *p_enabled_plugin =
resp->enabled_plugins;
for (int i = 0; i < resp->n_enabled_plugin; i++) {
neu_json_elem_t enabled_plugin_elems[] = { {
.name = NULL,
.t = NEU_JSON_STR,
.v.val_str = *p_enabled_plugin,
} };
enabled_plugin_array = neu_json_encode_array_value(
enabled_plugin_array, enabled_plugin_elems,
NEU_JSON_ELEM_SIZE(enabled_plugin_elems));
p_enabled_plugin++;
}
neu_json_elem_t resp_elems[] = { {
.name = "valid_until",
.t = NEU_JSON_STR,
.v.val_str = resp->valid_until,
},
{
.name = "valid_since",
.t = NEU_JSON_STR,
.v.val_str = resp->valid_since,
},
{
.name = "valid",
.t = NEU_JSON_BOOL,
.v.val_bool = resp->valid,
},
{
.name = "max_nodes",
.t = NEU_JSON_INT,
.v.val_int = resp->max_nodes,
},
{
.name = "max_node_tags",
.t = NEU_JSON_INT,
.v.val_int = resp->max_node_tags,
},
{
.name = "license_type",
.t = NEU_JSON_STR,
.v.val_str = resp->license_type,
},
{
.name = "error",
.t = NEU_JSON_INT,
.v.val_int = resp->error,
},
{
.name = "enabled_plugins",
.t = NEU_JSON_OBJECT,
.v.val_object = enabled_plugin_array,
} };
ret = neu_json_encode_field(json_object, resp_elems,
NEU_JSON_ELEM_SIZE(resp_elems));
return ret;
}
int neu_json_decode_set_license_req(char * buf,
neu_json_set_license_req_t **result)
{
int ret = 0;
neu_json_set_license_req_t *req =
calloc(1, sizeof(neu_json_set_license_req_t));
if (NULL == req) {
return -1;
}
neu_json_elem_t req_elems[] = { {
.name = "license",
.t = NEU_JSON_STR,
} };
ret = neu_json_decode(buf, NEU_JSON_ELEM_SIZE(req_elems), req_elems);
if (ret != 0) {
goto decode_fail;
}
req->license = req_elems[0].v.val_str;
*result = req;
return ret;
decode_fail:
free(req);
return -1;
}
void neu_json_decode_set_license_req_free(neu_json_set_license_req_t *req)
{
free(req->license);
free(req);
}
-62
View File
@@ -1,62 +0,0 @@
/**
* NEURON IIoT System for Industry 4.0
* Copyright (C) 2020-2022 EMQ Technologies Co., Ltd All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/*
* DO NOT EDIT THIS FILE MANUALLY!
* It was automatically generated by `json-autotype`.
*/
#ifndef _NEU_JSON_API_NEU_JSON_LICENSE_H_
#define _NEU_JSON_API_NEU_JSON_LICENSE_H_
#include "json/json.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef char *neu_json_get_license_resp_enabled_plugin_t;
typedef struct {
bool valid;
int n_enabled_plugin;
neu_json_get_license_resp_enabled_plugin_t *enabled_plugins;
int64_t max_node_tags;
char * license_type;
int64_t error;
char * valid_until;
char * valid_since;
int64_t max_nodes;
} neu_json_get_license_resp_t;
int neu_json_encode_get_license_resp(void *json_object, void *param);
typedef struct {
char *license;
} neu_json_set_license_req_t;
int neu_json_decode_set_license_req(char * buf,
neu_json_set_license_req_t **result);
void neu_json_decode_set_license_req_free(neu_json_set_license_req_t *req);
#ifdef __cplusplus
}
#endif
#endif