{"id":20829780,"url":"https://github.com/pdf/kodirpc","last_synced_at":"2025-05-07T22:10:01.510Z","repository":{"id":48105547,"uuid":"60447270","full_name":"pdf/kodirpc","owner":"pdf","description":"Golang client for the Kodi TCP JSON-RPC interface","archived":false,"fork":false,"pushed_at":"2021-08-06T11:33:22.000Z","size":31,"stargazers_count":12,"open_issues_count":1,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-07T22:09:56.042Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://godoc.org/github.com/pdf/kodirpc","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pdf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-05T06:52:04.000Z","updated_at":"2023-01-28T20:49:00.000Z","dependencies_parsed_at":"2022-08-12T18:40:49.616Z","dependency_job_id":null,"html_url":"https://github.com/pdf/kodirpc","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf%2Fkodirpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf%2Fkodirpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf%2Fkodirpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdf%2Fkodirpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdf","download_url":"https://codeload.github.com/pdf/kodirpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252961841,"owners_count":21832197,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T23:22:00.865Z","updated_at":"2025-05-07T22:10:01.484Z","avatar_url":"https://github.com/pdf.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/pdf/kodirpc.svg?branch=master)](https://travis-ci.org/pdf/kodirpc) [![GoDoc](https://godoc.org/github.com/pdf/kodirpc?status.svg)](http://godoc.org/github.com/pdf/kodirpc) [![License-MIT](http://img.shields.io/badge/license-MIT-red.svg)](https://github.com/pdf/kodirpc/raw/master/LICENSE)\n\n# kodirpc\n--\n    import \"github.com/pdf/kodirpc\"\n\nPackage kodirpc is a JSON-RPC client for the TCP socket of the Kodi home theatre\nsoftware.\n\n## Usage\n\n```go\nconst (\n\t// DefaultReadTimeout is the default time a call will wait for a response.\n\tDefaultReadTimeout = 5 * time.Second\n\t// DefaultConnectTimeout is the default time re-/connection will be\n\t// attempted before failure.\n\tDefaultConnectTimeout = 5 * time.Minute\n\t// DefaultReconnect determines whether the client reconnects by default.\n\tDefaultReconnect = true\n\t// DefaultConnectBackoffScale is the default back-off scaling factor\n\tDefaultConnectBackoffScale = 2\n)\n```\n\n#### func  SetLogger\n\n```go\nfunc SetLogger(l LevelledLogger)\n```\nSetLogger enables logging for the library and wraps the supplied logger with a\nlogPrefixer to denote locally generated logs\n\n#### type Client\n\n```go\ntype Client struct {\n\tsync.RWMutex\n}\n```\n\nClient is a TCP JSON-RPC client for Kodi.\n\n#### func  NewClient\n\n```go\nfunc NewClient(address string, config *Config) (c *Client, err error)\n```\nNewClient connects to the specified address and returns the resulting Client.\n\n#### func (*Client) Call\n\n```go\nfunc (c *Client) Call(method string, params interface{}) (interface{}, error)\n```\nCall an RPC method and return the result.\n\n#### func (*Client) Close\n\n```go\nfunc (c *Client) Close() error\n```\nClose the client connection, not further use of the Client is permitted after\nthis method has been called.\n\n#### func (*Client) Handle\n\n```go\nfunc (c *Client) Handle(method string, handler NotificationHandler)\n```\nHandle the notification method, using the specificed handler. The handler will\nbe passed the data parameter from the incoming notification.\n\n#### func (*Client) Notify\n\n```go\nfunc (c *Client) Notify(method string, params interface{}) error\n```\nNotify sends the RPC request and does not wait for a response.\n\n#### type Config\n\n```go\ntype Config struct {\n\t// ReadTimeout is the time a call will wait for a response before failure.\n\tReadTimeout time.Duration\n\t// ConnectTimeout is the time a re-/connection will be attempted before\n\t// failure. A value of zero attempts indefinitely.\n\tConnectTimeout time.Duration\n\t// Reconnect determines whether the client will attempt to reconnect on\n\t// connection failure\n\tReconnect bool\n\t// ConnectBackoffScale sets the scaling factor for back-off on failed\n\t// connection attempts\n\tConnectBackoffScale int\n}\n```\n\nConfig represents the user-configurable parameters for the client\n\n#### func  NewConfig\n\n```go\nfunc NewConfig() (c *Config)\n```\nNewConfig returns a config instance with default values.\n\n#### type Error\n\n```go\ntype Error struct {\n\tCode    int         `json:\"code\"`\n\tMessage string      `json:\"message\"`\n\tData    interface{} `json:\"data,omitempty\"`\n}\n```\n\nError response.\n\n#### func (*Error) Error\n\n```go\nfunc (e *Error) Error() string\n```\nError satisfies the error interface.\n\n#### type LevelledLogger\n\n```go\ntype LevelledLogger interface {\n\t// Debugf handles debug level messages\n\tDebugf(format string, args ...interface{})\n\t// Infof handles info level messages\n\tInfof(format string, args ...interface{})\n\t// Warnf handles warn level messages\n\tWarnf(format string, args ...interface{})\n\t// Errorf handles error level messages\n\tErrorf(format string, args ...interface{})\n\t// Fatalf handles fatal level messages, and must exit the application\n\tFatalf(format string, args ...interface{})\n\t// Panicf handles debug level messages, and must panic the application\n\tPanicf(format string, args ...interface{})\n}\n```\n\nLevelledLogger represents a minimal levelled logger\n\n#### type NotificationHandler\n\n```go\ntype NotificationHandler func(method string, data interface{})\n```\n\nNotificationHandler is a callback handler for notifications.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdf%2Fkodirpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdf%2Fkodirpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdf%2Fkodirpc/lists"}