snapshot

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EndpointMainnet = "https://hub.snapshot.org/graphql"
	EndpointTestnet = "https://testnet.snapshot.org/graphql"

	Limit = 1000

	ProposalStateClosed = "closed"
)
View Source
const Proposal_Operation = `` /* 182-byte string literal not displayed */

The query or mutation executed by Proposal.

View Source
const Proposals_Operation = `` /* 253-byte string literal not displayed */

The query or mutation executed by Proposals.

View Source
const Vote_Operation = `
query Vote ($id: String) {
	votes(where: {id:$id}) {
		id
		voter
		created
		choice
		vp
		reason
	}
}
`

The query or mutation executed by Vote.

View Source
const Votes_Operation = `` /* 214-byte string literal not displayed */

The query or mutation executed by Votes.

Variables

This section is empty.

Functions

func NewClient

func NewClient(endpoint string, options ...Option) (graphql.Client, error)

NewClient a function that can be used to configure a [client] with options. Options are applied in the order they are passed to the function

Types

type Option

type Option func(client *client) error

Option is a function that can be used to configure a [client].

func WithAPIKey

func WithAPIKey(apiKey string) Option

WithAPIKey is an Option that can be used to set the X-API-KEY header for requests.

type ProposalProposalsProposal

type ProposalProposalsProposal struct {
	Id      string                         `json:"id"`
	Link    string                         `json:"link"`
	Title   string                         `json:"title"`
	Body    string                         `json:"body"`
	Choices []string                       `json:"choices"`
	Start   int                            `json:"start"`
	End     int                            `json:"end"`
	State   string                         `json:"state"`
	Author  string                         `json:"author"`
	Created int                            `json:"created"`
	Space   ProposalProposalsProposalSpace `json:"space"`
}

ProposalProposalsProposal includes the requested fields of the GraphQL type Proposal.

func (*ProposalProposalsProposal) GetAuthor

func (v *ProposalProposalsProposal) GetAuthor() string

GetAuthor returns ProposalProposalsProposal.Author, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetBody

func (v *ProposalProposalsProposal) GetBody() string

GetBody returns ProposalProposalsProposal.Body, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetChoices

func (v *ProposalProposalsProposal) GetChoices() []string

GetChoices returns ProposalProposalsProposal.Choices, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetCreated

func (v *ProposalProposalsProposal) GetCreated() int

GetCreated returns ProposalProposalsProposal.Created, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetEnd

func (v *ProposalProposalsProposal) GetEnd() int

GetEnd returns ProposalProposalsProposal.End, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetId

func (v *ProposalProposalsProposal) GetId() string

GetId returns ProposalProposalsProposal.Id, and is useful for accessing the field via an interface.

func (v *ProposalProposalsProposal) GetLink() string

GetLink returns ProposalProposalsProposal.Link, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetSpace

GetSpace returns ProposalProposalsProposal.Space, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetStart

func (v *ProposalProposalsProposal) GetStart() int

GetStart returns ProposalProposalsProposal.Start, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetState

func (v *ProposalProposalsProposal) GetState() string

GetState returns ProposalProposalsProposal.State, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposal) GetTitle

func (v *ProposalProposalsProposal) GetTitle() string

GetTitle returns ProposalProposalsProposal.Title, and is useful for accessing the field via an interface.

type ProposalProposalsProposalSpace

type ProposalProposalsProposalSpace struct {
	Id    string `json:"id"`
	Name  string `json:"name"`
	About string `json:"about"`
}

ProposalProposalsProposalSpace includes the requested fields of the GraphQL type Space.

func (*ProposalProposalsProposalSpace) GetAbout

func (v *ProposalProposalsProposalSpace) GetAbout() string

GetAbout returns ProposalProposalsProposalSpace.About, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposalSpace) GetId

GetId returns ProposalProposalsProposalSpace.Id, and is useful for accessing the field via an interface.

func (*ProposalProposalsProposalSpace) GetName

GetName returns ProposalProposalsProposalSpace.Name, and is useful for accessing the field via an interface.

type ProposalResponse

type ProposalResponse struct {
	Proposals []ProposalProposalsProposal `json:"proposals"`
}

ProposalResponse is returned by Proposal on success.

func Proposal

func Proposal(
	ctx context.Context,
	client graphql.Client,
	id string,
) (*ProposalResponse, error)

func (*ProposalResponse) GetProposals

func (v *ProposalResponse) GetProposals() []ProposalProposalsProposal

GetProposals returns ProposalResponse.Proposals, and is useful for accessing the field via an interface.

type ProposalsProposalsProposal

type ProposalsProposalsProposal struct {
	Id      string                          `json:"id"`
	Link    string                          `json:"link"`
	Title   string                          `json:"title"`
	Body    string                          `json:"body"`
	Choices []string                        `json:"choices"`
	Start   int                             `json:"start"`
	End     int                             `json:"end"`
	State   string                          `json:"state"`
	Author  string                          `json:"author"`
	Created int                             `json:"created"`
	Space   ProposalsProposalsProposalSpace `json:"space"`
}

ProposalsProposalsProposal includes the requested fields of the GraphQL type Proposal.

func (*ProposalsProposalsProposal) GetAuthor

func (v *ProposalsProposalsProposal) GetAuthor() string

GetAuthor returns ProposalsProposalsProposal.Author, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetBody

func (v *ProposalsProposalsProposal) GetBody() string

GetBody returns ProposalsProposalsProposal.Body, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetChoices

func (v *ProposalsProposalsProposal) GetChoices() []string

GetChoices returns ProposalsProposalsProposal.Choices, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetCreated

func (v *ProposalsProposalsProposal) GetCreated() int

GetCreated returns ProposalsProposalsProposal.Created, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetEnd

func (v *ProposalsProposalsProposal) GetEnd() int

GetEnd returns ProposalsProposalsProposal.End, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetId

GetId returns ProposalsProposalsProposal.Id, and is useful for accessing the field via an interface.

func (v *ProposalsProposalsProposal) GetLink() string

GetLink returns ProposalsProposalsProposal.Link, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetSpace

GetSpace returns ProposalsProposalsProposal.Space, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetStart

func (v *ProposalsProposalsProposal) GetStart() int

GetStart returns ProposalsProposalsProposal.Start, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetState

func (v *ProposalsProposalsProposal) GetState() string

GetState returns ProposalsProposalsProposal.State, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposal) GetTitle

func (v *ProposalsProposalsProposal) GetTitle() string

GetTitle returns ProposalsProposalsProposal.Title, and is useful for accessing the field via an interface.

type ProposalsProposalsProposalSpace

type ProposalsProposalsProposalSpace struct {
	Id    string `json:"id"`
	Name  string `json:"name"`
	About string `json:"about"`
}

ProposalsProposalsProposalSpace includes the requested fields of the GraphQL type Space.

func (*ProposalsProposalsProposalSpace) GetAbout

GetAbout returns ProposalsProposalsProposalSpace.About, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposalSpace) GetId

GetId returns ProposalsProposalsProposalSpace.Id, and is useful for accessing the field via an interface.

func (*ProposalsProposalsProposalSpace) GetName

GetName returns ProposalsProposalsProposalSpace.Name, and is useful for accessing the field via an interface.

type ProposalsResponse

type ProposalsResponse struct {
	Proposals []ProposalsProposalsProposal `json:"proposals"`
}

ProposalsResponse is returned by Proposals on success.

func Proposals

func Proposals(
	ctx context.Context,
	client graphql.Client,
	created int,
) (*ProposalsResponse, error)

func (*ProposalsResponse) GetProposals

func (v *ProposalsResponse) GetProposals() []ProposalsProposalsProposal

GetProposals returns ProposalsResponse.Proposals, and is useful for accessing the field via an interface.

type VoteResponse

type VoteResponse struct {
	Votes []VoteVotesVote `json:"votes"`
}

VoteResponse is returned by Vote on success.

func Vote

func Vote(
	ctx context.Context,
	client graphql.Client,
	id string,
) (*VoteResponse, error)

func (*VoteResponse) GetVotes

func (v *VoteResponse) GetVotes() []VoteVotesVote

GetVotes returns VoteResponse.Votes, and is useful for accessing the field via an interface.

type VoteVotesVote

type VoteVotesVote struct {
	Id      string  `json:"id"`
	Voter   string  `json:"voter"`
	Created int     `json:"created"`
	Choice  any     `json:"choice"`
	Vp      float64 `json:"vp"`
	Reason  string  `json:"reason"`
}

VoteVotesVote includes the requested fields of the GraphQL type Vote.

func (*VoteVotesVote) GetChoice

func (v *VoteVotesVote) GetChoice() any

GetChoice returns VoteVotesVote.Choice, and is useful for accessing the field via an interface.

func (*VoteVotesVote) GetCreated

func (v *VoteVotesVote) GetCreated() int

GetCreated returns VoteVotesVote.Created, and is useful for accessing the field via an interface.

func (*VoteVotesVote) GetId

func (v *VoteVotesVote) GetId() string

GetId returns VoteVotesVote.Id, and is useful for accessing the field via an interface.

func (*VoteVotesVote) GetReason

func (v *VoteVotesVote) GetReason() string

GetReason returns VoteVotesVote.Reason, and is useful for accessing the field via an interface.

func (*VoteVotesVote) GetVoter

func (v *VoteVotesVote) GetVoter() string

GetVoter returns VoteVotesVote.Voter, and is useful for accessing the field via an interface.

func (*VoteVotesVote) GetVp

func (v *VoteVotesVote) GetVp() float64

GetVp returns VoteVotesVote.Vp, and is useful for accessing the field via an interface.

type VotesResponse

type VotesResponse struct {
	Votes []VotesVotesVote `json:"votes"`
}

VotesResponse is returned by Votes on success.

func Votes

func Votes(
	ctx context.Context,
	client graphql.Client,
	proposal string,
	created int,
) (*VotesResponse, error)

func (*VotesResponse) GetVotes

func (v *VotesResponse) GetVotes() []VotesVotesVote

GetVotes returns VotesResponse.Votes, and is useful for accessing the field via an interface.

type VotesVotesVote

type VotesVotesVote struct {
	Id      string  `json:"id"`
	Voter   string  `json:"voter"`
	Created int     `json:"created"`
	Choice  any     `json:"choice"`
	Vp      float64 `json:"vp"`
	Reason  string  `json:"reason"`
}

VotesVotesVote includes the requested fields of the GraphQL type Vote.

func (*VotesVotesVote) GetChoice

func (v *VotesVotesVote) GetChoice() any

GetChoice returns VotesVotesVote.Choice, and is useful for accessing the field via an interface.

func (*VotesVotesVote) GetCreated

func (v *VotesVotesVote) GetCreated() int

GetCreated returns VotesVotesVote.Created, and is useful for accessing the field via an interface.

func (*VotesVotesVote) GetId

func (v *VotesVotesVote) GetId() string

GetId returns VotesVotesVote.Id, and is useful for accessing the field via an interface.

func (*VotesVotesVote) GetReason

func (v *VotesVotesVote) GetReason() string

GetReason returns VotesVotesVote.Reason, and is useful for accessing the field via an interface.

func (*VotesVotesVote) GetVoter

func (v *VotesVotesVote) GetVoter() string

GetVoter returns VotesVotesVote.Voter, and is useful for accessing the field via an interface.

func (*VotesVotesVote) GetVp

func (v *VotesVotesVote) GetVp() float64

GetVp returns VotesVotesVote.Vp, and is useful for accessing the field via an interface.

Jump to

Keyboard shortcuts

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