Documentation ¶
Index ¶
- Constants
- func APIProviderAsDefault(action web.Action) web.Action
- func CreateImageFromFile(ctx context.Context, mgr *model.Manager, userID int64, shouldValidate bool, ...) (*model.Image, error)
- func GetUser(session *web.Session) *model.User
- func SetUser(session *web.Session, user *model.User)
- type APIResponse
- type APIResponseMeta
- type APIResultProvider
- func (ar *APIResultProvider) BadRequest(err error) web.Result
- func (ar *APIResultProvider) InternalError(err error) web.Result
- func (ar *APIResultProvider) NotAuthorized() web.Result
- func (ar *APIResultProvider) NotFound() web.Result
- func (ar *APIResultProvider) OK() web.Result
- func (ar *APIResultProvider) Result(response interface{}) web.Result
- func (ar *APIResultProvider) Status(statusCode int, data interface{}) web.Result
- type APIs
- type Auth
- type Chart
- type Index
- type Integrations
- type UploadImage
Constants ¶
const ( // OAuthProviderGoogle is the google auth provider. OAuthProviderGoogle = "google" // OAuthProviderFacebook is the facebook auth provider. OAuthProviderFacebook = "facebook" // OAuthProviderSlack is the google auth provider. OAuthProviderSlack = "slack" )
const (
// SessionStateUserKey is the key we store the user in the session state.
SessionStateUserKey = "User"
)
Variables ¶
This section is empty.
Functions ¶
func APIProviderAsDefault ¶
APIProviderAsDefault sets the context.CurrrentProvider() equal to context.API().
func CreateImageFromFile ¶
func CreateImageFromFile(ctx context.Context, mgr *model.Manager, userID int64, shouldValidate bool, fileContents []byte, fileName string, fm *filemanager.FileManager) (*model.Image, error)
CreateImageFromFile creates and uploads a new image.
Types ¶
type APIResponse ¶
type APIResponse struct { Meta *APIResponseMeta Response interface{} }
APIResponse is the standard API response format.
type APIResponseMeta ¶
type APIResponseMeta struct { StatusCode int Message string `json:",omitempty"` Exception *exception.Ex `json:",omitempty"` }
APIResponseMeta is the meta component of a service response.
type APIResultProvider ¶
type APIResultProvider struct {
// contains filtered or unexported fields
}
APIResultProvider are context results for api methods.
func NewAPIResultProvider ¶
func NewAPIResultProvider(r *web.Ctx) *APIResultProvider
NewAPIResultProvider Creates a new JSONResults object.
func (*APIResultProvider) BadRequest ¶
func (ar *APIResultProvider) BadRequest(err error) web.Result
BadRequest returns a service response.
func (*APIResultProvider) InternalError ¶
func (ar *APIResultProvider) InternalError(err error) web.Result
InternalError returns a service response.
func (*APIResultProvider) NotAuthorized ¶
func (ar *APIResultProvider) NotAuthorized() web.Result
NotAuthorized returns a service response.
func (*APIResultProvider) NotFound ¶
func (ar *APIResultProvider) NotFound() web.Result
NotFound returns a service response.
func (*APIResultProvider) OK ¶
func (ar *APIResultProvider) OK() web.Result
OK returns a service response.
func (*APIResultProvider) Result ¶
func (ar *APIResultProvider) Result(response interface{}) web.Result
Result returns a service response.
type APIs ¶
type APIs struct { Log logger.Log Config *config.Giffy Model *model.Manager OAuth *oauth.Manager Files *filemanager.FileManager }
APIs is the controller for api endpoints.
type Integrations ¶
Integrations controller is responsible for integration responses.
func (Integrations) Register ¶
func (i Integrations) Register(app *web.App)
Register registers the controller's actions with the app.
type UploadImage ¶
type UploadImage struct { Log logger.Log Config *config.Giffy Model *model.Manager Files *filemanager.FileManager }
UploadImage is the controller responsible for image actions.
func (UploadImage) FetchImageFromURL ¶
func (ic UploadImage) FetchImageFromURL(imageURL string) (fileName string, fileContents []byte, err error)
func (UploadImage) Register ¶
func (ic UploadImage) Register(app *web.App)
Register registers the controllers routes.