.. | ||
SwaggerClient | ||
SwaggerClientTests | ||
.gitignore | ||
git_push.sh | ||
README.md | ||
SwaggerClient.podspec |
SwaggerClient
This is a sample server Petstore server. You can find out more about Swagger at <a href="http://swagger.io">http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key "special-key" to test the authorization filters
This ObjC package is automatically generated by the Swagger Codegen project:
- API version: 1.0.0
- Package version:
- Build date: 2016-04-12T15:30:12.334+08:00
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
Requirements
The SDK requires ARC (Automatic Reference Counting) to be enabled in the Xcode project.
Installation & Usage
Install from Github using CocoaPods
Add the following to the Podfile:
pod 'SwaggerClient', :git => 'https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git'
To specify a particular branch, append , :branch => 'branch-name-here'
To specify a particular commit, append , :commit => '11aa22'
Install from local path using CocoaPods
Put the SDK under your project folder (e.g. /path/to/objc_project/Vendor/SwaggerClient) and then add the following to the Podfile:
pod 'SwaggerClient', :path => 'Vendor/SwaggerClient'
Usage
Import the following:
#import <SwaggerClient/SWGApiClient.h>
#import <SwaggerClient/SWGConfiguration.h>
// load models
#import <SwaggerClient/SWG200Response.h>
#import <SwaggerClient/SWGAnimal.h>
#import <SwaggerClient/SWGCat.h>
#import <SwaggerClient/SWGCategory.h>
#import <SwaggerClient/SWGDog.h>
#import <SwaggerClient/SWGFormatTest.h>
#import <SwaggerClient/SWGInlineResponse200.h>
#import <SwaggerClient/SWGName.h>
#import <SwaggerClient/SWGOrder.h>
#import <SwaggerClient/SWGPet.h>
#import <SwaggerClient/SWGReturn.h>
#import <SwaggerClient/SWGSpecialModelName_.h>
#import <SwaggerClient/SWGTag.h>
#import <SwaggerClient/SWGUser.h>
// load API classes for accessing endpoints
#import <SwaggerClient/SWGPetApi.h>
#import <SwaggerClient/SWGStoreApi.h>
#import <SwaggerClient/SWGUserApi.h>
Recommendation
It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issue.
Getting Started
Please follow the installation procedure and then run the following:
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
SWGPet* *body = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional)
@try
{
SWGPetApi *apiInstance = [[SWGPetApi alloc] init];
// Add a new pet to the store
[apiInstance addPetWithBody:body
completionHandler: ^(NSError* error)) {
if (error) {
NSLog(@"Error: %@", error);
}
}];
}
@catch (NSException *exception)
{
NSLog(@"Exception when calling SWGPetApi->addPet: %@ ", exception.name);
NSLog(@"Reason: %@ ", exception.reason);
}
Documentation for API Endpoints
All URIs are relative to http://petstore.swagger.io/v2
Class | Method | HTTP request | Description |
---|---|---|---|
SWGPetApi | addPet | POST /pet | Add a new pet to the store |
SWGPetApi | addPetUsingByteArray | POST /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store |
SWGPetApi | deletePet | DELETE /pet/{petId} | Deletes a pet |
SWGPetApi | findPetsByStatus | GET /pet/findByStatus | Finds Pets by status |
SWGPetApi | findPetsByTags | GET /pet/findByTags | Finds Pets by tags |
SWGPetApi | getPetById | GET /pet/{petId} | Find pet by ID |
SWGPetApi | getPetByIdInObject | GET /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' |
SWGPetApi | petPetIdtestingByteArraytrueGet | GET /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' |
SWGPetApi | updatePet | PUT /pet | Update an existing pet |
SWGPetApi | updatePetWithForm | POST /pet/{petId} | Updates a pet in the store with form data |
SWGPetApi | uploadFile | POST /pet/{petId}/uploadImage | uploads an image |
SWGStoreApi | deleteOrder | DELETE /store/order/{orderId} | Delete purchase order by ID |
SWGStoreApi | findOrdersByStatus | GET /store/findByStatus | Finds orders by status |
SWGStoreApi | getInventory | GET /store/inventory | Returns pet inventories by status |
SWGStoreApi | getInventoryInObject | GET /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' |
SWGStoreApi | getOrderById | GET /store/order/{orderId} | Find purchase order by ID |
SWGStoreApi | placeOrder | POST /store/order | Place an order for a pet |
SWGUserApi | createUser | POST /user | Create user |
SWGUserApi | createUsersWithArrayInput | POST /user/createWithArray | Creates list of users with given input array |
SWGUserApi | createUsersWithListInput | POST /user/createWithList | Creates list of users with given input array |
SWGUserApi | deleteUser | DELETE /user/{username} | Delete user |
SWGUserApi | getUserByName | GET /user/{username} | Get user by user name |
SWGUserApi | loginUser | GET /user/login | Logs user into the system |
SWGUserApi | logoutUser | GET /user/logout | Logs out current logged in user session |
SWGUserApi | updateUser | PUT /user/{username} | Updated user |
Documentation For Models
- SWG200Response
- SWGAnimal
- SWGCat
- SWGCategory
- SWGDog
- SWGFormatTest
- SWGInlineResponse200
- SWGName
- SWGOrder
- SWGPet
- SWGReturn
- SWGSpecialModelName_
- SWGTag
- SWGUser
Documentation For Authorization
test_api_key_header
- Type: API key
- API key parameter name: test_api_key_header
- Location: HTTP header
api_key
- Type: API key
- API key parameter name: api_key
- Location: HTTP header
test_http_basic
- Type: HTTP basic authentication
test_api_client_secret
- Type: API key
- API key parameter name: x-test_api_client_secret
- Location: HTTP header
test_api_client_id
- Type: API key
- API key parameter name: x-test_api_client_id
- Location: HTTP header
test_api_key_query
- Type: API key
- API key parameter name: test_api_key_query
- Location: URL query string
petstore_auth
- Type: OAuth
- Flow: implicit
- Authorizatoin URL: http://petstore.swagger.io/api/oauth/dialog
- Scopes:
- write:pets: modify pets in your account
- read:pets: read your pets