import "github.com/gophish/gophish/controllers/api"
campaign.go group.go imap.go import.go page.go reset.go response.go server.go smtp.go template.go user.go util.go webhook.go
ErrEmptyRole is throws when no role is provided when creating or modifying a user.
ErrEmptyUsername is thrown when a user attempts to register a username that is taken.
ErrInsufficientPermission is thrown when a user attempts to change an attribute (such as the role) for which they don't have permission.
ErrUsernameTaken is thrown when a user attempts to register a username that is taken.
func JSONResponse(w http.ResponseWriter, d interface{}, c int)
JSONResponse attempts to set the status code, c, and marshal the given interface, d, into a response that is written to the given ResponseWriter.
type Server struct {
// contains filtered or unexported fields
}
Server represents the routes and functionality of the Gophish API. It's not a server in the traditional sense, in that it isn't started and stopped. Rather, it's meant to be used as an http.Handler in the AdminServer.
func NewServer(options ...ServerOption) *Server
NewServer returns a new instance of the API handler with the provided options applied.
Campaign returns details about the requested campaign. If the campaign is not valid, APICampaign returns null.
CampaignComplete effectively "ends" a campaign. Future phishing emails clicked will return a simple "404" page.
CampaignResults returns just the results for a given campaign to significantly reduce the information returned.
CampaignSummary returns the summary for a given campaign.
Campaigns returns a list of campaigns if requested via GET. If requested via POST, APICampaigns creates a new campaign and returns a reference to it.
CampaignsSummary returns the summary for the current user's campaigns
Group returns details about the requested group. If the group is not valid, Group returns null.
GroupSummary returns a summary of the groups owned by the current user.
Groups returns a list of groups if requested via GET. If requested via POST, APIGroups creates a new group and returns a reference to it.
GroupsSummary returns a summary of the groups owned by the current user.
IMAPServer handles requests for the /api/imapserver/ endpoint
IMAPServerValidate handles requests for the /api/imapserver/validate endpoint
ImportEmail allows for the importing of email. Returns a Message object
ImportGroup imports a CSV of group members
ImportSite allows for the importing of HTML from a website Without "include_resources" set, it will merely place a "base" tag so that all resources can be loaded relative to the given URL.
Page contains functions to handle the GET'ing, DELETE'ing, and PUT'ing of a Page object
Pages handles requests for the /api/pages/ endpoint
Reset (/api/reset) resets the currently authenticated user's API key
SendTestEmail sends a test email using the template name and Target given.
SendingProfile contains functions to handle the GET'ing, DELETE'ing, and PUT'ing of a SMTP object
SendingProfiles handles requests for the /api/smtp/ endpoint
Template handles the functions for the /api/templates/:id endpoint
Templates handles the functionality for the /api/templates endpoint
User contains functions to retrieve or delete a single user. Users with the ModifySystem permission can view and modify any user. Otherwise, users may only view or delete their own account.
Users contains functions to retrieve a list of existing users or create a new user. Users with the ModifySystem permissions can view and create users.
ValidateWebhook makes an HTTP request to a specified remote url to ensure that it's valid.
Webhook returns details of a single webhook specified by "id" parameter
Webhooks returns a list of webhooks, both active and disabled
ServerOption is an option to apply to the API server.
func WithLimiter(limiter *ratelimit.PostLimiter) ServerOption
func WithWorker(w worker.Worker) ServerOption
WithWorker is an option that sets the background worker.
Package api imports 25 packages (graph) and is imported by 2 packages. Updated 2020-12-09. Refresh now. Tools for package owners.