Documentation
¶
Index ¶
- Constants
- Variables
- type Capabilities
- type Config
- type ErrorMessageResponse
- type InviteAcceptedRequest
- type NewShareRequest
- type NewShareResponse
- type Notification
- type NotificationRequest
- type OCMClient
- func (c *OCMClient) Discovery(ctx context.Context, endpoint string) (*Capabilities, error)
- func (c *OCMClient) InviteAccepted(ctx context.Context, endpoint string, r *InviteAcceptedRequest) (*User, error)
- func (c *OCMClient) NewShare(ctx context.Context, endpoint string, r *NewShareRequest) (*NewShareResponse, error)
- func (c *OCMClient) NotifyRemote(ctx context.Context, endpoint string, r *NotificationRequest) error
- type User
- type ValidationError
Constants ¶
const ( SHARE_UNSHARED = "SHARE_UNSHARED" SHARE_CHANGE_PERMISSION = "SHARE_CHANGE_PERMISSION" )
https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1notifications/post NotificationType one of "SHARE_ACCEPTED", "SHARE_DECLINED", "SHARE_CHANGE_PERMISSION", "SHARE_UNSHARED", "USER_REMOVED"
Variables ¶
var ErrInvalidParameters = errors.New("invalid parameters")
ErrInvalidParameters is the error returned by the shares endpoint when the request does not contain required properties.
var ErrServiceNotTrusted = errors.New("service is not trusted to accept invitations")
ErrServiceNotTrusted is the error returned by the invite-accepted endpoint when the service is not trusted to accept invitations.
var ErrTokenInvalid = errors.New("the invitation token is invalid")
ErrTokenInvalid is the error returned by the invite-accepted endpoint when the token is not valid.
var ErrTokenNotFound = errors.New("token not found")
ErrTokenNotFound is the error returned by the invite-accepted endpoint when the request is done using a not existing token.
var ErrUserAlreadyAccepted = errors.New("user already accepted an invitation token")
ErrUserAlreadyAccepted is the error returned by the invite-accepted endpoint when a user is already know by the remote cloud.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct { Enabled bool `json:"enabled"` APIVersion string `json:"apiVersion"` EndPoint string `json:"endPoint"` Provider string `json:"provider"` ResourceTypes []struct { Name string `json:"name"` ShareTypes []string `json:"shareTypes"` Protocols struct { Webdav *string `json:"webdav"` Webapp *string `json:"webapp"` Datatx *string `json:"datatx"` } `json:"protocols"` } `json:"resourceTypes"` Capabilities []string `json:"capabilities"` }
Capabilities contains a set of properties exposed by a remote cloud storage.
type ErrorMessageResponse ¶ added in v2.27.5
type ErrorMessageResponse struct { Message string `json:"message"` ValidationErrors []*ValidationError `json:"validationErrors,omitempty"` }
ErrorMessageResponse is the response returned by the OCM API in case of an error. https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1notifications/post
type InviteAcceptedRequest ¶
type InviteAcceptedRequest struct { UserID string `json:"userID"` Email string `json:"email"` Name string `json:"name"` RecipientProvider string `json:"recipientProvider"` Token string `json:"token"` }
InviteAcceptedRequest contains the parameters for accepting an invitation.
type NewShareRequest ¶
type NewShareRequest struct {}
NewShareRequest contains the parameters for creating a new OCM share.
type NewShareResponse ¶
type NewShareResponse struct {
}NewShareResponse is the response returned when creating a new share.
type Notification ¶ added in v2.27.5
type Notification struct { // Owner string `json:"owner,omitempty"` Grantee string `json:"grantee,omitempty"` Protocols ocmd.Protocols `json:"protocol,omitempty"` }
Notification is the payload for the notification field in the NotificationRequest.
type NotificationRequest ¶ added in v2.27.5
type NotificationRequest struct { NotificationType string `json:"notificationType" validate:"required"` ResourceType string `json:"resourceType" validate:"required"` // Identifier to identify the shared resource at the provider side. This is unique per provider such that if the same resource is shared twice, this providerId will not be repeated. ProviderId string `json:"providerId" validate:"required"` // Optional additional parameters, depending on the notification and the resource type. Notification *Notification `json:"notification,omitempty"` }
NotificationRequest is the request payload for the OCM API notifications endpoint. https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1notifications/post
type OCMClient ¶
type OCMClient struct {
// contains filtered or unexported fields
}
OCMClient is the client for an OCM provider.
func (*OCMClient) Discovery ¶
Discovery returns a number of properties used to discover the capabilities offered by a remote cloud storage. https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1ocm-provider/get
func (*OCMClient) InviteAccepted ¶
func (c *OCMClient) InviteAccepted(ctx context.Context, endpoint string, r *InviteAcceptedRequest) (*User, error)
InviteAccepted informs the sender that the invitation was accepted to start sharing https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1invite-accepted/post
func (*OCMClient) NewShare ¶
func (c *OCMClient) NewShare(ctx context.Context, endpoint string, r *NewShareRequest) (*NewShareResponse, error)
NewShare creates a new share. https://github.com/cs3org/OCM-API/blob/develop/spec.yaml
func (*OCMClient) NotifyRemote ¶ added in v2.27.5
func (c *OCMClient) NotifyRemote(ctx context.Context, endpoint string, r *NotificationRequest) error
NotifyRemote sends a notification to a remote OCM instance. Send a notification to a remote party about a previously known entity Notifications are optional messages. They are expected to be used to inform the other party about a change about a previously known entity, such as a share or a trusted user. For example, a notification MAY be sent by a recipient to let the provider know that the recipient declined a share. In this case, the provider site MAY mark the share as declined for its user(s). Similarly, it MAY be sent by a provider to let the recipient know that the provider removed a given share, such that the recipient MAY clean it up from its database. A notification MAY also be sent to let a recipient know that the provider removed that recipient from the list of trusted users, along with any related share. The recipient MAY reciprocally remove that provider from the list of trusted users, along with any related share. https://cs3org.github.io/OCM-API/docs.html?branch=develop&repo=OCM-API&user=cs3org#/paths/~1notifications/post
type User ¶
type User struct { UserID string `json:"userID"` Email string `json:"email"` Name string `json:"name"` }
User contains the remote user's information when accepting an invitation.
type ValidationError ¶ added in v2.27.5
ValidationError is the payload for the validationErrors field in the ErrorMessageResponse.