6.9 KiB

SWGStoreApi

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

-(NSNumber*) deleteOrderWithOrderId: (NSString*) orderId
        completionHandler: (void (^)(NSError* error)) handler;

Delete purchase order by ID

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

Example


NSString* orderId = @"orderId_example"; // ID of the order that needs to be deleted

@try
{ 
    SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init];

    // Delete purchase order by ID
    [apiInstance deleteOrderWithOrderId:orderId
              completionHandler: ^(NSError* error) {
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
}
@catch (NSException *exception)
{
    NSLog(@"Exception when calling SWGStoreApi->deleteOrder: %@ ", exception.name);
    NSLog(@"Reason: %@ ", exception.reason);
}

Parameters

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

Return type

void (empty response body)

Authorization

No authorization required

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]

getInventory

-(NSNumber*) getInventoryWithCompletionHandler: 
        (void (^)(NSDictionary<NSString*, NSNumber*>* output, NSError* error)) handler;

Returns pet inventories by status

Returns a map of status codes to quantities

Example

SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];

// 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"];



@try
{ 
    SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init];

    // Returns pet inventories by status
    [apiInstance getInventoryWithCompletionHandler: 
              ^(NSDictionary<NSString*, NSNumber*>* output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
}
@catch (NSException *exception)
{
    NSLog(@"Exception when calling SWGStoreApi->getInventory: %@ ", exception.name);
    NSLog(@"Reason: %@ ", exception.reason);
}

Parameters

This endpoint does not need any parameter.

Return type

NSDictionary<NSString, NSNumber>***

Authorization

api_key

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]

getOrderById

-(NSNumber*) getOrderByIdWithOrderId: (NSString*) orderId
        completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;

Find purchase order by ID

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

Example


NSString* orderId = @"orderId_example"; // ID of pet that needs to be fetched

@try
{ 
    SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init];

    // Find purchase order by ID
    [apiInstance getOrderByIdWithOrderId:orderId
              completionHandler: ^(SWGOrder* output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
}
@catch (NSException *exception)
{
    NSLog(@"Exception when calling SWGStoreApi->getOrderById: %@ ", exception.name);
    NSLog(@"Reason: %@ ", exception.reason);
}

Parameters

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

Return type

SWGOrder*

Authorization

No authorization required

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]

placeOrder

-(NSNumber*) placeOrderWithBody: (SWGOrder*) body
        completionHandler: (void (^)(SWGOrder* output, NSError* error)) handler;

Place an order for a pet

Example


SWGOrder* body = [[SWGOrder alloc] init]; // order placed for purchasing the pet (optional)

@try
{ 
    SWGStoreApi *apiInstance = [[SWGStoreApi alloc] init];

    // Place an order for a pet
    [apiInstance placeOrderWithBody:body
              completionHandler: ^(SWGOrder* output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];
}
@catch (NSException *exception)
{
    NSLog(@"Exception when calling SWGStoreApi->placeOrder: %@ ", exception.name);
    NSLog(@"Reason: %@ ", exception.reason);
}

Parameters

Name Type Description Notes
body SWGOrder* order placed for purchasing the pet [optional]

Return type

SWGOrder*

Authorization

No authorization required

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]