Skip to content

datarhei/core-client-go

Repository files navigation

core-client-go

A golang client for the github.com/datarhei/core API.


Quick Start

Example for retrieving a list of all processes:

import "github.com/datarhei/core-client-go/v16"

client, err := coreclient.New(coreclient.Config{
    Address: "https://example.com:8080",
    Username: "foo",
    Password: "bar",
})
if err != nil {
    ...
}

processes, err := client.ProcessList(coreclient.ProcessListOptions{})
if err != nil {
    ...
}

API definitions

General

  • GET /api

    About() api.About

Config

  • GET /api/v3/config

    Config() (api.Config, error)
  • PUT /api/v3/config

    ConfigSet(config api.ConfigSet) error
  • GET /api/v3/config/reload

    ConfigReload() error

Disk filesystem

  • GET /api/v3/fs/disk

    DiskFSList(sort, order string) ([]api.FileInfo, error)
  • HEAD /api/v3/fs/disk/{path}

    DiskFSHasFile(path string) bool
  • GET /api/v3/fs/disk/{path}

    DiskFSGetFile(path string) (io.ReadCloser, error)
  • DELETE /api/v3/fs/disk/{path}

    DiskFSDeleteFile(path string) error
  • PUT /api/v3/fs/disk/{path}

    DiskFSAddFile(path string, data io.Reader) error

In-memory filesystem

  • GET /api/v3/fs/mem

    MemFSList(sort, order string) ([]api.FileInfo, error)
  • HEAD /api/v3/fs/mem/{path}

    MemFSHasFile(path string) bool
  • GET /api/v3/fs/mem/{path}

    MemFSGetFile(path string) (io.ReadCloser, error)
  • DELETE /api/v3/fs/mem/{path}

    MemFSDeleteFile(path string) error
  • PUT /api/v3/fs/mem/{path}

    MemFSAddFile(path string, data io.Reader) error

Log

  • GET /api/v3/log

    Log() ([]api.LogEvent, error)

Metadata

  • GET /api/v3/metadata/{key}

    Metadata(id, key string) (api.Metadata, error)
  • PUT /api/v3/metadata/{key}

    MetadataSet(id, key string, metadata api.Metadata) error

Metrics

  • GET /api/v3/metrics

    MetricsList() ([]api.MetricsDescription, error)
  • POST /api/v3/metrics

    Metrics(query api.MetricsQuery) (api.MetricsResponse, error)

Process

  • GET /api/v3/process

    ProcessList(opts ProcessListOptions) ([]api.Process, error)
  • POST /api/v3/process

    ProcessAdd(p api.ProcessConfig) error
  • GET /api/v3/process/{id}

    Process(id string, filter []string) (api.Process, error)
  • PUT /api/v3/process/{id}

    ProcessUpdate(id string, p api.ProcessConfig) error
  • DELETE /api/v3/process/{id}

    ProcessDelete(id string) error
  • PUT /api/v3/process/{id}/command

    ProcessCommand(id, command string) error
  • GET /api/v3/process/{id}/probe

    ProcessProbe(id string) (api.Probe, error)
  • GET /api/v3/process/{id}/config

    ProcessConfig(id string) (api.ProcessConfig, error)
  • GET /api/v3/process/{id}/report

    ProcessReport(id string) (api.ProcessReport, error)
  • GET /api/v3/process/{id}/state

    ProcessState(id string) (api.ProcessState, error)
  • GET /api/v3/process/{id}/metadata/{key}

    ProcessMetadata(id, key string) (api.Metadata, error)
  • PUT /api/v3/process/{id}/metadata/{key}

    ProcessMetadataSet(id, key string, metadata api.Metadata) error

RTMP

  • GET /api/v3/rtmp

    RTMPChannels() ([]api.RTMPChannel, error)

SRT

  • GET /api/v3/srt

    SRTChannels() (api.SRTChannels, error)

Session

  • GET /api/v3/session

    Sessions(collectors []string) (api.SessionsSummary, error)
  • GET /api/v3/session/active

    SessionsActive(collectors []string) (api.SessionsActive, error)

Skills

  • GET /api/v3/skills

    Skills() (api.Skills, error)
  • GET /api/v3/skills/reload

    SkillsReload() error

Widget

  • GET /api/v3/widget

    WidgetProcess(id string) (api.WidgetProcess, error)

Versioning

The version of this module is according to which version of the datarhei Core API you want to connect to. Check the branches to find out which other versions are implemented. If you want to connect to an API version 12, you have to import the client module of the version 12, i.e. import "github.com/datarhei/core-client-go/v12".

The latest implementation is on the main branch.

Contributing

Found a mistake or misconduct? Create a issue or send a pull-request. Suggestions for improvement are welcome.

Licence

MIT