client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client is the hand-written wrapper around the generated transport. It owns auth, base URL, and — crucially — error decoding into Problem, which is where the CLI's discoverability value lives. The generated client is treated strictly as a transport layer; wrappers go through Do/DoRaw so the 2xx-check, ProblemDetail decode and `*/*`-quirk are solved in exactly one place.

Index

Constants

This section is empty.

Variables

View Source
var ErrResponseTooLarge = errors.New("response too large")

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Problem   *problem.Problem
	TooLarge  *ResponseTooLargeError
	Status    int
	Body      []byte
	Malformed bool // true when the body was not a recognizable ProblemDetail
	Transport error
}

APIError carries either a decoded Problem or a malformed-response marker.

func APIErrorFromRead

func APIErrorFromRead(err error) *APIError

APIErrorFromRead converts a typed streaming read failure into the same APIError shape used for Content-Length and buffered-response limit failures.

func Do

func Do[T any](c *Client, call LowLevel) (*T, *APIError)

Do is DoRaw + a typed JSON unmarshal into T. An empty 2xx body (e.g. 204 No Content) yields the zero value of T, not an error. A non-empty body that fails to unmarshal is a malformed-response APIError carrying the real status code.

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) ExitCode

func (e *APIError) ExitCode() int

type AuditFilters

type AuditFilters struct {
	Search, ActionType, Actor, EntityType, From, To string
	EntityID                                        int64
	Include                                         []string
}

AuditFilters holds the audit-search filters; empty fields are omitted.

type Client

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

func New

func New(baseURL, apiKey string) (*Client, error)

func (*Client) ActivateGroup

func (c *Client) ActivateGroup(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) AddAccess

func (c *Client) AddAccess(ctx context.Context, pageID int64, f api.PageRestrictionAccessForm) ([]byte, *APIError)

func (*Client) AddGroupAccess

func (c *Client) AddGroupAccess(ctx context.Context, pageID int64, f api.PageRestrictionGroupAccessForm) ([]byte, *APIError)

func (*Client) AddGroupMember

func (c *Client) AddGroupMember(ctx context.Context, id int64, f api.AddMemberForm) ([]byte, *APIError)

func (*Client) AddWorkItemTransition

func (c *Client) AddWorkItemTransition(ctx context.Context, typeSlug string, f api.WorkItemTransitionCreateForm) ([]byte, *APIError)

func (*Client) ArchivePage

func (c *Client) ArchivePage(ctx context.Context, id int64, f api.ArchivePageForm) ([]byte, *APIError)

func (*Client) CommentWorkItem

func (c *Client) CommentWorkItem(ctx context.Context, pageID, workItemID int64, f api.WorkItemCommentForm) ([]byte, *APIError)

func (*Client) CreateDomainEnum

func (c *Client) CreateDomainEnum(ctx context.Context, f api.DomainEnumForm) ([]byte, *APIError)

func (*Client) CreateExternalUser

func (c *Client) CreateExternalUser(ctx context.Context, f api.ExternalUserForm) ([]byte, *APIError)

func (*Client) CreateGroup

func (c *Client) CreateGroup(ctx context.Context, f api.UserGroupForm) ([]byte, *APIError)

func (*Client) CreatePage

func (c *Client) CreatePage(ctx context.Context, name string, pageTypeID int64, parentID *int64, content *string) ([]byte, *APIError)

CreatePage — POST /public/v1/pages. Minimal flag-driven form (name + pageTypeId, optional parent/content). For the full form incl. propertyValues use the -f form.json route via CreatePageForm.

func (*Client) CreatePageForm

func (c *Client) CreatePageForm(ctx context.Context, form api.PageCreateForm) ([]byte, *APIError)

CreatePageForm — POST /public/v1/pages with a full PageCreateForm (the -f form.json route). propertyValues[] are sent verbatim; the server validates dataType↔value. No client-side semantic validation.

func (*Client) CreatePageType

func (c *Client) CreatePageType(ctx context.Context, f api.PageTypeForm) ([]byte, *APIError)

func (*Client) CreatePropertyDescriptor

func (c *Client) CreatePropertyDescriptor(ctx context.Context, pageTypeID int64, f api.PropertyDescriptorForm) ([]byte, *APIError)

func (*Client) CreateRestriction

func (c *Client) CreateRestriction(ctx context.Context, pageID int64) ([]byte, *APIError)

func (*Client) CreateWorkItem

func (c *Client) CreateWorkItem(ctx context.Context, pageID int64, f api.WorkItemCreateForm) ([]byte, *APIError)

func (*Client) CreateWorkItemType

func (c *Client) CreateWorkItemType(ctx context.Context, f api.WorkItemTypeCreateForm) ([]byte, *APIError)

func (*Client) DeactivateGroup

func (c *Client) DeactivateGroup(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DeleteArchivedPage

func (c *Client) DeleteArchivedPage(ctx context.Context, pageID int64) ([]byte, *APIError)

DeleteArchivedPage — DELETE /public/v1/pages/admin/archive/{pageId}: moves an archived page to trash (admin). CLI command: `archive delete`.

func (*Client) DeleteDomainEnum

func (c *Client) DeleteDomainEnum(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DeleteFileAttachment

func (c *Client) DeleteFileAttachment(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DeleteImage

func (c *Client) DeleteImage(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DeletePage

func (c *Client) DeletePage(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DeletePageType

func (c *Client) DeletePageType(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DeletePropertyDescriptor

func (c *Client) DeletePropertyDescriptor(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DeleteWorkItem

func (c *Client) DeleteWorkItem(ctx context.Context, pageID, workItemID int64) ([]byte, *APIError)

func (*Client) DeleteWorkItemType

func (c *Client) DeleteWorkItemType(ctx context.Context, slug string) ([]byte, *APIError)

func (*Client) DiscardWorkingRevision

func (c *Client) DiscardWorkingRevision(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) DoConditional

func (c *Client) DoConditional(call LowLevel) (body []byte, notModified bool, apiErr *APIError)

DoConditional is for ETag/If-None-Match GETs: a 304 is returned as notModified=true (NOT an error), 2xx as the body, other non-2xx as APIError.

func (*Client) DoDownload

func (c *Client) DoDownload(call LowLevel) (body io.ReadCloser, notModified bool, apiErr *APIError)

DoDownload is the streaming counterpart of DoConditional. On a successful 2xx response the caller owns and must close body. Every other path closes the response body before returning.

func (*Client) DoRaw

func (c *Client) DoRaw(call LowLevel) ([]byte, *APIError)

DoRaw executes a low-level call and returns the raw 2xx body. It centralises the two API-wide invariants: non-2xx → ProblemDetail/APIError via decodeError, and the `*/*` content-type quirk → the body is always read raw here (the generated client gives no typed JSON200 for `*/*`). NOTE: 3xx (incl. 304) is treated as an error; ETag/If-None-Match GETs must use DoConditional.

func (*Client) DownloadAttachment

func (c *Client) DownloadAttachment(ctx context.Context, id int64, ifNoneMatch string) (io.ReadCloser, bool, *APIError)

func (*Client) DownloadImage

func (c *Client) DownloadImage(ctx context.Context, id int64, ifNoneMatch string) (io.ReadCloser, bool, *APIError)

func (*Client) EditWorkItem

func (c *Client) EditWorkItem(ctx context.Context, pageID, workItemID int64, f api.WorkItemEditForm) ([]byte, *APIError)

func (*Client) GetArchivedPage

func (c *Client) GetArchivedPage(ctx context.Context, pageID int64) ([]byte, *APIError)

GetArchivedPage — GET /public/v1/pages/admin/archive/{pageId}: admin read view of a single archived page (ArchivedPageViewResult with nested page detail).

func (*Client) GetAvailablePropertyDescriptors

func (c *Client) GetAvailablePropertyDescriptors(ctx context.Context, pageTypeID int64) ([]byte, *APIError)

func (*Client) GetChainLinkOptions

func (c *Client) GetChainLinkOptions(ctx context.Context, pageTypeID, pageID int64) ([]byte, *APIError)

func (*Client) GetContentMacroDocs

func (c *Client) GetContentMacroDocs(ctx context.Context) ([]byte, *APIError)

GetContentMacroDocs — GET /public/v1/content-macros/docs: the full macro knowledge base (preamble + shared filter syntax + per-macro documentation).

func (*Client) GetContentMacroDocsByName

func (c *Client) GetContentMacroDocsByName(ctx context.Context, name string) ([]byte, *APIError)

GetContentMacroDocsByName — GET /public/v1/content-macros/{name}/docs: one macro's documentation (directiveName as key; 404 CONTENT_MACRO_NOT_FOUND).

func (*Client) GetDomainEnum

func (c *Client) GetDomainEnum(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) GetDomainEnumUsages

func (c *Client) GetDomainEnumUsages(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) GetGroup

func (c *Client) GetGroup(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) GetLandingSettings

func (c *Client) GetLandingSettings(ctx context.Context) ([]byte, *APIError)

func (*Client) GetPage

func (c *Client) GetPage(ctx context.Context, id int64, expand []string) ([]byte, *APIError)

GetPage — GET /public/v1/pages/{id} (?expand=). Raw composite body.

func (*Client) GetPageType

func (c *Client) GetPageType(ctx context.Context, id int64, expand []string) ([]byte, *APIError)

func (*Client) GetPagesTree

func (c *Client) GetPagesTree(ctx context.Context, ifNoneMatch string) (body []byte, notModified bool, err *APIError)

func (*Client) GetPropertyDescriptor

func (c *Client) GetPropertyDescriptor(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) GetReleaseNoteByVersion

func (c *Client) GetReleaseNoteByVersion(ctx context.Context, version string) ([]byte, *APIError)

GetReleaseNoteByVersion — GET /public/v1/release-notes/{version}: one release note's detail (version + date + markdown body; 404 RELEASE_NOTE_NOT_FOUND).

func (*Client) GetRevisionSnapshot

func (c *Client) GetRevisionSnapshot(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) GetUser

func (c *Client) GetUser(ctx context.Context, id int64, expand []string) ([]byte, *APIError)

func (*Client) GetWorkItem

func (c *Client) GetWorkItem(ctx context.Context, pageID, workItemID int64) ([]byte, *APIError)

func (*Client) GetWorkItemTransitions

func (c *Client) GetWorkItemTransitions(ctx context.Context, pageID, workItemID int64) ([]byte, *APIError)

func (*Client) GetWorkItemType

func (c *Client) GetWorkItemType(ctx context.Context, slug string) ([]byte, *APIError)

func (*Client) GetWorkflowRoles

func (c *Client) GetWorkflowRoles(ctx context.Context, include string) ([]byte, *APIError)

func (*Client) ListArchive

func (c *Client) ListArchive(ctx context.Context, page, size int, sort []string) ([]byte, *APIError)

ListArchive — GET /public/v1/admin/archive: the archived-pages overview (admin). Paged exactly like ListTrash; every row carries the archive reason.

func (*Client) ListContentMacros

func (c *Client) ListContentMacros(ctx context.Context, context string) ([]byte, *APIError)

func (*Client) ListDomainEnums

func (c *Client) ListDomainEnums(ctx context.Context, expand []string) ([]byte, *APIError)

func (*Client) ListDraftsQueue

func (c *Client) ListDraftsQueue(ctx context.Context, page, size int, sort []string) ([]byte, *APIError)

func (*Client) ListGroups

func (c *Client) ListGroups(ctx context.Context, status string, page, size int, sort []string) ([]byte, *APIError)

func (*Client) ListPageImages

func (c *Client) ListPageImages(ctx context.Context, pageID int64) ([]byte, *APIError)

func (*Client) ListPageTypes

func (c *Client) ListPageTypes(ctx context.Context) ([]byte, *APIError)

func (*Client) ListPages

func (c *Client) ListPages(ctx context.Context, page, size int, sort []string, pageTypeID *int64) (*api.PagePageListResult, *APIError)

ListPages — GET /public/v1/pages (paginated). Empty Pageable + pageableEditor avoids the broken object-styling; the */* body is read raw by Do.

func (*Client) ListPublishQueue

func (c *Client) ListPublishQueue(ctx context.Context, page, size int, sort []string) ([]byte, *APIError)

func (*Client) ListReleaseNotes

func (c *Client) ListReleaseNotes(ctx context.Context, page, size int) ([]byte, *APIError)

ListReleaseNotes — GET /public/v1/release-notes: paged release-note summaries (version + date). The server enforces a fixed semver-desc order and rejects a sort param (400 INVALID_SORT), so this exposes only page/size — never sort.

func (*Client) ListReviewQueue

func (c *Client) ListReviewQueue(ctx context.Context, page, size int, sort []string) ([]byte, *APIError)

func (*Client) ListRevisions

func (c *Client) ListRevisions(ctx context.Context, id int64, compare string) ([]byte, *APIError)

func (*Client) ListTrash

func (c *Client) ListTrash(ctx context.Context, page, size int, sort []string) ([]byte, *APIError)

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context, status string, page, size int, sort []string) ([]byte, *APIError)

func (*Client) ListWorkItemTypes

func (c *Client) ListWorkItemTypes(ctx context.Context, page, size int, sort []string) ([]byte, *APIError)

func (*Client) ListWorkItems

func (c *Client) ListWorkItems(ctx context.Context, pageID int64, typ string) ([]byte, *APIError)

func (*Client) Me

func (c *Client) Me(ctx context.Context) ([]byte, *APIError)

Me — GET /public/v1/users/me (self-discovery of the API-key owner).

func (*Client) MovePage

func (c *Client) MovePage(ctx context.Context, id int64, f api.PageMoveForm) ([]byte, *APIError)

func (*Client) MovePageType

func (c *Client) MovePageType(ctx context.Context, id int64, f api.PageTypeMoveForm) ([]byte, *APIError)

func (*Client) PatchPage

func (c *Client) PatchPage(ctx context.Context, id int64, f api.PagePatchForm) ([]byte, *APIError)

func (*Client) PerformTransition

func (c *Client) PerformTransition(ctx context.Context, id int64, f api.TransitionForm) ([]byte, *APIError)

func (*Client) PermanentDeleteUser

func (c *Client) PermanentDeleteUser(ctx context.Context, id int64, f api.PermanentDeleteForm) ([]byte, *APIError)

func (*Client) PurgeFromTrash

func (c *Client) PurgeFromTrash(ctx context.Context, pageID int64) ([]byte, *APIError)

func (*Client) ReactivateUser

func (c *Client) ReactivateUser(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) RemoveAccess

func (c *Client) RemoveAccess(ctx context.Context, pageID, accessID int64) ([]byte, *APIError)

func (*Client) RemoveGroupAccess

func (c *Client) RemoveGroupAccess(ctx context.Context, pageID, accessID int64) ([]byte, *APIError)

func (*Client) RemoveGroupMember

func (c *Client) RemoveGroupMember(ctx context.Context, id, userID int64) ([]byte, *APIError)

func (*Client) RemoveRestriction

func (c *Client) RemoveRestriction(ctx context.Context, pageID int64) ([]byte, *APIError)

func (*Client) RemoveWorkItemTransition

func (c *Client) RemoveWorkItemTransition(ctx context.Context, typeSlug string, transitionID int64) ([]byte, *APIError)

func (*Client) RestoreFromTrash

func (c *Client) RestoreFromTrash(ctx context.Context, pageID int64) ([]byte, *APIError)

func (*Client) RestoreVersion

func (c *Client) RestoreVersion(ctx context.Context, id int64, revisionNumber int32) ([]byte, *APIError)

func (*Client) ScanMacroUsage

func (c *Client) ScanMacroUsage(ctx context.Context, macroName string) ([]byte, *APIError)

ScanMacroUsage — GET /public/v1/content-macros/{macroName}/scan: pages that use a macro (access-aware; requires an admin API key). Returns a MacroScanResult.

func (*Client) SearchAuditLog

func (c *Client) SearchAuditLog(ctx context.Context, f AuditFilters, page, size int, sort []string) ([]byte, *APIError)

func (*Client) SearchGroups

func (c *Client) SearchGroups(ctx context.Context, query string, page, size int, sort []string) ([]byte, *APIError)

func (*Client) SearchPages

func (c *Client) SearchPages(ctx context.Context, query string, page, size int, allowedPageTypeID *int64) ([]byte, *APIError)

SearchPages — GET /public/v1/pages/search?query=. Raw body. allowedPageTypeID, when non-nil, scopes the candidates to a page type (used by --property PAGE_OUTGOING name resolution).

func (*Client) SearchUsers

func (c *Client) SearchUsers(ctx context.Context, query string, page, size int, sort []string) ([]byte, *APIError)

func (*Client) SetGroupWorkflowRole

func (c *Client) SetGroupWorkflowRole(ctx context.Context, groupID int64, f api.WorkflowRoleForm) ([]byte, *APIError)

func (*Client) SetUserWorkflowRole

func (c *Client) SetUserWorkflowRole(ctx context.Context, userID int64, f api.WorkflowRoleForm) ([]byte, *APIError)

func (*Client) SortChildren

func (c *Client) SortChildren(ctx context.Context, parentID int64, childIDs []int64) ([]byte, *APIError)

func (*Client) SortDisplayColumns

func (c *Client) SortDisplayColumns(ctx context.Context, descriptorID int64, ids []int64) ([]byte, *APIError)

func (*Client) SortPropertyDescriptors

func (c *Client) SortPropertyDescriptors(ctx context.Context, pageTypeID int64, ids []int64) ([]byte, *APIError)

func (*Client) StartRevision

func (c *Client) StartRevision(ctx context.Context, id int64) ([]byte, *APIError)

func (*Client) SwapPropertyDescriptors

func (c *Client) SwapPropertyDescriptors(ctx context.Context, fromID, toID int64) ([]byte, *APIError)

func (*Client) TransitionWorkItem

func (c *Client) TransitionWorkItem(ctx context.Context, pageID, workItemID int64, f api.WorkItemTransitionForm) ([]byte, *APIError)

func (*Client) UnarchivePage

func (c *Client) UnarchivePage(ctx context.Context, pageID int64) ([]byte, *APIError)

UnarchivePage — POST /public/v1/pages/admin/archive/{pageId}/unarchive: the server-side name of what the CLI exposes as `archive restore`.

func (*Client) UpdateAccess

func (c *Client) UpdateAccess(ctx context.Context, pageID, accessID int64, f api.PageRestrictionAccessForm) ([]byte, *APIError)

func (*Client) UpdateDomainEnum

func (c *Client) UpdateDomainEnum(ctx context.Context, id int64, f api.DomainEnumForm) ([]byte, *APIError)

func (*Client) UpdateGroup

func (c *Client) UpdateGroup(ctx context.Context, id int64, f api.UserGroupForm) ([]byte, *APIError)

func (*Client) UpdateGroupAccess

func (c *Client) UpdateGroupAccess(ctx context.Context, pageID, accessID int64, f api.PageRestrictionGroupAccessForm) ([]byte, *APIError)

func (*Client) UpdateLandingSettings

func (c *Client) UpdateLandingSettings(ctx context.Context, f api.LandingSettingsForm) ([]byte, *APIError)

func (*Client) UpdatePage

func (c *Client) UpdatePage(ctx context.Context, id int64, f api.PageEditForm) ([]byte, *APIError)

func (*Client) UpdatePageType

func (c *Client) UpdatePageType(ctx context.Context, id int64, f api.PageTypeForm) ([]byte, *APIError)

func (*Client) UpdatePropertyDescriptor

func (c *Client) UpdatePropertyDescriptor(ctx context.Context, id int64, f api.PropertyDescriptorForm) ([]byte, *APIError)

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, id int64, f api.UserForm) ([]byte, *APIError)

func (*Client) UpdateWorkItemTransition

func (c *Client) UpdateWorkItemTransition(ctx context.Context, typeSlug string, transitionID int64, f api.WorkItemTransitionUpdateForm) ([]byte, *APIError)

func (*Client) UpdateWorkItemType

func (c *Client) UpdateWorkItemType(ctx context.Context, slug string, f api.WorkItemTypeUpdateForm) ([]byte, *APIError)

func (*Client) UploadAttachment

func (c *Client) UploadAttachment(ctx context.Context, pageID int64, filePath string) ([]byte, *APIError)

UploadAttachment uploads a file as a page attachment (multipart/form-data, part name "file") — POST /public/v1/pages/{pageId}/file-attachments.

func (*Client) UploadPageImage

func (c *Client) UploadPageImage(ctx context.Context, pageID int64, filePath string) ([]byte, *APIError)

UploadPageImage uploads a file as a page image — POST /public/v1/pages/{pageId}/images.

func (*Client) ValidateContent

func (c *Client) ValidateContent(ctx context.Context, f api.PublicContentValidationForm) ([]byte, *APIError)

type LowLevel

type LowLevel func() (*http.Response, error)

LowLevel is a thunk that performs exactly one generated low-level oapi call. The wrapper method closes over ctx, path params, body and request-editors, so Do/DoRaw stay completely generic and never see resource-specific shapes.

type ResponseTooLargeError

type ResponseTooLargeError struct {
	Status int
	Limit  int64
}

func (*ResponseTooLargeError) Error

func (e *ResponseTooLargeError) Error() string

func (*ResponseTooLargeError) Unwrap

func (e *ResponseTooLargeError) Unwrap() error

Jump to

Keyboard shortcuts

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