Secure Share | Golang SDK
CreatedAt
func (f *FilterList) CreatedAt() *pangea.FilterRange[string]Folder
func (f *FilterList) Folder() *pangea.FilterEqual[string]ID
func (f *FilterList) ID() *pangea.FilterMatch[string]Name
func (f *FilterList) Name() *pangea.FilterMatch[string]ParentID
func (f *FilterList) ParentID() *pangea.FilterMatch[string]Size
func (f *FilterList) Size() *pangea.FilterRange[string]Tags
func (f *FilterList) Tags() *pangea.FilterEqual[[]string]Type
func (f *FilterList) Type() *pangea.FilterMatch[string]UpdatedAt
func (f *FilterList) UpdatedAt() *pangea.FilterRange[string]AccessCount
func (f *FilterShareLinkList) AccessCount() *pangea.FilterRange[string]CreatedAt
func (f *FilterShareLinkList) CreatedAt() *pangea.FilterRange[string]ExpiresAt
func (f *FilterShareLinkList) ExpiresAt() *pangea.FilterRange[string]ID
func (f *FilterShareLinkList) ID() *pangea.FilterMatch[string]LastAccessedAt
func (f *FilterShareLinkList) LastAccessedAt() *pangea.FilterRange[string]Link
func (f *FilterShareLinkList) Link() *pangea.FilterMatch[string]LinkType
func (f *FilterShareLinkList) LinkType() *pangea.FilterMatch[string]MaxAccessCount
func (f *FilterShareLinkList) MaxAccessCount() *pangea.FilterRange[string]Target
func (f *FilterShareLinkList) Target() *pangea.FilterMatch[string]Buckets
func (e *share) Buckets(ctx context.Context) (*pangea.PangeaResponse[BucketsResult], error)Get information on the accessible buckets.
res, err := shareClient.Buckets(ctx)
Delete
func (e *share) Delete(ctx context.Context, input *DeleteRequest) (*pangea.PangeaResponse[DeleteResult], error)Delete object by ID.
input := &share.DeleteRequest{
ID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm"
}
res, err := shareClient.Delete(ctx, input)
Create a folder
func (e *share) FolderCreate(ctx context.Context, input *FolderCreateRequest) (*pangea.PangeaResponse[FolderCreateResult], error)Create a folder, either by name or path and parent_id.
input := &share.FolderCreateRequest{
Metadata: share.Metadata{
"created_by": "jim",
"priority": "medium",
},
ParentID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
Folder: "/",
Tags: share.Tags{"irs_2023", "personal"},
}
res, err := shareClient.FolderCreate(ctx, input)
Get an object
func (e *share) Get(ctx context.Context, input *GetRequest) (*pangea.PangeaResponse[GetResult], error)Get object.
input := &share.GetRequest{
ID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
}
res, err := shareClient.Get(ctx, input)
Get archive
func (e *share) GetArchive(ctx context.Context, input *GetArchiveRequest) (*pangea.PangeaResponse[GetArchiveResult], error)Get an archive file of multiple objects.
input := &share.GetArchiveRequest{
Ids: []string{"pos_3djfmzg2db4c6donarecbyv5begtj2bm"},
}
res, err := shareClient.GetArchive(ctx, input)
List
func (e *share) List(ctx context.Context, input *ListRequest) (*pangea.PangeaResponse[ListResult], error)List or filter/search records.
input := &share.ListRequest{}
res, err := shareClient.List(ctx, input)
Upload a file
func (e *share) Put(ctx context.Context, input *PutRequest, file *os.File) (*pangea.PangeaResponse[PutResult], error)Upload a file.
input := &share.PutRequest{
TransferMethod: pangea.TMmultipart,
Metadata: share.Metadata{
"created_by": "jim",
"priority": "medium",
},
ParentID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
Folder: "/",
Tags: share.Tags{"irs_2023", "personal"},
}
file, err := os.Open("./path/to/file.pdf")
if err != nil {
log.Fatal("Error opening file: %v", err)
}
res, err := shareClient.Put(ctx, input, file)
Request upload URL
func (e *share) RequestUploadURL(ctx context.Context, input *PutRequest) (*pangea.PangeaResponse[PutResult], error)Request an upload URL.
input := &share.PutRequest{
TransferMethod: pangea.TMpostURL,
CRC32C: "515f7c32",
SHA256: "c0b56b1a154697f79d27d57a3a2aad4c93849aa2239cd23048fc6f45726271cc",
Size: 222089,
Metadata: share.Metadata{
"created_by": "jim",
"priority": "medium",
},
ParentID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
Folder: "/",
Tags: share.Tags{"irs_2023", "personal"},
}
res, err := shareClient.RequestUploadURL(ctx, input)
Create share links
func (e *share) ShareLinkCreate(ctx context.Context, input *ShareLinkCreateRequest) (*pangea.PangeaResponse[ShareLinkCreateResult], error)Create a share link.
authenticator := share.Authenticator{
AuthType: share.ATpassword,
AuthContext: "my_fav_Pa55word",
}
link := share.ShareLinkCreateItem{
Targets: []string{"pos_3djfmzg2db4c6donarecbyv5begtj2bm"},
LinkType: "download",
Authenticators: []Authenticator{authenticator},
}
input := &share.ShareLinkCreateRequest{
Links: []share.ShareLinkCreateItem{link},
}
res, err := shareClient.ShareLinkCreate(ctx, input)
Delete share links
func (e *share) ShareLinkDelete(ctx context.Context, input *ShareLinkDeleteRequest) (*pangea.PangeaResponse[ShareLinkDeleteResult], error)Delete share links.
input := &share.ShareLinkDeleteRequest{
Ids: []string{"psl_3djfmzg2db4c6donarecbyv5begtj2bm"},
}
res, err := shareClient.ShareLinkDelete(ctx, input)
Get share link
func (e *share) ShareLinkGet(ctx context.Context, input *ShareLinkGetRequest) (*pangea.PangeaResponse[ShareLinkGetResult], error)Get a share link.
input := &share.ShareLinkGetRequest{
ID: "psl_3djfmzg2db4c6donarecbyv5begtj2bm",
}
res, err := shareClient.ShareLinkGet(ctx, input)
List share links
func (e *share) ShareLinkList(ctx context.Context, input *ShareLinkListRequest) (*pangea.PangeaResponse[ShareLinkListResult], error)Look up share links by filter options.
input := &share.ShareLinkListRequest{}
res, err := shareClient.ShareLinkList(ctx, input)
Send share link(s)
func (e *share) ShareLinkSend(ctx context.Context, input *ShareLinkSendRequest) (*pangea.PangeaResponse[ShareLinkSendResult], error)Send share link(s).
res, err := client.ShareLinkSend(ctx, &share.ShareLinkSendRequest{
Links: []share.ShareLinkSendItem{
share.ShareLinkSendItem{
Id: link.ID,
Email: "user@email.com",
},
},
SenderEmail: "sender@email.com",
SenderName: "Sender Name",
})
Update a file
func (e *share) Update(ctx context.Context, input *UpdateRequest) (*pangea.PangeaResponse[UpdateResult], error)Update a file.
input := &share.UpdateRequest{
ID: "pos_3djfmzg2db4c6donarecbyv5begtj2bm",
Folder: "/",
RemoveMetadata: share.Metadata{
"created_by": "jim",
"priority": "medium",
},
RemoveTags: share.Tags{"irs_2023", "personal"},
}
res, err := shareClient.Update(ctx, input)
Type ArchiveFormat
type ArchiveFormat stringtype ArchiveFormat string
Type Authenticator
type Authenticator structtype Authenticator struct {
AuthType AuthenticatorType `json:"auth_type"` // An authentication mechanism
AuthContext string `json:"auth_context"` // An email address, a phone number or a password to access share link
}
Type AuthenticatorType
type AuthenticatorType stringtype AuthenticatorType string
Type Bucket
type Bucket structtype Bucket struct {
Default bool `json:"default"` // If true, is the default bucket.
ID string `json:"id"` // The ID of a share bucket resource.
Name string `json:"name"` // The bucket's friendly name.
TransferMethods []pangea.TransferMethod `json:"transfer_methods"`
}
Type BucketsResult
type BucketsResult structtype BucketsResult struct {
Buckets []Bucket `json:"buckets"` // A list of available buckets.
}
Type Client
type Client interfacetype Client interface {
// Get information on the accessible buckets.
Buckets(ctx context.Context) (*pangea.PangeaResponse[BucketsResult], error)
FolderCreate(ctx context.Context, input *FolderCreateRequest) (*pangea.PangeaResponse[FolderCreateResult], error)
Delete(ctx context.Context, input *DeleteRequest) (*pangea.PangeaResponse[DeleteResult], error)
Get(ctx context.Context, input *GetRequest) (*pangea.PangeaResponse[GetResult], error)
Put(ctx context.Context, input *PutRequest, file *os.File) (*pangea.PangeaResponse[PutResult], error)
Update(ctx context.Context, input *UpdateRequest) (*pangea.PangeaResponse[UpdateResult], error)
List(ctx context.Context, input *ListRequest) (*pangea.PangeaResponse[ListResult], error)
GetArchive(ctx context.Context, input *GetArchiveRequest) (*pangea.PangeaResponse[GetArchiveResult], error)
ShareLinkCreate(ctx context.Context, input *ShareLinkCreateRequest) (*pangea.PangeaResponse[ShareLinkCreateResult], error)
ShareLinkGet(ctx context.Context, input *ShareLinkGetRequest) (*pangea.PangeaResponse[ShareLinkGetResult], error)
ShareLinkList(ctx context.Context, input *ShareLinkListRequest) (*pangea.PangeaResponse[ShareLinkListResult], error)
ShareLinkDelete(ctx context.Context, input *ShareLinkDeleteRequest) (*pangea.PangeaResponse[ShareLinkDeleteResult], error)
ShareLinkSend(ctx context.Context, input *ShareLinkSendRequest) (*pangea.PangeaResponse[ShareLinkSendResult], error)
RequestUploadURL(ctx context.Context, input *PutRequest) (*pangea.PangeaResponse[PutResult], error)
// Base service methods
pangea.BaseServicer
}
Type DeleteRequest
type DeleteRequest structtype DeleteRequest struct {
pangea.BaseRequest
ID string `json:"id,omitempty"` // The ID of the object to delete.
Force *bool `json:"force,omitempty"` // If true, delete a folder even if it's not empty. Deletes the contents of folder as well.
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
}
Type DeleteResult
type DeleteResult structtype DeleteResult struct {
Count int `json:"count"` // Number of objects deleted.
}
Type FileFormat
type FileFormat stringtype FileFormat string
Type FilterList
type FilterList structJust allowed to filter by folder now
type FilterList struct {
pangea.FilterBase
folder *pangea.FilterEqual[string]
createdAt *pangea.FilterRange[string]
id *pangea.FilterMatch[string]
name *pangea.FilterMatch[string]
parentId *pangea.FilterMatch[string]
size *pangea.FilterRange[string]
tags *pangea.FilterEqual[[]string]
type_ *pangea.FilterMatch[string]
updatedAt *pangea.FilterRange[string]
}
Type FilterShareLinkList
type FilterShareLinkList structtype FilterShareLinkList struct {
pangea.FilterBase
id *pangea.FilterMatch[string]
target *pangea.FilterMatch[string]
linkType *pangea.FilterMatch[string]
accessCount *pangea.FilterRange[string]
maxAccessCount *pangea.FilterRange[string]
createdAt *pangea.FilterRange[string]
expiresAt *pangea.FilterRange[string]
lastAccessedAt *pangea.FilterRange[string]
link *pangea.FilterMatch[string]
}
Type FolderCreateRequest
type FolderCreateRequest structtype FolderCreateRequest struct {
pangea.BaseRequest
Name string `json:"name,omitempty"` // The name of an object.
Metadata Metadata `json:"metadata,omitempty"` // A set of string-based key/value pairs used to provide additional data about an object.
ParentID string `json:"parent_id,omitempty"` // The ID of a stored object.
Folder string `json:"folder,omitempty"` // The folder to place the folder in. Must match `parent_id` if also set.
Tags Tags `json:"tags,omitempty"` // A list of user-defined tags
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
}
Type FolderCreateResult
type FolderCreateResult structtype FolderCreateResult struct {
Object ItemData `json:"object"` // Information on the created folder.
}
Type GetArchiveRequest
type GetArchiveRequest structtype GetArchiveRequest struct {
pangea.BaseRequest
Ids []string `json:"ids"` // The IDs of the objects to include in the archive. Folders include all children.
Format ArchiveFormat `json:"format,omitempty"` // The format to use to build the archive.
TransferMethod pangea.TransferMethod `json:"transfer_method,omitempty"` // The requested transfer method for the file data.
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
}
Type GetArchiveResult
type GetArchiveResult structtype GetArchiveResult struct {
DestURL *string `json:"dest_url,omitempty"` // A location where the archive can be downloaded from. (transfer_method: dest-url)
Count int `json:"count"` // Number of objects included in the archive.
Objects []ItemData `json:"objects"` // A list of all objects included in the archive.
}
Type GetRequest
type GetRequest structtype GetRequest struct {
pangea.BaseRequest
ID string `json:"id,omitempty"` // The ID of the object to retrieve.
Password *string `json:"password,omitempty"` // If the file was protected with a password, the password to decrypt with.
TransferMethod pangea.TransferMethod `json:"transfer_method,omitempty"` // The requested transfer method for the file data.
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
}
Type GetResult
type GetResult structtype GetResult struct {
Object ItemData `json:"object"` // File information.
DestURL *string `json:"dest_url,omitempty"` // A URL where the file can be downloaded from. (transfer_method: dest-url)
}
Type ItemData
type ItemData structtype ItemData struct {
BillableSize int `json:"billable_size"` // The number of billable bytes (includes Metadata, Tags, etc.) for the object.
CreatedAt string `json:"created_at"` // The date and time the object was created.
ExternalBucketKey string `json:"external_bucket_key"` // The key in the external bucket that contains this file.
Folder string `json:"folder"` // The full path to the folder the object is stored in.
ID string `json:"id"` // The ID of a stored object.
MD5 string `json:"md5"` // The MD5 hash of the file contents. Cannot be written to.
Metadata Metadata `json:"metadata,omitempty"` // A set of string-based key/value pairs used to provide additional data about an object.
MetadataProtected Metadata `json:"metadata_protected,omitempty"` // Protected (read-only) metadata.
Name string `json:"name"` // The name of the object.
ParentID string `json:"parent_id"` // The parent ID (a folder). Blanks means the root folder.
SHA256 string `json:"sha256"` // The SHA256 hash of the file contents. Cannot be written to.
SHA512 string `json:"sha512"` // The SHA512 hash of the file contents. Cannot be written to.
Size int `json:"size"` // The size of the object in bytes.
Tags Tags `json:"tags,omitempty"` // A list of user-defined tags
TagsProtected Tags `json:"tags_protected,omitempty"` // Protected (read-only) flags.
Type string `json:"type"` // The type of the item (file or dir). Cannot be written to.
UpdatedAt string `json:"updated_at"` // The date and time the object was last updated.
}
Type ItemOrder
type ItemOrder stringtype ItemOrder string
Type LinkType
type LinkType stringtype LinkType string
Type ListRequest
type ListRequest structtype ListRequest struct {
pangea.BaseRequest
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
IncludeExternalBucketKey *bool `json:"include_external_bucket_key,omitempty"` // If true, include the `external_bucket_key` in results.
Filter pangea.Filter `json:"filter,omitempty"`
Last string `json:"last,omitempty"` // Reflected value from a previous response to obtain the next page of results.
Order ItemOrder `json:"order,omitempty"` // Order results asc(ending) or desc(ending).
OrderBy ObjectOrderBy `json:"order_by,omitempty"` // Which field to order results by.
Size int `json:"size,omitempty"` // Maximum results to include in the response.
}
Type ListResult
type ListResult structtype ListResult struct {
Count int `json:"count"` // The total number of objects matched by the list request.
Last string `json:"last,omitempty"` // Used to fetch the next page of the current listing when provided in a repeated request's last parameter.
Objects []ItemData `json:"objects"`
}
Type Metadata
type Metadata map[string]stringtype Metadata map[string]string
Type ObjectOrderBy
type ObjectOrderBy stringtype ObjectOrderBy string
Type PutRequest
type PutRequest structtype PutRequest struct {
pangea.BaseRequest
pangea.TransferRequest
Size *int `json:"size,omitempty"` // The size (in bytes) of the file. If the upload doesn't match, the call will fail.
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
CRC32C string `json:"crc32c,omitempty"` // The hexadecimal-encoded CRC32C hash of the file data, which will be verified by the server if provided.
SHA256 string `json:"sha256,omitempty"` // The SHA256 hash of the file data, which will be verified by the server if provided.
MD5 string `json:"md5,omitempty"` // The hexadecimal-encoded MD5 hash of the file data, which will be verified by the server if provided.
Name string `json:"name,omitempty"` // The name of the object to store.
Format *FileFormat `json:"format,omitempty"` // The format of the file, which will be verified by the server if provided. Uploads not matching the supplied format will be rejected.
Metadata Metadata `json:"metadata,omitempty"` // A set of string-based key/value pairs used to provide additional data about an object.
MimeType string `json:"mimetype,omitempty"` // The MIME type of the file, which will be verified by the server if provided. Uploads not matching the supplied MIME type will be rejected.
ParentID string `json:"parent_id,omitempty"` // The parent ID of the object (a folder). Leave blank to keep in the root folder.
Folder string `json:"folder,omitempty"` // The path to the parent folder. Leave blank for the root folder. Path must resolve to `parent_id` if also set.
Password string `json:"password,omitempty"` // An optional password to protect the file with. Downloading the file will require this password.
PasswordAlgorithm string `json:"password_algorithm,omitempty"` // An optional password algorithm to protect the file with. See symmetric vault password_algorithm.
SHA1 string `json:"sha1,omitempty"` // The hexadecimal-encoded SHA1 hash of the file data, which will be verified by the server if provided.
SHA512 string `json:"sha512,omitempty"` // The hexadecimal-encoded SHA512 hash of the file data, which will be verified by the server if provided.
SourceURL string `json:"source_url,omitempty"` // The URL to fetch the file payload from (for transfer_method source-url).
Tags Tags `json:"tags,omitempty"` // A list of user-defined tags
}
Type PutResult
type PutResult structtype PutResult struct {
Object ItemData `json:"object"`
}
Type ShareLinkCreateItem
type ShareLinkCreateItem structtype ShareLinkCreateItem struct {
Targets []string `json:"targets"` // List of storage IDs
LinkType LinkType `json:"link_type,omitempty"` // Type of link
ExpiresAt string `json:"expires_at,omitempty"` // The date and time the share link expires.
MaxAccessCount *int `json:"max_access_count,omitempty"` // The maximum number of times a user can be authenticated to access the share link.
Authenticators []Authenticator `json:"authenticators,omitempty"` // A list of authenticators
Title string `json:"title,omitempty"` // An optional title to use in accessing shares.
Message string `json:"message,omitempty"` // An optional message to use in accessing shares.
NotifyEmail string `json:"notify_email,omitempty"` // An email address
Tags Tags `json:"tags,omitempty"` // A list of user-defined tags
}
Type ShareLinkCreateRequest
type ShareLinkCreateRequest structtype ShareLinkCreateRequest struct {
pangea.BaseRequest
Links []ShareLinkCreateItem `json:"links"`
}
Type ShareLinkCreateResult
type ShareLinkCreateResult structtype ShareLinkCreateResult struct {
ShareLinkObjects []ShareLinkItem `json:"share_link_objects"`
}
Type ShareLinkDeleteRequest
type ShareLinkDeleteRequest structtype ShareLinkDeleteRequest struct {
pangea.BaseRequest
BucketID *string `json:"bucket_id,omitempty"` // The bucket to use, if not the default.
Ids []string `json:"ids"`
}