forked from loafle/openapi-generator-original
* [C] Deprecate *_create() to avoid *_free() confusion The behaviour of *_free() doesn't match *_create(), so the user should avoid using them together. But they still need *_free() to clean up library-allocated objects, so add a _library_owned flag to each struct as an attempt to tell them apart. This isn't perfect though, because the user may neglect to zero the field, but they would still see a warning once in a while so it serves its purpose. To prevent the new deprecation warnings (intended for the user) from showing up during the library build itself, define a new family of *_create_internal() functions, and turn *_create() into simple wrappers. * Update samples * add eafer to c technical committee --------- Co-authored-by: William Cheng <wing328hk@gmail.com>
43 lines
883 B
C
43 lines
883 B
C
/*
|
|
* api_response.h
|
|
*
|
|
* Describes the result of uploading an image resource
|
|
*/
|
|
|
|
#ifndef _api_response_H_
|
|
#define _api_response_H_
|
|
|
|
#include <string.h>
|
|
#include "../external/cJSON.h"
|
|
#include "../include/list.h"
|
|
#include "../include/keyValuePair.h"
|
|
#include "../include/binary.h"
|
|
|
|
typedef struct api_response_t api_response_t;
|
|
|
|
|
|
|
|
|
|
typedef struct api_response_t {
|
|
int code; //numeric
|
|
char *type; // string
|
|
char *message; // string
|
|
|
|
int _library_owned; // Is the library responsible for freeing this object?
|
|
} api_response_t;
|
|
|
|
__attribute__((deprecated)) api_response_t *api_response_create(
|
|
int code,
|
|
char *type,
|
|
char *message
|
|
);
|
|
|
|
void api_response_free(api_response_t *api_response);
|
|
|
|
api_response_t *api_response_parseFromJSON(cJSON *api_responseJSON);
|
|
|
|
cJSON *api_response_convertToJSON(api_response_t *api_response);
|
|
|
|
#endif /* _api_response_H_ */
|
|
|