Documentation ¶
Index ¶
- type SyncthingClient
- func (s *SyncthingClient) GetDiskEvents(since int, timeout int, limit int) ([]events.Event, error)
- func (s *SyncthingClient) GetEvents(eventTypes []events.EventType, since int, timeout int, limit int) ([]events.Event, error)
- func (s *SyncthingClient) GetSystemStatus() (*domain.SystemStatus, error)
- func (s *SyncthingClient) String() string
- func (s *SyncthingClient) SubscribeEvent(eventTypes []events.EventType, since int) <-chan events.Event
- func (s *SyncthingClient) UnsubscribeEvent(eventCh <-chan events.Event)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SyncthingClient ¶
type SyncthingClient struct { Url string // contains filtered or unexported fields }
SyncthingClient represents a SyncthingClient instance. It is used to interact with SyncthingClient.
func NewSyncthing ¶
func NewSyncthing(url string, apikey string, logger *zap.SugaredLogger) (*SyncthingClient, error)
func (*SyncthingClient) GetDiskEvents ¶
func (*SyncthingClient) GetEvents ¶
func (s *SyncthingClient) GetEvents(eventTypes []events.EventType, since int, timeout int, limit int) ([]events.Event, error)
GetEvents receives events. since sets the ID of the last event you’ve already seen. The default value is 0, which returns all events. The timeout duration can be customized with the parameter timeout(seconds). To receive only a limited number of events, add the limit parameter with a suitable value for n and only the last n events will be returned.
Note: if more than one eventTypes filter is given, only subsequent events can be fetched. This function will wait until a new event or timeout. However, if there's only one event type or empty, cached events can be fetched. This is the intended behavior of SyncthingClient API, details: https://github.com/syncthing/syncthing/issues/8902
func (*SyncthingClient) GetSystemStatus ¶
func (s *SyncthingClient) GetSystemStatus() (*domain.SystemStatus, error)
func (*SyncthingClient) String ¶
func (s *SyncthingClient) String() string
func (*SyncthingClient) SubscribeEvent ¶
func (s *SyncthingClient) SubscribeEvent(eventTypes []events.EventType, since int) <-chan events.Event
SubscribeEvent subscribes any events compliant with eventTypes after since. Returns the event callback. Call unsubscribe if you want to stop subscription.
If the given since is -1, it will get the id of the current latest event as since.
func (*SyncthingClient) UnsubscribeEvent ¶
func (s *SyncthingClient) UnsubscribeEvent(eventCh <-chan events.Event)