api

package
v1.67.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package api provides types used by the Jottacloud API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllocateFileRequest

type AllocateFileRequest struct {
	Bytes    int64  `json:"bytes"`
	Created  string `json:"created"`
	Md5      string `json:"md5"`
	Modified string `json:"modified"`
	Path     string `json:"path"`
}

AllocateFileRequest to prepare an upload to Jottacloud

type AllocateFileResponse

type AllocateFileResponse struct {
	Name      string `json:"name"`
	Path      string `json:"path"`
	State     string `json:"state"`
	UploadID  string `json:"upload_id"`
	UploadURL string `json:"upload_url"`
	Bytes     int64  `json:"bytes"`
	ResumePos int64  `json:"resume_pos"`
}

AllocateFileResponse for upload requests

type CustomerInfo added in v1.6.1

type CustomerInfo struct {
	Username          string      `json:"username"`
	Email             string      `json:"email"`
	Name              string      `json:"name"`
	CountryCode       string      `json:"country_code"`
	LanguageCode      string      `json:"language_code"`
	CustomerGroupCode string      `json:"customer_group_code"`
	BrandCode         string      `json:"brand_code"`
	AccountType       string      `json:"account_type"`
	SubscriptionType  string      `json:"subscription_type"`
	Usage             int64       `json:"usage"`
	Quota             int64       `json:"quota"`
	BusinessUsage     int64       `json:"business_usage"`
	BusinessQuota     int64       `json:"business_quota"`
	WriteLocked       bool        `json:"write_locked"`
	ReadLocked        bool        `json:"read_locked"`
	LockedCause       interface{} `json:"locked_cause"`
	WebHash           string      `json:"web_hash"`
	AndroidHash       string      `json:"android_hash"`
	IOSHash           string      `json:"ios_hash"`
}

CustomerInfo provides general information about the account. Required for finding the correct internal username.

type DeviceRegistrationResponse

type DeviceRegistrationResponse struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
}

DeviceRegistrationResponse is the response to registering a device

type DriveInfo added in v1.6.1

type DriveInfo struct {
	Username          string        `xml:"username"`
	AccountType       string        `xml:"account-type"`
	Locked            bool          `xml:"locked"`
	Capacity          int64         `xml:"capacity"`
	MaxDevices        int           `xml:"max-devices"`
	MaxMobileDevices  int           `xml:"max-mobile-devices"`
	Usage             int64         `xml:"usage"`
	ReadLocked        bool          `xml:"read-locked"`
	WriteLocked       bool          `xml:"write-locked"`
	QuotaWriteLocked  bool          `xml:"quota-write-locked"`
	EnableSync        bool          `xml:"enable-sync"`
	EnableFolderShare bool          `xml:"enable-foldershare"`
	Devices           []JottaDevice `xml:"devices>device"`
}

DriveInfo represents a Jottacloud account

type Error

type Error struct {
	StatusCode int    `xml:"code"`
	Message    string `xml:"message"`
	Reason     string `xml:"reason"`
	Cause      string `xml:"cause"`
}

Error is a custom Error for wrapping Jottacloud error responses

func (*Error) Error

func (e *Error) Error() string

Error returns a string for the error and satisfies the error interface

type Flag

type Flag bool

Flag is a hacky type for checking if an attribute is present

func (*Flag) MarshalXMLAttr

func (f *Flag) MarshalXMLAttr(name xml.Name) (xml.Attr, error)

MarshalXMLAttr : Do not use

func (*Flag) UnmarshalXMLAttr

func (f *Flag) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr sets Flag to true if the attribute is present

type JottaDevice

type JottaDevice struct {
	Name        string            `xml:"name"`
	DisplayName string            `xml:"display_name"`
	Type        string            `xml:"type"`
	Sid         string            `xml:"sid"`
	Size        int64             `xml:"size"`
	User        string            `xml:"user"`
	MountPoints []JottaMountPoint `xml:"mountPoints>mountPoint"`
}

JottaDevice represents a Jottacloud Device

type JottaFile

type JottaFile struct {
	XMLName         xml.Name
	Name            string    `xml:"name,attr"`
	Deleted         Flag      `xml:"deleted,attr"`
	PublicURI       string    `xml:"publicURI"`
	PublicSharePath string    `xml:"publicSharePath"`
	State           string    `xml:"currentRevision>state"`
	CreatedAt       JottaTime `xml:"currentRevision>created"`
	ModifiedAt      JottaTime `xml:"currentRevision>modified"`
	UpdatedAt       JottaTime `xml:"currentRevision>updated"`
	Size            int64     `xml:"currentRevision>size"`
	MimeType        string    `xml:"currentRevision>mime"`
	MD5             string    `xml:"currentRevision>md5"`
}

JottaFile represents a Jottacloud file

type JottaFolder

type JottaFolder struct {
	XMLName    xml.Name
	Name       string        `xml:"name,attr"`
	Deleted    Flag          `xml:"deleted,attr"`
	Path       string        `xml:"path"`
	CreatedAt  JottaTime     `xml:"created"`
	ModifiedAt JottaTime     `xml:"modified"`
	Updated    JottaTime     `xml:"updated"`
	Folders    []JottaFolder `xml:"folders>folder"`
	Files      []JottaFile   `xml:"files>file"`
}

JottaFolder represents a JottacloudFolder

type JottaMountPoint

type JottaMountPoint struct {
	Name    string        `xml:"name"`
	Size    int64         `xml:"size"`
	Device  string        `xml:"device"`
	Folders []JottaFolder `xml:"folders>folder"`
	Files   []JottaFile   `xml:"files>file"`
}

JottaMountPoint represents a Jottacloud mountpoint

type JottaTime added in v1.58.0

type JottaTime time.Time

JottaTime represents time values in the classic API using a custom RFC3339 like format

func (*JottaTime) MarshalXML added in v1.58.0

func (t *JottaTime) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML turns a JottaTime into XML

func (JottaTime) String added in v1.58.0

func (t JottaTime) String() string

String returns JottaTime string in Jottacloud classic format

func (*JottaTime) UnmarshalXML added in v1.58.0

func (t *JottaTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML turns XML into a JottaTime

type LoginToken added in v1.50.4

type LoginToken struct {
	Username      string `json:"username"`
	Realm         string `json:"realm"`
	WellKnownLink string `json:"well_known_link"`
	AuthToken     string `json:"auth_token"`
}

LoginToken is struct representing the login token generated in the WebUI

type Rfc3339Time added in v1.58.0

type Rfc3339Time time.Time

Rfc3339Time represents time values in the newer APIs using standard RFC3339 format

func (*Rfc3339Time) MarshalJSON added in v1.58.0

func (t *Rfc3339Time) MarshalJSON() ([]byte, error)

MarshalJSON turns a Rfc3339Time into JSON

func (*Rfc3339Time) MarshalXML added in v1.58.0

func (t *Rfc3339Time) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML turns a Rfc3339Time into XML

func (Rfc3339Time) String added in v1.58.0

func (t Rfc3339Time) String() string

String returns Rfc3339Time string in Jottacloud RFC3339 format

func (*Rfc3339Time) UnmarshalXML added in v1.58.0

func (t *Rfc3339Time) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML turns XML into a Rfc3339Time

type TokenJSON

type TokenJSON struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int32  `json:"expires_in"` // at least PayPal returns string, while most return number
	RefreshExpiresIn int32  `json:"refresh_expires_in"`
	RefreshToken     string `json:"refresh_token"`
	TokenType        string `json:"token_type"`
	IDToken          string `json:"id_token"`
	NotBeforePolicy  int32  `json:"not-before-policy"`
	SessionState     string `json:"session_state"`
	Scope            string `json:"scope"`
}

TokenJSON is the struct representing the HTTP response from OAuth2 providers returning a token in JSON form.

type TrashResponse added in v1.50.20

type TrashResponse struct {
	Folders int64 `json:"folders"`
	Files   int64 `json:"files"`
}

TrashResponse is returned when emptying the Trash

type UploadResponse

type UploadResponse struct {
	Path      string `json:"path"`
	ContentID string `json:"content_id"`
	Bytes     int64  `json:"bytes"`
	Md5       string `json:"md5"`
	Modified  int64  `json:"modified"`
}

UploadResponse after an upload

type WellKnown added in v1.50.4

type WellKnown struct {
	Issuer                                     string   `json:"issuer"`
	AuthorizationEndpoint                      string   `json:"authorization_endpoint"`
	TokenEndpoint                              string   `json:"token_endpoint"`
	TokenIntrospectionEndpoint                 string   `json:"token_introspection_endpoint"`
	UserinfoEndpoint                           string   `json:"userinfo_endpoint"`
	EndSessionEndpoint                         string   `json:"end_session_endpoint"`
	JwksURI                                    string   `json:"jwks_uri"`
	CheckSessionIframe                         string   `json:"check_session_iframe"`
	GrantTypesSupported                        []string `json:"grant_types_supported"`
	ResponseTypesSupported                     []string `json:"response_types_supported"`
	SubjectTypesSupported                      []string `json:"subject_types_supported"`
	IDTokenSigningAlgValuesSupported           []string `json:"id_token_signing_alg_values_supported"`
	UserinfoSigningAlgValuesSupported          []string `json:"userinfo_signing_alg_values_supported"`
	RequestObjectSigningAlgValuesSupported     []string `json:"request_object_signing_alg_values_supported"`
	ResponseNodesSupported                     []string `json:"response_modes_supported"`
	RegistrationEndpoint                       string   `json:"registration_endpoint"`
	TokenEndpointAuthMethodsSupported          []string `json:"token_endpoint_auth_methods_supported"`
	TokenEndpointAuthSigningAlgValuesSupported []string `json:"token_endpoint_auth_signing_alg_values_supported"`
	ClaimsSupported                            []string `json:"claims_supported"`
	ClaimTypesSupported                        []string `json:"claim_types_supported"`
	ClaimsParameterSupported                   bool     `json:"claims_parameter_supported"`
	ScopesSupported                            []string `json:"scopes_supported"`
	RequestParameterSupported                  bool     `json:"request_parameter_supported"`
	RequestURIParameterSupported               bool     `json:"request_uri_parameter_supported"`
	CodeChallengeMethodsSupported              []string `json:"code_challenge_methods_supported"`
	TLSClientCertificateBoundAccessTokens      bool     `json:"tls_client_certificate_bound_access_tokens"`
	IntrospectionEndpoint                      string   `json:"introspection_endpoint"`
}

WellKnown contains some configuration parameters for setting up endpoints

Jump to

Keyboard shortcuts

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