Documentation ¶
Index ¶
- Constants
- Variables
- func Marshal(src any, item *Item)
- type Asset
- type AssetUpload
- type CMS
- func (c *CMS) Asset(ctx context.Context, assetID string) (*Asset, error)
- func (c *CMS) CommentToAsset(ctx context.Context, assetID, content string) error
- func (c *CMS) CommentToItem(ctx context.Context, itemID, content string) error
- func (c *CMS) CreateAssetByToken(ctx context.Context, projectID, token string) (*Asset, error)
- func (c *CMS) CreateAssetUpload(ctx context.Context, projectID, name string) (*AssetUpload, error)
- func (c *CMS) CreateItem(ctx context.Context, modelID string, fields []*Field, metadataFields []*Field) (*Item, error)
- func (c *CMS) CreateItemByKey(ctx context.Context, projectID, modelID string, fields []*Field, ...) (*Item, error)
- func (c *CMS) DeleteItem(ctx context.Context, itemID string) error
- func (c *CMS) GetItem(ctx context.Context, itemID string, asset bool) (*Item, error)
- func (c *CMS) GetItems(ctx context.Context, modelID string, asset bool) (items *Items, _ error)
- func (c *CMS) GetItemsByKey(ctx context.Context, projectIDOrAlias, modelIDOrAlias string, asset bool) (*Items, error)
- func (c *CMS) GetItemsByKeyInParallel(ctx context.Context, projectIDOrAlias, modelIDOrAlias string, asset bool, ...) (*Items, error)
- func (c *CMS) GetItemsInParallel(ctx context.Context, modelID string, asset bool, limit int) (*Items, error)
- func (c *CMS) GetItemsPartially(ctx context.Context, modelID string, page, perPage int, asset bool) (*Items, error)
- func (c *CMS) GetItemsPartiallyByKey(ctx context.Context, projectIDOrAlias, modelIDOrAlias string, ...) (*Items, error)
- func (c *CMS) GetModel(ctx context.Context, modelID string) (*Model, error)
- func (c *CMS) GetModelByKey(ctx context.Context, projectKey, modelKey string) (*Model, error)
- func (c *CMS) GetModels(ctx context.Context, projectIDOrAlias string) (models *Models, _ error)
- func (c *CMS) GetModelsInParallel(ctx context.Context, modelID string, limit int) (*Models, error)
- func (c *CMS) GetModelsPartially(ctx context.Context, projectIDOrAlias string, page, perPage int) (*Models, error)
- func (c *CMS) UpdateItem(ctx context.Context, itemID string, fields []*Field, metadataFields []*Field) (*Item, error)
- func (c *CMS) UploadAsset(ctx context.Context, projectID, url string) (string, error)
- func (c *CMS) UploadAssetDirectly(ctx context.Context, projectID, name string, data io.Reader) (string, error)
- func (c *CMS) UploadToAssetUpload(ctx context.Context, upload *AssetUpload, data io.Reader) error
- func (c *CMS) WithHTTPClient(hc *http.Client) *CMS
- func (c *CMS) WithTimeout(t time.Duration) *CMS
- type Field
- type FieldChange
- type FieldChangeType
- type File
- type Interface
- type Item
- func (i *Item) Clone() *Item
- func (i *Item) Field(id string) *Field
- func (i *Item) FieldByGroup(id, group string) *Field
- func (i *Item) FieldByKey(key string) *Field
- func (i *Item) FieldByKeyAndGroup(key, group string) *Field
- func (i *Item) Group(g string) *Item
- func (i *Item) MetadataField(id string) *Field
- func (i *Item) MetadataFieldByGroup(id, group string) *Field
- func (i *Item) MetadataFieldByKey(key string) *Field
- func (i *Item) MetadataFieldByKeyAndGroup(key, group string) *Field
- func (d *Item) Unmarshal(i any)
- type Items
- type MarshalCMS
- type Model
- type Models
- type PublicAPIClient
- func (c *PublicAPIClient[T]) Clone() *PublicAPIClient[T]
- func (c *PublicAPIClient[T]) GetAllItems(ctx context.Context, project, model string) (res []T, err error)
- func (c *PublicAPIClient[T]) GetAllItemsInParallel(ctx context.Context, project, model string, limit int) ([]T, error)
- func (c *PublicAPIClient[T]) GetAsset(ctx context.Context, project, id string) (*PublicAsset, error)
- func (c *PublicAPIClient[T]) GetItem(ctx context.Context, project, model string, id string) (T, error)
- func (c *PublicAPIClient[T]) GetItems(ctx context.Context, project, model string, page, perPage int) (_ *PublicAPIListResponse[T], err error)
- func (c *PublicAPIClient[T]) WithTimeout(t time.Duration) *PublicAPIClient[T]
- type PublicAPIListResponse
- type PublicAsset
- type Schema
- type SchemaField
- type Tag
- type Value
- func (v *Value) Asset() *PublicAsset
- func (v *Value) AssetID() string
- func (v *Value) AssetURL() string
- func (v *Value) Bool() *bool
- func (v *Value) Bools() []bool
- func (v *Value) Float() *float64
- func (v *Value) Floats() []float64
- func (v *Value) Int() *int
- func (v *Value) Interface() any
- func (v *Value) Ints() []int
- func (f *Value) JSON(j any) error
- func (f *Value) JSONs(j any) error
- func (v *Value) MarshalCMS() any
- func (v *Value) MarshalJSON() ([]byte, error)
- func (v *Value) String() *string
- func (v *Value) Strings() []string
- func (v *Value) Tag() *Tag
- func (v *Value) Tags() []Tag
- func (v *Value) UnmarshalJSON(b []byte) error
Constants ¶
View Source
const (
AssetArchiveExtractionStatusDone = "done"
)
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
Functions ¶
Types ¶
type Asset ¶
type Asset struct { ArchiveExtractionStatus string `json:"archiveExtractionStatus,omitempty"` ContentType string `json:"contentType,omitempty"` CreatedAt time.Time `json:"createdAt"` File *File `json:"file,omitempty"` ID string `json:"id"` Name string `json:"name,omitempty"` PreviewType string `json:"previewType,omitempty"` ProjectID string `json:"projectId"` TotalSize uint64 `json:"totalSize,omitempty"` UpdatedAt time.Time `json:"updatedAt"` URL string `json:"url"` }
func (*Asset) ToPublic ¶
func (a *Asset) ToPublic() *PublicAsset
type AssetUpload ¶
type CMS ¶
type CMS struct {
// contains filtered or unexported fields
}
func (*CMS) CommentToAsset ¶
func (*CMS) CommentToItem ¶
func (*CMS) CreateAssetByToken ¶
func (*CMS) CreateAssetUpload ¶
func (*CMS) CreateItem ¶
func (*CMS) CreateItemByKey ¶
func (*CMS) GetItemsByKey ¶
func (*CMS) GetItemsByKeyInParallel ¶
func (*CMS) GetItemsInParallel ¶
func (*CMS) GetItemsPartially ¶
func (*CMS) GetItemsPartiallyByKey ¶
func (*CMS) GetModelByKey ¶
func (*CMS) GetModelsInParallel ¶
func (*CMS) GetModelsPartially ¶
func (*CMS) UpdateItem ¶
func (*CMS) UploadAsset ¶
func (*CMS) UploadAssetDirectly ¶
func (*CMS) UploadToAssetUpload ¶
type Field ¶
type FieldChange ¶
type FieldChange struct { ID string `json:"id,omitempty"` Type FieldChangeType `json:"type"` PreviousValue any `json:"previousValue"` CurrentValue any `json:"currentValue"` }
func (*FieldChange) GetCurrentValue ¶
func (f *FieldChange) GetCurrentValue() *Value
func (*FieldChange) GetPreviousValue ¶
func (f *FieldChange) GetPreviousValue() *Value
type FieldChangeType ¶
type FieldChangeType string
const ( FieldChangeTypeCreate FieldChangeType = "add" FieldChangeTypeUpdate FieldChangeType = "update" FieldChangeTypeDelete FieldChangeType = "delete" )
type File ¶
type Interface ¶
type Interface interface { GetModel(ctx context.Context, modelID string) (*Model, error) GetModelByKey(ctx context.Context, proejctID, modelID string) (*Model, error) GetModelsPartially(ctx context.Context, projectIDOrAlias string, page, perPage int) (*Models, error) GetModelsInParallel(ctx context.Context, modelID string, limit int) (*Models, error) GetModels(ctx context.Context, projectIDOrAlias string) (*Models, error) GetItem(ctx context.Context, itemID string, asset bool) (*Item, error) GetItemsPartially(ctx context.Context, modelID string, page, perPage int, asset bool) (*Items, error) GetItems(ctx context.Context, modelID string, asset bool) (*Items, error) GetItemsInParallel(ctx context.Context, modelID string, asset bool, limit int) (*Items, error) GetItemsPartiallyByKey(ctx context.Context, projectIDOrAlias, modelIDOrKey string, page, perPage int, asset bool) (*Items, error) GetItemsByKey(ctx context.Context, projectIDOrAlias, modelIDOrKey string, asset bool) (*Items, error) GetItemsByKeyInParallel(ctx context.Context, projectIDOrAlias, modelIDOrKey string, asset bool, limit int) (*Items, error) CreateItem(ctx context.Context, modelID string, fields []*Field, metadataFields []*Field) (*Item, error) CreateItemByKey(ctx context.Context, projectID, modelID string, fields []*Field, metadataFields []*Field) (*Item, error) UpdateItem(ctx context.Context, itemID string, fields []*Field, metadataFields []*Field) (*Item, error) DeleteItem(ctx context.Context, itemID string) error Asset(ctx context.Context, id string) (*Asset, error) UploadAsset(ctx context.Context, projectID, url string) (string, error) UploadAssetDirectly(ctx context.Context, projectID, name string, data io.Reader) (string, error) UploadToAssetUpload(ctx context.Context, upload *AssetUpload, data io.Reader) error CreateAssetByToken(ctx context.Context, projectID, token string) (*Asset, error) CreateAssetUpload(ctx context.Context, projectID, name string) (*AssetUpload, error) CommentToItem(ctx context.Context, assetID, content string) error CommentToAsset(ctx context.Context, assetID, content string) error }
type Item ¶
type Item struct { ID string `json:"id"` ModelID string `json:"modelId"` Fields []*Field `json:"fields"` MetadataFields []*Field `json:"metadataFields,omitempty"` ReferencedItems []*Item `json:"referencedItems,omitempty"` OriginalItemID *string `json:"originalItemId,omitempty"` MetadataItemID *string `json:"metadataItemId,omitempty"` IsMetadata bool `json:"isMetadata,omitempty"` }
func (*Item) FieldByGroup ¶
func (*Item) FieldByKey ¶
func (*Item) FieldByKeyAndGroup ¶
func (*Item) MetadataField ¶
func (*Item) MetadataFieldByGroup ¶
func (*Item) MetadataFieldByKey ¶
func (*Item) MetadataFieldByKeyAndGroup ¶
type Items ¶
type MarshalCMS ¶
type MarshalCMS interface {
MarshalCMS() any
}
type Model ¶
type Model struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Key string `json:"key,omitempty"` Public bool `json:"public,omitempty"` ProjectID string `json:"projectId,omitempty"` SchemaID string `json:"schemaId,omitempty"` MetadataSchemaID string `json:"metadataSchemaId,omitempty"` CreatedAt time.Time `json:"createdAt,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty"` LastModified time.Time `json:"lastModified,omitempty"` }
type Models ¶
type PublicAPIClient ¶
type PublicAPIClient[T any] struct { // contains filtered or unexported fields }
func ChangePublicAPIClientType ¶
func ChangePublicAPIClientType[T, K any](c *PublicAPIClient[T]) *PublicAPIClient[K]
func NewPublicAPIClient ¶
func (*PublicAPIClient[T]) Clone ¶
func (c *PublicAPIClient[T]) Clone() *PublicAPIClient[T]
func (*PublicAPIClient[T]) GetAllItems ¶
func (c *PublicAPIClient[T]) GetAllItems(ctx context.Context, project, model string) (res []T, err error)
func (*PublicAPIClient[T]) GetAllItemsInParallel ¶
func (*PublicAPIClient[T]) GetAsset ¶
func (c *PublicAPIClient[T]) GetAsset(ctx context.Context, project, id string) (*PublicAsset, error)
func (*PublicAPIClient[T]) GetItems ¶
func (c *PublicAPIClient[T]) GetItems(ctx context.Context, project, model string, page, perPage int) (_ *PublicAPIListResponse[T], err error)
func (*PublicAPIClient[T]) WithTimeout ¶
func (c *PublicAPIClient[T]) WithTimeout(t time.Duration) *PublicAPIClient[T]
type PublicAPIListResponse ¶
type PublicAPIListResponse[T any] struct { Results []T `json:"results"` PerPage int `json:"perPage"` Page int `json:"page"` TotalCount int `json:"totalCount"` }
func (PublicAPIListResponse[T]) HasNext ¶
func (r PublicAPIListResponse[T]) HasNext() bool
type PublicAsset ¶
type PublicAsset struct { Type string `json:"type,omitempty"` Files []string `json:"files,omitempty"` Asset }
func PublicAssetFrom ¶
func PublicAssetFrom(a any) *PublicAsset
func (PublicAsset) IsExtractionDone ¶
func (a PublicAsset) IsExtractionDone() bool
type Schema ¶
type Schema struct { ID string `json:"id"` Fields []SchemaField `json:"fields"` ProjectID string `json:"projectId"` Meta *Schema `json:"meta"` }
func (Schema) FieldIDByKey ¶
type SchemaField ¶
type Tag ¶
func (*Tag) MarshalCMS ¶
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
func (*Value) Asset ¶
func (v *Value) Asset() *PublicAsset
func (*Value) MarshalCMS ¶
func (*Value) MarshalJSON ¶
func (*Value) UnmarshalJSON ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package cmaoapi provides primitives to interact with the openapi HTTP API.
|
Package cmaoapi provides primitives to interact with the openapi HTTP API. |
Click to show internal directories.
Click to hide internal directories.