objc.README.mustache Maven / Gradle / Ivy
# {{podName}}
{{#appDescriptionWithNewLines}}
{{{appDescriptionWithNewLines}}}
{{/appDescriptionWithNewLines}}
This ObjC package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: {{appVersion}}
- Package version: {{artifactVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
## Requirements
The SDK requires [**ARC (Automatic Reference Counting)**](http://stackoverflow.com/questions/7778356/how-to-enable-disable-automatic-reference-counting) to be enabled in the Xcode project.
## Installation & Usage
### Install from Github using [CocoaPods](https://cocoapods.org/)
Add the following to the Podfile:
```ruby
pod '{{podName}}', :git => 'https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}.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](https://cocoapods.org/)
Put the SDK under your project folder (e.g. /path/to/objc_project/Vendor/{{podName}}) and then add the following to the Podfile:
```ruby
pod '{{podName}}', :path => 'Vendor/{{podName}}'
```
### Usage
Import the following:
```objc
#import <{{podName}}/{{{classPrefix}}}ApiClient.h>
#import <{{podName}}/{{{classPrefix}}}DefaultConfiguration.h>
// load models
{{#models}}{{#model}}#import <{{podName}}/{{{classname}}}.h>
{{/model}}{{/models}}// load API classes for accessing endpoints
{{#apiInfo}}{{#apis}}#import <{{podName}}/{{{classname}}}.h>
{{/apis}}{{/apiInfo}}
```
## Recommendation
It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issues.
## Getting Started
Please follow the [installation procedure](#installation--usage) and then run the following:
```objc
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
{{#hasAuthMethods}}
{{classPrefix}}DefaultConfiguration *apiConfig = [{{classPrefix}}DefaultConfiguration sharedConfig];
{{#authMethods}}{{#isBasic}}// Configure HTTP basic authorization (authentication scheme: {{{name}}})
[apiConfig setUsername:@"YOUR_USERNAME"];
[apiConfig setPassword:@"YOUR_PASSWORD"];
{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: (authentication scheme: {{{name}}})
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"{{{keyParamName}}}"];
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//[apiConfig setApiKeyPrefix:@"Bearer" forApiKeyIdentifier:@"{{{keyParamName}}}"];
{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: (authentication scheme: {{{name}}})
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}
{{#allParams}}{{{dataType}}} *{{paramName}} = {{{example}}}; // {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/allParams}}
{{classname}} *apiInstance = [[{{classname}} alloc] init];
{{#summary}}// {{{.}}}
{{/summary}}[apiInstance {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{nickname}}{{#hasParams}}With{{vendorExtensions.x-first-param-alt-name}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{^-first}}
{{paramName}}{{/-first}}:{{paramName}}{{/allParams}}
{{#hasParams}}completionHandler: {{/hasParams}}^({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error) {
{{#returnType}}
if (output) {
NSLog(@"%@", output);
}
{{/returnType}}
if (error) {
NSLog(@"Error: %@", error);
}
}];
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```
## Documentation for API Endpoints
All URIs are relative to *{{basePath}}*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
## Documentation For Models
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}}
## Documentation For Authorization
{{^authMethods}} All endpoints do not require authorization.
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
{{#authMethods}}## {{{name}}}
{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{{keyParamName}}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{{flow}}}
- **Authorization URL**: {{{authorizationUrl}}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - **{{{scope}}}**: {{{description}}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}
## Author
{{#apiInfo}}{{#apis}}{{#-last}}{{infoEmail}}
{{/-last}}{{/apis}}{{/apiInfo}}