Skip to content

Commit 86b0b77

Browse files
authored
Updated to uplink-c v1.2.2 (#4)
* Updated to uplink-c v1.2.2 * Update main.swift * Update main.swift
1 parent 9a19ef8 commit 86b0b77

File tree

5 files changed

+31
-10
lines changed

5 files changed

+31
-10
lines changed

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
# Storj-swift Changelog
1+
# Uplink-swift Changelog
2+
3+
## [1.2.2] - 26-03-2021
4+
### Changelog:
5+
* Updated Makefile to enforce using uplink-c latest version (v1.2.2)
6+
* Updated HelloStorj/main.swift test cases sample file
7+
* Tested on uplink-c v1.2.2
8+
* Updated README.md
9+
* Updated docs/README.md
210

311
## [1.0.4] - 07-08-2020
412
### Changelog:

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ build:
2323
if test ! -d $(CLIBUPLINK_DIR_NAME); then echo '$(RED_COLOR) \nBuild Failed : Directory $(CLIBUPLINK_DIR_NAME) does not exits\n$(RESET_COLOR)' && exit 1; fi
2424
if test ! -f $(CLIBUPLINK_FILENAME); then echo '$(RED_COLOR) \n Build Failed : File $(CLIBUPLINK_FILENAME) does not exits\n$(RESET_COLOR)\n' && exit 1; fi
2525
if test ! -d $(CLIBUPLINK_INCLUDE_FOLDER_NAME); then mkdir $(CLIBUPLINK_INCLUDE_FOLDER_NAME); fi
26-
if test ! -d $(UPLINKC_NAME); then git clone https://github.com/storj/uplink-c; fi
26+
if test ! -d $(UPLINKC_NAME); then git clone --depth 1 --branch v1.2.2 https://github.com/storj/uplink-c; fi
2727
cd uplink-c;$(GOBUILD) -o $(LIBRARY_NAME) -buildmode=c-shared;mv $(COPY_LIBRARY_FILE) ../$(CLIBUPLINK_INCLUDE_FOLDER_NAME);
2828
rm -rf $(UPLINKC_NAME);
2929
echo ' $(GREEN_COLOR) \n Successfully build $(RESET_COLOR)';

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2a62886560a64453b2d5417393b2305f)](https://app.codacy.com/gh/storj-thirdparty/uplink-swift?utm_source=github.com&utm_medium=referral&utm_content=storj-thirdparty/uplink-swift&utm_campaign=Badge_Grade_Dashboard)
44

5-
#### *Developed using v1.1.0 storj/uplink-c*
5+
#### *Developed using v1.2.2 storj/uplink-c*
66

77
[API documentation and tutorial](https://storj-thirdparty.github.io/uplink-swift/#/)
88

Sources/helloStorj/main.swift

+19-6
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var storjEncryption: String = "change-me-to-desired-encryptionphassphrase"
1212
var storjBucket: String = "change-me-to-desired-bucket-name"
1313
// Upload path within the bucket, where file will be uploaded.
1414
var storjUploadPath: String = "path/filename.txt"
15+
// Upload path within the bucket, where file will be uploaded via overridden serialized access key
16+
var storjUploadPath2: String = "path/filename2.txt"
1517
// Download path within the bucket, wherefrom the Storj object is to be downloaded.
1618
var storjDownloadPath: String = "path/filename.txt"
1719
// Full file name, including path, of the local system, to be uploaded to Storj bucket.
@@ -32,7 +34,7 @@ do {
3234
//
3335
let uplink = try Storj.uplink()
3436
//
35-
print("Getting Accessig using :\nSatellite address : \(storjSatellite)\nAPI key : \(storjApiKey)\nEncryption phassphrase : \(storjEncryption)")
37+
print("Getting Access using :\nSatellite address : \(storjSatellite)\nAPI key : \(storjApiKey)\nEncryption phassphrase : \(storjEncryption)")
3638
//
3739
let access = try uplink.request_Access_With_Passphrase(satellite: storjSatellite, apiKey: storjApiKey, encryption: storjEncryption)
3840
//
@@ -92,14 +94,20 @@ do {
9294
//
9395
downloadObject(project: &project, bucketName: storjBucket, localFullFileLocationToStore: localFullFileLocationToStore, storjDownloadPath: storjDownloadPath)
9496
//
95-
var listObjectsOptions = ListObjectsOptions(prefix: "change-me-to-desired-prefix-with-/", cursor: "", recursive: true, system: false, custom: true)
97+
var listObjectsOptions = ListObjectsOptions(prefix: "change-me-to-desired-prefix-with-/", cursor: "", recursive: true, system: true, custom: true)
9698
//
9799
let objectslist = try project.list_Objects(bucket: storjBucket, listObjectsOptions: &listObjectsOptions)
98100
print("\nList object")
99101
for object in objectslist {
100102
print("Object Name : \(object.key)")
101103
print("Object Size : \(object.system.content_length)")
102104
}
105+
//Deleting Object
106+
let deletedObject = try project.delete_Object(bucket: storjBucket, key: storjUploadPath)
107+
print("\nObject deleted !!")
108+
print("Object Information : ")
109+
print("Object Name : \(deletedObject.key)")
110+
print("Object Size : \(deletedObject.system.content_length)")
103111
//
104112
print("\nCreating share access")
105113
//
@@ -148,19 +156,24 @@ do {
148156
}
149157
}
150158
//
151-
//Deleting Object
152-
let deletedObject = try projectparsed.delete_Object(bucket: storjBucket, key: storjUploadPath)
159+
print("\nUploading object on storj V3 network via overridden serialized access...")
160+
//
161+
uploadObject(project: projectparsed, bucketName: storjBucket, localFullFileNameToUpload: localFullFileNameToUpload, storjUploadPath: storjUploadPath2)
162+
//
163+
//Deleting Object uploaded via overridden serialized access
164+
let deletedObject2 = try projectparsed.delete_Object(bucket: storjBucket, key: storjUploadPath2)
153165
print("\nObject deleted !!")
154166
print("Object Information : ")
155-
print("Object Name : \(deletedObject.key)")
156-
print("Object Size : \(deletedObject.system.content_length)")
167+
print("Object Name : \(deletedObject2.key)")
168+
print("Object Size : \(deletedObject2.system.content_length)")
157169
//Deleting bucket
158170
let deleteBucket = try project.delete_Bucket(bucket: storjBucket)
159171
//
160172
print("\nBucket deleted!!")
161173
print("Bucket information :\nBucket created : ", unixTimeConvert(unixTime: deleteBucket.created))
162174
print("Bucket name : ", deleteBucket.name)
163175
//
176+
//
164177
} catch let error as InternalError {
165178
print("Internal SO error")
166179
print("Error Code : \(error.code)")

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/2a62886560a64453b2d5417393b2305f)](https://app.codacy.com/gh/storj-thirdparty/uplink-swift?utm_source=github.com&utm_medium=referral&utm_content=storj-thirdparty/uplink-swift&utm_campaign=Badge_Grade_Dashboard)
44

5-
#### *Developed using v1.0.2 storj/uplink-c*
5+
#### *Developed using v1.2.2 storj/uplink-c*
66

77
## <b>Initial Set-up (Important)</b>
88

0 commit comments

Comments
 (0)