{"modulePath":"github.com/codeGROOVE-dev/turnclient","version":"v0.0.0-20260116163536-b91f21bbe0c9","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package turn\n\nPackage turn provides a client for the Turn API service that helps track pull request review states and blocking actions.\n\n## Constants\n\n```go\nconst (\n\t// DefaultBackend is the default backend URL for the Turn API service.\n\tDefaultBackend = \"https://turn.github.codegroove.app\"\n)\n```\n\n## Types\n\n```go\ntype Action struct {\n\tSince    time.Time  `json:\"since\"`\n\tKind     ActionKind `json:\"kind\"`\n\tReason   string     `json:\"reason\"`\n\tCritical bool       `json:\"critical\"`\n}\n```\nAction represents an expected action from a specific user.\n\n```go\ntype ActionKind string\n```\nActionKind represents the type of action required from a user.\n\n```go\nconst (\n\tActionResolveComments  ActionKind = \"resolve_comments\"\n\tActionPublishDraft     ActionKind = \"publish_draft\"\n\tActionRequestReviewers ActionKind = \"request_reviewers\"\n\tActionReview           ActionKind = \"review\"\n\tActionReReview         ActionKind = \"re_review\"\n\tActionReviewDiscussion ActionKind = \"review_discussion\" // Respond to discussion/questions without code changes\n\tActionApprove          ActionKind = \"approve\"           // Formally approve PR (for LGTM scenarios)\n\tActionFixTests         ActionKind = \"fix_tests\"\n\tActionTestsPending     ActionKind = \"tests_pending\"\n\tActionRerunTests       ActionKind = \"rerun_tests\"\n\tActionRespond          ActionKind = \"respond\"\n\tActionFixConflict      ActionKind = \"fix_conflict\"\n\tActionMerge            ActionKind = \"merge\"\n)\n```\nAction constants.\n\n```go\ntype Analysis struct {\n\tLastActivity       LastActivity      `json:\"last_activity\"`\n\tNextAction         map[string]Action `json:\"next_action\"`\n\tSecondsInState     map[string]int    `json:\"seconds_in_state,omitempty\"`\n\tSize               string            `json:\"size\"`\n\tWorkflowState      string            `json:\"workflow_state,omitempty\"`\n\tTags               []string          `json:\"tags\"`\n\tStateTransitions   []StateTransition `json:\"state_transitions,omitempty\"`\n\tChecks             Checks            `json:\"checks\"`\n\tUnresolvedComments int               `json:\"unresolved_comments\"`\n\tReadyToMerge       bool              `json:\"ready_to_merge\"`\n\tMergeConflict      bool              `json:\"merge_conflict\"`\n\tApproved           bool              `json:\"approved\"`\n}\n```\nAnalysis represents the computed analysis of a PR.\n\n```go\ntype CheckRequest struct {\n\tURL           string    `json:\"url\"`\n\tUpdatedAt     time.Time `json:\"updated_at\"` // Last known update time of the PR (required)\n\tUser          string    `json:\"user\"`\n\tIncludeEvents bool      `json:\"include_events,omitempty\"` // Include full event list from prx (defaults to false)\n}\n```\nCheckRequest represents a request to check if a PR is blocked by a user.\n\n```go\ntype CheckResponse struct {\n\tTimestamp             time.Time       `json:\"timestamp\"`\n\tCommit                string          `json:\"commit\"`\n\tEvents                []prx.Event     `json:\"events,omitempty\"`\n\tPullRequest           prx.PullRequest `json:\"pull_request\"`\n\tAnalysis              Analysis        `json:\"analysis\"`\n\tTier                  string          `json:\"tier,omitempty\"`                  // GitHub Marketplace tier (free/pro/flock), only set for GitHub\n\tPrivateReposEnabled   bool            `json:\"private_repos_enabled,omitempty\"` // Whether user can access private repos\n\tTierEnforcementActive bool            `json:\"tier_enforcement_active\"`         // Whether tier restrictions are enforced\n}\n```\nCheckResponse represents the response from a PR check.\n\n```go\ntype Checks struct {\n\tTotal   int `json:\"total\"`   // number of checks associated to this PR\n\tFailing int `json:\"failing\"` // number of checks that failed\n\tWaiting int `json:\"waiting\"` // waiting for a deployment protection rule to be satisfied.\n\tPending int `json:\"pending\"` // Pending execution (effectively: total - failing - waiting - passing)\n\tPassing int `json:\"passing\"` // Number of checks that passed\n\tIgnored int `json:\"ignored\"` // Number of failing tests we ignored\n}\n```\nChecks represents the status of CI checks for a pull request.\n\n```go\ntype Client struct {\n\t// contains filtered or unexported fields\n}\n```\nClient communicates with the Turn API. Client methods are safe for concurrent use after initialization. Set\\* methods should only be called during setup before concurrent use.\n\n```go\nfunc New(opts ...Option) (*Client, error)\n```\nNew creates a new Turn API client with options. If no backend is specified via WithBackend, uses DefaultBackend.\n\n```go\nfunc NewClient(baseURL string) (*Client, error)\n```\nNewClient creates a new Turn API client with the specified backend URL. The baseURL should be a valid HTTP(S) URL without trailing slash.\n\n```go\nfunc NewDefaultClient() (*Client, error)\n```\nNewDefaultClient creates a new Turn API client using the default backend.\n\n```go\nfunc (c *Client) Check(ctx context.Context, prURL, user string, updatedAt time.Time) (*CheckResponse, error)\n```\nCheck validates a PR state at the given URL for the specified user. The updatedAt timestamp is used for caching.\n\n```go\nfunc (c *Client) CurrentUser(ctx context.Context) (string, error)\n```\nCurrentUser retrieves the current authenticated GitHub user's login.\n\n```go\nfunc (c *Client) IncludeEvents()\n```\nIncludeEvents enables including the full event list in check responses.\n\n```go\nfunc (c *Client) SetAuthToken(token string)\n```\nSetAuthToken sets the GitHub authentication token.\n\n```go\nfunc (c *Client) SetLogger(logger *log.Logger)\n```\nSetLogger sets a custom logger for the client.\n\n```go\nfunc (c *Client) SetNoCache(noCache bool)\n```\nSetNoCache enables or disables caching for this client.\n\n```go\ntype LastActivity struct {\n\tTimestamp time.Time `json:\"timestamp\"`\n\tKind      string    `json:\"kind\"`\n\tActor     string    `json:\"actor\"`\n\tMessage   string    `json:\"message\"`\n}\n```\nLastActivity represents the most recent activity on a PR.\n\n```go\ntype Option func(*Client)\n```\nOption configures a Client.\n\n```go\nfunc WithAuthToken(token string) Option\n```\nWithAuthToken sets the GitHub authentication token.\n\n```go\nfunc WithBackend(baseURL string) Option\n```\nWithBackend sets a custom backend URL.\n\n```go\nfunc WithLogger(logger *log.Logger) Option\n```\nWithLogger sets a custom logger.\n\n```go\nfunc WithNoCache(noCache bool) Option\n```\nWithNoCache enables or disables caching.\n\n```go\ntype StateTransition struct {\n\tFromState     string    `json:\"from_state\"`\n\tToState       string    `json:\"to_state\"`\n\tTimestamp     time.Time `json:\"timestamp\"`\n\tTriggerEvent  string    `json:\"trigger_event\"`\n\tLastEventKind string    `json:\"last_event_kind\"` // The last event kind seen before this transition\n}\n```\nStateTransition represents a state change based on an event.\n\n```go\ntype WorkflowState string\n```\nWorkflowState represents the current state of a PR in the workflow.\n\n```go\nconst (\n\tStateNewlyPublished             WorkflowState = \"NEWLY_PUBLISHED\"\n\tStateInDraft                    WorkflowState = \"IN_DRAFT\"\n\tStatePublishedWaitingForTests   WorkflowState = \"PUBLISHED_WAITING_FOR_TESTS\"\n\tStateTestedWaitingForFixes      WorkflowState = \"TESTED_WAITING_FOR_FIXES\"\n\tStateTestedWaitingForAssignment WorkflowState = \"TESTED_WAITING_FOR_ASSIGNMENT\"\n\tStateAssignedWaitingForReview   WorkflowState = \"ASSIGNED_WAITING_FOR_REVIEW\"\n\tStateReviewedNeedsRefinement    WorkflowState = \"REVIEWED_NEEDS_REFINEMENT\"\n\tStateRefinedWaitingForApproval  WorkflowState = \"REFINED_WAITING_FOR_APPROVAL\"\n\tStateApprovedWaitingForMerge    WorkflowState = \"APPROVED_WAITING_FOR_MERGE\"\n)\n```\nWorkflow state constants for tracking time spent in each state.\n\n","path":"github.com/codeGROOVE-dev/turnclient/pkg/turn","name":"turn","synopsis":"Package turn provides a client for the Turn API service that helps track pull request review states and blocking actions.","isRedistributable":true}
