Ernesto Fernández b7c7ed087f
Fix a few issues with the C generator (part 4) (#20289)
* [C] Deal with binary api parameters

With this change, the bodyParameters array can also be binary, so pass
its length around instead of relying on strlen().

* [C] Fix a few remaining enum issues

* [C] Install headers and include any_type.h header

* [C] Don't require C++ to compile C code

* [C] Test binary bodies and path enums in schemas

* Update samples

---------

Co-authored-by: Sam Bingner <sam@corellium.com>
2024-12-13 02:01:04 +08:00

12 KiB

PetAPI

All URIs are relative to http://petstore.swagger.io/v2

Method HTTP request Description
PetAPI_addPet POST /pet Add a new pet to the store
PetAPI_deletePet DELETE /pet/{petId} Deletes a pet
PetAPI_findPetsByStatus GET /pet/findByStatus Finds Pets by status
PetAPI_findPetsByTags GET /pet/findByTags Finds Pets by tags
PetAPI_getDaysWithoutIncident GET /store/daysWithoutIncident Number of days since the last time a pet maimed someone at the store
PetAPI_getPetById GET /pet/{petId} Find pet by ID
PetAPI_getPicture GET /pet/picture Get a random picture of someone else's pet
PetAPI_isPetAvailable POST /pet/{petId}/isAvailable Is this pet still available?
PetAPI_sharePicture POST /pet/picture Send a picture of your happy pet
PetAPI_specialtyPet GET /pet/specialty Specialty of the shop
PetAPI_updatePet PUT /pet Update an existing pet
PetAPI_updatePetWithForm POST /pet/{petId} Updates a pet in the store with form data
PetAPI_uploadFile POST /pet/{petId}/uploadImage uploads an image

PetAPI_addPet

// Add a new pet to the store
//
void PetAPI_addPet(apiClient_t *apiClient, pet_t *body);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
body pet_t * Pet object that needs to be added to the store

Return type

void

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_deletePet

// Deletes a pet
//
void PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
petId long Pet id to delete
api_key char * [optional]

Return type

void

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_findPetsByStatus

// Finds Pets by status
//
// Multiple status values can be provided with comma separated strings
//
list_t* PetAPI_findPetsByStatus(apiClient_t *apiClient, list_t *status);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
status list_t * Status values that need to be considered for filter

Return type

list_t *

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_findPetsByTags

// Finds Pets by tags
//
// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
//
list_t* PetAPI_findPetsByTags(apiClient_t *apiClient, list_t *tags);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
tags list_t * Tags to filter by

Return type

list_t *

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_getDaysWithoutIncident

// Number of days since the last time a pet maimed someone at the store
//
int* PetAPI_getDaysWithoutIncident(apiClient_t *apiClient);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration

Return type

int*

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_getPetById

// Find pet by ID
//
// Returns a single pet
//
pet_t* PetAPI_getPetById(apiClient_t *apiClient, long petId);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
petId long ID of pet to return

Return type

pet_t *

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_getPicture

// Get a random picture of someone else's pet
//
binary_t** PetAPI_getPicture(apiClient_t *apiClient);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration

Return type

binary_t**

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_isPetAvailable

// Is this pet still available?
//
bit_t* PetAPI_isPetAvailable(apiClient_t *apiClient, long petId);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
petId long ID of pet to check

Return type

bit_t *

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_sharePicture

// Send a picture of your happy pet
//
char* PetAPI_sharePicture(apiClient_t *apiClient, binary_t* picture);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
picture binary_t* A picture you want to share

Return type

char*

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_specialtyPet

// Specialty of the shop
//
// Returns the kind of pet the store specializes in
//
preference_t* PetAPI_specialtyPet(apiClient_t *apiClient);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration

Return type

preference_t *

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_updatePet

// Update an existing pet
//
void PetAPI_updatePet(apiClient_t *apiClient, pet_t *body);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
body pet_t * Pet object that needs to be added to the store

Return type

void

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_updatePetWithForm

// Updates a pet in the store with form data
//
void PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, char *status);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
petId long ID of pet that needs to be updated
name char * Updated name of the pet [optional]
status char * Updated status of the pet [optional]

Return type

void

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: Not defined

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PetAPI_uploadFile

// uploads an image
//
api_response_t* PetAPI_uploadFile(apiClient_t *apiClient, long petId, char *additionalMetadata, binary_t* file);

Parameters

Name Type Description Notes
apiClient apiClient_t * context containing the client configuration
petId long ID of pet to update
additionalMetadata char * Additional data to pass to server [optional]
file binary_t* file to upload [optional]

Return type

api_response_t *

Authorization

petstore_auth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]