Documentation ¶
Index ¶
- func RecordVerify(r pdv2.Record, serverPubKey string) error
- type Client
- func (c *Client) Author(ctx context.Context, token string) (string, error)
- func (c *Client) CommentCount(ctx context.Context, tokens []string) (map[string]uint32, error)
- func (c *Client) CommentDel(ctx context.Context, d comments.Del) (*comments.DelReply, error)
- func (c *Client) CommentNew(ctx context.Context, n comments.New) (*comments.Comment, error)
- func (c *Client) CommentTimestamps(ctx context.Context, token string, t comments.Timestamps) (*comments.TimestampsReply, error)
- func (c *Client) CommentVote(ctx context.Context, v comments.Vote) (*comments.VoteReply, error)
- func (c *Client) CommentVotes(ctx context.Context, token string, v comments.Votes) ([]comments.CommentVote, error)
- func (c *Client) CommentsGet(ctx context.Context, token string, g comments.Get) (map[uint32]comments.Comment, error)
- func (c *Client) CommentsGetAll(ctx context.Context, token string) ([]comments.Comment, error)
- func (c *Client) GetUnvetted(ctx context.Context, token string) (*pdv1.Record, error)
- func (c *Client) GetVetted(ctx context.Context, token, version string) (*pdv1.Record, error)
- func (c *Client) Identity(ctx context.Context) (*identity.PublicIdentity, error)
- func (c *Client) Inventory(ctx context.Context, state pdv2.RecordStateT, status pdv2.RecordStatusT, ...) (*pdv2.InventoryReply, error)
- func (c *Client) InventoryOrdered(ctx context.Context, state pdv2.RecordStateT, page uint32) ([]string, error)
- func (c *Client) NewRecord(ctx context.Context, metadata []pdv1.MetadataStream, files []pdv1.File) (*pdv1.CensorshipRecord, error)
- func (c *Client) PiBillingStatusChanges(ctx context.Context, tokens []string) (map[string]pi.BillingStatusChangesReply, error)
- func (c *Client) PiSetBillingStatus(ctx context.Context, sbs pi.SetBillingStatus) (*pi.SetBillingStatusReply, error)
- func (c *Client) PiSummaries(ctx context.Context, tokens []string) (map[string]pi.SummaryReply, error)
- func (c *Client) PluginCommand(ctx context.Context, pluginID, cmd, payload string) (string, error)
- func (c *Client) PluginInventory(ctx context.Context) ([]pdv2.Plugin, error)
- func (c *Client) PluginReads(ctx context.Context, cmds []pdv2.PluginCmd) ([]pdv2.PluginCmdReply, error)
- func (c *Client) PluginWrite(ctx context.Context, cmd pdv2.PluginCmd) (string, error)
- func (c *Client) RecordEdit(ctx context.Context, token string, mdAppend, mdOverwrite []pdv2.MetadataStream, ...) (*pdv2.Record, error)
- func (c *Client) RecordEditMetadata(ctx context.Context, token string, mdAppend, mdOverwrite []pdv2.MetadataStream) (*pdv2.Record, error)
- func (c *Client) RecordNew(ctx context.Context, metadata []pdv2.MetadataStream, files []pdv2.File) (*pdv2.Record, error)
- func (c *Client) RecordSetStatus(ctx context.Context, token string, status pdv2.RecordStatusT, ...) (*pdv2.Record, error)
- func (c *Client) RecordTimestamps(ctx context.Context, token string, version uint32) (*pdv2.RecordTimestampsReply, error)
- func (c *Client) Records(ctx context.Context, reqs []pdv2.RecordRequest) (map[string]pdv2.Record, error)
- func (c *Client) SetUnvettedStatus(ctx context.Context, token string, status pdv1.RecordStatusT, ...) error
- func (c *Client) SetVettedStatus(ctx context.Context, token string, status pdv1.RecordStatusT, ...) error
- func (c *Client) TicketVoteAuthorize(ctx context.Context, a ticketvote.Authorize) (*ticketvote.AuthorizeReply, error)
- func (c *Client) TicketVoteCastBallot(ctx context.Context, token string, cb ticketvote.CastBallot) (*ticketvote.CastBallotReply, error)
- func (c *Client) TicketVoteDetails(ctx context.Context, token string) (*ticketvote.DetailsReply, error)
- func (c *Client) TicketVoteInventory(ctx context.Context, i ticketvote.Inventory) (*ticketvote.InventoryReply, error)
- func (c *Client) TicketVoteResults(ctx context.Context, token string) (*ticketvote.ResultsReply, error)
- func (c *Client) TicketVoteStart(ctx context.Context, token string, s ticketvote.Start) (*ticketvote.StartReply, error)
- func (c *Client) TicketVoteSubmissions(ctx context.Context, token string) ([]string, error)
- func (c *Client) TicketVoteSummaries(ctx context.Context, tokens []string) (map[string]ticketvote.SummaryReply, error)
- func (c *Client) TicketVoteSummary(ctx context.Context, token string) (*ticketvote.SummaryReply, error)
- func (c *Client) TicketVoteTimestamps(ctx context.Context, token string, t ticketvote.Timestamps) (*ticketvote.TimestampsReply, error)
- func (c *Client) UpdateUnvetted(ctx context.Context, token string, mdAppend, mdOverwrite []pdv1.MetadataStream, ...) error
- func (c *Client) UpdateVetted(ctx context.Context, token string, mdAppend, mdOverwrite []pdv1.MetadataStream, ...) error
- func (c *Client) UpdateVettedMetadata(ctx context.Context, token string, mdAppend, mdOverwrite []pdv1.MetadataStream) error
- func (c *Client) UserRecords(ctx context.Context, userID string) (*usermd.UserRecordsReply, error)
- type ErrorReply
- type RespError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a client for interacting with the politeiad API.
func New ¶
func New(rpcHost, rpcCert, rpcUser, rpcPass string, pid *identity.PublicIdentity) (*Client, error)
New returns a new politeiad client.
func (*Client) CommentCount ¶
CommentCount sends a batch of comment plugin Count commands to the politeiad v2 API and returns a map[token]count with the results. If a record is not found for a token or any other error occurs, that token will not be included in the reply.
func (*Client) CommentDel ¶
CommentDel sends the comments plugin Del command to the politeiad v2 API.
func (*Client) CommentNew ¶
CommentNew sends the comments plugin New command to the politeiad v2 API.
func (*Client) CommentTimestamps ¶
func (c *Client) CommentTimestamps(ctx context.Context, token string, t comments.Timestamps) (*comments.TimestampsReply, error)
CommentTimestamps sends the comments plugin Timestamps command to the politeiad v2 API.
func (*Client) CommentVote ¶
CommentVote sends the comments plugin Vote command to the politeiad v2 API.
func (*Client) CommentVotes ¶
func (c *Client) CommentVotes(ctx context.Context, token string, v comments.Votes) ([]comments.CommentVote, error)
CommentVotes sends the comments plugin Votes command to the politeiad v2 API.
func (*Client) CommentsGet ¶
func (c *Client) CommentsGet(ctx context.Context, token string, g comments.Get) (map[uint32]comments.Comment, error)
CommentsGet sends the comments plugin Get command to the politeiad v2 API.
func (*Client) CommentsGetAll ¶
CommentsGetAll sends the comments plugin GetAll command to the politeiad v2 API.
func (*Client) GetUnvetted ¶
GetUnvetted sends a GetUnvetted request to the politeiad v1 API.
func (*Client) Inventory ¶
func (c *Client) Inventory(ctx context.Context, state pdv2.RecordStateT, status pdv2.RecordStatusT, page uint32) (*pdv2.InventoryReply, error)
Inventory sends a Inventory command to the politeiad v2 API.
func (*Client) InventoryOrdered ¶
func (c *Client) InventoryOrdered(ctx context.Context, state pdv2.RecordStateT, page uint32) ([]string, error)
InventoryOrdered sends a InventoryOrdered command to the politeiad v2 API.
func (*Client) NewRecord ¶
func (c *Client) NewRecord(ctx context.Context, metadata []pdv1.MetadataStream, files []pdv1.File) (*pdv1.CensorshipRecord, error)
NewRecord sends a NewRecord request to the politeiad v1 API.
func (*Client) PiBillingStatusChanges ¶ added in v1.3.0
func (c *Client) PiBillingStatusChanges(ctx context.Context, tokens []string) (map[string]pi.BillingStatusChangesReply, error)
PiBillingStatusChanges sends a page of pi plugin BillingStatusChanges commands to the politeiad v2 API.
func (*Client) PiSetBillingStatus ¶ added in v1.2.0
func (c *Client) PiSetBillingStatus(ctx context.Context, sbs pi.SetBillingStatus) (*pi.SetBillingStatusReply, error)
PiSetBillingStatus sends the pi plugin SetBillingStatus command to the politeiad v2 API.
func (*Client) PiSummaries ¶ added in v1.2.0
func (c *Client) PiSummaries(ctx context.Context, tokens []string) (map[string]pi.SummaryReply, error)
PiSummaries sends a page of pi plugin Summary commands to the politeiad v2 API.
func (*Client) PluginCommand ¶
PluginCommand sends a PluginCommand request to the politeiad v1 API.
func (*Client) PluginInventory ¶
PluginInventory sends a PluginInventory command to the politeiad v2 API.
func (*Client) PluginReads ¶
func (c *Client) PluginReads(ctx context.Context, cmds []pdv2.PluginCmd) ([]pdv2.PluginCmdReply, error)
PluginReads sends a PluginReads command to the politeiad v2 API.
func (*Client) PluginWrite ¶
PluginWrite sends a PluginWrite command to the politeiad v2 API.
func (*Client) RecordEdit ¶
func (c *Client) RecordEdit(ctx context.Context, token string, mdAppend, mdOverwrite []pdv2.MetadataStream, filesAdd []pdv2.File, filesDel []string) (*pdv2.Record, error)
RecordEdit sends a RecordEdit command to the politeiad v2 API.
func (*Client) RecordEditMetadata ¶
func (c *Client) RecordEditMetadata(ctx context.Context, token string, mdAppend, mdOverwrite []pdv2.MetadataStream) (*pdv2.Record, error)
RecordEditMetadata sends a RecordEditMetadata command to the politeiad v2 API.
func (*Client) RecordNew ¶
func (c *Client) RecordNew(ctx context.Context, metadata []pdv2.MetadataStream, files []pdv2.File) (*pdv2.Record, error)
RecordNew sends a RecordNew command to the politeiad v2 API.
func (*Client) RecordSetStatus ¶
func (c *Client) RecordSetStatus(ctx context.Context, token string, status pdv2.RecordStatusT, mdAppend, mdOverwrite []pdv2.MetadataStream) (*pdv2.Record, error)
RecordSetStatus sends a RecordSetStatus command to the politeiad v2 API.
func (*Client) RecordTimestamps ¶
func (c *Client) RecordTimestamps(ctx context.Context, token string, version uint32) (*pdv2.RecordTimestampsReply, error)
RecordTimestamps sends a RecordTimestamps command to the politeiad v2 API.
func (*Client) Records ¶
func (c *Client) Records(ctx context.Context, reqs []pdv2.RecordRequest) (map[string]pdv2.Record, error)
Records sends a Records command to the politeiad v2 API.
func (*Client) SetUnvettedStatus ¶
func (c *Client) SetUnvettedStatus(ctx context.Context, token string, status pdv1.RecordStatusT, mdAppend, mdOverwrite []pdv1.MetadataStream) error
SetUnvettedStatus sends a SetUnvettedStatus request to the politeiad v1 API.
func (*Client) SetVettedStatus ¶
func (c *Client) SetVettedStatus(ctx context.Context, token string, status pdv1.RecordStatusT, mdAppend, mdOverwrite []pdv1.MetadataStream) error
SetVettedStatus sends a SetVettedStatus request to the politeiad v1 API.
func (*Client) TicketVoteAuthorize ¶
func (c *Client) TicketVoteAuthorize(ctx context.Context, a ticketvote.Authorize) (*ticketvote.AuthorizeReply, error)
TicketVoteAuthorize sends the ticketvote plugin Authorize command to the politeiad v2 API.
func (*Client) TicketVoteCastBallot ¶
func (c *Client) TicketVoteCastBallot(ctx context.Context, token string, cb ticketvote.CastBallot) (*ticketvote.CastBallotReply, error)
TicketVoteCastBallot sends the ticketvote plugin CastBallot command to the politeiad v2 API.
func (*Client) TicketVoteDetails ¶
func (c *Client) TicketVoteDetails(ctx context.Context, token string) (*ticketvote.DetailsReply, error)
TicketVoteDetails sends the ticketvote plugin Details command to the politeiad v2 API.
func (*Client) TicketVoteInventory ¶
func (c *Client) TicketVoteInventory(ctx context.Context, i ticketvote.Inventory) (*ticketvote.InventoryReply, error)
TicketVoteInventory sends the ticketvote plugin Inventory command to the politeiad v2 API.
func (*Client) TicketVoteResults ¶
func (c *Client) TicketVoteResults(ctx context.Context, token string) (*ticketvote.ResultsReply, error)
TicketVoteResults sends the ticketvote plugin Results command to the politeiad v2 API.
func (*Client) TicketVoteStart ¶
func (c *Client) TicketVoteStart(ctx context.Context, token string, s ticketvote.Start) (*ticketvote.StartReply, error)
TicketVoteStart sends the ticketvote plugin Start command to the politeiad v2 API.
func (*Client) TicketVoteSubmissions ¶
TicketVoteSubmissions sends the ticketvote plugin Submissions command to the politeiad v2 API.
func (*Client) TicketVoteSummaries ¶
func (c *Client) TicketVoteSummaries(ctx context.Context, tokens []string) (map[string]ticketvote.SummaryReply, error)
TicketVoteSummaries sends a batch of ticketvote plugin Summary commands to the politeiad v2 API. Individual summary errors are not returned, the token will simply be left out of the returned map.
func (*Client) TicketVoteSummary ¶
func (c *Client) TicketVoteSummary(ctx context.Context, token string) (*ticketvote.SummaryReply, error)
TicketVoteSummary sends the ticketvote plugin Summary command to the politeiad v2 API.
func (*Client) TicketVoteTimestamps ¶
func (c *Client) TicketVoteTimestamps(ctx context.Context, token string, t ticketvote.Timestamps) (*ticketvote.TimestampsReply, error)
TicketVoteTimestamps sends the ticketvote plugin Timestamps command to the politeiad v2 API.
func (*Client) UpdateUnvetted ¶
func (c *Client) UpdateUnvetted(ctx context.Context, token string, mdAppend, mdOverwrite []pdv1.MetadataStream, filesAdd []pdv1.File, filesDel []string) error
UpdateUnvetted sends a UpdateRecord request to the unvetted politeiad v1 API.
func (*Client) UpdateVetted ¶
func (c *Client) UpdateVetted(ctx context.Context, token string, mdAppend, mdOverwrite []pdv1.MetadataStream, filesAdd []pdv1.File, filesDel []string) error
UpdateVetted sends a UpdateRecord request to the vetted politeiad v1 API.
func (*Client) UpdateVettedMetadata ¶
func (c *Client) UpdateVettedMetadata(ctx context.Context, token string, mdAppend, mdOverwrite []pdv1.MetadataStream) error
UpdateVettedMetadata sends a UpdateVettedMetadata request to the politeiad v1 API.
func (*Client) UserRecords ¶
UserRecords sends the user plugin UserRecords command to the politeiad v2 API.
type ErrorReply ¶
type ErrorReply struct { PluginID string `json:"pluginid"` ErrorCode uint32 `json:"errorcode"` ErrorContext string `json:"errorcontext"` }
ErrorReply represents the request body that is returned from politeaid when an error occurs. PluginID will only be populated if the error occurred during execution of a plugin command.