api

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBaseURL is the production Entire API origin.
	DefaultBaseURL = "https://entire.io"

	// DefaultAuthBaseURL is the production Entire login server — the
	// default for `entire login --server`.
	DefaultAuthBaseURL = "https://us.auth.entire.io"

	// BaseURLEnvVar overrides the Entire API origin for local development.
	BaseURLEnvVar = "ENTIRE_API_BASE_URL"

	// AuthBaseURLEnvVar is the retired auth-origin override. Nothing reads
	// its value — RejectRemovedAuthEnv fails every command when it is set,
	// pointing at `entire login --server`.
	AuthBaseURLEnvVar = "ENTIRE_AUTH_BASE_URL"
)

Variables

View Source
var ErrInsecureHTTP = errors.New("refusing to use insecure http:// base URL for authentication (use --insecure-http-auth to override)")

ErrInsecureHTTP is returned when the base URL uses HTTP without an explicit opt-in.

Functions

func BaseURL

func BaseURL() string

BaseURL returns the effective Entire API base URL. ENTIRE_API_BASE_URL takes precedence over the production default.

func CheckResponse added in v0.5.2

func CheckResponse(resp *http.Response) error

CheckResponse returns an error if the response status code indicates failure. For non-2xx responses, it reads and parses the error message from the body and returns it as an *HTTPError. The caller is responsible for closing resp.Body.

func DecodeJSON added in v0.5.2

func DecodeJSON(resp *http.Response, dest any) error

DecodeJSON reads the response body and decodes it into dest. It limits the body size to protect against unbounded reads. The caller is responsible for closing resp.Body.

func IsHTTPErrorStatus added in v0.6.0

func IsHTTPErrorStatus(err error, status int) bool

IsHTTPErrorStatus reports whether err wraps an *HTTPError with the given HTTP status.

func NormalizeOriginURL added in v0.6.3

func NormalizeOriginURL(raw string) string

NormalizeOriginURL canonicalises an origin URL the same way auth-go's tokenmanager does internally: lowercase scheme/host, default port stripped (80 for http, 443 for https), path/query/fragment dropped, trailing slash collapsed. On parse failure, raw is returned unchanged so non-URL audience values still compare byte-for-byte.

Mirrors auth-go's internal/oauthhttp.NormalizeOriginURL so the value the CLI hands to the manager as Issuer survives the manager's own normalisation pass byte-for-byte; a cosmetically-different origin (uppercase host, explicit :443, trailing slash) would otherwise be keyed under a different keyring slot than the manager later reads.

func OriginOnly added in v0.6.3

func OriginOnly(raw string) string

OriginOnly is a backwards-compatible alias for NormalizeOriginURL. Callers reading raw URLs (e.g. ENTIRE_SEARCH_URL) and feeding them into tokenmanager.TokenRequest.Resource use this to strip path/query/fragment before the lib's stricter origin-only validator runs.

func RejectRemovedAuthEnv added in v0.7.6

func RejectRemovedAuthEnv() error

RejectRemovedAuthEnv returns an error when ENTIRE_AUTH_BASE_URL is set at all (even empty). The variable is retired in favour of `entire login --server`; failing loudly beats silently ignoring an override the operator believes is in effect.

func RequireSecureURL

func RequireSecureURL(baseURL string) error

RequireSecureURL returns ErrInsecureHTTP if the base URL uses the http scheme. Call this before making authenticated requests unless --insecure-http-auth is set.

func ResolveURL

func ResolveURL(path string) (string, error)

ResolveURL joins an API-relative path against the effective base URL.

func ResolveURLFromBase

func ResolveURLFromBase(baseURL, path string) (string, error)

ResolveURLFromBase joins an API-relative path against an explicit base URL. Only http and https schemes are accepted.

Types

type AuthSession added in v0.7.4

type AuthSession struct {
	ID         string  `json:"id"`
	UserID     string  `json:"user_id"`
	Name       string  `json:"name"`
	Scope      string  `json:"scope"`
	ExpiresAt  string  `json:"expires_at"`
	LastUsedAt *string `json:"last_used_at"`
	CreatedAt  string  `json:"created_at"`
}

AuthSession is a single active login session — an OAuth refresh-token family — returned by entire-core's session endpoint. One is created per `entire login`, across all of a user's devices. Plaintext token values are never returned by the server, only metadata. (The list envelope's wire key is "tokens"; the rows are sessions.)

type AuthSessionsResponse added in v0.7.4

type AuthSessionsResponse struct {
	Sessions []AuthSession `json:"tokens"`
}

AuthSessionsResponse is the envelope returned by the list endpoint.

type Client added in v0.5.2

type Client struct {
	// contains filtered or unexported fields
}

Client is an authenticated HTTP client for the Entire API. It attaches the bearer token to all outgoing requests via the Authorization header.

func NewClient added in v0.5.2

func NewClient(token string) *Client

NewClient creates a new authenticated API client with an explicit bearer token, targeting the data API base URL (BaseURL()).

func NewClientWithBaseURL added in v0.6.3

func NewClientWithBaseURL(token, baseURL string) *Client

NewClientWithBaseURL creates a new authenticated API client targeting an explicit base URL. Use this for endpoints that live on a login server rather than the data API (e.g. auth-session management).

func (*Client) Delete added in v0.5.2

func (c *Client) Delete(ctx context.Context, path string) (*http.Response, error)

Delete sends an authenticated DELETE request to the given API-relative path.

func (*Client) Get added in v0.5.2

func (c *Client) Get(ctx context.Context, path string) (*http.Response, error)

Get sends an authenticated GET request to the given API-relative path.

func (*Client) GetStream added in v0.6.2

func (c *Client) GetStream(ctx context.Context, path string, headers http.Header) (*http.Response, error)

GetStream sends an authenticated GET request with optional extra request headers (e.g. Accept: text/event-stream, Last-Event-ID) and returns the response with the body still open. Callers are responsible for reading and closing resp.Body. Intended for streaming endpoints such as Server-Sent Events; for normal JSON requests use Get.

func (*Client) ListAuthSessions added in v0.7.4

func (c *Client) ListAuthSessions(ctx context.Context) ([]AuthSession, error)

ListAuthSessions returns the authenticated user's active login sessions.

func (*Client) ListRepositories added in v0.5.6

func (c *Client) ListRepositories(ctx context.Context, sort RepositorySort) ([]Repository, error)

ListRepositories lists the authenticated user's repositories. An empty sort uses the server default.

func (*Client) Patch added in v0.5.2

func (c *Client) Patch(ctx context.Context, path string, body any) (*http.Response, error)

Patch sends an authenticated PATCH request with a JSON body to the given API-relative path.

func (*Client) Post added in v0.5.2

func (c *Client) Post(ctx context.Context, path string, body any) (*http.Response, error)

Post sends an authenticated POST request with a JSON body to the given API-relative path.

func (*Client) Put added in v0.5.2

func (c *Client) Put(ctx context.Context, path string, body any) (*http.Response, error)

Put sends an authenticated PUT request with a JSON body to the given API-relative path.

func (*Client) ReportEnable added in v0.7.6

func (c *Client) ReportEnable(ctx context.Context, remoteURL string) (*EnableRepoResponse, error)

ReportEnable records that the authenticated user ran `entire enable` for the repo identified by remoteURL, and returns whether the App can reach it.

func (*Client) RevokeAuthSession added in v0.7.4

func (c *Client) RevokeAuthSession(ctx context.Context, id string) error

RevokeAuthSession revokes the login session with the given id.

func (*Client) RevokeCurrentAuthSession added in v0.7.4

func (c *Client) RevokeCurrentAuthSession(ctx context.Context) error

RevokeCurrentAuthSession revokes the login session this client is authenticating with (the family the current bearer belongs to).

func (*Client) TrailsEnabled added in v0.7.7

func (c *Client) TrailsEnabled(ctx context.Context, forge, owner, repo string) (bool, error)

TrailsEnabled probes trail availability: 2xx=true, 403/404/410=false, everything else ambiguous.

func (*Client) WithAuthSessionsPath added in v0.7.4

func (c *Client) WithAuthSessionsPath(path string) *Client

WithAuthSessionsPath sets the base path used by ListAuthSessions, RevokeCurrentAuthSession, and RevokeAuthSession. Returns the receiver for chaining at construction:

c := api.NewClientWithBaseURL(token, base).WithAuthSessionsPath(p)

type EnableRepoRequest added in v0.7.6

type EnableRepoRequest struct {
	RemoteURL string `json:"remote_url"`
}

EnableRepoRequest is the body of POST /api/v1/cli/enable. RemoteURL is a clean, credential-free remote URL (the CLI strips any embedded credentials and query params before sending — see reportRepoEnabled); the server resolves it to a repo on its end.

type EnableRepoResponse added in v0.7.6

type EnableRepoResponse struct {
	Connected  bool   `json:"connected"`
	InstallURL string `json:"install_url,omitempty"`
	Repo       *struct {
		FullName string `json:"full_name"`
		GitHubID int64  `json:"github_id"`
		Private  bool   `json:"private"`
	} `json:"repo,omitempty"`
}

EnableRepoResponse is the result of recording an `entire enable`. Connected reports whether the GitHub App can currently reach the repo; when it can't, InstallURL points at the App installation page.

The CLI deliberately ignores these fields today: reporting is best-effort and the "install the GitHub App" nudge is surfaced by the web onboarding, not the CLI. They are decoded for the API contract and potential future use.

type ErrorResponse added in v0.5.2

type ErrorResponse struct {
	Error any `json:"error"`
}

ErrorResponse represents a standard API error response. Older endpoints return {"error":"message"}; newer endpoints return {"error":{"code":"...","message":"...",...}}.

func (ErrorResponse) Message added in v0.6.3

func (e ErrorResponse) Message() string

Message extracts the human-readable error message from either envelope shape.

type HTTPError added in v0.6.0

type HTTPError struct {
	StatusCode int
	Message    string
}

HTTPError is returned by CheckResponse for non-2xx responses. Callers can use errors.As to inspect the HTTP status, or IsHTTPErrorStatus for a quick check.

func (*HTTPError) Error added in v0.6.0

func (e *HTTPError) Error() string

type RepositoriesResponse added in v0.5.6

type RepositoriesResponse struct {
	Repositories []Repository `json:"repositories"`
}

RepositoriesResponse is the envelope returned by GET /api/v1/repositories.

type Repository added in v0.5.6

type Repository struct {
	FullName        string `json:"full_name"`
	CheckpointCount int    `json:"checkpoint_count"`
}

Repository is a single entry returned by GET /api/v1/repositories. Only fields currently consumed by callers are decoded; extras are ignored.

type RepositorySort added in v0.5.6

type RepositorySort string
const (
	RepositorySortRecent RepositorySort = "recent"
	RepositorySortName   RepositorySort = "name"
)

type TrailBodyDocument added in v0.7.8

type TrailBodyDocument struct {
	TextSnapshot string `json:"text_snapshot"`
}

TrailBodyDocument is the trail's description editor document. TextSnapshot is the rendered plain text the CLI displays.

type TrailCreateRequest added in v0.5.2

type TrailCreateRequest struct {
	Title      string `json:"title"`
	Body       string `json:"body,omitempty"`
	BranchName string `json:"branch_name,omitempty"`
	// BranchAction is "create" (default) or "link". The CLI sends "link" to
	// attach an already-pushed branch instead of backfilling it at base. Omit
	// both branch_name and branch_action to create a branchless trail.
	BranchAction string   `json:"branch_action,omitempty"`
	Base         string   `json:"base,omitempty"`
	Status       string   `json:"status,omitempty"`
	Assignees    []string `json:"assignees,omitempty"`
	Labels       []string `json:"labels,omitempty"`
	Priority     string   `json:"priority,omitempty"`
	Type         string   `json:"type,omitempty"`
}

TrailCreateRequest is the body for POST /api/v1/trails/:host/:owner/:repo.

type TrailCreateResponse added in v0.5.2

type TrailCreateResponse struct {
	Trail TrailResource `json:"trail"`
}

TrailCreateResponse is the response from POST /api/v1/trails/:org/:repo.

type TrailDeleteResponse added in v0.7.7

type TrailDeleteResponse struct {
	OK bool `json:"ok"`
}

TrailDeleteResponse is the response from DELETE /api/v1/trails/:host/:owner/:repo/:number. OK is the server's explicit success signal; a destructive delete should not be reported as done unless it is true.

type TrailListResponse added in v0.5.2

type TrailListResponse struct {
	Trails        []TrailResource `json:"trails"`
	Total         int             `json:"total"`
	Limit         int             `json:"limit"`
	Offset        int             `json:"offset"`
	RepoFullName  string          `json:"repo_full_name"`
	DefaultBranch string          `json:"default_branch"`
	UpdatedAt     time.Time       `json:"updated_at"`
}

TrailListResponse is the response from GET /api/v1/trails/:org/:repo. The endpoint paginates: Trails holds one page (server max 200 rows) and Total is the full match count for the requested filters.

type TrailResource added in v0.5.2

type TrailResource struct {
	ID              string           `json:"id,omitempty"`
	Number          int              `json:"number,omitempty"`
	URL             string           `json:"url,omitempty"`
	Branch          string           `json:"branch"`
	Base            string           `json:"base"`
	Title           string           `json:"title"`
	Body            string           `json:"body"`
	Status          string           `json:"status"`
	Phase           string           `json:"phase,omitempty"`
	Author          *trail.Author    `json:"author"`
	Assignees       []string         `json:"assignees"`
	Labels          []string         `json:"labels"`
	Priority        string           `json:"priority,omitempty"`
	Type            string           `json:"type,omitempty"`
	Reviewers       []trail.Reviewer `json:"reviewers,omitempty"`
	CreatedAt       time.Time        `json:"created_at"`
	UpdatedAt       time.Time        `json:"updated_at"`
	MergedAt        *time.Time       `json:"merged_at,omitempty"`
	CommentCount    int              `json:"comment_count,omitempty"`
	UnresolvedCount int              `json:"unresolved_count,omitempty"`
	CheckpointCount int              `json:"checkpoint_count,omitempty"`
	CommitsAhead    int              `json:"commits_ahead,omitempty"`
	// BodyDocument carries the trail's description (collaborative editor doc).
	// The list endpoint omits it; the detail endpoint populates it.
	BodyDocument *TrailBodyDocument `json:"body_document,omitempty"`
}

TrailResource represents a single trail from the API.

func (*TrailResource) ToMetadata added in v0.5.2

func (r *TrailResource) ToMetadata() *trail.Metadata

ToMetadata converts a TrailResource to a trail.Metadata for display.

type TrailReview added in v0.7.6

type TrailReview struct {
	ID            string    `json:"id"`
	TrailID       string    `json:"trail_id"`
	CodeVersionID string    `json:"code_version_id"`
	ActorID       string    `json:"actor_id"`
	Summary       *string   `json:"summary"`
	StartedAt     time.Time `json:"started_at"`
}

TrailReview represents a review session.

type TrailReviewCodeVersion added in v0.7.6

type TrailReviewCodeVersion struct {
	ID           string    `json:"id"`
	TrailID      string    `json:"trail_id"`
	RepositoryID string    `json:"repository_id"`
	BaseRef      *string   `json:"base_ref"`
	HeadRef      *string   `json:"head_ref"`
	BaseSHA      *string   `json:"base_sha"`
	HeadSHA      *string   `json:"head_sha"`
	CapturedAt   time.Time `json:"captured_at"`
}

TrailReviewCodeVersion pins the base/head that a review covers.

type TrailReviewComment added in v0.7.6

type TrailReviewComment struct {
	ID                        string                       `json:"id"`
	TrailID                   string                       `json:"trail_id"`
	RepositoryID              string                       `json:"repository_id"`
	ReviewID                  string                       `json:"review_id"`
	CodeVersionID             string                       `json:"code_version_id"`
	ActorID                   string                       `json:"actor_id"`
	Title                     *string                      `json:"title"`
	Body                      *string                      `json:"body"`
	Severity                  *string                      `json:"severity"`
	Confidence                *float64                     `json:"confidence"`
	Status                    string                       `json:"status"`
	StatusReason              *string                      `json:"status_reason"`
	StaleOutcome              string                       `json:"stale_outcome"`
	StaleCheckedAt            *time.Time                   `json:"stale_checked_at"`
	StaleCheckedCodeVersionID *string                      `json:"stale_checked_code_version_id"`
	ClientID                  *string                      `json:"client_id"`
	ClientIDHash              *string                      `json:"client_id_hash"`
	CreatedAt                 time.Time                    `json:"created_at"`
	UpdatedAt                 time.Time                    `json:"updated_at"`
	Location                  TrailReviewLocation          `json:"location"`
	SuggestedChanges          []TrailReviewSuggestedChange `json:"suggested_changes,omitempty"`
	ThreadID                  *string                      `json:"thread_id,omitempty"`
	ThreadMessageCount        int                          `json:"thread_message_count,omitempty"`
	OutgoingLinks             []TrailReviewOutgoingLink    `json:"outgoing_links,omitempty"`
}

TrailReviewComment is a single agent-native review finding.

type TrailReviewCommentBatchError added in v0.7.6

type TrailReviewCommentBatchError struct {
	Code      string  `json:"code"`
	Message   string  `json:"message"`
	Field     *string `json:"field"`
	Retryable bool    `json:"retryable"`
}

TrailReviewCommentBatchError describes why a single finding in a batch failed.

type TrailReviewCommentBatchRequest added in v0.7.6

type TrailReviewCommentBatchRequest struct {
	Comments []TrailReviewCommentInput `json:"comments"`
}

TrailReviewCommentBatchRequest posts a batch of findings to a review via POST /api/v1/trails/{trail_id}/reviews/{id}/comments. The API requires at least one comment and rejects batches larger than the review's max_comments_per_batch limit.

type TrailReviewCommentBatchResponse added in v0.7.6

type TrailReviewCommentBatchResponse struct {
	Results []TrailReviewCommentBatchResult `json:"results"`
}

TrailReviewCommentBatchResponse is returned by the batch comment endpoint.

type TrailReviewCommentBatchResult added in v0.7.6

type TrailReviewCommentBatchResult struct {
	ClientID        string                        `json:"client_id"`
	Status          string                        `json:"status"`
	Comment         *TrailReviewComment           `json:"comment,omitempty"`
	SuggestedChange *TrailReviewSuggestedChange   `json:"suggested_change,omitempty"`
	Error           *TrailReviewCommentBatchError `json:"error,omitempty"`
}

TrailReviewCommentBatchResult reports the per-finding outcome of a batch. Status is one of "created", "existing", or "error"; Comment is populated for the first two, Error for the last.

type TrailReviewCommentInput added in v0.7.6

type TrailReviewCommentInput struct {
	ClientID        string                                   `json:"client_id"`
	Body            *string                                  `json:"body,omitempty"`
	Severity        *string                                  `json:"severity,omitempty"`
	Confidence      *float64                                 `json:"confidence,omitempty"`
	Status          *string                                  `json:"status,omitempty"`
	StatusReason    *string                                  `json:"status_reason,omitempty"`
	Location        TrailReviewLocationCreateRequest         `json:"location"`
	SuggestedChange *TrailReviewSuggestedChangeCreateRequest `json:"suggested_change,omitempty"`
}

TrailReviewCommentInput is a single finding within a batch create request. client_id (an idempotency key) and location are required by the API.

type TrailReviewCommentPatchRequest added in v0.7.6

type TrailReviewCommentPatchRequest struct {
	Title        *string  `json:"title,omitempty"`
	Body         *string  `json:"body,omitempty"`
	Severity     *string  `json:"severity,omitempty"`
	Confidence   *float64 `json:"confidence,omitempty"`
	Status       string   `json:"status,omitempty"`
	StatusReason *string  `json:"status_reason,omitempty"`
}

TrailReviewCommentPatchRequest updates a review finding.

type TrailReviewCommentsResponse added in v0.7.6

type TrailReviewCommentsResponse struct {
	Comments   []TrailReviewComment `json:"comments"`
	HasMore    bool                 `json:"has_more"`
	NextOffset *int                 `json:"next_offset"`
}

TrailReviewCommentsResponse is returned by trail/review comment list endpoints.

type TrailReviewCounts added in v0.7.6

type TrailReviewCounts struct {
	Open      int `json:"open"`
	Resolved  int `json:"resolved"`
	Dismissed int `json:"dismissed"`
	Stale     int `json:"stale"`
	Total     int `json:"total"`
}

TrailReviewCounts are review-scoped comment counts.

type TrailReviewLimits added in v0.7.6

type TrailReviewLimits struct {
	MaxCommentsPerBatch int `json:"max_comments_per_batch"`
}

TrailReviewLimits carries the server-enforced batch limits for a review.

type TrailReviewLocation added in v0.7.6

type TrailReviewLocation struct {
	ID              string  `json:"id"`
	ReviewCommentID string  `json:"review_comment_id"`
	CodeVersionID   string  `json:"code_version_id"`
	Granularity     string  `json:"granularity"`
	FilePath        *string `json:"file_path"`
	StartLine       *int    `json:"start_line"`
	StartColumn     *int    `json:"start_column"`
	EndLine         *int    `json:"end_line"`
	EndColumn       *int    `json:"end_column"`
	SelectedText    *string `json:"selected_text"`
	NearbyText      *string `json:"nearby_text"`
	Language        *string `json:"language"`
}

TrailReviewLocation identifies where a finding applies.

type TrailReviewLocationCreateRequest added in v0.7.6

type TrailReviewLocationCreateRequest struct {
	Granularity  string  `json:"granularity"`
	FilePath     *string `json:"file_path,omitempty"`
	StartLine    *int    `json:"start_line,omitempty"`
	StartColumn  *int    `json:"start_column,omitempty"`
	EndLine      *int    `json:"end_line,omitempty"`
	EndColumn    *int    `json:"end_column,omitempty"`
	SelectedText *string `json:"selected_text,omitempty"`
	NearbyText   *string `json:"nearby_text,omitempty"`
	Language     *string `json:"language,omitempty"`
}

TrailReviewLocationCreateRequest identifies where a new finding applies.

type TrailReviewOutgoingLink struct {
	SourceCommentID string `json:"source_comment_id"`
	TargetCommentID string `json:"target_comment_id"`
	LinkType        string `json:"link_type"`
}

TrailReviewOutgoingLink relates two review comments.

type TrailReviewStartRequest added in v0.7.6

type TrailReviewStartRequest struct {
	HeadSHA *string `json:"head_sha,omitempty"`
	BaseSHA *string `json:"base_sha,omitempty"`
	BaseRef *string `json:"base_ref,omitempty"`
	HeadRef *string `json:"head_ref,omitempty"`
}

TrailReviewStartRequest starts a review session for a trail via POST /api/v1/trails/{trail_id}/reviews. All fields are optional; the server resolves the code version (base/head) when they are omitted.

type TrailReviewStartResponse added in v0.7.6

type TrailReviewStartResponse struct {
	ReviewID       string            `json:"review_id"`
	TrailID        string            `json:"trail_id"`
	RepositoryID   string            `json:"repository_id"`
	CodeVersionID  string            `json:"code_version_id"`
	BaseSHA        *string           `json:"base_sha"`
	HeadSHA        *string           `json:"head_sha"`
	EventStreamURL string            `json:"event_stream_url"`
	DiffURL        string            `json:"diff_url"`
	FilesURL       string            `json:"files_url"`
	Limits         TrailReviewLimits `json:"limits"`
}

TrailReviewStartResponse is returned by POST /api/v1/trails/{trail_id}/reviews.

type TrailReviewStateResponse added in v0.7.6

type TrailReviewStateResponse struct {
	Review      TrailReview            `json:"review"`
	CodeVersion TrailReviewCodeVersion `json:"code_version"`
	Counts      TrailReviewCounts      `json:"counts"`
	Comments    []TrailReviewComment   `json:"comments"`
	NextCursor  *string                `json:"next_cursor"`
	EventCursor string                 `json:"event_cursor"`
}

TrailReviewStateResponse is returned by GET /api/v1/trails/{trail_id}/reviews/{id}.

type TrailReviewSuggestedChange added in v0.7.6

type TrailReviewSuggestedChange struct {
	ID                string    `json:"id"`
	ReviewCommentID   string    `json:"review_comment_id"`
	CodeVersionID     string    `json:"code_version_id"`
	ChangeType        string    `json:"change_type"`
	Patch             *string   `json:"patch"`
	Instruction       *string   `json:"instruction"`
	ExpectedFilePath  *string   `json:"expected_file_path"`
	ExpectedFileHash  *string   `json:"expected_file_hash"`
	ExpectedStartLine *int      `json:"expected_start_line"`
	ExpectedEndLine   *int      `json:"expected_end_line"`
	ExpectedLines     *string   `json:"expected_lines"`
	CreatedBy         string    `json:"created_by"`
	CreatedAt         time.Time `json:"created_at"`
	UpdatedAt         time.Time `json:"updated_at"`
}

TrailReviewSuggestedChange describes a machine-applicable or manual fix.

type TrailReviewSuggestedChangeCreateRequest added in v0.7.6

type TrailReviewSuggestedChangeCreateRequest struct {
	ChangeType        string  `json:"change_type"`
	Patch             *string `json:"patch,omitempty"`
	Instruction       *string `json:"instruction,omitempty"`
	ExpectedFilePath  *string `json:"expected_file_path,omitempty"`
	ExpectedFileHash  *string `json:"expected_file_hash,omitempty"`
	ExpectedStartLine *int    `json:"expected_start_line,omitempty"`
	ExpectedEndLine   *int    `json:"expected_end_line,omitempty"`
	ExpectedLines     *string `json:"expected_lines,omitempty"`
}

TrailReviewSuggestedChangeCreateRequest attaches a suggested fix to a new finding.

type TrailUpdateRequest added in v0.5.2

type TrailUpdateRequest struct {
	Status *string   `json:"status,omitempty"`
	Title  *string   `json:"title,omitempty"`
	Body   *string   `json:"body,omitempty"`
	Labels *[]string `json:"labels,omitempty"`
}

TrailUpdateRequest is the body for PATCH /api/v1/trails/:host/:owner/:repo/:trailId. Pointer fields distinguish "not provided" (nil) from "set to value". For slices, *[]string is used so nil means "no change" while &[]string{} means "clear".

type TrailUpdateResponse added in v0.5.2

type TrailUpdateResponse struct {
	Trail TrailResource `json:"trail"`
}

TrailUpdateResponse is the response from PATCH /api/v1/trails/:org/:repo/:trailId.

Jump to

Keyboard shortcuts

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