Hemant Zope 3be4902444 [C] C generator refactored (#2463)
* New modified model header and body mustache for c client generator

* remove uncrustify from cmake as it is used during code generation, also remove valgrind as it is not used

* add function to encode and decode binary data

* update model mustache

* update api body and header mustache for handling all types of parameters

* update model mustache with variable names and address few more issues to generate working codes

* updated api body and header mustaches with support for various new parameters and fix some issues as per new changes in code flow structure

* update apiClient header and body mustache as per new modifications for handling binary data and few more stuff

* updated samples generated by new modified mustache

* update handling of file and binary data type to binary_t

* update samples with recent commit on master regarding c-generator

* update cmakelist which was ignored by .openapi-generator-ignore, cleanup external folder

* update CMakeList mustache to show how to use compiled libary to compile source files

* update samples with new cmake

* Add comments explaining what each command is doing inshort

* remove freeing of base path as it is not memory allocated

* update samples to free apiclient object when the requirement is over

* add missing cJSON delete to fix memory not freed bugs

* use uncrustify to beautify manual written test code
2019-04-15 11:27:34 +08:00

42 lines
1.1 KiB
C

#ifndef INCLUDE_API_CLIENT_H
#define INCLUDE_API_CLIENT_H
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include "../include/list.h"
#include "../include/keyValuePair.h"
typedef struct apiClient_t {
char *basePath;
void *dataReceived;
long response_code;
list_t *apiKeys;
char *accessToken;
} apiClient_t;
typedef struct binary_t {
uint8_t *data;
unsigned int len;
} binary_t;
apiClient_t *apiClient_create();
void apiClient_free(apiClient_t *apiClient);
void apiClient_invoke(apiClient_t *apiClient, char *operationParameter,
list_t *queryParameters, list_t *headerParameters,
list_t *formParameters, list_t *headerType,
list_t *contentType, char *bodyParameters,
char *requestType);
char *strReplace(char *orig, char *rep, char *with);
char *base64encode(const void *b64_encode_this, int encode_this_many_bytes);
char *base64decode(const void *b64_decode_this, int decode_this_many_bytes);
#endif // INCLUDE_API_CLIENT_H