-
Notifications
You must be signed in to change notification settings - Fork 7
Get Storage info
WARNING - OUTDATED
Get drive is used to get some drive. For getting use Storage.GetDrive()
Following parameters is required:
- Context - context
- PublicAccount - the public account of some drive
package main
import (
"context"
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
const (
// Sirius api rest server
baseUrl = "http://localhost:3000"
)
func main() {
conf, err := sdk.NewConfig(context.Background(), []string{baseUrl})
if err != nil {
fmt.Printf("NewConfig returned error: %s", err)
return
}
// Use the default http client
client := sdk.NewClient(nil, conf)
// Some drive account (create or get)
driveAccount := &sdk.Account{}
//Get drive
drive, err := client.Storage.GetDrive(context.Background(), driveAccount.PublicAccount)
handleError(err)
println(drive.String())
}
Get account drives is used to get drives of some account. For getting use Storage.GetAccountDrives()
Following parameters is required:
- Context - context
- DrivePublicAccount - the public account of some drive
Third parameter can get next values:
- AllRoles - all drives on which the account is the participant
- Owner - all drives on which the account is the owner
- Replicator - all drives on which the account is the replicator
package main
import (
"context"
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
const (
// Sirius api rest server
baseUrl = "http://localhost:3000"
)
func main() {
conf, err := sdk.NewConfig(context.Background(), []string{baseUrl})
if err != nil {
fmt.Printf("NewConfig returned error: %s", err)
return
}
// Use the default http client
client := sdk.NewClient(nil, conf)
// Some drive account (create or get
owner := &sdk.Account{}
//Get owner drives
drives, err := client.Storage.GetAccountDrives(context.Background(), owner.PublicAccount, sdk.AllRoles)
handleError(err)
for _, d := range drives {
println(d.String())
}
}
Get account download infos is used to get download info of some account (recipient). For getting use Storage.GetAccountDownloadInfos()
Following parameters is required:
- Context - context
- PublicAccount - the public account of a recipient
package main
import (
"context"
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
const (
// Sirius api rest server
baseUrl = "http://localhost:3000"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
//Create new config
conf, err := sdk.NewConfig(ctx, []string{baseUrl})
if err != nil {
fmt.Printf("NewConfig returned error: %s", err)
return
}
// Use the default http client
client := sdk.NewClient(nil, conf)
//Some recipient (see download example)
recipient, err := client.NewAccount()
handleError(err)
//Get download infos
downloadInfos, err := client.Storage.GetAccountDownloadInfos(ctx, recipient.PublicAccount)
handleError(err)
//Print download infos
for _, d := range downloadInfos {
fmt.Println(d)
}
}
Get download info is used to get info about some download transaction. For getting use Storage.GetDownloadInfo()
Following parameters is required:
- Context - context
- OperationToken - the hash of download transaction
package main
import (
"context"
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
const (
// Sirius api rest server
baseUrl = "http://localhost:3000"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
//Create new config
conf, err := sdk.NewConfig(ctx, []string{baseUrl})
if err != nil {
fmt.Printf("NewConfig returned error: %s", err)
return
}
// Use the default http client
client := sdk.NewClient(nil, conf)
//Some hash of a transaction
operationToken := &sdk.Hash{}
//Get download info
downloadInfo, err := client.Storage.GetDownloadInfo(ctx, operationToken)
handleError(err)
fmt.Println(downloadInfo)
}
Get drive download infos is used to get drive download info. For getting use Storage.GetDriveDownloadInfos()
Following parameters is required:
- Context - context
- PublicAccount - the public account of some drive account
package main
import (
"context"
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
const (
// Sirius api rest server
baseUrl = "http://localhost:3000"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
//Create new config
conf, err := sdk.NewConfig(ctx, []string{baseUrl})
if err != nil {
fmt.Printf("NewConfig returned error: %s", err)
return
}
// Use the default http client
client := sdk.NewClient(nil, conf)
// Some drive account (create or get)
driveAccount := &sdk.Account{}
//Get download infos
downloadInfos, err := client.Storage.GetDriveDownloadInfos(ctx, driveAccount.PublicAccount)
handleError(err)
//Print download infos
for _, d := range downloadInfos {
fmt.Println(d)
}
}
Get verification status is used to get status of download transaction. For getting use Storage.GetVerificationStatus()
Following parameters is required:
- Context - context
- PublicAccount - the public account of some drive account
package main
import (
"context"
"fmt"
"github.com/proximax-storage/go-xpx-chain-sdk/sdk"
)
const (
// Sirius api rest server
baseUrl = "http://localhost:3000"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
//Create new config
conf, err := sdk.NewConfig(ctx, []string{baseUrl})
if err != nil {
fmt.Printf("NewConfig returned error: %s", err)
return
}
// Use the default http client
client := sdk.NewClient(nil, conf)
// Some drive account (create or get)
driveAccount := &sdk.Account{}
//Get status
status, err := client.Storage.GetVerificationStatus(ctx, driveAccount.PublicAccount)
handleError(err)
//Print download infos
fmt.Println(status)
}
- Home
- Installation
-
Examples
- Basic functions
- Get Accounts info
- Get Transactions info
- Get Mosaic info
- Get Mosaic Levy info
- Get Namespace info
- Get BlockChain info
- Get Network info
- Get Metadata info
- Get Nem Metadata info
- Get Account Properties info
- Get Exchange info
- Get SDA-SDA Exchange info
- Get Secret lock info
- Get Storage info
- Announces a transaction
- Websocket