Documentation
¶
Index ¶
- func EnhanceError(err error, path string, params map[string]string) error
- func ValidateEntityType(entityType string) error
- func WarnSelectDotPaths(selectExpr string) string
- type APIError
- type Client
- func (c *Client) BuildV2EntityURL(entityType string, id int, selectExpr string) string
- func (c *Client) BuildV2URL(entityType string, params V2Params) string
- func (c *Client) CreateEntity(ctx context.Context, entityType string, fields map[string]any) (Entity, error)
- func (c *Client) DeleteEntity(ctx context.Context, entityType string, id int) ([]byte, error)
- func (c *Client) GetEntity(ctx context.Context, entityType string, id int, include []string) (Entity, error)
- func (c *Client) GetMetaIndex(ctx context.Context) ([]byte, error)
- func (c *Client) GetTypeMeta(ctx context.Context, entityType string) ([]byte, error)
- func (c *Client) QueryV2(ctx context.Context, entityType string, params V2Params) ([]byte, error)
- func (c *Client) QueryV2Entity(ctx context.Context, entityType string, id int, selectExpr string) ([]byte, error)
- func (c *Client) Raw(ctx context.Context, method, path string, body io.Reader) ([]byte, error)
- func (c *Client) ResolveEntityType(ctx context.Context, id int) (string, error)
- func (c *Client) SearchEntities(ctx context.Context, entityType, where string, include []string, take int, ...) ([]Entity, error)
- func (c *Client) UpdateEntity(ctx context.Context, entityType string, id int, fields map[string]any) (Entity, error)
- type Entity
- type V2Params
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnhanceError ¶
EnhanceError checks if an API error matches known patterns and returns an enhanced error message with fix suggestions. If no pattern matches, returns the original error unchanged.
func ValidateEntityType ¶
ValidateEntityType checks that an entity type name is safe for use in URL paths.
func WarnSelectDotPaths ¶
WarnSelectDotPaths checks for dot-path fields in a select expression that are missing 'as' aliases. These fields are silently dropped by the API. Returns a warning message or empty string.
Types ¶
type Client ¶
Client is the Targetprocess API client.
func (*Client) BuildV2EntityURL ¶
BuildV2EntityURL constructs the full v2 URL for a single entity by ID.
func (*Client) BuildV2URL ¶
BuildV2URL constructs the full v2 URL without executing the request. Useful for --dry-run to inspect the URL that would be called.
func (*Client) CreateEntity ¶
func (c *Client) CreateEntity(ctx context.Context, entityType string, fields map[string]any) (Entity, error)
CreateEntity creates a new entity. Fields are sent as the JSON body.
func (*Client) DeleteEntity ¶ added in v0.3.0
DeleteEntity deletes an entity by type and ID.
func (*Client) GetEntity ¶
func (c *Client) GetEntity(ctx context.Context, entityType string, id int, include []string) (Entity, error)
GetEntity gets a single entity by type and ID.
func (*Client) GetMetaIndex ¶
GetMetaIndex fetches the metadata index (list of all entity types) as XML.
func (*Client) GetTypeMeta ¶
GetTypeMeta fetches metadata for a specific entity type as XML.
func (*Client) QueryV2 ¶
QueryV2 executes a v2 API query and returns raw JSON bytes. entityType is singular (e.g., "UserStory", "Assignable").
func (*Client) QueryV2Entity ¶
func (c *Client) QueryV2Entity(ctx context.Context, entityType string, id int, selectExpr string) ([]byte, error)
QueryV2Entity gets a single entity by ID via v2.
func (*Client) ResolveEntityType ¶ added in v0.4.0
ResolveEntityType resolves the entity type for a given ID via the General endpoint.