internxtclient

package
v0.0.0-...-7ef3b77 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDriveAPIURL  = "https://gateway.internxt.com/drive"
	DefaultAuthAPIURL   = "https://gateway.internxt.com/drive/auth"
	DefaultUsersAPIURL  = "https://gateway.internxt.com/users"
	DefaultBucketAPIURL = "https://gateway.internxt.com/network/buckets"
	DefaultBaseAPIURL   = "https://gateway.internxt.com"

	DefaultAppCryptoSecret  = "6KYQBP847D4ATSFA"
	DefaultAppCryptoSecret2 = "8Q8VMUE3BJZV87GT"
	DefaultAppMagicIV       = "d139cb9a2cd17092e79e1861cf9d7023"
	DefaultAppMagicSalt     = "" /* 128-byte string literal not displayed */
)
View Source
const (
	TrashTypeFile   TrashType = "file"
	TrashTypeFolder TrashType = "folder"

	OrderAsc  Order = "ASC"
	OrderDesc Order = "DESC"

	SortByPlainName SortField = "plainName"
	SortByUpdatedAt SortField = "updatedAt"
	SortBySize      SortField = "size"

	ItemTypeFiles   ItemType = "files"
	ItemTypeFolders ItemType = "folders"
)

Variables

This section is empty.

Functions

func CalculateFileHash

func CalculateFileHash(reader io.Reader) (string, error)

Calculates the hash of a file

func DecryptReader

func DecryptReader(src io.Reader, key, iv []byte) (io.Reader, error)

DecryptReader wraps the provided src reader in a StreamReader that decrypts data encrypted with AES‑256‑CTR (no padding):

encryptedSrc -> source -> …

func EncryptReader

func EncryptReader(src io.Reader, key, iv []byte) (io.Reader, error)

EncryptReader wraps the provided src reader in a StreamReader that encrypts all data through AES‑256‑CTR (no padding):

source -> cipher -> …

func GenerateBucketKey

func GenerateBucketKey(mnem string, bucketID []byte) (string, error)

GenerateBucketKey generates a 64-character hexadecimal bucket key from a mnemonic and bucket ID.

func GenerateFileBucketKey

func GenerateFileBucketKey(mnemonic, bucketID string) ([]byte, error)

GenerateFileBucketKey derives a bucket-level key from mnemonic and bucketID

func GenerateFileKey

func GenerateFileKey(mnemonic, bucketID, indexHex string) (key, iv []byte, err error)

GenerateFileKey derives the per-file key and IV from mnemonic, bucketID, and plaintext index

func GetDeterministicKey

func GetDeterministicKey(key []byte, data []byte) ([]byte, error)

func GetFileDeterministicKey

func GetFileDeterministicKey(key, data []byte) []byte

GetFileDeterministicKey returns SHA512(key||data)

func NewAES256CTRCipher

func NewAES256CTRCipher(key, iv []byte) (cipher.Stream, error)

NewAES256CTRCipher returns a cipher.Stream that performs AES‑256‑CTR encryption with the given 32‑byte key and 16‑byte IV, exactly like Node.js’s createCipheriv('aes-256-ctr', key, iv).

Types

type APIType

type APIType int
const (
	APITypeDrive APIType = iota
	APITypeAuth
	APITypeUsers
	APITypeBucket
	APITypeBase
)

type AccessResponse

type AccessResponse struct {
	User     *User           `json:"user"`
	Token    string          `json:"token"`
	UserTeam json.RawMessage `json:"userTeam"`
	NewToken string          `json:"newToken"`
}

type AuthService

type AuthService struct {
	// contains filtered or unexported fields
}

func (*AuthService) AccessLogin

func (a *AuthService) AccessLogin(loginResponse *LoginResponse, password string) (*AccessResponse, error)

AccessLogin calls {DRIVE_API_URL}/auth/login/access based on our previous LoginResponse

func (*AuthService) AreCredentialsCorrect

func (a *AuthService) AreCredentialsCorrect(hashedPassword string) (bool, error)

func (*AuthService) Login

func (a *AuthService) Login(email string) (*LoginResponse, error)

Login calls {DRIVE_API_URL}/auth/login with {"email":…}

func (*AuthService) Logout

func (a *AuthService) Logout() error

Logout calls {DRIVE_API_URL}/auth/logout. Returns error if failed.

type AvailableWorkspace

type AvailableWorkspace struct {
	WorkspaceUser WorkspaceUser `json:"workspaceUser"`
	Workspace     Workspace     `json:"workspace"`
}

AvailableWorkspace ties a user to a workspace

type BucketFileInfo

type BucketFileInfo struct {
	Bucket   string      `json:"bucket"`
	Index    string      `json:"index"`
	Size     int64       `json:"size"`
	Version  int         `json:"version"`
	Created  string      `json:"created"`
	Renewal  string      `json:"renewal"`
	Mimetype string      `json:"mimetype"`
	Filename string      `json:"filename"`
	ID       string      `json:"id"`
	Shards   []ShardInfo `json:"shards"`
}

BucketFileInfo is the metadata returned by GET /buckets/{bucketID}/files/{fileID}/info

type BucketsService

type BucketsService struct {
	// contains filtered or unexported fields
}

func (*BucketsService) CreateMetaFile

func (b *BucketsService) CreateMetaFile(name, fileID, encryptVersion, folderUuid, plainName, fileType string, size int64, modTime time.Time) (*CreateMetaResponse, error)

func (*BucketsService) DownloadFile

func (b *BucketsService) DownloadFile(fileID, destination string) error

Downloads a file by its ID and places it at destination

func (*BucketsService) DownloadFileStream

func (b *BucketsService) DownloadFileStream(fileID string, optionalRange ...string) (io.ReadCloser, error)

DownloadFileStream returns a ReadCloser that streams the decrypted contents of the file with the given UUID. The caller must close the returned ReadCloser. It takes an optional range header in the format of either "bytes=100-199" or "bytes=100-".

func (*BucketsService) FinishUpload

func (b *BucketsService) FinishUpload(index string, shards []Shard) (*FinishUploadResp, error)

func (*BucketsService) GetBucketFileInfo

func (b *BucketsService) GetBucketFileInfo(bucketID, fileID string) (*BucketFileInfo, error)

GetBucketFileInfo calls the correct /info endpoint and parses its JSON.

func (*BucketsService) StartUpload

func (b *BucketsService) StartUpload(bucketID string, parts []UploadPartSpec) (*StartUploadResp, error)

StartUpload reserves all parts at once

func (*BucketsService) Transfer

func (b *BucketsService) Transfer(part UploadPart, r io.Reader, size int64) error

func (*BucketsService) UploadFileStream

func (b *BucketsService) UploadFileStream(targetFolderUUID, fileName string, in io.Reader, plainSize int64, modTime time.Time) (*CreateMetaResponse, error)

UploadFileStream uploads data from the provided io.Reader into Internxt, encrypting it on the fly and creating the metadata file in the target folder. It returns the CreateMetaResponse of the created file entry.

type Client

type Client struct {
	Config     Config
	HTTPClient *http.Client
	UserData   *UserData

	Folders    *FoldersService
	Files      *FilesService
	Auth       *AuthService
	Users      *UsersService
	Fuzzy      *FuzzyService
	Buckets    *BucketsService
	Workspaces *WorkspacesService
	Trash      *TrashService
}

func NewWithCredentials

func NewWithCredentials(email, password string) (*Client, error)

func NewWithDefaults

func NewWithDefaults() *Client

func (*Client) Delete

func (c *Client) Delete(apiType APIType, path string, body, result any, headers *http.Header) (*Response, error)

Get sends an HTTP DELETE request with optional headers to the given APIType and path, unmarshaling the response into result.

func (*Client) Get

func (c *Client) Get(apiType APIType, path string, result any, headers *http.Header) (*Response, error)

Get sends an HTTP GET request with optional headers to the given APIType and path, unmarshaling the response into result.

func (*Client) GetError

func (c *Client) GetError(endpoint string, resp *Response, err error) error

func (*Client) Patch

func (c *Client) Patch(apiType APIType, path string, body any, result any, headers *http.Header) (*Response, error)

Get sends an HTTP PATCH request with optional headers to the given APIType and path, unmarshaling the response into result.

func (*Client) Post

func (c *Client) Post(apiType APIType, path string, body any, result any, headers *http.Header) (*Response, error)

Get sends an HTTP POST request with optional headers to the given APIType and path, unmarshaling the response into result.

func (*Client) Put

func (c *Client) Put(apiType APIType, path string, body any, result any, headers *http.Header) (*Response, error)

Get sends an HTTP PUT request with optional headers to the given APIType and path, unmarshaling the response into result.

func (*Client) URL

func (c *Client) URL(api APIType) string

Getter for convenience

type Config

type Config struct {
	APIURLs map[APIType]string `json:"api_urls,omitempty"`

	AppCryptoSecret   string `json:"app_crypto_secret,omitempty"`
	AppCryptoSecret2  string `json:"app_crypto_secret2,omitempty"`
	AppMagicIV        string `json:"app_magic_iv,omitempty"`
	AppMagicSalt      string `json:"app_magic_salt,omitempty"`
	EncryptedPassword string `json:"encrypted_password,omitempty"`
	PasswordHash      string `json:"password_hash,omitempty"`
}

type CreateFolderRequest

type CreateFolderRequest struct {
	PlainName        string `json:"plainName"`
	ParentFolderUUID string `json:"parentFolderUuid"`
	ModificationTime string `json:"modificationTime"`
	CreationTime     string `json:"creationTime"`
}

CreateFolderRequest is the payload for POST /drive/folders

type CreateMetaRequest

type CreateMetaRequest struct {
	Name             string    `json:"name"`
	Bucket           string    `json:"bucket"`
	FileID           string    `json:"fileId"`
	EncryptVersion   string    `json:"encryptVersion"`
	FolderUuid       string    `json:"folderUuid"`
	Size             int64     `json:"size"`
	PlainName        string    `json:"plainName"`
	Type             string    `json:"type"`
	CreationTime     time.Time `json:"creationTime"`
	Date             time.Time `json:"date"`
	ModificationTime time.Time `json:"modificationTime"`
}

type CreateMetaResponse

type CreateMetaResponse struct {
	UUID           string      `json:"uuid"`
	Name           string      `json:"name"`
	Bucket         string      `json:"bucket"`
	FileID         string      `json:"fileId"`
	EncryptVersion string      `json:"encryptVersion"`
	FolderUuid     string      `json:"folderUuid"`
	Size           json.Number `json:"size"`
	PlainName      string      `json:"plainName"`
	Type           string      `json:"type"`
	Created        string      `json:"created"`
}

type File

type File struct {
	ID               int64       `json:"id"`
	FileID           string      `json:"fileId"`
	UUID             string      `json:"uuid"`
	Name             string      `json:"name"`
	PlainName        string      `json:"plainName"`
	Type             string      `json:"type"`
	FolderID         json.Number `json:"folderId"`
	FolderUUID       string      `json:"folderUuid"`
	Folder           any         `json:"folder"`
	Bucket           string      `json:"bucket"`
	UserID           json.Number `json:"userId"`
	User             any         `json:"user"`
	EncryptVersion   string      `json:"encryptVersion"`
	Size             json.Number `json:"size"`
	Deleted          bool        `json:"deleted"`
	DeletedAt        *time.Time  `json:"deletedAt"`
	Removed          bool        `json:"removed"`
	RemovedAt        *time.Time  `json:"removedAt"`
	Shares           []any       `json:"shares"`
	Sharings         []any       `json:"sharings"`
	Thumbnails       []any       `json:"thumbnails"`
	CreatedAt        time.Time   `json:"createdAt"`
	UpdatedAt        time.Time   `json:"updatedAt"`
	CreationTime     time.Time   `json:"creationTime"`
	ModificationTime time.Time   `json:"modificationTime"`
	Status           string      `json:"status"`
}

File represents the response object for files in a folder under GET /drive/folders/content/{uuid}/files

type FilesService

type FilesService struct {
	// contains filtered or unexported fields
}

func (*FilesService) DeleteFile

func (f *FilesService) DeleteFile(uuid string) error

DeleteFile deletes a file by UUID

func (*FilesService) GetFileMeta

func (f *FilesService) GetFileMeta(fileUUID string) (*File, error)

GetFileMeta gets file with metadata by UUID

func (*FilesService) GetRecentFiles

func (f *FilesService) GetRecentFiles(limit int) ([]File, error)

GetRecentFiles retrieves a list of recent files with the given limit.

func (*FilesService) MoveFile

func (f *FilesService) MoveFile(fileUUID, destinationFolderUUID string) (*File, error)

MoveFile moves the file with the given UUID to the destination folder.

func (*FilesService) UpdateFileMeta

func (f *FilesService) UpdateFileMeta(fileUUID string, updated *File) (*File, error)

UpdateFileMeta updates the metadata of a file with the given UUID.

type FinishUploadResp

type FinishUploadResp struct {
	Bucket   string `json:"bucket"`
	Index    string `json:"index"`
	ID       string `json:"id"`
	Version  int    `json:"version"`
	Created  string `json:"created"`
	Renewal  string `json:"renewal"`
	Mimetype string `json:"mimetype"`
	Filename string `json:"filename"`
}

type Folder

type Folder struct {
	Type             string     `json:"type"`
	ID               int64      `json:"id"`
	ParentID         int64      `json:"parentId"`
	ParentUUID       string     `json:"parentUuid"`
	Name             string     `json:"name"`
	Parent           any        `json:"parent"`
	Bucket           any        `json:"bucket"`
	UserID           int64      `json:"userId"`
	User             *User      `json:"user"`
	EncryptVersion   string     `json:"encryptVersion"`
	Deleted          bool       `json:"deleted"`
	DeletedAt        *time.Time `json:"deletedAt"`
	CreatedAt        time.Time  `json:"createdAt"`
	UpdatedAt        time.Time  `json:"updatedAt"`
	UUID             string     `json:"uuid"`
	PlainName        string     `json:"plainName"`
	Size             int64      `json:"size"`
	Removed          bool       `json:"removed"`
	RemovedAt        *time.Time `json:"removedAt"`
	CreationTime     time.Time  `json:"creationTime"`
	ModificationTime time.Time  `json:"modificationTime"`
	Status           string     `json:"status"`
	Files            []File     `json:"files"`
	Children         []Folder   `json:"children"`
}

Folder represents the response from POST/GET /drive/folders

type FolderStatus

type FolderStatus string

FolderStatus represents the status filter for file and folder operations Possible values: EXISTS, TRASHED, DELETED, ALL

const (
	StatusExists  FolderStatus = "EXISTS"
	StatusTrashed FolderStatus = "TRASHED"
	StatusDeleted FolderStatus = "DELETED"
	StatusAll     FolderStatus = "ALL"
)

type FoldersService

type FoldersService struct {
	// contains filtered or unexported fields
}

func (*FoldersService) CreateFolder

func (f *FoldersService) CreateFolder(reqBody CreateFolderRequest) (*Folder, error)

CreateFolder calls {DriveAPIURL}/folders with authorization. It auto‑fills CreationTime/ModificationTime if empty, checks status, and returns the newly created Folder.

func (*FoldersService) DeleteFolder

func (f *FoldersService) DeleteFolder(uuid string) error

DeleteFolders deletes a folder by UUID

func (*FoldersService) GetFolderMeta

func (f *FoldersService) GetFolderMeta(folderUUID string) (*Folder, error)

Gets the metadata for a folder by its UUID

func (*FoldersService) GetFolderSize

func (f *FoldersService) GetFolderSize(uuid string) (int64, error)

GetFolderSize retrieves the total size (in bytes) of a folder by UUID. Returns the size as int64, or an error.

func (*FoldersService) ListAllFiles

func (f *FoldersService) ListAllFiles(parentUUID string) ([]File, error)

This function will get all of the files in a folder, getting 50 at a time until completed

func (*FoldersService) ListAllFolders

func (f *FoldersService) ListAllFolders(parentUUID string) ([]Folder, error)

This function will get all of the folders in a folder, getting 50 at a time until completed

func (*FoldersService) ListFiles

func (f *FoldersService) ListFiles(parentUUID string, opts *ListOptions) ([]File, error)

ListFiles lists child files under the given parent UUID. Returns a slice of files or error otherwise

func (*FoldersService) ListFolders

func (f *FoldersService) ListFolders(parentUUID string, opts *ListOptions) ([]Folder, error)

ListFolders lists child folders under the given parent UUID. Returns a slice of folders or error

func (*FoldersService) MoveFolder

func (f *FoldersService) MoveFolder(uuid, destUUID string) error

MoveFolder moves a folder into a new parent.

func (*FoldersService) RenameFolder

func (f *FoldersService) RenameFolder(uuid, newName string) error

RenameFolder updates the plainName of an existing folder.

func (*FoldersService) Tree

func (f *FoldersService) Tree(parentUUID string) (*Folder, error)

Tree lists child folders and files recursively under the given parent UUID.

type FuzzyService

type FuzzyService struct {
	// contains filtered or unexported fields
}

func (*FuzzyService) FuzzySearch

func (f *FuzzyService) FuzzySearch(term string, offset int) (*SearchResponse, error)

FuzzySearch performs a fuzzy search with a given term and offset.

type GetUserCredentialsResponse

type GetUserCredentialsResponse struct {
	User struct {
		ID         int    `json:"id"`
		UserID     string `json:"userId"`
		Name       string `json:"name"`
		Lastname   string `json:"lastname"`
		Email      string `json:"email"`
		Username   string `json:"username"`
		BridgeUser string `json:"bridgeUser"`
		Password   struct {
			Type string `json:"type"`
			Data []byte `json:"data"`
		} `json:"password"`
		Mnemonic struct {
			Type string `json:"type"`
			Data []byte `json:"data"`
		} `json:"mnemonic"`
		RootFolderID int `json:"rootFolderId"`
		HKey         struct {
			Type string `json:"type"`
			Data []byte `json:"data"`
		} `json:"hKey"`
		Secret2FA             any       `json:"secret_2FA"`
		ErrorLoginCount       int       `json:"errorLoginCount"`
		IsEmailActivitySended bool      `json:"isEmailActivitySended"`
		ReferralCode          string    `json:"referralCode"`
		Referrer              any       `json:"referrer"`
		SyncDate              any       `json:"syncDate"`
		UUID                  string    `json:"uuid"`
		LastResend            any       `json:"lastResend"`
		Credit                int       `json:"credit"`
		WelcomePack           bool      `json:"welcomePack"`
		RegisterCompleted     bool      `json:"registerCompleted"`
		BackupsBucket         any       `json:"backupsBucket"`
		SharedWorkspace       bool      `json:"sharedWorkspace"`
		Avatar                any       `json:"avatar"`
		LastPasswordChangedAt any       `json:"lastPasswordChangedAt"`
		TierID                string    `json:"tierId"`
		EmailVerified         bool      `json:"emailVerified"`
		UpdatedAt             time.Time `json:"updatedAt"`
		CreatedAt             time.Time `json:"createdAt"`
	} `json:"user"`
	OldToken string `json:"oldToken"`
	NewToken string `json:"newToken"`
}

type ItemType

type ItemType string

type LimitResponse

type LimitResponse struct {
	MaxSpaceBytes int64 `json:"maxSpaceBytes"`
}

type ListOptions

type ListOptions struct {
	Limit  int    `url:"limit"`
	Offset int    `url:"offset"`
	Sort   string `url:"sort,omitempty"`
	Order  string `url:"order,omitempty"`
}

ListOptions defines common pagination and sorting parameters for list endpoints.

type LoginResponse

type LoginResponse struct {
	HasKeys      bool   `json:"hasKeys"`
	SKey         string `json:"sKey"`
	TFA          bool   `json:"tfa"`
	HasKyberKeys bool   `json:"hasKyberKeys"`
	HasECCKeys   bool   `json:"hasEccKeys"`
}

type Order

type Order string

type Response

type Response struct {
	StatusCode int
	Headers    http.Header
	Body       []byte
}

type SearchResponse

type SearchResponse struct {
	Data []SearchResult `json:"data"`
}

type SearchResult

type SearchResult struct {
	ID         string  `json:"id"`
	ItemID     string  `json:"itemId"`
	ItemType   string  `json:"itemType"` // "file" or "folder"
	Name       string  `json:"name"`
	Rank       float64 `json:"rank"`
	Similarity float64 `json:"similarity"`
}

type Shard

type Shard struct {
	Hash string `json:"hash"`
	UUID string `json:"uuid"`
}

type ShardInfo

type ShardInfo struct {
	Index int    `json:"index"`
	Hash  string `json:"hash"`
	URL   string `json:"url"`
}

ShardInfo mirrors the per‑shard info returned by /files/{fileID}/info

type SortField

type SortField string

type StartUploadResp

type StartUploadResp struct {
	Uploads []UploadPart `json:"uploads"`
}

type TrashItemsRequest

type TrashItemsRequest struct {
	Items []TrashRef `json:"items"`
}

type TrashRef

type TrashRef struct {
	UUID string    `json:"uuid"`
	Type TrashType `json:"type"`
}

type TrashService

type TrashService struct {
	// contains filtered or unexported fields
}

func (*TrashService) AddToTrash

func (t *TrashService) AddToTrash(items []TrashRef) error

AddToTrash adds an item to trash

func (*TrashService) DeleteAllTrash

func (t *TrashService) DeleteAllTrash() error

DeleteAllTrash deletes the entire trash

func (*TrashService) DeleteSpecifiedTrashItems

func (t *TrashService) DeleteSpecifiedTrashItems(items []TrashRef) error

DeleteSpecifiedTrashItems deletes items (either files or folders) identified by TrashRef from trash

func (*TrashService) DeleteTrashFile

func (t *TrashService) DeleteTrashFile(fileID string) error

DeleteTrashFile deletes a file from trash. This takes FileID as input, not UUID

func (*TrashService) DeleteTrashFolder

func (t *TrashService) DeleteTrashFolder(folderID int64) error

DeleteTrashFolder deletes a folder from trash. This takes FolderID as input, not UUID

func (*TrashService) FilesToTrashRefs

func (t *TrashService) FilesToTrashRefs(files []File) []TrashRef

FilesToTrashRefs converts a slice of File to TrashRef

func (*TrashService) FoldersToTrashRefs

func (t *TrashService) FoldersToTrashRefs(folders []Folder) []TrashRef

FoldersToTrashRefs converts a slice of Folder to TrashRef

func (*TrashService) GetPaginatedTrashFiles

func (t *TrashService) GetPaginatedTrashFiles(limit, offset int, sort SortField, order Order, root bool) ([]File, error)

GetPaginatedTrashFiles gets files in trash

func (*TrashService) GetPaginatedTrashFolders

func (t *TrashService) GetPaginatedTrashFolders(limit, offset int, sort SortField, order Order, root bool) ([]Folder, error)

func (*TrashService) NewTrashFile

func (t *TrashService) NewTrashFile(uuid string) TrashRef

NewTrashFile returns a new TrashRef of type file

func (*TrashService) NewTrashFolder

func (t *TrashService) NewTrashFolder(uuid string) TrashRef

NewTrashFolder returns a new TrashRef of type folder

func (*TrashService) RequestDeleteAllTrash

func (t *TrashService) RequestDeleteAllTrash() error

RequestDeleteAllTrash deletes the entire trash

type TrashType

type TrashType string

type UploadPart

type UploadPart struct {
	Index int    `json:"index"`
	UUID  string `json:"uuid"`
	URL   string `json:"url"`
}

type UploadPartSpec

type UploadPartSpec struct {
	Index int   `json:"index"`
	Size  int64 `json:"size"`
}

UploadPartSpec defines each part’s index and size for the start call

type UsageResponse

type UsageResponse struct {
	Drive int64 `json:"drive"`
}

type User

type User struct {
	Email          string    `json:"email"`
	UserID         string    `json:"userId"`
	Mnemonic       string    `json:"mnemonic"`
	RootFolderID   int       `json:"root_folder_id"`
	RootFolderUUID string    `json:"rootFolderId"`
	Name           string    `json:"name"`
	Lastname       string    `json:"lastname"`
	UUID           string    `json:"uuid"`
	Credit         int       `json:"credit"`
	CreatedAt      time.Time `json:"createdAt"`
	PrivateKey     string    `json:"privateKey"`
	PublicKey      string    `json:"publicKey"`
	RevocateKey    string    `json:"revocateKey"`
	Keys           struct {
		Ecc struct {
			PrivateKey string `json:"privateKey"`
			PublicKey  string `json:"publicKey"`
		} `json:"ecc"`
		Kyber struct {
			PrivateKey string `json:"privateKey"`
			PublicKey  string `json:"publicKey"`
		} `json:"kyber"`
	} `json:"keys"`
	Bucket                string `json:"bucket"`
	RegisterCompleted     bool   `json:"registerCompleted"`
	Teams                 bool   `json:"teams"`
	Username              string `json:"username"`
	BridgeUser            string `json:"bridgeUser"`
	SharedWorkspace       bool   `json:"sharedWorkspace"`
	AppSumoDetails        any    `json:"appSumoDetails"`
	HasReferralsProgram   bool   `json:"hasReferralsProgram"`
	BackupsBucket         any    `json:"backupsBucket"`
	Avatar                any    `json:"avatar"`
	EmailVerified         bool   `json:"emailVerified"`
	LastPasswordChangedAt any    `json:"lastPasswordChangedAt"`
}

type UserData

type UserData struct {
	LoginData       *LoginResponse  `json:"login,omitempty"`
	AccessData      *AccessResponse `json:"access,omitempty"`
	BasicAuthHeader string          `json:"basic_auth_header,omitempty"`
}

type UsersService

type UsersService struct {
	// contains filtered or unexported fields
}

func (*UsersService) GetLimit

func (u *UsersService) GetLimit() (*LimitResponse, error)

GetLimit calls {DRIVE_API_URL}/users/limit and returns the maximum available storage of the account.

func (*UsersService) GetUsage

func (u *UsersService) GetUsage() (*UsageResponse, error)

GetUsage calls GET {DRIVE_API_URL}/users/usage and returns the account's current usage in bytes.

func (*UsersService) GetUserCredentials

func (u *UsersService) GetUserCredentials() (*GetUserCredentialsResponse, error)

GetUserCredentials gets the user's data by user uuid

type Workspace

type Workspace struct {
	ID              string `json:"id"`
	OwnerID         string `json:"ownerId"`
	Address         string `json:"address"`
	Name            string `json:"name"`
	Description     string `json:"description"`
	Avatar          string `json:"avatar"`
	DefaultTeamID   string `json:"defaultTeamId"`
	WorkspaceUserID string `json:"workspaceUserId"`
	SetupCompleted  bool   `json:"setupCompleted"`
	NumberOfSeats   int    `json:"numberOfSeats"`
	PhoneNumber     string `json:"phoneNumber"`
	RootFolderID    string `json:"rootFolderId"`
	CreatedAt       string `json:"createdAt"`
	UpdatedAt       string `json:"updatedAt"`
}

Workspace holds metadata about a workspace

type WorkspaceUser

type WorkspaceUser struct {
	ID           string          `json:"id"`
	MemberID     string          `json:"memberId"`
	Key          string          `json:"key"`
	WorkspaceID  string          `json:"workspaceId"`
	RootFolderID string          `json:"rootFolderId"`
	SpaceLimit   int64           `json:"spaceLimit"`
	DriveUsage   int64           `json:"driveUsage"`
	BackupsUsage int64           `json:"backupsUsage"`
	Deactivated  bool            `json:"deactivated"`
	Member       json.RawMessage `json:"member"`
	CreatedAt    string          `json:"createdAt"`
	UpdatedAt    string          `json:"updatedAt"`
}

WorkspaceUser holds per-user settings within a workspace

type WorkspacesResponse

type WorkspacesResponse struct {
	Available []AvailableWorkspace `json:"availableWorkspaces"`
	Pending   []json.RawMessage    `json:"pendingWorkspaces"`
}

WorkspacesResponse is the response for GET /drive/workspaces

type WorkspacesService

type WorkspacesService struct {
	// contains filtered or unexported fields
}

func (*WorkspacesService) GetWorkspaces

func (w *WorkspacesService) GetWorkspaces() (*WorkspacesResponse, error)

GetWorkspaces calls GET {DriveAPIURL}/workspaces and returns the parsed response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL