Bundle Notifications

A BundleNotification is an E-Mail sent out to users when certain actions are performed on or within a shared set of files and folders.

SDK Method

bundle_notification.List()

Return Values

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

Authorization Requirement

Available to all authenticated keys or sessions.

BundleNotificationListParams Fields

FieldDescription
UserId
int64
User ID. Provide a value of 0 to operate the current session's user.
BundleId
int64
Bundle ID

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

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

bundleNotificationIterator, err := bundle_notification.List(files_sdk.BundleNotificationListParams{UserId: 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
}

for bundleNotification, err := range bundleNotificationIterator.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(bundleNotification)
}

SDK Method

bundle_notification.Find()

Return Values

Returns a files_sdk.BundleNotification value and an error.

Authorization Requirement

Available to all authenticated keys or sessions.

BundleNotificationFindParams Fields

FieldDescription
Id
int64
Required
Bundle Notification ID.

Example Request

import (
    "fmt"
    "errors"

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

bundleNotification, err := bundle_notification.Find(files_sdk.BundleNotificationFindParams{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(bundleNotification)

SDK Method

bundle_notification.Create()

Return Values

Returns a files_sdk.BundleNotification value and an error.

Authorization Requirement

Available to all authenticated keys or sessions.

BundleNotificationCreateParams Fields

FieldDefaultDescription
UserId
int64
User ID. Provide a value of 0 to operate the current session's user.
BundleId
int64
Required
Bundle ID to notify on
NotifyUserId
int64
The id of the user to notify.
NotifyOnRegistration
boolean
falseTriggers bundle notification when a registration action occurs for it.
NotifyOnUpload
boolean
falseTriggers bundle notification when a upload action occurs for it.

Example Request

import (
    "fmt"
    "errors"

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

bundleNotification, err := bundle_notification.Create(files_sdk.BundleNotificationCreateParams{BundleId: 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(bundleNotification)

SDK Method

bundle_notification.Update()

Return Values

Returns a files_sdk.BundleNotification value and an error.

Authorization Requirement

Available to all authenticated keys or sessions.

BundleNotificationUpdateParams Fields

FieldDescription
Id
int64
Required
Bundle Notification ID.
NotifyOnRegistration
boolean
Triggers bundle notification when a registration action occurs for it.
NotifyOnUpload
boolean
Triggers bundle notification when a upload action occurs for it.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    bundle_notification "github.com/Files-com/files-sdk-go/v3/bundlenotification"
    "github.com/Files-com/files-sdk-go/v3/lib"
)

bundleNotification, err := bundle_notification.Update(files_sdk.BundleNotificationUpdateParams{
  Id: 1,
  NotifyOnRegistration: lib.Bool(true),
})
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(bundleNotification)

SDK Method

bundle_notification.Delete()

Return Values

Returns an error, or nil on success.

Authorization Requirement

Available to all authenticated keys or sessions.

BundleNotificationDeleteParams Fields

FieldDescription
Id
int64
Required
Bundle Notification ID.

Example Request

import (
    "fmt"
    "errors"

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

err := bundle_notification.Delete(files_sdk.BundleNotificationDeleteParams{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 BundleNotification Object

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

AttributeDescription
BundleId
int64
Bundle ID to notify on
Id
int64
Bundle Notification ID
NotifyOnRegistration
boolean
Triggers bundle notification when a registration action occurs for it.
NotifyOnUpload
boolean
Triggers bundle notification when a upload action occurs for it.
NotifyCurrentUser
boolean
Is the current user the user to notify?
NotifyUserId
int64
The id of the user to notify.
WorkspaceId
int64
Workspace ID. 0 means the default workspace.