14 KiB
SWGPetApi
All URIs are relative to http://petstore.swagger.io/v2
Method | HTTP request | Description |
---|---|---|
addPet | POST /pet | Add a new pet to the store |
deletePet | DELETE /pet/{petId} | Deletes a pet |
findPetsByStatus | GET /pet/findByStatus | Finds Pets by status |
findPetsByTags | GET /pet/findByTags | Finds Pets by tags |
getPetById | GET /pet/{petId} | Find pet by ID |
updatePet | PUT /pet | Update an existing pet |
updatePetWithForm | POST /pet/{petId} | Updates a pet in the store with form data |
uploadFile | POST /pet/{petId}/uploadImage | uploads an image |
addPet
-(NSURLSessionTask*) addPetWithPet: (SWGPet*) pet
completionHandler: (void (^)(NSError* error)) handler;
Add a new pet to the store
Example
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
SWGPet* pet = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional)
SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Add a new pet to the store
[apiInstance addPetWithPet:pet
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error calling SWGPetApi->addPet: %@", error);
}
}];
Parameters
Name | Type | Description | Notes |
---|---|---|---|
pet | SWGPet* | Pet object that needs to be added to the store | [optional] |
Return type
void (empty response body)
Authorization
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]
deletePet
-(NSURLSessionTask*) deletePetWithPetId: (NSNumber*) petId
apiKey: (NSString*) apiKey
completionHandler: (void (^)(NSError* error)) handler;
Deletes a pet
Example
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSNumber* petId = @56; // Pet id to delete
NSString* apiKey = @"apiKey_example"; // (optional)
SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Deletes a pet
[apiInstance deletePetWithPetId:petId
apiKey:apiKey
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error calling SWGPetApi->deletePet: %@", error);
}
}];
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | NSNumber* | Pet id to delete | |
apiKey | NSString* | [optional] |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]
findPetsByStatus
-(NSURLSessionTask*) findPetsByStatusWithStatus: (NSArray<NSString*>*) status
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
Finds Pets by status
Multiple status values can be provided with comma separated strings
Example
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSArray<NSString*>* status = @[@"status_example"]; // Status values that need to be considered for filter (optional)
SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Finds Pets by status
[apiInstance findPetsByStatusWithStatus:status
completionHandler: ^(NSArray<SWGPet>* output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error calling SWGPetApi->findPetsByStatus: %@", error);
}
}];
Parameters
Name | Type | Description | Notes |
---|---|---|---|
status | NSArray<NSString>** | Status values that need to be considered for filter | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/xml
[Back to top] [Back to API list] [Back to Model list] [Back to README]
findPetsByTags
-(NSURLSessionTask*) findPetsByTagsWithTags: (NSArray<NSString*>*) tags
completionHandler: (void (^)(NSArray<SWGPet>* output, NSError* error)) handler;
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSArray<NSString*>* tags = @[@"tags_example"]; // Tags to filter by (optional)
SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Finds Pets by tags
[apiInstance findPetsByTagsWithTags:tags
completionHandler: ^(NSArray<SWGPet>* output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error calling SWGPetApi->findPetsByTags: %@", error);
}
}];
Parameters
Name | Type | Description | Notes |
---|---|---|---|
tags | NSArray<NSString>** | Tags to filter by | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/xml
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getPetById
-(NSURLSessionTask*) getPetByIdWithPetId: (NSNumber*) petId
completionHandler: (void (^)(SWGPet* output, NSError* error)) handler;
Find pet by ID
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
Example
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
// Configure API key authorization: (authentication scheme: api_key)
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"api_key"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"api_key"];
NSNumber* petId = @56; // ID of pet that needs to be fetched
SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Find pet by ID
[apiInstance getPetByIdWithPetId:petId
completionHandler: ^(SWGPet* output, NSError* error) {
if (output) {
NSLog(@"%@", output);
}
if (error) {
NSLog(@"Error calling SWGPetApi->getPetById: %@", error);
}
}];
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | NSNumber* | ID of pet that needs to be fetched |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json, application/xml
[Back to top] [Back to API list] [Back to Model list] [Back to README]
updatePet
-(NSURLSessionTask*) updatePetWithPet: (SWGPet*) pet
completionHandler: (void (^)(NSError* error)) handler;
Update an existing pet
Example
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
SWGPet* pet = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional)
SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Update an existing pet
[apiInstance updatePetWithPet:pet
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error calling SWGPetApi->updatePet: %@", error);
}
}];
Parameters
Name | Type | Description | Notes |
---|---|---|---|
pet | SWGPet* | Pet object that needs to be added to the store | [optional] |
Return type
void (empty response body)
Authorization
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]
updatePetWithForm
-(NSURLSessionTask*) updatePetWithFormWithPetId: (NSString*) petId
name: (NSString*) name
status: (NSString*) status
completionHandler: (void (^)(NSError* error)) handler;
Updates a pet in the store with form data
Example
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSString* petId = @"petId_example"; // ID of pet that needs to be updated
NSString* name = @"name_example"; // Updated name of the pet (optional)
NSString* status = @"status_example"; // Updated status of the pet (optional)
SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// Updates a pet in the store with form data
[apiInstance updatePetWithFormWithPetId:petId
name:name
status:status
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error calling SWGPetApi->updatePetWithForm: %@", error);
}
}];
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | NSString* | ID of pet that needs to be updated | |
name | NSString* | Updated name of the pet | [optional] |
status | NSString* | Updated status of the pet | [optional] |
Return type
void (empty response body)
Authorization
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]
uploadFile
-(NSURLSessionTask*) uploadFileWithPetId: (NSNumber*) petId
additionalMetadata: (NSString*) additionalMetadata
file: (NSURL*) file
completionHandler: (void (^)(NSError* error)) handler;
uploads an image
Example
SWGDefaultConfiguration *apiConfig = [SWGDefaultConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
NSNumber* petId = @56; // ID of pet to update
NSString* additionalMetadata = @"additionalMetadata_example"; // Additional data to pass to server (optional)
NSURL* file = [NSURL fileURLWithPath:@"/path/to/file"]; // file to upload (optional)
SWGPetApi*apiInstance = [[SWGPetApi alloc] init];
// uploads an image
[apiInstance uploadFileWithPetId:petId
additionalMetadata:additionalMetadata
file:file
completionHandler: ^(NSError* error) {
if (error) {
NSLog(@"Error calling SWGPetApi->uploadFile: %@", error);
}
}];
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | NSNumber* | ID of pet to update | |
additionalMetadata | NSString* | Additional data to pass to server | [optional] |
file | NSURLNSURL | file to upload | [optional] |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: multipart/form-data
- Accept: Not defined
[Back to top] [Back to API list] [Back to Model list] [Back to README]