Skip to content

Fix indentation #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 51 commits into from
Jun 9, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1e27364
Issue #642 - Removing the unnecesary \n added to generated example re…
Apr 16, 2015
1d175c1
+ advices for OS X Users
denyago Apr 18, 2015
5fbd0af
Added support for Basic Auth
Apr 30, 2015
abe072c
Merge pull request #703 from MaorBril/master
fehguy Apr 30, 2015
cd2e030
Linked to the 2.0.18 tag instead of the no longer existing 2.0.17.
eerwitt Apr 30, 2015
e3f09ae
Merge pull request #708 from eerwitt/update_documentation_links
webron Apr 30, 2015
9876e79
Found the 2.0.17 tag under 2.0.17 instead of v2.0.17.
eerwitt Apr 30, 2015
b70f5bc
Merge pull request #709 from eerwitt/update_documentation_links
webron Apr 30, 2015
df95114
Fixes a bug with Node.js example generating invalid package.json and …
May 4, 2015
df2cbfd
Merge pull request #720 from akras14/master
fehguy May 4, 2015
bae40de
Update README.md
lindybrandon May 7, 2015
9e382ec
Fix a typo in the README
sebest May 17, 2015
0c94b89
Merge pull request #750 from sebest/patch-1
webron May 17, 2015
8dbb1aa
Merge pull request #654 from kvelakur/master
fehguy May 21, 2015
e592d1b
Merge pull request #660 from denyago/master
fehguy May 21, 2015
89e3bcc
Adds isPrimitiveType flag to CodegenParameter.
chakrit May 21, 2015
e3c1163
Merge pull request #773 from hyperworks/master
fehguy May 23, 2015
26a22a3
Create LICENSE
webron May 29, 2015
ca46405
Update README.md
webron May 29, 2015
f025dda
merged
fehguy Jun 8, 2015
915ad77
Merge branch 'develop_2.0'
fehguy Jun 8, 2015
0dd8670
rollback python template
wing328 Jun 9, 2015
d5cbbae
rollback ruby swagger template
wing328 Jun 9, 2015
5f6622c
rollback ruby template
wing328 Jun 9, 2015
2e12ac5
rollback perl template
wing328 Jun 9, 2015
50ae965
rollback php template
wing328 Jun 9, 2015
263b408
rollback python3 template
wing328 Jun 9, 2015
6253bbf
roll back qt5cpp template
wing328 Jun 9, 2015
eee8685
rollback flash template
wing328 Jun 9, 2015
eede02a
rollback nodejs and htmldocs template
wing328 Jun 9, 2015
b1f5c03
rollback objc templates
wing328 Jun 9, 2015
7d6fdf9
rollback retroit template
wing328 Jun 9, 2015
b636d2a
rollback scala template
wing328 Jun 9, 2015
f2ee63d
rollback scalatra template
wing328 Jun 9, 2015
d8060f4
rollback swagger-static template
wing328 Jun 9, 2015
410144e
rollback swift template
wing328 Jun 9, 2015
6617af5
rollback tizen template
wing328 Jun 9, 2015
6efef51
rollback validator template
wing328 Jun 9, 2015
a8f6044
rollback akka-scala template
wing328 Jun 9, 2015
ab9daaa
rollback android template
wing328 Jun 9, 2015
f610958
rollback asyncscala template
wing328 Jun 9, 2015
7b6480f
rollback codegen template
wing328 Jun 9, 2015
46c5b77
rollback csharp template
wing328 Jun 9, 2015
900f396
rollback grovvy template
wing328 Jun 9, 2015
180d48e
rollback java template
wing328 Jun 9, 2015
29c41ad
rollback java jxrs template
wing328 Jun 9, 2015
fc38b9b
rollback akkascala to another commit (637ee77d66dbcd2a94a22941754158d…
wing328 Jun 9, 2015
d155ddd
rollback java spring mvc template
wing328 Jun 9, 2015
7fd996b
update php sample
wing328 Jun 9, 2015
a593271
rollback flash apiinvoker based on 8ee8eddcff26d72a89538bcdac39f2f730…
wing328 Jun 9, 2015
680078d
fix csharp refer to apiinvoker
wing328 Jun 9, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rollback objc templates
  • Loading branch information
wing328 committed Jun 9, 2015
commit b1f5c0314e8ac78e570e3ef1b5f82420e2e0fc90
Original file line number Diff line number Diff line change
Expand Up @@ -12,88 +12,88 @@
#pragma mark - Singletion Methods

+ (instancetype) sharedConfig {
static SWGConfiguration *shardConfig = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shardConfig = [[self alloc] init];
});
return shardConfig;
static SWGConfiguration *shardConfig = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
shardConfig = [[self alloc] init];
});
return shardConfig;
}

#pragma mark - Initialize Methods

- (instancetype) init {
self = [super init];
if (self) {
self.username = @"";
self.password = @"";
self.mutableApiKey = [NSMutableDictionary dictionary];
self.mutableApiKeyPrefix = [NSMutableDictionary dictionary];
}
return self;
self = [super init];
if (self) {
self.username = @"";
self.password = @"";
self.mutableApiKey = [NSMutableDictionary dictionary];
self.mutableApiKeyPrefix = [NSMutableDictionary dictionary];
}
return self;
}

#pragma mark - Instance Methods

- (NSString *) getApiKeyWithPrefix:(NSString *)key {
if ([self.apiKeyPrefix objectForKey:key] && [self.apiKey objectForKey:key]) {
return [NSString stringWithFormat:@"%@ %@", [self.apiKeyPrefix objectForKey:key], [self.apiKey objectForKey:key]];
}
else if ([self.apiKey objectForKey:key]) {
return [NSString stringWithFormat:@"%@", [self.apiKey objectForKey:key]];
}
else {
return @"";
}
if ([self.apiKeyPrefix objectForKey:key] && [self.apiKey objectForKey:key]) {
return [NSString stringWithFormat:@"%@ %@", [self.apiKeyPrefix objectForKey:key], [self.apiKey objectForKey:key]];
}
else if ([self.apiKey objectForKey:key]) {
return [NSString stringWithFormat:@"%@", [self.apiKey objectForKey:key]];
}
else {
return @"";
}
}

- (NSString *) getBasicAuthToken {
NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", self.username, self.password];
NSData *data = [basicAuthCredentials dataUsingEncoding:NSUTF8StringEncoding];
basicAuthCredentials = [NSString stringWithFormat:@"Basic %@", [data base64EncodedStringWithOptions:0]];

return basicAuthCredentials;
NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", self.username, self.password];
NSData *data = [basicAuthCredentials dataUsingEncoding:NSUTF8StringEncoding];
basicAuthCredentials = [NSString stringWithFormat:@"Basic %@", [data base64EncodedStringWithOptions:0]];
return basicAuthCredentials;
}

#pragma mark - Setter Methods

- (void) setValue:(NSString *)value forApiKeyField:(NSString *)field {
[self.mutableApiKey setValue:value forKey:field];
[self.mutableApiKey setValue:value forKey:field];
}

- (void) setValue:(NSString *)value forApiKeyPrefixField:(NSString *)field {
[self.mutableApiKeyPrefix setValue:value forKey:field];
[self.mutableApiKeyPrefix setValue:value forKey:field];
}

#pragma mark - Getter Methods

- (NSDictionary *) apiKey {
return [NSDictionary dictionaryWithDictionary:self.mutableApiKey];
return [NSDictionary dictionaryWithDictionary:self.mutableApiKey];
}

- (NSDictionary *) apiKeyPrefix {
return [NSDictionary dictionaryWithDictionary:self.mutableApiKeyPrefix];
return [NSDictionary dictionaryWithDictionary:self.mutableApiKeyPrefix];
}

#pragma mark -

- (NSDictionary *) authSettings {
return @{ {{#authMethods}}{{#isApiKey}}
@"{{name}}": @{
@"type": @"api_key",
@"in": {{#isKeyInHeader}}@"header"{{/isKeyInHeader}}{{#isKeyInQuery}}@"query"{{/isKeyInQuery}},
@"key": @"{{keyParamName}}",
@"value": [self getApiKeyWithPrefix:@"{{keyParamName}}"]
},
{{/isApiKey}}{{#isBasic}}
@"{{name}}": @{
@"type": @"basic",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getBasicAuthToken]
},
{{/isBasic}}{{/authMethods}}
};
return @{ {{#authMethods}}{{#isApiKey}}
@"{{name}}": @{
@"type": @"api_key",
@"in": {{#isKeyInHeader}}@"header"{{/isKeyInHeader}}{{#isKeyInQuery}}@"query"{{/isKeyInQuery}},
@"key": @"{{keyParamName}}",
@"value": [self getApiKeyWithPrefix:@"{{keyParamName}}"]
},
{{/isApiKey}}{{#isBasic}}
@"{{name}}": @{
@"type": @"basic",
@"in": @"header",
@"key": @"Authorization",
@"value": [self getBasicAuthToken]
},
{{/isBasic}}{{/authMethods}}
};
}

@end
Original file line number Diff line number Diff line change
@@ -1,57 +1,56 @@
#import
<Foundation/Foundation.h>
#import <Foundation/Foundation.h>

@interface SWGConfiguration : NSObject


/**
* Api key values for Api Key type Authentication
*
* To add or remove api key, use `setValue:forApiKeyField:`.
*/
* Api key values for Api Key type Authentication
*
* To add or remove api key, use `setValue:forApiKeyField:`.
*/
@property (readonly, nonatomic, strong) NSDictionary *apiKey;

/**
* Api key prefix values to be prepend to the respective api key
*
* To add or remove prefix, use `setValue:forApiKeyPrefixField:`.
*/
* Api key prefix values to be prepend to the respective api key
*
* To add or remove prefix, use `setValue:forApiKeyPrefixField:`.
*/
@property (readonly, nonatomic, strong) NSDictionary *apiKeyPrefix;

/**
* Usename and Password for Basic type Authentication
*/
* Usename and Password for Basic type Authentication
*/
@property (nonatomic) NSString *username;
@property (nonatomic) NSString *password;

/**
* Get configuration singleton instance
*/
* Get configuration singleton instance
*/
+ (instancetype) sharedConfig;

/**
* Sets field in `apiKey`
*/
* Sets field in `apiKey`
*/
- (void) setValue:(NSString *)value forApiKeyField:(NSString*)field;

/**
* Sets field in `apiKeyPrefix`
*/
* Sets field in `apiKeyPrefix`
*/
- (void) setValue:(NSString *)value forApiKeyPrefixField:(NSString *)field;

/**
* Get API key (with prefix if set)
*/
* Get API key (with prefix if set)
*/
- (NSString *) getApiKeyWithPrefix:(NSString *) key;

/**
* Get Basic Auth token
*/
* Get Basic Auth token
*/
- (NSString *) getBasicAuthToken;

/**
* Get Authentication Setings
*/
* Get Authentication Setings
*/
- (NSDictionary *) authSettings;

@end
Loading