Skip to content

Commit 0824620

Browse files
authored
Update REST API.md
1 parent fa198b4 commit 0824620

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

Documentation/REST API.md

+23-19
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,25 @@ let uploadcare = Uploadcare(withPublicKey: "YOUR_PUBLIC_KEY", secretKey: "YOUR_S
3333
## List of files ([API Reference](https://uploadcare.com/api-refs/rest-api/v0.6.0/#operation/filesList?utm_source=github&utm_medium=referral&utm_campaign=uploadcare-swift)) ##
3434

3535
```swift
36-
// Make a query object
37-
let query = PaginationQuery()
38-
.stored(true)
39-
.ordering(.sizeDESC)
40-
.limit(5)
4136
// Make a list of files object
42-
let filesList = uploadcare.list()
43-
44-
// Get file list
45-
filesList.get(withQuery: query) { list, error in
46-
if let error = error {
47-
print(error)
48-
return
37+
lazy var filesList = uploadcare.listOfFiles()
38+
39+
func someFilesListMethod() {
40+
// Make a query object
41+
let query = PaginationQuery()
42+
.stored(true)
43+
.ordering(.sizeDESC)
44+
.limit(5)
45+
46+
// Get file list
47+
filesList.get(withQuery: query) { list, error in
48+
if let error = error {
49+
print(error)
50+
return
51+
}
52+
53+
print(list ?? "")
4954
}
50-
51-
print(list as Any)
5255
}
5356
```
5457

@@ -270,7 +273,7 @@ uploadcare.getAuthenticatedUrlFromUrl(url) { value, error in
270273

271274
// Value is https://cdn.yourdomain.com/{uuid}/?token={token}&expire={timestamp}
272275
print(value as Any)
273-
})
276+
}
274277
```
275278

276279
## List of webhooks ([API Reference](https://uploadcare.com/api-refs/rest-api/v0.6.0/#operation/webhooksList?utm_source=github&utm_medium=referral&utm_campaign=uploadcare-swift)) ##
@@ -308,12 +311,13 @@ Update webhook attributes.
308311

309312
```swift
310313
let url = URL(string: "https://yourwebhook.com")!
311-
uploadcare.updateWebhook(id: "webhookId", targetUrl: url, isActive: true, signingSecret: "someNewSigningSecret") { value, error in
314+
let webhookId = 100
315+
uploadcare.updateWebhook(id: webhookId, targetUrl: url, isActive: true, signingSecret: "someNewSigningSecret") { value, error in
312316
if let error = error {
313317
print(error)
314318
return
315319
}
316-
320+
317321
print(value as Any)
318322
}
319323
```
@@ -375,7 +379,7 @@ uploadcare.documentConversionJobStatus(token: 123456) { job, error in
375379

376380
print(job as Any)
377381

378-
switch job.status {
382+
switch job?.status {
379383
case .failed(let conversionError):
380384
print(conversionError)
381385
default: break
@@ -434,7 +438,7 @@ uploadcare.videoConversionJobStatus(token: 123456) { job, error in
434438

435439
print(job as Any)
436440

437-
switch job.status {
441+
switch job?.status {
438442
case .failed(let conversionError):
439443
print(conversionError)
440444
default: break

0 commit comments

Comments
 (0)