Documentation
¶
Index ¶
- func Bool(b bool) param.Opt[bool]
- func BoolPtr(v bool) *bool
- func DefaultClientOptions() []option.RequestOption
- func File(rdr io.Reader, filename string, contentType string) file
- func Float(f float64) param.Opt[float64]
- func FloatPtr(v float64) *float64
- func Int(i int64) param.Opt[int64]
- func IntPtr(v int64) *int64
- func Opt[T comparable](v T) param.Opt[T]
- func Ptr[T any](v T) *T
- func String(s string) param.Opt[string]
- func StringPtr(v string) *string
- func Time(t time.Time) param.Opt[time.Time]
- func TimePtr(v time.Time) *time.Time
- type AlbumListResponse
- type AlbumListResponseData
- type AlbumListResponseObject
- type AlbumService
- type ChangeListParams
- type ChangeListResponse
- type ChangeListResponseMedia
- type ChangeListResponseMediaLocation
- type ChangeListResponseObject
- type ChangeListResponseType
- type ChangeService
- func (r *ChangeService) List(ctx context.Context, query ChangeListParams, opts ...option.RequestOption) (res *pagination.OffsetPage[ChangeListResponse], err error)
- func (r *ChangeService) ListAutoPaging(ctx context.Context, query ChangeListParams, opts ...option.RequestOption) *pagination.OffsetPageAutoPager[ChangeListResponse]
- type Client
- func (r *Client) Delete(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, ...) error
- func (r *Client) Get(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Patch(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Post(ctx context.Context, path string, params any, res any, ...) error
- func (r *Client) Put(ctx context.Context, path string, params any, res any, ...) error
- type ConnectService
- type ConnectTryParams
- type ConnectTryResponse
- type ConnectTryResponseObject
- type ConnectTryResponseStatus
- type Error
- type FListParams
- type FListResponse
- type FListResponseObject
- type FListResponseType
- type FReadParams
- type FService
- func (r *FService) List(ctx context.Context, query FListParams, opts ...option.RequestOption) (res *pagination.OffsetPage[FListResponse], err error)
- func (r *FService) ListAutoPaging(ctx context.Context, query FListParams, opts ...option.RequestOption) *pagination.OffsetPageAutoPager[FListResponse]
- func (r *FService) Read(ctx context.Context, query FReadParams, opts ...option.RequestOption) (err error)
- func (r *FService) Stat(ctx context.Context, query FStatParams, opts ...option.RequestOption) (res *FStatResponse, err error)
- type FStatParams
- type FStatResponse
- type FStatResponseObject
- type FStatResponseType
- type HandshakeCompleteParams
- type HandshakeCompleteResponse
- type HandshakeCompleteResponseObject
- type HandshakeService
- type HealthCheckResponse
- type HealthCheckResponseDeviceType
- type HealthCheckResponseMediaCount
- type HealthCheckResponseObject
- type HealthCheckResponseStatus
- type HealthService
- type MediaDownloadContentParams
- type MediaDownloadContentParamsFormat
- type MediaDownloadContentParamsSize
- type MediaGetResponse
- type MediaGetResponseLocation
- type MediaGetResponseObject
- type MediaListMonthsResponse
- type MediaListMonthsResponseObject
- type MediaListParams
- type MediaListParamsOrder
- type MediaListParamsOrderBy
- type MediaListParamsType
- type MediaListResponse
- type MediaListResponseLocation
- type MediaListResponseObject
- type MediaListYearsResponse
- type MediaListYearsResponseObject
- type MediaService
- func (r *MediaService) DownloadContent(ctx context.Context, id string, params MediaDownloadContentParams, ...) (res *http.Response, err error)
- func (r *MediaService) Fetch(ctx context.Context, id string, opts ...option.RequestOption) (res *http.Response, err error)
- func (r *MediaService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *MediaGetResponse, err error)
- func (r *MediaService) List(ctx context.Context, query MediaListParams, opts ...option.RequestOption) (res *pagination.OffsetPage[MediaListResponse], err error)
- func (r *MediaService) ListAutoPaging(ctx context.Context, query MediaListParams, opts ...option.RequestOption) *pagination.OffsetPageAutoPager[MediaListResponse]
- func (r *MediaService) ListMonths(ctx context.Context, year int64, opts ...option.RequestOption) (res *MediaListMonthsResponse, err error)
- func (r *MediaService) ListYears(ctx context.Context, opts ...option.RequestOption) (res *MediaListYearsResponse, err error)
- type PersonService
- type SyncRequestParams
- type SyncRequestResponse
- type SyncRequestResponseObject
- type SyncRequestResponseStatus
- type SyncService
- type UsbConfigureParams
- type UsbConfigureResponse
- type UsbConfigureResponseObject
- type UsbService
- type UsbStatusResponse
- type UsbStatusResponseObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClientOptions ¶
func DefaultClientOptions() []option.RequestOption
DefaultClientOptions read from the environment (SYNCAWESOME_API_KEY, SYNCAWESOME_CLIENT_IP, SYNCAWESOME_PORT, SYNCAWESOME_BASE_URL). This should be used to initialize new clients.
func Opt ¶
func Opt[T comparable](v T) param.Opt[T]
Types ¶
type AlbumListResponse ¶
type AlbumListResponse struct {
// Number of items returned in this page
Count int64 `json:"count" api:"required"`
// Array of albums
Data []AlbumListResponseData `json:"data" api:"required"`
// Object type indicator for list responses
//
// Any of "list".
Object AlbumListResponseObject `json:"object" api:"required"`
// Starting index of this page
Offset int64 `json:"offset" api:"required"`
// Total number of albums
TotalCount int64 `json:"total_count" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Count respjson.Field
Data respjson.Field
Object respjson.Field
Offset respjson.Field
TotalCount respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AlbumListResponse) RawJSON ¶
func (r AlbumListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*AlbumListResponse) UnmarshalJSON ¶
func (r *AlbumListResponse) UnmarshalJSON(data []byte) error
type AlbumListResponseData ¶
type AlbumListResponseData struct {
// Unique album identifier
ID string `json:"id" api:"required"`
// ID of cover media item
CoverMediaID string `json:"cover_media_id" api:"required"`
// Album creation timestamp (Unix seconds)
CreatedAt int64 `json:"created_at" api:"required"`
// Number of items in album
ItemCount int64 `json:"item_count" api:"required"`
// Object type indicator
//
// Any of "album".
Object string `json:"object" api:"required"`
// Album title
Title string `json:"title" api:"required"`
// Album type (smart = system, user = created by user)
//
// Any of "smart", "user".
Type string `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CoverMediaID respjson.Field
CreatedAt respjson.Field
ItemCount respjson.Field
Object respjson.Field
Title respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (AlbumListResponseData) RawJSON ¶
func (r AlbumListResponseData) RawJSON() string
Returns the unmodified JSON received from the API
func (*AlbumListResponseData) UnmarshalJSON ¶
func (r *AlbumListResponseData) UnmarshalJSON(data []byte) error
type AlbumListResponseObject ¶
type AlbumListResponseObject string
Object type indicator for list responses
const (
AlbumListResponseObjectList AlbumListResponseObject = "list"
)
type AlbumService ¶
type AlbumService struct {
Options []option.RequestOption
}
Photo albums
AlbumService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAlbumService method instead.
func NewAlbumService ¶
func NewAlbumService(opts ...option.RequestOption) (r AlbumService)
NewAlbumService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*AlbumService) List ¶
func (r *AlbumService) List(ctx context.Context, opts ...option.RequestOption) (res *AlbumListResponse, err error)
List all photo albums (both smart albums and user-created albums).
type ChangeListParams ¶
type ChangeListParams struct {
// Starting index (0-based) for pagination
Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
// Number of changes to return (1-500)
Count param.Opt[int64] `query:"count,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (ChangeListParams) URLQuery ¶
func (r ChangeListParams) URLQuery() (v url.Values, err error)
URLQuery serializes ChangeListParams's query parameters as `url.Values`.
type ChangeListResponse ¶
type ChangeListResponse struct {
// Unique change identifier
ID string `json:"id" api:"required"`
Media ChangeListResponseMedia `json:"media" api:"required"`
// ID of affected media
MediaID string `json:"media_id" api:"required"`
// Object type indicator
//
// Any of "change".
Object ChangeListResponseObject `json:"object" api:"required"`
// When the change occurred (Unix seconds)
Timestamp int64 `json:"timestamp" api:"required"`
// Type of change
//
// Any of "added", "modified", "deleted".
Type ChangeListResponseType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
Media respjson.Field
MediaID respjson.Field
Object respjson.Field
Timestamp respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChangeListResponse) RawJSON ¶
func (r ChangeListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChangeListResponse) UnmarshalJSON ¶
func (r *ChangeListResponse) UnmarshalJSON(data []byte) error
type ChangeListResponseMedia ¶
type ChangeListResponseMedia struct {
// Unique media identifier (PHAsset localIdentifier)
ID string `json:"id" api:"required"`
// Creation timestamp (Unix seconds)
CreatedAt int64 `json:"created_at" api:"required"`
// Original filename
Filename string `json:"filename" api:"required"`
// Whether the media is a Live Photo (image with paired video)
IsLivePhoto bool `json:"is_live_photo" api:"required"`
// Whether the media is a screenshot (detected via iOS PHAssetMediaSubtype)
IsScreenshot bool `json:"is_screenshot" api:"required"`
// GPS coordinates if available
Location ChangeListResponseMediaLocation `json:"location" api:"required"`
// MIME type (e.g., image/jpeg, video/mp4)
MimeType string `json:"mime_type" api:"required"`
// Modification timestamp (Unix seconds)
ModifiedAt int64 `json:"modified_at" api:"required"`
// Object type indicator
//
// Any of "media".
Object string `json:"object" api:"required"`
// Duration in seconds (videos only)
Duration float64 `json:"duration"`
// Height in pixels
Height int64 `json:"height"`
// Width in pixels
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Filename respjson.Field
IsLivePhoto respjson.Field
IsScreenshot respjson.Field
Location respjson.Field
MimeType respjson.Field
ModifiedAt respjson.Field
Object respjson.Field
Duration respjson.Field
Height respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ChangeListResponseMedia) RawJSON ¶
func (r ChangeListResponseMedia) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChangeListResponseMedia) UnmarshalJSON ¶
func (r *ChangeListResponseMedia) UnmarshalJSON(data []byte) error
type ChangeListResponseMediaLocation ¶
type ChangeListResponseMediaLocation struct {
// Latitude
Lat float64 `json:"lat" api:"required"`
// Longitude
Lng float64 `json:"lng" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Lat respjson.Field
Lng respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
GPS coordinates if available
func (ChangeListResponseMediaLocation) RawJSON ¶
func (r ChangeListResponseMediaLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*ChangeListResponseMediaLocation) UnmarshalJSON ¶
func (r *ChangeListResponseMediaLocation) UnmarshalJSON(data []byte) error
type ChangeListResponseObject ¶
type ChangeListResponseObject string
Object type indicator
const (
ChangeListResponseObjectChange ChangeListResponseObject = "change"
)
type ChangeListResponseType ¶
type ChangeListResponseType string
Type of change
const ( ChangeListResponseTypeAdded ChangeListResponseType = "added" ChangeListResponseTypeModified ChangeListResponseType = "modified" ChangeListResponseTypeDeleted ChangeListResponseType = "deleted" )
type ChangeService ¶
type ChangeService struct {
Options []option.RequestOption
}
Change tracking for sync
ChangeService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewChangeService method instead.
func NewChangeService ¶
func NewChangeService(opts ...option.RequestOption) (r ChangeService)
NewChangeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ChangeService) List ¶
func (r *ChangeService) List(ctx context.Context, query ChangeListParams, opts ...option.RequestOption) (res *pagination.OffsetPage[ChangeListResponse], err error)
Get recently modified media items. Useful for incremental sync.
**Pagination**: Uses cursor-based pagination:
- Pass `next_cursor` from the response as `cursor` to get the next page - `has_more` indicates if more changes exist
func (*ChangeService) ListAutoPaging ¶
func (r *ChangeService) ListAutoPaging(ctx context.Context, query ChangeListParams, opts ...option.RequestOption) *pagination.OffsetPageAutoPager[ChangeListResponse]
Get recently modified media items. Useful for incremental sync.
**Pagination**: Uses cursor-based pagination:
- Pass `next_cursor` from the response as `cursor` to get the next page - `has_more` indicates if more changes exist
type Client ¶
type Client struct {
Options []option.RequestOption
// Server health and status
Health HealthService
// Session authentication
Handshake HandshakeService
// Media listing and download
Media MediaService
// Photo albums
Albums AlbumService
// Change tracking for sync
Changes ChangeService
// Virtual filesystem for FUSE mounting
Fs FService
// Change tracking for sync
Sync SyncService
// People/face thumbnails
People PersonService
// Connection management
Connect ConnectService
// Connection management
Usb UsbService
}
Client creates a struct with services and top level methods that help with interacting with the syncawesome API. You should not instantiate this client directly, and instead use the NewClient method instead.
func NewClient ¶
func NewClient(opts ...option.RequestOption) (r Client)
NewClient generates a new client with the default option read from the environment (SYNCAWESOME_API_KEY, SYNCAWESOME_CLIENT_IP, SYNCAWESOME_PORT, SYNCAWESOME_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.
func (*Client) Delete ¶
func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Execute ¶
func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error
Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.
If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.
The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.
If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.
Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.
The response body will be deserialized into the res variable, depending on its type:
- A pointer to a *http.Response is populated by the raw response.
- A pointer to a byte array will be populated with the contents of the request body.
- A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
- A nil value will not read the response body.
For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.
func (*Client) Get ¶
func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
func (*Client) Patch ¶
func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error
Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.
type ConnectService ¶
type ConnectService struct {
Options []option.RequestOption
}
Connection management
ConnectService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewConnectService method instead.
func NewConnectService ¶
func NewConnectService(opts ...option.RequestOption) (r ConnectService)
NewConnectService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*ConnectService) Try ¶
func (r *ConnectService) Try(ctx context.Context, body ConnectTryParams, opts ...option.RequestOption) (res *ConnectTryResponse, err error)
Request the client to attempt connecting to a server.
This endpoint is called by the server when it starts up and wants to trigger immediate connection attempts from clients it has previously seen.
The client will check if it's already connected to the specified server. If not, it will initiate a connection attempt.
type ConnectTryParams ¶
type ConnectTryParams struct {
// contains filtered or unexported fields
}
func (ConnectTryParams) MarshalJSON ¶
func (r ConnectTryParams) MarshalJSON() (data []byte, err error)
func (*ConnectTryParams) UnmarshalJSON ¶
func (r *ConnectTryParams) UnmarshalJSON(data []byte) error
type ConnectTryResponse ¶
type ConnectTryResponse struct {
// Object type indicator
//
// Any of "connect_attempt".
Object ConnectTryResponseObject `json:"object" api:"required"`
// Status of the connection attempt
//
// Any of "connecting", "already_connected", "failed".
Status ConnectTryResponseStatus `json:"status" api:"required"`
// Additional status message
Message string `json:"message"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Object respjson.Field
Status respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (ConnectTryResponse) RawJSON ¶
func (r ConnectTryResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*ConnectTryResponse) UnmarshalJSON ¶
func (r *ConnectTryResponse) UnmarshalJSON(data []byte) error
type ConnectTryResponseObject ¶
type ConnectTryResponseObject string
Object type indicator
const (
ConnectTryResponseObjectConnectAttempt ConnectTryResponseObject = "connect_attempt"
)
type ConnectTryResponseStatus ¶
type ConnectTryResponseStatus string
Status of the connection attempt
const ( ConnectTryResponseStatusConnecting ConnectTryResponseStatus = "connecting" ConnectTryResponseStatusAlreadyConnected ConnectTryResponseStatus = "already_connected" ConnectTryResponseStatusFailed ConnectTryResponseStatus = "failed" )
type FListParams ¶
type FListParams struct {
// Starting index (0-based) for pagination
Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
// Number of entries to return (1-500)
Count param.Opt[int64] `query:"count,omitzero" json:"-"`
// Virtual path to list
Path param.Opt[string] `query:"path,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (FListParams) URLQuery ¶
func (r FListParams) URLQuery() (v url.Values, err error)
URLQuery serializes FListParams's query parameters as `url.Values`.
type FListResponse ¶
type FListResponse struct {
// Creation timestamp (Unix seconds)
CreatedAt int64 `json:"created_at" api:"required"`
// Media ID for file entries
MediaID string `json:"media_id" api:"required"`
// MIME type for files
MimeType string `json:"mime_type" api:"required"`
// Modification timestamp (Unix seconds)
ModifiedAt int64 `json:"modified_at" api:"required"`
// Entry name
Name string `json:"name" api:"required"`
// Object type indicator
//
// Any of "fs_entry".
Object FListResponseObject `json:"object" api:"required"`
// File size in bytes
Size int64 `json:"size" api:"required"`
// Entry type
//
// Any of "file", "directory".
Type FListResponseType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreatedAt respjson.Field
MediaID respjson.Field
MimeType respjson.Field
ModifiedAt respjson.Field
Name respjson.Field
Object respjson.Field
Size respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (FListResponse) RawJSON ¶
func (r FListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*FListResponse) UnmarshalJSON ¶
func (r *FListResponse) UnmarshalJSON(data []byte) error
type FListResponseObject ¶
type FListResponseObject string
Object type indicator
const (
FListResponseObjectFsEntry FListResponseObject = "fs_entry"
)
type FListResponseType ¶
type FListResponseType string
Entry type
const ( FListResponseTypeFile FListResponseType = "file" FListResponseTypeDirectory FListResponseType = "directory" )
type FReadParams ¶
type FReadParams struct {
// Virtual path to read
Path string `query:"path" api:"required" json:"-"`
// Byte offset to start reading
Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
// Number of bytes to read
Length param.Opt[int64] `query:"length,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (FReadParams) URLQuery ¶
func (r FReadParams) URLQuery() (v url.Values, err error)
URLQuery serializes FReadParams's query parameters as `url.Values`.
type FService ¶
type FService struct {
Options []option.RequestOption
}
Virtual filesystem for FUSE mounting
FService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewFService method instead.
func NewFService ¶
func NewFService(opts ...option.RequestOption) (r FService)
NewFService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*FService) List ¶
func (r *FService) List(ctx context.Context, query FListParams, opts ...option.RequestOption) (res *pagination.OffsetPage[FListResponse], err error)
List entries in a virtual directory.
**Virtual filesystem structure**:
``` / ├── All Photos/ ├── All Videos/ ├── By Date/{year}/{month}/{day}/ ├── Albums/{album_name}/ └── By Type/Photos|Videos/ ```
func (*FService) ListAutoPaging ¶
func (r *FService) ListAutoPaging(ctx context.Context, query FListParams, opts ...option.RequestOption) *pagination.OffsetPageAutoPager[FListResponse]
List entries in a virtual directory.
**Virtual filesystem structure**:
``` / ├── All Photos/ ├── All Videos/ ├── By Date/{year}/{month}/{day}/ ├── Albums/{album_name}/ └── By Type/Photos|Videos/ ```
func (*FService) Read ¶
func (r *FService) Read(ctx context.Context, query FReadParams, opts ...option.RequestOption) (err error)
Read a byte range from a virtual file. Useful for FUSE read operations.
func (*FService) Stat ¶
func (r *FService) Stat(ctx context.Context, query FStatParams, opts ...option.RequestOption) (res *FStatResponse, err error)
Get metadata about a virtual file or directory. Useful for FUSE getattr operations.
type FStatParams ¶
type FStatParams struct {
// Virtual path to stat
Path string `query:"path" api:"required" json:"-"`
// contains filtered or unexported fields
}
func (FStatParams) URLQuery ¶
func (r FStatParams) URLQuery() (v url.Values, err error)
URLQuery serializes FStatParams's query parameters as `url.Values`.
type FStatResponse ¶
type FStatResponse struct {
// Creation timestamp (Unix seconds)
CreatedAt int64 `json:"created_at" api:"required"`
// Whether the path exists
Exists bool `json:"exists" api:"required"`
// Media ID for file entries
MediaID string `json:"media_id" api:"required"`
// MIME type for files
MimeType string `json:"mime_type" api:"required"`
// Modification timestamp (Unix seconds)
ModifiedAt int64 `json:"modified_at" api:"required"`
// Object type indicator
//
// Any of "fs_stat".
Object FStatResponseObject `json:"object" api:"required"`
// The path that was stat'd
Path string `json:"path" api:"required"`
// Unix-style permission string
Permissions string `json:"permissions" api:"required"`
// File size in bytes
Size int64 `json:"size" api:"required"`
// Entry type if exists
//
// Any of "file", "directory".
Type FStatResponseType `json:"type" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
CreatedAt respjson.Field
Exists respjson.Field
MediaID respjson.Field
MimeType respjson.Field
ModifiedAt respjson.Field
Object respjson.Field
Path respjson.Field
Permissions respjson.Field
Size respjson.Field
Type respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (FStatResponse) RawJSON ¶
func (r FStatResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*FStatResponse) UnmarshalJSON ¶
func (r *FStatResponse) UnmarshalJSON(data []byte) error
type FStatResponseObject ¶
type FStatResponseObject string
Object type indicator
const (
FStatResponseObjectFsStat FStatResponseObject = "fs_stat"
)
type FStatResponseType ¶
type FStatResponseType string
Entry type if exists
const ( FStatResponseTypeFile FStatResponseType = "file" FStatResponseTypeDirectory FStatResponseType = "directory" )
type HandshakeCompleteParams ¶
type HandshakeCompleteParams struct {
// Challenge token from website API
Challenge string `json:"challenge" api:"required"`
// Requesting device ID
DeviceID string `json:"device_id" api:"required"`
// Requesting device name
DeviceName string `json:"device_name" api:"required"`
// contains filtered or unexported fields
}
func (HandshakeCompleteParams) MarshalJSON ¶
func (r HandshakeCompleteParams) MarshalJSON() (data []byte, err error)
func (*HandshakeCompleteParams) UnmarshalJSON ¶
func (r *HandshakeCompleteParams) UnmarshalJSON(data []byte) error
type HandshakeCompleteResponse ¶
type HandshakeCompleteResponse struct {
// Whether this device was previously known
DeviceKnown bool `json:"device_known" api:"required"`
// Object type indicator
//
// Any of "session".
Object HandshakeCompleteResponseObject `json:"object" api:"required"`
// Server protocol version
ProtocolVersion int64 `json:"protocol_version" api:"required"`
// Session key for subsequent requests
SessionKey string `json:"session_key" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
DeviceKnown respjson.Field
Object respjson.Field
ProtocolVersion respjson.Field
SessionKey respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (HandshakeCompleteResponse) RawJSON ¶
func (r HandshakeCompleteResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*HandshakeCompleteResponse) UnmarshalJSON ¶
func (r *HandshakeCompleteResponse) UnmarshalJSON(data []byte) error
type HandshakeCompleteResponseObject ¶
type HandshakeCompleteResponseObject string
Object type indicator
const (
HandshakeCompleteResponseObjectSession HandshakeCompleteResponseObject = "session"
)
type HandshakeService ¶
type HandshakeService struct {
Options []option.RequestOption
}
Session authentication
HandshakeService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewHandshakeService method instead.
func NewHandshakeService ¶
func NewHandshakeService(opts ...option.RequestOption) (r HandshakeService)
NewHandshakeService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*HandshakeService) Complete ¶
func (r *HandshakeService) Complete(ctx context.Context, body HandshakeCompleteParams, opts ...option.RequestOption) (res *HandshakeCompleteResponse, err error)
Complete the authentication handshake to obtain a session key.
type HealthCheckResponse ¶
type HealthCheckResponse struct {
// Unique device identifier
DeviceID string `json:"device_id" api:"required"`
// Human-readable device name
DeviceName string `json:"device_name" api:"required"`
// Any of "client".
DeviceType HealthCheckResponseDeviceType `json:"device_type" api:"required"`
MediaCount HealthCheckResponseMediaCount `json:"media_count" api:"required"`
// Object type indicator
//
// Any of "health".
Object HealthCheckResponseObject `json:"object" api:"required"`
// Client protocol version
ProtocolVersion int64 `json:"protocol_version" api:"required"`
// Any of "ok".
Status HealthCheckResponseStatus `json:"status" api:"required"`
// Unix timestamp in seconds
Timestamp int64 `json:"timestamp" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
DeviceID respjson.Field
DeviceName respjson.Field
DeviceType respjson.Field
MediaCount respjson.Field
Object respjson.Field
ProtocolVersion respjson.Field
Status respjson.Field
Timestamp respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (HealthCheckResponse) RawJSON ¶
func (r HealthCheckResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*HealthCheckResponse) UnmarshalJSON ¶
func (r *HealthCheckResponse) UnmarshalJSON(data []byte) error
type HealthCheckResponseDeviceType ¶
type HealthCheckResponseDeviceType string
const (
HealthCheckResponseDeviceTypeClient HealthCheckResponseDeviceType = "client"
)
type HealthCheckResponseMediaCount ¶
type HealthCheckResponseMediaCount struct {
Photos int64 `json:"photos" api:"required"`
Videos int64 `json:"videos" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Photos respjson.Field
Videos respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (HealthCheckResponseMediaCount) RawJSON ¶
func (r HealthCheckResponseMediaCount) RawJSON() string
Returns the unmodified JSON received from the API
func (*HealthCheckResponseMediaCount) UnmarshalJSON ¶
func (r *HealthCheckResponseMediaCount) UnmarshalJSON(data []byte) error
type HealthCheckResponseObject ¶
type HealthCheckResponseObject string
Object type indicator
const (
HealthCheckResponseObjectHealth HealthCheckResponseObject = "health"
)
type HealthCheckResponseStatus ¶
type HealthCheckResponseStatus string
const (
HealthCheckResponseStatusOk HealthCheckResponseStatus = "ok"
)
type HealthService ¶
type HealthService struct {
Options []option.RequestOption
}
Server health and status
HealthService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewHealthService method instead.
func NewHealthService ¶
func NewHealthService(opts ...option.RequestOption) (r HealthService)
NewHealthService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*HealthService) Check ¶
func (r *HealthService) Check(ctx context.Context, opts ...option.RequestOption) (res *HealthCheckResponse, err error)
Returns device info and media counts. Does not require authentication.
type MediaDownloadContentParams ¶
type MediaDownloadContentParams struct {
// HTTP Range header (e.g., bytes=0-1023)
Range param.Opt[string] `header:"Range,omitzero" json:"-"`
// Output format (jpeg converts HEIC to JPEG)
//
// Any of "original", "jpeg".
Format MediaDownloadContentParamsFormat `query:"format,omitzero" json:"-"`
// Requested size: thumbnail (200x200), medium (1024x1024), or full
//
// Any of "thumbnail", "medium", "full".
Size MediaDownloadContentParamsSize `query:"size,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MediaDownloadContentParams) URLQuery ¶
func (r MediaDownloadContentParams) URLQuery() (v url.Values, err error)
URLQuery serializes MediaDownloadContentParams's query parameters as `url.Values`.
type MediaDownloadContentParamsFormat ¶
type MediaDownloadContentParamsFormat string
Output format (jpeg converts HEIC to JPEG)
const ( MediaDownloadContentParamsFormatOriginal MediaDownloadContentParamsFormat = "original" MediaDownloadContentParamsFormatJpeg MediaDownloadContentParamsFormat = "jpeg" )
type MediaDownloadContentParamsSize ¶
type MediaDownloadContentParamsSize string
Requested size: thumbnail (200x200), medium (1024x1024), or full
const ( MediaDownloadContentParamsSizeThumbnail MediaDownloadContentParamsSize = "thumbnail" MediaDownloadContentParamsSizeMedium MediaDownloadContentParamsSize = "medium" MediaDownloadContentParamsSizeFull MediaDownloadContentParamsSize = "full" )
type MediaGetResponse ¶
type MediaGetResponse struct {
// Unique media identifier (PHAsset localIdentifier)
ID string `json:"id" api:"required"`
// IDs of albums containing this media
AlbumIDs []string `json:"album_ids" api:"required"`
// Creation timestamp (Unix seconds)
CreatedAt int64 `json:"created_at" api:"required"`
// Original filename
Filename string `json:"filename" api:"required"`
// Whether the media is marked as favorite
IsFavorite bool `json:"is_favorite" api:"required"`
// Whether the media is a Live Photo (image with paired video)
IsLivePhoto bool `json:"is_live_photo" api:"required"`
// Whether the media is a screenshot (detected via iOS PHAssetMediaSubtype)
IsScreenshot bool `json:"is_screenshot" api:"required"`
// Local URI for the media (ph://...)
LocalUri string `json:"local_uri" api:"required"`
// GPS coordinates if available
Location MediaGetResponseLocation `json:"location" api:"required"`
// MIME type (e.g., image/jpeg, video/mp4)
MimeType string `json:"mime_type" api:"required"`
// Modification timestamp (Unix seconds)
ModifiedAt int64 `json:"modified_at" api:"required"`
// Object type indicator
//
// Any of "media".
Object MediaGetResponseObject `json:"object" api:"required"`
// Duration in seconds (videos only)
Duration float64 `json:"duration"`
// Height in pixels
Height int64 `json:"height"`
// Width in pixels
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
AlbumIDs respjson.Field
CreatedAt respjson.Field
Filename respjson.Field
IsFavorite respjson.Field
IsLivePhoto respjson.Field
IsScreenshot respjson.Field
LocalUri respjson.Field
Location respjson.Field
MimeType respjson.Field
ModifiedAt respjson.Field
Object respjson.Field
Duration respjson.Field
Height respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MediaGetResponse) RawJSON ¶
func (r MediaGetResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MediaGetResponse) UnmarshalJSON ¶
func (r *MediaGetResponse) UnmarshalJSON(data []byte) error
type MediaGetResponseLocation ¶
type MediaGetResponseLocation struct {
// Latitude
Lat float64 `json:"lat" api:"required"`
// Longitude
Lng float64 `json:"lng" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Lat respjson.Field
Lng respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
GPS coordinates if available
func (MediaGetResponseLocation) RawJSON ¶
func (r MediaGetResponseLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*MediaGetResponseLocation) UnmarshalJSON ¶
func (r *MediaGetResponseLocation) UnmarshalJSON(data []byte) error
type MediaGetResponseObject ¶
type MediaGetResponseObject string
Object type indicator
const (
MediaGetResponseObjectMedia MediaGetResponseObject = "media"
)
type MediaListMonthsResponse ¶
type MediaListMonthsResponse struct {
// Array of months (1-12) that have media in the specified year, sorted ascending
Data []int64 `json:"data" api:"required"`
// Object type indicator
//
// Any of "months_list".
Object MediaListMonthsResponseObject `json:"object" api:"required"`
// The requested year
Year int64 `json:"year" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Object respjson.Field
Year respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MediaListMonthsResponse) RawJSON ¶
func (r MediaListMonthsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MediaListMonthsResponse) UnmarshalJSON ¶
func (r *MediaListMonthsResponse) UnmarshalJSON(data []byte) error
type MediaListMonthsResponseObject ¶
type MediaListMonthsResponseObject string
Object type indicator
const (
MediaListMonthsResponseObjectMonthsList MediaListMonthsResponseObject = "months_list"
)
type MediaListParams ¶
type MediaListParams struct {
// Starting index (0-based) for pagination
Offset param.Opt[int64] `query:"offset,omitzero" json:"-"`
// Filter by album ID (only return media in this album)
AlbumID param.Opt[string] `query:"album_id,omitzero" json:"-"`
// Number of items to return (1-500)
Count param.Opt[int64] `query:"count,omitzero" json:"-"`
// Only items created after this ISO8601 timestamp
CreatedAfter param.Opt[time.Time] `query:"created_after,omitzero" format:"date-time" json:"-"`
// Only items created before this ISO8601 timestamp
CreatedBefore param.Opt[time.Time] `query:"created_before,omitzero" format:"date-time" json:"-"`
// Filter by month (1-12). Requires year to be set.
Month param.Opt[int64] `query:"month,omitzero" json:"-"`
// Filter by year (e.g., 2024)
Year param.Opt[int64] `query:"year,omitzero" json:"-"`
// Sort direction
//
// Any of "asc", "desc".
Order MediaListParamsOrder `query:"order,omitzero" json:"-"`
// Field to sort by
//
// Any of "created_at", "modified_at".
OrderBy MediaListParamsOrderBy `query:"order_by,omitzero" json:"-"`
// Filter by media type
//
// Any of "photo", "video", "all".
Type MediaListParamsType `query:"type,omitzero" json:"-"`
// contains filtered or unexported fields
}
func (MediaListParams) URLQuery ¶
func (r MediaListParams) URLQuery() (v url.Values, err error)
URLQuery serializes MediaListParams's query parameters as `url.Values`.
type MediaListParamsOrder ¶
type MediaListParamsOrder string
Sort direction
const ( MediaListParamsOrderAsc MediaListParamsOrder = "asc" MediaListParamsOrderDesc MediaListParamsOrder = "desc" )
type MediaListParamsOrderBy ¶
type MediaListParamsOrderBy string
Field to sort by
const ( MediaListParamsOrderByCreatedAt MediaListParamsOrderBy = "created_at" MediaListParamsOrderByModifiedAt MediaListParamsOrderBy = "modified_at" )
type MediaListParamsType ¶
type MediaListParamsType string
Filter by media type
const ( MediaListParamsTypePhoto MediaListParamsType = "photo" MediaListParamsTypeVideo MediaListParamsType = "video" MediaListParamsTypeAll MediaListParamsType = "all" )
type MediaListResponse ¶
type MediaListResponse struct {
// Unique media identifier (PHAsset localIdentifier)
ID string `json:"id" api:"required"`
// Creation timestamp (Unix seconds)
CreatedAt int64 `json:"created_at" api:"required"`
// Original filename
Filename string `json:"filename" api:"required"`
// Whether the media is a Live Photo (image with paired video)
IsLivePhoto bool `json:"is_live_photo" api:"required"`
// Whether the media is a screenshot (detected via iOS PHAssetMediaSubtype)
IsScreenshot bool `json:"is_screenshot" api:"required"`
// GPS coordinates if available
Location MediaListResponseLocation `json:"location" api:"required"`
// MIME type (e.g., image/jpeg, video/mp4)
MimeType string `json:"mime_type" api:"required"`
// Modification timestamp (Unix seconds)
ModifiedAt int64 `json:"modified_at" api:"required"`
// Object type indicator
//
// Any of "media".
Object MediaListResponseObject `json:"object" api:"required"`
// Duration in seconds (videos only)
Duration float64 `json:"duration"`
// Height in pixels
Height int64 `json:"height"`
// Width in pixels
Width int64 `json:"width"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
ID respjson.Field
CreatedAt respjson.Field
Filename respjson.Field
IsLivePhoto respjson.Field
IsScreenshot respjson.Field
Location respjson.Field
MimeType respjson.Field
ModifiedAt respjson.Field
Object respjson.Field
Duration respjson.Field
Height respjson.Field
Width respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MediaListResponse) RawJSON ¶
func (r MediaListResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MediaListResponse) UnmarshalJSON ¶
func (r *MediaListResponse) UnmarshalJSON(data []byte) error
type MediaListResponseLocation ¶
type MediaListResponseLocation struct {
// Latitude
Lat float64 `json:"lat" api:"required"`
// Longitude
Lng float64 `json:"lng" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Lat respjson.Field
Lng respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
GPS coordinates if available
func (MediaListResponseLocation) RawJSON ¶
func (r MediaListResponseLocation) RawJSON() string
Returns the unmodified JSON received from the API
func (*MediaListResponseLocation) UnmarshalJSON ¶
func (r *MediaListResponseLocation) UnmarshalJSON(data []byte) error
type MediaListResponseObject ¶
type MediaListResponseObject string
Object type indicator
const (
MediaListResponseObjectMedia MediaListResponseObject = "media"
)
type MediaListYearsResponse ¶
type MediaListYearsResponse struct {
// Array of years that have media, sorted descending
Data []int64 `json:"data" api:"required"`
// Object type indicator
//
// Any of "years_list".
Object MediaListYearsResponseObject `json:"object" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Data respjson.Field
Object respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (MediaListYearsResponse) RawJSON ¶
func (r MediaListYearsResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*MediaListYearsResponse) UnmarshalJSON ¶
func (r *MediaListYearsResponse) UnmarshalJSON(data []byte) error
type MediaListYearsResponseObject ¶
type MediaListYearsResponseObject string
Object type indicator
const (
MediaListYearsResponseObjectYearsList MediaListYearsResponseObject = "years_list"
)
type MediaService ¶
type MediaService struct {
Options []option.RequestOption
}
Media listing and download
MediaService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewMediaService method instead.
func NewMediaService ¶
func NewMediaService(opts ...option.RequestOption) (r MediaService)
NewMediaService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*MediaService) DownloadContent ¶
func (r *MediaService) DownloadContent(ctx context.Context, id string, params MediaDownloadContentParams, opts ...option.RequestOption) (res *http.Response, err error)
Download the actual media file.
**Size options**:
- `thumbnail`: 200x200, cropped square - `medium`: 1024x1024 max, maintains aspect ratio - `full`: Original resolution
**Format conversion**: Use `format=jpeg` to convert HEIC to JPEG.
**Range requests**: Supports HTTP Range header for partial content (206 responses).
func (*MediaService) Fetch ¶
func (r *MediaService) Fetch(ctx context.Context, id string, opts ...option.RequestOption) (res *http.Response, err error)
Fetch raw binary data for a specific media item.
This endpoint is called by the server over USB to pull media files from the client device. Returns the actual file bytes (JPEG, HEVC, MP4, etc.) as application/octet-stream.
The server uses this endpoint when the client calls POST /media/pull on the server, enabling high-speed USB transfers without the client needing to push data to a localhost URL it cannot reach.
func (*MediaService) Get ¶
func (r *MediaService) Get(ctx context.Context, id string, opts ...option.RequestOption) (res *MediaGetResponse, err error)
Get detailed metadata for a single media item.
func (*MediaService) List ¶
func (r *MediaService) List(ctx context.Context, query MediaListParams, opts ...option.RequestOption) (res *pagination.OffsetPage[MediaListResponse], err error)
List media items with cursor-based pagination.
**Pagination**: Uses cursor_id style pagination:
- Use `starting_after` with the `last_id` from the previous response to get the next page
- Use `ending_before` with the `first_id` to get the previous page
- The `has_more` field indicates if more items exist
func (*MediaService) ListAutoPaging ¶
func (r *MediaService) ListAutoPaging(ctx context.Context, query MediaListParams, opts ...option.RequestOption) *pagination.OffsetPageAutoPager[MediaListResponse]
List media items with cursor-based pagination.
**Pagination**: Uses cursor_id style pagination:
- Use `starting_after` with the `last_id` from the previous response to get the next page
- Use `ending_before` with the `first_id` to get the previous page
- The `has_more` field indicates if more items exist
func (*MediaService) ListMonths ¶
func (r *MediaService) ListMonths(ctx context.Context, year int64, opts ...option.RequestOption) (res *MediaListMonthsResponse, err error)
Returns a list of months (1-12) that have media items in the specified year, sorted in ascending order.
func (*MediaService) ListYears ¶
func (r *MediaService) ListYears(ctx context.Context, opts ...option.RequestOption) (res *MediaListYearsResponse, err error)
Returns a list of years that have media items, sorted in descending order (most recent first).
type PersonService ¶
type PersonService struct {
Options []option.RequestOption
}
People/face thumbnails
PersonService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewPersonService method instead.
func NewPersonService ¶
func NewPersonService(opts ...option.RequestOption) (r PersonService)
NewPersonService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*PersonService) GetThumbnail ¶
func (r *PersonService) GetThumbnail(ctx context.Context, id string, opts ...option.RequestOption) (res *http.Response, err error)
Get the thumbnail image for a person.
Returns binary JPEG image data suitable for use as an `<Image>` source URI. Returns 404 if the person does not exist or has no thumbnail.
type SyncRequestParams ¶
type SyncRequestParams struct {
// ID of the media item to sync
MediaID string `json:"media_id" api:"required"`
// contains filtered or unexported fields
}
func (SyncRequestParams) MarshalJSON ¶
func (r SyncRequestParams) MarshalJSON() (data []byte, err error)
func (*SyncRequestParams) UnmarshalJSON ¶
func (r *SyncRequestParams) UnmarshalJSON(data []byte) error
type SyncRequestResponse ¶
type SyncRequestResponse struct {
// ID of the media item being synced
MediaID string `json:"media_id" api:"required"`
// Object type indicator
//
// Any of "sync_request".
Object SyncRequestResponseObject `json:"object" api:"required"`
// Current status of the sync request
//
// Any of "queued", "in_progress", "completed", "failed".
Status SyncRequestResponseStatus `json:"status" api:"required"`
// Additional status message
Message string `json:"message"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
MediaID respjson.Field
Object respjson.Field
Status respjson.Field
Message respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (SyncRequestResponse) RawJSON ¶
func (r SyncRequestResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*SyncRequestResponse) UnmarshalJSON ¶
func (r *SyncRequestResponse) UnmarshalJSON(data []byte) error
type SyncRequestResponseObject ¶
type SyncRequestResponseObject string
Object type indicator
const (
SyncRequestResponseObjectSyncRequest SyncRequestResponseObject = "sync_request"
)
type SyncRequestResponseStatus ¶
type SyncRequestResponseStatus string
Current status of the sync request
const ( SyncRequestResponseStatusQueued SyncRequestResponseStatus = "queued" SyncRequestResponseStatusInProgress SyncRequestResponseStatus = "in_progress" SyncRequestResponseStatusCompleted SyncRequestResponseStatus = "completed" SyncRequestResponseStatusFailed SyncRequestResponseStatus = "failed" )
type SyncService ¶
type SyncService struct {
Options []option.RequestOption
}
Change tracking for sync
SyncService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewSyncService method instead.
func NewSyncService ¶
func NewSyncService(opts ...option.RequestOption) (r SyncService)
NewSyncService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*SyncService) Request ¶
func (r *SyncService) Request(ctx context.Context, body SyncRequestParams, opts ...option.RequestOption) (res *SyncRequestResponse, err error)
Request the client to sync a specific media item to the server.
The client will add the specified media item to its upload queue with high priority, uploading it to the server it's already connected to. This is used when a user clicks on an unsynced thumbnail in the server's gallery view.
type UsbConfigureParams ¶
type UsbConfigureParams struct {
// Whether the client should prefer USB over WiFi for uploads
PreferUsb bool `json:"prefer_usb" api:"required"`
// The USB tunnel URL that the client should use to connect to the server (e.g.,
// http://localhost:51843)
ServerURL string `json:"server_url" api:"required" format:"uri"`
// contains filtered or unexported fields
}
func (UsbConfigureParams) MarshalJSON ¶
func (r UsbConfigureParams) MarshalJSON() (data []byte, err error)
func (*UsbConfigureParams) UnmarshalJSON ¶
func (r *UsbConfigureParams) UnmarshalJSON(data []byte) error
type UsbConfigureResponse ¶
type UsbConfigureResponse struct {
// Any of "usb_configure".
Object UsbConfigureResponseObject `json:"object" api:"required"`
// Whether USB is preferred
PreferUsb bool `json:"prefer_usb" api:"required"`
// The configured server URL
ServerURL string `json:"server_url" api:"required"`
// Whether the configuration was applied
Success bool `json:"success" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
Object respjson.Field
PreferUsb respjson.Field
ServerURL respjson.Field
Success respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (UsbConfigureResponse) RawJSON ¶
func (r UsbConfigureResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*UsbConfigureResponse) UnmarshalJSON ¶
func (r *UsbConfigureResponse) UnmarshalJSON(data []byte) error
type UsbConfigureResponseObject ¶
type UsbConfigureResponseObject string
const (
UsbConfigureResponseObjectUsbConfigure UsbConfigureResponseObject = "usb_configure"
)
type UsbService ¶
type UsbService struct {
Options []option.RequestOption
}
Connection management
UsbService contains methods and other services that help with interacting with the syncawesome API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewUsbService method instead.
func NewUsbService ¶
func NewUsbService(opts ...option.RequestOption) (r UsbService)
NewUsbService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*UsbService) Configure ¶
func (r *UsbService) Configure(ctx context.Context, body UsbConfigureParams, opts ...option.RequestOption) (res *UsbConfigureResponse, err error)
Notify the client about USB connection availability and provide the USB tunnel URL.
When the server establishes a USB tunnel to the client device, it calls this endpoint to inform the client that USB is available and provide the tunnel URL (typically http://localhost:PORT).
The client will update its connection preferences to use the USB tunnel for uploads instead of WiFi, significantly improving upload speeds (USB can reach 30MB/s+ vs WiFi's variable speeds).
func (*UsbService) Status ¶
func (r *UsbService) Status(ctx context.Context, opts ...option.RequestOption) (res *UsbStatusResponse, err error)
Check whether the device is currently connected via USB. Does not require authentication.
type UsbStatusResponse ¶
type UsbStatusResponse struct {
// Whether device is connected via USB
IsConnectedViaUsb bool `json:"is_connected_via_usb" api:"required"`
// Any of "usb_status".
Object UsbStatusResponseObject `json:"object" api:"required"`
// JSON contains metadata for fields, check presence with [respjson.Field.Valid].
JSON struct {
IsConnectedViaUsb respjson.Field
Object respjson.Field
ExtraFields map[string]respjson.Field
// contains filtered or unexported fields
} `json:"-"`
}
func (UsbStatusResponse) RawJSON ¶
func (r UsbStatusResponse) RawJSON() string
Returns the unmodified JSON received from the API
func (*UsbStatusResponse) UnmarshalJSON ¶
func (r *UsbStatusResponse) UnmarshalJSON(data []byte) error
type UsbStatusResponseObject ¶
type UsbStatusResponseObject string
const (
UsbStatusResponseObjectUsbStatus UsbStatusResponseObject = "usb_status"
)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
|
Package json implements encoding and decoding of JSON as defined in RFC 7159. |
|
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package.
|
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.22, and used by the Go 1.24 encoding/json package. |
|
packages
|
|
|
shared
|
|