Documentation
¶
Index ¶
- Variables
- type AuthSession
- type CatalogStats
- type CatalogVersion
- type Category
- type CategoryOptimisticLockConflict
- type Collection
- type CollectionOptimisticLockConflict
- type CreateCategoryInput
- type CreateCategoryPayload
- type CreateCollectionInput
- type CreateCollectionPayload
- type CreateProductInput
- type CreateProductPayload
- type DeleteCategoryInput
- type DeleteCategoryPayload
- type DeleteCollectionInput
- type DeleteCollectionPayload
- type DeleteProductInput
- type DeleteProductPayload
- type InventoryStatus
- type LoginInput
- type LoginPayload
- type LogoutInput
- type LogoutPayload
- type Mutation
- type Node
- type OptimisticLockConflict
- type PageInfo
- type Product
- type ProductConnection
- type ProductEdge
- type ProductFilter
- type PublishCatalogInput
- type PublishCatalogPayload
- type Query
- type RefreshTokenInput
- type RefreshTokenPayload
- type ReorderCategoriesInput
- type ReorderCategoriesPayload
- type ReorderCollectionsInput
- type ReorderCollectionsPayload
- type UpdateCategoryInput
- type UpdateCategoryPayload
- type UpdateCollectionInput
- type UpdateCollectionPayload
- type UpdateProductInput
- type UpdateProductPayload
- type User
Constants ¶
This section is empty.
Variables ¶
var AllInventoryStatus = []InventoryStatus{ InventoryStatusInStock, InventoryStatusOutOfStock, InventoryStatusPreorder, InventoryStatusDiscontinued, }
Functions ¶
This section is empty.
Types ¶
type AuthSession ¶
type AuthSession struct {
// JWT token for authentication
Token string `json:"token"`
// Token expiration time (ISO 8601)
ExpiresAt time.Time `json:"expiresAt"`
// Authenticated user information
User *User `json:"user"`
}
Authentication session response
type CatalogStats ¶
type CatalogStats struct {
// Total products
ProductCount int32 `json:"productCount"`
// Total categories
CategoryCount int32 `json:"categoryCount"`
// Total collections
CollectionCount int32 `json:"collectionCount"`
// Number of orphaned product references
OrphanedReferences int32 `json:"orphanedReferences"`
}
Catalog statistics
type CatalogVersion ¶
type CatalogVersion struct {
// Version tag (e.g., v1.0.0)
Tag string `json:"tag"`
// Commit SHA
Commit string `json:"commit"`
// Release timestamp
PublishedAt time.Time `json:"publishedAt"`
// Release message
Message *string `json:"message,omitempty"`
// Statistics
Stats *CatalogStats `json:"stats"`
}
Catalog version information
type Category ¶
type Category struct {
// Globally unique identifier (format: cat_[base62])
ID string `json:"id"`
// Category display name
Name string `json:"name"`
// URL-friendly slug (unique)
Slug string `json:"slug"`
// Parent category (null for root categories)
Parent *Category `json:"parent,omitempty"`
// Child categories (subcategories)
Children []*Category `json:"children"`
// Display order within parent
DisplayOrder int32 `json:"displayOrder"`
// Products in this category (includes subcategory products)
Products *ProductConnection `json:"products"`
// Markdown body content (category description with rich formatting)
Body *string `json:"body,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt"`
// Last modification timestamp
UpdatedAt time.Time `json:"updatedAt"`
// Full path from root (e.g., ["Electronics", "Computers", "Laptops"])
Path []string `json:"path"`
// Depth in tree (root = 0)
Depth int32 `json:"depth"`
}
Category represents a hierarchical classification system for products
type CategoryOptimisticLockConflict ¶
type CategoryOptimisticLockConflict struct {
// Current version in database
CurrentVersion time.Time `json:"currentVersion"`
// Version client attempted to update
AttemptedVersion time.Time `json:"attemptedVersion"`
// Current state of the category
Current *Category `json:"current"`
// Diff between current and attempted
Diff string `json:"diff"`
}
Optimistic lock conflict for category
type Collection ¶
type Collection struct {
// Globally unique identifier (format: coll_[base62])
ID string `json:"id"`
// Collection display name
Name string `json:"name"`
// URL-friendly slug (unique)
Slug string `json:"slug"`
// Display order for collection listing
DisplayOrder int32 `json:"displayOrder"`
// Products in this collection
Products *ProductConnection `json:"products"`
// Markdown body content (collection description with rich formatting)
Body *string `json:"body,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt"`
// Last modification timestamp
UpdatedAt time.Time `json:"updatedAt"`
// Number of products in this collection
ProductCount int32 `json:"productCount"`
}
Collection represents a curated grouping of products (flat, non-hierarchical)
func (Collection) GetID ¶
func (this Collection) GetID() string
Globally unique identifier (format: [type]_[base62])
func (Collection) IsNode ¶
func (Collection) IsNode()
type CollectionOptimisticLockConflict ¶
type CollectionOptimisticLockConflict struct {
// Current version in database
CurrentVersion time.Time `json:"currentVersion"`
// Version client attempted to update
AttemptedVersion time.Time `json:"attemptedVersion"`
// Current state of the collection
Current *Collection `json:"current"`
// Diff between current and attempted
Diff string `json:"diff"`
}
Optimistic lock conflict for collection
type CreateCategoryInput ¶
type CreateCategoryInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Category name
Name string `json:"name"`
// URL-friendly slug (must be unique)
Slug string `json:"slug"`
// Parent category ID (null for root)
ParentID *string `json:"parentId,omitempty"`
// Display order
DisplayOrder *int32 `json:"displayOrder,omitempty"`
// Markdown body content
Body *string `json:"body,omitempty"`
}
Input for creating a category
type CreateCategoryPayload ¶
type CreateCategoryPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// The created category
Category *Category `json:"category,omitempty"`
}
Payload for createCategory mutation
type CreateCollectionInput ¶
type CreateCollectionInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Collection name
Name string `json:"name"`
// URL-friendly slug (must be unique)
Slug string `json:"slug"`
// Display order
DisplayOrder *int32 `json:"displayOrder,omitempty"`
// Product IDs to include
ProductIds []string `json:"productIds,omitempty"`
// Markdown body content
Body *string `json:"body,omitempty"`
}
Input for creating a collection
type CreateCollectionPayload ¶
type CreateCollectionPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// The created collection
Collection *Collection `json:"collection,omitempty"`
}
Payload for createCollection mutation
type CreateProductInput ¶
type CreateProductInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Stock Keeping Unit (must be unique)
Sku string `json:"sku"`
// Product display name
Title string `json:"title"`
// Markdown body content (product description)
Body *string `json:"body,omitempty"`
// Product price
Price scalar.Decimal `json:"price"`
// Currency code (default: USD)
Currency *string `json:"currency,omitempty"`
// Inventory status (default: IN_STOCK)
InventoryStatus *InventoryStatus `json:"inventoryStatus,omitempty"`
// Available quantity
InventoryQuantity *int32 `json:"inventoryQuantity,omitempty"`
// Primary category ID (required)
CategoryID string `json:"categoryId"`
// Collection IDs (optional)
CollectionIds []string `json:"collectionIds,omitempty"`
// Product image URLs
Images []string `json:"images,omitempty"`
// Custom metadata
Metadata map[string]any `json:"metadata,omitempty"`
}
Input for creating a product
type CreateProductPayload ¶
type CreateProductPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// The created product
Product *Product `json:"product,omitempty"`
}
Payload for createProduct mutation
type DeleteCategoryInput ¶
type DeleteCategoryInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Category ID to delete
ID string `json:"id"`
}
Input for deleting a category
type DeleteCategoryPayload ¶
type DeleteCategoryPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Deleted category ID
DeletedCategoryID *string `json:"deletedCategoryId,omitempty"`
// Orphaned product IDs (products that referenced this category)
OrphanedProductIds []string `json:"orphanedProductIds,omitempty"`
}
Payload for deleteCategory mutation
type DeleteCollectionInput ¶
type DeleteCollectionInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Collection ID to delete
ID string `json:"id"`
}
Input for deleting a collection
type DeleteCollectionPayload ¶
type DeleteCollectionPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Deleted collection ID
DeletedCollectionID *string `json:"deletedCollectionId,omitempty"`
}
Payload for deleteCollection mutation
type DeleteProductInput ¶
type DeleteProductInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Product ID to delete
ID string `json:"id"`
}
Input for deleting a product
type DeleteProductPayload ¶
type DeleteProductPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Deleted product ID
DeletedProductID *string `json:"deletedProductId,omitempty"`
}
Payload for deleteProduct mutation
type InventoryStatus ¶
type InventoryStatus string
Product inventory status
const ( InventoryStatusInStock InventoryStatus = "IN_STOCK" InventoryStatusOutOfStock InventoryStatus = "OUT_OF_STOCK" InventoryStatusPreorder InventoryStatus = "PREORDER" InventoryStatusDiscontinued InventoryStatus = "DISCONTINUED" )
func (InventoryStatus) IsValid ¶
func (e InventoryStatus) IsValid() bool
func (InventoryStatus) MarshalGQL ¶
func (e InventoryStatus) MarshalGQL(w io.Writer)
func (InventoryStatus) MarshalJSON ¶
func (e InventoryStatus) MarshalJSON() ([]byte, error)
func (InventoryStatus) String ¶
func (e InventoryStatus) String() string
func (*InventoryStatus) UnmarshalGQL ¶
func (e *InventoryStatus) UnmarshalGQL(v any) error
func (*InventoryStatus) UnmarshalJSON ¶
func (e *InventoryStatus) UnmarshalJSON(b []byte) error
type LoginInput ¶
type LoginInput struct {
// Client mutation ID for request tracking (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Username
Username string `json:"username"`
// Password
Password string `json:"password"`
}
Login mutation input (Relay pattern)
type LoginPayload ¶
type LoginPayload struct {
// Client mutation ID for request tracking (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Authentication session (token + user info)
Session *AuthSession `json:"session,omitempty"`
}
Login mutation payload (Relay pattern)
type LogoutInput ¶
type LogoutInput struct {
// Client mutation ID for request tracking (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
}
Logout mutation input (Relay pattern)
type LogoutPayload ¶
type LogoutPayload struct {
// Client mutation ID for request tracking (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Success indicator
Success bool `json:"success"`
}
Logout mutation payload (Relay pattern)
type Node ¶
type Node interface {
IsNode()
// Globally unique identifier (format: [type]_[base62])
GetID() string
}
An object with a globally unique ID
type OptimisticLockConflict ¶
type OptimisticLockConflict struct {
// Current version in database
CurrentVersion time.Time `json:"currentVersion"`
// Version client attempted to update
AttemptedVersion time.Time `json:"attemptedVersion"`
// Current state of the entity
Current *Product `json:"current"`
// Diff between current and attempted (human-readable)
Diff string `json:"diff"`
}
Optimistic lock conflict information
type PageInfo ¶
type PageInfo struct {
// When paginating forwards, are there more items?
HasNextPage bool `json:"hasNextPage"`
// When paginating backwards, are there more items?
HasPreviousPage bool `json:"hasPreviousPage"`
// When paginating backwards, the cursor to continue
StartCursor *string `json:"startCursor,omitempty"`
// When paginating forwards, the cursor to continue
EndCursor *string `json:"endCursor,omitempty"`
}
Information about pagination in a connection
type Product ¶
type Product struct {
// Globally unique identifier (format: prod_[base62])
ID string `json:"id"`
// Stock Keeping Unit (unique)
Sku string `json:"sku"`
// Product display name
Title string `json:"title"`
// Markdown body content (product description with rich formatting)
Body *string `json:"body,omitempty"`
// Product price
Price scalar.Decimal `json:"price"`
// Currency code (ISO 4217)
Currency string `json:"currency"`
// Inventory status
InventoryStatus InventoryStatus `json:"inventoryStatus"`
// Available quantity (null if not tracked)
InventoryQuantity *int32 `json:"inventoryQuantity,omitempty"`
// Primary category (exactly one)
Category *Category `json:"category"`
// Collections this product belongs to (multiple allowed)
Collections []*Collection `json:"collections"`
// Product image URLs (external CDN)
Images []string `json:"images"`
// Custom metadata (free-form JSON)
Metadata map[string]any `json:"metadata,omitempty"`
// Creation timestamp
CreatedAt time.Time `json:"createdAt"`
// Last modification timestamp
UpdatedAt time.Time `json:"updatedAt"`
}
Product represents a sellable item in the catalog
type ProductConnection ¶
type ProductConnection struct {
// List of product edges
Edges []*ProductEdge `json:"edges"`
// Pagination information
PageInfo *PageInfo `json:"pageInfo"`
// Total count of products matching filter
TotalCount int32 `json:"totalCount"`
}
Connection type for paginated products (Relay pattern)
type ProductEdge ¶
type ProductEdge struct {
// Cursor for pagination
Cursor string `json:"cursor"`
// The product node
Node *Product `json:"node"`
}
Edge type for Product connection (Relay pattern)
type ProductFilter ¶
type ProductFilter struct {
// Filter by category ID (includes subcategory products)
CategoryID *string `json:"categoryId,omitempty"`
// Filter by collection ID
CollectionID *string `json:"collectionId,omitempty"`
// Filter by inventory status
InventoryStatus *InventoryStatus `json:"inventoryStatus,omitempty"`
// Filter by minimum price
PriceMin *scalar.Decimal `json:"priceMin,omitempty"`
// Filter by maximum price
PriceMax *scalar.Decimal `json:"priceMax,omitempty"`
// Search query (title, description, SKU)
Search *string `json:"search,omitempty"`
}
Product filter options
type PublishCatalogInput ¶
type PublishCatalogInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Release version tag (e.g., v1.0.0)
Version string `json:"version"`
// Release notes/commit message
Message string `json:"message"`
}
Input for publishing catalog changes
type PublishCatalogPayload ¶
type PublishCatalogPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// New catalog version
CatalogVersion *CatalogVersion `json:"catalogVersion,omitempty"`
}
Payload for publishCatalog mutation
type RefreshTokenInput ¶
type RefreshTokenInput struct {
// Client mutation ID for request tracking (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
}
Refresh token mutation input (Relay pattern)
type RefreshTokenPayload ¶
type RefreshTokenPayload struct {
// Client mutation ID for request tracking (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// New authentication session
Session *AuthSession `json:"session,omitempty"`
}
Refresh token mutation payload (Relay pattern)
type ReorderCategoriesInput ¶
type ReorderCategoriesInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Ordered list of category IDs within parent
OrderedIds []string `json:"orderedIds"`
// Parent category ID (null for root categories)
ParentID *string `json:"parentId,omitempty"`
// Category ID being moved (for tree restructure)
MovedCategoryID *string `json:"movedCategoryId,omitempty"`
// New parent ID for moved category (for tree restructure)
NewParentID *string `json:"newParentId,omitempty"`
}
Input for reordering categories (drag-and-drop)
type ReorderCategoriesPayload ¶
type ReorderCategoriesPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Updated categories
Categories []*Category `json:"categories,omitempty"`
}
Payload for reorderCategories mutation
type ReorderCollectionsInput ¶
type ReorderCollectionsInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Ordered list of collection IDs
OrderedIds []string `json:"orderedIds"`
}
Input for reordering collections (drag-and-drop)
type ReorderCollectionsPayload ¶
type ReorderCollectionsPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Updated collections
Collections []*Collection `json:"collections,omitempty"`
}
Payload for reorderCollections mutation
type UpdateCategoryInput ¶
type UpdateCategoryInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Category ID to update
ID string `json:"id"`
// New name
Name *string `json:"name,omitempty"`
// New slug
Slug *string `json:"slug,omitempty"`
// New parent ID (null to make root, ID to change parent)
ParentID *string `json:"parentId,omitempty"`
// New display order
DisplayOrder *int32 `json:"displayOrder,omitempty"`
// New body content
Body *string `json:"body,omitempty"`
// Version for optimistic locking
Version time.Time `json:"version"`
}
Input for updating a category
type UpdateCategoryPayload ¶
type UpdateCategoryPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// The updated category
Category *Category `json:"category,omitempty"`
// Conflict information (if optimistic lock failed)
Conflict *CategoryOptimisticLockConflict `json:"conflict,omitempty"`
}
Payload for updateCategory mutation
type UpdateCollectionInput ¶
type UpdateCollectionInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Collection ID to update
ID string `json:"id"`
// New name
Name *string `json:"name,omitempty"`
// New slug
Slug *string `json:"slug,omitempty"`
// New display order
DisplayOrder *int32 `json:"displayOrder,omitempty"`
// New product IDs (replaces all)
ProductIds []string `json:"productIds,omitempty"`
// New body content
Body *string `json:"body,omitempty"`
// Version for optimistic locking
Version time.Time `json:"version"`
}
Input for updating a collection
type UpdateCollectionPayload ¶
type UpdateCollectionPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// The updated collection
Collection *Collection `json:"collection,omitempty"`
// Conflict information (if optimistic lock failed)
Conflict *CollectionOptimisticLockConflict `json:"conflict,omitempty"`
}
Payload for updateCollection mutation
type UpdateProductInput ¶
type UpdateProductInput struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// Product ID to update
ID string `json:"id"`
// New SKU (optional, must be unique)
Sku *string `json:"sku,omitempty"`
// New title
Title *string `json:"title,omitempty"`
// New description
Description *string `json:"description,omitempty"`
// New body content
Body *string `json:"body,omitempty"`
// New price
Price *scalar.Decimal `json:"price,omitempty"`
// New currency
Currency *string `json:"currency,omitempty"`
// New inventory status
InventoryStatus *InventoryStatus `json:"inventoryStatus,omitempty"`
// New inventory quantity
InventoryQuantity *int32 `json:"inventoryQuantity,omitempty"`
// New category ID
CategoryID *string `json:"categoryId,omitempty"`
// New collection IDs (replaces all)
CollectionIds []string `json:"collectionIds,omitempty"`
// New image URLs (replaces all)
Images []string `json:"images,omitempty"`
// New metadata (replaces all)
Metadata map[string]any `json:"metadata,omitempty"`
// Version for optimistic locking (updated_at timestamp)
Version time.Time `json:"version"`
}
Input for updating a product
type UpdateProductPayload ¶
type UpdateProductPayload struct {
// Client mutation ID (Relay pattern)
ClientMutationID *string `json:"clientMutationId,omitempty"`
// The updated product
Product *Product `json:"product,omitempty"`
// Conflict information (if optimistic lock failed)
Conflict *OptimisticLockConflict `json:"conflict,omitempty"`
}
Payload for updateProduct mutation