Skip to content

Commit

Permalink
Updated to uplink-c v1.2.2 (#4)
Browse files Browse the repository at this point in the history
* Updated to uplink-c v1.2.2

* Update main.swift

* Update main.swift
  • Loading branch information
testsid123 authored Apr 2, 2021
1 parent 9a19ef8 commit 86b0b77
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# Storj-swift Changelog
# Uplink-swift Changelog

## [1.2.2] - 26-03-2021
### Changelog:
* Updated Makefile to enforce using uplink-c latest version (v1.2.2)
* Updated HelloStorj/main.swift test cases sample file
* Tested on uplink-c v1.2.2
* Updated README.md
* Updated docs/README.md

## [1.0.4] - 07-08-2020
### Changelog:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ build:
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
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
if test ! -d $(CLIBUPLINK_INCLUDE_FOLDER_NAME); then mkdir $(CLIBUPLINK_INCLUDE_FOLDER_NAME); fi
if test ! -d $(UPLINKC_NAME); then git clone https://github.com/storj/uplink-c; fi
if test ! -d $(UPLINKC_NAME); then git clone --depth 1 --branch v1.2.2 https://github.com/storj/uplink-c; fi
cd uplink-c;$(GOBUILD) -o $(LIBRARY_NAME) -buildmode=c-shared;mv $(COPY_LIBRARY_FILE) ../$(CLIBUPLINK_INCLUDE_FOLDER_NAME);
rm -rf $(UPLINKC_NAME);
echo ' $(GREEN_COLOR) \n Successfully build $(RESET_COLOR)';
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![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)

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

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

Expand Down
25 changes: 19 additions & 6 deletions Sources/helloStorj/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ var storjEncryption: String = "change-me-to-desired-encryptionphassphrase"
var storjBucket: String = "change-me-to-desired-bucket-name"
// Upload path within the bucket, where file will be uploaded.
var storjUploadPath: String = "path/filename.txt"
// Upload path within the bucket, where file will be uploaded via overridden serialized access key
var storjUploadPath2: String = "path/filename2.txt"
// Download path within the bucket, wherefrom the Storj object is to be downloaded.
var storjDownloadPath: String = "path/filename.txt"
// Full file name, including path, of the local system, to be uploaded to Storj bucket.
Expand All @@ -32,7 +34,7 @@ do {
//
let uplink = try Storj.uplink()
//
print("Getting Accessig using :\nSatellite address : \(storjSatellite)\nAPI key : \(storjApiKey)\nEncryption phassphrase : \(storjEncryption)")
print("Getting Access using :\nSatellite address : \(storjSatellite)\nAPI key : \(storjApiKey)\nEncryption phassphrase : \(storjEncryption)")
//
let access = try uplink.request_Access_With_Passphrase(satellite: storjSatellite, apiKey: storjApiKey, encryption: storjEncryption)
//
Expand Down Expand Up @@ -92,14 +94,20 @@ do {
//
downloadObject(project: &project, bucketName: storjBucket, localFullFileLocationToStore: localFullFileLocationToStore, storjDownloadPath: storjDownloadPath)
//
var listObjectsOptions = ListObjectsOptions(prefix: "change-me-to-desired-prefix-with-/", cursor: "", recursive: true, system: false, custom: true)
var listObjectsOptions = ListObjectsOptions(prefix: "change-me-to-desired-prefix-with-/", cursor: "", recursive: true, system: true, custom: true)
//
let objectslist = try project.list_Objects(bucket: storjBucket, listObjectsOptions: &listObjectsOptions)
print("\nList object")
for object in objectslist {
print("Object Name : \(object.key)")
print("Object Size : \(object.system.content_length)")
}
//Deleting Object
let deletedObject = try project.delete_Object(bucket: storjBucket, key: storjUploadPath)
print("\nObject deleted !!")
print("Object Information : ")
print("Object Name : \(deletedObject.key)")
print("Object Size : \(deletedObject.system.content_length)")
//
print("\nCreating share access")
//
Expand Down Expand Up @@ -148,19 +156,24 @@ do {
}
}
//
//Deleting Object
let deletedObject = try projectparsed.delete_Object(bucket: storjBucket, key: storjUploadPath)
print("\nUploading object on storj V3 network via overridden serialized access...")
//
uploadObject(project: projectparsed, bucketName: storjBucket, localFullFileNameToUpload: localFullFileNameToUpload, storjUploadPath: storjUploadPath2)
//
//Deleting Object uploaded via overridden serialized access
let deletedObject2 = try projectparsed.delete_Object(bucket: storjBucket, key: storjUploadPath2)
print("\nObject deleted !!")
print("Object Information : ")
print("Object Name : \(deletedObject.key)")
print("Object Size : \(deletedObject.system.content_length)")
print("Object Name : \(deletedObject2.key)")
print("Object Size : \(deletedObject2.system.content_length)")
//Deleting bucket
let deleteBucket = try project.delete_Bucket(bucket: storjBucket)
//
print("\nBucket deleted!!")
print("Bucket information :\nBucket created : ", unixTimeConvert(unixTime: deleteBucket.created))
print("Bucket name : ", deleteBucket.name)
//
//
} catch let error as InternalError {
print("Internal SO error")
print("Error Code : \(error.code)")
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![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)

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

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

Expand Down

0 comments on commit 86b0b77

Please sign in to comment.