# GO SDK

### Titan Storage Go SDK

The Titan Storage Go SDK provides functionalities for file uploading, downloading, deleting, renaming, sharing, and creating folders.

The Go SDK consists of TitanStorage.

#### Install Go SDK And initialize the go SDK

```
go get -u github.com/utopiosphe/titan-storage-sdk
```

Retrieve the apikey and use it to initialize the go SDK

<figure><img src="https://743115216-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS3G37Grl2vDniwEyDc23%2Fuploads%2FvbkBF5AG9rO2ycZac5ff%2Faccess_key.jpg?alt=media&#x26;token=14b50d15-07c5-4b73-ae2b-a5aea5e0bc7d" alt=""><figcaption></figcaption></figure>

```
package main

import (
    storage "github.com/utopiosphe/titan-storage-sdk"
)

const (
    titanStorageURL = "https://api-test1.container1.titannet.io"
)

var TitanStorage storage.Storage

func init() {
    var err error

    TitanStorage,err = storage.Initialize(&storage.Config{
        TitanURL: titanStorageURL,
        APIKey: os.Getenv("apikey"),
    })
    if err != nil {
        panic(fmt.Errorf("new client of titan storage error:%w",err))
    }
}
```

#### Go SDK Method With Client

| Method                                                                                                                      | Description                                           |
| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| [TitanStorage.ListRegions](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L32)           | Retrieve the list of area IDs from the scheduler      |
| [TitanStorage.CreateFolder](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L47)          | Create directories, including root and subdirectories |
| [TitanStorage.ListDirectoryContents](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L56) | Retrieve a list of all folders and files              |
| [TitanStorage.RenameFolder](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L67)          | Rename a specific folder                              |
| [TitanStorage.RenameAsset](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L76)           | Rename a specific file                                |
| [TitanStorage.DeleteFolder](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L85)          | Delete a specific folder                              |
| [TitanStorage.DeleteAsset](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L94)           | Delete a specific file                                |
| [TitanStorage.GetUserProfile](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#174)        | Retrieve user-related information                     |
| [TitanStorage.GetltemDetails](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L103)       | Get detailed information about files/folders          |
| [TitanStorage.CreateSharedLink](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L114)     | Share file/folder data                                |
| [TitanStorage.UploadAsset](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L126)          | Upload files/folders                                  |
| [TitanStorage.DownloadAsset](https://github.com/utopiosphe/titan-storage-sdk/blob/main/example/storage_test.go#L149)        | Download files/folders                                |
