* Added mustache file for namedCredentials * Removed Basic and OAuth from Apex API in favor of NamedCredentials * Moved old README to README for ant deployment * Added SFDX OSS descriptor * Removed remoteSite mustache * Changed package.xml from RemoteSite to NamedCredential * Update ApexClientCodegen to support SFDX and namedCredentials * Created initial README for Salesforce DX * Ran Petstore test for Apex commit * Fixed error in README mustache
9.8 KiB
SwagPetApi
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
addPet(body)
Add a new pet to the store
Example
SwagPetApi api = new SwagPetApi();
SwagClient client = api.getClient();
// Configure OAuth2 access token for authorization: petstore_auth
Swagger.OAuth petstore_auth = (Swagger.OAuth) client.getAuthentication('petstore_auth');
petstore_auth.setAccessToken('YOUR ACCESS TOKEN');
Map<String, Object> params = new Map<String, Object>{
'body' => SwagPet.getExample()
};
try {
// cross your fingers
api.addPet(params);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | SwagPet | Pet object that needs to be added to the store |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
deletePet
deletePet(petId, apiKey)
Deletes a pet
Example
SwagPetApi api = new SwagPetApi();
SwagClient client = api.getClient();
// Configure OAuth2 access token for authorization: petstore_auth
Swagger.OAuth petstore_auth = (Swagger.OAuth) client.getAuthentication('petstore_auth');
petstore_auth.setAccessToken('YOUR ACCESS TOKEN');
Map<String, Object> params = new Map<String, Object>{
'petId' => 2147483648L,
'apiKey' => 'apiKey_example'
};
try {
// cross your fingers
api.deletePet(params);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | Pet id to delete | |
apiKey | String | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
findPetsByStatus
List<SwagPet> findPetsByStatus(status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
Example
SwagPetApi api = new SwagPetApi();
SwagClient client = api.getClient();
// Configure OAuth2 access token for authorization: petstore_auth
Swagger.OAuth petstore_auth = (Swagger.OAuth) client.getAuthentication('petstore_auth');
petstore_auth.setAccessToken('YOUR ACCESS TOKEN');
Map<String, Object> params = new Map<String, Object>{
'status' => new List<String>{'available'}
};
try {
// cross your fingers
List<SwagPet> result = api.findPetsByStatus(params);
System.debug(result);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
status | List<String> | Status values that need to be considered for filter | [enum: available, pending, sold] |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
findPetsByTags
List<SwagPet> findPetsByTags(tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Example
SwagPetApi api = new SwagPetApi();
SwagClient client = api.getClient();
// Configure OAuth2 access token for authorization: petstore_auth
Swagger.OAuth petstore_auth = (Swagger.OAuth) client.getAuthentication('petstore_auth');
petstore_auth.setAccessToken('YOUR ACCESS TOKEN');
Map<String, Object> params = new Map<String, Object>{
'tags' => new List<String>{'aeiou'}
};
try {
// cross your fingers
List<SwagPet> result = api.findPetsByTags(params);
System.debug(result);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
tags | List<String> | Tags to filter by |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
getPetById
SwagPet getPetById(petId)
Find pet by ID
Returns a single pet
Example
SwagPetApi api = new SwagPetApi();
SwagClient client = api.getClient();
// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) client.getAuthentication('api_key');
api_key.setApiKey('YOUR API KEY');
Map<String, Object> params = new Map<String, Object>{
'petId' => 2147483648L
};
try {
// cross your fingers
SwagPet result = api.getPetById(params);
System.debug(result);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | ID of pet to return |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
updatePet
updatePet(body)
Update an existing pet
Example
SwagPetApi api = new SwagPetApi();
SwagClient client = api.getClient();
// Configure OAuth2 access token for authorization: petstore_auth
Swagger.OAuth petstore_auth = (Swagger.OAuth) client.getAuthentication('petstore_auth');
petstore_auth.setAccessToken('YOUR ACCESS TOKEN');
Map<String, Object> params = new Map<String, Object>{
'body' => SwagPet.getExample()
};
try {
// cross your fingers
api.updatePet(params);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
body | SwagPet | Pet object that needs to be added to the store |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
updatePetWithForm
updatePetWithForm(petId, name, status)
Updates a pet in the store with form data
Example
SwagPetApi api = new SwagPetApi();
SwagClient client = api.getClient();
// Configure OAuth2 access token for authorization: petstore_auth
Swagger.OAuth petstore_auth = (Swagger.OAuth) client.getAuthentication('petstore_auth');
petstore_auth.setAccessToken('YOUR ACCESS TOKEN');
Map<String, Object> params = new Map<String, Object>{
'petId' => 2147483648L,
'name' => 'name_example',
'status' => 'status_example'
};
try {
// cross your fingers
api.updatePetWithForm(params);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | ID of pet that needs to be updated | |
name | String | Updated name of the pet | [optional] |
status | String | Updated status of the pet | [optional] |
Return type
null (empty response body)
Authorization
HTTP request headers
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
uploadFile
SwagApiResponse uploadFile(petId, additionalMetadata, file)
uploads an image
Example
SwagPetApi api = new SwagPetApi();
SwagClient client = api.getClient();
// Configure OAuth2 access token for authorization: petstore_auth
Swagger.OAuth petstore_auth = (Swagger.OAuth) client.getAuthentication('petstore_auth');
petstore_auth.setAccessToken('YOUR ACCESS TOKEN');
Map<String, Object> params = new Map<String, Object>{
'petId' => 2147483648L,
'additionalMetadata' => 'additionalMetadata_example',
'file' => Blob.valueOf('Sample text file\nContents')
};
try {
// cross your fingers
SwagApiResponse result = api.uploadFile(params);
System.debug(result);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
petId | Long | ID of pet to update | |
additionalMetadata | String | Additional data to pass to server | [optional] |
file | Blob | file to upload | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json