Documentation ¶
Index ¶
- Constants
- type CreateBugReportRequest
- type CreateBugReportResponse
- type CreateGithubIssueRequest
- type CreateGithubIssueResponse
- type CreateIntercomIssueRequest
- type CreateIntercomIssueResponse
- type Endpoint
- type GithubReporter
- type IntercomReporter
- type NewGithubReporterOpts
- type NewIntercomReporterOpts
- type NewStorageOpts
- type Report
- type Reporter
- type ReporterWithMessage
- type Storage
- type Uploader
Constants ¶
const ( USER_ROLE_KEY = "user_role" NODE_IDENTITY_KEY = "node_identity" NODE_COUNTRY_KEY = "node_country" IP_TYPE_KEY = "ip_type" IP_KEY = "ip" CONTACT_TYPE = "contact" USER_TYPE = "user" DEFAULT_INTERCOM_BASE_URL = "https://api.intercom.io" )
keys of intercom custom attributes
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateBugReportRequest ¶ added in v1.3.0
type CreateBugReportRequest struct { NodeIdentity string `form:"nodeIdentity" example:"0xF0345F6251Bef9447A08766b9DA2B07b28aD80B0" validate:"required"` Description string `form:"description" minLength:"30" validate:"required"` Email string `form:"email" validate:"required"` File *multipart.FileHeader }
CreateBugReportRequest create bug report request
func ParseBugReportRequest ¶ added in v1.3.0
func ParseBugReportRequest(c *gin.Context) (CreateBugReportRequest, []error)
ParseBugReportRequest parses CreateBugReportRequest from HTTP request
type CreateBugReportResponse ¶ added in v1.3.0
type CreateBugReportResponse struct { IssueId string `json:"issueId"` Message string `json:"message"` Email string `json:"email"` NodeIdentity string `json:"node_identity"` }
CreateBugReportResponse represents a successful bug report creation
type CreateGithubIssueRequest ¶
type CreateGithubIssueRequest struct { UserId string `form:"userId"` Description string `form:"description"` Email string `form:"email"` File *multipart.FileHeader `form:"file"` }
CreateGithubIssueRequest create github issue request
func ParseGithubIssueRequest ¶
func ParseGithubIssueRequest(c *gin.Context) (CreateGithubIssueRequest, []error)
ParseGithubIssueRequest parses CreateGithubIssueRequest from HTTP request
type CreateGithubIssueResponse ¶
type CreateGithubIssueResponse struct {
IssueId string `json:"issueId"`
}
CreateGithubIssueResponse represents a successful github issue creation
type CreateIntercomIssueRequest ¶ added in v1.2.0
type CreateIntercomIssueRequest struct { UserId string `form:"userId" validate:"optional"` NodeIdentity string `form:"nodeIdentity" validate:"required"` UserType string `form:"userType" validate:"optional"` NodeCountry string `form:"nodeCountry" validate:"optional"` IpType string `form:"ipType" validate:"optional"` Ip string `form:"ip" validate:"optional"` Description string `form:"description" validate:"required" minLength:"30"` Email string `form:"email" validate:"required"` File *multipart.FileHeader }
CreateIntercomIssueRequest create intercom issue request
func ParseIntercomIssueRequest ¶ added in v1.2.0
func ParseIntercomIssueRequest(c *gin.Context) (CreateIntercomIssueRequest, []error)
ParseIntercomIssueRequest parses CreateIntercomIssueRequest from HTTP request
type CreateIntercomIssueResponse ¶ added in v1.2.0
type CreateIntercomIssueResponse struct {
ConversationId string `json:"conversationId"`
}
CreateIntercomIssueResponse represents a successful intercom issue creation
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint user feedback endpoint
func NewEndpoint ¶
func NewEndpoint(githubReporter Reporter, intercomReporter ReporterWithMessage, storage Uploader, rateLimiter *infra.RateLimiter) *Endpoint
NewEndpoint creates new Endpoint
func (*Endpoint) CreateBugReport ¶ added in v1.3.0
CreateBugReport creates a new bug report.
@Tags bug-report @Summary create a new bug report @Param request formData feedback.CreateBugReportRequest true "bug report request" @Param file formData file true "log file" @Accepts multipart/form-data @Produces json @Success 200 {object} feedback.CreateBugReportResponse @Failure 400 {object} apierror.APIErrorResponse @Failure 429 @Failure 503 {object} apierror.APIErrorResponse @Router /v1/bug-report [post]
func (*Endpoint) CreateGithubIssue
deprecated
func (*Endpoint) CreateIntercomIssue ¶ added in v1.2.0
CreateIntercomIssue creates a new Intercom chat with the issue with user report Deprecated: use CreateBugReport instead
@Tags bug-report @Summary create a new bug in intercom @Param request formData feedback.CreateIntercomIssueRequest true "bug report request" @Param file formData file true "log file" @Accepts multipart/form-data @Produces json @Success 200 {object} feedback.CreateIntercomIssueResponse @Failure 400 {object} apierror.APIErrorResponse @Failure 429 @Failure 503 {object} apierror.APIErrorResponse @Router /v1/intercom [post] @Deprecated
func (*Endpoint) RegisterRoutes ¶
RegisterRoutes registers feedback API routes
type GithubReporter ¶ added in v1.2.0
type GithubReporter struct {
// contains filtered or unexported fields
}
GithubReporter reports issues to Github
func NewGithubReporter ¶ added in v1.2.0
func NewGithubReporter(opts *NewGithubReporterOpts) (*GithubReporter, error)
NewGithubReporter creates a new GithubReporter
func (*GithubReporter) ReportIssue ¶ added in v1.2.0
func (rep *GithubReporter) ReportIssue(report *Report) (issueId string, err error)
ReportIssue reports issue
type IntercomReporter ¶ added in v1.2.0
type IntercomReporter struct {
// contains filtered or unexported fields
}
IntercomReporter reports issues to Intercom
func NewIntercomReporter ¶ added in v1.2.0
func NewIntercomReporter(opts *NewIntercomReporterOpts) *IntercomReporter
NewIntercomReporter creates a new IntercomReporter
func (*IntercomReporter) GetBugReportMessage ¶ added in v1.3.0
func (rep *IntercomReporter) GetBugReportMessage(report *Report) (message string, err error)
func (*IntercomReporter) ReportIssue ¶ added in v1.2.0
func (rep *IntercomReporter) ReportIssue(report *Report) (conversationId string, err error)
ReportIssue creates a issue message for the user in intercom
type NewGithubReporterOpts ¶ added in v1.2.0
type NewGithubReporterOpts struct { GithubBaseUrlOverride *string Token string Owner string Repository string LogProxyBaseUrl string }
NewGithubReporterOpts GithubReporter initialization options
type NewIntercomReporterOpts ¶ added in v1.2.0
NewIntercomReporterOpts Reporter initialization options
type NewStorageOpts ¶
NewStorageOpts options to initialize Storage
type Report ¶
type Report struct { UserId string NodeIdentity string UserType string NodeCountry string IpType string Ip string Description string Email string LogURL url.URL }
Report represents an issue report
type ReporterWithMessage ¶ added in v1.3.0
type ReporterWithMessage interface { Reporter GetBugReportMessage(report *Report) (message string, err error) }
ReporterWithMessage reports issues and generates bug report messages