userapi

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

nolint

Index

Constants

View Source
const BootstrappedUserAPIService = "UserAPI Service"

BootstrappedUserAPIService key maps to the Service implementation in Bootstrap context.

View Source
const ErrInvalidAgreementID = errors.Error("Invalid funding agreement ID")

ErrInvalidAgreementID is a sentinel error when the agreement ID is invalid.

Variables

This section is empty.

Functions

func Register

func Register(ctx map[string]interface{}, r chi.Router)

Register registers the core apis to the router.

func Webhook

func Webhook(http.ResponseWriter, *http.Request)

Webhook is a place holder to describe webhook response in swagger @summary Webhook is a place holder to describe webhook response in swagger. @description Webhook is a place holder to describe webhook response in swagger. @id webhook @tags Webhook @accept json @produce json @success 200 {object} notification.Message @router /webhook [post]

Types

type Bootstrapper

type Bootstrapper struct{}

Bootstrapper implements bootstrap.Bootstrapper.

func (Bootstrapper) Bootstrap

func (b Bootstrapper) Bootstrap(ctx map[string]interface{}) error

Bootstrap adds transaction.Repository into context.

type CreateEntityRequest

type CreateEntityRequest struct {
	ReadAccess  []identity.DID              `json:"read_access" swaggertype:"array,string"`
	WriteAccess []identity.DID              `json:"write_access" swaggertype:"array,string"`
	Data        entity.Data                 `json:"data"`
	Attributes  coreapi.AttributeMapRequest `json:"attributes"`
}

CreateEntityRequest holds details for creating Entity Document.

type CreateTransferDetailRequest

type CreateTransferDetailRequest struct {
	DocumentID string               `json:"document_id"`
	Data       transferdetails.Data `json:"data"`
}

CreateTransferDetailRequest is the request body for creating a Transfer Detail

type EntityDataResponse

type EntityDataResponse struct {
	Entity        entity.Data    `json:"entity"`
	Relationships []Relationship `json:"relationships"`
}

EntityDataResponse holds the entity data and Relationships

type EntityResponse

type EntityResponse struct {
	Header     coreapi.ResponseHeader       `json:"header"`
	Data       EntityDataResponse           `json:"data"`
	Attributes coreapi.AttributeMapResponse `json:"attributes"`
}

EntityResponse represents the entity in client API format.

type FundingDataResponse

type FundingDataResponse struct {
	Funding    funding.Data        `json:"funding"`
	Signatures []funding.Signature `json:"signatures"`
}

FundingDataResponse holds funding data and the signatures.

type FundingListResponse

type FundingListResponse struct {
	Header coreapi.ResponseHeader `json:"header"`
	Data   []FundingDataResponse  `json:"data"`
}

FundingListResponse holds the response for funding agreements.

type FundingRequest

type FundingRequest struct {
	Data funding.Data `json:"data"`
}

FundingRequest is the request payload for funding operations.

type FundingResponse

type FundingResponse struct {
	Header coreapi.ResponseHeader `json:"header"`
	Data   FundingDataResponse    `json:"data"`
}

FundingResponse holds the response for funding operations.

type NFTMintInvoiceUnpaidRequest

type NFTMintInvoiceUnpaidRequest struct {
	// Deposit address for NFT Token created
	DepositAddress common.Address `json:"deposit_address" swaggertype:"primitive,string"`
}

NFTMintInvoiceUnpaidRequest is the request for minting an NFT for an unpaid NFT

type NFTMintResponse

type NFTMintResponse struct {
	Header *ResponseHeader `json:"header"`
}

NFTMintResponse is response from user api NFT minting

type Relationship

type Relationship struct {
	TargetIdentity   identity.DID       `json:"target_identity" swaggertype:"primitive,string"`
	OwnerIdentity    identity.DID       `json:"owner_identity" swaggertype:"primitive,string"`
	EntityIdentifier byteutils.HexBytes `json:"entity_identifier" swaggertype:"primitive,string"`
	Active           bool               `json:"active"`
}

Relationship holds the identity and status of the relationship

type ResponseHeader

type ResponseHeader struct {
	JobID string `json:"job_id"`
}

ResponseHeader header with job id

type Service

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

Service provides functionality for User APIs.

func (Service) CreateEntity

func (s Service) CreateEntity(ctx context.Context, req CreateEntityRequest) (documents.Model, jobs.JobID, error)

CreateEntity creates Entity document and anchors it.

func (Service) CreateFundingAgreement

func (s Service) CreateFundingAgreement(ctx context.Context, docID []byte, data *funding.Data) (documents.Model, jobs.JobID, error)

CreateFundingAgreement creates a new funding agreement on a document and anchors the document.

func (Service) CreateTransferDetail

CreateTransferDetail creates and anchors a Transfer Detail

func (Service) GetCurrentTransferDetail

func (s Service) GetCurrentTransferDetail(ctx context.Context, docID, transferID []byte) (*transferdetails.TransferDetail, documents.Model, error)

GetCurrentTransferDetail returns the current version on a Transfer Detail

func (Service) GetCurrentTransferDetailsList

func (s Service) GetCurrentTransferDetailsList(ctx context.Context, docID []byte) (*transferdetails.TransferDetailList, documents.Model, error)

GetCurrentTransferDetailsList returns a list of Transfer Details on the current version of a document

func (Service) GetEntity

func (s Service) GetEntity(ctx context.Context, docID []byte) (documents.Model, error)

GetEntity returns the Entity associated with docID.

func (Service) GetEntityByRelationship

func (s Service) GetEntityByRelationship(ctx context.Context, docID []byte) (documents.Model, error)

GetEntityByRelationship returns an entity through a relationship ID.

func (Service) GetVersionTransferDetail

func (s Service) GetVersionTransferDetail(ctx context.Context, docID, versionID, transferID []byte) (*transferdetails.TransferDetail, documents.Model, error)

GetVersionTransferDetail returns a Transfer Detail on a particular version of a Document

func (Service) GetVersionTransferDetailsList

func (s Service) GetVersionTransferDetailsList(ctx context.Context, docID, versionID []byte) (*transferdetails.TransferDetailList, documents.Model, error)

GetVersionTransferDetailsList returns a list of Transfer Details on a particular version of a Document

func (Service) RevokeRelationship

func (s Service) RevokeRelationship(ctx context.Context, docID []byte, req ShareEntityRequest) (documents.Model, jobs.JobID, error)

RevokeRelationship revokes target_identity's access to entity.

func (Service) ShareEntity

func (s Service) ShareEntity(ctx context.Context, docID []byte, req ShareEntityRequest) (documents.Model, jobs.JobID, error)

ShareEntity shares an entity relationship document with target identity.

func (Service) UpdateEntity

func (s Service) UpdateEntity(ctx context.Context, docID []byte, req CreateEntityRequest) (documents.Model, jobs.JobID, error)

UpdateEntity updates existing entity associated with docID with provided data and anchors it.

func (Service) UpdateTransferDetail

UpdateTransferDetail updates and anchors a Transfer Detail

type ShareEntityRequest

type ShareEntityRequest struct {
	TargetIdentity identity.DID `json:"target_identity" swaggertype:"primitive,string"`
}

ShareEntityRequest holds the documentID and target identity to share entity with.

type ShareEntityResponse

type ShareEntityResponse struct {
	Header       coreapi.ResponseHeader `json:"header"`
	Relationship Relationship           `json:"relationship"`
}

ShareEntityResponse holds the response for entity share.

type TransferDetailListResponse

type TransferDetailListResponse struct {
	Header coreapi.ResponseHeader `json:"header"`
	Data   []transferdetails.Data `json:"data"`
}

TransferDetailListResponse is the response body when fetching a list of Transfer Details

type TransferDetailResponse

type TransferDetailResponse struct {
	Header coreapi.ResponseHeader `json:"header"`
	Data   transferdetails.Data   `json:"data"`
}

TransferDetailResponse is the response body when fetching a Transfer Detail

type UpdateTransferDetailRequest

type UpdateTransferDetailRequest struct {
	DocumentID string               `json:"document_id"`
	TransferID string               `json:"transfer_id"`
	Data       transferdetails.Data `json:"data"`
}

UpdateTransferDetailRequest is the request body for updating a Transfer Detail

Jump to

Keyboard shortcuts

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