Application Connections

List Application Connections

SDK Method

application_connection.List()

Return Values

Returns a *application_connection.Iter and an error. Range over All() to receive files_sdk.ApplicationConnection values and errors. Check each loop error before using its resource. Next() and Err() remain supported.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

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

applicationConnectionIterator, err := application_connection.List(files_sdk.ApplicationConnectionListParams{})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

for applicationConnection, err := range applicationConnectionIterator.All() {
    if err != nil {
        var respErr files_sdk.ResponseError
        if errors.As(err, &respErr) {
            fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
        } else {
            fmt.Printf("Request failed: %v\n", err)
        }
        return
    }
    fmt.Println(applicationConnection)
}

Show Application Connection

SDK Method

application_connection.Find()

Return Values

Returns a files_sdk.ApplicationConnection value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

ApplicationConnectionFindParams Fields

FieldDescription
Id
int64
Required
Application Connection ID.

Example Request

import (
    "fmt"
    "errors"

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

applicationConnection, err := application_connection.Find(files_sdk.ApplicationConnectionFindParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(applicationConnection)

Create Application Connection

SDK Method

application_connection.Create()

Return Values

Returns a files_sdk.ApplicationConnection value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

ApplicationConnectionCreateParams Fields

FieldDefaultDescription
Name
string
Required
Connection display name.
SecretId
int64
ID of the credential in the Secret Store, if the connection uses a credential.
ApplicationKey
string
Required
Application key from the Automation applications list.
Origin
string
Required
HTTPS origin for this connection.
WorkspaceId
int64
0Workspace that owns this connection.

Example Request

import (
    "fmt"
    "errors"

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

applicationConnection, err := application_connection.Create(files_sdk.ApplicationConnectionCreateParams{
  Name: "example",
  ApplicationKey: "example",
  Origin: "example",
})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(applicationConnection)

Update Application Connection

SDK Method

application_connection.Update()

Return Values

Returns a files_sdk.ApplicationConnection value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

ApplicationConnectionUpdateParams Fields

FieldDescription
Id
int64
Required
Application Connection ID.
Name
string
Connection display name.
SecretId
int64
ID of the credential in the Secret Store, if the connection uses a credential.

Example Request

import (
    "fmt"
    "errors"

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

applicationConnection, err := application_connection.Update(files_sdk.ApplicationConnectionUpdateParams{
  Id: 1,
  Name: "example",
})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(applicationConnection)

Delete Application Connection

SDK Method

application_connection.Delete()

Return Values

Returns an error, or nil on success.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

ApplicationConnectionDeleteParams Fields

FieldDescription
Id
int64
Required
Application Connection ID.

Example Request

import (
    "fmt"
    "errors"

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

err := application_connection.Delete(files_sdk.ApplicationConnectionDeleteParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

The ApplicationConnection Object

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

AttributeDescription
Id
int64
Connection ID.
WorkspaceId
int64
Workspace that owns this connection.
Name
string
Connection display name.
ApplicationKey
string
Application key from the Automation applications list.
Origin
string
HTTPS origin for this connection.
SecretId
int64
ID of the credential in the Secret Store, if the connection uses a credential.
Authentication
object
Current credential type and placement, without the secret value.
CreatedAt
date-time
Time the connection was created.
UpdatedAt
date-time
Time the connection was updated.