create

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package create is the single owner of project, issue-type, and priority resolution for gadak create (CLI and REST). Both surfaces must call these functions so a default cannot exist on one path and not the other.

Need* errors carry catalogue data only. The CLI formats flag names; REST maps them to stable wire codes. This package does not name CLI flags.

Index

Constants

View Source
const (
	SourceFlag   = "flag"
	SourceConfig = "config"
	SourceSole   = "sole"
)

Source names recorded on --json / the REST create response so a caller can see why a project or type was chosen.

Variables

This section is empty.

Functions

func FormatTypes

func FormatTypes(types []jira.NamedID) string

FormatTypes is the "Name (id N); …" list used in type-resolution errors.

func MetaFor

func MetaFor(meta []jira.CreateMetaProject, project string, cfg *config.Config) (jira.CreateMetaProject, []jira.NamedID, error)

MetaFor picks the createmeta project (case-insensitive key) and its types.

func Priority

func Priority(want string, list []jira.NamedID) (id string, err error)

Priority resolves a user-supplied name or id against the site catalog. Names follow the account language; the return is always the catalog id.

func PriorityField

func PriorityField(id string) map[string]string

PriorityField is the Jira fields.priority value: always an id, never a localized name. Create and edit both send this shape.

Types

type NeedPriorityError

type NeedPriorityError struct {
	Available []jira.NamedID
}

NeedPriorityError is returned when a priority name or id was required but empty. Available is the site catalog. Surfaces format this.

func (*NeedPriorityError) Error

func (e *NeedPriorityError) Error() string

type NeedProjectError

type NeedProjectError struct {
	Configured []string
}

NeedProjectError is returned when create cannot resolve a project. Configured is the profile project list (may be empty). Surfaces format this.

func (*NeedProjectError) Error

func (e *NeedProjectError) Error() string

type NeedTypeError

type NeedTypeError struct {
	Available []jira.NamedID
}

NeedTypeError is returned when create cannot resolve an issue type. Available is the createmeta catalog. Surfaces format this.

func (*NeedTypeError) Error

func (e *NeedTypeError) Error() string

type Resolved

type Resolved struct {
	Value  string `json:"value"`
	Source string `json:"source"`
}

Resolved is one filled create field and where it came from.

func Project

func Project(want string, cfg *config.Config) (Resolved, error)

Project resolves the create project:

  1. explicit flag / request field
  2. profile DefaultProject
  3. the sole configured project
  4. otherwise fail — inventing a project is not a default.

func Type

func Type(want string, types []jira.NamedID, cfg *config.Config, project string) (Resolved, error)

Type resolves the create issue type:

  1. explicit flag / request field (name or id, same as today's CLI)
  2. profile DefaultIssueTypeID, matched by id only
  3. the project has exactly one createmeta type
  4. otherwise fail

types[0] is deliberately not a fallback. The web dialog may pick types[0] because the person can see and change it before submit. A headless CLI or REST caller never sees that value, so the same fallback would silently file as the wrong type.

Jump to

Keyboard shortcuts

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