types

package
v0.0.0-...-775ef2c Latest Latest
Warning

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

Go to latest
Published: May 19, 2019 License: ISC Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ShorterDesc maps the short description to there respective vote status type.

Functions

func VotesStatuses

func VotesStatuses() map[VoteStatusType]string

VotesStatuses returns the ShorterDesc map contents exclusive of Invalid and Doesn't exist statuses.

Types

type AttachmentFile

type AttachmentFile struct {
	Name      string `json:"name"`
	MimeType  string `json:"mime"`
	DigestKey string `json:"digest"`
	Payload   string `json:"payload"`
}

AttachmentFile are files and documents submitted as proposal details. https://github.com/fonero-project/politeia/blob/master/politeiawww/api/www/v1/api.md#file

type CensorshipRecord

type CensorshipRecord struct {
	TokenVal   string `json:"token" storm:"unique"`
	MerkleRoot string `json:"merkle"`
	Signature  string `json:"signature"`
}

CensorshipRecord is an entry that was created when the proposal was submitted. https://github.com/fonero-project/politeia/blob/master/politeiawww/api/www/v1/api.md#censorship-record

type Proposal

type Proposal struct {
	Data *ProposalInfo `json:"proposal"`
}

Proposal defines a proposal payload as returned by RouteProposalDetails route.

type ProposalInfo

type ProposalInfo struct {
	ID              int                `json:"id" storm:"id,increment"`
	Name            string             `json:"name"`
	State           ProposalStateType  `json:"state"`
	Status          ProposalStatusType `json:"status"`
	Timestamp       uint64             `json:"timestamp"`
	UserID          string             `json:"userid"`
	Username        string             `json:"username"`
	PublicKey       string             `json:"publickey"`
	Signature       string             `json:"signature"`
	Version         string             `json:"version"`
	NumComments     int32              `json:"numcomments"`
	StatusChangeMsg string             `json:"statuschangemessage"`
	PublishedDate   uint64             `json:"publishedat" storm:"index"`
	CensoredDate    uint64             `json:"censoredat"`
	AbandonedDate   uint64             `json:"abandonedat"`
	// RefID was added to create an easily readable part of the URL that helps
	// to reference the proposals details page. Storm db ignores entries with
	// duplicate pk but returns "ErrAlreadyExists" error if the field other than
	// the pk has the tag "unique".
	RefID            string `storm:"unique"`
	CensorshipRecord `json:"censorshiprecord"`
	ProposalVotes    `json:"votes"`
}

ProposalInfo holds the proposal details as document here https://github.comfonero-project/politeia/blob/master/politeiawww/api/www/v1/api.md#user-proposals. It also holds the votes status details. The ID field is auto incremented by the db.

func (*ProposalInfo) IsEqual

func (a *ProposalInfo) IsEqual(b *ProposalInfo) bool

IsEqual compares CensorshipRecord, Name, State, NumComments, StatusChangeMsg, Timestamp, CensoredDate, AbandonedDate, PublishedDate, Token, VoteStatus, TotalVotes and count of VoteResults between the two ProposalsInfo structs passed.

type ProposalStateType

type ProposalStateType int8

ProposalStateType defines the proposal state entry.

const (
	// InvalidState defines the invalid state proposals.
	InvalidState ProposalStateType = iota

	// UnvettedState defines the unvetted state proposals and includes proposals
	// with a status of:
	//   * PropStatusNotReviewed
	//   * PropStatusUnreviewedChanges
	//   * PropStatusCensored
	UnvettedState

	// VettedState defines the vetted state proposals and includes proposals
	// with a status of:
	//   * PropStatusPublic
	//   * PropStatusAbandoned
	VettedState

	// UnknownState indicates a proposal state that is unrecognized.
	UnknownState
)

func ProposalStateFromStr

func ProposalStateFromStr(val string) ProposalStateType

ProposalStateFromStr converts the string into ProposalStateType value.

func (ProposalStateType) String

func (f ProposalStateType) String() string

type ProposalStatusType

type ProposalStatusType piapi.PropStatusT

ProposalStatusType defines the various proposal statuses available as referenced in https://github.com/fonero-project/politeia/blob/master/politeiawww/api/www/v1/v1.go

func (ProposalStatusType) String

func (p ProposalStatusType) String() string

type ProposalVotes

type ProposalVotes struct {
	Token              string         `json:"token"`
	VoteStatus         VoteStatusType `json:"status"`
	VoteResults        []Results      `json:"optionsresult"`
	TotalVotes         int64          `json:"totalvotes"`
	Endheight          string         `json:"endheight"`
	NumOfEligibleVotes int64          `json:"numofeligiblevotes"`
	QuorumPercentage   uint32         `json:"quorumpercentage"`
	PassPercentage     uint32         `json:"passpercentage"`
}

ProposalVotes defines the proposal status(Votes infor for the public proposals). https://github.com/fonero-project/politeia/blob/master/politeiawww/api/www/v1/api.md#proposal-vote-status

type Proposals

type Proposals struct {
	Data []*ProposalInfo `json:"proposals"`
}

Proposals defines an array of proposals payload as returned by RouteAllVetted route.

type Results

type Results struct {
	Option        VoteOption `json:"option"`
	VotesReceived int64      `json:"votesreceived"`
}

Results defines the actual vote count info per the votes choices available.

type VoteOption

type VoteOption struct {
	OptionID    string `json:"id"`
	Description string `json:"description"`
	Bits        int32  `json:"bits"`
}

VoteOption defines the actual high level vote results for the specific agenda.

type VoteStatusType

type VoteStatusType piapi.PropVoteStatusT

VoteStatusType defines the various vote statuses available as referenced in https://github.com/fonero-project/politeia/blob/master/politeiawww/api/www/v1/v1.go

func (VoteStatusType) LongDesc

func (s VoteStatusType) LongDesc() string

LongDesc returns the long vote status description.

func (VoteStatusType) ShortDesc

func (s VoteStatusType) ShortDesc() string

ShortDesc returns the shorter vote status description.

type Votes

type Votes struct {
	Data []ProposalVotes `json:"votesstatus"`
}

Votes defines a slice of VotesStatuses as returned by RouteAllVoteStatus.

Jump to

Keyboard shortcuts

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