rest

package
v0.0.0-...-d58e437 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ComponentName = "rest"
View Source
const (
	DefaultYagnaApiUrl = "http://127.0.0.1:7465"
)
View Source
const Slots = "_api"

Variables

View Source
var (
	OfferProposalSlots = []string{"_proposal", "_subscription"}
)

Functions

This section is empty.

Types

type Activity

type Activity struct {
	*ActivityService
	// contains filtered or unexported fields
}

func (*Activity) DestroyActivity

func (a *Activity) DestroyActivity(excType, excVal, excTb interface{})

func (*Activity) Id

func (a *Activity) Id() string

func (*Activity) Send

func (a *Activity) Send(script []map[string]interface{}, stream bool, deadline time.Time) (Poller, error)

func (*Activity) State

func (a *Activity) State() (*activity.ActivityState, error)

type ActivityService

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

ActivityService

func NewActivityService

func NewActivityService(ctx context.Context, client *activity.APIClient, logger log.Logger) *ActivityService

func (*ActivityService) NewActivity

func (as *ActivityService) NewActivity(agreementId string) (*Activity, error)

type Agreement

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

func (*Agreement) Confirm

func (a *Agreement) Confirm() error

func (*Agreement) Details

func (a *Agreement) Details() (*AgreementDetails, error)

func (*Agreement) Id

func (a *Agreement) Id() string

func (*Agreement) Terminate

func (a *Agreement) Terminate(reason map[string]interface{}) error

type AgreementDetails

type AgreementDetails struct {
	RawDetails *yam.Agreement
}

func (*AgreementDetails) ProviderView

func (ad *AgreementDetails) ProviderView() *view

func (*AgreementDetails) RequesterView

func (ad *AgreementDetails) RequesterView() *view

type Allocation

type Allocation struct {
	Id     string
	Amount decimal.Decimal

	PaymentPlatform string
	PaymentAddress  string
	Expires         time.Time
	// contains filtered or unexported fields
}

func (*Allocation) Delete

func (a *Allocation) Delete() error

func (*Allocation) Details

func (a *Allocation) Details() (*AllocationDetails, error)

type AllocationDetails

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

type Batch

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

func (*Batch) Id

func (b *Batch) Id() string

func (*Batch) SecondsLeft

func (b *Batch) SecondsLeft() float32

type BatchTimeoutError

type BatchTimeoutError struct {
}

func (*BatchTimeoutError) Error

func (b *BatchTimeoutError) Error() string

type CommandExecutionError

type CommandExecutionError struct {
	Command string
	Message string
}

func (CommandExecutionError) Error

func (c CommandExecutionError) Error() string

type Configuration

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

func NewConfiguration

func NewConfiguration(appKey string,
	url string,
	marketUrl string,
	paymentUrl string,
	activityUrl string) (*Configuration, error)

func (*Configuration) Activity

func (c *Configuration) Activity() *yaa.APIClient

func (*Configuration) ActivityUrl

func (c *Configuration) ActivityUrl() string

func (*Configuration) AppKey

func (c *Configuration) AppKey() string

func (*Configuration) Market

func (c *Configuration) Market() *yam.APIClient

func (*Configuration) MarketUrl

func (c *Configuration) MarketUrl() string

func (*Configuration) Payment

func (c *Configuration) Payment() *yap.APIClient

func (*Configuration) PaymentUrl

func (c *Configuration) PaymentUrl() string

func (*Configuration) Url

func (c *Configuration) Url() string

type DebitNote

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

func NewDebitNote

func NewDebitNote(ctx context.Context, api *yap.RequestorApiService, debitNote *yap.DebitNote) *DebitNote

func (*DebitNote) Accept

func (d *DebitNote) Accept(amount string, allocation Allocation) (*http.Response, error)

type Invoice

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

func NewInvoice

func NewInvoice(ctx context.Context, api *yap.RequestorApiService, invoice *yap.Invoice) *Invoice

func (*Invoice) Accept

func (i *Invoice) Accept(amount string, allocation Allocation) (*http.Response, error)

type Market

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

func (*Market) Subscribe

func (m *Market) Subscribe(props props.Props, constraints string) (*Subscription, error)

func (*Market) Subscriptions

func (m *Market) Subscriptions() ([]Subscription, error)

type MissingConfiguration

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

func (*MissingConfiguration) Error

func (e *MissingConfiguration) Error() string

type OfferProposal

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

func (*OfferProposal) CreateAgreement

func (o *OfferProposal) CreateAgreement(ctx context.Context, timeout time.Duration) (*Agreement, error)

func (*OfferProposal) Id

func (o *OfferProposal) Id() string

func (*OfferProposal) IsDraft

func (o *OfferProposal) IsDraft() bool

func (*OfferProposal) Issuer

func (o *OfferProposal) Issuer() string

func (*OfferProposal) Props

func (o *OfferProposal) Props() props.Props

func (*OfferProposal) Reject

func (o *OfferProposal) Reject(reason string) error

func (*OfferProposal) Respond

func (o *OfferProposal) Respond(props props.Props, constraints string) (string, error)

func (*OfferProposal) String

func (o *OfferProposal) String() string

type Payment

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

func NewPayment

func NewPayment(client *yap.APIClient) *Payment

func (*Payment) Accounts

func (p *Payment) Accounts(ctx context.Context, allocationId string) ([]yap.Account, error)

func (*Payment) Allocation

func (p *Payment) Allocation(ctx context.Context, allocationId string) (*Allocation, error)

func (*Payment) Allocations

func (p *Payment) Allocations(ctx context.Context) ([]Allocation, error)

func (*Payment) DebitNote

func (p *Payment) DebitNote(ctx context.Context, debitNoteId string) (*DebitNote, error)

func (*Payment) DecorateDemand

func (p *Payment) DecorateDemand(ctx context.Context, ids []string) (*yap.MarketDecoration, error)

func (*Payment) IncomingDebitNotes

func (p *Payment) IncomingDebitNotes(ctx context.Context) (chan *DebitNote, error)

func (*Payment) IncomingInvoice

func (p *Payment) IncomingInvoice(ctx context.Context) (chan *Invoice, error)

func (*Payment) Invoice

func (p *Payment) Invoice(ctx context.Context, invoiceId string) (*Invoice, error)

func (*Payment) Invoices

func (p *Payment) Invoices(ctx context.Context) ([]Invoice, error)

func (*Payment) NewAllocation

func (p *Payment) NewAllocation(amount decimal.Decimal,
	paymentPlatform string,
	paymentAddress string,
	expires *time.Time,
	makeDeposit bool) *allocationTask

type Poller

type Poller interface {
	Poll(ctx context.Context) (eventCh chan *executer.CommandEventContext, errCh chan error)
}

type PollingBatch

type PollingBatch struct {
	Batch
}

func NewPollingBatch

func NewPollingBatch(logger log.Logger, api *activity.RequestorControlApiService, activityId, batchId string, size int, deadline time.Time) *PollingBatch

func (*PollingBatch) Poll

func (pb *PollingBatch) Poll(ctx context.Context) (eventCh chan *executer.CommandEventContext, errCh chan error)

type Resourcer

type Resourcer interface {
	Source() error
	UnSource() error
}

type Result

type Result struct {
	Idx     int
	Message string
}

type StreamingBatch

type StreamingBatch struct {
	Batch
	// contains filtered or unexported fields
}

func NewStreamingBatch

func NewStreamingBatch(logger log.Logger, client *activity.APIClient, api *activity.RequestorControlApiService, activityId, batchId string, size int, deadline time.Time) *StreamingBatch

func (*StreamingBatch) Poll

func (sb *StreamingBatch) Poll(ctx context.Context) (eventCh chan *executer.CommandEventContext, errCh chan error)

type Subscription

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

func NewSubscription

func NewSubscription(logger log.Logger, ctx context.Context, api *yam.RequestorApiService,
	id string,
	open bool,
	deleted bool,
	details *yam.Demand) *Subscription

func (*Subscription) Close

func (s *Subscription) Close()

func (*Subscription) Delete

func (s *Subscription) Delete() error

func (*Subscription) Events

func (s *Subscription) Events(ctx context.Context) chan *OfferProposal

func (*Subscription) Id

func (s *Subscription) Id() string

func (*Subscription) Start

func (s *Subscription) Start() error

func (*Subscription) Stop

func (s *Subscription) Stop(excType, excValue, traceback interface{}) error

func (*Subscription) ValidateDetails

func (s *Subscription) ValidateDetails() error

Jump to

Keyboard shortcuts

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