staticapi

package
v0.0.0-...-da9a50a Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPublicationByTitle

func CheckPublicationByTitle(w http.ResponseWriter, r *http.Request, s IServer)

CheckPublicationByTitle checks if a publication with this title exists

func CreatePublication

func CreatePublication(w http.ResponseWriter, r *http.Request, s IServer)

CreatePublication creates a publication in the database

func CreatePurchase

func CreatePurchase(w http.ResponseWriter, r *http.Request, s IServer)

CreatePurchase creates a purchase in the database

func CreateUser

func CreateUser(w http.ResponseWriter, r *http.Request, s IServer)

CreateUser creates a user in the database

func DecodeJSONPublication

func DecodeJSONPublication(r *http.Request) (webpublication.Publication, error)

DecodeJSONPublication transforms a json string to a User struct

func DecodeJSONPurchase

func DecodeJSONPurchase(r *http.Request) (webpurchase.Purchase, error)

DecodeJSONPurchase transforms a json object into an golang object

func DecodeJSONUser

func DecodeJSONUser(r *http.Request) (webuser.User, error)

DecodeJSONUser transforms a json string to a User struct

func DeletePublication

func DeletePublication(w http.ResponseWriter, r *http.Request, s IServer)

DeletePublication removes a publication in the database

func DeleteUser

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

DeleteUser creates a user in the database

func GetDashboardBestSellers

func GetDashboardBestSellers(w http.ResponseWriter, r *http.Request, s IServer)

GetDashboardBestSellers gets the dashboard bestsellers

func GetDashboardInfos

func GetDashboardInfos(w http.ResponseWriter, r *http.Request, s IServer)

GetDashboardInfos searches a publication by its uuid

func GetFilteredLicenses

func GetFilteredLicenses(w http.ResponseWriter, r *http.Request, s IServer)

GetFilteredLicenses searches licenses activated by more than n devices

func GetLicense

func GetLicense(w http.ResponseWriter, r *http.Request, s IServer)

GetLicense gets an existing license by its id (passed as a section of the REST URL). It generates a partial license from the purchase info, fetches the license from the lcp server and returns it to the caller. This API method is called from a link in the license status document.

func GetPublication

func GetPublication(w http.ResponseWriter, r *http.Request, s IServer)

GetPublication returns a publication from its numeric id, given as part of the calling url

func GetPublications

func GetPublications(w http.ResponseWriter, r *http.Request, s IServer)

GetPublications returns a list of publications

func GetPurchase

func GetPurchase(w http.ResponseWriter, r *http.Request, s IServer)

GetPurchase gets a purchase by its id in the database

func GetPurchaseByLicenseID

func GetPurchaseByLicenseID(w http.ResponseWriter, r *http.Request, s IServer)

GetPurchaseByLicenseID gets a purchase by a license id in the database

func GetPurchasedLicense

func GetPurchasedLicense(w http.ResponseWriter, r *http.Request, s IServer)

GetPurchasedLicense generates a new license from the corresponding purchase id (passed as a section of the REST URL). It fetches the license from the lcp server and returns it to the caller. This API method is called from the client app (angular) when a license is requested after a purchase.

func GetPurchases

func GetPurchases(w http.ResponseWriter, r *http.Request, s IServer)

GetPurchases searches all purchases for a client

func GetRepositoryMasterFiles

func GetRepositoryMasterFiles(w http.ResponseWriter, r *http.Request, s IServer)

GetRepositoryMasterFiles returns a list of repository masterfiles

func GetUser

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

GetUser searches a client by his email

func GetUserPurchases

func GetUserPurchases(w http.ResponseWriter, r *http.Request, s IServer)

GetUserPurchases searches all purchases for a client

func GetUsers

func GetUsers(w http.ResponseWriter, r *http.Request, s IServer)

GetUsers returns a list of users

func PrepareListHeaderResponse

func PrepareListHeaderResponse(resourceCount int, resourceLink string, pagination Pagination, w http.ResponseWriter)

PrepareListHeaderResponse set several http headers sets previous and next link headers

func UpdatePublication

func UpdatePublication(w http.ResponseWriter, r *http.Request, s IServer)

UpdatePublication updates an identified publication (id) in the database

func UpdatePurchase

func UpdatePurchase(w http.ResponseWriter, r *http.Request, s IServer)

UpdatePurchase updates a purchase in the database Only updates the license id (uuid), start and end date, status

func UpdateUser

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

UpdateUser updates an identified user (id) in the database

func UploadPublication

func UploadPublication(w http.ResponseWriter, r *http.Request, s IServer)

UploadPublication creates a new publication via a POST request This function is called from the frontend test client

Types

type IServer

type IServer interface {
	RepositoryAPI() webrepository.WebRepository
	PublicationAPI() webpublication.WebPublication
	UserAPI() webuser.WebUser
	PurchaseAPI() webpurchase.WebPurchase
	DashboardAPI() webdashboard.WebDashboard
	LicenseAPI() weblicense.WebLicense
}

IServer defines methods for db interaction

type Pagination

type Pagination struct {
	Page    int
	PerPage int
}

Pagination used to paginate listing

func ExtractPaginationFromRequest

func ExtractPaginationFromRequest(r *http.Request) (Pagination, error)

ExtractPaginationFromRequest extract from http.Request pagination information

Jump to

Keyboard shortcuts

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