forked from loafle/openapi-generator-original
Update Swift4 client with OAS2 (#270)
* update swift4 client with oas2 * map binary as file in swift4
This commit is contained in:
@@ -146,55 +146,55 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
);
|
||||
reservedWords = new HashSet<>(
|
||||
Arrays.asList(
|
||||
// name used by swift client
|
||||
"ErrorResponse", "Response",
|
||||
// name used by swift client
|
||||
"ErrorResponse", "Response",
|
||||
|
||||
// Added for Objective-C compatibility
|
||||
"id", "description", "NSArray", "NSURL", "CGFloat", "NSSet", "NSString", "NSInteger", "NSUInteger",
|
||||
"NSError", "NSDictionary",
|
||||
// Added for Objective-C compatibility
|
||||
"id", "description", "NSArray", "NSURL", "CGFloat", "NSSet", "NSString", "NSInteger", "NSUInteger",
|
||||
"NSError", "NSDictionary",
|
||||
|
||||
//
|
||||
// Swift keywords. This list is taken from here:
|
||||
// https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/LexicalStructure.html#//apple_ref/doc/uid/TP40014097-CH30-ID410
|
||||
//
|
||||
// Keywords used in declarations
|
||||
"associatedtype", "class", "deinit", "enum", "extension", "fileprivate", "func", "import", "init",
|
||||
"inout", "internal", "let", "open", "operator", "private", "protocol", "public", "static", "struct",
|
||||
"subscript", "typealias", "var",
|
||||
// Keywords uses in statements
|
||||
"break", "case", "continue", "default", "defer", "do", "else", "fallthrough", "for", "guard", "if",
|
||||
"in", "repeat", "return", "switch", "where", "while",
|
||||
// Keywords used in expressions and types
|
||||
"as", "Any", "catch", "false", "is", "nil", "rethrows", "super", "self", "Self", "throw", "throws", "true", "try",
|
||||
// Keywords used in patterns
|
||||
"_",
|
||||
// Keywords that begin with a number sign
|
||||
"#available", "#colorLiteral", "#column", "#else", "#elseif", "#endif", "#file", "#fileLiteral", "#function", "#if",
|
||||
"#imageLiteral", "#line", "#selector", "#sourceLocation",
|
||||
// Keywords reserved in particular contexts
|
||||
"associativity", "convenience", "dynamic", "didSet", "final", "get", "infix", "indirect", "lazy", "left",
|
||||
"mutating", "none", "nonmutating", "optional", "override", "postfix", "precedence", "prefix", "Protocol",
|
||||
"required", "right", "set", "Type", "unowned", "weak", "willSet",
|
||||
//
|
||||
// Swift keywords. This list is taken from here:
|
||||
// https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/LexicalStructure.html#//apple_ref/doc/uid/TP40014097-CH30-ID410
|
||||
//
|
||||
// Keywords used in declarations
|
||||
"associatedtype", "class", "deinit", "enum", "extension", "fileprivate", "func", "import", "init",
|
||||
"inout", "internal", "let", "open", "operator", "private", "protocol", "public", "static", "struct",
|
||||
"subscript", "typealias", "var",
|
||||
// Keywords uses in statements
|
||||
"break", "case", "continue", "default", "defer", "do", "else", "fallthrough", "for", "guard", "if",
|
||||
"in", "repeat", "return", "switch", "where", "while",
|
||||
// Keywords used in expressions and types
|
||||
"as", "Any", "catch", "false", "is", "nil", "rethrows", "super", "self", "Self", "throw", "throws", "true", "try",
|
||||
// Keywords used in patterns
|
||||
"_",
|
||||
// Keywords that begin with a number sign
|
||||
"#available", "#colorLiteral", "#column", "#else", "#elseif", "#endif", "#file", "#fileLiteral", "#function", "#if",
|
||||
"#imageLiteral", "#line", "#selector", "#sourceLocation",
|
||||
// Keywords reserved in particular contexts
|
||||
"associativity", "convenience", "dynamic", "didSet", "final", "get", "infix", "indirect", "lazy", "left",
|
||||
"mutating", "none", "nonmutating", "optional", "override", "postfix", "precedence", "prefix", "Protocol",
|
||||
"required", "right", "set", "Type", "unowned", "weak", "willSet",
|
||||
|
||||
//
|
||||
// Swift Standard Library types
|
||||
// https://developer.apple.com/documentation/swift
|
||||
//
|
||||
// Numbers and Basic Values
|
||||
"Bool", "Int", "Double", "Float", "Range", "ClosedRange", "Error", "Optional",
|
||||
// Special-Use Numeric Types
|
||||
"UInt", "UInt8", "UInt16", "UInt32", "UInt64", "Int8", "Int16", "Int32", "Int64", "Float80", "Float32", "Float64",
|
||||
// Strings and Text
|
||||
"String", "Character", "Unicode", "StaticString",
|
||||
// Collections
|
||||
"Array", "Dictionary", "Set", "OptionSet", "CountableRange", "CountableClosedRange",
|
||||
//
|
||||
// Swift Standard Library types
|
||||
// https://developer.apple.com/documentation/swift
|
||||
//
|
||||
// Numbers and Basic Values
|
||||
"Bool", "Int", "Double", "Float", "Range", "ClosedRange", "Error", "Optional",
|
||||
// Special-Use Numeric Types
|
||||
"UInt", "UInt8", "UInt16", "UInt32", "UInt64", "Int8", "Int16", "Int32", "Int64", "Float80", "Float32", "Float64",
|
||||
// Strings and Text
|
||||
"String", "Character", "Unicode", "StaticString",
|
||||
// Collections
|
||||
"Array", "Dictionary", "Set", "OptionSet", "CountableRange", "CountableClosedRange",
|
||||
|
||||
// The following are commonly-used Foundation types
|
||||
"URL", "Data", "Codable", "Encodable", "Decodable",
|
||||
// The following are commonly-used Foundation types
|
||||
"URL", "Data", "Codable", "Encodable", "Decodable",
|
||||
|
||||
// The following are other words we want to reserve
|
||||
"Void", "AnyObject", "Class", "dynamicType", "COLUMN", "FILE", "FUNCTION", "LINE"
|
||||
)
|
||||
// The following are other words we want to reserve
|
||||
"Void", "AnyObject", "Class", "dynamicType", "COLUMN", "FILE", "FUNCTION", "LINE"
|
||||
)
|
||||
);
|
||||
|
||||
typeMapping = new HashMap<>();
|
||||
@@ -217,7 +217,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("double", "Double");
|
||||
typeMapping.put("object", "Any");
|
||||
typeMapping.put("file", "URL");
|
||||
typeMapping.put("binary", "Data");
|
||||
typeMapping.put("binary", "URL");
|
||||
typeMapping.put("ByteArray", "Data");
|
||||
typeMapping.put("UUID", "UUID");
|
||||
|
||||
@@ -225,16 +225,16 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
cliOptions.add(new CliOption(PROJECT_NAME, "Project name in Xcode"));
|
||||
cliOptions.add(new CliOption(RESPONSE_AS,
|
||||
"Optionally use libraries to manage response. Currently "
|
||||
+ StringUtils.join(RESPONSE_LIBRARIES, ", ")
|
||||
+ " are available."));
|
||||
"Optionally use libraries to manage response. Currently "
|
||||
+ StringUtils.join(RESPONSE_LIBRARIES, ", ")
|
||||
+ " are available."));
|
||||
cliOptions.add(new CliOption(UNWRAP_REQUIRED,
|
||||
"Treat 'required' properties in response as non-optional "
|
||||
+ "(which would crash the app if api returns null as opposed "
|
||||
+ "to required option specified in json schema"));
|
||||
"Treat 'required' properties in response as non-optional "
|
||||
+ "(which would crash the app if api returns null as opposed "
|
||||
+ "to required option specified in json schema"));
|
||||
cliOptions.add(new CliOption(OBJC_COMPATIBLE,
|
||||
"Add additional properties and methods for Objective-C "
|
||||
+ "compatibility (default: false)"));
|
||||
"Add additional properties and methods for Objective-C "
|
||||
+ "compatibility (default: false)"));
|
||||
cliOptions.add(new CliOption(POD_SOURCE, "Source information used for Podspec"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "Version used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_AUTHORS, "Authors used for Podspec"));
|
||||
@@ -246,16 +246,16 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
cliOptions.add(new CliOption(POD_DESCRIPTION, "Description used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_SCREENSHOTS, "Screenshots used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_DOCUMENTATION_URL,
|
||||
"Documentation URL used for Podspec"));
|
||||
"Documentation URL used for Podspec"));
|
||||
cliOptions.add(new CliOption(SWIFT_USE_API_NAMESPACE,
|
||||
"Flag to make all the API classes inner-class "
|
||||
+ "of {{projectName}}API"));
|
||||
"Flag to make all the API classes inner-class "
|
||||
+ "of {{projectName}}API"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.HIDE_GENERATION_TIMESTAMP,
|
||||
CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
|
||||
CodegenConstants.HIDE_GENERATION_TIMESTAMP_DESC)
|
||||
.defaultValue(Boolean.TRUE.toString()));
|
||||
cliOptions.add(new CliOption(LENIENT_TYPE_CAST,
|
||||
"Accept and cast values for simple types (string->bool, "
|
||||
+ "string->int, int->string)")
|
||||
"Accept and cast values for simple types (string->bool, "
|
||||
+ "string->int, int->string)")
|
||||
.defaultValue(Boolean.FALSE.toString()));
|
||||
}
|
||||
|
||||
@@ -315,44 +315,44 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
setLenientTypeCast(convertPropertyToBooleanAndWriteBack(LENIENT_TYPE_CAST));
|
||||
|
||||
supportingFiles.add(new SupportingFile("Podspec.mustache",
|
||||
"",
|
||||
projectName + ".podspec"));
|
||||
"",
|
||||
projectName + ".podspec"));
|
||||
supportingFiles.add(new SupportingFile("Cartfile.mustache",
|
||||
"",
|
||||
"Cartfile"));
|
||||
"",
|
||||
"Cartfile"));
|
||||
supportingFiles.add(new SupportingFile("APIHelper.mustache",
|
||||
sourceFolder,
|
||||
"APIHelper.swift"));
|
||||
sourceFolder,
|
||||
"APIHelper.swift"));
|
||||
supportingFiles.add(new SupportingFile("AlamofireImplementations.mustache",
|
||||
sourceFolder,
|
||||
"AlamofireImplementations.swift"));
|
||||
sourceFolder,
|
||||
"AlamofireImplementations.swift"));
|
||||
supportingFiles.add(new SupportingFile("Configuration.mustache",
|
||||
sourceFolder,
|
||||
"Configuration.swift"));
|
||||
sourceFolder,
|
||||
"Configuration.swift"));
|
||||
supportingFiles.add(new SupportingFile("Extensions.mustache",
|
||||
sourceFolder,
|
||||
"Extensions.swift"));
|
||||
sourceFolder,
|
||||
"Extensions.swift"));
|
||||
supportingFiles.add(new SupportingFile("Models.mustache",
|
||||
sourceFolder,
|
||||
"Models.swift"));
|
||||
sourceFolder,
|
||||
"Models.swift"));
|
||||
supportingFiles.add(new SupportingFile("APIs.mustache",
|
||||
sourceFolder,
|
||||
"APIs.swift"));
|
||||
sourceFolder,
|
||||
"APIs.swift"));
|
||||
supportingFiles.add(new SupportingFile("CodableHelper.mustache",
|
||||
sourceFolder,
|
||||
"CodableHelper.swift"));
|
||||
sourceFolder,
|
||||
"CodableHelper.swift"));
|
||||
supportingFiles.add(new SupportingFile("JSONEncodableEncoding.mustache",
|
||||
sourceFolder,
|
||||
"JSONEncodableEncoding.swift"));
|
||||
sourceFolder,
|
||||
"JSONEncodableEncoding.swift"));
|
||||
supportingFiles.add(new SupportingFile("JSONEncodingHelper.mustache",
|
||||
sourceFolder,
|
||||
"JSONEncodingHelper.swift"));
|
||||
sourceFolder,
|
||||
"JSONEncodingHelper.swift"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache",
|
||||
"",
|
||||
"git_push.sh"));
|
||||
"",
|
||||
"git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache",
|
||||
"",
|
||||
".gitignore"));
|
||||
"",
|
||||
".gitignore"));
|
||||
|
||||
}
|
||||
|
||||
@@ -372,13 +372,13 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
@Override
|
||||
public String modelFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder
|
||||
+ modelPackage().replace('.', File.separatorChar);
|
||||
+ modelPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separator + sourceFolder
|
||||
+ apiPackage().replace('.', File.separatorChar);
|
||||
+ apiPackage().replace('.', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -446,7 +446,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (isReservedWord(name)) {
|
||||
String modelName = "Model" + name;
|
||||
LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to "
|
||||
+ modelName);
|
||||
+ modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@@ -455,8 +455,8 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
// e.g. 200Response => Model200Response (after camelize)
|
||||
String modelName = "Model" + name;
|
||||
LOGGER.warn(name
|
||||
+ " (model name starts with number) cannot be used as model name."
|
||||
+ " Renamed to " + modelName);
|
||||
+ " (model name starts with number) cannot be used as model name."
|
||||
+ " Renamed to " + modelName);
|
||||
return modelName;
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
if (isReservedWord(operationId)) {
|
||||
String newOperationId = camelize(("call_" + operationId), true);
|
||||
LOGGER.warn(operationId + " (reserved word) cannot be used as method name."
|
||||
+ " Renamed to " + newOperationId);
|
||||
+ " Renamed to " + newOperationId);
|
||||
return newOperationId;
|
||||
}
|
||||
|
||||
@@ -583,8 +583,8 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
while (parentSchema != null) {
|
||||
final Schema parentModel = allDefinitions.get(parentSchema);
|
||||
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent,
|
||||
parentModel,
|
||||
allDefinitions);
|
||||
parentModel,
|
||||
allDefinitions);
|
||||
codegenModel = Swift4Codegen.reconcileProperties(codegenModel, parentCodegenModel);
|
||||
|
||||
// get the next parent
|
||||
@@ -680,8 +680,8 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
char[] separators = {'-', '_', ' ', ':', '(', ')'};
|
||||
return camelize(WordUtils.capitalizeFully(StringUtils.lowerCase(name), separators)
|
||||
.replaceAll("[-_ :\\(\\)]", ""),
|
||||
true);
|
||||
.replaceAll("[-_ :\\(\\)]", ""),
|
||||
true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -759,7 +759,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
// due to short-circuit evaluation of the || operator.
|
||||
boolean isSwiftOptional = !unwrapRequired || !property.required;
|
||||
boolean isSwiftScalarType = property.isInteger || property.isLong || property.isFloat
|
||||
|| property.isDouble || property.isBoolean;
|
||||
|| property.isDouble || property.isBoolean;
|
||||
if (isSwiftOptional && isSwiftScalarType) {
|
||||
// Optional scalar types like Int?, Int64?, Float?, Double?, and Bool?
|
||||
// do not translate to Objective-C. So we want to flag those
|
||||
@@ -803,7 +803,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig {
|
||||
Iterator<CodegenProperty> iterator = codegenProperties.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
CodegenProperty codegenProperty = iterator.next();
|
||||
if (codegenProperty.baseName == parentModelCodegenProperty.baseName) {
|
||||
if (codegenProperty.baseName.equals(parentModelCodegenProperty.baseName)) {
|
||||
// We found a property in the child class that is
|
||||
// a duplicate of the one in the parent, so remove it.
|
||||
iterator.remove();
|
||||
|
||||
@@ -1 +1 @@
|
||||
2.4.0-SNAPSHOT
|
||||
3.0.0-SNAPSHOT
|
||||
@@ -14,11 +14,11 @@ open class AnotherFakeAPI {
|
||||
/**
|
||||
To test special tags
|
||||
|
||||
- parameter body: (body) client model
|
||||
- parameter client: (body) client model
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testSpecialTags(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
|
||||
testSpecialTagsWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func testSpecialTags(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
|
||||
testSpecialTagsWithRequestBuilder(client: client).execute { (response, error) -> Void in
|
||||
completion(response?.body, error)
|
||||
}
|
||||
}
|
||||
@@ -28,18 +28,13 @@ open class AnotherFakeAPI {
|
||||
To test special tags
|
||||
- PATCH /another-fake/dummy
|
||||
- To test special tags
|
||||
- examples: [{contentType=application/json, example={
|
||||
"client" : "client"
|
||||
}}]
|
||||
|
||||
- parameter body: (body) client model
|
||||
|
||||
- parameter client: (body) client model
|
||||
- returns: RequestBuilder<Client>
|
||||
*/
|
||||
open class func testSpecialTagsWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
|
||||
open class func testSpecialTagsWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
|
||||
let path = "/another-fake/dummy"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ open class FakeAPI {
|
||||
- parameter body: (body) Input boolean as post body (optional)
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func fakeOuterBooleanSerialize(body: OuterBoolean? = nil, completion: @escaping ((_ data: OuterBoolean?,_ error: Error?) -> Void)) {
|
||||
open class func fakeOuterBooleanSerialize(body: Bool? = nil, completion: @escaping ((_ data: Bool?,_ error: Error?) -> Void)) {
|
||||
fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
completion(response?.body, error)
|
||||
}
|
||||
@@ -26,31 +26,28 @@ open class FakeAPI {
|
||||
/**
|
||||
- POST /fake/outer/boolean
|
||||
- Test serialization of outer boolean types
|
||||
- examples: [{contentType=application/json, example={ }}]
|
||||
|
||||
- parameter body: (body) Input boolean as post body (optional)
|
||||
|
||||
- returns: RequestBuilder<OuterBoolean>
|
||||
- returns: RequestBuilder<Bool>
|
||||
*/
|
||||
open class func fakeOuterBooleanSerializeWithRequestBuilder(body: OuterBoolean? = nil) -> RequestBuilder<OuterBoolean> {
|
||||
open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder<Bool> {
|
||||
let path = "/fake/outer/boolean"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<OuterBoolean>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let requestBuilder: RequestBuilder<Bool>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
- parameter body: (body) Input composite as post body (optional)
|
||||
- parameter outerComposite: (body) Input composite as post body (optional)
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) {
|
||||
fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func fakeOuterCompositeSerialize(outerComposite: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) {
|
||||
fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: outerComposite).execute { (response, error) -> Void in
|
||||
completion(response?.body, error)
|
||||
}
|
||||
}
|
||||
@@ -59,20 +56,13 @@ open class FakeAPI {
|
||||
/**
|
||||
- POST /fake/outer/composite
|
||||
- Test serialization of object with outer number type
|
||||
- examples: [{contentType=application/json, example={
|
||||
"my_string" : { },
|
||||
"my_number" : { },
|
||||
"my_boolean" : { }
|
||||
}}]
|
||||
|
||||
- parameter body: (body) Input composite as post body (optional)
|
||||
|
||||
- parameter outerComposite: (body) Input composite as post body (optional)
|
||||
- returns: RequestBuilder<OuterComposite>
|
||||
*/
|
||||
open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
|
||||
open class func fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: OuterComposite? = nil) -> RequestBuilder<OuterComposite> {
|
||||
let path = "/fake/outer/composite"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: outerComposite)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
@@ -86,7 +76,7 @@ open class FakeAPI {
|
||||
- parameter body: (body) Input number as post body (optional)
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func fakeOuterNumberSerialize(body: OuterNumber? = nil, completion: @escaping ((_ data: OuterNumber?,_ error: Error?) -> Void)) {
|
||||
open class func fakeOuterNumberSerialize(body: Double? = nil, completion: @escaping ((_ data: Double?,_ error: Error?) -> Void)) {
|
||||
fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
completion(response?.body, error)
|
||||
}
|
||||
@@ -96,20 +86,17 @@ open class FakeAPI {
|
||||
/**
|
||||
- POST /fake/outer/number
|
||||
- Test serialization of outer number types
|
||||
- examples: [{contentType=application/json, example={ }}]
|
||||
|
||||
- parameter body: (body) Input number as post body (optional)
|
||||
|
||||
- returns: RequestBuilder<OuterNumber>
|
||||
- returns: RequestBuilder<Double>
|
||||
*/
|
||||
open class func fakeOuterNumberSerializeWithRequestBuilder(body: OuterNumber? = nil) -> RequestBuilder<OuterNumber> {
|
||||
open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder<Double> {
|
||||
let path = "/fake/outer/number"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<OuterNumber>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let requestBuilder: RequestBuilder<Double>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
|
||||
}
|
||||
@@ -119,7 +106,7 @@ open class FakeAPI {
|
||||
- parameter body: (body) Input string as post body (optional)
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func fakeOuterStringSerialize(body: OuterString? = nil, completion: @escaping ((_ data: OuterString?,_ error: Error?) -> Void)) {
|
||||
open class func fakeOuterStringSerialize(body: String? = nil, completion: @escaping ((_ data: String?,_ error: Error?) -> Void)) {
|
||||
fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
completion(response?.body, error)
|
||||
}
|
||||
@@ -129,32 +116,67 @@ open class FakeAPI {
|
||||
/**
|
||||
- POST /fake/outer/string
|
||||
- Test serialization of outer string types
|
||||
- examples: [{contentType=application/json, example={ }}]
|
||||
|
||||
- parameter body: (body) Input string as post body (optional)
|
||||
|
||||
- returns: RequestBuilder<OuterString>
|
||||
- returns: RequestBuilder<String>
|
||||
*/
|
||||
open class func fakeOuterStringSerializeWithRequestBuilder(body: OuterString? = nil) -> RequestBuilder<OuterString> {
|
||||
open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder<String> {
|
||||
let path = "/fake/outer/string"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
let requestBuilder: RequestBuilder<OuterString>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
let requestBuilder: RequestBuilder<String>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder()
|
||||
|
||||
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
|
||||
}
|
||||
|
||||
/**
|
||||
To test \"client\" model
|
||||
|
||||
- parameter body: (body) client model
|
||||
|
||||
- parameter query: (query)
|
||||
- parameter user: (body)
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testClientModel(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
|
||||
testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func testBodyWithQueryParams(query: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
testBodyWithQueryParamsWithRequestBuilder(query: query, user: user).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
completion(nil, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
- PUT /fake/body-with-query-params
|
||||
- parameter query: (query)
|
||||
- parameter user: (body)
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testBodyWithQueryParamsWithRequestBuilder(query: String, user: User) -> RequestBuilder<Void> {
|
||||
let path = "/fake/body-with-query-params"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
|
||||
|
||||
var url = URLComponents(string: URLString)
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"query": query
|
||||
])
|
||||
|
||||
let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder()
|
||||
|
||||
return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true)
|
||||
}
|
||||
|
||||
/**
|
||||
To test \"client\" model
|
||||
|
||||
- parameter client: (body) client model
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testClientModel(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
|
||||
testClientModelWithRequestBuilder(client: client).execute { (response, error) -> Void in
|
||||
completion(response?.body, error)
|
||||
}
|
||||
}
|
||||
@@ -164,18 +186,13 @@ open class FakeAPI {
|
||||
To test \"client\" model
|
||||
- PATCH /fake
|
||||
- To test \"client\" model
|
||||
- examples: [{contentType=application/json, example={
|
||||
"client" : "client"
|
||||
}}]
|
||||
|
||||
- parameter body: (body) client model
|
||||
|
||||
- parameter client: (body) client model
|
||||
- returns: RequestBuilder<Client>
|
||||
*/
|
||||
open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
|
||||
open class func testClientModelWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
@@ -203,7 +220,7 @@ open class FakeAPI {
|
||||
- parameter callback: (form) None (optional)
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
@@ -219,9 +236,8 @@ open class FakeAPI {
|
||||
- POST /fake
|
||||
- Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트
|
||||
- BASIC:
|
||||
- type: basic
|
||||
- type: http
|
||||
- name: http_basic_test
|
||||
|
||||
- parameter number: (form) None
|
||||
- parameter double: (form) None
|
||||
- parameter patternWithoutDelimiter: (form) None
|
||||
@@ -236,10 +252,9 @@ open class FakeAPI {
|
||||
- parameter dateTime: (form) None (optional)
|
||||
- parameter password: (form) None (optional)
|
||||
- parameter callback: (form) None (optional)
|
||||
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> {
|
||||
open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: URL? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String:Any?] = [
|
||||
@@ -269,23 +284,6 @@ open class FakeAPI {
|
||||
return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
|
||||
}
|
||||
|
||||
/**
|
||||
* enum for parameter enumFormStringArray
|
||||
*/
|
||||
public enum EnumFormStringArray_testEnumParameters: String {
|
||||
case greaterThan = ">"
|
||||
case dollar = "$"
|
||||
}
|
||||
|
||||
/**
|
||||
* enum for parameter enumFormString
|
||||
*/
|
||||
public enum EnumFormString_testEnumParameters: String {
|
||||
case abc = "_abc"
|
||||
case efg = "-efg"
|
||||
case xyz = "(xyz)"
|
||||
}
|
||||
|
||||
/**
|
||||
* enum for parameter enumHeaderStringArray
|
||||
*/
|
||||
@@ -336,21 +334,38 @@ open class FakeAPI {
|
||||
case number12 = -1.2
|
||||
}
|
||||
|
||||
/**
|
||||
* enum for parameter enumFormStringArray
|
||||
*/
|
||||
public enum EnumFormStringArray_testEnumParameters: [String] {
|
||||
case greaterThan = >
|
||||
case dollar = $
|
||||
}
|
||||
|
||||
/**
|
||||
* enum for parameter enumFormString
|
||||
*/
|
||||
public enum EnumFormString_testEnumParameters: String {
|
||||
case abc = "_abc"
|
||||
case efg = "-efg"
|
||||
case xyz = "(xyz)"
|
||||
}
|
||||
|
||||
/**
|
||||
To test enum parameters
|
||||
|
||||
- parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional)
|
||||
- parameter enumFormString: (form) Form parameter enum test (string) (optional, default to -efg)
|
||||
- parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional)
|
||||
- parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to -efg)
|
||||
- parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional)
|
||||
- parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to -efg)
|
||||
- parameter enumQueryInteger: (query) Query parameter enum test (double) (optional)
|
||||
- parameter enumQueryDouble: (form) Query parameter enum test (double) (optional)
|
||||
- parameter enumQueryDouble: (query) Query parameter enum test (double) (optional)
|
||||
- parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional)
|
||||
- parameter enumFormString: (form) Form parameter enum test (string) (optional)
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
testEnumParametersWithRequestBuilder(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble).execute { (response, error) -> Void in
|
||||
open class func testEnumParameters(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray]_testEnumParameters? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
@@ -364,25 +379,22 @@ open class FakeAPI {
|
||||
To test enum parameters
|
||||
- GET /fake
|
||||
- To test enum parameters
|
||||
|
||||
- parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional)
|
||||
- parameter enumFormString: (form) Form parameter enum test (string) (optional, default to -efg)
|
||||
- parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional)
|
||||
- parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to -efg)
|
||||
- parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional)
|
||||
- parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to -efg)
|
||||
- parameter enumQueryInteger: (query) Query parameter enum test (double) (optional)
|
||||
- parameter enumQueryDouble: (form) Query parameter enum test (double) (optional)
|
||||
|
||||
- parameter enumQueryDouble: (query) Query parameter enum test (double) (optional)
|
||||
- parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional)
|
||||
- parameter enumFormString: (form) Form parameter enum test (string) (optional)
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> RequestBuilder<Void> {
|
||||
open class func testEnumParametersWithRequestBuilder(enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray]_testEnumParameters? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) -> RequestBuilder<Void> {
|
||||
let path = "/fake"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let formParams: [String:Any?] = [
|
||||
"enum_form_string_array": enumFormStringArray,
|
||||
"enum_form_string": enumFormString?.rawValue,
|
||||
"enum_query_double": enumQueryDouble?.rawValue
|
||||
"enum_form_string_array": enumFormStringArray?.rawValue,
|
||||
"enum_form_string": enumFormString?.rawValue
|
||||
]
|
||||
|
||||
let nonNullParameters = APIHelper.rejectNil(formParams)
|
||||
@@ -392,7 +404,8 @@ open class FakeAPI {
|
||||
url?.queryItems = APIHelper.mapValuesToQueryItems([
|
||||
"enum_query_string_array": enumQueryStringArray,
|
||||
"enum_query_string": enumQueryString?.rawValue,
|
||||
"enum_query_integer": enumQueryInteger?.rawValue
|
||||
"enum_query_integer": enumQueryInteger?.rawValue,
|
||||
"enum_query_double": enumQueryDouble?.rawValue
|
||||
])
|
||||
let nillableHeaders: [String: Any?] = [
|
||||
"enum_header_string_array": enumHeaderStringArray,
|
||||
@@ -408,11 +421,11 @@ open class FakeAPI {
|
||||
/**
|
||||
test inline additionalProperties
|
||||
|
||||
- parameter param: (body) request body
|
||||
- parameter requestBody: (body) request body
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testInlineAdditionalProperties(param: Any, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute { (response, error) -> Void in
|
||||
open class func testInlineAdditionalProperties(requestBody: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
testInlineAdditionalPropertiesWithRequestBuilder(requestBody: requestBody).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
@@ -425,16 +438,13 @@ open class FakeAPI {
|
||||
/**
|
||||
test inline additionalProperties
|
||||
- POST /fake/inline-additionalProperties
|
||||
-
|
||||
|
||||
- parameter param: (body) request body
|
||||
|
||||
- parameter requestBody: (body) request body
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testInlineAdditionalPropertiesWithRequestBuilder(param: Any) -> RequestBuilder<Void> {
|
||||
open class func testInlineAdditionalPropertiesWithRequestBuilder(requestBody: String) -> RequestBuilder<Void> {
|
||||
let path = "/fake/inline-additionalProperties"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: param)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
@@ -464,11 +474,8 @@ open class FakeAPI {
|
||||
/**
|
||||
test json serialization of form data
|
||||
- GET /fake/jsonFormData
|
||||
-
|
||||
|
||||
- parameter param: (form) field1
|
||||
- parameter param2: (form) field2
|
||||
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> {
|
||||
|
||||
@@ -14,11 +14,11 @@ open class FakeClassnameTags123API {
|
||||
/**
|
||||
To test class name in snake case
|
||||
|
||||
- parameter body: (body) client model
|
||||
- parameter client: (body) client model
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func testClassname(body: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
|
||||
testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func testClassname(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) {
|
||||
testClassnameWithRequestBuilder(client: client).execute { (response, error) -> Void in
|
||||
completion(response?.body, error)
|
||||
}
|
||||
}
|
||||
@@ -31,18 +31,13 @@ open class FakeClassnameTags123API {
|
||||
- API Key:
|
||||
- type: apiKey api_key_query (QUERY)
|
||||
- name: api_key_query
|
||||
- examples: [{contentType=application/json, example={
|
||||
"client" : "client"
|
||||
}}]
|
||||
|
||||
- parameter body: (body) client model
|
||||
|
||||
- parameter client: (body) client model
|
||||
- returns: RequestBuilder<Client>
|
||||
*/
|
||||
open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> {
|
||||
open class func testClassnameWithRequestBuilder(client: Client) -> RequestBuilder<Client> {
|
||||
let path = "/fake_classname_test"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: client)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ open class PetAPI {
|
||||
/**
|
||||
Add a new pet to the store
|
||||
|
||||
- parameter body: (body) Pet object that needs to be added to the store
|
||||
- parameter pet: (body) Pet object that needs to be added to the store
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func addPet(body: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func addPet(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
@@ -31,19 +31,16 @@ open class PetAPI {
|
||||
/**
|
||||
Add a new pet to the store
|
||||
- POST /pet
|
||||
-
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
|
||||
- parameter body: (body) Pet object that needs to be added to the store
|
||||
|
||||
- parameter pet: (body) Pet object that needs to be added to the store
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
|
||||
open class func addPetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
|
||||
let path = "/pet"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
@@ -73,14 +70,11 @@ open class PetAPI {
|
||||
/**
|
||||
Deletes a pet
|
||||
- DELETE /pet/{petId}
|
||||
-
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
|
||||
- parameter petId: (path) Pet id to delete
|
||||
- parameter apiKey: (header) (optional)
|
||||
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> {
|
||||
@@ -131,93 +125,7 @@ open class PetAPI {
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
- examples: [{contentType=application/xml, example=<Pet>
|
||||
<id>123456789</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
<photoUrls>aeiou</photoUrls>
|
||||
</photoUrls>
|
||||
<tags>
|
||||
</tags>
|
||||
<status>aeiou</status>
|
||||
</Pet>}, {contentType=application/json, example=[ {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
}, {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
} ]}]
|
||||
- examples: [{contentType=application/xml, example=<Pet>
|
||||
<id>123456789</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
<photoUrls>aeiou</photoUrls>
|
||||
</photoUrls>
|
||||
<tags>
|
||||
</tags>
|
||||
<status>aeiou</status>
|
||||
</Pet>}, {contentType=application/json, example=[ {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
}, {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
} ]}]
|
||||
|
||||
- parameter status: (query) Status values that need to be considered for filter
|
||||
|
||||
- returns: RequestBuilder<[Pet]>
|
||||
*/
|
||||
open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> {
|
||||
@@ -255,93 +163,7 @@ open class PetAPI {
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
- examples: [{contentType=application/xml, example=<Pet>
|
||||
<id>123456789</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
<photoUrls>aeiou</photoUrls>
|
||||
</photoUrls>
|
||||
<tags>
|
||||
</tags>
|
||||
<status>aeiou</status>
|
||||
</Pet>}, {contentType=application/json, example=[ {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
}, {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
} ]}]
|
||||
- examples: [{contentType=application/xml, example=<Pet>
|
||||
<id>123456789</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
<photoUrls>aeiou</photoUrls>
|
||||
</photoUrls>
|
||||
<tags>
|
||||
</tags>
|
||||
<status>aeiou</status>
|
||||
</Pet>}, {contentType=application/json, example=[ {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
}, {
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
} ]}]
|
||||
|
||||
- parameter tags: (query) Tags to filter by
|
||||
|
||||
- returns: RequestBuilder<[Pet]>
|
||||
*/
|
||||
open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> {
|
||||
@@ -379,61 +201,7 @@ open class PetAPI {
|
||||
- API Key:
|
||||
- type: apiKey api_key
|
||||
- name: api_key
|
||||
- examples: [{contentType=application/xml, example=<Pet>
|
||||
<id>123456789</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
<photoUrls>aeiou</photoUrls>
|
||||
</photoUrls>
|
||||
<tags>
|
||||
</tags>
|
||||
<status>aeiou</status>
|
||||
</Pet>}, {contentType=application/json, example={
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
}}]
|
||||
- examples: [{contentType=application/xml, example=<Pet>
|
||||
<id>123456789</id>
|
||||
<name>doggie</name>
|
||||
<photoUrls>
|
||||
<photoUrls>aeiou</photoUrls>
|
||||
</photoUrls>
|
||||
<tags>
|
||||
</tags>
|
||||
<status>aeiou</status>
|
||||
</Pet>}, {contentType=application/json, example={
|
||||
"photoUrls" : [ "photoUrls", "photoUrls" ],
|
||||
"name" : "doggie",
|
||||
"id" : 0,
|
||||
"category" : {
|
||||
"name" : "name",
|
||||
"id" : 6
|
||||
},
|
||||
"tags" : [ {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
}, {
|
||||
"name" : "name",
|
||||
"id" : 1
|
||||
} ],
|
||||
"status" : "available"
|
||||
}}]
|
||||
|
||||
- parameter petId: (path) ID of pet to return
|
||||
|
||||
- returns: RequestBuilder<Pet>
|
||||
*/
|
||||
open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> {
|
||||
@@ -454,11 +222,11 @@ open class PetAPI {
|
||||
/**
|
||||
Update an existing pet
|
||||
|
||||
- parameter body: (body) Pet object that needs to be added to the store
|
||||
- parameter pet: (body) Pet object that needs to be added to the store
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func updatePet(body: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func updatePet(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
@@ -471,19 +239,16 @@ open class PetAPI {
|
||||
/**
|
||||
Update an existing pet
|
||||
- PUT /pet
|
||||
-
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
|
||||
- parameter body: (body) Pet object that needs to be added to the store
|
||||
|
||||
- parameter pet: (body) Pet object that needs to be added to the store
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> {
|
||||
open class func updatePetWithRequestBuilder(pet: Pet) -> RequestBuilder<Void> {
|
||||
let path = "/pet"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: pet)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
@@ -514,15 +279,12 @@ open class PetAPI {
|
||||
/**
|
||||
Updates a pet in the store with form data
|
||||
- POST /pet/{petId}
|
||||
-
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
|
||||
- parameter petId: (path) ID of pet that needs to be updated
|
||||
- parameter name: (form) Updated name of the pet (optional)
|
||||
- parameter status: (form) Updated status of the pet (optional)
|
||||
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> {
|
||||
@@ -564,20 +326,12 @@ open class PetAPI {
|
||||
/**
|
||||
uploads an image
|
||||
- POST /pet/{petId}/uploadImage
|
||||
-
|
||||
- OAuth:
|
||||
- type: oauth2
|
||||
- name: petstore_auth
|
||||
- examples: [{contentType=application/json, example={
|
||||
"code" : 0,
|
||||
"type" : "type",
|
||||
"message" : "message"
|
||||
}}]
|
||||
|
||||
- parameter petId: (path) ID of pet to update
|
||||
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
|
||||
- parameter file: (form) file to upload (optional)
|
||||
|
||||
- returns: RequestBuilder<ApiResponse>
|
||||
*/
|
||||
open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> {
|
||||
|
||||
@@ -32,9 +32,7 @@ open class StoreAPI {
|
||||
Delete purchase order by ID
|
||||
- DELETE /store/order/{order_id}
|
||||
- For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
- parameter orderId: (path) ID of the order that needs to be deleted
|
||||
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> {
|
||||
@@ -71,10 +69,6 @@ open class StoreAPI {
|
||||
- API Key:
|
||||
- type: apiKey api_key
|
||||
- name: api_key
|
||||
- examples: [{contentType=application/json, example={
|
||||
"key" : 0
|
||||
}}]
|
||||
|
||||
- returns: RequestBuilder<[String:Int]>
|
||||
*/
|
||||
open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int]> {
|
||||
@@ -106,39 +100,7 @@ open class StoreAPI {
|
||||
Find purchase order by ID
|
||||
- GET /store/order/{order_id}
|
||||
- For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
- examples: [{contentType=application/xml, example=<Order>
|
||||
<id>123456789</id>
|
||||
<petId>123456789</petId>
|
||||
<quantity>123</quantity>
|
||||
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
|
||||
<status>aeiou</status>
|
||||
<complete>true</complete>
|
||||
</Order>}, {contentType=application/json, example={
|
||||
"petId" : 6,
|
||||
"quantity" : 1,
|
||||
"id" : 0,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
}}]
|
||||
- examples: [{contentType=application/xml, example=<Order>
|
||||
<id>123456789</id>
|
||||
<petId>123456789</petId>
|
||||
<quantity>123</quantity>
|
||||
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
|
||||
<status>aeiou</status>
|
||||
<complete>true</complete>
|
||||
</Order>}, {contentType=application/json, example={
|
||||
"petId" : 6,
|
||||
"quantity" : 1,
|
||||
"id" : 0,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
}}]
|
||||
|
||||
- parameter orderId: (path) ID of pet that needs to be fetched
|
||||
|
||||
- returns: RequestBuilder<Order>
|
||||
*/
|
||||
open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> {
|
||||
@@ -159,11 +121,11 @@ open class StoreAPI {
|
||||
/**
|
||||
Place an order for a pet
|
||||
|
||||
- parameter body: (body) order placed for purchasing the pet
|
||||
- parameter order: (body) order placed for purchasing the pet
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func placeOrder(body: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) {
|
||||
placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func placeOrder(order: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) {
|
||||
placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in
|
||||
completion(response?.body, error)
|
||||
}
|
||||
}
|
||||
@@ -172,46 +134,13 @@ open class StoreAPI {
|
||||
/**
|
||||
Place an order for a pet
|
||||
- POST /store/order
|
||||
-
|
||||
- examples: [{contentType=application/xml, example=<Order>
|
||||
<id>123456789</id>
|
||||
<petId>123456789</petId>
|
||||
<quantity>123</quantity>
|
||||
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
|
||||
<status>aeiou</status>
|
||||
<complete>true</complete>
|
||||
</Order>}, {contentType=application/json, example={
|
||||
"petId" : 6,
|
||||
"quantity" : 1,
|
||||
"id" : 0,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
}}]
|
||||
- examples: [{contentType=application/xml, example=<Order>
|
||||
<id>123456789</id>
|
||||
<petId>123456789</petId>
|
||||
<quantity>123</quantity>
|
||||
<shipDate>2000-01-23T04:56:07.000Z</shipDate>
|
||||
<status>aeiou</status>
|
||||
<complete>true</complete>
|
||||
</Order>}, {contentType=application/json, example={
|
||||
"petId" : 6,
|
||||
"quantity" : 1,
|
||||
"id" : 0,
|
||||
"shipDate" : "2000-01-23T04:56:07.000+00:00",
|
||||
"complete" : false,
|
||||
"status" : "placed"
|
||||
}}]
|
||||
|
||||
- parameter body: (body) order placed for purchasing the pet
|
||||
|
||||
- parameter order: (body) order placed for purchasing the pet
|
||||
- returns: RequestBuilder<Order>
|
||||
*/
|
||||
open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> {
|
||||
open class func placeOrderWithRequestBuilder(order: Order) -> RequestBuilder<Order> {
|
||||
let path = "/store/order"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: order)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
|
||||
@@ -14,11 +14,11 @@ open class UserAPI {
|
||||
/**
|
||||
Create user
|
||||
|
||||
- parameter body: (body) Created user object
|
||||
- parameter user: (body) Created user object
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func createUser(body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func createUser(user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
@@ -32,15 +32,13 @@ open class UserAPI {
|
||||
Create user
|
||||
- POST /user
|
||||
- This can only be done by the logged in user.
|
||||
|
||||
- parameter body: (body) Created user object
|
||||
|
||||
- parameter user: (body) Created user object
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> {
|
||||
open class func createUserWithRequestBuilder(user: User) -> RequestBuilder<Void> {
|
||||
let path = "/user"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
@@ -52,11 +50,11 @@ open class UserAPI {
|
||||
/**
|
||||
Creates list of users with given input array
|
||||
|
||||
- parameter body: (body) List of user object
|
||||
- parameter user: (body) List of user object
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func createUsersWithArrayInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
@@ -69,16 +67,13 @@ open class UserAPI {
|
||||
/**
|
||||
Creates list of users with given input array
|
||||
- POST /user/createWithArray
|
||||
-
|
||||
|
||||
- parameter body: (body) List of user object
|
||||
|
||||
- parameter user: (body) List of user object
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
|
||||
open class func createUsersWithArrayInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
|
||||
let path = "/user/createWithArray"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
@@ -90,11 +85,11 @@ open class UserAPI {
|
||||
/**
|
||||
Creates list of users with given input array
|
||||
|
||||
- parameter body: (body) List of user object
|
||||
- parameter user: (body) List of user object
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func createUsersWithListInput(body: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in
|
||||
open class func createUsersWithListInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
@@ -107,16 +102,13 @@ open class UserAPI {
|
||||
/**
|
||||
Creates list of users with given input array
|
||||
- POST /user/createWithList
|
||||
-
|
||||
|
||||
- parameter body: (body) List of user object
|
||||
|
||||
- parameter user: (body) List of user object
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> {
|
||||
open class func createUsersWithListInputWithRequestBuilder(user: [User]) -> RequestBuilder<Void> {
|
||||
let path = "/user/createWithList"
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
@@ -146,9 +138,7 @@ open class UserAPI {
|
||||
Delete user
|
||||
- DELETE /user/{username}
|
||||
- This can only be done by the logged in user.
|
||||
|
||||
- parameter username: (path) The name that needs to be deleted
|
||||
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> {
|
||||
@@ -182,48 +172,7 @@ open class UserAPI {
|
||||
/**
|
||||
Get user by user name
|
||||
- GET /user/{username}
|
||||
-
|
||||
- examples: [{contentType=application/xml, example=<User>
|
||||
<id>123456789</id>
|
||||
<username>aeiou</username>
|
||||
<firstName>aeiou</firstName>
|
||||
<lastName>aeiou</lastName>
|
||||
<email>aeiou</email>
|
||||
<password>aeiou</password>
|
||||
<phone>aeiou</phone>
|
||||
<userStatus>123</userStatus>
|
||||
</User>}, {contentType=application/json, example={
|
||||
"firstName" : "firstName",
|
||||
"lastName" : "lastName",
|
||||
"password" : "password",
|
||||
"userStatus" : 6,
|
||||
"phone" : "phone",
|
||||
"id" : 0,
|
||||
"email" : "email",
|
||||
"username" : "username"
|
||||
}}]
|
||||
- examples: [{contentType=application/xml, example=<User>
|
||||
<id>123456789</id>
|
||||
<username>aeiou</username>
|
||||
<firstName>aeiou</firstName>
|
||||
<lastName>aeiou</lastName>
|
||||
<email>aeiou</email>
|
||||
<password>aeiou</password>
|
||||
<phone>aeiou</phone>
|
||||
<userStatus>123</userStatus>
|
||||
</User>}, {contentType=application/json, example={
|
||||
"firstName" : "firstName",
|
||||
"lastName" : "lastName",
|
||||
"password" : "password",
|
||||
"userStatus" : 6,
|
||||
"phone" : "phone",
|
||||
"id" : 0,
|
||||
"email" : "email",
|
||||
"username" : "username"
|
||||
}}]
|
||||
|
||||
- parameter username: (path) The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
- returns: RequestBuilder<User>
|
||||
*/
|
||||
open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> {
|
||||
@@ -258,15 +207,9 @@ open class UserAPI {
|
||||
/**
|
||||
Logs user into the system
|
||||
- GET /user/login
|
||||
-
|
||||
- responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)]
|
||||
- responseHeaders: [X-Rate-Limit(Int), X-Expires-After(Date)]
|
||||
- examples: [{contentType=application/xml, example=aeiou}, {contentType=application/json, example=""}]
|
||||
- examples: [{contentType=application/xml, example=aeiou}, {contentType=application/json, example=""}]
|
||||
|
||||
- parameter username: (query) The user name for login
|
||||
- parameter password: (query) The password for login in clear text
|
||||
|
||||
- returns: RequestBuilder<String>
|
||||
*/
|
||||
open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> {
|
||||
@@ -304,8 +247,6 @@ open class UserAPI {
|
||||
/**
|
||||
Logs out current logged in user session
|
||||
- GET /user/logout
|
||||
-
|
||||
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> {
|
||||
@@ -324,11 +265,11 @@ open class UserAPI {
|
||||
Updated user
|
||||
|
||||
- parameter username: (path) name that need to be deleted
|
||||
- parameter body: (body) Updated user object
|
||||
- parameter user: (body) Updated user object
|
||||
- parameter completion: completion handler to receive the data and the error objects
|
||||
*/
|
||||
open class func updateUser(username: String, body: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in
|
||||
open class func updateUser(username: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
|
||||
updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in
|
||||
if error == nil {
|
||||
completion((), error)
|
||||
} else {
|
||||
@@ -342,19 +283,17 @@ open class UserAPI {
|
||||
Updated user
|
||||
- PUT /user/{username}
|
||||
- This can only be done by the logged in user.
|
||||
|
||||
- parameter username: (path) name that need to be deleted
|
||||
- parameter body: (body) Updated user object
|
||||
|
||||
- parameter user: (body) Updated user object
|
||||
- returns: RequestBuilder<Void>
|
||||
*/
|
||||
open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> {
|
||||
open class func updateUserWithRequestBuilder(username: String, user: User) -> RequestBuilder<Void> {
|
||||
var path = "/user/{username}"
|
||||
let usernamePreEscape = "\(username)"
|
||||
let usernamePostEscape = usernamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
|
||||
path = path.replacingOccurrences(of: "{username}", with: usernamePostEscape, options: .literal, range: nil)
|
||||
let URLString = PetstoreClientAPI.basePath + path
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
|
||||
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: user)
|
||||
|
||||
let url = URLComponents(string: URLString)
|
||||
|
||||
|
||||
@@ -19,13 +19,13 @@ public struct FormatTest: Codable {
|
||||
public var double: Double?
|
||||
public var string: String?
|
||||
public var byte: Data
|
||||
public var binary: Data?
|
||||
public var binary: URL?
|
||||
public var date: Date
|
||||
public var dateTime: Date?
|
||||
public var uuid: UUID?
|
||||
public var password: String
|
||||
|
||||
public init(integer: Int?, int32: Int?, int64: Int64?, number: Double, float: Float?, double: Double?, string: String?, byte: Data, binary: Data?, date: Date, dateTime: Date?, uuid: UUID?, password: String) {
|
||||
public init(integer: Int?, int32: Int?, int64: Int64?, number: Double, float: Float?, double: Double?, string: String?, byte: Data, binary: URL?, date: Date, dateTime: Date?, uuid: UUID?, password: String) {
|
||||
self.integer = integer
|
||||
self.int32 = int32
|
||||
self.int64 = int64
|
||||
|
||||
@@ -11,14 +11,14 @@ import Foundation
|
||||
|
||||
public struct List: Codable {
|
||||
|
||||
public var _123List: String?
|
||||
public var _123list: String?
|
||||
|
||||
public init(_123List: String?) {
|
||||
self._123List = _123List
|
||||
public init(_123list: String?) {
|
||||
self._123list = _123list
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case _123List = "123-list"
|
||||
case _123list = "123-list"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,20 +15,20 @@ public struct Name: Codable {
|
||||
public var name: Int
|
||||
public var snakeCase: Int?
|
||||
public var property: String?
|
||||
public var _123Number: Int?
|
||||
public var _123number: Int?
|
||||
|
||||
public init(name: Int, snakeCase: Int?, property: String?, _123Number: Int?) {
|
||||
public init(name: Int, snakeCase: Int?, property: String?, _123number: Int?) {
|
||||
self.name = name
|
||||
self.snakeCase = snakeCase
|
||||
self.property = property
|
||||
self._123Number = _123Number
|
||||
self._123number = _123number
|
||||
}
|
||||
|
||||
public enum CodingKeys: String, CodingKey {
|
||||
case name
|
||||
case snakeCase = "snake_case"
|
||||
case property
|
||||
case _123Number = "123Number"
|
||||
case _123number = "123Number"
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import Foundation
|
||||
|
||||
public struct OuterComposite: Codable {
|
||||
|
||||
public var myNumber: OuterNumber?
|
||||
public var myString: OuterString?
|
||||
public var myBoolean: OuterBoolean?
|
||||
public var myNumber: Double?
|
||||
public var myString: String?
|
||||
public var myBoolean: Bool?
|
||||
|
||||
public init(myNumber: OuterNumber?, myString: OuterString?, myBoolean: OuterBoolean?) {
|
||||
public init(myNumber: Double?, myString: String?, myBoolean: Bool?) {
|
||||
self.myNumber = myNumber
|
||||
self.myString = myString
|
||||
self.myBoolean = myBoolean
|
||||
|
||||
Reference in New Issue
Block a user