Styles

A Style is a custom set of branding that can be applied on a per-folder basis. Currently these support a logo per folder and an optional click-through URL for public visitors. In the future we may extend these to also support colors. If you want to see that, please let us know so we can add your vote to the list.

Show Style

SDK Method

style.Find()

Return Object

Style

Authorization Requirement

Available to all authenticated keys or sessions.

StyleFindParams Fields

FieldDescription
Path
string
Required
Style path.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    "github.com/Files-com/files-sdk-go/v3/style"
)

style, err := style.Find(files_sdk.StyleFindParams{Path: "path"})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Update Style

SDK Method

style.Update()

Return Object

Style

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Folder Admin permissions.

StyleUpdateParams Fields

FieldDescription
Path
string
Required
Style path.
File
file
Logo for custom branding. Required when creating a new style. See Attaching Files to API Requests.
LogoClickHref
string
URL to open when a public visitor clicks the logo.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    "github.com/Files-com/files-sdk-go/v3/style"
)

style, err := style.Update(files_sdk.StyleUpdateParams{
  Path: "path",
  LogoClickHref: "https://www.example.com"
})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Delete Style

SDK Method

style.Delete()

Return Object

No return value.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Folder Admin permissions.

StyleDeleteParams Fields

FieldDescription
Path
string
Required
Style path.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    "github.com/Files-com/files-sdk-go/v3/style"
)

err := style.Delete(files_sdk.StyleDeleteParams{Path: "path"})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

The Style Object

Some of the methods above return a Style object. The attributes of this object are listed below.

AttributeDescription
Id
int64
Style ID
Path
string
Folder path. This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
Logo
Image
Logo
LogoClickHref
string
URL to open when a public visitor clicks the logo
Thumbnail
Image
Logo thumbnail