Documentation
¶
Index ¶
- Constants
- type ConfigurationParameter
- type ConfigurationTemplate
- type Link
- type PostRecordResponse
- type PutStoreRequest
- type Record
- type RecordAttachment
- type RecordField
- type RecordRequest
- type RecordRequestAttachment
- type RequestHeader
- type ResponseErr
- type SearchRequest
- type SearchResponse
- type SearchResponseChannel
- type SearchResponseItem
- type ServerClient
- type StoreClient
- func (c *StoreClient) GetRecord(ctx context.Context, id uuid.UUID) (*Record, error)
- func (c *StoreClient) GetRecordAttachment(ctx context.Context, writer io.Writer, recordID, attachmentID uuid.UUID) (int64, error)
- func (c *StoreClient) GetStoreStatus(ctx context.Context) (*StoreStatus, error)
- func (c *StoreClient) PostRecord(ctx context.Context, request *RecordRequest) (*PostRecordResponse, error)
- func (c *StoreClient) Search(ctx context.Context, request *SearchRequest) (*SearchResponseChannel, error)
- func (c *StoreClient) SearchQuery(ctx context.Context, url string) (*SearchResponseChannel, error)
- type StoreStatus
- type User
- type UserClaims
Constants ¶
const (
HeaderKeyOtrisErr = "X-Otris-Eas-Error"
)
const UserClaimsKey = "easclient-user-claims-key"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigurationParameter ¶
type ConfigurationTemplate ¶
type ConfigurationTemplate struct { Name string `json:"name"` Parameters []ConfigurationParameter `json:"parameters"` }
type PostRecordResponse ¶ added in v0.4.0
type PutStoreRequest ¶
type PutStoreRequest struct {
ConfigurationTemplate `json:"configurationTemplate"`
}
type Record ¶
type Record struct { Type string `xml:"type"` Title string `xml:"title"` DocumentType string `xml:"documentType"` MasterId uuid.UUID `xml:"masterId"` ArchiveDateTime time.Time `xml:"archiveDateTime"` ID uuid.UUID `xml:"id"` Version string `xml:"version"` ArchiverLogin string `xml:"archiverLogin"` Archiver string `xml:"archiver"` InitialArchiver string `xml:"initialArchiver"` InitialArchiverLogin string `xml:"initialArchiverLogin"` InitialArchiveDateTime time.Time `xml:"initialArchiveDateTime"` Fields []*RecordField `xml:"field"` Attachments []*RecordAttachment `xml:"attachment"` }
func (*Record) GetHeaderFieldVal ¶ added in v0.7.0
type RecordAttachment ¶
type RecordField ¶ added in v0.7.0
type RecordRequest ¶ added in v0.4.0
type RecordRequest struct { Fields map[string]string Attachments []*RecordRequestAttachment }
type RecordRequestAttachment ¶ added in v0.6.0
type RecordRequestAttachment struct { Name string Path string Size uint64 Register string Author string }
RecordRequestAttachment is used in a RecordRequest to specify spooled attachments to be added to the record.
The EAS expects at least Name and Path to be set.
type RequestHeader ¶
type RequestHeader string
const ( HeaderUser RequestHeader = "x-otris-eas-user" HeaderUserFullname RequestHeader = "x-otris-eas-user-fullname" HeaderTokens RequestHeader = "x-otris-eas-tokens" )
type ResponseErr ¶ added in v0.5.0
type ResponseErr struct { Body []byte // Response is the original error response from the EAS. This may contain // zero values if the EAS did not return a valid error response. Response errorResponse // contains filtered or unexported fields }
func NewResponseErr ¶ added in v0.5.0
func NewResponseErr(msg string, body []byte) *ResponseErr
func (*ResponseErr) Error ¶ added in v0.5.0
func (r *ResponseErr) Error() string
type SearchRequest ¶ added in v0.3.0
type SearchRequest struct { Query string `json:"query"` ItemsPerPage int `json:"itemsPerPage"` StartIndex int `json:"startIndex"` // Sort is the field to sort by Sort string `json:"sort"` // SortOrder is the order to sort by, either "asc" or "desc" SortOrder string `json:"sortOrder"` }
func SearchRequestFromURL ¶ added in v0.3.0
func SearchRequestFromURL(s string) (*SearchRequest, error)
func (SearchRequest) ToQuery ¶ added in v0.3.0
func (request SearchRequest) ToQuery() map[string]string
type SearchResponse ¶ added in v0.3.0
type SearchResponse struct { XMLName xml.Name `xml:"rss"` Version string `xml:"version,attr"` Channel *SearchResponseChannel `xml:"channel"` }
type SearchResponseChannel ¶ added in v0.7.0
type SearchResponseChannel struct { Title string `xml:"title"` Link string `xml:"link"` Description string `xml:"description"` TotalResults int `xml:"totalResults"` ItemsPerPage int `xml:"itemsPerPage"` StartIndex int `xml:"startIndex"` Query struct { Role string `xml:"role,attr"` SearchTerms string `xml:"searchTerms,attr"` StartPage int `xml:"startPage,attr"` } `xml:"Query"` Topn int `xml:"topn"` EffectiveResults int `xml:"effectiveResults"` NextPage string `xml:"nextPage"` Items []*SearchResponseItem `xml:"item"` }
type SearchResponseItem ¶ added in v0.7.0
type SearchResponseItem struct { Title string `xml:"title"` Link string `xml:"link"` Description string `xml:"description"` Score float64 `xml:"score"` ExplainLink Link `xml:"explainLink"` VersionLink Link `xml:"versionLink"` HistoryLink Link `xml:"historyLink"` VerifyLink Link `xml:"verifyLink"` DocumentType string `xml:"documentType"` Fields []*RecordField `xml:"field"` MasterId uuid.UUID `xml:"masterId"` ArchiveDateTime time.Time `xml:"archiveDateTime"` Id uuid.UUID `xml:"id"` Version string `xml:"version"` ArchiverLogin string `xml:"archiverLogin"` Archiver string `xml:"archiver"` InitialArchiver string `xml:"initialArchiver"` InitialArchiverLogin string `xml:"initialArchiverLogin"` InitialArchiveDateTime time.Time `xml:"initialArchiveDateTime"` }
type ServerClient ¶
type ServerClient struct {
// contains filtered or unexported fields
}
func NewServerClient ¶
func NewServerClient(c *resty.Client) *ServerClient
NewServerClient creates a new client for server interaction.
func (*ServerClient) PutStore ¶
func (c *ServerClient) PutStore(ctx context.Context, storeName string, request *PutStoreRequest) error
type StoreClient ¶
type StoreClient struct {
// contains filtered or unexported fields
}
func NewStoreClient ¶
func NewStoreClient(c *resty.Client) *StoreClient
NewStoreClient creates a new client for store interaction.
func (*StoreClient) GetRecordAttachment ¶
func (c *StoreClient) GetRecordAttachment(ctx context.Context, writer io.Writer, recordID, attachmentID uuid.UUID) (int64, error)
GetRecordAttachment retrieves the actual attachment. It is written to the given io.Writer.
This returns the number of bytes written and an error if any.
func (*StoreClient) GetStoreStatus ¶
func (c *StoreClient) GetStoreStatus(ctx context.Context) (*StoreStatus, error)
func (*StoreClient) PostRecord ¶ added in v0.4.0
func (c *StoreClient) PostRecord(ctx context.Context, request *RecordRequest) (*PostRecordResponse, error)
func (*StoreClient) Search ¶ added in v0.3.0
func (c *StoreClient) Search(ctx context.Context, request *SearchRequest) (*SearchResponseChannel, error)
func (*StoreClient) SearchQuery ¶ added in v0.3.0
func (c *StoreClient) SearchQuery(ctx context.Context, url string) (*SearchResponseChannel, error)
SearchQuery is similar to Search but expects a URL from which SearchRequest is parsed via SearchRequestFromURL.
type StoreStatus ¶
type StoreStatus struct { XMLName xml.Name `xml:"status"` Registry struct { Records struct { All int `xml:"all"` Indexed int `xml:"indexed"` } `xml:"records"` Attachments struct { All int `xml:"all"` Indexed int `xml:"indexed"` } `xml:"attachments"` } `xml:"registry"` Index struct { Documents int `xml:"documents"` IsCurrent bool `xml:"isCurrent"` HasDeletions bool `xml:"hasDeletions"` } `xml:"index"` }
type User ¶
type User string
User is a custom type to represent one of the four EAS user instances.
const ( // UserAdmin is the administrator which most permissions. UserAdmin User = "eas_administrator" // UserKeeper is responsible for auditing, moderating, etc. UserKeeper User = "eas_keeper" // UserUser is the default user being able to read and write. UserUser User = "eas_user" // UserGuest is a guest user. UserGuest User = "eas_guest" )
type UserClaims ¶
type UserClaims struct { // UserId - Technischer Identifikator des Nutzers, der im Host-System die Anfrage ausgelöst hat. UserId string `json:"user,omitempty"` // UserFullname - Optionaler, vollständiger Name des Nutzers, der im Host-System die Anfrage ausgelöst hat UserFullname string `json:"user_fullname,omitempty"` // Tokens - Securitytokens (Gruppenzugehörigkeit) -getrennt durch Kommata- des Nutzers, der im Host-System den Request // ausgelöst hat. Tokens []string `json:"tokens,omitempty"` }
UserClaims aggregates all claims that are scoped to an EAS archive user.
func NewUserClaims ¶
func NewUserClaims(userId string) *UserClaims
func UserClaimsFromContext ¶
func UserClaimsFromContext(ctx context.Context) *UserClaims
func (*UserClaims) SetOnContext ¶
func (claims *UserClaims) SetOnContext(ctx context.Context) context.Context
func (*UserClaims) SetOnHeader ¶
func (claims *UserClaims) SetOnHeader(header http.Header)
SetOnHeader sets all possible eas.RequestHeader based on this UserClaims