* Add test cases for body-byte.json

* Add putBase64UrlEncoded test case

* Remove unnecessary file

* Remove create project option in testserver_codegen.py

* Add generated code for body-number.json

* Change default swift type for Number from Float to Double

* Add test case for AutorestSwiftTest/AutoRestNumberTest.swift

* Update to use decimal

* All code compiled

* Refactor

* All code compiled. 5 number test failed

* Refactor

* Fix compile warnings in test case

* WIP. All generated code compiled. But test cases failed to compile

* Add generated code for header.json

* Bug fix

* Bug fix

* Bug fix. Fix broken tests

* Refactor

* Refactor

* All generated code compiled

* Add decode Demical to String

* Refactor

* Fix compile error

* WIP

* Regenerate test code

* Fix compile issue

* Refactor

* Bug fixes.

* Bug fix:

* Address PR feedback

* Fix compile warnings and all test cases passed

* Refactor

* Refactor

* Refactor

* Merge changes

* WIP. All tests passed

* All generated code compile. All test cases pass

* Refactor

* Refactor

* Refactor

* Address PR feedback

* Address PR feedback

* Address PR feedback

* Address PR feedback

* ADdress PR feedback

* Address PR feedback
This commit is contained in:
Sam Cheung 2020-11-16 13:56:30 -08:00 коммит произвёл GitHub
Родитель d7e8f41e2d
Коммит ba32c83d68
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
51 изменённых файлов: 5103 добавлений и 96 удалений

Просмотреть файл

@ -281,7 +281,7 @@ class AutoRestSwaggerBatTest: XCTestCase {
client.enumOperation.put(notExpandable: Colors.redColor) { result, httpResponse in
switch result {
case let .success:
case .success:
XCTAssertEqual(httpResponse?.statusCode, 200)
case let .failure(error):
let details = errorDetails(for: error, withResponse: httpResponse)

Просмотреть файл

@ -26,7 +26,8 @@ working_files = [
"custom-baseUrl",
"body-string",
"body-byte",
"body-number"
"body-number",
"header"
]
def get_all_files():

Просмотреть файл

@ -112,4 +112,36 @@ class ConstantSchema: Schema {
try super.encode(to: encoder)
}
/// Convert the Constant into String format in Swift
/// - Parameter skipUrlEncoding: a flag to indicate if the string should skip url encoding
/// - Returns: A swift string in generated code
public func formatValue(skipUrlEncoding: Bool) -> String {
let constantValue: String = value.value
let type = valueType.type
if type == .string,
skipUrlEncoding {
return "\"\(constantValue)\".removingPercentEncoding ?? \"\""
} else {
switch type {
case .date,
.unixTime,
.dateTime,
.byteArray,
.string:
return "\"\(constantValue)\""
case .number:
let numberSchema = valueType
let swiftType = numberSchema.swiftType()
if swiftType == "Decimal" {
return "\(swiftType)(\(constantValue))"
} else {
return "String(\(swiftType)(\(constantValue)))"
}
default:
return "String(\(constantValue))"
}
}
}
}

Просмотреть файл

@ -151,6 +151,59 @@ enum ParameterType: Codable {
internal func belongsInOptions() -> Bool {
return common.belongsInOptions()
}
/// Convert the type into String format in Swift
/// - Parameter value: Value of the swift string
/// - Returns: A swift string in generated code
public func formatValue(_ valueIn: String? = nil) -> String {
let value = valueIn ?? name
switch schema.type {
case .integer,
.boolean,
.number:
return "String(\(value))"
// For these types, a variable will be created in the method using the naming convention `{key|value}String`
case .date,
.unixTime,
.dateTime,
.byteArray:
return "\(value)String"
case .choice,
.sealedChoice:
return "\(value).rawValue"
case .array:
return "\(value).map { String($0) }.joined(separator: \"\(delimiter)\") "
case .duration:
return "DateComponentsFormatter().string(from: \(value)) ?? \"\""
default:
return "\(value)"
}
}
var keyValueDecodeStrategy: KeyValueDecodeStrategy {
switch schema.type {
case .date,
.unixTime:
return .date
case .dateTime:
return .dateTime
case .byteArray:
if let byteArraySchema = schema as? ByteArraySchema,
byteArraySchema.format == .base64url {
return .base64ByteArray
} else {
return .byteArray
}
case .number:
if let numberSchema = schema as? NumberSchema {
return (numberSchema.swiftType() == "Decimal") ? .decimal : .number
} else {
return .number
}
default:
return .default
}
}
}
extension ParameterType: Equatable {

Просмотреть файл

@ -124,6 +124,8 @@ class Schema: Codable, LanguageShortcut {
fatalError("Type mismatch. Expected constant type but got \(self)")
}
swiftType = constant.valueType.swiftType()
case AllSchemaTypes.duration:
swiftType = "DateComponents"
default:
fatalError("Type \(type) not implemented")
}

Просмотреть файл

@ -68,7 +68,7 @@ struct KeyValueViewModel: Comparable {
if let constantSchema = param.schema as? ConstantSchema {
self.init(param: param, constantSchema: constantSchema, name: name)
} else if let signatureParameter = operation.signatureParameter(for: name) {
self.init(signatureParameter: signatureParameter, name: name)
self.init(signatureParameter: signatureParameter)
} else if let groupedBy = param.groupedBy?.name {
self.init(key: name, value: "\(groupedBy).\(name)")
} else if param.implementation == .client {
@ -81,85 +81,48 @@ struct KeyValueViewModel: Comparable {
)
} else if param.paramLocation == .body {
let bodyParamName = operation.request?.bodyParamName(for: operation)
self.init(signatureParameter: param, name: bodyParamName ?? name, value: bodyParamName)
self.init(bodySignatureParameter: param, bodyParamName: bodyParamName)
} else {
self.init(key: name, value: "")
}
}
private init(signatureParameter: ParameterType) {
self.key = signatureParameter.serializedName ?? signatureParameter.name
self.path = signatureParameter.belongsInOptions() ? "options?." : ""
self.optional = !signatureParameter.required
self.needDecodingInMethod = signatureParameter.required
// value is referring a signature parameter, no need to wrap as String
self.value = signatureParameter.formatValue()
self.strategy = signatureParameter.keyValueDecodeStrategy.rawValue
}
private init(param: ParameterType, constantSchema: ConstantSchema, name: String) {
self.optional = false
self.needDecodingInMethod = false
self.path = ""
self.key = name
let constantValue: String = constantSchema.value.value
self.strategy = KeyValueDecodeStrategy.default.rawValue
let type = constantSchema.valueType.type
if type == .string,
param.value.isSkipUrlEncoding {
self.value = "\"\(constantValue)\".removingPercentEncoding ?? \"\""
} else {
switch type {
case .date,
.unixTime,
.dateTime,
.byteArray,
.string:
self.value = "\"\(constantValue)\""
case .number:
let numberSchema = constantSchema.valueType
let swiftType = numberSchema.swiftType()
if swiftType == "Decimal" {
self.value = "\(swiftType)(\(constantValue))"
} else {
self.value = "String(\(swiftType)(\(constantValue)))"
}
default:
self.value = "String(\(constantValue))"
}
}
self.value = constantSchema.formatValue(skipUrlEncoding: param.value.isSkipUrlEncoding)
}
private init(signatureParameter: ParameterType, name: String, value: String? = nil) {
self.key = name
self.path = signatureParameter.belongsInOptions() ? "options?." : ""
self.optional = !signatureParameter.required
var needDecodingInMethod = signatureParameter.required
var keyValueType = KeyValueDecodeStrategy.default
let type = signatureParameter.schema.type
private init(bodySignatureParameter: ParameterType, bodyParamName: String?) {
self.path = bodySignatureParameter.belongsInOptions() ? "options?." : ""
self.optional = !bodySignatureParameter.required
var needDecodingInMethod = bodySignatureParameter.required
let type = bodySignatureParameter.schema.type
// value is referring a signature parameter, no need to wrap as String
self.value = value ?? KeyValueViewModel.formatValue(forSignatureParameter: signatureParameter, value: name)
// if parameter is from method signature (not from option) and type is date or byteArray,
// add decoding logic to string in the method and specify the right decoding strategy
switch type {
case .date,
.unixTime:
keyValueType = .date
needDecodingInMethod = signatureParameter.paramLocation == .body ? false : needDecodingInMethod
case .dateTime:
keyValueType = .dateTime
case .byteArray:
if let byteArraySchema = signatureParameter.schema as? ByteArraySchema,
byteArraySchema.format == .base64url {
keyValueType = .base64ByteArray
} else {
keyValueType = .byteArray
}
needDecodingInMethod = signatureParameter.paramLocation == .body ? false : needDecodingInMethod
case .number:
if let numberSchema = signatureParameter.schema as? NumberSchema {
keyValueType = numberSchema.swiftType() == "Decimal" ? .decimal : .number
} else {
keyValueType = .number
}
default:
keyValueType = .default
self.value = bodyParamName ?? bodySignatureParameter.formatValue(bodyParamName)
self.key = bodyParamName ?? bodySignatureParameter.name
if type == .date || type == .byteArray || type == .unixTime {
needDecodingInMethod = bodySignatureParameter.paramLocation == .body ? false : needDecodingInMethod
}
self.needDecodingInMethod = needDecodingInMethod
self.strategy = keyValueType.rawValue
self.strategy = bodySignatureParameter.keyValueDecodeStrategy.rawValue
}
/**
@ -178,33 +141,6 @@ struct KeyValueViewModel: Comparable {
self.needDecodingInMethod = false
}
/**
Convert the type into String format in Swift
*/
private static func formatValue(forSignatureParameter signatureParameter: ParameterType, value: String) -> String {
let type = signatureParameter.schema.type
switch type {
case .integer,
.boolean:
return "String(\(value))"
// For these types, a variable will be created in the method using the naming convention `{key|value}String`
case .date,
.unixTime,
.dateTime,
.byteArray:
return "\(value)String"
case .number:
return signatureParameter.required ? "\(value)String" : "String(\(value))"
case .choice,
.sealedChoice:
return "\(value).rawValue"
case .array:
return "\(value).map { String($0) }.joined(separator: \"\(signatureParameter.delimiter)\") "
default:
return "\(value)"
}
}
static func < (lhs: KeyValueViewModel, rhs: KeyValueViewModel) -> Bool {
return lhs.key < rhs.key
}

Просмотреть файл

@ -66,7 +66,7 @@ struct OperationParameters {
}
}
let allParams = query.required + path + body
let allParams = query.required + path + body + header.required
for param in allParams where param.needDecodingInMethod {
methodDecoding.append(param)
}

Просмотреть файл

@ -41,7 +41,7 @@ struct ParameterViewModel {
if let name = specificName, !name.isEmpty {
self.name = name
} else {
self.name = param.serializedName ?? param.name
self.name = (param.implementation == .client) ? param.serializedName ?? param.name : param.name
}
self.optional = !param.required
self.type = param.schema.swiftType(optional: optional)

Просмотреть файл

@ -7,8 +7,9 @@ if let {{ param.key }} = {{ param.path }}{{ param.key }} {
}
{% endfor %}
// Header options
{% for header in op.params.header.optional %}
if let {{ header.key }} = {{ param.path }}{{ header.key }} {
headers["{{ header.key }}"] = {{ header.value}}
{% for param in op.params.header.optional %}
if let {{ param.key }} = {{ param.path }}{{ param.key }} {
{% include "OperationOptionsDecodingSnippet.stencil" %}
headers["{{ param.key }}"] = {{ param.value}}
}
{% endfor %}

Просмотреть файл

@ -25,3 +25,4 @@ extension Data {
return base64UrlString
}
}

Просмотреть файл

@ -0,0 +1,21 @@
author: Microsoft
author_url: https://azure.github.io/azure-sdk/
github_url: https://github.com/Azure/azure-sdk-for-ios
module: AutoRestSwaggerBatHeader
module_version: 0.1
readme: ../sdk/secret/AutoRestSwaggerBatHeader/README.md
skip_undocumented: false
theme: fullwidth
output: ../build/jazzy/AutoRestSwaggerBatHeader
swift_build_tool: spm
clean: true
sdk: iphonesimulator
swift_build_tool: spm
build_tool_arguments:
- "-Xswiftc"
- "-swift-version"
- "-Xswiftc"
- "5"
exclude:
- "*/Source/ObjectiveCCompatibility/*"
- "*/Tests/*"

Просмотреть файл

@ -0,0 +1,39 @@
// swift-tools-version:5.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
//
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import PackageDescription
let package = Package(
name: "AutoRestSwaggerBatHeader",
platforms: [
.macOS(.v10_15), .iOS(.v12), .tvOS(.v12)
],
products: [
.library(name: "AutoRestSwaggerBatHeader", type: .static, targets: ["AutoRestSwaggerBatHeader"])
],
dependencies: [
.package(
url: "https://github.com/Azure/azure-sdk-for-ios.git",
.revision("3e3c80d60173613c8dd4cb6b219188cf5070e8e7")
)
],
targets: [
// Build targets
.target(
name: "AutoRestSwaggerBatHeader",
dependencies: ["AzureCore"],
path: "Source"
)
],
swiftLanguageVersions: [.v5]
)

Просмотреть файл

@ -0,0 +1,16 @@
# AutoRest Swagger BAT Header Service client library for iOS
Test Infrastructure for AutoRest
[Source code](TODO: Find source URL) | [API reference documentation](TODO: Find API docs URL) | [Product documentation](TODO: Find product documenation URL) | [Samples](TODO: Find samples URL)
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
![Impressions](TODO: Find impressions URL)

Просмотреть файл

@ -0,0 +1,123 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable file_length
// swiftlint:disable cyclomatic_complexity
// swiftlint:disable function_body_length
// swiftlint:disable type_body_length
extension CharacterSet {
static let azureUrlQueryAllowed = urlQueryAllowed.subtracting(.init(charactersIn: "!*'();:@&=+$,/?"))
static let azureUrlPathAllowed = urlPathAllowed.subtracting(.init(charactersIn: "!*'()@&=+$,/:"))
}
public final class AutoRestSwaggerBatHeaderClient: PipelineClient {
/// API version of the to invoke. Defaults to the latest.
public enum ApiVersion: String {
/// API version ""
case v = ""
/// The most recent API version of the
public static var latest: ApiVersion {
return .v
}
}
/// Options provided to configure this `AutoRestSwaggerBatHeaderClient`.
public let options: AutoRestSwaggerBatHeaderClientOptions
// MARK: Initializers
/// Create a AutoRestSwaggerBatHeaderClient client.
/// - Parameters:
/// - endpoint: Base URL for the AutoRestSwaggerBatHeaderClient.
/// - authPolicy: An `Authenticating` policy to use for authenticating client requests.
/// - options: Options used to configure the client.
public init(
url: URL? = nil,
authPolicy: Authenticating,
withOptions options: AutoRestSwaggerBatHeaderClientOptions
) throws {
let defaultHost = URL(string: "http://localhost:3000")
guard let endpoint = url ?? defaultHost else {
fatalError("Unable to determine base URL. ")
}
self.options = options
super.init(
endpoint: endpoint,
transport: options.transportOptions.transport ?? URLSessionTransport(),
policies: [
UserAgentPolicy(for: AutoRestSwaggerBatHeaderClient.self, telemetryOptions: options.telemetryOptions),
RequestIdPolicy(),
AddDatePolicy(),
authPolicy,
ContentDecodePolicy(),
LoggingPolicy(),
NormalizeETagPolicy()
],
logger: options.logger,
options: options
)
}
public func url(
host hostIn: String? = nil,
template templateIn: String,
pathParams pathParamsIn: [String: String]? = nil,
queryParams queryParamsIn: [QueryParameter]? = nil
) -> URL? {
var template = templateIn
var hostString = hostIn
if template.hasPrefix("/") { template = String(template.dropFirst()) }
if let pathParams = pathParamsIn {
for (key, value) in pathParams {
if let encodedPathValue = value.addingPercentEncoding(withAllowedCharacters: .azureUrlPathAllowed) {
template = template.replacingOccurrences(of: "{\(key)}", with: encodedPathValue)
}
if let host = hostString {
hostString = host.replacingOccurrences(of: "{\(key)}", with: value)
}
}
}
if let hostUnwrapped = hostString,
!hostUnwrapped.hasSuffix("/") {
hostString = hostUnwrapped + "/"
}
let urlString = (hostString ?? endpoint.absoluteString) + template
guard let url = URL(string: urlString) else {
return nil
}
guard !(queryParamsIn?.isEmpty ?? false) else { return url }
return appendingQueryParameters(url: url, queryParamsIn ?? [])
}
private func appendingQueryParameters(url: URL, _ queryParams: [QueryParameter]) -> URL? {
guard !queryParams.isEmpty else { return url }
guard var urlComps = URLComponents(url: url, resolvingAgainstBaseURL: true) else { return nil }
let queryItems = queryParams.map { name, value in URLQueryItem(
name: name,
value: value?.addingPercentEncoding(withAllowedCharacters: .azureUrlQueryAllowed)
) }
urlComps.percentEncodedQueryItems = queryItems
return urlComps.url
}
public lazy var header: Header = Header(client: self)
// MARK: Public Client Methods
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,20 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
public enum GreyscaleColors: String, Codable {
case white = "White"
case black = "black"
case grey = "GREY"
}

Просмотреть файл

@ -0,0 +1,58 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
// swiftlint:disable cyclomatic_complexity
public struct ErrorType: Codable, Swift.Error {
// MARK: Properties
public let status: Int32?
public let message: String?
// MARK: Initializers
/// Initialize a `ErrorType` structure.
/// - Parameters:
/// - status:
/// - message:
public init(
status: Int32? = nil, message: String? = nil
) {
self.status = status
self.message = message
}
// MARK: Codable
enum CodingKeys: String, CodingKey {
case status
case message
}
/// Initialize a `ErrorType` structure from decoder
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.status = try? container.decode(Int32.self, forKey: .status)
self.message = try? container.decode(String.self, forKey: .message)
}
/// Encode a `ErrorType` structure
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
if status != nil { try? container.encode(status, forKey: .status) }
if message != nil { try? container.encode(message, forKey: .message) }
}
}

Просмотреть файл

@ -0,0 +1,50 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
/// User-configurable options for the `AutoRestSwaggerBatHeaderClient`.
public struct AutoRestSwaggerBatHeaderClientOptions: ClientOptions {
/// The API version of the to invoke.
public let apiVersion: String
/// The `ClientLogger` to be used by this `AutoRestSwaggerBatHeaderClient`.
public let logger: ClientLogger
/// Options for configuring telemetry sent by this `AutoRestSwaggerBatHeaderClient`.
public let telemetryOptions: TelemetryOptions
/// Global transport options
public let transportOptions: TransportOptions
/// The default dispatch queue on which to call all completion handler. Defaults to `DispatchQueue.main`.
public let dispatchQueue: DispatchQueue?
/// Initialize a `AutoRestSwaggerBatHeaderClientOptions` structure.
/// - Parameters:
/// - apiVersion: The API version of the to invoke.
/// - logger: The `ClientLogger` to be used by this `AutoRestSwaggerBatHeaderClient`.
/// - telemetryOptions: Options for configuring telemetry sent by this `AutoRestSwaggerBatHeaderClient`.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: The default dispatch queue on which to call all completion handler. Defaults to `DispatchQueue.main`.
public init(
apiVersion: AutoRestSwaggerBatHeaderClient.ApiVersion = .latest,
logger: ClientLogger = ClientLoggers.default(tag: "AutoRestSwaggerBatHeaderClientClient"),
telemetryOptions: TelemetryOptions = TelemetryOptions(),
transportOptions: TransportOptions? = nil,
dispatchQueue: DispatchQueue? = nil
) {
self.apiVersion = apiVersion.rawValue
self.logger = logger
self.telemetryOptions = telemetryOptions
self.transportOptions = transportOptions ?? TransportOptions()
self.dispatchQueue = dispatchQueue
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.CustomRequestId` operation.
public struct CustomRequestIdOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `CustomRequestIdOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamBool` operation.
public struct ParamBoolOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamBoolOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamByte` operation.
public struct ParamByteOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamByteOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamDate` operation.
public struct ParamDateOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamDateOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamDatetime` operation.
public struct ParamDatetimeOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamDatetimeOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,58 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamDatetimeRfc1123` operation.
public struct ParamDatetimeRfc1123Options: RequestOptions {
/// Send a post request with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT"
public let value: Date?
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamDatetimeRfc1123Options` structure.
/// - Parameters:
/// - value: Send a post request with header values "Wed, 01 Jan 2010 12:34:56 GMT" or "Mon, 01 Jan 0001 00:00:00 GMT"
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
value: Date? = nil,
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.value = value
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamDouble` operation.
public struct ParamDoubleOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamDoubleOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamDuration` operation.
public struct ParamDurationOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamDurationOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,58 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamEnum` operation.
public struct ParamEnumOptions: RequestOptions {
/// Send a post request with header values 'GREY'
public let value: GreyscaleColors?
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamEnumOptions` structure.
/// - Parameters:
/// - value: Send a post request with header values 'GREY'
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
value: GreyscaleColors? = nil,
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.value = value
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamExistingKey` operation.
public struct ParamExistingKeyOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamExistingKeyOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamFloat` operation.
public struct ParamFloatOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamFloatOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamInteger` operation.
public struct ParamIntegerOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamIntegerOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamLong` operation.
public struct ParamLongOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamLongOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamProtectedKey` operation.
public struct ParamProtectedKeyOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamProtectedKeyOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,58 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ParamString` operation.
public struct ParamStringOptions: RequestOptions {
/// Send a post request with header values "The quick brown fox jumps over the lazy dog" or null or ""
public let value: String?
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ParamStringOptions` structure.
/// - Parameters:
/// - value: Send a post request with header values "The quick brown fox jumps over the lazy dog" or null or ""
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
value: String? = nil,
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.value = value
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseBool` operation.
public struct ResponseBoolOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseBoolOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseByte` operation.
public struct ResponseByteOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseByteOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseDate` operation.
public struct ResponseDateOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseDateOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseDatetime` operation.
public struct ResponseDatetimeOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseDatetimeOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseDatetimeRfc1123` operation.
public struct ResponseDatetimeRfc1123Options: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseDatetimeRfc1123Options` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseDouble` operation.
public struct ResponseDoubleOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseDoubleOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseDuration` operation.
public struct ResponseDurationOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseDurationOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseEnum` operation.
public struct ResponseEnumOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseEnumOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseExistingKey` operation.
public struct ResponseExistingKeyOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseExistingKeyOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseFloat` operation.
public struct ResponseFloatOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseFloatOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseInteger` operation.
public struct ResponseIntegerOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseIntegerOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseLong` operation.
public struct ResponseLongOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseLongOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseProtectedKey` operation.
public struct ResponseProtectedKeyOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseProtectedKeyOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,52 @@
// --------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// --------------------------------------------------------------------------
import AzureCore
import Foundation
// swiftlint:disable superfluous_disable_command
// swiftlint:disable identifier_name
// swiftlint:disable line_length
extension Header {
/// User-configurable options for the `AutoRestSwaggerBATHeaderService.ResponseString` operation.
public struct ResponseStringOptions: RequestOptions {
/// A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// Highly recommended for correlating client-side activites with requests received by the server.
public let clientRequestId: String?
/// A token used to make a best-effort attempt at canceling a request.
public let cancellationToken: CancellationToken?
/// A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
public var dispatchQueue: DispatchQueue?
/// A `PipelineContext` object to associate with the request.
public var context: PipelineContext?
/// Initialize a `ResponseStringOptions` structure.
/// - Parameters:
/// - clientRequestId: A client-generated, opaque value with 1KB character limit that is recorded in analytics logs.
/// - cancellationToken: A token used to make a best-effort attempt at canceling a request.
/// - dispatchQueue: A dispatch queue on which to call the completion handler. Defaults to `DispatchQueue.main`.
/// - context: A `PipelineContext` object to associate with the request.
public init(
clientRequestId: String? = nil,
cancellationToken: CancellationToken? = nil,
dispatchQueue: DispatchQueue? = nil,
context: PipelineContext? = nil
) {
self.clientRequestId = clientRequestId
self.cancellationToken = cancellationToken
self.dispatchQueue = dispatchQueue
self.context = context
}
}
}

Просмотреть файл

@ -0,0 +1,169 @@
// --------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The MIT License (MIT)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the ""Software""), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//
// --------------------------------------------------------------------------
// Original code found:
// https://stackoverflow.com/a/48582964/2918468
import Foundation
protocol ExtensionStringDecodeKeys {
var stringDecodedKeys: [String] { get }
}
public struct AnyCodable: Decodable {
var value: Any
struct CodingKeys: CodingKey {
var stringValue: String
var intValue: Int?
init?(intValue: Int) {
self.stringValue = "\(intValue)"
self.intValue = intValue
}
init?(stringValue: String) { self.stringValue = stringValue }
}
// A sets of extensions key should be always decode as String type
static var extensionStringDecodedKey: CodingUserInfoKey {
return CodingUserInfoKey(rawValue: "stringDecoded")!
}
init(value: Any) {
self.value = value
}
private func decodeDictionary(withDecoder decoder: Decoder) throws -> [String: Any] {
let container = try decoder.container(keyedBy: CodingKeys.self)
var result = [String: Any]()
try container.allKeys.forEach { (key) throws in
result[key.stringValue] = try container.decode(AnyCodable.self, forKey: key).value
}
return result
}
private func decodeArray(withDecoder decoder: Decoder) throws -> [Any] {
var container = try decoder.unkeyedContainer()
var result = [Any]()
while !container.isAtEnd {
result.append(try container.decode(AnyCodable.self).value)
}
return result
}
private func decodeSimple(withDecoder decoder: Decoder) throws -> Any {
let container = try decoder.singleValueContainer()
let currentCodingKey = container.codingPath[container.codingPath.count - 1]
let extensionKeys = decoder.userInfo[AnyCodable.extensionStringDecodedKey] as? ExtensionStringDecodeKeys
let stringDecodedKeys = extensionKeys?.stringDecodedKeys
// if the current coding key is part of the stringDecodedKeys, always decode as String. This is because
// the values of these properties are always digits, they will be deocded as Int instead of string by default
let shouldDecodedAsString = stringDecodedKeys?.contains(currentCodingKey.stringValue) ?? false
if shouldDecodedAsString {
if let stringVal = try? container.decode(String.self) {
return stringVal
} else {
throw DecodingError.dataCorruptedError(
in: container,
debugDescription: "the container contains nothing serializable"
)
}
} else if let intVal = try? container.decode(Int.self) {
if let stringVal = try? container.decode(String.self) {
// If the decode int value is only partial of the string value, use string value instead
if String(intVal) == stringVal {
return intVal
} else {
return stringVal
}
} else {
return intVal
}
} else if let doubleVal = try? container.decode(Double.self) {
return doubleVal
} else if let boolVal = try? container.decode(Bool.self) {
return boolVal
} else if let stringVal = try? container.decode(String.self) {
return stringVal
} else {
throw DecodingError.dataCorruptedError(
in: container,
debugDescription: "the container contains nothing serializable"
)
}
}
public init(from decoder: Decoder) throws {
self.value = "" as Any
let dictVal = try? decodeDictionary(withDecoder: decoder)
let arrayVal = try? decodeArray(withDecoder: decoder)
let simpleVal = try? decodeSimple(withDecoder: decoder)
guard let value = dictVal ?? arrayVal ?? simpleVal else {
throw DecodingError.dataCorrupted(
DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Could not serialise")
)
}
self.value = value
}
}
extension AnyCodable: Encodable {
public func encode(to encoder: Encoder) throws {
if let array = value as? [Any] {
var container = encoder.unkeyedContainer()
for value in array {
let decodable = AnyCodable(value: value)
try container.encode(decodable)
}
} else if let dictionary = value as? [String: Any] {
var container = encoder.container(keyedBy: CodingKeys.self)
for (key, value) in dictionary {
let codingKey = CodingKeys(stringValue: key)!
let decodable = AnyCodable(value: value)
try container.encode(decodable, forKey: codingKey)
}
} else {
var container = encoder.singleValueContainer()
if let intVal = value as? Int {
try container.encode(intVal)
} else if let doubleVal = value as? Double {
try container.encode(doubleVal)
} else if let boolVal = value as? Bool {
try container.encode(boolVal)
} else if let stringVal = value as? String {
try container.encode(stringVal)
} else {
throw EncodingError.invalidValue(
value,
EncodingError.Context(codingPath: [], debugDescription: "The value is not encodable")
)
}
}
}
}

Просмотреть файл

@ -0,0 +1,70 @@
import Foundation
// TODO: Remove this when these objects are in AzureCore
enum MergePatchOpType: String, Codable {
case add
case remove
case replace
case move
case copy
case test
}
// TODO: NO support for nil-setting sentinel
struct MergePatchOperation: Encodable {
let operation: MergePatchOpType
let from: String?
let path: String
let value: String?
// MARK: Encodable
enum CodingKeys: String, CodingKey {
case operation, from, path, value
}
func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(operation, forKey: .operation)
try container.encode(from, forKey: .from)
try container.encode(path, forKey: .path)
try container.encode(value, forKey: .value)
}
}
/// Helper class for creating PatchObjects
final class MergePatchObject: Encodable {
fileprivate var operations = [MergePatchOperation]()
/// Inserts a new value at an array index or adds a new property.
func add(atPath path: String, withValue value: String) {
operations.append(MergePatchOperation(operation: .add, from: nil, path: path, value: value))
}
/// Remove the property or entry at an array index. Property must exist.
func remove(atPath path: String) {
operations.append(MergePatchOperation(operation: .remove, from: nil, path: path, value: nil))
}
/// Replaces the value at the target location with a new value. Existing value must exist.
func replace(atPath path: String, withValue value: String) {
operations.append(MergePatchOperation(operation: .replace, from: nil, path: path, value: value))
}
/// Remove the value at a specified location and adds it to the target location.
func move(fromPath src: String, toPath dest: String) {
operations.append(MergePatchOperation(operation: .move, from: src, path: dest, value: nil))
}
/// Copies the value at a specified location and adds it to the target location.
func copy(fromPath src: String, toPath dest: String) {
operations.append(MergePatchOperation(operation: .copy, from: src, path: dest, value: nil))
}
/// Tests that a value at the target location is equal to a specified value.
func test(atPath path: String, equalsValue value: String) {
operations.append(MergePatchOperation(operation: .test, from: nil, path: path, value: value))
}
}

Просмотреть файл

@ -0,0 +1,27 @@
import Foundation
extension String: LocalizedError {
public var errorDescription: String? { return self }
}
extension Int: LocalizedError {
public var errorDescription: String? { return String(self) }
}
extension Int32: LocalizedError {
public var errorDescription: String? { return String(self) }
}
extension Int64: LocalizedError {
public var errorDescription: String? { return String(self) }
}
extension Data {
func base64URLEncodedString() -> String {
let base64String = base64EncodedString()
let base64UrlString = base64String.replacingOccurrences(of: "/", with: "_")
.replacingOccurrences(of: "+", with: "-")
.replacingOccurrences(of: "=", with: "")
return base64UrlString
}
}

Просмотреть файл

@ -292,4 +292,114 @@ public final class PetOperation {
}
}
}
/// Ensure you can correctly deserialize the returned PetActionError and deserialization doesn't conflict with the input param name 'models'
/// - Parameters:
/// - options: A list of options for the operation
/// - completionHandler: A completion handler that receives a status code on
/// success.
public func hasModelsParam(
withOptions options: HasModelsParamOptions? = nil,
completionHandler: @escaping HTTPResultHandler<Void>
) {
// Construct URL
let urlTemplate = "/errorStatusCodes/Pets/hasModelsParam"
let pathParams = [
"$host": client.endpoint.absoluteString
]
// Construct query
var queryParams: [QueryParameter] = [
]
// Construct headers
var headers = HTTPHeaders()
headers["Accept"] = "application/json"
// Process endpoint options
// Query options
if let models = options?.models {
queryParams.append("models", models)
}
// Header options
// Construct request
guard let requestUrl = url(
host: "{$host}",
template: urlTemplate,
pathParams: pathParams,
queryParams: queryParams
) else {
self.options.logger.error("Failed to construct request url")
return
}
guard let request = try? HTTPRequest(method: .post, url: requestUrl, headers: headers) else {
self.options.logger.error("Failed to construct Http request")
return
}
// Send request
let context = PipelineContext.of(keyValues: [
ContextKey.allowedStatusCodes.rawValue: [200, 500] as AnyObject
])
context.add(cancellationToken: options?.cancellationToken, applying: self.options)
context.merge(with: options?.context)
self.request(request, context: context) { result, httpResponse in
let dispatchQueue = options?.dispatchQueue ?? self.commonOptions.dispatchQueue ?? DispatchQueue.main
guard let data = httpResponse?.data else {
let noDataError = AzureError.client("Response data expected but not found.")
dispatchQueue.async {
completionHandler(.failure(noDataError), httpResponse)
}
return
}
switch result {
case .success:
guard let statusCode = httpResponse?.statusCode else {
let noStatusCodeError = AzureError.client("Expected a status code in response but didn't find one.")
dispatchQueue.async {
completionHandler(.failure(noStatusCodeError), httpResponse)
}
return
}
if [
200
].contains(statusCode) {
dispatchQueue.async {
completionHandler(
.success(()),
httpResponse
)
}
}
if [
500
].contains(statusCode) {
do {
let decoder = JSONDecoder()
let decoded = try decoder.decode(PetActionError.self, from: data)
dispatchQueue.async {
completionHandler(.failure(AzureError.service("", decoded)), httpResponse)
}
} catch {
dispatchQueue.async {
completionHandler(.failure(AzureError.client("Decoding error.", error)), httpResponse)
}
}
}
case .failure:
do {
let decoder = JSONDecoder()
let decoded = try decoder.decode(PetActionError.self, from: data)
dispatchQueue.async {
completionHandler(.failure(AzureError.service("", decoded)), httpResponse)
}
} catch {
dispatchQueue.async {
completionHandler(.failure(AzureError.client("Decoding error.", error)), httpResponse)
}
}
}
}
}
}