Documentation
¶
Overview ¶
Package fakelinear is a deterministic, in-memory fake of the Linear GraphQL API subset used by connectors/linear. Requests are matched loosely by the root field name of the query or mutation; variables carry all inputs.
Supported root fields: viewer, project, projects, projectCreate, issue, issues, searchIssues, issueCreate, issueUpdate, commentCreate, comments.
Test control:
GET /_test/state projects, issues and comments
POST /_test/fail {operation, mode, count}; mode is
"drop_response_after_commit" (apply, then close the connection),
"error" (GraphQL error, not applied),
"rate_limited" (HTTP 429, not applied) or
"server_error" (HTTP 500, not applied)
POST /_test/reset clear records and failures
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Comment ¶
type Comment struct {
ID string `json:"id"`
IssueID string `json:"issue_id"`
Body string `json:"body"`
URL string `json:"url"`
Author string `json:"author,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
Comment is a stored comment.
type Issue ¶
type Issue struct {
ID string `json:"id"`
Identifier string `json:"identifier"`
Title string `json:"title"`
Description string `json:"description"`
URL string `json:"url"`
Priority int `json:"priority"`
TeamID string `json:"team_id"`
ProjectID string `json:"project_id,omitempty"`
StateID string `json:"state_id,omitempty"`
AssigneeID string `json:"assignee_id,omitempty"`
}
Issue is a stored issue.
type Options ¶
type Options struct {
// APIKey, when set, must equal the Authorization header (with or without
// "Bearer "). Otherwise any non-empty value is accepted.
APIKey string
// OrganizationID is the viewer's organisation id. Default org-fake.
OrganizationID string
// Teams maps team id to key. Default: team-eng ENG.
Teams map[string]string
}
Options configure the fake.
type Project ¶
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
Content string `json:"content"`
URL string `json:"url"`
State string `json:"state"`
TeamIDs []string `json:"team_ids"`
}
Project is a stored project.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the fake. It implements http.Handler.
func (*Server) AddComment ¶ added in v0.2.0
AddComment adds a comment as a human would in the Linear UI.
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler.
Click to show internal directories.
Click to hide internal directories.