Documentation
¶
Index ¶
- Constants
- type Article
- type ArticleContent
- type ArticleFilter
- type BaseEntity
- type BaseSearch
- type Client
- func (client *Client) FindArticles(query string, filter *ArticleFilter) ([]Article, int, error)
- func (client *Client) GetArticle(id, langId string, version int) (*Article, *ArticleContent, []User, error)
- func (client *Client) GetLanguages() ([]Language, error)
- func (client *Client) GetOrganization() (*Organization, error)
- type Config
- type Filter
- type Language
- type Organization
- type OrganizationMember
- type SortDirection
- type Tag
- type User
Constants ¶
const ( DateFormat = "2006-01-02" SortAscending = SortDirection("asc") SortDescending = SortDirection("desc") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { BaseEntity OrganizationId string `json:"organization_id"` Views uint `json:"views"` WIP int `json:"wip"` Archived string `json:"archived"` Published time.Time `json:"published"` Pinned bool `json:"pinned"` LatestArticleContent *ArticleContent `json:"latest_article_content"` Tags []Tag `json:"tags"` PreviewImage string `json:"preview_image"` }
type ArticleContent ¶
type ArticleContent struct { BaseEntity Title string `json:"title"` Content string `json:"content"` Version int `json:"version"` Commit string `json:"commit"` WIP bool `json:"wip"` ArticleId string `json:"article_id"` LanguageId string `json:"language_id"` UserId string `json:"user_id"` // user who created this commit Authors []User `json:"authors"` }
type ArticleFilter ¶
type ArticleFilter struct { BaseSearch LanguageId string `json:"language_id"` Archived bool `json:"archived"` WIP bool `json:"wip"` ClientAccess bool `json:"client_access"` Preview bool `json:"preview"` PreviewParagraph bool `json:"preview_paragraph"` PreviewImage bool `json:"preview_image"` Title string `json:"title"` Content string `json:"content"` Tags string `json:"tags"` TagIds []string `json:"tag_ids"` AuthorUserIds []string `json:"authors"` Commits string `json:"commits"` PublishedStart time.Time `json:"published_start"` PublishedEnd time.Time `json:"published_end"` SortTitle SortDirection `json:"sort_title"` SortPublished SortDirection `json:"sort_published"` }
type BaseEntity ¶
type BaseSearch ¶
type BaseSearch struct { CreatedStart time.Time `json:"created_start"` CreatedEnd time.Time `json:"created_end"` UpdatedStart time.Time `json:"updated_start"` UpdatedEnd time.Time `json:"updated_end"` SortCreated SortDirection `json:"sort_created"` SortUpdated SortDirection `json:"sort_updated"` Offset int `json:"offset"` Limit int `json:"limit"` }
type Client ¶
type Client struct { ClientId string ClientSecret string Organization string AuthHost string ApiHost string TokenType string AccessToken string ExpiresIn int // TTL in seconds // contains filtered or unexported fields }
Client connects to the Emvi client API.
func NewClient ¶
NewClient returns a new Client instance. For clientId and clientSecret, use the keys generated in the administration by Emvi. For organization pass the organization subdomain (e.g. https://my-orga.emvi.com/ -> my-orga). The config object is optional.
func (*Client) FindArticles ¶
FindArticles finds articles for given query and filter and returns the articles and the total number of results.
func (*Client) GetArticle ¶
func (client *Client) GetArticle(id, langId string, version int) (*Article, *ArticleContent, []User, error)
GetArticle returns an article, its content and authors for given ID, language ID and version. Use version 0 if you want to read the latest version. The language ID and version are optional.
func (*Client) GetLanguages ¶
GetLanguages returns all languages for the organization.
func (*Client) GetOrganization ¶
func (client *Client) GetOrganization() (*Organization, error)
GetOrganization returns the organization.
type Filter ¶
type Filter interface {
// contains filtered or unexported methods
}
Filter is used to filter results.
type Language ¶
type Language struct { BaseEntity OrganizationId string `json:"organization_id"` Name string `json:"name"` Code string `json:"code"` Default bool `json:"default"` }
type Organization ¶
type Organization struct { BaseEntity Name string `json:"name"` NameNormalized string `json:"name_normalized"` Picture string `json:"picture"` Expert bool `json:"expert"` CreateGroupAdmin bool `json:"create_group_admin"` CreateGroupMod bool `json:"create_group_mod"` MemberCount int `json:"member_count"` ArticleCount int `json:"article_count"` }
type OrganizationMember ¶
type OrganizationMember struct { BaseEntity OrganizationId string `json:"organization_id"` UserId string `json:"user_id"` LanguageId string `json:"language_id"` Username string `json:"username"` Phone string `json:"phone"` Mobile string `json:"mobile"` Info string `json:"info"` User *User `json:"user"` }
type SortDirection ¶
type SortDirection string
type Tag ¶
type Tag struct { BaseEntity OrganizationId string `json:"organization_id"` Name string `json:"name"` Usages int `json:"usages"` }
type User ¶
type User struct { BaseEntity Email string `json:"email"` Firstname string `json:"firstname"` Lastname string `json:"lastname"` Language string `json:"language"` Info string `json:"info"` Picture string `json:"picture"` OrganizationMember *OrganizationMember `json:"organization_member"` }