Documentation ¶
Index ¶
- Constants
- Variables
- func DatasetRefFromReq(prefix string, r *http.Request) (dsref.Ref, error)
- func DsRefFromPath(prefix, path string) (dsref.Ref, error)
- func PathToQriPath(prefix, path string) string
- type APIEndpoint
- type Client
- func (c Client) Call(ctx context.Context, apiEndpoint APIEndpoint, source string, ...) error
- func (c Client) CallMethod(ctx context.Context, apiEndpoint APIEndpoint, httpMethod string, source string, ...) error
- func (c Client) CallMethodRaw(ctx context.Context, apiEndpoint APIEndpoint, httpMethod string, source string, ...) error
- func (c Client) CallRaw(ctx context.Context, apiEndpoint APIEndpoint, source string, ...) error
Constants ¶
const ( // JSONMimeType is the JSON content type header value JSONMimeType = "application/json" // SourceResolver header name SourceResolver = "SourceResolver" )
Variables ¶
var ( // ErrUnsupportedRPC is an error for when running a method that is not supported via HTTP RPC ErrUnsupportedRPC = errors.New("method is not supported over RPC") )
Functions ¶
func DatasetRefFromReq ¶
DatasetRefFromReq examines the path element of a request URL to
func DsRefFromPath ¶
DsRefFromPath parses a path and returns a dsref.Ref
func PathToQriPath ¶
PathToQriPath converts a http path to a qri path
Types ¶
type APIEndpoint ¶
type APIEndpoint string
APIEndpoint is a simple alias to have a consistent definition of our API endpoints
const ( // AEList lists all datasets in your collection AEList APIEndpoint = "/list" // AECollectionGet returns info on a head dataset in your collection AECollectionGet APIEndpoint = "/collection/get" // AEDiff is an endpoint for generating dataset diffs AEDiff APIEndpoint = "/diff" // AEChanges is an endpoint for generating dataset change reports AEChanges APIEndpoint = "/changes" // AECreateAuthToken creates an auth token for a user AECreateAuthToken APIEndpoint = "/access/token" // AEApply invokes a transform apply AEApply APIEndpoint = "/auto/apply" // AEDeploy creates, updates, or deploys a workflow AEDeploy APIEndpoint = "/auto/deploy" // AERun manually runs a workflow AERun APIEndpoint = "/auto/run" // AERunInfo fetches the full run info for a workflow run AERunInfo APIEndpoint = "/auto/runinfo" // AECancel cancels a run AECancel APIEndpoint = "/auto/cancel" // AEWorkflow fetches a workflow AEWorkflow APIEndpoint = "/auto/workflow" // AERemoveWorkflow removes a workflow AERemoveWorkflow APIEndpoint = "/auto/remove" // AEAnalyzeTransform performs static analysis on a starlark transform script AEAnalyzeTransform APIEndpoint = "/auto/analyze-transform" // AEGet is an endpoint for fetch individual dataset components AEGet APIEndpoint = "/ds/get" // AEActivity is an endpoint that returns a dataset activity list AEActivity APIEndpoint = "/ds/activity" // AERename is an endpoint for renaming datasets AERename APIEndpoint = "/ds/rename" // AESave is an endpoint for saving a dataset AESave APIEndpoint = "/ds/save" // AEPull facilittates dataset pull requests from a remote AEPull APIEndpoint = "/ds/pull" // AEPush facilitates dataset push requests to a remote AEPush APIEndpoint = "/ds/push" // AERender renders the current dataset ref AERender APIEndpoint = "/ds/render" // AERemove exposes the dataset remove mechanics AERemove APIEndpoint = "/ds/remove" // AEValidate is an endpoint for validating datasets AEValidate APIEndpoint = "/ds/validate" // AEManifest generates a manifest for a dataset path AEManifest APIEndpoint = "/ds/manifest" // AEManifestMissing generates a manifest of blocks that are not present on this repo for a given manifest AEManifestMissing APIEndpoint = "/ds/manifest/missing" // AEDAGInfo generates a dag.Info for a dataset path AEDAGInfo APIEndpoint = "/ds/daginfo" // AEWhatChanged gets what changed at a specific version in history AEWhatChanged APIEndpoint = "/ds/whatchanged" // AEPeer fetches a specific peer AEPeer APIEndpoint = "/peer" // AEConnect initiates an explicit connection to a peer AEConnect APIEndpoint = "/peer/connect" // AEDisconnect closes an explicit connection to a peer AEDisconnect APIEndpoint = "/peer/disconnect" // AEPeers fetches all the peers AEPeers APIEndpoint = "/peer/list" // AEGetProfile is an alias for the me endpoint AEGetProfile APIEndpoint = "/profile" // AESetProfile is an endpoint to set the profile AESetProfile APIEndpoint = "/profile/set" // AESetProfilePhoto is an endpoint to set the profile photo AESetProfilePhoto APIEndpoint = "/profile/photo" // AESetPosterPhoto is an endpoint to set the profile poster AESetPosterPhoto APIEndpoint = "/profile/poster" // AEFeeds fetches and index of named feeds AEFeeds APIEndpoint = "/remote/feeds" // AEPreview fetches a dataset preview from the registry AEPreview APIEndpoint = "/remote/preview" // AERemoteRemove removes a dataset from a given remote AERemoteRemove APIEndpoint = "/remote/remove" // AERegistryNew creates a new user on the registry AERegistryNew APIEndpoint = "/remote/registry/profile/new" // AERegistryProve links an the current peer with an existing // user on the registry AERegistryProve APIEndpoint = "/remote/registry/profile/prove" // AESearch returns a list of dataset search results AESearch APIEndpoint = "/registry/search" // AERegistryGetFollowing returns a list of datasets a user follows AERegistryGetFollowing APIEndpoint = "/registry/follow/list" // AERegistryFollow updates the follow status of the current user for a given dataset AERegistryFollow APIEndpoint = "/registry/follow" // AERemoteDSync exposes the dsync mechanics AERemoteDSync APIEndpoint = "/remote/dsync" // AERemoteLogSync exposes the logsync mechanics AERemoteLogSync APIEndpoint = "/remote/logsync" // AERemoteRefs exposes the remote ref resolution mechanics AERemoteRefs APIEndpoint = "/remote/refs" // AEConnections lists qri & IPFS connections AEConnections APIEndpoint = "/connections" // AEConnectedQriProfiles lists qri profile connections AEConnectedQriProfiles APIEndpoint = "/connections/qri" // DenyHTTP will disable HTTP access to a method DenyHTTP = APIEndpoint("") )
func (APIEndpoint) NoTrailingSlash ¶
func (ae APIEndpoint) NoTrailingSlash() string
NoTrailingSlash returns the path without a traling slash
func (APIEndpoint) String ¶
func (ae APIEndpoint) String() string
String allows for less casting in general code
func (APIEndpoint) WithSuffix ¶
func (ae APIEndpoint) WithSuffix(suffix string) APIEndpoint
WithSuffix returns a new endpoint with added path suffix
type Client ¶
Client makes remote procedure calls to a qri node over HTTP
func NewClientWithProtocol ¶
NewClientWithProtocol instantiates a new Client with either http or https protocols
func (Client) Call ¶
func (c Client) Call(ctx context.Context, apiEndpoint APIEndpoint, source string, params interface{}, result interface{}) error
Call calls API endpoint and passes on parameters, context info
func (Client) CallMethod ¶
func (c Client) CallMethod(ctx context.Context, apiEndpoint APIEndpoint, httpMethod string, source string, params interface{}, result interface{}) error
CallMethod calls API endpoint and passes on parameters, context info and specific HTTP Method
func (Client) CallMethodRaw ¶
func (c Client) CallMethodRaw(ctx context.Context, apiEndpoint APIEndpoint, httpMethod string, source string, params interface{}, result interface{}) error
CallMethodRaw calls API endpoint and passes on parameters, context info, specific HTTP Method and returns the []byte result