@@ -18,14 +18,15 @@ public class {{classname}}: APIBase {
18
18
{{#operation} }
19
19
{ {#allParams} }
20
20
{ {#isEnum} }
21
+ { {^isContainer} }
21
22
/**
22
-
23
- enum for parameter { {paramName} }
24
- */
23
+ * enum for parameter { {paramName} }
24
+ */
25
25
public enum { {{datatypeWithEnum} }}_{ {operationId} }: String { {{#allowableValues} }{ {#values} }
26
26
case { {enum} } = "{ {raw} }"{ {/values} }{ {/allowableValues} }
27
27
}
28
28
29
+ { {/isContainer} }
29
30
{ {/isEnum} }
30
31
{ {/allParams} }
31
32
/**
@@ -35,7 +36,7 @@ public class {{classname}}: APIBase {
35
36
- parameter { {paramName} }: ({ {#isFormParam} }form{ {/isFormParam} }{ {#isQueryParam} }query{ {/isQueryParam} }{ {#isPathParam} }path{ {/isPathParam} }{ {#isHeaderParam} }header{ {/isHeaderParam} }{ {#isBodyParam} }body{ {/isBodyParam} }) { {description} } { {^required} }(optional{ {#defaultValue} }, default to { {{.} }}{ {/defaultValue} }){ {/required} }{ {/allParams} }
36
37
- parameter completion: completion handler to receive the data and the error objects
37
38
*/
38
- public class func { {operationId} }({ {#allParams} }{ {^secondaryParam} }{ {paramName} } { {/secondaryParam} }{ {paramName} }: { {#isEnum} }{ {{ datatypeWithEnum} }}_{ {operationId} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {#hasMore} }, { {/hasMore} }{ {/allParams} }{ {#hasParams} }, { {/hasParams} }completion: (({ {#returnType} }data: { {{returnType} }}?, { {/returnType} }error: ErrorType?) -> Void)) {
39
+ public class func { {operationId} }({ {#allParams} }{ {^secondaryParam} }{ {paramName} } { {/secondaryParam} }{ {paramName} }: { {#isEnum} }{ {#isContainer } } { {{dataType } }} { {/isContainer } } { {^isContainer } } { {{ datatypeWithEnum} }}_{ {operationId} } { {/isContainer } }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {#hasMore} }, { {/hasMore} }{ {/allParams} }{ {#hasParams} }, { {/hasParams} }completion: (({ {#returnType} }data: { {{returnType} }}?, { {/returnType} }error: ErrorType?) -> Void)) {
39
40
{{operationId} }WithRequestBuilder({ {#allParams} }{ {paramName} }: { {paramName} }{ {#hasMore} }, { {/hasMore} }{ {/allParams} }).execute { (response, error) -> Void in
40
41
completion({{#returnType} }data: response?.body, { {/returnType} }error: error);
41
42
}
@@ -49,7 +50,7 @@ public class {{classname}}: APIBase {
49
50
- parameter { {paramName} }: ({ {#isFormParam} }form{ {/isFormParam} }{ {#isQueryParam} }query{ {/isQueryParam} }{ {#isPathParam} }path{ {/isPathParam} }{ {#isHeaderParam} }header{ {/isHeaderParam} }{ {#isBodyParam} }body{ {/isBodyParam} }) { {description} } { {^required} }(optional{ {#defaultValue} }, default to { {{.} }}{ {/defaultValue} }){ {/required} }{ {/allParams} }
50
51
- returns: Promise<{ {#returnType} }{ {{returnType} }}{ {/returnType} }{ {^returnType} }Void{ {/returnType} }>
51
52
*/
52
- public class func { {operationId} }({ {#allParams} }{ {^secondaryParam} }{ {paramName} } { {/secondaryParam} }{ {paramName} }: { {#isEnum} }{ {{ datatypeWithEnum} }}_{ {operationId} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {#hasMore} }, { {/hasMore} }{ {/allParams} }) -> Promise<{ {#returnType} }{ {{returnType} }}{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> {
53
+ public class func { {operationId} }({ {#allParams} }{ {^secondaryParam} }{ {paramName} } { {/secondaryParam} }{ {paramName} }: { {#isEnum} }{ {#isContainer } } { {{dataType } }} { {/isContainer } } { {^isContainer } } { {{ datatypeWithEnum} }}_{ {operationId} } { {/isContainer } }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {#hasMore} }, { {/hasMore} }{ {/allParams} }) -> Promise<{ {#returnType} }{ {{returnType} }}{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> {
53
54
let deferred = Promise< {{#returnType} }{ {{returnType} }}{ {/returnType} }{ {^returnType} }Void{ {/returnType} }>.pendingPromise()
54
55
{ {operationId} }({ {#allParams} }{ {paramName} }: { {paramName} }{ {#hasMore} }, { {/hasMore} }{ {/allParams} }) { {{#returnType} }data, { {/returnType} }error in
55
56
if let error = error {
@@ -81,16 +82,16 @@ public class {{classname}}: APIBase {
81
82
82
83
- returns: RequestBuilder<{ {#returnType} }{ {{returnType} }}{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> { {description} }
83
84
*/
84
- public class func { {operationId} }WithRequestBuilder({ {#allParams} }{ {^secondaryParam} }{ {paramName} } { {/secondaryParam} }{ {paramName} }: { {#isEnum} }{ {{ datatypeWithEnum} }}_{ {operationId} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {#hasMore} }, { {/hasMore} }{ {/allParams} }) -> RequestBuilder<{ {#returnType} }{ {{returnType} }}{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> {
85
+ public class func { {operationId} }WithRequestBuilder({ {#allParams} }{ {^secondaryParam} }{ {paramName} } { {/secondaryParam} }{ {paramName} }: { {#isEnum} }{ {#isContainer } } { {{dataType } }} { {/isContainer } } { {^isContainer } } { {{ datatypeWithEnum} }}_{ {operationId} } { {/isContainer } }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {#hasMore} }, { {/hasMore} }{ {/allParams} }) -> RequestBuilder<{ {#returnType} }{ {{returnType} }}{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> {
85
86
{{^pathParams} }let{ {/pathParams} }{ {#pathParams} }{ {^secondaryParam} }var{ {/secondaryParam} }{ {/pathParams} } path = "{ {path} }"{ {#pathParams} }
86
- path = path.stringByReplacingOccurrencesOfString("{ {=<% %>= } }{ <% paramName%> } <%={ { } }=%>", withString: "\({ {paramName} }{ {#isEnum} }.rawValue{ {/isEnum} })", options: .LiteralSearch, range: nil){ {/pathParams} }
87
+ path = path.stringByReplacingOccurrencesOfString("{ {=<% %>= } }{ <% paramName%> } <%={ { } }=%>", withString: "\({ {paramName} }{ {#isEnum} }{ {#isContainer } } { {{dataType } }} { {/isContainer } } { {^isContainer } } .rawValue{ {/isContainer } } { {/isEnum} })", options: .LiteralSearch, range: nil){ {/pathParams} }
87
88
let URLString = { {projectName} }API.basePath + path
88
89
{ {#bodyParam} }
89
90
let parameters = { {paramName} }{ {^required} }?{ {/required} }.encodeToJSON() as? [String:AnyObject]{ {/bodyParam} }{ {^bodyParam} }
90
91
let nillableParameters: [String:AnyObject?] = { {^queryParams} }{ {^formParams} }[:]{ {/formParams} }{ {#formParams} }{ {^secondaryParam} }[{ {/secondaryParam} }
91
92
"{ {baseName} }": { {paramName} }{ {#isInteger} }{ {^required} }?{ {/required} }.encodeToJSON(){ {/isInteger} }{ {#isLong} }{ {^required} }?{ {/required} }.encodeToJSON(){ {/isLong} }{ {#hasMore} },{ {/hasMore} }{ {^hasMore} }
92
93
]{ {/hasMore} }{ {/formParams} }{ {/queryParams} }{ {#queryParams} }{ {^secondaryParam} }[{ {/secondaryParam} }
93
- "{ {baseName} }": { {paramName} }{ {#isInteger} }{ {^required} }?{ {/required} }.encodeToJSON(){ {/isInteger} }{ {#isLong} }{ {^required} }?{ {/required} }.encodeToJSON(){ {/isLong} }{ {#isEnum} }{ {^required} }?{ {/required} }.rawValue{ {/isEnum} }{ {#hasMore} },{ {/hasMore} }{ {^hasMore} }
94
+ "{ {baseName} }": { {paramName} }{ {#isInteger} }{ {^required} }?{ {/required} }.encodeToJSON(){ {/isInteger} }{ {#isLong} }{ {^required} }?{ {/required} }.encodeToJSON(){ {/isLong} }{ {#isEnum} }{ {^isContainer } } { {^ required} }?{ {/required} }.rawValue{ {/isContainer } } { {/isEnum} }{ {#hasMore} },{ {/hasMore} }{ {^hasMore} }
94
95
]{ {/hasMore} }{ {/queryParams} }
95
96
96
97
let parameters = APIHelper.rejectNil(nillableParameters){ {/bodyParam} }
0 commit comments