-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateAPI.swift
More file actions
432 lines (400 loc) · 44 KB
/
Copy pathGenerateAPI.swift
File metadata and controls
432 lines (400 loc) · 44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
//
// GenerateAPI.swift
//
// Generated by openapi-generator
// https://openapi-generator.tech
//
import Foundation
open class GenerateAPI {
/**
Generate a barcode using a GET request with parameters in the route and query string.
- parameter barcodeType: (path) Type of barcode to generate.
- parameter data: (query) String that represents the data to encode.
- parameter dataType: (query) Type of data to encode. Default value: StringData. (optional)
- parameter imageFormat: (query) Barcode output image format. Default value: png. (optional)
- parameter textLocation: (query) Specify the displayed text location. Set to CodeLocation.None to hide CodeText. Default value depends on BarcodeType: CodeLocation.Below for 1D barcodes and CodeLocation.None for 2D barcodes. (optional)
- parameter foregroundColor: (query) Specify the display color for bars and content. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: Black. (optional, default to "Black")
- parameter backgroundColor: (query) Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: White. (optional, default to "White")
- parameter units: (query) Common units for all measurements. Default units: pixels. (optional)
- parameter resolution: (query) Resolution of the barcode image. One value for both dimensions. Default value: 96 dpi. Decimal separator is a dot. (optional)
- parameter imageHeight: (query) Height of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter imageWidth: (query) Width of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter rotationAngle: (query) Barcode image rotation angle, measured in degrees. For example, RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle is not equal to 90, 180, 270, or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. (optional)
- parameter qrEncodeMode: (query) QR barcode encode mode. (optional)
- parameter qrErrorLevel: (query) QR barcode error correction level. (optional)
- parameter qrVersion: (query) QR barcode version. Automatically selects the smallest version that fits the data. (optional)
- parameter qrECIEncoding: (query) ECI encoding for QR barcode data. (optional)
- parameter qrAspectRatio: (query) QR barcode aspect ratio. Values: 0 to 1. (optional)
- parameter microQRVersion: (query) MicroQR barcode version. Used when BarcodeType is MicroQR. (optional)
- parameter rectMicroQrVersion: (query) RectMicroQR barcode version. Used when BarcodeType is RectMicroQR. (optional)
- parameter code128EncodeMode: (query) Code128 barcode encode mode. Controls which Code 128 subset (A, B, C, or mix) is used. (optional)
- parameter pdf417EncodeMode: (query) PDF417 barcode encode mode. (optional)
- parameter pdf417ErrorLevel: (query) PDF417 barcode error correction level. (optional)
- parameter pdf417Truncate: (query) Whether to use truncated PDF417 format (removes right-side stop pattern). (optional)
- parameter pdf417Columns: (query) Number of columns in the PDF417 barcode. Values between 1 and 30. 0 for auto. (optional)
- parameter pdf417Rows: (query) Number of rows in the PDF417 barcode. Values between 3 and 90. 0 for automatic. (optional)
- parameter pdf417AspectRatio: (query) PDF417 barcode aspect ratio (height/width of the barcode module). Values are defined by the standard: 2 to 5 for MicroPdf417; 3 to 5 for Pdf417 and MacroPdf417. (optional)
- parameter pdf417ECIEncoding: (query) ECI encoding for PDF417 barcode data. (optional)
- parameter pdf417IsReaderInitialization: (query) Whether the barcode is used for reader initialization (programming). (optional)
- parameter pdf417MacroCharacters: (query) Macro character to prepend (structured append). (optional)
- parameter pdf417IsLinked: (query) Whether to use linked mode (for MicroPdf417). (optional)
- parameter pdf417IsCode128Emulation: (query) Whether to use Code128 emulation for MicroPdf417. (optional)
- parameter apiConfiguration: The configuration for the http request.
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
open class func generate(barcodeType: EncodeBarcodeType, data: String, dataType: EncodeDataType? = nil, barcodeImageParams: BarcodeImageParams? = nil, qrParams: QrParams? = nil, code128Params: Code128Params? = nil, pdf417Params: Pdf417Params? = nil, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Data?, _ error: Error?) -> Void) -> RequestTask {
generateWithRequestBuilder(barcodeType: barcodeType, data: data, dataType: dataType, barcodeImageParams: barcodeImageParams, qrParams: qrParams, code128Params: code128Params, pdf417Params: pdf417Params, apiConfiguration: apiConfiguration).execute { result in
switch result {
case let .success(response):
completion(response.body, nil)
case let .failure(error):
completion(nil, error)
}
}
}
/**
Generate a barcode using a GET request with parameters in the route and query string.
- parameter barcodeType: (path) Type of barcode to generate.
- parameter data: (query) String that represents the data to encode.
- parameter dataType: (query) Type of data to encode. Default value: StringData. (optional)
- parameter imageFormat: (query) Barcode output image format. Default value: png. (optional)
- parameter textLocation: (query) Specify the displayed text location. Set to CodeLocation.None to hide CodeText. Default value depends on BarcodeType: CodeLocation.Below for 1D barcodes and CodeLocation.None for 2D barcodes. (optional)
- parameter foregroundColor: (query) Specify the display color for bars and content. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: Black. (optional, default to "Black")
- parameter backgroundColor: (query) Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: White. (optional, default to "White")
- parameter units: (query) Common units for all measurements. Default units: pixels. (optional)
- parameter resolution: (query) Resolution of the barcode image. One value for both dimensions. Default value: 96 dpi. Decimal separator is a dot. (optional)
- parameter imageHeight: (query) Height of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter imageWidth: (query) Width of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter rotationAngle: (query) Barcode image rotation angle, measured in degrees. For example, RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle is not equal to 90, 180, 270, or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. (optional)
- parameter qrEncodeMode: (query) QR barcode encode mode. (optional)
- parameter qrErrorLevel: (query) QR barcode error correction level. (optional)
- parameter qrVersion: (query) QR barcode version. Automatically selects the smallest version that fits the data. (optional)
- parameter qrECIEncoding: (query) ECI encoding for QR barcode data. (optional)
- parameter qrAspectRatio: (query) QR barcode aspect ratio. Values: 0 to 1. (optional)
- parameter microQRVersion: (query) MicroQR barcode version. Used when BarcodeType is MicroQR. (optional)
- parameter rectMicroQrVersion: (query) RectMicroQR barcode version. Used when BarcodeType is RectMicroQR. (optional)
- parameter code128EncodeMode: (query) Code128 barcode encode mode. Controls which Code 128 subset (A, B, C, or mix) is used. (optional)
- parameter pdf417EncodeMode: (query) PDF417 barcode encode mode. (optional)
- parameter pdf417ErrorLevel: (query) PDF417 barcode error correction level. (optional)
- parameter pdf417Truncate: (query) Whether to use truncated PDF417 format (removes right-side stop pattern). (optional)
- parameter pdf417Columns: (query) Number of columns in the PDF417 barcode. Values between 1 and 30. 0 for auto. (optional)
- parameter pdf417Rows: (query) Number of rows in the PDF417 barcode. Values between 3 and 90. 0 for automatic. (optional)
- parameter pdf417AspectRatio: (query) PDF417 barcode aspect ratio (height/width of the barcode module). Values are defined by the standard: 2 to 5 for MicroPdf417; 3 to 5 for Pdf417 and MacroPdf417. (optional)
- parameter pdf417ECIEncoding: (query) ECI encoding for PDF417 barcode data. (optional)
- parameter pdf417IsReaderInitialization: (query) Whether the barcode is used for reader initialization (programming). (optional)
- parameter pdf417MacroCharacters: (query) Macro character to prepend (structured append). (optional)
- parameter pdf417IsLinked: (query) Whether to use linked mode (for MicroPdf417). (optional)
- parameter pdf417IsCode128Emulation: (query) Whether to use Code128 emulation for MicroPdf417. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: Data
*/
open class func generate(barcodeType: EncodeBarcodeType, data: String, dataType: EncodeDataType? = nil, barcodeImageParams: BarcodeImageParams? = nil, qrParams: QrParams? = nil, code128Params: Code128Params? = nil, pdf417Params: Pdf417Params? = nil, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared) async throws(ErrorResponse) -> Data {
try await generateWithRequestBuilder(barcodeType: barcodeType, data: data, dataType: dataType, barcodeImageParams: barcodeImageParams, qrParams: qrParams, code128Params: code128Params, pdf417Params: pdf417Params, apiConfiguration: apiConfiguration).execute().body
}
/**
Generate a barcode using a GET request with parameters in the route and query string.
- GET /barcode/generate/{barcodeType}
- OAuth:
- type: oauth2
- name: JWT
- parameter barcodeType: (path) Type of barcode to generate.
- parameter data: (query) String that represents the data to encode.
- parameter dataType: (query) Type of data to encode. Default value: StringData. (optional)
- parameter imageFormat: (query) Barcode output image format. Default value: png. (optional)
- parameter textLocation: (query) Specify the displayed text location. Set to CodeLocation.None to hide CodeText. Default value depends on BarcodeType: CodeLocation.Below for 1D barcodes and CodeLocation.None for 2D barcodes. (optional)
- parameter foregroundColor: (query) Specify the display color for bars and content. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: Black. (optional, default to "Black")
- parameter backgroundColor: (query) Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: White. (optional, default to "White")
- parameter units: (query) Common units for all measurements. Default units: pixels. (optional)
- parameter resolution: (query) Resolution of the barcode image. One value for both dimensions. Default value: 96 dpi. Decimal separator is a dot. (optional)
- parameter imageHeight: (query) Height of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter imageWidth: (query) Width of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter rotationAngle: (query) Barcode image rotation angle, measured in degrees. For example, RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle is not equal to 90, 180, 270, or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. (optional)
- parameter qrEncodeMode: (query) QR barcode encode mode. (optional)
- parameter qrErrorLevel: (query) QR barcode error correction level. (optional)
- parameter qrVersion: (query) QR barcode version. Automatically selects the smallest version that fits the data. (optional)
- parameter qrECIEncoding: (query) ECI encoding for QR barcode data. (optional)
- parameter qrAspectRatio: (query) QR barcode aspect ratio. Values: 0 to 1. (optional)
- parameter microQRVersion: (query) MicroQR barcode version. Used when BarcodeType is MicroQR. (optional)
- parameter rectMicroQrVersion: (query) RectMicroQR barcode version. Used when BarcodeType is RectMicroQR. (optional)
- parameter code128EncodeMode: (query) Code128 barcode encode mode. Controls which Code 128 subset (A, B, C, or mix) is used. (optional)
- parameter pdf417EncodeMode: (query) PDF417 barcode encode mode. (optional)
- parameter pdf417ErrorLevel: (query) PDF417 barcode error correction level. (optional)
- parameter pdf417Truncate: (query) Whether to use truncated PDF417 format (removes right-side stop pattern). (optional)
- parameter pdf417Columns: (query) Number of columns in the PDF417 barcode. Values between 1 and 30. 0 for auto. (optional)
- parameter pdf417Rows: (query) Number of rows in the PDF417 barcode. Values between 3 and 90. 0 for automatic. (optional)
- parameter pdf417AspectRatio: (query) PDF417 barcode aspect ratio (height/width of the barcode module). Values are defined by the standard: 2 to 5 for MicroPdf417; 3 to 5 for Pdf417 and MacroPdf417. (optional)
- parameter pdf417ECIEncoding: (query) ECI encoding for PDF417 barcode data. (optional)
- parameter pdf417IsReaderInitialization: (query) Whether the barcode is used for reader initialization (programming). (optional)
- parameter pdf417MacroCharacters: (query) Macro character to prepend (structured append). (optional)
- parameter pdf417IsLinked: (query) Whether to use linked mode (for MicroPdf417). (optional)
- parameter pdf417IsCode128Emulation: (query) Whether to use Code128 emulation for MicroPdf417. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Data>
*/
open class func generateWithRequestBuilder(barcodeType: EncodeBarcodeType, data: String, dataType: EncodeDataType? = nil, barcodeImageParams: BarcodeImageParams? = nil, qrParams: QrParams? = nil, code128Params: Code128Params? = nil, pdf417Params: Pdf417Params? = nil, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared) -> RequestBuilder<Data> {
var localVariablePath = "/barcode/generate/{barcodeType}"
let barcodeTypePreEscape = "\(APIHelper.mapValueToPathItem(barcodeType))"
let barcodeTypePostEscape = barcodeTypePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
localVariablePath = localVariablePath.replacingOccurrences(of: "{barcodeType}", with: barcodeTypePostEscape, options: .literal, range: nil)
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters: [String: any Sendable]? = nil
var localVariableUrlComponents = URLComponents(string: localVariableURLString)
localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([
"dataType": (wrappedValue: dataType?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"data": (wrappedValue: data.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"imageFormat": (wrappedValue: barcodeImageParams?.imageFormat?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"textLocation": (wrappedValue: barcodeImageParams?.textLocation?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"foregroundColor": (wrappedValue: barcodeImageParams?.foregroundColor?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"backgroundColor": (wrappedValue: barcodeImageParams?.backgroundColor?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"units": (wrappedValue: barcodeImageParams?.units?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"resolution": (wrappedValue: barcodeImageParams?.resolution?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"imageHeight": (wrappedValue: barcodeImageParams?.imageHeight?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"imageWidth": (wrappedValue: barcodeImageParams?.imageWidth?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"rotationAngle": (wrappedValue: barcodeImageParams?.rotationAngle?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"qrEncodeMode": (wrappedValue: qrParams?.qrEncodeMode?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"qrErrorLevel": (wrappedValue: qrParams?.qrErrorLevel?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"qrVersion": (wrappedValue: qrParams?.qrVersion?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"qrECIEncoding": (wrappedValue: qrParams?.qrECIEncoding?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"qrAspectRatio": (wrappedValue: qrParams?.qrAspectRatio?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"microQRVersion": (wrappedValue: qrParams?.microQRVersion?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"rectMicroQrVersion": (wrappedValue: qrParams?.rectMicroQrVersion?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"code128EncodeMode": (wrappedValue: code128Params?.code128EncodeMode?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417EncodeMode": (wrappedValue: pdf417Params?.pdf417EncodeMode?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417ErrorLevel": (wrappedValue: pdf417Params?.pdf417ErrorLevel?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417Truncate": (wrappedValue: pdf417Params?.pdf417Truncate?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417Columns": (wrappedValue: pdf417Params?.pdf417Columns?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417Rows": (wrappedValue: pdf417Params?.pdf417Rows?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417AspectRatio": (wrappedValue: pdf417Params?.pdf417AspectRatio?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417ECIEncoding": (wrappedValue: pdf417Params?.pdf417ECIEncoding?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417IsReaderInitialization": (wrappedValue: pdf417Params?.pdf417IsReaderInitialization?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417MacroCharacters": (wrappedValue: pdf417Params?.pdf417MacroCharacters?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417IsLinked": (wrappedValue: pdf417Params?.pdf417IsLinked?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
"pdf417IsCode128Emulation": (wrappedValue: pdf417Params?.pdf417IsCode128Emulation?.asParameter(codableHelper: apiConfiguration.codableHelper), isExplode: true),
])
let localVariableNillableHeaders: [String: (any Sendable)?] = [:]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<Data>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Generate a barcode using a POST request with parameters in the request body in JSON or XML format.
- parameter generateParams: (body) Generation parameters.
- parameter apiConfiguration: The configuration for the http request.
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
open class func generateBody(generateParams: GenerateParams, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Data?, _ error: Error?) -> Void) -> RequestTask {
generateBodyWithRequestBuilder(generateParams: generateParams, apiConfiguration: apiConfiguration).execute { result in
switch result {
case let .success(response):
completion(response.body, nil)
case let .failure(error):
completion(nil, error)
}
}
}
/**
Generate a barcode using a POST request with parameters in the request body in JSON or XML format.
- parameter generateParams: (body) Generation parameters.
- parameter apiConfiguration: The configuration for the http request.
- returns: Data
*/
open class func generateBody(generateParams: GenerateParams, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared) async throws(ErrorResponse) -> Data {
try await generateBodyWithRequestBuilder(generateParams: generateParams, apiConfiguration: apiConfiguration).execute().body
}
/**
Generate a barcode using a POST request with parameters in the request body in JSON or XML format.
- POST /barcode/generate-body
- OAuth:
- type: oauth2
- name: JWT
- parameter generateParams: (body) Generation parameters.
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Data>
*/
open class func generateBodyWithRequestBuilder(generateParams: GenerateParams, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared) -> RequestBuilder<Data> {
let localVariablePath = "/barcode/generate-body"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: generateParams, codableHelper: apiConfiguration.codableHelper)
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "application/json",
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<Data>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
/**
Generate a barcode using a POST request with parameters in a multipart form.
- parameter barcodeType: (form) See https://reference.aspose.com/barcode/net/aspose.barcode.generation/encodetypes/
- parameter data: (form) String that represents the data to encode.
- parameter dataType: (form) Type of data to encode. Default value: StringData. (optional)
- parameter imageFormat: (form) Barcode output image format. Default value: png. (optional)
- parameter textLocation: (form) Specify the displayed text location. Set to CodeLocation.None to hide CodeText. Default value depends on BarcodeType: CodeLocation.Below for 1D barcodes and CodeLocation.None for 2D barcodes. (optional)
- parameter foregroundColor: (form) Specify the display color for bars and content. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: Black. (optional, default to "Black")
- parameter backgroundColor: (form) Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: White. (optional, default to "White")
- parameter units: (form) Common units for all measurements. Default units: pixels. (optional)
- parameter resolution: (form) Resolution of the barcode image. One value for both dimensions. Default value: 96 dpi. Decimal separator is a dot. (optional)
- parameter imageHeight: (form) Height of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter imageWidth: (form) Width of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter rotationAngle: (form) Barcode image rotation angle, measured in degrees. For example, RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle is not equal to 90, 180, 270, or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. (optional)
- parameter qrEncodeMode: (form) QR barcode encode mode. (optional)
- parameter qrErrorLevel: (form) QR barcode error correction level. (optional)
- parameter qrVersion: (form) QR barcode version. Automatically selects the smallest version that fits the data. (optional)
- parameter qrECIEncoding: (form) ECI encoding for QR barcode data. (optional)
- parameter qrAspectRatio: (form) QR barcode aspect ratio. Values: 0 to 1. (optional)
- parameter microQRVersion: (form) MicroQR barcode version. Used when BarcodeType is MicroQR. (optional)
- parameter rectMicroQrVersion: (form) RectMicroQR barcode version. Used when BarcodeType is RectMicroQR. (optional)
- parameter code128EncodeMode: (form) Code128 barcode encode mode. Controls which Code 128 subset (A, B, C, or mix) is used. (optional)
- parameter pdf417EncodeMode: (form) PDF417 barcode encode mode. (optional)
- parameter pdf417ErrorLevel: (form) PDF417 barcode error correction level. (optional)
- parameter pdf417Truncate: (form) Whether to use truncated PDF417 format (removes right-side stop pattern). (optional)
- parameter pdf417Columns: (form) Number of columns in the PDF417 barcode. Values between 1 and 30. 0 for auto. (optional)
- parameter pdf417Rows: (form) Number of rows in the PDF417 barcode. Values between 3 and 90. 0 for automatic. (optional)
- parameter pdf417AspectRatio: (form) PDF417 barcode aspect ratio (height/width of the barcode module). Values are defined by the standard: 2 to 5 for MicroPdf417; 3 to 5 for Pdf417 and MacroPdf417. (optional)
- parameter pdf417ECIEncoding: (form) ECI encoding for PDF417 barcode data. (optional)
- parameter pdf417IsReaderInitialization: (form) Whether the barcode is used for reader initialization (programming). (optional)
- parameter pdf417MacroCharacters: (form) Macro character to prepend (structured append). (optional)
- parameter pdf417IsLinked: (form) Whether to use linked mode (for MicroPdf417). (optional)
- parameter pdf417IsCode128Emulation: (form) Whether to use Code128 emulation for MicroPdf417. (optional)
- parameter apiConfiguration: The configuration for the http request.
- parameter completion: completion handler to receive the data and the error objects
*/
@discardableResult
open class func generateMultipart(barcodeType: EncodeBarcodeType, data: String, dataType: EncodeDataType? = nil, barcodeImageParams: BarcodeImageParams? = nil, qrParams: QrParams? = nil, code128Params: Code128Params? = nil, pdf417Params: Pdf417Params? = nil, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared, completion: @Sendable @escaping (_ data: Data?, _ error: Error?) -> Void) -> RequestTask {
generateMultipartWithRequestBuilder(barcodeType: barcodeType, data: data, dataType: dataType, barcodeImageParams: barcodeImageParams, qrParams: qrParams, code128Params: code128Params, pdf417Params: pdf417Params, apiConfiguration: apiConfiguration).execute { result in
switch result {
case let .success(response):
completion(response.body, nil)
case let .failure(error):
completion(nil, error)
}
}
}
/**
Generate a barcode using a POST request with parameters in a multipart form.
- parameter barcodeType: (form) See https://reference.aspose.com/barcode/net/aspose.barcode.generation/encodetypes/
- parameter data: (form) String that represents the data to encode.
- parameter dataType: (form) Type of data to encode. Default value: StringData. (optional)
- parameter imageFormat: (form) Barcode output image format. Default value: png. (optional)
- parameter textLocation: (form) Specify the displayed text location. Set to CodeLocation.None to hide CodeText. Default value depends on BarcodeType: CodeLocation.Below for 1D barcodes and CodeLocation.None for 2D barcodes. (optional)
- parameter foregroundColor: (form) Specify the display color for bars and content. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: Black. (optional, default to "Black")
- parameter backgroundColor: (form) Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: White. (optional, default to "White")
- parameter units: (form) Common units for all measurements. Default units: pixels. (optional)
- parameter resolution: (form) Resolution of the barcode image. One value for both dimensions. Default value: 96 dpi. Decimal separator is a dot. (optional)
- parameter imageHeight: (form) Height of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter imageWidth: (form) Width of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter rotationAngle: (form) Barcode image rotation angle, measured in degrees. For example, RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle is not equal to 90, 180, 270, or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. (optional)
- parameter qrEncodeMode: (form) QR barcode encode mode. (optional)
- parameter qrErrorLevel: (form) QR barcode error correction level. (optional)
- parameter qrVersion: (form) QR barcode version. Automatically selects the smallest version that fits the data. (optional)
- parameter qrECIEncoding: (form) ECI encoding for QR barcode data. (optional)
- parameter qrAspectRatio: (form) QR barcode aspect ratio. Values: 0 to 1. (optional)
- parameter microQRVersion: (form) MicroQR barcode version. Used when BarcodeType is MicroQR. (optional)
- parameter rectMicroQrVersion: (form) RectMicroQR barcode version. Used when BarcodeType is RectMicroQR. (optional)
- parameter code128EncodeMode: (form) Code128 barcode encode mode. Controls which Code 128 subset (A, B, C, or mix) is used. (optional)
- parameter pdf417EncodeMode: (form) PDF417 barcode encode mode. (optional)
- parameter pdf417ErrorLevel: (form) PDF417 barcode error correction level. (optional)
- parameter pdf417Truncate: (form) Whether to use truncated PDF417 format (removes right-side stop pattern). (optional)
- parameter pdf417Columns: (form) Number of columns in the PDF417 barcode. Values between 1 and 30. 0 for auto. (optional)
- parameter pdf417Rows: (form) Number of rows in the PDF417 barcode. Values between 3 and 90. 0 for automatic. (optional)
- parameter pdf417AspectRatio: (form) PDF417 barcode aspect ratio (height/width of the barcode module). Values are defined by the standard: 2 to 5 for MicroPdf417; 3 to 5 for Pdf417 and MacroPdf417. (optional)
- parameter pdf417ECIEncoding: (form) ECI encoding for PDF417 barcode data. (optional)
- parameter pdf417IsReaderInitialization: (form) Whether the barcode is used for reader initialization (programming). (optional)
- parameter pdf417MacroCharacters: (form) Macro character to prepend (structured append). (optional)
- parameter pdf417IsLinked: (form) Whether to use linked mode (for MicroPdf417). (optional)
- parameter pdf417IsCode128Emulation: (form) Whether to use Code128 emulation for MicroPdf417. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: Data
*/
open class func generateMultipart(barcodeType: EncodeBarcodeType, data: String, dataType: EncodeDataType? = nil, barcodeImageParams: BarcodeImageParams? = nil, qrParams: QrParams? = nil, code128Params: Code128Params? = nil, pdf417Params: Pdf417Params? = nil, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared) async throws(ErrorResponse) -> Data {
try await generateMultipartWithRequestBuilder(barcodeType: barcodeType, data: data, dataType: dataType, barcodeImageParams: barcodeImageParams, qrParams: qrParams, code128Params: code128Params, pdf417Params: pdf417Params, apiConfiguration: apiConfiguration).execute().body
}
/**
Generate a barcode using a POST request with parameters in a multipart form.
- POST /barcode/generate-multipart
- OAuth:
- type: oauth2
- name: JWT
- parameter barcodeType: (form) See https://reference.aspose.com/barcode/net/aspose.barcode.generation/encodetypes/
- parameter data: (form) String that represents the data to encode.
- parameter dataType: (form) Type of data to encode. Default value: StringData. (optional)
- parameter imageFormat: (form) Barcode output image format. Default value: png. (optional)
- parameter textLocation: (form) Specify the displayed text location. Set to CodeLocation.None to hide CodeText. Default value depends on BarcodeType: CodeLocation.Below for 1D barcodes and CodeLocation.None for 2D barcodes. (optional)
- parameter foregroundColor: (form) Specify the display color for bars and content. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: Black. (optional, default to "Black")
- parameter backgroundColor: (form) Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value starting with #. For example: AliceBlue or #FF000000. Default value: White. (optional, default to "White")
- parameter units: (form) Common units for all measurements. Default units: pixels. (optional)
- parameter resolution: (form) Resolution of the barcode image. One value for both dimensions. Default value: 96 dpi. Decimal separator is a dot. (optional)
- parameter imageHeight: (form) Height of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter imageWidth: (form) Width of the barcode image in the specified units. Default units: pixels. Decimal separator is a dot. (optional)
- parameter rotationAngle: (form) Barcode image rotation angle, measured in degrees. For example, RotationAngle = 0 or RotationAngle = 360 means no rotation. If RotationAngle is not equal to 90, 180, 270, or 0, it may increase the difficulty for the scanner to read the image. Default value: 0. (optional)
- parameter qrEncodeMode: (form) QR barcode encode mode. (optional)
- parameter qrErrorLevel: (form) QR barcode error correction level. (optional)
- parameter qrVersion: (form) QR barcode version. Automatically selects the smallest version that fits the data. (optional)
- parameter qrECIEncoding: (form) ECI encoding for QR barcode data. (optional)
- parameter qrAspectRatio: (form) QR barcode aspect ratio. Values: 0 to 1. (optional)
- parameter microQRVersion: (form) MicroQR barcode version. Used when BarcodeType is MicroQR. (optional)
- parameter rectMicroQrVersion: (form) RectMicroQR barcode version. Used when BarcodeType is RectMicroQR. (optional)
- parameter code128EncodeMode: (form) Code128 barcode encode mode. Controls which Code 128 subset (A, B, C, or mix) is used. (optional)
- parameter pdf417EncodeMode: (form) PDF417 barcode encode mode. (optional)
- parameter pdf417ErrorLevel: (form) PDF417 barcode error correction level. (optional)
- parameter pdf417Truncate: (form) Whether to use truncated PDF417 format (removes right-side stop pattern). (optional)
- parameter pdf417Columns: (form) Number of columns in the PDF417 barcode. Values between 1 and 30. 0 for auto. (optional)
- parameter pdf417Rows: (form) Number of rows in the PDF417 barcode. Values between 3 and 90. 0 for automatic. (optional)
- parameter pdf417AspectRatio: (form) PDF417 barcode aspect ratio (height/width of the barcode module). Values are defined by the standard: 2 to 5 for MicroPdf417; 3 to 5 for Pdf417 and MacroPdf417. (optional)
- parameter pdf417ECIEncoding: (form) ECI encoding for PDF417 barcode data. (optional)
- parameter pdf417IsReaderInitialization: (form) Whether the barcode is used for reader initialization (programming). (optional)
- parameter pdf417MacroCharacters: (form) Macro character to prepend (structured append). (optional)
- parameter pdf417IsLinked: (form) Whether to use linked mode (for MicroPdf417). (optional)
- parameter pdf417IsCode128Emulation: (form) Whether to use Code128 emulation for MicroPdf417. (optional)
- parameter apiConfiguration: The configuration for the http request.
- returns: RequestBuilder<Data>
*/
open class func generateMultipartWithRequestBuilder(barcodeType: EncodeBarcodeType, data: String, dataType: EncodeDataType? = nil, barcodeImageParams: BarcodeImageParams? = nil, qrParams: QrParams? = nil, code128Params: Code128Params? = nil, pdf417Params: Pdf417Params? = nil, apiConfiguration: AsposeBarcodeCloudAPIConfiguration = AsposeBarcodeCloudAPIConfiguration.shared) -> RequestBuilder<Data> {
let localVariablePath = "/barcode/generate-multipart"
let localVariableURLString = apiConfiguration.basePath + localVariablePath
let localVariableFormParams: [String: (any Sendable)?] = [
"barcodeType": barcodeType.asParameter(codableHelper: apiConfiguration.codableHelper),
"dataType": dataType?.asParameter(codableHelper: apiConfiguration.codableHelper),
"data": data.asParameter(codableHelper: apiConfiguration.codableHelper),
"imageFormat": barcodeImageParams?.imageFormat?.asParameter(codableHelper: apiConfiguration.codableHelper),
"textLocation": barcodeImageParams?.textLocation?.asParameter(codableHelper: apiConfiguration.codableHelper),
"foregroundColor": barcodeImageParams?.foregroundColor?.asParameter(codableHelper: apiConfiguration.codableHelper),
"backgroundColor": barcodeImageParams?.backgroundColor?.asParameter(codableHelper: apiConfiguration.codableHelper),
"units": barcodeImageParams?.units?.asParameter(codableHelper: apiConfiguration.codableHelper),
"resolution": barcodeImageParams?.resolution?.asParameter(codableHelper: apiConfiguration.codableHelper),
"imageHeight": barcodeImageParams?.imageHeight?.asParameter(codableHelper: apiConfiguration.codableHelper),
"imageWidth": barcodeImageParams?.imageWidth?.asParameter(codableHelper: apiConfiguration.codableHelper),
"rotationAngle": barcodeImageParams?.rotationAngle?.asParameter(codableHelper: apiConfiguration.codableHelper),
"qrEncodeMode": qrParams?.qrEncodeMode?.asParameter(codableHelper: apiConfiguration.codableHelper),
"qrErrorLevel": qrParams?.qrErrorLevel?.asParameter(codableHelper: apiConfiguration.codableHelper),
"qrVersion": qrParams?.qrVersion?.asParameter(codableHelper: apiConfiguration.codableHelper),
"qrECIEncoding": qrParams?.qrECIEncoding?.asParameter(codableHelper: apiConfiguration.codableHelper),
"qrAspectRatio": qrParams?.qrAspectRatio?.asParameter(codableHelper: apiConfiguration.codableHelper),
"microQRVersion": qrParams?.microQRVersion?.asParameter(codableHelper: apiConfiguration.codableHelper),
"rectMicroQrVersion": qrParams?.rectMicroQrVersion?.asParameter(codableHelper: apiConfiguration.codableHelper),
"code128EncodeMode": code128Params?.code128EncodeMode?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417EncodeMode": pdf417Params?.pdf417EncodeMode?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417ErrorLevel": pdf417Params?.pdf417ErrorLevel?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417Truncate": pdf417Params?.pdf417Truncate?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417Columns": pdf417Params?.pdf417Columns?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417Rows": pdf417Params?.pdf417Rows?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417AspectRatio": pdf417Params?.pdf417AspectRatio?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417ECIEncoding": pdf417Params?.pdf417ECIEncoding?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417IsReaderInitialization": pdf417Params?.pdf417IsReaderInitialization?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417MacroCharacters": pdf417Params?.pdf417MacroCharacters?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417IsLinked": pdf417Params?.pdf417IsLinked?.asParameter(codableHelper: apiConfiguration.codableHelper),
"pdf417IsCode128Emulation": pdf417Params?.pdf417IsCode128Emulation?.asParameter(codableHelper: apiConfiguration.codableHelper),
]
let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
let localVariableUrlComponents = URLComponents(string: localVariableURLString)
let localVariableNillableHeaders: [String: (any Sendable)?] = [
"Content-Type": "multipart/form-data",
]
let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
let localVariableRequestBuilder: RequestBuilder<Data>.Type = apiConfiguration.requestBuilderFactory.getBuilder()
return localVariableRequestBuilder.init(method: "POST", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration)
}
}