Re-generate the client to merge the progress function support from openapi-generator PR#7974

This commit is contained in:
Hui Yu
2020-11-26 20:45:39 +08:00
parent 3bdbebcae6
commit 77f227d59e
2 changed files with 17 additions and 0 deletions

View File

@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <curl/curl.h>
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
@@ -24,6 +25,8 @@ typedef struct apiClient_t {
void *dataReceived;
long dataReceivedLen;
void (*data_callback_func)(void **, long *);
int (*progress_func)(void *, curl_off_t, curl_off_t, curl_off_t, curl_off_t);
void *progress_data;
long response_code;
list_t *apiKeys_BearerToken;
} apiClient_t;

View File

@@ -13,6 +13,8 @@ apiClient_t *apiClient_create() {
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
apiClient->data_callback_func = NULL;
apiClient->progress_func = NULL;
apiClient->progress_data = NULL;
apiClient->response_code = 0;
apiClient->apiKeys_BearerToken = NULL;
@@ -39,6 +41,8 @@ apiClient_t *apiClient_create_with_base_path(const char *basePath
apiClient->dataReceived = NULL;
apiClient->dataReceivedLen = 0;
apiClient->data_callback_func = NULL;
apiClient->progress_func = NULL;
apiClient->progress_data = NULL;
apiClient->response_code = 0;
if(apiKeys_BearerToken!= NULL) {
apiClient->apiKeys_BearerToken = list_create();
@@ -60,6 +64,8 @@ void apiClient_free(apiClient_t *apiClient) {
free(apiClient->basePath);
}
apiClient->data_callback_func = NULL;
apiClient->progress_func = NULL;
apiClient->progress_data = NULL;
if(apiClient->apiKeys_BearerToken) {
listEntry_t *listEntry = NULL;
list_ForEach(listEntry, apiClient->apiKeys_BearerToken) {
@@ -383,6 +389,14 @@ void apiClient_invoke(apiClient_t *apiClient,
}
}
if (apiClient->progress_func != NULL) {
curl_easy_setopt(handle, CURLOPT_XFERINFOFUNCTION, apiClient->progress_func);
if (apiClient->progress_data != NULL) {
curl_easy_setopt(handle, CURLOPT_XFERINFODATA, apiClient->progress_data);
}
curl_easy_setopt(handle, CURLOPT_NOPROGRESS, 0L);
}
// this would only be generated for apiKey authentication
if (apiClient->apiKeys_BearerToken != NULL)
{