api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package api provides types used by the Zoho API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CurrentTeamInfo

type CurrentTeamInfo struct {
	Data struct {
		ID   string `json:"id"`
		Type string `json:"string"`
	}
}

CurrentTeamInfo gives information about the current user in a team.

type Item

type Item struct {
	ID         string `json:"id"`
	Attributes struct {
		Name         string `json:"name"`
		Type         string `json:"type"`
		IsFolder     bool   `json:"is_folder"`
		CreatedTime  Time   `json:"created_time_in_millisecond"`
		ModifiedTime Time   `json:"modified_time_in_millisecond"`
		UploadedTime Time   `json:"uploaded_time_in_millisecond"`
		StorageInfo  struct {
			Size        int64 `json:"size_in_bytes"`
			FileCount   int64 `json:"files_count"`
			FolderCount int64 `json:"folders_count"`
		} `json:"storage_info"`
	} `json:"attributes"`
}

Item is may represent a file or a folder in Zoho Workdrive

type ItemInfo

type ItemInfo struct {
	Item Item `json:"data"`
}

ItemInfo contains a single Zoho Item

type ItemList

type ItemList struct {
	Links Links  `json:"links"`
	Items []Item `json:"data"`
}

ItemList contains multiple Zoho Items

type LargeUploadInfo

type LargeUploadInfo struct {
	Attributes struct {
		ParentID    string `json:"parent_id"`
		FileName    string `json:"file_name"`
		RessourceID string `json:"resource_id"`
		FileInfo    string `json:"file_info"`
	} `json:"attributes"`
}

LargeUploadInfo is once again a slightly different version of UploadInfo returned as part of an LargeUploadResponse by the large file upload API.

func (*LargeUploadInfo) GetUploadFileInfo

func (ui *LargeUploadInfo) GetUploadFileInfo() (*UploadFileInfo, error)

GetUploadFileInfo decodes the embedded FileInfo

type LargeUploadResponse

type LargeUploadResponse struct {
	Uploads []LargeUploadInfo `json:"data"`
	Status  string            `json:"status"`
}

LargeUploadResponse is the response returned by large file upload API.

type Links struct {
	Cursor struct {
		HasNext bool   `json:"has_next"`
		Next    string `json:"next"`
	} `json:"cursor"`
}

Links contains Cursor information

type OAuthUser

type OAuthUser struct {
	FirstName   string `json:"First_Name"`
	Email       string `json:"Email"`
	LastName    string `json:"Last_Name"`
	DisplayName string `json:"Display_Name"`
	ZUID        int64  `json:"ZUID"`
}

OAuthUser is a Zoho user we are only interested in the ZUID here

type PrivateSpaceInfo

type PrivateSpaceInfo struct {
	Data struct {
		ID   string `json:"id"`
		Type string `json:"string"`
	} `json:"data"`
}

PrivateSpaceInfo gives basic information about a users private folder.

type TeamWorkspace

type TeamWorkspace struct {
	ID         string `json:"id"`
	Type       string `json:"type"`
	Attributes struct {
		Name    string `json:"name"`
		Created Time   `json:"created_time_in_millisecond"`
		IsPart  bool   `json:"is_partof"`
	} `json:"attributes"`
}

TeamWorkspace represents a Zoho Team, Workspace or Private Space It's actually a VERY large json object that differs between Team and Workspace and Private Space but we are only interested in some fields that all of them have so we can use the same struct.

type TeamWorkspaceResponse

type TeamWorkspaceResponse struct {
	TeamWorkspace []TeamWorkspace `json:"data"`
}

TeamWorkspaceResponse is the response by the list teams API, list workspace API or list team private spaces API.

type Time

type Time time.Time

Time represents date and time information for Zoho Zoho uses milliseconds since unix epoch (Java currentTimeMillis)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON turns JSON into a Time

type UploadFileInfo

type UploadFileInfo struct {
	OrgID           string `json:"ORG_ID"`
	ResourceID      string `json:"RESOURCE_ID"`
	LibraryID       string `json:"LIBRARY_ID"`
	Md5Checksum     string `json:"MD5_CHECKSUM"`
	ParentModelID   string `json:"PARENT_MODEL_ID"`
	ParentID        string `json:"PARENT_ID"`
	ResourceType    int    `json:"RESOURCE_TYPE"`
	WmsSentTime     string `json:"WMS_SENT_TIME"`
	TabID           string `json:"TAB_ID"`
	Owner           string `json:"OWNER"`
	ResourceGroup   string `json:"RESOURCE_GROUP"`
	ParentModelName string `json:"PARENT_MODEL_NAME"`
	Size            int64  `json:"size"`
	Operation       string `json:"OPERATION"`
	EventID         string `json:"EVENT_ID"`
	AuditInfo       struct {
		VersionInfo struct {
			VersionAuthors    []string `json:"versionAuthors"`
			VersionID         string   `json:"versionId"`
			IsMinorVersion    bool     `json:"isMinorVersion"`
			VersionTime       Time     `json:"versionTime"`
			VersionAuthorZuid []string `json:"versionAuthorZuid"`
			VersionNotes      string   `json:"versionNotes"`
			VersionNumber     string   `json:"versionNumber"`
		} `json:"versionInfo"`
		Resource struct {
			Owner            string `json:"owner"`
			CreatedTime      Time   `json:"created_time"`
			Creator          string `json:"creator"`
			ServiceType      int    `json:"service_type"`
			Extension        string `json:"extension"`
			StatusChangeTime Time   `json:"status_change_time"`
			ResourceType     int    `json:"resource_type"`
			Name             string `json:"name"`
		} `json:"resource"`
		ParentInfo struct {
			ParentName string `json:"parentName"`
			ParentID   string `json:"parentId"`
			ParentType int    `json:"parentType"`
		} `json:"parentInfo"`
		LibraryInfo struct {
			LibraryName string `json:"libraryName"`
			LibraryID   string `json:"libraryId"`
			LibraryType int    `json:"libraryType"`
		} `json:"libraryInfo"`
		UpdateType string `json:"updateType"`
		StatusCode string `json:"statusCode"`
	} `json:"AUDIT_INFO"`
	ZUID   int64  `json:"ZUID"`
	TeamID string `json:"TEAM_ID"`
}

UploadFileInfo is what the FileInfo field in the UnloadInfo struct decodes to

func (*UploadFileInfo) GetModTime

func (ufi *UploadFileInfo) GetModTime() Time

GetModTime fetches the modification time of the upload

This tries a few places and if all fails returns the current time

type UploadInfo

type UploadInfo struct {
	Attributes struct {
		ParentID    string `json:"parent_id"`
		FileName    string `json:"notes.txt"`
		RessourceID string `json:"resource_id"`
		Permalink   string `json:"Permalink"`
		FileInfo    string `json:"File INFO"` // JSON encoded UploadFileInfo
	} `json:"attributes"`
}

UploadInfo is a simplified and slightly different version of the Item struct only used in the response to uploads

func (*UploadInfo) GetUploadFileInfo

func (ui *UploadInfo) GetUploadFileInfo() (*UploadFileInfo, error)

GetUploadFileInfo decodes the embedded FileInfo

type UploadResponse

type UploadResponse struct {
	Uploads []UploadInfo `json:"data"`
}

UploadResponse is the response to a file Upload

type UserInfoResponse

type UserInfoResponse struct {
	Data struct {
		ID         string `json:"id"`
		Type       string `json:"users"`
		Attributes struct {
			EmailID string `json:"email_id"`
			Edition string `json:"edition"`
		} `json:"attributes"`
	} `json:"data"`
}

UserInfoResponse is returned by the user info API.

type WriteAttributes

type WriteAttributes struct {
	Name        string `json:"name,omitempty"`
	ParentID    string `json:"parent_id,omitempty"`
	RessourceID string `json:"resource_id,omitempty"`
	Status      string `json:"status,omitempty"`
}

WriteAttributes is used to set various attributes for on items this is used for Move, Copy, Delete, Rename

type WriteMetadata

type WriteMetadata struct {
	Attributes WriteAttributes `json:"attributes,omitempty"`
	ID         string          `json:"id,omitempty"`
	Type       string          `json:"type"`
}

WriteMetadata is used to write item metadata

type WriteMetadataRequest

type WriteMetadataRequest struct {
	Data WriteMetadata `json:"data"`
}

WriteMetadataRequest is used to write metadata for a single item

type WriteMultiMetadataRequest

type WriteMultiMetadataRequest struct {
	Meta []WriteMetadata `json:"data"`
}

WriteMultiMetadataRequest can be used to write metadata for multiple items at once but we don't use it that way

Jump to

Keyboard shortcuts

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