mirror of https://github.com/linuxdeepin/linglong
parent
8ec9eb817d
commit
ecf1297728
|
|
@ -5,9 +5,12 @@ README.md
|
|||
api/ClientAPI.c
|
||||
api/ClientAPI.h
|
||||
docs/ClientAPI.md
|
||||
docs/_api_v1_repos_get_200_response.md
|
||||
docs/api_json_result.md
|
||||
docs/api_upload_task_file_resp.md
|
||||
docs/api_upload_task_layer_file_resp.md
|
||||
docs/apiv2_json_error.md
|
||||
docs/apiv2_search_app_response.md
|
||||
docs/fuzzy_search_app_200_response.md
|
||||
docs/get_repo_200_response.md
|
||||
docs/new_upload_task_id_200_response.md
|
||||
|
|
@ -30,12 +33,18 @@ include/binary.h
|
|||
include/keyValuePair.h
|
||||
include/list.h
|
||||
libcurl.licence
|
||||
model/_api_v1_repos_get_200_response.c
|
||||
model/_api_v1_repos_get_200_response.h
|
||||
model/api_json_result.c
|
||||
model/api_json_result.h
|
||||
model/api_upload_task_file_resp.c
|
||||
model/api_upload_task_file_resp.h
|
||||
model/api_upload_task_layer_file_resp.c
|
||||
model/api_upload_task_layer_file_resp.h
|
||||
model/apiv2_json_error.c
|
||||
model/apiv2_json_error.h
|
||||
model/apiv2_search_app_response.c
|
||||
model/apiv2_search_app_response.h
|
||||
model/fuzzy_search_app_200_response.c
|
||||
model/fuzzy_search_app_200_response.h
|
||||
model/get_repo_200_response.c
|
||||
|
|
@ -71,9 +80,12 @@ src/apiKey.c
|
|||
src/binary.c
|
||||
src/list.c
|
||||
uncrustify-rules.cfg
|
||||
unit-test/test__api_v1_repos_get_200_response.c
|
||||
unit-test/test_api_json_result.c
|
||||
unit-test/test_api_upload_task_file_resp.c
|
||||
unit-test/test_api_upload_task_layer_file_resp.c
|
||||
unit-test/test_apiv2_json_error.c
|
||||
unit-test/test_apiv2_search_app_response.c
|
||||
unit-test/test_fuzzy_search_app_200_response.c
|
||||
unit-test/test_get_repo_200_response.c
|
||||
unit-test/test_new_upload_task_id_200_response.c
|
||||
|
|
|
|||
|
|
@ -54,9 +54,12 @@ set(SRCS
|
|||
src/binary.c
|
||||
external/cJSON.c
|
||||
model/object.c
|
||||
model/_api_v1_repos_get_200_response.c
|
||||
model/api_json_result.c
|
||||
model/api_upload_task_file_resp.c
|
||||
model/api_upload_task_layer_file_resp.c
|
||||
model/apiv2_json_error.c
|
||||
model/apiv2_search_app_response.c
|
||||
model/fuzzy_search_app_200_response.c
|
||||
model/get_repo_200_response.c
|
||||
model/new_upload_task_id_200_response.c
|
||||
|
|
@ -82,9 +85,12 @@ set(HDRS
|
|||
include/keyValuePair.h
|
||||
external/cJSON.h
|
||||
model/object.h
|
||||
model/_api_v1_repos_get_200_response.h
|
||||
model/api_json_result.h
|
||||
model/api_upload_task_file_resp.h
|
||||
model/api_upload_task_layer_file_resp.h
|
||||
model/apiv2_json_error.h
|
||||
model/apiv2_search_app_response.h
|
||||
model/fuzzy_search_app_200_response.h
|
||||
model/get_repo_200_response.h
|
||||
model/new_upload_task_id_200_response.h
|
||||
|
|
|
|||
|
|
@ -66,9 +66,12 @@ All URIs are relative to *http://localhost*
|
|||
|
||||
Category | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*ClientAPI* | [**ClientAPI_apiV1ReposGet**](docs/ClientAPI.md#ClientAPI_apiV1ReposGet) | **GET** /api/v1/repos | 查看仓库列表
|
||||
*ClientAPI* | [**ClientAPI_fuzzySearchApp**](docs/ClientAPI.md#ClientAPI_fuzzySearchApp) | **POST** /api/v0/apps/fuzzysearchapp | 模糊查找App
|
||||
*ClientAPI* | [**ClientAPI_getRepo**](docs/ClientAPI.md#ClientAPI_getRepo) | **GET** /api/v1/repos/{repo} | 查看仓库信息
|
||||
*ClientAPI* | [**ClientAPI_newUploadTaskID**](docs/ClientAPI.md#ClientAPI_newUploadTaskID) | **POST** /api/v1/upload-tasks | generate a new upload task id
|
||||
*ClientAPI* | [**ClientAPI_refDelete**](docs/ClientAPI.md#ClientAPI_refDelete) | **DELETE** /api/v1/repos/{repo}/refs/{channel}/{app_id}/{version}/{arch}/{module} | delete a ref from repo
|
||||
*ClientAPI* | [**ClientAPI_searchApp**](docs/ClientAPI.md#ClientAPI_searchApp) | **GET** /api/v2/search/apps | 查找App
|
||||
*ClientAPI* | [**ClientAPI_signIn**](docs/ClientAPI.md#ClientAPI_signIn) | **POST** /api/v1/sign-in | 登陆帐号
|
||||
*ClientAPI* | [**ClientAPI_uploadTaskFile**](docs/ClientAPI.md#ClientAPI_uploadTaskFile) | **PUT** /api/v1/upload-tasks/{task_id}/tar | upload tgz file to upload task
|
||||
*ClientAPI* | [**ClientAPI_uploadTaskInfo**](docs/ClientAPI.md#ClientAPI_uploadTaskInfo) | **GET** /api/v1/upload-tasks/{task_id}/status | get upload task status
|
||||
|
|
@ -77,9 +80,12 @@ Category | Method | HTTP request | Description
|
|||
|
||||
## Documentation for Models
|
||||
|
||||
- [_api_v1_repos_get_200_response_t](docs/_api_v1_repos_get_200_response.md)
|
||||
- [api_json_result_t](docs/api_json_result.md)
|
||||
- [api_upload_task_file_resp_t](docs/api_upload_task_file_resp.md)
|
||||
- [api_upload_task_layer_file_resp_t](docs/api_upload_task_layer_file_resp.md)
|
||||
- [apiv2_json_error_t](docs/apiv2_json_error.md)
|
||||
- [apiv2_search_app_response_t](docs/apiv2_search_app_response.md)
|
||||
- [fuzzy_search_app_200_response_t](docs/fuzzy_search_app_200_response.md)
|
||||
- [get_repo_200_response_t](docs/get_repo_200_response.md)
|
||||
- [new_upload_task_id_200_response_t](docs/new_upload_task_id_200_response.md)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,69 @@
|
|||
}while(0)
|
||||
|
||||
|
||||
// 查看仓库列表
|
||||
//
|
||||
// returns repository mode and resolve all branches
|
||||
//
|
||||
_api_v1_repos_get_200_response_t*
|
||||
ClientAPI_apiV1ReposGet(apiClient_t *apiClient)
|
||||
{
|
||||
list_t *localVarQueryParameters = NULL;
|
||||
list_t *localVarHeaderParameters = NULL;
|
||||
list_t *localVarFormParameters = NULL;
|
||||
list_t *localVarHeaderType = list_createList();
|
||||
list_t *localVarContentType = NULL;
|
||||
char *localVarBodyParameters = NULL;
|
||||
|
||||
// create the path
|
||||
long sizeOfPath = strlen("/api/v1/repos")+1;
|
||||
char *localVarPath = malloc(sizeOfPath);
|
||||
snprintf(localVarPath, sizeOfPath, "/api/v1/repos");
|
||||
|
||||
|
||||
|
||||
list_addElement(localVarHeaderType,"*/*"); //produces
|
||||
apiClient_invoke(apiClient,
|
||||
localVarPath,
|
||||
localVarQueryParameters,
|
||||
localVarHeaderParameters,
|
||||
localVarFormParameters,
|
||||
localVarHeaderType,
|
||||
localVarContentType,
|
||||
localVarBodyParameters,
|
||||
"GET");
|
||||
|
||||
// uncomment below to debug the error response
|
||||
//if (apiClient->response_code == 200) {
|
||||
// printf("%s\n","OK");
|
||||
//}
|
||||
//nonprimitive not container
|
||||
cJSON *ClientAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
|
||||
_api_v1_repos_get_200_response_t *elementToReturn = _api_v1_repos_get_200_response_parseFromJSON(ClientAPIlocalVarJSON);
|
||||
cJSON_Delete(ClientAPIlocalVarJSON);
|
||||
if(elementToReturn == NULL) {
|
||||
// return 0;
|
||||
}
|
||||
|
||||
//return type
|
||||
if (apiClient->dataReceived) {
|
||||
free(apiClient->dataReceived);
|
||||
apiClient->dataReceived = NULL;
|
||||
apiClient->dataReceivedLen = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
list_freeList(localVarHeaderType);
|
||||
|
||||
free(localVarPath);
|
||||
return elementToReturn;
|
||||
end:
|
||||
free(localVarPath);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
// 模糊查找App
|
||||
//
|
||||
fuzzy_search_app_200_response_t*
|
||||
|
|
@ -260,6 +323,385 @@ end:
|
|||
|
||||
}
|
||||
|
||||
// delete a ref from repo
|
||||
//
|
||||
// delete a ref from repo
|
||||
//
|
||||
void
|
||||
ClientAPI_refDelete(apiClient_t *apiClient, char *X_Token, char *repo, char *channel, char *app_id, char *version, char *arch, char *module, char *hard)
|
||||
{
|
||||
list_t *localVarQueryParameters = list_createList();
|
||||
list_t *localVarHeaderParameters = list_createList();
|
||||
list_t *localVarFormParameters = NULL;
|
||||
list_t *localVarHeaderType = NULL;
|
||||
list_t *localVarContentType = NULL;
|
||||
char *localVarBodyParameters = NULL;
|
||||
|
||||
// create the path
|
||||
long sizeOfPath = strlen("/api/v1/repos/{repo}/refs/{channel}/{app_id}/{version}/{arch}/{module}")+1;
|
||||
char *localVarPath = malloc(sizeOfPath);
|
||||
snprintf(localVarPath, sizeOfPath, "/api/v1/repos/{repo}/refs/{channel}/{app_id}/{version}/{arch}/{module}");
|
||||
|
||||
|
||||
// Path Params
|
||||
long sizeOfPathParams_repo = strlen(repo)+3 + strlen(channel)+3 + strlen(app_id)+3 + strlen(version)+3 + strlen(arch)+3 + strlen(module)+3 + strlen("{ repo }");
|
||||
if(repo == NULL) {
|
||||
goto end;
|
||||
}
|
||||
char* localVarToReplace_repo = malloc(sizeOfPathParams_repo);
|
||||
sprintf(localVarToReplace_repo, "{%s}", "repo");
|
||||
|
||||
localVarPath = strReplace(localVarPath, localVarToReplace_repo, repo);
|
||||
|
||||
// Path Params
|
||||
long sizeOfPathParams_channel = strlen(repo)+3 + strlen(channel)+3 + strlen(app_id)+3 + strlen(version)+3 + strlen(arch)+3 + strlen(module)+3 + strlen("{ channel }");
|
||||
if(channel == NULL) {
|
||||
goto end;
|
||||
}
|
||||
char* localVarToReplace_channel = malloc(sizeOfPathParams_channel);
|
||||
sprintf(localVarToReplace_channel, "{%s}", "channel");
|
||||
|
||||
localVarPath = strReplace(localVarPath, localVarToReplace_channel, channel);
|
||||
|
||||
// Path Params
|
||||
long sizeOfPathParams_app_id = strlen(repo)+3 + strlen(channel)+3 + strlen(app_id)+3 + strlen(version)+3 + strlen(arch)+3 + strlen(module)+3 + strlen("{ app_id }");
|
||||
if(app_id == NULL) {
|
||||
goto end;
|
||||
}
|
||||
char* localVarToReplace_app_id = malloc(sizeOfPathParams_app_id);
|
||||
sprintf(localVarToReplace_app_id, "{%s}", "app_id");
|
||||
|
||||
localVarPath = strReplace(localVarPath, localVarToReplace_app_id, app_id);
|
||||
|
||||
// Path Params
|
||||
long sizeOfPathParams_version = strlen(repo)+3 + strlen(channel)+3 + strlen(app_id)+3 + strlen(version)+3 + strlen(arch)+3 + strlen(module)+3 + strlen("{ version }");
|
||||
if(version == NULL) {
|
||||
goto end;
|
||||
}
|
||||
char* localVarToReplace_version = malloc(sizeOfPathParams_version);
|
||||
sprintf(localVarToReplace_version, "{%s}", "version");
|
||||
|
||||
localVarPath = strReplace(localVarPath, localVarToReplace_version, version);
|
||||
|
||||
// Path Params
|
||||
long sizeOfPathParams_arch = strlen(repo)+3 + strlen(channel)+3 + strlen(app_id)+3 + strlen(version)+3 + strlen(arch)+3 + strlen(module)+3 + strlen("{ arch }");
|
||||
if(arch == NULL) {
|
||||
goto end;
|
||||
}
|
||||
char* localVarToReplace_arch = malloc(sizeOfPathParams_arch);
|
||||
sprintf(localVarToReplace_arch, "{%s}", "arch");
|
||||
|
||||
localVarPath = strReplace(localVarPath, localVarToReplace_arch, arch);
|
||||
|
||||
// Path Params
|
||||
long sizeOfPathParams_module = strlen(repo)+3 + strlen(channel)+3 + strlen(app_id)+3 + strlen(version)+3 + strlen(arch)+3 + strlen(module)+3 + strlen("{ module }");
|
||||
if(module == NULL) {
|
||||
goto end;
|
||||
}
|
||||
char* localVarToReplace_module = malloc(sizeOfPathParams_module);
|
||||
sprintf(localVarToReplace_module, "{%s}", "module");
|
||||
|
||||
localVarPath = strReplace(localVarPath, localVarToReplace_module, module);
|
||||
|
||||
|
||||
|
||||
// header parameters
|
||||
char *keyHeader_X_Token = NULL;
|
||||
char * valueHeader_X_Token = 0;
|
||||
keyValuePair_t *keyPairHeader_X_Token = 0;
|
||||
if (X_Token) {
|
||||
keyHeader_X_Token = strdup("X-Token");
|
||||
valueHeader_X_Token = strdup((X_Token));
|
||||
keyPairHeader_X_Token = keyValuePair_create(keyHeader_X_Token, valueHeader_X_Token);
|
||||
list_addElement(localVarHeaderParameters,keyPairHeader_X_Token);
|
||||
}
|
||||
|
||||
|
||||
// query parameters
|
||||
char *keyQuery_hard = NULL;
|
||||
char * valueQuery_hard = NULL;
|
||||
keyValuePair_t *keyPairQuery_hard = 0;
|
||||
if (hard)
|
||||
{
|
||||
keyQuery_hard = strdup("hard");
|
||||
valueQuery_hard = strdup((hard));
|
||||
keyPairQuery_hard = keyValuePair_create(keyQuery_hard, valueQuery_hard);
|
||||
list_addElement(localVarQueryParameters,keyPairQuery_hard);
|
||||
}
|
||||
apiClient_invoke(apiClient,
|
||||
localVarPath,
|
||||
localVarQueryParameters,
|
||||
localVarHeaderParameters,
|
||||
localVarFormParameters,
|
||||
localVarHeaderType,
|
||||
localVarContentType,
|
||||
localVarBodyParameters,
|
||||
"DELETE");
|
||||
|
||||
//No return type
|
||||
end:
|
||||
if (apiClient->dataReceived) {
|
||||
free(apiClient->dataReceived);
|
||||
apiClient->dataReceived = NULL;
|
||||
apiClient->dataReceivedLen = 0;
|
||||
}
|
||||
list_freeList(localVarQueryParameters);
|
||||
list_freeList(localVarHeaderParameters);
|
||||
|
||||
|
||||
|
||||
free(localVarPath);
|
||||
free(localVarToReplace_repo);
|
||||
free(localVarToReplace_channel);
|
||||
free(localVarToReplace_app_id);
|
||||
free(localVarToReplace_version);
|
||||
free(localVarToReplace_arch);
|
||||
free(localVarToReplace_module);
|
||||
if (keyHeader_X_Token) {
|
||||
free(keyHeader_X_Token);
|
||||
keyHeader_X_Token = NULL;
|
||||
}
|
||||
if (valueHeader_X_Token) {
|
||||
free(valueHeader_X_Token);
|
||||
valueHeader_X_Token = NULL;
|
||||
}
|
||||
free(keyPairHeader_X_Token);
|
||||
if(keyQuery_hard){
|
||||
free(keyQuery_hard);
|
||||
keyQuery_hard = NULL;
|
||||
}
|
||||
if(valueQuery_hard){
|
||||
free(valueQuery_hard);
|
||||
valueQuery_hard = NULL;
|
||||
}
|
||||
if(keyPairQuery_hard){
|
||||
keyValuePair_free(keyPairQuery_hard);
|
||||
keyPairQuery_hard = NULL;
|
||||
}
|
||||
if(keyQuery_hard){
|
||||
free(keyQuery_hard);
|
||||
keyQuery_hard = NULL;
|
||||
}
|
||||
if(keyPairQuery_hard){
|
||||
keyValuePair_free(keyPairQuery_hard);
|
||||
keyPairQuery_hard = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 查找App
|
||||
//
|
||||
apiv2_search_app_response_t*
|
||||
ClientAPI_searchApp(apiClient_t *apiClient, char *repo_name, char *channel, char *app_id, char *arch, char *module, char *version)
|
||||
{
|
||||
list_t *localVarQueryParameters = list_createList();
|
||||
list_t *localVarHeaderParameters = NULL;
|
||||
list_t *localVarFormParameters = NULL;
|
||||
list_t *localVarHeaderType = list_createList();
|
||||
list_t *localVarContentType = NULL;
|
||||
char *localVarBodyParameters = NULL;
|
||||
|
||||
// create the path
|
||||
long sizeOfPath = strlen("/api/v2/search/apps")+1;
|
||||
char *localVarPath = malloc(sizeOfPath);
|
||||
snprintf(localVarPath, sizeOfPath, "/api/v2/search/apps");
|
||||
|
||||
|
||||
|
||||
|
||||
// query parameters
|
||||
char *keyQuery_repo_name = NULL;
|
||||
char * valueQuery_repo_name = NULL;
|
||||
keyValuePair_t *keyPairQuery_repo_name = 0;
|
||||
if (repo_name)
|
||||
{
|
||||
keyQuery_repo_name = strdup("repo_name");
|
||||
valueQuery_repo_name = strdup((repo_name));
|
||||
keyPairQuery_repo_name = keyValuePair_create(keyQuery_repo_name, valueQuery_repo_name);
|
||||
list_addElement(localVarQueryParameters,keyPairQuery_repo_name);
|
||||
}
|
||||
|
||||
// query parameters
|
||||
char *keyQuery_channel = NULL;
|
||||
char * valueQuery_channel = NULL;
|
||||
keyValuePair_t *keyPairQuery_channel = 0;
|
||||
if (channel)
|
||||
{
|
||||
keyQuery_channel = strdup("channel");
|
||||
valueQuery_channel = strdup((channel));
|
||||
keyPairQuery_channel = keyValuePair_create(keyQuery_channel, valueQuery_channel);
|
||||
list_addElement(localVarQueryParameters,keyPairQuery_channel);
|
||||
}
|
||||
|
||||
// query parameters
|
||||
char *keyQuery_app_id = NULL;
|
||||
char * valueQuery_app_id = NULL;
|
||||
keyValuePair_t *keyPairQuery_app_id = 0;
|
||||
if (app_id)
|
||||
{
|
||||
keyQuery_app_id = strdup("app_id");
|
||||
valueQuery_app_id = strdup((app_id));
|
||||
keyPairQuery_app_id = keyValuePair_create(keyQuery_app_id, valueQuery_app_id);
|
||||
list_addElement(localVarQueryParameters,keyPairQuery_app_id);
|
||||
}
|
||||
|
||||
// query parameters
|
||||
char *keyQuery_arch = NULL;
|
||||
char * valueQuery_arch = NULL;
|
||||
keyValuePair_t *keyPairQuery_arch = 0;
|
||||
if (arch)
|
||||
{
|
||||
keyQuery_arch = strdup("arch");
|
||||
valueQuery_arch = strdup((arch));
|
||||
keyPairQuery_arch = keyValuePair_create(keyQuery_arch, valueQuery_arch);
|
||||
list_addElement(localVarQueryParameters,keyPairQuery_arch);
|
||||
}
|
||||
|
||||
// query parameters
|
||||
char *keyQuery_module = NULL;
|
||||
char * valueQuery_module = NULL;
|
||||
keyValuePair_t *keyPairQuery_module = 0;
|
||||
if (module)
|
||||
{
|
||||
keyQuery_module = strdup("module");
|
||||
valueQuery_module = strdup((module));
|
||||
keyPairQuery_module = keyValuePair_create(keyQuery_module, valueQuery_module);
|
||||
list_addElement(localVarQueryParameters,keyPairQuery_module);
|
||||
}
|
||||
|
||||
// query parameters
|
||||
char *keyQuery_version = NULL;
|
||||
char * valueQuery_version = NULL;
|
||||
keyValuePair_t *keyPairQuery_version = 0;
|
||||
if (version)
|
||||
{
|
||||
keyQuery_version = strdup("version");
|
||||
valueQuery_version = strdup((version));
|
||||
keyPairQuery_version = keyValuePair_create(keyQuery_version, valueQuery_version);
|
||||
list_addElement(localVarQueryParameters,keyPairQuery_version);
|
||||
}
|
||||
list_addElement(localVarHeaderType,"application/json"); //produces
|
||||
apiClient_invoke(apiClient,
|
||||
localVarPath,
|
||||
localVarQueryParameters,
|
||||
localVarHeaderParameters,
|
||||
localVarFormParameters,
|
||||
localVarHeaderType,
|
||||
localVarContentType,
|
||||
localVarBodyParameters,
|
||||
"GET");
|
||||
|
||||
// uncomment below to debug the error response
|
||||
//if (apiClient->response_code == 200) {
|
||||
// printf("%s\n","OK");
|
||||
//}
|
||||
// uncomment below to debug the error response
|
||||
//if (apiClient->response_code == 400) {
|
||||
// printf("%s\n","Bad Request");
|
||||
//}
|
||||
// uncomment below to debug the error response
|
||||
//if (apiClient->response_code == 500) {
|
||||
// printf("%s\n","Internal Server Error");
|
||||
//}
|
||||
//nonprimitive not container
|
||||
cJSON *ClientAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
|
||||
apiv2_search_app_response_t *elementToReturn = apiv2_search_app_response_parseFromJSON(ClientAPIlocalVarJSON);
|
||||
cJSON_Delete(ClientAPIlocalVarJSON);
|
||||
if(elementToReturn == NULL) {
|
||||
// return 0;
|
||||
}
|
||||
|
||||
//return type
|
||||
if (apiClient->dataReceived) {
|
||||
free(apiClient->dataReceived);
|
||||
apiClient->dataReceived = NULL;
|
||||
apiClient->dataReceivedLen = 0;
|
||||
}
|
||||
list_freeList(localVarQueryParameters);
|
||||
|
||||
|
||||
list_freeList(localVarHeaderType);
|
||||
|
||||
free(localVarPath);
|
||||
if(keyQuery_repo_name){
|
||||
free(keyQuery_repo_name);
|
||||
keyQuery_repo_name = NULL;
|
||||
}
|
||||
if(valueQuery_repo_name){
|
||||
free(valueQuery_repo_name);
|
||||
valueQuery_repo_name = NULL;
|
||||
}
|
||||
if(keyPairQuery_repo_name){
|
||||
keyValuePair_free(keyPairQuery_repo_name);
|
||||
keyPairQuery_repo_name = NULL;
|
||||
}
|
||||
if(keyQuery_channel){
|
||||
free(keyQuery_channel);
|
||||
keyQuery_channel = NULL;
|
||||
}
|
||||
if(valueQuery_channel){
|
||||
free(valueQuery_channel);
|
||||
valueQuery_channel = NULL;
|
||||
}
|
||||
if(keyPairQuery_channel){
|
||||
keyValuePair_free(keyPairQuery_channel);
|
||||
keyPairQuery_channel = NULL;
|
||||
}
|
||||
if(keyQuery_app_id){
|
||||
free(keyQuery_app_id);
|
||||
keyQuery_app_id = NULL;
|
||||
}
|
||||
if(valueQuery_app_id){
|
||||
free(valueQuery_app_id);
|
||||
valueQuery_app_id = NULL;
|
||||
}
|
||||
if(keyPairQuery_app_id){
|
||||
keyValuePair_free(keyPairQuery_app_id);
|
||||
keyPairQuery_app_id = NULL;
|
||||
}
|
||||
if(keyQuery_arch){
|
||||
free(keyQuery_arch);
|
||||
keyQuery_arch = NULL;
|
||||
}
|
||||
if(valueQuery_arch){
|
||||
free(valueQuery_arch);
|
||||
valueQuery_arch = NULL;
|
||||
}
|
||||
if(keyPairQuery_arch){
|
||||
keyValuePair_free(keyPairQuery_arch);
|
||||
keyPairQuery_arch = NULL;
|
||||
}
|
||||
if(keyQuery_module){
|
||||
free(keyQuery_module);
|
||||
keyQuery_module = NULL;
|
||||
}
|
||||
if(valueQuery_module){
|
||||
free(valueQuery_module);
|
||||
valueQuery_module = NULL;
|
||||
}
|
||||
if(keyPairQuery_module){
|
||||
keyValuePair_free(keyPairQuery_module);
|
||||
keyPairQuery_module = NULL;
|
||||
}
|
||||
if(keyQuery_version){
|
||||
free(keyQuery_version);
|
||||
keyQuery_version = NULL;
|
||||
}
|
||||
if(valueQuery_version){
|
||||
free(valueQuery_version);
|
||||
valueQuery_version = NULL;
|
||||
}
|
||||
if(keyPairQuery_version){
|
||||
keyValuePair_free(keyPairQuery_version);
|
||||
keyPairQuery_version = NULL;
|
||||
}
|
||||
return elementToReturn;
|
||||
end:
|
||||
free(localVarPath);
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
// 登陆帐号
|
||||
//
|
||||
sign_in_200_response_t*
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
#include "../external/cJSON.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "../model/_api_v1_repos_get_200_response.h"
|
||||
#include "../model/api_upload_task_file_resp.h"
|
||||
#include "../model/api_upload_task_layer_file_resp.h"
|
||||
#include "../model/apiv2_json_error.h"
|
||||
#include "../model/apiv2_search_app_response.h"
|
||||
#include "../model/fuzzy_search_app_200_response.h"
|
||||
#include "../model/get_repo_200_response.h"
|
||||
#include "../model/new_upload_task_id_200_response.h"
|
||||
|
|
@ -17,6 +20,14 @@
|
|||
#include "../model/upload_task_info_200_response.h"
|
||||
|
||||
|
||||
// 查看仓库列表
|
||||
//
|
||||
// returns repository mode and resolve all branches
|
||||
//
|
||||
_api_v1_repos_get_200_response_t*
|
||||
ClientAPI_apiV1ReposGet(apiClient_t *apiClient);
|
||||
|
||||
|
||||
// 模糊查找App
|
||||
//
|
||||
fuzzy_search_app_200_response_t*
|
||||
|
|
@ -39,6 +50,20 @@ new_upload_task_id_200_response_t*
|
|||
ClientAPI_newUploadTaskID(apiClient_t *apiClient, char *X_Token, schema_new_upload_task_req_t *req);
|
||||
|
||||
|
||||
// delete a ref from repo
|
||||
//
|
||||
// delete a ref from repo
|
||||
//
|
||||
void
|
||||
ClientAPI_refDelete(apiClient_t *apiClient, char *X_Token, char *repo, char *channel, char *app_id, char *version, char *arch, char *module, char *hard);
|
||||
|
||||
|
||||
// 查找App
|
||||
//
|
||||
apiv2_search_app_response_t*
|
||||
ClientAPI_searchApp(apiClient_t *apiClient, char *repo_name, char *channel, char *app_id, char *arch, char *module, char *version);
|
||||
|
||||
|
||||
// 登陆帐号
|
||||
//
|
||||
sign_in_200_response_t*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,180 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "_api_v1_repos_get_200_response.h"
|
||||
|
||||
|
||||
|
||||
_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response_create(
|
||||
int code,
|
||||
list_t *data,
|
||||
char *msg,
|
||||
char *trace_id
|
||||
) {
|
||||
_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response_local_var = malloc(sizeof(_api_v1_repos_get_200_response_t));
|
||||
if (!_api_v1_repos_get_200_response_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
_api_v1_repos_get_200_response_local_var->code = code;
|
||||
_api_v1_repos_get_200_response_local_var->data = data;
|
||||
_api_v1_repos_get_200_response_local_var->msg = msg;
|
||||
_api_v1_repos_get_200_response_local_var->trace_id = trace_id;
|
||||
|
||||
return _api_v1_repos_get_200_response_local_var;
|
||||
}
|
||||
|
||||
|
||||
void _api_v1_repos_get_200_response_free(_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response) {
|
||||
if(NULL == _api_v1_repos_get_200_response){
|
||||
return ;
|
||||
}
|
||||
listEntry_t *listEntry;
|
||||
if (_api_v1_repos_get_200_response->data) {
|
||||
list_ForEach(listEntry, _api_v1_repos_get_200_response->data) {
|
||||
schema_repo_info_free(listEntry->data);
|
||||
}
|
||||
list_freeList(_api_v1_repos_get_200_response->data);
|
||||
_api_v1_repos_get_200_response->data = NULL;
|
||||
}
|
||||
if (_api_v1_repos_get_200_response->msg) {
|
||||
free(_api_v1_repos_get_200_response->msg);
|
||||
_api_v1_repos_get_200_response->msg = NULL;
|
||||
}
|
||||
if (_api_v1_repos_get_200_response->trace_id) {
|
||||
free(_api_v1_repos_get_200_response->trace_id);
|
||||
_api_v1_repos_get_200_response->trace_id = NULL;
|
||||
}
|
||||
free(_api_v1_repos_get_200_response);
|
||||
}
|
||||
|
||||
cJSON *_api_v1_repos_get_200_response_convertToJSON(_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response) {
|
||||
cJSON *item = cJSON_CreateObject();
|
||||
|
||||
// _api_v1_repos_get_200_response->code
|
||||
if(_api_v1_repos_get_200_response->code) {
|
||||
if(cJSON_AddNumberToObject(item, "code", _api_v1_repos_get_200_response->code) == NULL) {
|
||||
goto fail; //Numeric
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// _api_v1_repos_get_200_response->data
|
||||
if(_api_v1_repos_get_200_response->data) {
|
||||
cJSON *data = cJSON_AddArrayToObject(item, "data");
|
||||
if(data == NULL) {
|
||||
goto fail; //nonprimitive container
|
||||
}
|
||||
|
||||
listEntry_t *dataListEntry;
|
||||
if (_api_v1_repos_get_200_response->data) {
|
||||
list_ForEach(dataListEntry, _api_v1_repos_get_200_response->data) {
|
||||
cJSON *itemLocal = schema_repo_info_convertToJSON(dataListEntry->data);
|
||||
if(itemLocal == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
cJSON_AddItemToArray(data, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// _api_v1_repos_get_200_response->msg
|
||||
if(_api_v1_repos_get_200_response->msg) {
|
||||
if(cJSON_AddStringToObject(item, "msg", _api_v1_repos_get_200_response->msg) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// _api_v1_repos_get_200_response->trace_id
|
||||
if(_api_v1_repos_get_200_response->trace_id) {
|
||||
if(cJSON_AddStringToObject(item, "trace_id", _api_v1_repos_get_200_response->trace_id) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
fail:
|
||||
if (item) {
|
||||
cJSON_Delete(item);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response_parseFromJSON(cJSON *_api_v1_repos_get_200_responseJSON){
|
||||
|
||||
_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response_local_var = NULL;
|
||||
|
||||
// define the local list for _api_v1_repos_get_200_response->data
|
||||
list_t *dataList = NULL;
|
||||
|
||||
// _api_v1_repos_get_200_response->code
|
||||
cJSON *code = cJSON_GetObjectItemCaseSensitive(_api_v1_repos_get_200_responseJSON, "code");
|
||||
if (code) {
|
||||
if(!cJSON_IsNumber(code))
|
||||
{
|
||||
goto end; //Numeric
|
||||
}
|
||||
}
|
||||
|
||||
// _api_v1_repos_get_200_response->data
|
||||
cJSON *data = cJSON_GetObjectItemCaseSensitive(_api_v1_repos_get_200_responseJSON, "data");
|
||||
if (data) {
|
||||
cJSON *data_local_nonprimitive = NULL;
|
||||
if(!cJSON_IsArray(data)){
|
||||
goto end; //nonprimitive container
|
||||
}
|
||||
|
||||
dataList = list_createList();
|
||||
|
||||
cJSON_ArrayForEach(data_local_nonprimitive,data )
|
||||
{
|
||||
if(!cJSON_IsObject(data_local_nonprimitive)){
|
||||
goto end;
|
||||
}
|
||||
schema_repo_info_t *dataItem = schema_repo_info_parseFromJSON(data_local_nonprimitive);
|
||||
|
||||
list_addElement(dataList, dataItem);
|
||||
}
|
||||
}
|
||||
|
||||
// _api_v1_repos_get_200_response->msg
|
||||
cJSON *msg = cJSON_GetObjectItemCaseSensitive(_api_v1_repos_get_200_responseJSON, "msg");
|
||||
if (msg) {
|
||||
if(!cJSON_IsString(msg) && !cJSON_IsNull(msg))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
// _api_v1_repos_get_200_response->trace_id
|
||||
cJSON *trace_id = cJSON_GetObjectItemCaseSensitive(_api_v1_repos_get_200_responseJSON, "trace_id");
|
||||
if (trace_id) {
|
||||
if(!cJSON_IsString(trace_id) && !cJSON_IsNull(trace_id))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_api_v1_repos_get_200_response_local_var = _api_v1_repos_get_200_response_create (
|
||||
code ? code->valuedouble : 0,
|
||||
data ? dataList : NULL,
|
||||
msg && !cJSON_IsNull(msg) ? strdup(msg->valuestring) : NULL,
|
||||
trace_id && !cJSON_IsNull(trace_id) ? strdup(trace_id->valuestring) : NULL
|
||||
);
|
||||
|
||||
return _api_v1_repos_get_200_response_local_var;
|
||||
end:
|
||||
if (dataList) {
|
||||
listEntry_t *listEntry = NULL;
|
||||
list_ForEach(listEntry, dataList) {
|
||||
schema_repo_info_free(listEntry->data);
|
||||
listEntry->data = NULL;
|
||||
}
|
||||
list_freeList(dataList);
|
||||
dataList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* _api_v1_repos_get_200_response.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __api_v1_repos_get_200_response_H_
|
||||
#define __api_v1_repos_get_200_response_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
typedef struct _api_v1_repos_get_200_response_t _api_v1_repos_get_200_response_t;
|
||||
|
||||
#include "schema_repo_info.h"
|
||||
|
||||
|
||||
|
||||
typedef struct _api_v1_repos_get_200_response_t {
|
||||
int code; //numeric
|
||||
list_t *data; //nonprimitive container
|
||||
char *msg; // string
|
||||
char *trace_id; // string
|
||||
|
||||
} _api_v1_repos_get_200_response_t;
|
||||
|
||||
_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response_create(
|
||||
int code,
|
||||
list_t *data,
|
||||
char *msg,
|
||||
char *trace_id
|
||||
);
|
||||
|
||||
void _api_v1_repos_get_200_response_free(_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response);
|
||||
|
||||
_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response_parseFromJSON(cJSON *_api_v1_repos_get_200_responseJSON);
|
||||
|
||||
cJSON *_api_v1_repos_get_200_response_convertToJSON(_api_v1_repos_get_200_response_t *_api_v1_repos_get_200_response);
|
||||
|
||||
#endif /* __api_v1_repos_get_200_response_H_ */
|
||||
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "apiv2_json_error.h"
|
||||
|
||||
|
||||
|
||||
apiv2_json_error_t *apiv2_json_error_create(
|
||||
int code,
|
||||
list_t* fields,
|
||||
char *msg,
|
||||
char *trace_id
|
||||
) {
|
||||
apiv2_json_error_t *apiv2_json_error_local_var = malloc(sizeof(apiv2_json_error_t));
|
||||
if (!apiv2_json_error_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
apiv2_json_error_local_var->code = code;
|
||||
apiv2_json_error_local_var->fields = fields;
|
||||
apiv2_json_error_local_var->msg = msg;
|
||||
apiv2_json_error_local_var->trace_id = trace_id;
|
||||
|
||||
return apiv2_json_error_local_var;
|
||||
}
|
||||
|
||||
|
||||
void apiv2_json_error_free(apiv2_json_error_t *apiv2_json_error) {
|
||||
if(NULL == apiv2_json_error){
|
||||
return ;
|
||||
}
|
||||
listEntry_t *listEntry;
|
||||
if (apiv2_json_error->fields) {
|
||||
list_ForEach(listEntry, apiv2_json_error->fields) {
|
||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
||||
free (localKeyValue->key);
|
||||
free (localKeyValue->value);
|
||||
keyValuePair_free(localKeyValue);
|
||||
}
|
||||
list_freeList(apiv2_json_error->fields);
|
||||
apiv2_json_error->fields = NULL;
|
||||
}
|
||||
if (apiv2_json_error->msg) {
|
||||
free(apiv2_json_error->msg);
|
||||
apiv2_json_error->msg = NULL;
|
||||
}
|
||||
if (apiv2_json_error->trace_id) {
|
||||
free(apiv2_json_error->trace_id);
|
||||
apiv2_json_error->trace_id = NULL;
|
||||
}
|
||||
free(apiv2_json_error);
|
||||
}
|
||||
|
||||
cJSON *apiv2_json_error_convertToJSON(apiv2_json_error_t *apiv2_json_error) {
|
||||
cJSON *item = cJSON_CreateObject();
|
||||
|
||||
// apiv2_json_error->code
|
||||
if(apiv2_json_error->code) {
|
||||
if(cJSON_AddNumberToObject(item, "code", apiv2_json_error->code) == NULL) {
|
||||
goto fail; //Numeric
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// apiv2_json_error->fields
|
||||
if(apiv2_json_error->fields) {
|
||||
cJSON *fields = cJSON_AddObjectToObject(item, "fields");
|
||||
if(fields == NULL) {
|
||||
goto fail; //primitive map container
|
||||
}
|
||||
cJSON *localMapObject = fields;
|
||||
listEntry_t *fieldsListEntry;
|
||||
if (apiv2_json_error->fields) {
|
||||
list_ForEach(fieldsListEntry, apiv2_json_error->fields) {
|
||||
keyValuePair_t *localKeyValue = (keyValuePair_t*)fieldsListEntry->data;
|
||||
if(cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL)
|
||||
{
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// apiv2_json_error->msg
|
||||
if(apiv2_json_error->msg) {
|
||||
if(cJSON_AddStringToObject(item, "msg", apiv2_json_error->msg) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// apiv2_json_error->trace_id
|
||||
if(apiv2_json_error->trace_id) {
|
||||
if(cJSON_AddStringToObject(item, "trace_id", apiv2_json_error->trace_id) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
fail:
|
||||
if (item) {
|
||||
cJSON_Delete(item);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
apiv2_json_error_t *apiv2_json_error_parseFromJSON(cJSON *apiv2_json_errorJSON){
|
||||
|
||||
apiv2_json_error_t *apiv2_json_error_local_var = NULL;
|
||||
|
||||
// define the local map for apiv2_json_error->fields
|
||||
list_t *fieldsList = NULL;
|
||||
|
||||
// apiv2_json_error->code
|
||||
cJSON *code = cJSON_GetObjectItemCaseSensitive(apiv2_json_errorJSON, "code");
|
||||
if (code) {
|
||||
if(!cJSON_IsNumber(code))
|
||||
{
|
||||
goto end; //Numeric
|
||||
}
|
||||
}
|
||||
|
||||
// apiv2_json_error->fields
|
||||
cJSON *fields = cJSON_GetObjectItemCaseSensitive(apiv2_json_errorJSON, "fields");
|
||||
if (fields) {
|
||||
cJSON *fields_local_map = NULL;
|
||||
if(!cJSON_IsObject(fields) && !cJSON_IsNull(fields))
|
||||
{
|
||||
goto end;//primitive map container
|
||||
}
|
||||
if(cJSON_IsObject(fields))
|
||||
{
|
||||
fieldsList = list_createList();
|
||||
keyValuePair_t *localMapKeyPair;
|
||||
cJSON_ArrayForEach(fields_local_map, fields)
|
||||
{
|
||||
cJSON *localMapObject = fields_local_map;
|
||||
if(!cJSON_IsString(localMapObject))
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
localMapKeyPair = keyValuePair_create(strdup(localMapObject->string),strdup(localMapObject->valuestring));
|
||||
list_addElement(fieldsList , localMapKeyPair);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// apiv2_json_error->msg
|
||||
cJSON *msg = cJSON_GetObjectItemCaseSensitive(apiv2_json_errorJSON, "msg");
|
||||
if (msg) {
|
||||
if(!cJSON_IsString(msg) && !cJSON_IsNull(msg))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
// apiv2_json_error->trace_id
|
||||
cJSON *trace_id = cJSON_GetObjectItemCaseSensitive(apiv2_json_errorJSON, "trace_id");
|
||||
if (trace_id) {
|
||||
if(!cJSON_IsString(trace_id) && !cJSON_IsNull(trace_id))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apiv2_json_error_local_var = apiv2_json_error_create (
|
||||
code ? code->valuedouble : 0,
|
||||
fields ? fieldsList : NULL,
|
||||
msg && !cJSON_IsNull(msg) ? strdup(msg->valuestring) : NULL,
|
||||
trace_id && !cJSON_IsNull(trace_id) ? strdup(trace_id->valuestring) : NULL
|
||||
);
|
||||
|
||||
return apiv2_json_error_local_var;
|
||||
end:
|
||||
if (fieldsList) {
|
||||
listEntry_t *listEntry = NULL;
|
||||
list_ForEach(listEntry, fieldsList) {
|
||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
||||
free(localKeyValue->key);
|
||||
localKeyValue->key = NULL;
|
||||
free(localKeyValue->value);
|
||||
localKeyValue->value = NULL;
|
||||
keyValuePair_free(localKeyValue);
|
||||
localKeyValue = NULL;
|
||||
}
|
||||
list_freeList(fieldsList);
|
||||
fieldsList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* apiv2_json_error.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _apiv2_json_error_H_
|
||||
#define _apiv2_json_error_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
typedef struct apiv2_json_error_t apiv2_json_error_t;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef struct apiv2_json_error_t {
|
||||
int code; //numeric
|
||||
list_t* fields; //map
|
||||
char *msg; // string
|
||||
char *trace_id; // string
|
||||
|
||||
} apiv2_json_error_t;
|
||||
|
||||
apiv2_json_error_t *apiv2_json_error_create(
|
||||
int code,
|
||||
list_t* fields,
|
||||
char *msg,
|
||||
char *trace_id
|
||||
);
|
||||
|
||||
void apiv2_json_error_free(apiv2_json_error_t *apiv2_json_error);
|
||||
|
||||
apiv2_json_error_t *apiv2_json_error_parseFromJSON(cJSON *apiv2_json_errorJSON);
|
||||
|
||||
cJSON *apiv2_json_error_convertToJSON(apiv2_json_error_t *apiv2_json_error);
|
||||
|
||||
#endif /* _apiv2_json_error_H_ */
|
||||
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "apiv2_search_app_response.h"
|
||||
|
||||
|
||||
|
||||
apiv2_search_app_response_t *apiv2_search_app_response_create(
|
||||
int code,
|
||||
list_t *data,
|
||||
char *trace_id
|
||||
) {
|
||||
apiv2_search_app_response_t *apiv2_search_app_response_local_var = malloc(sizeof(apiv2_search_app_response_t));
|
||||
if (!apiv2_search_app_response_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
apiv2_search_app_response_local_var->code = code;
|
||||
apiv2_search_app_response_local_var->data = data;
|
||||
apiv2_search_app_response_local_var->trace_id = trace_id;
|
||||
|
||||
return apiv2_search_app_response_local_var;
|
||||
}
|
||||
|
||||
|
||||
void apiv2_search_app_response_free(apiv2_search_app_response_t *apiv2_search_app_response) {
|
||||
if(NULL == apiv2_search_app_response){
|
||||
return ;
|
||||
}
|
||||
listEntry_t *listEntry;
|
||||
if (apiv2_search_app_response->data) {
|
||||
list_ForEach(listEntry, apiv2_search_app_response->data) {
|
||||
request_register_struct_free(listEntry->data);
|
||||
}
|
||||
list_freeList(apiv2_search_app_response->data);
|
||||
apiv2_search_app_response->data = NULL;
|
||||
}
|
||||
if (apiv2_search_app_response->trace_id) {
|
||||
free(apiv2_search_app_response->trace_id);
|
||||
apiv2_search_app_response->trace_id = NULL;
|
||||
}
|
||||
free(apiv2_search_app_response);
|
||||
}
|
||||
|
||||
cJSON *apiv2_search_app_response_convertToJSON(apiv2_search_app_response_t *apiv2_search_app_response) {
|
||||
cJSON *item = cJSON_CreateObject();
|
||||
|
||||
// apiv2_search_app_response->code
|
||||
if(apiv2_search_app_response->code) {
|
||||
if(cJSON_AddNumberToObject(item, "code", apiv2_search_app_response->code) == NULL) {
|
||||
goto fail; //Numeric
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// apiv2_search_app_response->data
|
||||
if(apiv2_search_app_response->data) {
|
||||
cJSON *data = cJSON_AddArrayToObject(item, "data");
|
||||
if(data == NULL) {
|
||||
goto fail; //nonprimitive container
|
||||
}
|
||||
|
||||
listEntry_t *dataListEntry;
|
||||
if (apiv2_search_app_response->data) {
|
||||
list_ForEach(dataListEntry, apiv2_search_app_response->data) {
|
||||
cJSON *itemLocal = request_register_struct_convertToJSON(dataListEntry->data);
|
||||
if(itemLocal == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
cJSON_AddItemToArray(data, itemLocal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// apiv2_search_app_response->trace_id
|
||||
if(apiv2_search_app_response->trace_id) {
|
||||
if(cJSON_AddStringToObject(item, "trace_id", apiv2_search_app_response->trace_id) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
return item;
|
||||
fail:
|
||||
if (item) {
|
||||
cJSON_Delete(item);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
apiv2_search_app_response_t *apiv2_search_app_response_parseFromJSON(cJSON *apiv2_search_app_responseJSON){
|
||||
|
||||
apiv2_search_app_response_t *apiv2_search_app_response_local_var = NULL;
|
||||
|
||||
// define the local list for apiv2_search_app_response->data
|
||||
list_t *dataList = NULL;
|
||||
|
||||
// apiv2_search_app_response->code
|
||||
cJSON *code = cJSON_GetObjectItemCaseSensitive(apiv2_search_app_responseJSON, "code");
|
||||
if (code) {
|
||||
if(!cJSON_IsNumber(code))
|
||||
{
|
||||
goto end; //Numeric
|
||||
}
|
||||
}
|
||||
|
||||
// apiv2_search_app_response->data
|
||||
cJSON *data = cJSON_GetObjectItemCaseSensitive(apiv2_search_app_responseJSON, "data");
|
||||
if (data) {
|
||||
cJSON *data_local_nonprimitive = NULL;
|
||||
if(!cJSON_IsArray(data)){
|
||||
goto end; //nonprimitive container
|
||||
}
|
||||
|
||||
dataList = list_createList();
|
||||
|
||||
cJSON_ArrayForEach(data_local_nonprimitive,data )
|
||||
{
|
||||
if(!cJSON_IsObject(data_local_nonprimitive)){
|
||||
goto end;
|
||||
}
|
||||
request_register_struct_t *dataItem = request_register_struct_parseFromJSON(data_local_nonprimitive);
|
||||
|
||||
list_addElement(dataList, dataItem);
|
||||
}
|
||||
}
|
||||
|
||||
// apiv2_search_app_response->trace_id
|
||||
cJSON *trace_id = cJSON_GetObjectItemCaseSensitive(apiv2_search_app_responseJSON, "trace_id");
|
||||
if (trace_id) {
|
||||
if(!cJSON_IsString(trace_id) && !cJSON_IsNull(trace_id))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
apiv2_search_app_response_local_var = apiv2_search_app_response_create (
|
||||
code ? code->valuedouble : 0,
|
||||
data ? dataList : NULL,
|
||||
trace_id && !cJSON_IsNull(trace_id) ? strdup(trace_id->valuestring) : NULL
|
||||
);
|
||||
|
||||
return apiv2_search_app_response_local_var;
|
||||
end:
|
||||
if (dataList) {
|
||||
listEntry_t *listEntry = NULL;
|
||||
list_ForEach(listEntry, dataList) {
|
||||
request_register_struct_free(listEntry->data);
|
||||
listEntry->data = NULL;
|
||||
}
|
||||
list_freeList(dataList);
|
||||
dataList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* apiv2_search_app_response.h
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _apiv2_search_app_response_H_
|
||||
#define _apiv2_search_app_response_H_
|
||||
|
||||
#include <string.h>
|
||||
#include "../external/cJSON.h"
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
|
||||
typedef struct apiv2_search_app_response_t apiv2_search_app_response_t;
|
||||
|
||||
#include "request_register_struct.h"
|
||||
|
||||
|
||||
|
||||
typedef struct apiv2_search_app_response_t {
|
||||
int code; //numeric
|
||||
list_t *data; //nonprimitive container
|
||||
char *trace_id; // string
|
||||
|
||||
} apiv2_search_app_response_t;
|
||||
|
||||
apiv2_search_app_response_t *apiv2_search_app_response_create(
|
||||
int code,
|
||||
list_t *data,
|
||||
char *trace_id
|
||||
);
|
||||
|
||||
void apiv2_search_app_response_free(apiv2_search_app_response_t *apiv2_search_app_response);
|
||||
|
||||
apiv2_search_app_response_t *apiv2_search_app_response_parseFromJSON(cJSON *apiv2_search_app_responseJSON);
|
||||
|
||||
cJSON *apiv2_search_app_response_convertToJSON(apiv2_search_app_response_t *apiv2_search_app_response);
|
||||
|
||||
#endif /* _apiv2_search_app_response_H_ */
|
||||
|
||||
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
|
||||
request_fuzzy_search_req_t *request_fuzzy_search_req_create(
|
||||
char *channel,
|
||||
char *app_id,
|
||||
char *arch,
|
||||
char *channel,
|
||||
char *repo_name,
|
||||
char *version
|
||||
) {
|
||||
|
|
@ -16,9 +16,9 @@ request_fuzzy_search_req_t *request_fuzzy_search_req_create(
|
|||
if (!request_fuzzy_search_req_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
request_fuzzy_search_req_local_var->channel = channel;
|
||||
request_fuzzy_search_req_local_var->app_id = app_id;
|
||||
request_fuzzy_search_req_local_var->arch = arch;
|
||||
request_fuzzy_search_req_local_var->channel = channel;
|
||||
request_fuzzy_search_req_local_var->repo_name = repo_name;
|
||||
request_fuzzy_search_req_local_var->version = version;
|
||||
|
||||
|
|
@ -31,10 +31,6 @@ void request_fuzzy_search_req_free(request_fuzzy_search_req_t *request_fuzzy_sea
|
|||
return ;
|
||||
}
|
||||
listEntry_t *listEntry;
|
||||
if (request_fuzzy_search_req->channel) {
|
||||
free(request_fuzzy_search_req->channel);
|
||||
request_fuzzy_search_req->channel = NULL;
|
||||
}
|
||||
if (request_fuzzy_search_req->app_id) {
|
||||
free(request_fuzzy_search_req->app_id);
|
||||
request_fuzzy_search_req->app_id = NULL;
|
||||
|
|
@ -43,6 +39,10 @@ void request_fuzzy_search_req_free(request_fuzzy_search_req_t *request_fuzzy_sea
|
|||
free(request_fuzzy_search_req->arch);
|
||||
request_fuzzy_search_req->arch = NULL;
|
||||
}
|
||||
if (request_fuzzy_search_req->channel) {
|
||||
free(request_fuzzy_search_req->channel);
|
||||
request_fuzzy_search_req->channel = NULL;
|
||||
}
|
||||
if (request_fuzzy_search_req->repo_name) {
|
||||
free(request_fuzzy_search_req->repo_name);
|
||||
request_fuzzy_search_req->repo_name = NULL;
|
||||
|
|
@ -57,14 +57,6 @@ void request_fuzzy_search_req_free(request_fuzzy_search_req_t *request_fuzzy_sea
|
|||
cJSON *request_fuzzy_search_req_convertToJSON(request_fuzzy_search_req_t *request_fuzzy_search_req) {
|
||||
cJSON *item = cJSON_CreateObject();
|
||||
|
||||
// request_fuzzy_search_req->channel
|
||||
if(request_fuzzy_search_req->channel) {
|
||||
if(cJSON_AddStringToObject(item, "channel", request_fuzzy_search_req->channel) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// request_fuzzy_search_req->app_id
|
||||
if(request_fuzzy_search_req->app_id) {
|
||||
if(cJSON_AddStringToObject(item, "appId", request_fuzzy_search_req->app_id) == NULL) {
|
||||
|
|
@ -81,6 +73,14 @@ cJSON *request_fuzzy_search_req_convertToJSON(request_fuzzy_search_req_t *reques
|
|||
}
|
||||
|
||||
|
||||
// request_fuzzy_search_req->channel
|
||||
if(request_fuzzy_search_req->channel) {
|
||||
if(cJSON_AddStringToObject(item, "channel", request_fuzzy_search_req->channel) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// request_fuzzy_search_req->repo_name
|
||||
if(request_fuzzy_search_req->repo_name) {
|
||||
if(cJSON_AddStringToObject(item, "repoName", request_fuzzy_search_req->repo_name) == NULL) {
|
||||
|
|
@ -108,15 +108,6 @@ request_fuzzy_search_req_t *request_fuzzy_search_req_parseFromJSON(cJSON *reques
|
|||
|
||||
request_fuzzy_search_req_t *request_fuzzy_search_req_local_var = NULL;
|
||||
|
||||
// request_fuzzy_search_req->channel
|
||||
cJSON *channel = cJSON_GetObjectItemCaseSensitive(request_fuzzy_search_reqJSON, "channel");
|
||||
if (channel) {
|
||||
if(!cJSON_IsString(channel) && !cJSON_IsNull(channel))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
// request_fuzzy_search_req->app_id
|
||||
cJSON *app_id = cJSON_GetObjectItemCaseSensitive(request_fuzzy_search_reqJSON, "appId");
|
||||
if (app_id) {
|
||||
|
|
@ -135,6 +126,15 @@ request_fuzzy_search_req_t *request_fuzzy_search_req_parseFromJSON(cJSON *reques
|
|||
}
|
||||
}
|
||||
|
||||
// request_fuzzy_search_req->channel
|
||||
cJSON *channel = cJSON_GetObjectItemCaseSensitive(request_fuzzy_search_reqJSON, "channel");
|
||||
if (channel) {
|
||||
if(!cJSON_IsString(channel) && !cJSON_IsNull(channel))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
// request_fuzzy_search_req->repo_name
|
||||
cJSON *repo_name = cJSON_GetObjectItemCaseSensitive(request_fuzzy_search_reqJSON, "repoName");
|
||||
if (repo_name) {
|
||||
|
|
@ -155,9 +155,9 @@ request_fuzzy_search_req_t *request_fuzzy_search_req_parseFromJSON(cJSON *reques
|
|||
|
||||
|
||||
request_fuzzy_search_req_local_var = request_fuzzy_search_req_create (
|
||||
channel && !cJSON_IsNull(channel) ? strdup(channel->valuestring) : NULL,
|
||||
app_id && !cJSON_IsNull(app_id) ? strdup(app_id->valuestring) : NULL,
|
||||
arch && !cJSON_IsNull(arch) ? strdup(arch->valuestring) : NULL,
|
||||
channel && !cJSON_IsNull(channel) ? strdup(channel->valuestring) : NULL,
|
||||
repo_name && !cJSON_IsNull(repo_name) ? strdup(repo_name->valuestring) : NULL,
|
||||
version && !cJSON_IsNull(version) ? strdup(version->valuestring) : NULL
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,18 +19,18 @@ typedef struct request_fuzzy_search_req_t request_fuzzy_search_req_t;
|
|||
|
||||
|
||||
typedef struct request_fuzzy_search_req_t {
|
||||
char *channel; // string
|
||||
char *app_id; // string
|
||||
char *arch; // string
|
||||
char *channel; // string
|
||||
char *repo_name; // string
|
||||
char *version; // string
|
||||
|
||||
} request_fuzzy_search_req_t;
|
||||
|
||||
request_fuzzy_search_req_t *request_fuzzy_search_req_create(
|
||||
char *channel,
|
||||
char *app_id,
|
||||
char *arch,
|
||||
char *channel,
|
||||
char *repo_name,
|
||||
char *version
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,14 +8,16 @@
|
|||
request_register_struct_t *request_register_struct_create(
|
||||
char *app_id,
|
||||
char *arch,
|
||||
char *base,
|
||||
char *channel,
|
||||
char *description,
|
||||
char *id,
|
||||
char *kind,
|
||||
char *module,
|
||||
char *name,
|
||||
char *repo_name,
|
||||
char *runtime,
|
||||
int size,
|
||||
long size,
|
||||
char *uab_url,
|
||||
char *version
|
||||
) {
|
||||
|
|
@ -25,8 +27,10 @@ request_register_struct_t *request_register_struct_create(
|
|||
}
|
||||
request_register_struct_local_var->app_id = app_id;
|
||||
request_register_struct_local_var->arch = arch;
|
||||
request_register_struct_local_var->base = base;
|
||||
request_register_struct_local_var->channel = channel;
|
||||
request_register_struct_local_var->description = description;
|
||||
request_register_struct_local_var->id = id;
|
||||
request_register_struct_local_var->kind = kind;
|
||||
request_register_struct_local_var->module = module;
|
||||
request_register_struct_local_var->name = name;
|
||||
|
|
@ -53,6 +57,10 @@ void request_register_struct_free(request_register_struct_t *request_register_st
|
|||
free(request_register_struct->arch);
|
||||
request_register_struct->arch = NULL;
|
||||
}
|
||||
if (request_register_struct->base) {
|
||||
free(request_register_struct->base);
|
||||
request_register_struct->base = NULL;
|
||||
}
|
||||
if (request_register_struct->channel) {
|
||||
free(request_register_struct->channel);
|
||||
request_register_struct->channel = NULL;
|
||||
|
|
@ -61,6 +69,10 @@ void request_register_struct_free(request_register_struct_t *request_register_st
|
|||
free(request_register_struct->description);
|
||||
request_register_struct->description = NULL;
|
||||
}
|
||||
if (request_register_struct->id) {
|
||||
free(request_register_struct->id);
|
||||
request_register_struct->id = NULL;
|
||||
}
|
||||
if (request_register_struct->kind) {
|
||||
free(request_register_struct->kind);
|
||||
request_register_struct->kind = NULL;
|
||||
|
|
@ -111,6 +123,14 @@ cJSON *request_register_struct_convertToJSON(request_register_struct_t *request_
|
|||
}
|
||||
|
||||
|
||||
// request_register_struct->base
|
||||
if(request_register_struct->base) {
|
||||
if(cJSON_AddStringToObject(item, "base", request_register_struct->base) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// request_register_struct->channel
|
||||
if(request_register_struct->channel) {
|
||||
if(cJSON_AddStringToObject(item, "channel", request_register_struct->channel) == NULL) {
|
||||
|
|
@ -127,6 +147,14 @@ cJSON *request_register_struct_convertToJSON(request_register_struct_t *request_
|
|||
}
|
||||
|
||||
|
||||
// request_register_struct->id
|
||||
if(request_register_struct->id) {
|
||||
if(cJSON_AddStringToObject(item, "id", request_register_struct->id) == NULL) {
|
||||
goto fail; //String
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// request_register_struct->kind
|
||||
if(request_register_struct->kind) {
|
||||
if(cJSON_AddStringToObject(item, "kind", request_register_struct->kind) == NULL) {
|
||||
|
|
@ -220,6 +248,15 @@ request_register_struct_t *request_register_struct_parseFromJSON(cJSON *request_
|
|||
}
|
||||
}
|
||||
|
||||
// request_register_struct->base
|
||||
cJSON *base = cJSON_GetObjectItemCaseSensitive(request_register_structJSON, "base");
|
||||
if (base) {
|
||||
if(!cJSON_IsString(base) && !cJSON_IsNull(base))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
// request_register_struct->channel
|
||||
cJSON *channel = cJSON_GetObjectItemCaseSensitive(request_register_structJSON, "channel");
|
||||
if (channel) {
|
||||
|
|
@ -238,6 +275,15 @@ request_register_struct_t *request_register_struct_parseFromJSON(cJSON *request_
|
|||
}
|
||||
}
|
||||
|
||||
// request_register_struct->id
|
||||
cJSON *id = cJSON_GetObjectItemCaseSensitive(request_register_structJSON, "id");
|
||||
if (id) {
|
||||
if(!cJSON_IsString(id) && !cJSON_IsNull(id))
|
||||
{
|
||||
goto end; //String
|
||||
}
|
||||
}
|
||||
|
||||
// request_register_struct->kind
|
||||
cJSON *kind = cJSON_GetObjectItemCaseSensitive(request_register_structJSON, "kind");
|
||||
if (kind) {
|
||||
|
|
@ -314,8 +360,10 @@ request_register_struct_t *request_register_struct_parseFromJSON(cJSON *request_
|
|||
request_register_struct_local_var = request_register_struct_create (
|
||||
app_id && !cJSON_IsNull(app_id) ? strdup(app_id->valuestring) : NULL,
|
||||
arch && !cJSON_IsNull(arch) ? strdup(arch->valuestring) : NULL,
|
||||
base && !cJSON_IsNull(base) ? strdup(base->valuestring) : NULL,
|
||||
channel && !cJSON_IsNull(channel) ? strdup(channel->valuestring) : NULL,
|
||||
description && !cJSON_IsNull(description) ? strdup(description->valuestring) : NULL,
|
||||
id && !cJSON_IsNull(id) ? strdup(id->valuestring) : NULL,
|
||||
kind && !cJSON_IsNull(kind) ? strdup(kind->valuestring) : NULL,
|
||||
module && !cJSON_IsNull(module) ? strdup(module->valuestring) : NULL,
|
||||
name && !cJSON_IsNull(name) ? strdup(name->valuestring) : NULL,
|
||||
|
|
|
|||
|
|
@ -21,14 +21,16 @@ typedef struct request_register_struct_t request_register_struct_t;
|
|||
typedef struct request_register_struct_t {
|
||||
char *app_id; // string
|
||||
char *arch; // string
|
||||
char *base; // string
|
||||
char *channel; // string
|
||||
char *description; // string
|
||||
char *id; // string
|
||||
char *kind; // string
|
||||
char *module; // string
|
||||
char *name; // string
|
||||
char *repo_name; // string
|
||||
char *runtime; // string
|
||||
int size; //numeric
|
||||
long size; //numeric
|
||||
char *uab_url; // string
|
||||
char *version; // string
|
||||
|
||||
|
|
@ -37,14 +39,16 @@ typedef struct request_register_struct_t {
|
|||
request_register_struct_t *request_register_struct_create(
|
||||
char *app_id,
|
||||
char *arch,
|
||||
char *base,
|
||||
char *channel,
|
||||
char *description,
|
||||
char *id,
|
||||
char *kind,
|
||||
char *module,
|
||||
char *name,
|
||||
char *repo_name,
|
||||
char *runtime,
|
||||
int size,
|
||||
long size,
|
||||
char *uab_url,
|
||||
char *version
|
||||
);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
#ifndef _api_v1_repos_get_200_response_TEST
|
||||
#define _api_v1_repos_get_200_response_TEST
|
||||
|
||||
// the following is to include only the main from the first c file
|
||||
#ifndef TEST_MAIN
|
||||
#define TEST_MAIN
|
||||
#define _api_v1_repos_get_200_response_MAIN
|
||||
#endif // TEST_MAIN
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "../external/cJSON.h"
|
||||
|
||||
#include "../model/_api_v1_repos_get_200_response.h"
|
||||
_api_v1_repos_get_200_response_t* instantiate__api_v1_repos_get_200_response(int include_optional);
|
||||
|
||||
|
||||
|
||||
_api_v1_repos_get_200_response_t* instantiate__api_v1_repos_get_200_response(int include_optional) {
|
||||
_api_v1_repos_get_200_response_t* _api_v1_repos_get_200_response = NULL;
|
||||
if (include_optional) {
|
||||
_api_v1_repos_get_200_response = _api_v1_repos_get_200_response_create(
|
||||
56,
|
||||
list_createList(),
|
||||
"0",
|
||||
"0"
|
||||
);
|
||||
} else {
|
||||
_api_v1_repos_get_200_response = _api_v1_repos_get_200_response_create(
|
||||
56,
|
||||
list_createList(),
|
||||
"0",
|
||||
"0"
|
||||
);
|
||||
}
|
||||
|
||||
return _api_v1_repos_get_200_response;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _api_v1_repos_get_200_response_MAIN
|
||||
|
||||
void test__api_v1_repos_get_200_response(int include_optional) {
|
||||
_api_v1_repos_get_200_response_t* _api_v1_repos_get_200_response_1 = instantiate__api_v1_repos_get_200_response(include_optional);
|
||||
|
||||
cJSON* json_api_v1_repos_get_200_response_1 = _api_v1_repos_get_200_response_convertToJSON(_api_v1_repos_get_200_response_1);
|
||||
printf("_api_v1_repos_get_200_response :\n%s\n", cJSON_Print(json_api_v1_repos_get_200_response_1));
|
||||
_api_v1_repos_get_200_response_t* _api_v1_repos_get_200_response_2 = _api_v1_repos_get_200_response_parseFromJSON(json_api_v1_repos_get_200_response_1);
|
||||
cJSON* json_api_v1_repos_get_200_response_2 = _api_v1_repos_get_200_response_convertToJSON(_api_v1_repos_get_200_response_2);
|
||||
printf("repeating _api_v1_repos_get_200_response:\n%s\n", cJSON_Print(json_api_v1_repos_get_200_response_2));
|
||||
}
|
||||
|
||||
int main() {
|
||||
test__api_v1_repos_get_200_response(1);
|
||||
test__api_v1_repos_get_200_response(0);
|
||||
|
||||
printf("Hello world \n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // _api_v1_repos_get_200_response_MAIN
|
||||
#endif // _api_v1_repos_get_200_response_TEST
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
#ifndef apiv2_json_error_TEST
|
||||
#define apiv2_json_error_TEST
|
||||
|
||||
// the following is to include only the main from the first c file
|
||||
#ifndef TEST_MAIN
|
||||
#define TEST_MAIN
|
||||
#define apiv2_json_error_MAIN
|
||||
#endif // TEST_MAIN
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "../external/cJSON.h"
|
||||
|
||||
#include "../model/apiv2_json_error.h"
|
||||
apiv2_json_error_t* instantiate_apiv2_json_error(int include_optional);
|
||||
|
||||
|
||||
|
||||
apiv2_json_error_t* instantiate_apiv2_json_error(int include_optional) {
|
||||
apiv2_json_error_t* apiv2_json_error = NULL;
|
||||
if (include_optional) {
|
||||
apiv2_json_error = apiv2_json_error_create(
|
||||
56,
|
||||
list_createList(),
|
||||
"0",
|
||||
"0"
|
||||
);
|
||||
} else {
|
||||
apiv2_json_error = apiv2_json_error_create(
|
||||
56,
|
||||
list_createList(),
|
||||
"0",
|
||||
"0"
|
||||
);
|
||||
}
|
||||
|
||||
return apiv2_json_error;
|
||||
}
|
||||
|
||||
|
||||
#ifdef apiv2_json_error_MAIN
|
||||
|
||||
void test_apiv2_json_error(int include_optional) {
|
||||
apiv2_json_error_t* apiv2_json_error_1 = instantiate_apiv2_json_error(include_optional);
|
||||
|
||||
cJSON* jsonapiv2_json_error_1 = apiv2_json_error_convertToJSON(apiv2_json_error_1);
|
||||
printf("apiv2_json_error :\n%s\n", cJSON_Print(jsonapiv2_json_error_1));
|
||||
apiv2_json_error_t* apiv2_json_error_2 = apiv2_json_error_parseFromJSON(jsonapiv2_json_error_1);
|
||||
cJSON* jsonapiv2_json_error_2 = apiv2_json_error_convertToJSON(apiv2_json_error_2);
|
||||
printf("repeating apiv2_json_error:\n%s\n", cJSON_Print(jsonapiv2_json_error_2));
|
||||
}
|
||||
|
||||
int main() {
|
||||
test_apiv2_json_error(1);
|
||||
test_apiv2_json_error(0);
|
||||
|
||||
printf("Hello world \n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // apiv2_json_error_MAIN
|
||||
#endif // apiv2_json_error_TEST
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
#ifndef apiv2_search_app_response_TEST
|
||||
#define apiv2_search_app_response_TEST
|
||||
|
||||
// the following is to include only the main from the first c file
|
||||
#ifndef TEST_MAIN
|
||||
#define TEST_MAIN
|
||||
#define apiv2_search_app_response_MAIN
|
||||
#endif // TEST_MAIN
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "../external/cJSON.h"
|
||||
|
||||
#include "../model/apiv2_search_app_response.h"
|
||||
apiv2_search_app_response_t* instantiate_apiv2_search_app_response(int include_optional);
|
||||
|
||||
|
||||
|
||||
apiv2_search_app_response_t* instantiate_apiv2_search_app_response(int include_optional) {
|
||||
apiv2_search_app_response_t* apiv2_search_app_response = NULL;
|
||||
if (include_optional) {
|
||||
apiv2_search_app_response = apiv2_search_app_response_create(
|
||||
56,
|
||||
list_createList(),
|
||||
"0"
|
||||
);
|
||||
} else {
|
||||
apiv2_search_app_response = apiv2_search_app_response_create(
|
||||
56,
|
||||
list_createList(),
|
||||
"0"
|
||||
);
|
||||
}
|
||||
|
||||
return apiv2_search_app_response;
|
||||
}
|
||||
|
||||
|
||||
#ifdef apiv2_search_app_response_MAIN
|
||||
|
||||
void test_apiv2_search_app_response(int include_optional) {
|
||||
apiv2_search_app_response_t* apiv2_search_app_response_1 = instantiate_apiv2_search_app_response(include_optional);
|
||||
|
||||
cJSON* jsonapiv2_search_app_response_1 = apiv2_search_app_response_convertToJSON(apiv2_search_app_response_1);
|
||||
printf("apiv2_search_app_response :\n%s\n", cJSON_Print(jsonapiv2_search_app_response_1));
|
||||
apiv2_search_app_response_t* apiv2_search_app_response_2 = apiv2_search_app_response_parseFromJSON(jsonapiv2_search_app_response_1);
|
||||
cJSON* jsonapiv2_search_app_response_2 = apiv2_search_app_response_convertToJSON(apiv2_search_app_response_2);
|
||||
printf("repeating apiv2_search_app_response:\n%s\n", cJSON_Print(jsonapiv2_search_app_response_2));
|
||||
}
|
||||
|
||||
int main() {
|
||||
test_apiv2_search_app_response(1);
|
||||
test_apiv2_search_app_response(0);
|
||||
|
||||
printf("Hello world \n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // apiv2_search_app_response_MAIN
|
||||
#endif // apiv2_search_app_response_TEST
|
||||
|
|
@ -31,6 +31,8 @@ request_register_struct_t* instantiate_request_register_struct(int include_optio
|
|||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
56,
|
||||
"0",
|
||||
"0"
|
||||
|
|
@ -46,6 +48,8 @@ request_register_struct_t* instantiate_request_register_struct(int include_optio
|
|||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
"0",
|
||||
56,
|
||||
"0",
|
||||
"0"
|
||||
|
|
|
|||
Loading…
Reference in New Issue