rpc

package
v0.0.0-...-7db4835 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Query(endpoint, query string) Result
}

Client represents an RPC client interface

type GitHubClient

type GitHubClient struct {
	// contains filtered or unexported fields
}

GitHubClient wraps a githubv4 graphql client connection

func NewGitHubClient

func NewGitHubClient(cfg config.Config) *GitHubClient

NewGitHubClient returns a GitHub graphqlv4 client wrapper from a config

func (*GitHubClient) GetIssue

func (g *GitHubClient) GetIssue(res *Result, issue string) error

GetIssue retrieves an issue's information

func (*GitHubClient) GetIssues

func (g *GitHubClient) GetIssues(res *Result, query string) error

GetIssues retrieves issues from the search API given a query

func (*GitHubClient) GetProject

func (g *GitHubClient) GetProject(res *Result, query string) error

GetProject retrieves a project for either an org or a repo

func (*GitHubClient) GetProjects

func (g *GitHubClient) GetProjects(res *Result, query string) error

GetProjects retrieves a list of projects

func (*GitHubClient) GetRepo

func (g *GitHubClient) GetRepo(res *Result, repo string) error

GetRepo retrieves a repo's information

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is a set of RPC http handlers

func NewHandler

func NewHandler(cfg config.Config, lg service.Logger) *Handler

NewHandler creates a new RPC handler with the given config

func (*Handler) Mount

func (h *Handler) Mount(mux *chi.Mux)

Mount routes the RPC handlers on a mux

type Issue

type Issue struct {
	Type   string `json:"type"`
	State  string `json:"state"`
	Title  string `json:"description"`
	Repo   string `json:"repo"`
	Number string `json:"number"`
}

Issue is an issue in a RPC result

type Project

type Project struct {
	Number int    `json:"number"`
	URL    string `json:"url"`
	Name   string `json:"name"`
	State  string `json:"state"`
}

Project is a project in an RPC result

type Repo

type Repo struct {
	Description string `json:"description"`
}

Repo is a respository in an RPC result

type Result

type Result struct {
	Complete bool   `json:"complete"` // is the request finished?
	Error    string `json:"error"`    // server error, if applicable

	Repos    []Repo    `json:"repos"`
	Issues   []Issue   `json:"issues"`
	Projects []Project `json:"projects"`
}

Result is the result of an RPC call

type SocketClient

type SocketClient struct {
	// contains filtered or unexported fields
}

SocketClient is a client that talks to a local socket

func NewClient

func NewClient(socketPath string) SocketClient

NewClient creates a new Client from a config

func (SocketClient) Query

func (sc SocketClient) Query(endpoint, query string) Result

Query executes a query against the RPC server.

Returns a Result if the RPC call completed successfully, regardless of whether the ultimate value is ready or not.

Jump to

Keyboard shortcuts

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