Skip to content

Commit bee42a1

Browse files
committed
chore(samples): Regenerate all C samples with template fix
Regenerated all C sample variants to include the UUID path parameter example.
1 parent 92ef959 commit bee42a1

4 files changed

Lines changed: 133 additions & 0 deletions

File tree

samples/client/petstore/c-useJsonUnformatted/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Category | Method | HTTP request | Description
7171
*PetAPI* | [**PetAPI_findPetsByTags**](docs/PetAPI.md#PetAPI_findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
7272
*PetAPI* | [**PetAPI_getDaysWithoutIncident**](docs/PetAPI.md#PetAPI_getDaysWithoutIncident) | **GET** /store/daysWithoutIncident | Number of days since the last time a pet maimed someone at the store
7373
*PetAPI* | [**PetAPI_getPetById**](docs/PetAPI.md#PetAPI_getPetById) | **GET** /pet/{petId} | Find pet by ID
74+
*PetAPI* | [**PetAPI_getPetByUuid**](docs/PetAPI.md#PetAPI_getPetByUuid) | **GET** /pet/byUuid/{uuid} | Find pet by UUID
7475
*PetAPI* | [**PetAPI_getPicture**](docs/PetAPI.md#PetAPI_getPicture) | **GET** /pet/picture | Get a random picture of someone else's pet
7576
*PetAPI* | [**PetAPI_isPetAvailable**](docs/PetAPI.md#PetAPI_isPetAvailable) | **POST** /pet/{petId}/isAvailable | Is this pet still available?
7677
*PetAPI* | [**PetAPI_sharePicture**](docs/PetAPI.md#PetAPI_sharePicture) | **POST** /pet/picture | Send a picture of your happy pet

samples/client/petstore/c-useJsonUnformatted/api/PetAPI.c

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,98 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId)
548548

549549
}
550550

551+
// Find pet by UUID
552+
//
553+
// Returns a single pet identified by UUID
554+
//
555+
pet_t*
556+
PetAPI_getPetByUuid(apiClient_t *apiClient, char *uuid)
557+
{
558+
list_t *localVarQueryParameters = NULL;
559+
list_t *localVarHeaderParameters = NULL;
560+
list_t *localVarFormParameters = NULL;
561+
list_t *localVarHeaderType = list_createList();
562+
list_t *localVarContentType = NULL;
563+
char *localVarBodyParameters = NULL;
564+
size_t localVarBodyLength = 0;
565+
566+
// clear the error code from the previous api call
567+
apiClient->response_code = 0;
568+
569+
// create the path
570+
char *localVarPath = strdup("/pet/byUuid/{uuid}");
571+
572+
if(!uuid)
573+
goto end;
574+
575+
576+
// Path Params
577+
long sizeOfPathParams_uuid = strlen(uuid)+3 + sizeof("{ uuid }") - 1;
578+
if(uuid == NULL) {
579+
goto end;
580+
}
581+
char* localVarToReplace_uuid = malloc(sizeOfPathParams_uuid);
582+
sprintf(localVarToReplace_uuid, "{%s}", "uuid");
583+
584+
localVarPath = strReplace(localVarPath, localVarToReplace_uuid, uuid);
585+
586+
587+
list_addElement(localVarHeaderType,"application/xml"); //produces
588+
list_addElement(localVarHeaderType,"application/json"); //produces
589+
apiClient_invoke(apiClient,
590+
localVarPath,
591+
localVarQueryParameters,
592+
localVarHeaderParameters,
593+
localVarFormParameters,
594+
localVarHeaderType,
595+
localVarContentType,
596+
localVarBodyParameters,
597+
localVarBodyLength,
598+
"GET");
599+
600+
// uncomment below to debug the error response
601+
//if (apiClient->response_code == 200) {
602+
// printf("%s\n","successful operation");
603+
//}
604+
// uncomment below to debug the error response
605+
//if (apiClient->response_code == 400) {
606+
// printf("%s\n","Invalid UUID supplied");
607+
//}
608+
// uncomment below to debug the error response
609+
//if (apiClient->response_code == 404) {
610+
// printf("%s\n","Pet not found");
611+
//}
612+
//nonprimitive not container
613+
pet_t *elementToReturn = NULL;
614+
if(apiClient->response_code >= 200 && apiClient->response_code < 300) {
615+
cJSON *PetAPIlocalVarJSON = cJSON_Parse(apiClient->dataReceived);
616+
elementToReturn = pet_parseFromJSON(PetAPIlocalVarJSON);
617+
cJSON_Delete(PetAPIlocalVarJSON);
618+
if(elementToReturn == NULL) {
619+
// return 0;
620+
}
621+
}
622+
623+
//return type
624+
if (apiClient->dataReceived) {
625+
free(apiClient->dataReceived);
626+
apiClient->dataReceived = NULL;
627+
apiClient->dataReceivedLen = 0;
628+
}
629+
630+
631+
632+
list_freeList(localVarHeaderType);
633+
634+
free(localVarPath);
635+
free(localVarToReplace_uuid);
636+
return elementToReturn;
637+
end:
638+
free(localVarPath);
639+
return NULL;
640+
641+
}
642+
551643
// Get a random picture of someone else's pet
552644
//
553645
binary_t*

samples/client/petstore/c-useJsonUnformatted/api/PetAPI.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ pet_t*
5656
PetAPI_getPetById(apiClient_t *apiClient, long petId);
5757

5858

59+
// Find pet by UUID
60+
//
61+
// Returns a single pet identified by UUID
62+
//
63+
pet_t*
64+
PetAPI_getPetByUuid(apiClient_t *apiClient, char *uuid);
65+
66+
5967
// Get a random picture of someone else's pet
6068
//
6169
binary_t*

samples/client/petstore/c-useJsonUnformatted/docs/PetAPI.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Method | HTTP request | Description
1010
[**PetAPI_findPetsByTags**](PetAPI.md#PetAPI_findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
1111
[**PetAPI_getDaysWithoutIncident**](PetAPI.md#PetAPI_getDaysWithoutIncident) | **GET** /store/daysWithoutIncident | Number of days since the last time a pet maimed someone at the store
1212
[**PetAPI_getPetById**](PetAPI.md#PetAPI_getPetById) | **GET** /pet/{petId} | Find pet by ID
13+
[**PetAPI_getPetByUuid**](PetAPI.md#PetAPI_getPetByUuid) | **GET** /pet/byUuid/{uuid} | Find pet by UUID
1314
[**PetAPI_getPicture**](PetAPI.md#PetAPI_getPicture) | **GET** /pet/picture | Get a random picture of someone else&#39;s pet
1415
[**PetAPI_isPetAvailable**](PetAPI.md#PetAPI_isPetAvailable) | **POST** /pet/{petId}/isAvailable | Is this pet still available?
1516
[**PetAPI_sharePicture**](PetAPI.md#PetAPI_sharePicture) | **POST** /pet/picture | Send a picture of your happy pet
@@ -187,6 +188,37 @@ Name | Type | Description | Notes
187188
[pet_t](pet.md) *
188189

189190

191+
### Authorization
192+
193+
[api_key](../README.md#api_key)
194+
195+
### HTTP request headers
196+
197+
- **Content-Type**: Not defined
198+
- **Accept**: application/xml, application/json
199+
200+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
201+
202+
# **PetAPI_getPetByUuid**
203+
```c
204+
// Find pet by UUID
205+
//
206+
// Returns a single pet identified by UUID
207+
//
208+
pet_t* PetAPI_getPetByUuid(apiClient_t *apiClient, char *uuid);
209+
```
210+
211+
### Parameters
212+
Name | Type | Description | Notes
213+
------------- | ------------- | ------------- | -------------
214+
**apiClient** | **apiClient_t \*** | context containing the client configuration |
215+
**uuid** | **char \*** | UUID of pet to return |
216+
217+
### Return type
218+
219+
[pet_t](pet.md) *
220+
221+
190222
### Authorization
191223
192224
[api_key](../README.md#api_key)

0 commit comments

Comments
 (0)