Documentation
¶
Overview ¶
Package sieve implements JMAP Sieve Scripts (RFC 9661).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Capability ¶
type Capability struct {
// Implementation is the name of the server's Sieve implementation.
Implementation string `json:"implementation"`
// MaxSizeScript is the maximum size of a Sieve script in octets.
MaxSizeScript uint64 `json:"maxSizeScript"`
// MaxNumberScripts is the maximum number of Sieve scripts allowed.
MaxNumberScripts uint64 `json:"maxNumberScripts"`
// MaxNumberRedirects is the maximum number of redirect actions.
MaxNumberRedirects uint64 `json:"maxNumberRedirects"`
// SieveExtensions lists the supported Sieve extensions.
SieveExtensions []string `json:"sieveExtensions"`
// NotificationMethods lists the supported notification method URIs.
NotificationMethods []string `json:"notificationMethods,omitempty"`
// ExternalLists lists the supported external list URIs.
ExternalLists []string `json:"externalLists,omitempty"`
}
Capability represents the urn:ietf:params:jmap:sieve capability (RFC 9661 Section 2).
type Script ¶
type Script struct {
// ID is the server-assigned identifier for this script.
ID jmap.ID `json:"id,omitempty"`
// Name is the user-visible name of the script.
Name *string `json:"name,omitempty"`
// BlobID is the identifier for the blob containing the script content.
BlobID *jmap.ID `json:"blobId,omitempty"`
// IsActive indicates whether this script is the active script.
IsActive bool `json:"isActive,omitempty"`
}
Script represents a JMAP Script object (RFC 9661 Section 3).
type ScriptFilter ¶
type ScriptFilter struct {
// Name filters by script name (substring match).
Name *string `json:"name,omitempty"`
// IsActive filters by active status.
IsActive *bool `json:"isActive,omitempty"`
}
ScriptFilter is a filter for Script/query (RFC 9661 Section 4).
type ScriptGet ¶
type ScriptGet struct {
// AccountID is the account to query.
AccountID jmap.ID `json:"accountId"`
// IDs is the list of Script IDs to retrieve. If nil, all are returned.
IDs []jmap.ID `json:"ids,omitempty"`
// Properties lists the properties to include. If nil, all are returned.
Properties []string `json:"properties,omitempty"`
}
ScriptGet is the Script/get method (RFC 9661 Section 4).
type ScriptGetResponse ¶
type ScriptGetResponse struct {
// AccountID is the account this response is for.
AccountID jmap.ID `json:"accountId"`
// State is the current state string for this data type.
State string `json:"state"`
// List contains the requested Script objects.
List []*Script `json:"list"`
// NotFound contains IDs that were not found.
NotFound []jmap.ID `json:"notFound"`
}
ScriptGetResponse is the response to Script/get.
func (*ScriptGetResponse) Name ¶
func (r *ScriptGetResponse) Name() string
Name implements jmap.MethodResponse.
type ScriptQuery ¶
type ScriptQuery struct {
// AccountID is the account to query.
AccountID jmap.ID `json:"accountId"`
// Filter specifies conditions for the query.
Filter *ScriptFilter `json:"filter,omitempty"`
// Sort specifies the sort order for results.
Sort []*ScriptSort `json:"sort,omitempty"`
// Position is the zero-based index of the first result to return.
Position int64 `json:"position,omitempty"`
// Anchor is the ID of an item to use as the position reference.
Anchor *jmap.ID `json:"anchor,omitempty"`
// AnchorOffset is the offset from the anchor to the first result.
AnchorOffset int64 `json:"anchorOffset,omitempty"`
// Limit is the maximum number of results to return.
Limit *uint64 `json:"limit,omitempty"`
// CalculateTotal requests the server include a total count.
CalculateTotal bool `json:"calculateTotal,omitempty"`
}
ScriptQuery is the Script/query method (RFC 9661 Section 4).
func (*ScriptQuery) Requires ¶
func (m *ScriptQuery) Requires() []jmap.URI
Requires implements jmap.Method.
type ScriptQueryResponse ¶
type ScriptQueryResponse struct {
// AccountID is the account this response is for.
AccountID jmap.ID `json:"accountId"`
// QueryState is the current state of the query.
QueryState string `json:"queryState"`
// CanCalculateChanges indicates if the server supports queryChanges.
CanCalculateChanges bool `json:"canCalculateChanges"`
// Position is the zero-based index of the first result returned.
Position uint64 `json:"position"`
// IDs contains the IDs of the matching Script objects.
IDs []jmap.ID `json:"ids"`
// Total is the total number of matching results, if requested.
Total *uint64 `json:"total,omitempty"`
// Limit is the limit that was applied to the query.
Limit *uint64 `json:"limit,omitempty"`
}
ScriptQueryResponse is the response to Script/query.
func (*ScriptQueryResponse) Name ¶
func (r *ScriptQueryResponse) Name() string
Name implements jmap.MethodResponse.
type ScriptSet ¶
type ScriptSet struct {
// AccountID is the account to modify.
AccountID jmap.ID `json:"accountId"`
// IfInState only applies changes if the current state matches.
IfInState *string `json:"ifInState,omitempty"`
// Create maps creation IDs to Script objects to create.
Create map[jmap.ID]*Script `json:"create,omitempty"`
// Update maps Script IDs to patch objects.
Update map[jmap.ID]*jmap.Patch `json:"update,omitempty"`
// Destroy is a list of Script IDs to destroy.
Destroy []jmap.ID `json:"destroy,omitempty"`
// OnSuccessActivateScript is the ID of the script to activate after
// a successful set operation. Use the creation ID prefixed with "#"
// to reference a newly created script. If nil, no activation change
// is made.
OnSuccessActivateScript *jmap.ID `json:"onSuccessActivateScript,omitempty"`
}
ScriptSet is the Script/set method (RFC 9661 Section 4).
type ScriptSetResponse ¶
type ScriptSetResponse struct {
// AccountID is the account this response is for.
AccountID jmap.ID `json:"accountId"`
// OldState is the state before the changes.
OldState string `json:"oldState"`
// NewState is the state after the changes.
NewState string `json:"newState"`
// Created maps creation IDs to created Script objects.
Created map[jmap.ID]*Script `json:"created,omitempty"`
// Updated maps Script IDs to updated Script objects.
Updated map[jmap.ID]*Script `json:"updated,omitempty"`
// Destroyed contains IDs of destroyed Scripts.
Destroyed []jmap.ID `json:"destroyed,omitempty"`
// NotCreated maps creation IDs to errors.
NotCreated map[jmap.ID]*jmap.SetError `json:"notCreated,omitempty"`
// NotUpdated maps Script IDs to errors.
NotUpdated map[jmap.ID]*jmap.SetError `json:"notUpdated,omitempty"`
// NotDestroyed maps Script IDs to errors.
NotDestroyed map[jmap.ID]*jmap.SetError `json:"notDestroyed,omitempty"`
}
ScriptSetResponse is the response to Script/set.
func (*ScriptSetResponse) Name ¶
func (r *ScriptSetResponse) Name() string
Name implements jmap.MethodResponse.
type ScriptSort ¶
type ScriptSort struct {
// Property is the Script property to sort by.
Property string `json:"property"`
// IsAscending controls sort direction. Default is true.
IsAscending *bool `json:"isAscending,omitempty"`
}
ScriptSort defines the sort order for Script/query results.
type ScriptValidate ¶
type ScriptValidate struct {
// AccountID is the account to validate against.
AccountID jmap.ID `json:"accountId"`
// BlobID is the identifier for the blob containing the script to validate.
BlobID jmap.ID `json:"blobId"`
}
ScriptValidate is the SieveScript/validate method (RFC 9661 Section 4).
func (*ScriptValidate) Requires ¶
func (m *ScriptValidate) Requires() []jmap.URI
Requires implements jmap.Method.
type ScriptValidateResponse ¶
type ScriptValidateResponse struct {
// AccountID is the account this response is for.
AccountID jmap.ID `json:"accountId"`
// Error is nil if the script is valid, or a SetError describing the problem.
Error *jmap.SetError `json:"error"`
}
ScriptValidateResponse is the response to SieveScript/validate.
func (*ScriptValidateResponse) Name ¶
func (r *ScriptValidateResponse) Name() string
Name implements jmap.MethodResponse.