endpoint

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2016 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Overview

Package endpoint provides API endpoints for Documize.

Index

Constants

View Source
const (
	// RoutePrefixPublic used for the unsecured api
	RoutePrefixPublic = "/api/public/"
	// RoutePrefixPrivate used for secured api (requiring api)
	RoutePrefixPrivate = "/api/"
	// RoutePrefixRoot used for unsecured endpoints at root (e.g. robots.txt)
	RoutePrefixRoot = "/"
)

Variables

View Source
var Product core.ProdInfo

Functions

func AcceptSharedFolder

func AcceptSharedFolder(w http.ResponseWriter, r *http.Request)

AcceptSharedFolder records the fact that a user has completed folder onboard process.

func Add

func Add(prefix, path string, methods, queries []string, endPtFn RouteFunc) error

Add an endpoint to those that will be processed when Serve() is called.

func AddAttachments

func AddAttachments(w http.ResponseWriter, r *http.Request)

AddAttachments stores files against a document.

func AddDocumentPage

func AddDocumentPage(w http.ResponseWriter, r *http.Request)

AddDocumentPage inserts new section into document.

func AddFolder

func AddFolder(w http.ResponseWriter, r *http.Request)

AddFolder creates a new folder.

func AddUser

func AddUser(w http.ResponseWriter, r *http.Request)

AddUser is the endpoint that enables an administrator to add a new user for their orgaisation.

func AttachmentDownload

func AttachmentDownload(w http.ResponseWriter, r *http.Request)

AttachmentDownload is the end-point that responds to a request for a particular attachment by sending the requested file to the client.

func Authenticate

func Authenticate(w http.ResponseWriter, r *http.Request)

Authenticate user based up HTTP Authorization header. An encrypted authentication token is issued with an expiry date.

func Authorize

func Authorize(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

Authorize secure API calls by inspecting authentication token. request.Context provides caller user information. Site meta sent back as HTTP custom headers.

func ChangeDocumentPageLevel

func ChangeDocumentPageLevel(w http.ResponseWriter, r *http.Request)

ChangeDocumentPageLevel handles page indent/outdent changes.

func ChangeDocumentPageSequence

func ChangeDocumentPageSequence(w http.ResponseWriter, r *http.Request)

ChangeDocumentPageSequence will swap page sequence for a given number of pages.

func ChangeUserPassword

func ChangeUserPassword(w http.ResponseWriter, r *http.Request)

ChangeUserPassword accepts password change from within the app.

func DeleteAttachment

func DeleteAttachment(w http.ResponseWriter, r *http.Request)

DeleteAttachment is an endpoint that deletes a particular document attachment.

func DeleteDocument

func DeleteDocument(w http.ResponseWriter, r *http.Request)

DeleteDocument is an endpoint that deletes a document specified by documentID.

func DeleteDocumentPage

func DeleteDocumentPage(w http.ResponseWriter, r *http.Request)

DeleteDocumentPage deletes a page.

func DeleteDocumentPages

func DeleteDocumentPages(w http.ResponseWriter, r *http.Request)

DeleteDocumentPages batch deletes pages.

func DeleteUser

func DeleteUser(w http.ResponseWriter, r *http.Request)

DeleteUser is the endpoint to delete a user specified by userID, the caller must be an Administrator.

func ForgotUserPassword

func ForgotUserPassword(w http.ResponseWriter, r *http.Request)

ForgotUserPassword initiates the change password procedure. Generates a reset token and sends email to the user. User has to click link in email and then provide a new password.

func GetAttachments

func GetAttachments(w http.ResponseWriter, r *http.Request)

GetAttachments is an end-point that returns all of the attachments of a particular documentID.

func GetDocument

func GetDocument(w http.ResponseWriter, r *http.Request)

GetDocument is an endpoint that returns the document-level information for a given documentID.

func GetDocumentAsDocx

func GetDocumentAsDocx(w http.ResponseWriter, r *http.Request)

GetDocumentAsDocx returns a Word document.

func GetDocumentMeta

func GetDocumentMeta(w http.ResponseWriter, r *http.Request)

GetDocumentMeta is an endpoint returning the metadata for a document.

func GetDocumentPage

func GetDocumentPage(w http.ResponseWriter, r *http.Request)

GetDocumentPage gets specified page for document.

func GetDocumentPageMeta

func GetDocumentPageMeta(w http.ResponseWriter, r *http.Request)

GetDocumentPageMeta gets page meta data for specified document page.

func GetDocumentPages

func GetDocumentPages(w http.ResponseWriter, r *http.Request)

GetDocumentPages gets all pages for document.

func GetDocumentPagesBatch

func GetDocumentPagesBatch(w http.ResponseWriter, r *http.Request)

GetDocumentPagesBatch gets specified pages for document.

func GetDocumentsByFolder

func GetDocumentsByFolder(w http.ResponseWriter, r *http.Request)

GetDocumentsByFolder is an endpoint that returns the documents in a given folder.

func GetDocumentsByTag

func GetDocumentsByTag(w http.ResponseWriter, r *http.Request)

GetDocumentsByTag is an endpoint that returns the documents with a given tag.

func GetFolder

func GetFolder(w http.ResponseWriter, r *http.Request)

GetFolder returns the requested folder.

func GetFolderPermissions

func GetFolderPermissions(w http.ResponseWriter, r *http.Request)

GetFolderPermissions returns user permissions for the requested folder.

func GetFolderUsers

func GetFolderUsers(w http.ResponseWriter, r *http.Request)

GetFolderUsers returns every user within a given space

func GetFolderVisibility

func GetFolderVisibility(w http.ResponseWriter, r *http.Request)

GetFolderVisibility returns the users that can see the shared folders.

func GetFolders

func GetFolders(w http.ResponseWriter, r *http.Request)

GetFolders returns the folders the user can see.

func GetMeta

func GetMeta(w http.ResponseWriter, r *http.Request)

GetMeta provides org meta data based upon request domain (e.g. acme.documize.com).

func GetOrganization

func GetOrganization(w http.ResponseWriter, r *http.Request)

GetOrganization returns the requested organization.

func GetOrganizationUsers

func GetOrganizationUsers(w http.ResponseWriter, r *http.Request)

GetOrganizationUsers is the endpoint that allows administrators to view the users in their organisation.

func GetRobots

func GetRobots(w http.ResponseWriter, r *http.Request)

GetRobots returns robots.txt depending on site configuration. Did we allow anonymouse access?

func GetSavedTemplates

func GetSavedTemplates(w http.ResponseWriter, r *http.Request)

GetSavedTemplates returns all templates saved by the user

func GetSections

func GetSections(w http.ResponseWriter, r *http.Request)

GetSections returns available smart sections.

func GetSitemap

func GetSitemap(w http.ResponseWriter, r *http.Request)

GetSitemap returns URLs that can be indexed. We only include public folders and documents (e.g. can be seen by everyone).

func GetStockTemplates

func GetStockTemplates(w http.ResponseWriter, r *http.Request)

GetStockTemplates returns available templates from the public Documize repository.

func GetUser

func GetUser(w http.ResponseWriter, r *http.Request)

GetUser returns user specified by Id

func GetUserFolderPermissions

func GetUserFolderPermissions(w http.ResponseWriter, r *http.Request)

GetUserFolderPermissions returns folder permission for authenticated user.

func InviteToFolder

func InviteToFolder(w http.ResponseWriter, r *http.Request)

InviteToFolder sends users folder invitation emails.

func RefreshSections

func RefreshSections(w http.ResponseWriter, r *http.Request)

RefreshSections updates document sections where the data is externally sourced.

func Remove

func Remove(prefix, path string, methods, queries []string) error

Remove an endpoint.

func RemoveFolder

func RemoveFolder(w http.ResponseWriter, r *http.Request)

RemoveFolder moves documents to another folder before deleting it

func ResetUserPassword

func ResetUserPassword(w http.ResponseWriter, r *http.Request)

ResetUserPassword stores the newly chosen password for the user.

func RunSectionCommand

func RunSectionCommand(w http.ResponseWriter, r *http.Request)

RunSectionCommand passes UI request to section handler.

func SaveAsTemplate

func SaveAsTemplate(w http.ResponseWriter, r *http.Request)

SaveAsTemplate saves existing document as a template.

func SearchDocuments

func SearchDocuments(w http.ResponseWriter, r *http.Request)

SearchDocuments endpoint takes a list of keywords and returns a list of document references matching those keywords.

func Serve

func Serve(ready chan struct{})

Serve the Documize endpoint.

func SetFolderPermissions

func SetFolderPermissions(w http.ResponseWriter, r *http.Request)

SetFolderPermissions persists specified folder permissions

func StartDocumentFromSavedTemplate

func StartDocumentFromSavedTemplate(w http.ResponseWriter, r *http.Request)

StartDocumentFromSavedTemplate creates new document using a saved document as a template. If template ID is ZERO then we provide an Empty Document as the new document.

func StartDocumentFromStockTemplate

func StartDocumentFromStockTemplate(w http.ResponseWriter, r *http.Request)

StartDocumentFromStockTemplate creates new document using one of the stock templates

func UpdateDocument

func UpdateDocument(w http.ResponseWriter, r *http.Request)

UpdateDocument updates an existing document using the format described in NewDocumentModel() encoded as JSON in the request.

func UpdateDocumentPage

func UpdateDocumentPage(w http.ResponseWriter, r *http.Request)

UpdateDocumentPage will persist changed page and note the fact that this is a new revision. If the page is the first in a document then the corresponding document title will also be changed.

func UpdateFolder

func UpdateFolder(w http.ResponseWriter, r *http.Request)

UpdateFolder processes request to save folder object to the database

func UpdateOrganization

func UpdateOrganization(w http.ResponseWriter, r *http.Request)

UpdateOrganization saves organization amends.

func UpdateUser

func UpdateUser(w http.ResponseWriter, r *http.Request)

UpdateUser is the endpoint to update user information for the given userID. Note that unless they have admin privildges, a user can only update their own information. Also, only admins can update user roles in organisations.

func UploadConvertDocument

func UploadConvertDocument(w http.ResponseWriter, r *http.Request)

UploadConvertDocument is an endpoint to both upload and convert a document

func ValidateAuthToken

func ValidateAuthToken(w http.ResponseWriter, r *http.Request)

ValidateAuthToken checks the auth token and returns the corresponding user.

Types

type RouteFunc

type RouteFunc func(http.ResponseWriter, *http.Request)

RouteFunc describes end-point functions

Directories

Path Synopsis
Package models describes the communication format between JS snd Go.
Package models describes the communication format between JS snd Go.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL