Documentation ¶
Index ¶
- func GetAccessToken(config *Config) (string, error)
- func RemoveTokenInfos() error
- func SaveTokenInfos(infos *TokenInfos) error
- type ApiInfoResponse
- type AuthRealmResponse
- type Client
- func (k *Client) CreateDocument(doc *DocumentResponse) (*DocumentResponse, error)
- func (k *Client) CreateJob(job *JobRequest) (*JobResponse, error)
- func (k *Client) CreateLabel(label *LabelResponse) (*LabelResponse, error)
- func (k *Client) CreateWebhook(webhook *WebhookResponse) (*WebhookResponse, error)
- func (k *Client) Delete(url string, query *url.Values) (*http.Response, error)
- func (k *Client) DestroyDocument(docid string) error
- func (k *Client) DestroyLabel(id string) error
- func (k *Client) Do(r *Request) (*http.Response, error)
- func (k *Client) DownloadExport(out *os.File) error
- func (k *Client) EmptyGraveyard() error
- func (k *Client) Get(url string, query *url.Values) (*http.Response, error)
- func (k *Client) GetApiInfo() (*ApiInfoResponse, error)
- func (k *Client) GetDocument(docid string) (*DocumentResponse, error)
- func (k *Client) GetDocuments(query string, order string, size int, from int) ([]DocumentResponse, error)
- func (k *Client) GetExportStatus(out io.Writer) error
- func (k *Client) GetGraveyard() ([]DocumentResponse, error)
- func (k *Client) GetJob(id string) (*JobResponse, error)
- func (k *Client) GetJobsInfos() (*JobsInfosResponse, error)
- func (k *Client) GetLabel(id string) (*LabelResponse, error)
- func (k *Client) GetLabels() ([]LabelResponse, error)
- func (k *Client) GetProfile() (*ProfileResponse, error)
- func (k *Client) GetServerInfos() (*ServerInfosResponse, error)
- func (k *Client) GetUser(uid string) (*UserResponse, error)
- func (k *Client) GetUsers() ([]UserResponse, error)
- func (k *Client) GetWebhook(id string) (*WebhookResponse, error)
- func (k *Client) GetWebhooks() ([]WebhookResponse, error)
- func (k *Client) Login(username string, password string) (*TokenInfos, error)
- func (k *Client) Post(url string, query *url.Values, body io.Reader) (*http.Response, error)
- func (k *Client) PostForm(url string, query *url.Values, form *url.Values) (*http.Response, error)
- func (k *Client) Put(url string, query *url.Values, body io.Reader) (*http.Response, error)
- func (k *Client) RemoveDocument(docid string) error
- func (k *Client) RemoveLabel(id string) error
- func (k *Client) RemoveWebhook(id string) error
- func (k *Client) RestoreDocument(docid string) (*DocumentResponse, error)
- func (k *Client) RestoreLabel(id string) (*LabelResponse, error)
- func (k *Client) ScheduleExport() error
- func (k *Client) UpdateWebhook(id string, webhook *WebhookResponse) (*WebhookResponse, error)
- type Config
- type Credentials
- type DocumentResponse
- type DocumentsResponse
- type Href
- type JobRequest
- type JobResponse
- type JobsInfosResponse
- type LabelResponse
- type LabelsResponse
- type ProfileResponse
- type Request
- type ServerInfosResponse
- type TokenInfos
- type UserResponse
- type WebhookResponse
- type WebhooksResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAccessToken ¶
func RemoveTokenInfos ¶
func RemoveTokenInfos() error
func SaveTokenInfos ¶
func SaveTokenInfos(infos *TokenInfos) error
Types ¶
type ApiInfoResponse ¶
type AuthRealmResponse ¶
type AuthRealmResponse struct { Realm string `json:realm` TokenService string `json:"token-service"` }
func GetAuthRealm ¶
func GetAuthRealm(authRealm string) (*AuthRealmResponse, error)
type Client ¶
type Client struct {
Config *Config
}
func NewAPIClient ¶
NewAPIClient returns new API client instance
func (*Client) CreateDocument ¶
func (k *Client) CreateDocument(doc *DocumentResponse) (*DocumentResponse, error)
func (*Client) CreateJob ¶
func (k *Client) CreateJob(job *JobRequest) (*JobResponse, error)
func (*Client) CreateLabel ¶
func (k *Client) CreateLabel(label *LabelResponse) (*LabelResponse, error)
func (*Client) CreateWebhook ¶
func (k *Client) CreateWebhook(webhook *WebhookResponse) (*WebhookResponse, error)
CreateWebhook Create a webhook
func (*Client) DestroyDocument ¶
func (*Client) DestroyLabel ¶
func (*Client) DownloadExport ¶
DownloadExport Download export file
func (*Client) EmptyGraveyard ¶
func (*Client) GetApiInfo ¶
func (k *Client) GetApiInfo() (*ApiInfoResponse, error)
func (*Client) GetDocument ¶
func (k *Client) GetDocument(docid string) (*DocumentResponse, error)
func (*Client) GetDocuments ¶
func (*Client) GetExportStatus ¶
GetExportStatus Get export status
func (*Client) GetGraveyard ¶
func (k *Client) GetGraveyard() ([]DocumentResponse, error)
func (*Client) GetJobsInfos ¶
func (k *Client) GetJobsInfos() (*JobsInfosResponse, error)
func (*Client) GetLabels ¶
func (k *Client) GetLabels() ([]LabelResponse, error)
func (*Client) GetProfile ¶
func (k *Client) GetProfile() (*ProfileResponse, error)
func (*Client) GetServerInfos ¶
func (k *Client) GetServerInfos() (*ServerInfosResponse, error)
func (*Client) GetUsers ¶
func (k *Client) GetUsers() ([]UserResponse, error)
func (*Client) GetWebhook ¶
func (k *Client) GetWebhook(id string) (*WebhookResponse, error)
GetWebhook Get a webhook
func (*Client) GetWebhooks ¶
func (k *Client) GetWebhooks() ([]WebhookResponse, error)
GetWebhooks Get webhook list
func (*Client) Login ¶
func (k *Client) Login(username string, password string) (*TokenInfos, error)
func (*Client) RemoveDocument ¶
func (*Client) RemoveLabel ¶
func (*Client) RemoveWebhook ¶
RemoveWebhook Delete a webhook
func (*Client) RestoreDocument ¶
func (k *Client) RestoreDocument(docid string) (*DocumentResponse, error)
func (*Client) RestoreLabel ¶
func (k *Client) RestoreLabel(id string) (*LabelResponse, error)
func (*Client) ScheduleExport ¶
ScheduleExport Schedule a new export
func (*Client) UpdateWebhook ¶
func (k *Client) UpdateWebhook(id string, webhook *WebhookResponse) (*WebhookResponse, error)
UpdateWebhook Update a webhook
type Config ¶
type Config struct { Endpoint string ClientId string ClientSecret string Credentials *TokenInfos }
type Credentials ¶
type DocumentResponse ¶
type DocumentResponse struct { Id string `json:"id,omitempty"` Title string `json:"title,omitempty"` Content string `json:"content,omitempty"` ContentType string `json:"contentType,omitempty"` Origin string `json:"origin,omitempty"` Date string `json:"date,omitempty"` Owner string `json:"owner,omitempty"` Ghost bool `json:"ghost,omitempty"` }
type DocumentsResponse ¶
type DocumentsResponse struct {
Documents []DocumentResponse `json:"hits"`
}
type JobRequest ¶
type JobRequest struct { Type string `json:"type"` Data interface{} `json:"data"` }
type JobResponse ¶
type JobResponse struct { Id string `json:"id"` Type string `json:"type"` Data interface{} `json:"data"` Priority int `json:"priority"` Progress string `json:"progress"` State string `json:"state"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Duration string `json:"duration"` }
type JobsInfosResponse ¶
type LabelResponse ¶
type LabelsResponse ¶
type LabelsResponse struct {
Labels []LabelResponse
}
type ProfileResponse ¶
type ServerInfosResponse ¶
type TokenInfos ¶
type TokenInfos struct { TokenService string `json:"token_service"` TokenType string `json:"token_type"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresIn int `json:"expires_in"` RefreshExpiresIn int `json:"refresh_expires_in"` }
func GetOfflineToken ¶
func GetOfflineToken(tokenServiceUrl string, creds *Credentials) (*TokenInfos, error)
func LoadTokenInfos ¶
func LoadTokenInfos() (*TokenInfos, error)
type UserResponse ¶
type WebhookResponse ¶
type WebhookResponse struct { ID string `json:"id,omitempty"` Owner string `json:"owner,omitempty"` URL string `json:"url,omitempty"` Secret string `json:"secret,omitempty"` Active bool `json:"active,omitempty"` Events []string `json:"events,omitempty"` Labels []string `json:"labels,omitempty"` CreationDate string `json:"cdate,omitempty"` ModificationDate string `json:"mdate,omitempty"` }
WebhookResponse Webhook object response
type WebhooksResponse ¶
type WebhooksResponse struct {
Webhooks []WebhookResponse
}
WebhooksResponse Webhook list response
Click to show internal directories.
Click to hide internal directories.