René Winkelmeyer 3d97d83f7a Apex update for NamedCredentials and Salesforce DX (#5717)
* 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
2017-05-29 11:16:06 +08:00

4.0 KiB

SwagStoreApi

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

Method HTTP request Description
deleteOrder DELETE /store/order/{orderId} Delete purchase order by ID
getInventory GET /store/inventory Returns pet inventories by status
getOrderById GET /store/order/{orderId} Find purchase order by ID
placeOrder POST /store/order Place an order for a pet

deleteOrder

deleteOrder(orderId)

Delete purchase order by ID

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

Example

SwagStoreApi api = new SwagStoreApi();

Map<String, Object> params = new Map<String, Object>{
    'orderId' => 'orderId_example'
};

try {
    // cross your fingers
    api.deleteOrder(params);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
orderId String ID of the order that needs to be deleted

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

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

getInventory

Map<String, Integer> getInventory()

Returns pet inventories by status

Returns a map of status codes to quantities

Example

SwagStoreApi api = new SwagStoreApi();
SwagClient client = api.getClient();

// Configure API key authorization: api_key
ApiKeyAuth api_key = (ApiKeyAuth) client.getAuthentication('api_key');
api_key.setApiKey('YOUR API KEY');

try {
    // cross your fingers
    Map<String, Integer> result = api.getInventory();
    System.debug(result);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

This endpoint does not need any parameter.

Return type

Map<String, Integer>

Authorization

api_key

HTTP request headers

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

getOrderById

SwagOrder getOrderById(orderId)

Find purchase order by ID

For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions

Example

SwagStoreApi api = new SwagStoreApi();

Map<String, Object> params = new Map<String, Object>{
    'orderId' => 2147483648L
};

try {
    // cross your fingers
    SwagOrder result = api.getOrderById(params);
    System.debug(result);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
orderId Long ID of pet that needs to be fetched

Return type

SwagOrder

Authorization

No authorization required

HTTP request headers

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

placeOrder

SwagOrder placeOrder(body)

Place an order for a pet

Example

SwagStoreApi api = new SwagStoreApi();

Map<String, Object> params = new Map<String, Object>{
    'body' => SwagOrder.getExample()
};

try {
    // cross your fingers
    SwagOrder result = api.placeOrder(params);
    System.debug(result);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
body SwagOrder order placed for purchasing the pet

Return type

SwagOrder

Authorization

No authorization required

HTTP request headers

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