Skip to content

Commit 1042cbb

Browse files
author
github-actions
committed
ios-consumer-api release 0.0.17
1 parent dd6ed86 commit 1042cbb

File tree

4 files changed

+148
-31
lines changed

4 files changed

+148
-31
lines changed

ExtoleConsumerAPI.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pod::Spec.new do |s|
22
s.name = 'ExtoleConsumerAPI'
33
s.ios.deployment_target = '10.0'
44
s.platform = :ios, "10.0"
5-
s.version = '0.0.16'
5+
s.version = '0.0.17'
66
s.source = { :git => 'https://github.com/extole/ios-consumer-api.git', :tag => "#{s.version}" }
77
s.authors = 'Extole'
88
s.license = { :type => "MIT", :file => "LICENSE" }

Sources/ExtoleConsumerAPI/APIs/AuthorizationV4Endpoints.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ open class AuthorizationV4Endpoints {
1313
/**
1414
Deletes the unique access token identified in the request from the associate user's profile.
1515

16-
- parameter token: (path)
1716
- parameter completion: completion handler to receive the data and the error objects
1817
*/
19-
open class func deleteToken(token: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
20-
deleteTokenWithRequestBuilder(token: token).execute { (response, error) -> Void in
18+
open class func deleteToken(completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
19+
deleteTokenWithRequestBuilder().execute { (response, error) -> Void in
2120
if error == nil {
2221
completion((), error)
2322
} else {
@@ -29,7 +28,7 @@ open class AuthorizationV4Endpoints {
2928

3029
/**
3130
Deletes the unique access token identified in the request from the associate user's profile.
32-
- DELETE /v4/token/{token}
31+
- DELETE /v4/token
3332

3433
- API Key:
3534
- type: apiKey access_token (QUERY)
@@ -40,15 +39,11 @@ open class AuthorizationV4Endpoints {
4039
- API Key:
4140
- type: apiKey access_token (QUERY)
4241
- name: QUERY
43-
- parameter token: (path)
4442

4543
- returns: RequestBuilder<Void>
4644
*/
47-
open class func deleteTokenWithRequestBuilder(token: String) -> RequestBuilder<Void> {
48-
var path = "/v4/token/{token}"
49-
let tokenPreEscape = "\(token)"
50-
let tokenPostEscape = tokenPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
51-
path = path.replacingOccurrences(of: "{token}", with: tokenPostEscape, options: .literal, range: nil)
45+
open class func deleteTokenWithRequestBuilder() -> RequestBuilder<Void> {
46+
let path = "/v4/token"
5247
let URLString = ExtoleConsumerAPI.basePath + path
5348
let parameters: [String:Any]? = nil
5449
let url = URLComponents(string: URLString)
@@ -61,10 +56,11 @@ open class AuthorizationV4Endpoints {
6156
/**
6257
Deletes the unique access token identified in the request from the associate user's profile.
6358

59+
- parameter token: (path)
6460
- parameter completion: completion handler to receive the data and the error objects
6561
*/
66-
open class func deleteToken(completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
67-
deleteTokenWithRequestBuilder().execute { (response, error) -> Void in
62+
open class func deleteToken(token: String, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
63+
deleteTokenWithRequestBuilder(token: token).execute { (response, error) -> Void in
6864
if error == nil {
6965
completion((), error)
7066
} else {
@@ -76,7 +72,7 @@ open class AuthorizationV4Endpoints {
7672

7773
/**
7874
Deletes the unique access token identified in the request from the associate user's profile.
79-
- DELETE /v4/token
75+
- DELETE /v4/token/{token}
8076

8177
- API Key:
8278
- type: apiKey access_token (QUERY)
@@ -87,11 +83,15 @@ open class AuthorizationV4Endpoints {
8783
- API Key:
8884
- type: apiKey access_token (QUERY)
8985
- name: QUERY
86+
- parameter token: (path)
9087

9188
- returns: RequestBuilder<Void>
9289
*/
93-
open class func deleteTokenWithRequestBuilder() -> RequestBuilder<Void> {
94-
let path = "/v4/token"
90+
open class func deleteTokenWithRequestBuilder(token: String) -> RequestBuilder<Void> {
91+
var path = "/v4/token/{token}"
92+
let tokenPreEscape = "\(token)"
93+
let tokenPostEscape = tokenPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
94+
path = path.replacingOccurrences(of: "{token}", with: tokenPostEscape, options: .literal, range: nil)
9595
let URLString = ExtoleConsumerAPI.basePath + path
9696
let parameters: [String:Any]? = nil
9797
let url = URLComponents(string: URLString)

Sources/ExtoleConsumerAPI/APIs/DefaultEndpoints.swift

Lines changed: 131 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,65 @@ import Alamofire
1010

1111

1212
open class DefaultEndpoints {
13+
/**
14+
Download asset by personId and assetId
15+
16+
- parameter personId: (path) The Extole unique profile identifier of this user at Extole.
17+
- parameter assetId: (path) The Extole unique profile identifier of this asset at Extole.
18+
- parameter defaultUrl: (query) (optional)
19+
- parameter completion: completion handler to receive the data and the error objects
20+
*/
21+
open class func downloadAssetById(personId: String, assetId: String, defaultUrl: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
22+
downloadAssetByIdWithRequestBuilder(personId: personId, assetId: assetId, defaultUrl: defaultUrl).execute { (response, error) -> Void in
23+
if error == nil {
24+
completion((), error)
25+
} else {
26+
completion(nil, error)
27+
}
28+
}
29+
}
30+
31+
32+
/**
33+
Download asset by personId and assetId
34+
- GET /web/persons/{personId}/assets/{assetId}/download
35+
-
36+
37+
- API Key:
38+
- type: apiKey access_token (QUERY)
39+
- name: COOKIE
40+
- API Key:
41+
- type: apiKey Authorization
42+
- name: HEADER
43+
- API Key:
44+
- type: apiKey access_token (QUERY)
45+
- name: QUERY
46+
- parameter personId: (path) The Extole unique profile identifier of this user at Extole.
47+
- parameter assetId: (path) The Extole unique profile identifier of this asset at Extole.
48+
- parameter defaultUrl: (query) (optional)
49+
50+
- returns: RequestBuilder<Void>
51+
*/
52+
open class func downloadAssetByIdWithRequestBuilder(personId: String, assetId: String, defaultUrl: String? = nil) -> RequestBuilder<Void> {
53+
var path = "/web/persons/{personId}/assets/{assetId}/download"
54+
let personIdPreEscape = "\(personId)"
55+
let personIdPostEscape = personIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
56+
path = path.replacingOccurrences(of: "{personId}", with: personIdPostEscape, options: .literal, range: nil)
57+
let assetIdPreEscape = "\(assetId)"
58+
let assetIdPostEscape = assetIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
59+
path = path.replacingOccurrences(of: "{assetId}", with: assetIdPostEscape, options: .literal, range: nil)
60+
let URLString = ExtoleConsumerAPI.basePath + path
61+
let parameters: [String:Any]? = nil
62+
var url = URLComponents(string: URLString)
63+
url?.queryItems = APIHelper.mapValuesToQueryItems([
64+
"default_url": defaultUrl
65+
])
66+
67+
68+
let requestBuilder: RequestBuilder<Void>.Type = ExtoleConsumerAPI.requestBuilderFactory.getNonDecodableBuilder()
69+
70+
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
71+
}
1372
/**
1473
Download content for an asset
1574

@@ -60,6 +119,63 @@ open class DefaultEndpoints {
60119
let url = URLComponents(string: URLString)
61120

62121

122+
let requestBuilder: RequestBuilder<Void>.Type = ExtoleConsumerAPI.requestBuilderFactory.getNonDecodableBuilder()
123+
124+
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
125+
}
126+
/**
127+
Download asset by personId and name
128+
129+
- parameter personId: (path) The Extole unique profile identifier of this user at Extole.
130+
- parameter name: (query) (optional)
131+
- parameter defaultUrl: (query) (optional)
132+
- parameter completion: completion handler to receive the data and the error objects
133+
*/
134+
open class func downloadAssetByName(personId: String, name: String? = nil, defaultUrl: String? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
135+
downloadAssetByNameWithRequestBuilder(personId: personId, name: name, defaultUrl: defaultUrl).execute { (response, error) -> Void in
136+
if error == nil {
137+
completion((), error)
138+
} else {
139+
completion(nil, error)
140+
}
141+
}
142+
}
143+
144+
145+
/**
146+
Download asset by personId and name
147+
- GET /web/persons/{personId}/assets/download
148+
-
149+
150+
- API Key:
151+
- type: apiKey access_token (QUERY)
152+
- name: COOKIE
153+
- API Key:
154+
- type: apiKey Authorization
155+
- name: HEADER
156+
- API Key:
157+
- type: apiKey access_token (QUERY)
158+
- name: QUERY
159+
- parameter personId: (path) The Extole unique profile identifier of this user at Extole.
160+
- parameter name: (query) (optional)
161+
- parameter defaultUrl: (query) (optional)
162+
163+
- returns: RequestBuilder<Void>
164+
*/
165+
open class func downloadAssetByNameWithRequestBuilder(personId: String, name: String? = nil, defaultUrl: String? = nil) -> RequestBuilder<Void> {
166+
var path = "/web/persons/{personId}/assets/download"
167+
let personIdPreEscape = "\(personId)"
168+
let personIdPostEscape = personIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
169+
path = path.replacingOccurrences(of: "{personId}", with: personIdPostEscape, options: .literal, range: nil)
170+
let URLString = ExtoleConsumerAPI.basePath + path
171+
let parameters: [String:Any]? = nil
172+
var url = URLComponents(string: URLString)
173+
url?.queryItems = APIHelper.mapValuesToQueryItems([
174+
"name": name,
175+
"default_url": defaultUrl
176+
])
177+
178+
63179
let requestBuilder: RequestBuilder<Void>.Type = ExtoleConsumerAPI.requestBuilderFactory.getNonDecodableBuilder()
64180

65181
return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false)
@@ -182,11 +298,12 @@ open class DefaultEndpoints {
182298
}
183299
/**
184300

301+
- parameter zoneName: (path)
185302
- parameter body: (body) (optional)
186303
- parameter completion: completion handler to receive the data and the error objects
187304
*/
188-
open class func post(body: RenderZoneRequest? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
189-
postWithRequestBuilder(body: body).execute { (response, error) -> Void in
305+
open class func post(zoneName: String, body: [String:String]? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
306+
postWithRequestBuilder(zoneName: zoneName, body: body).execute { (response, error) -> Void in
190307
if error == nil {
191308
completion((), error)
192309
} else {
@@ -197,7 +314,7 @@ open class DefaultEndpoints {
197314

198315

199316
/**
200-
- POST /zones
317+
- POST /zones/{zone_name}
201318

202319
- API Key:
203320
- type: apiKey access_token (QUERY)
@@ -208,12 +325,16 @@ open class DefaultEndpoints {
208325
- API Key:
209326
- type: apiKey access_token (QUERY)
210327
- name: QUERY
328+
- parameter zoneName: (path)
211329
- parameter body: (body) (optional)
212330

213331
- returns: RequestBuilder<Void>
214332
*/
215-
open class func postWithRequestBuilder(body: RenderZoneRequest? = nil) -> RequestBuilder<Void> {
216-
let path = "/zones"
333+
open class func postWithRequestBuilder(zoneName: String, body: [String:String]? = nil) -> RequestBuilder<Void> {
334+
var path = "/zones/{zone_name}"
335+
let zoneNamePreEscape = "\(zoneName)"
336+
let zoneNamePostEscape = zoneNamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
337+
path = path.replacingOccurrences(of: "{zone_name}", with: zoneNamePostEscape, options: .literal, range: nil)
217338
let URLString = ExtoleConsumerAPI.basePath + path
218339
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
219340
let url = URLComponents(string: URLString)
@@ -225,12 +346,11 @@ open class DefaultEndpoints {
225346
}
226347
/**
227348

228-
- parameter zoneName: (path)
229349
- parameter body: (body) (optional)
230350
- parameter completion: completion handler to receive the data and the error objects
231351
*/
232-
open class func post(zoneName: String, body: [String:String]? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
233-
postWithRequestBuilder(zoneName: zoneName, body: body).execute { (response, error) -> Void in
352+
open class func post(body: RenderZoneRequest? = nil, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) {
353+
postWithRequestBuilder(body: body).execute { (response, error) -> Void in
234354
if error == nil {
235355
completion((), error)
236356
} else {
@@ -241,7 +361,7 @@ open class DefaultEndpoints {
241361

242362

243363
/**
244-
- POST /zones/{zone_name}
364+
- POST /zones
245365

246366
- API Key:
247367
- type: apiKey access_token (QUERY)
@@ -252,16 +372,12 @@ open class DefaultEndpoints {
252372
- API Key:
253373
- type: apiKey access_token (QUERY)
254374
- name: QUERY
255-
- parameter zoneName: (path)
256375
- parameter body: (body) (optional)
257376

258377
- returns: RequestBuilder<Void>
259378
*/
260-
open class func postWithRequestBuilder(zoneName: String, body: [String:String]? = nil) -> RequestBuilder<Void> {
261-
var path = "/zones/{zone_name}"
262-
let zoneNamePreEscape = "\(zoneName)"
263-
let zoneNamePostEscape = zoneNamePreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
264-
path = path.replacingOccurrences(of: "{zone_name}", with: zoneNamePostEscape, options: .literal, range: nil)
379+
open class func postWithRequestBuilder(body: RenderZoneRequest? = nil) -> RequestBuilder<Void> {
380+
let path = "/zones"
265381
let URLString = ExtoleConsumerAPI.basePath + path
266382
let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: body)
267383
let url = URLComponents(string: URLString)

Sources/ExtoleConsumerAPI/Models/RewardResponse.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public struct RewardResponse: Codable {
2323
case brl = "BRL"
2424
case inr = "INR"
2525
case nzd = "NZD"
26+
case mxn = "MXN"
2627
case points = "POINTS"
2728
}
2829
public enum ModelType: String, Codable {

0 commit comments

Comments
 (0)