wing328 ae8a123484 [WIP][Scala] Finch generator (#3905)
* Feature/objc tasks 2.3.0 (#3522)

* change api and ApiClient to return cancellable NSURLSessionTasks instead of NSNumber

* define a configuration protocol for custom configurations, which can be passed to api clients instead of a global configuration, provide a default implementation with a singleton option

* integrate a workaround for a current JSONModel concurrency bug

* update to new ISO8601 pod

* add missing call to super

* integrate new templates into codegen

* updates documentation templates

* updates petstore objc generated code

* fixes objc client tests

* [ObjC] Add version define and share default headers of each client

* add finch generator and resource

* update license, add errros

* Fix problem with multitheard api client

* fix some errors for finch

* [finch] Remove license header

* [finch] Remove finatra stuff, fix a few issues

* WIP: Finch server generator

* [finch] WIP: server generator impl

This puts parameters (input/output) in the right format. Currently, this
is done in the generator class using vendorExtensions, but should be
refactored to imported templates to clean up.

Previous commits of the server generator output to appropriate
models/api directories. I've made no changes to this logic, but code
currently generates to the root scala package directory. This will need
to be fixed.

There's also an issue with circe's and Option[Date] in the Order type.
This issue will need to be resolved. As well, there's some unused
imports to clean up.

Initial implementation lacks support for custom imports, type mappings,
etc.

* [finch] Update api/model package and imports

* [finch] Explicit import/type mappings

* [finch] Regenerate example
2017-01-29 12:15:39 +08:00

11 KiB

SWGUserApi

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

Method HTTP request Description
createUser POST /user Create user
createUsersWithArrayInput POST /user/createWithArray Creates list of users with given input array
createUsersWithListInput POST /user/createWithList Creates list of users with given input array
deleteUser DELETE /user/{username} Delete user
getUserByName GET /user/{username} Get user by user name
loginUser GET /user/login Logs user into the system
logoutUser GET /user/logout Logs out current logged in user session
updateUser PUT /user/{username} Updated user

createUser

-(NSURLSessionTask*) createUserWithBody: (SWGUser*) body
        completionHandler: (void (^)(NSError* error)) handler;

Create user

This can only be done by the logged in user.

Example


SWGUser* body = [[SWGUser alloc] init]; // Created user object (optional)

SWGUserApi*apiInstance = [[SWGUserApi alloc] init];

// Create user
[apiInstance createUserWithBody:body
          completionHandler: ^(NSError* error) {
                        if (error) {
                            NSLog(@"Error calling SWGUserApi->createUser: %@", error);
                        }
                    }];

Parameters

Name Type Description Notes
body SWGUser* Created user object [optional]

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]

createUsersWithArrayInput

-(NSURLSessionTask*) createUsersWithArrayInputWithBody: (NSArray<SWGUser>*) body
        completionHandler: (void (^)(NSError* error)) handler;

Creates list of users with given input array

Example


NSArray<SWGUser>* body = @[[[SWGUser alloc] init]]; // List of user object (optional)

SWGUserApi*apiInstance = [[SWGUserApi alloc] init];

// Creates list of users with given input array
[apiInstance createUsersWithArrayInputWithBody:body
          completionHandler: ^(NSError* error) {
                        if (error) {
                            NSLog(@"Error calling SWGUserApi->createUsersWithArrayInput: %@", error);
                        }
                    }];

Parameters

Name Type Description Notes
body NSArray<SWGUser>* List of user object [optional]

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]

createUsersWithListInput

-(NSURLSessionTask*) createUsersWithListInputWithBody: (NSArray<SWGUser>*) body
        completionHandler: (void (^)(NSError* error)) handler;

Creates list of users with given input array

Example


NSArray<SWGUser>* body = @[[[SWGUser alloc] init]]; // List of user object (optional)

SWGUserApi*apiInstance = [[SWGUserApi alloc] init];

// Creates list of users with given input array
[apiInstance createUsersWithListInputWithBody:body
          completionHandler: ^(NSError* error) {
                        if (error) {
                            NSLog(@"Error calling SWGUserApi->createUsersWithListInput: %@", error);
                        }
                    }];

Parameters

Name Type Description Notes
body NSArray<SWGUser>* List of user object [optional]

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]

deleteUser

-(NSURLSessionTask*) deleteUserWithUsername: (NSString*) username
        completionHandler: (void (^)(NSError* error)) handler;

Delete user

This can only be done by the logged in user.

Example


NSString* username = @"username_example"; // The name that needs to be deleted

SWGUserApi*apiInstance = [[SWGUserApi alloc] init];

// Delete user
[apiInstance deleteUserWithUsername:username
          completionHandler: ^(NSError* error) {
                        if (error) {
                            NSLog(@"Error calling SWGUserApi->deleteUser: %@", error);
                        }
                    }];

Parameters

Name Type Description Notes
username NSString* The name 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]

getUserByName

-(NSURLSessionTask*) getUserByNameWithUsername: (NSString*) username
        completionHandler: (void (^)(SWGUser* output, NSError* error)) handler;

Get user by user name

Example


NSString* username = @"username_example"; // The name that needs to be fetched. Use user1 for testing. 

SWGUserApi*apiInstance = [[SWGUserApi alloc] init];

// Get user by user name
[apiInstance getUserByNameWithUsername:username
          completionHandler: ^(SWGUser* output, NSError* error) {
                        if (output) {
                            NSLog(@"%@", output);
                        }
                        if (error) {
                            NSLog(@"Error calling SWGUserApi->getUserByName: %@", error);
                        }
                    }];

Parameters

Name Type Description Notes
username NSString* The name that needs to be fetched. Use user1 for testing.

Return type

SWGUser*

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]

loginUser

-(NSURLSessionTask*) loginUserWithUsername: (NSString*) username
    password: (NSString*) password
        completionHandler: (void (^)(NSString* output, NSError* error)) handler;

Logs user into the system

Example


NSString* username = @"username_example"; // The user name for login (optional)
NSString* password = @"password_example"; // The password for login in clear text (optional)

SWGUserApi*apiInstance = [[SWGUserApi alloc] init];

// Logs user into the system
[apiInstance loginUserWithUsername:username
              password:password
          completionHandler: ^(NSString* output, NSError* error) {
                        if (output) {
                            NSLog(@"%@", output);
                        }
                        if (error) {
                            NSLog(@"Error calling SWGUserApi->loginUser: %@", error);
                        }
                    }];

Parameters

Name Type Description Notes
username NSString* The user name for login [optional]
password NSString* The password for login in clear text [optional]

Return type

NSString*

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]

logoutUser

-(NSURLSessionTask*) logoutUserWithCompletionHandler: 
        (void (^)(NSError* error)) handler;

Logs out current logged in user session

Example



SWGUserApi*apiInstance = [[SWGUserApi alloc] init];

// Logs out current logged in user session
[apiInstance logoutUserWithCompletionHandler: 
          ^(NSError* error) {
                        if (error) {
                            NSLog(@"Error calling SWGUserApi->logoutUser: %@", error);
                        }
                    }];

Parameters

This endpoint does not need any parameter.

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]

updateUser

-(NSURLSessionTask*) updateUserWithUsername: (NSString*) username
    body: (SWGUser*) body
        completionHandler: (void (^)(NSError* error)) handler;

Updated user

This can only be done by the logged in user.

Example


NSString* username = @"username_example"; // name that need to be deleted
SWGUser* body = [[SWGUser alloc] init]; // Updated user object (optional)

SWGUserApi*apiInstance = [[SWGUserApi alloc] init];

// Updated user
[apiInstance updateUserWithUsername:username
              body:body
          completionHandler: ^(NSError* error) {
                        if (error) {
                            NSLog(@"Error calling SWGUserApi->updateUser: %@", error);
                        }
                    }];

Parameters

Name Type Description Notes
username NSString* name that need to be deleted
body SWGUser* Updated user object [optional]

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]