Skip to content

Commit c986c38

Browse files
authored
Update REST API.md (#133)
* Update REST API.md * replaced unsplash URLs with ucarecdn
1 parent 723b0f0 commit c986c38

9 files changed

+37
-36
lines changed

Documentation/REST API.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* [Create webhook](#create-webhook-api-reference)
1818
* [Update webhook](#update-webhook-api-reference)
1919
* [Delete webhook](#delete-webhook-api-reference)
20+
* [Document info](#document-info-api-reference)
2021
* [Convert document](#convert-document-api-reference)
2122
* [Document conversion job status](#document-conversion-job-status-api-reference)
2223
* [Convert video](#convert-video-api-reference)

Documentation/Upload API.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ let task = uploadcare.uploadFile(data, withName: "some_file.ext", store: .auto,
119119
Direct uploads work with background `URLSession`, so uploading will continue if the app goes to the background state. It supports files smaller than 100MB only
120120

121121
```swift
122-
guard let url = URL(string: "https://source.unsplash.com/featured"),
122+
guard let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/"),
123123
let data = try? Data(contentsOf: url) else { return }
124124

125125
let task = uploadcare.uploadAPI.directUpload(files: ["random_file_name.jpg": data], store: .auto, metadata: ["someKey": "someMetaValue"]) { progress in
@@ -142,7 +142,7 @@ task.cancel()
142142
Sometimes you don't want to have the secret key in your client app and want to get it from the backend. In that case, you can provide an upload signature directly:
143143

144144
```swift
145-
guard let url = URL(string: "https://source.unsplash.com/featured"),
145+
guard let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/"),
146146
let data = try? Data(contentsOf: url) else { return }
147147

148148
let signature = UploadSignature(signature: "signature", expire: 1658486910)
@@ -203,7 +203,7 @@ The direct upload method works with background `URLSession`, so uploading will c
203203
## Upload files from URLs ([API Reference](https://uploadcare.com/api-refs/upload-api/#operation/fromURLUpload/)) ##
204204

205205
```swift
206-
guard let url = URL(string: "https://source.unsplash.com/featured") else { return }
206+
guard let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/") else { return }
207207

208208
// Set parameters by accessing properties
209209
let task1 = UploadFromURLTask(sourceUrl: url)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Check the [Upload API documentation](https://github.com/uploadcare/uploadcare-sw
117117
Example of uploads:
118118

119119
```swift
120-
guard let url = URL(string: "https://source.unsplash.com/featured") else { return }
120+
guard let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/") else { return }
121121
guard let data = try? Data(contentsOf: url) else { return }
122122

123123
// You can create an UploadedFile object to operate with it

Sources/Uploadcare/UploadAPI.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ extension UploadAPI {
489489
///
490490
/// Example:
491491
/// ```swift
492-
/// guard let url = URL(string: "https://source.unsplash.com/featured"),
492+
/// guard let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/"),
493493
/// let data = try? Data(contentsOf: url) else { return }
494494
///
495495
/// let onProgress: (Double)->Void = { (progress) in

Sources/Uploadcare/models/upload/UploadedFile.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ public class UploadedFile: Codable {
294294
///
295295
/// Example:
296296
/// ```swift
297-
/// let url = URL(string: "https://source.unsplash.com/featured")!
297+
/// let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
298298
/// let data = try! Data(contentsOf: url)
299299
/// let fileForUploading = uploadcarePublicKeyOnly.file(fromData: data)
300300
///

Tests/UploadcareTests/RESTAPIIntegrationAsyncTests.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
8282
}
8383

8484
func test05_delete_file() async throws {
85-
let url = URL(string: "https://source.unsplash.com/featured")!
85+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
8686
let data = try! Data(contentsOf: url)
8787

8888
DLog("size of file: \(sizeString(ofData: data))")
@@ -97,7 +97,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
9797
}
9898

9999
func test06_batch_delete_files() async throws {
100-
let url = URL(string: "https://source.unsplash.com/featured")!
100+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
101101
let data = try! Data(contentsOf: url)
102102

103103
DLog("size of file: \(sizeString(ofData: data))")
@@ -114,7 +114,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
114114
}
115115

116116
func test07_store_file() async throws {
117-
let url = URL(string: "https://source.unsplash.com/featured")!
117+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
118118
let data = try! Data(contentsOf: url)
119119

120120
DLog("size of file: \(sizeString(ofData: data))")
@@ -133,7 +133,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
133133
}
134134

135135
func test08_batch_store_files() async throws {
136-
let url = URL(string: "https://source.unsplash.com/featured")!
136+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
137137
let data = try! Data(contentsOf: url)
138138

139139
DLog("size of file: \(sizeString(ofData: data))")
@@ -208,7 +208,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
208208
}
209209

210210
func test13_copy_file_to_local_storage() async throws {
211-
let url = URL(string: "https://source.unsplash.com/featured")!
211+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
212212
let data = try! Data(contentsOf: url)
213213

214214
DLog("size of file: \(sizeString(ofData: data))")
@@ -229,7 +229,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
229229
}
230230

231231
func test14_copy_file_to_remote_storage() async throws {
232-
let url = URL(string: "https://source.unsplash.com/featured")!
232+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
233233
let data = try! Data(contentsOf: url)
234234

235235
DLog("size of file: \(sizeString(ofData: data))")
@@ -285,7 +285,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
285285
}
286286

287287
func test19_document_conversion_and_status() async throws {
288-
let url = URL(string: "https://source.unsplash.com/featured")!
288+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
289289
let data = try! Data(contentsOf: url)
290290
DLog("size of file: \(sizeString(ofData: data))")
291291

@@ -374,7 +374,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
374374
// func test21_storing_shoudBeStored() {
375375
// let expectation = XCTestExpectation(description: "test21_storing_shoudBeStored")
376376
//
377-
// let url = URL(string: "https://source.unsplash.com/featured")!
377+
// let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
378378
// let data = try! Data(contentsOf: url)
379379
// let file = uploadcare.file(fromData: data)
380380
// let name = UUID().uuidString
@@ -562,7 +562,7 @@ final class RESTAPIIntegrationAsyncTests: XCTestCase {
562562
}
563563

564564
func test31_document_info() async throws {
565-
let url = URL(string: "https://source.unsplash.com/featured")!
565+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
566566
let data = try! Data(contentsOf: url)
567567
DLog("size of file: \(sizeString(ofData: data))")
568568

Tests/UploadcareTests/RESTAPIIntegrationTests.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
154154
func test05_delete_file() {
155155
let expectation = XCTestExpectation(description: "test5_delete_file")
156156

157-
let url = URL(string: "https://source.unsplash.com/featured")!
157+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
158158
let data = try! Data(contentsOf: url)
159159

160160
DLog("size of file: \(sizeString(ofData: data))")
@@ -189,7 +189,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
189189
func test06_batch_delete_files() {
190190
let expectation = XCTestExpectation(description: "test6_batch_delete_files")
191191

192-
let url = URL(string: "https://source.unsplash.com/featured")!
192+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
193193
let data = try! Data(contentsOf: url)
194194

195195
DLog("size of file: \(sizeString(ofData: data))")
@@ -224,7 +224,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
224224
func test07_store_file() {
225225
let expectation = XCTestExpectation(description: "test7_store_file")
226226

227-
let url = URL(string: "https://source.unsplash.com/featured")!
227+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
228228
let data = try! Data(contentsOf: url)
229229

230230
DLog("size of file: \(sizeString(ofData: data))")
@@ -262,7 +262,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
262262
func test08_batch_store_files() {
263263
let expectation = XCTestExpectation(description: "test8_batch_store_files")
264264

265-
let url = URL(string: "https://source.unsplash.com/featured")!
265+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
266266
let data = try! Data(contentsOf: url)
267267

268268
DLog("size of file: \(sizeString(ofData: data))")
@@ -421,7 +421,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
421421
func test13_copy_file_to_local_storage() {
422422
let expectation = XCTestExpectation(description: "test13_copy_file_to_local_storage")
423423

424-
let url = URL(string: "https://source.unsplash.com/featured")!
424+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
425425
let data = try! Data(contentsOf: url)
426426

427427
DLog("size of file: \(sizeString(ofData: data))")
@@ -460,7 +460,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
460460
func test14_copy_file_to_remote_storage() {
461461
let expectation = XCTestExpectation(description: "test14_copy_file_to_remote_storage")
462462

463-
let url = URL(string: "https://source.unsplash.com/featured")!
463+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
464464
let data = try! Data(contentsOf: url)
465465

466466
DLog("size of file: \(sizeString(ofData: data))")
@@ -583,7 +583,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
583583
func test19_document_conversion_and_status() {
584584
let expectation = XCTestExpectation(description: "test19_document_conversion_and_status")
585585

586-
let url = URL(string: "https://source.unsplash.com/featured")!
586+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
587587
let data = try! Data(contentsOf: url)
588588

589589
DLog("size of file: \(sizeString(ofData: data))")
@@ -743,7 +743,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
743743
func test21_storing_shoudBeStored() {
744744
let expectation = XCTestExpectation(description: "test21_storing_shoudBeStored")
745745

746-
let url = URL(string: "https://source.unsplash.com/featured")!
746+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
747747
let data = try! Data(contentsOf: url)
748748
let file = uploadcare.file(fromData: data)
749749
let name = UUID().uuidString
@@ -1009,7 +1009,7 @@ final class RESTAPIIntegrationTests: XCTestCase {
10091009
func test27_document_info() {
10101010
let expectation = XCTestExpectation(description: "test27_document_info")
10111011

1012-
let url = URL(string: "https://source.unsplash.com/featured")!
1012+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
10131013
guard let data = try? Data(contentsOf: url) else {
10141014
XCTFail("Could not read data from URL")
10151015
return

Tests/UploadcareTests/UploadAPIIntegrationAsyncTests.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ final class UploadAPIIntegrationAsyncTests: XCTestCase {
3737
}
3838

3939
func test02_DirectUploadInForeground_and_FileInfo() async throws {
40-
let url = URL(string: "https://source.unsplash.com/featured")!
40+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
4141
let data = try! Data(contentsOf: url)
4242

4343
DLog("size of file: \(sizeString(ofData: data))")
@@ -62,7 +62,7 @@ final class UploadAPIIntegrationAsyncTests: XCTestCase {
6262
}
6363

6464
func test03_MainUpload() async throws {
65-
let url = URL(string: "https://source.unsplash.com/featured")!
65+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
6666
let data = try! Data(contentsOf: url)
6767

6868
// small file with direct uploading
@@ -96,7 +96,7 @@ final class UploadAPIIntegrationAsyncTests: XCTestCase {
9696
}
9797

9898
func test05_createFilesGroup_and_filesGroupInfo_and_delegeGroup() async throws {
99-
let url = URL(string: "https://source.unsplash.com/featured?\(UUID().uuidString)")!
99+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/?\(UUID().uuidString)")!
100100
let data = try! Data(contentsOf: url)
101101

102102
DLog("size of file: \(sizeString(ofData: data))")
@@ -126,7 +126,7 @@ final class UploadAPIIntegrationAsyncTests: XCTestCase {
126126

127127
func test06_direct_upload_public_key_only() async throws {
128128
// a small file that should be uploaded with multipart upload method
129-
let url = URL(string: "https://source.unsplash.com/featured")!
129+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
130130
let data = try! Data(contentsOf: url)
131131
let fileForUploading = uploadcarePublicKeyOnly.file(fromData: data)
132132

Tests/UploadcareTests/UploadAPIIntegrationTests.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ final class UploadAPIIntegrationTests: XCTestCase {
6262
func test02_DirectUpload() {
6363
let expectation = XCTestExpectation(description: "test02_DirectUpload")
6464

65-
let url = URL(string: "https://source.unsplash.com/featured")!
65+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
6666
let data = try! Data(contentsOf: url)
6767

6868
DLog("size of file: \(sizeString(ofData: data))")
@@ -92,7 +92,7 @@ final class UploadAPIIntegrationTests: XCTestCase {
9292
func test03_DirectUploadInForeground() {
9393
let expectation = XCTestExpectation(description: "test03_DirectUploadInForeground")
9494

95-
let url = URL(string: "https://source.unsplash.com/featured")!
95+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
9696
let data = try! Data(contentsOf: url)
9797

9898
DLog("size of file: \(sizeString(ofData: data))")
@@ -121,7 +121,7 @@ final class UploadAPIIntegrationTests: XCTestCase {
121121
func test04_DirectUploadInForegroundCancel() {
122122
let expectation = XCTestExpectation(description: "test04_DirectUploadInForegroundCancel")
123123

124-
let url = URL(string: "https://source.unsplash.com/featured")!
124+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
125125
let data = try! Data(contentsOf: url)
126126

127127
DLog("size of file: \(sizeString(ofData: data))")
@@ -147,7 +147,7 @@ final class UploadAPIIntegrationTests: XCTestCase {
147147
func test05_UploadFileInfo() {
148148
let expectation = XCTestExpectation(description: "test05_UploadFileInfo")
149149

150-
let url = URL(string: "https://source.unsplash.com/featured?\(UUID().uuidString)")!
150+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/?\(UUID().uuidString)")!
151151
let data = try! Data(contentsOf: url)
152152

153153
DLog("size of file: \(sizeString(ofData: data))")
@@ -180,7 +180,7 @@ final class UploadAPIIntegrationTests: XCTestCase {
180180
}
181181

182182
func test06_MainUpload_Cancel() {
183-
let url = URL(string: "https://source.unsplash.com/featured")!
183+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
184184
let data = try! Data(contentsOf: url)
185185

186186
let expectation = XCTestExpectation(description: "test06_MainUpload_Cancel")
@@ -246,7 +246,7 @@ final class UploadAPIIntegrationTests: XCTestCase {
246246
func test08_fileInfo() {
247247
let expectation = XCTestExpectation(description: "test08_fileInfo")
248248

249-
let url = URL(string: "https://source.unsplash.com/featured")!
249+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
250250
let data = try! Data(contentsOf: url)
251251

252252
uploadcare.uploadAPI.directUploadInForeground(files: ["random_file_name.jpg": data], store: .doNotStore, { (progress) in
@@ -306,7 +306,7 @@ final class UploadAPIIntegrationTests: XCTestCase {
306306
func test10_createFilesGroup_and_filesGroupInfo_and_delegeGroup() {
307307
let expectation = XCTestExpectation(description: "test10_createFilesGroup_and_filesGroupInfo")
308308

309-
let url = URL(string: "https://source.unsplash.com/featured?\(UUID().uuidString)")!
309+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/?\(UUID().uuidString)")!
310310
let data = try! Data(contentsOf: url)
311311

312312
DLog("size of file: \(sizeString(ofData: data))")
@@ -373,7 +373,7 @@ final class UploadAPIIntegrationTests: XCTestCase {
373373
func test11_direct_upload_public_key_only() {
374374
let expectation = XCTestExpectation(description: "test11_public_key_only")
375375

376-
let url = URL(string: "https://source.unsplash.com/featured")!
376+
let url = URL(string: "https://ucarecdn.com/46528d0d-323c-42d7-beab-2fdc5e7077ba/")!
377377
let data = try! Data(contentsOf: url)
378378
let fileForUploading = uploadcarePublicKeyOnly.file(fromData: data)
379379

0 commit comments

Comments
 (0)