Documentation ¶
Overview ¶
Code generated by https://github.com/foomo/gocontentful - DO NOT EDIT.
Code generated by https://github.com/foomo/gocontentful - DO NOT EDIT.
Code generated by https://github.com/foomo/gocontentful - DO NOT EDIT.
Code generated by https://github.com/foomo/gocontentful - DO NOT EDIT.
Code generated by https://github.com/foomo/gocontentful - DO NOT EDIT.
Code generated by https://github.com/foomo/gocontentful - DO NOT EDIT.
gocontentful version: latest
Index ¶
- Constants
- Variables
- func FieldToObject(jsonField interface{}, targetObject interface{}) error
- func NewAssetFromURL(id string, uploadUrl string, imageFileType string, title string, ...) *contentful.Asset
- func RichTextToHtml(rt interface{}, linkResolver LinkResolverFunc, ...) (string, error)
- func RichTextToPlainText(rt interface{}, locale Locale) (string, error)
- type BrokenReference
- type CacheStats
- type CfBrand
- func (vo *CfBrand) CompanyDescription(locale ...Locale) string
- func (vo *CfBrand) CompanyName(locale ...Locale) string
- func (vo *CfBrand) DeleteEntry(ctx context.Context) (err error)
- func (vo *CfBrand) Email(locale ...Locale) string
- func (vo *CfBrand) GetParents(ctx context.Context, contentType ...string) (parents []EntryReference, err error)
- func (vo *CfBrand) GetPublishingStatus() string
- func (vo *CfBrand) Logo(ctx context.Context, locale ...Locale) *contentful.AssetNoLocale
- func (vo *CfBrand) Phone(locale ...Locale) []string
- func (vo *CfBrand) PublishEntry(ctx context.Context) (err error)
- func (vo *CfBrand) SetCompanyDescription(companyDescription string, locale ...Locale) (err error)
- func (vo *CfBrand) SetCompanyName(companyName string, locale ...Locale) (err error)
- func (vo *CfBrand) SetEmail(email string, locale ...Locale) (err error)
- func (vo *CfBrand) SetLogo(logo ContentTypeSys, locale ...Locale) (err error)
- func (vo *CfBrand) SetPhone(phone []string, locale ...Locale) (err error)
- func (vo *CfBrand) SetTwitter(twitter string, locale ...Locale) (err error)
- func (vo *CfBrand) SetWebsite(website string, locale ...Locale) (err error)
- func (vo *CfBrand) ToReference() (refSys ContentTypeSys)
- func (vo *CfBrand) Twitter(locale ...Locale) string
- func (vo *CfBrand) UnpublishEntry(ctx context.Context) (err error)
- func (vo *CfBrand) UpdateEntry(ctx context.Context) (err error)
- func (vo *CfBrand) UpsertEntry(ctx context.Context) (err error)
- func (vo *CfBrand) Website(locale ...Locale) string
- type CfBrandFields
- type CfBrandFieldsLogo
- type CfCategory
- func (vo *CfCategory) CategoryDescription(locale ...Locale) string
- func (vo *CfCategory) DeleteEntry(ctx context.Context) (err error)
- func (vo *CfCategory) GetParents(ctx context.Context, contentType ...string) (parents []EntryReference, err error)
- func (vo *CfCategory) GetPublishingStatus() string
- func (vo *CfCategory) Icon(ctx context.Context, locale ...Locale) *contentful.AssetNoLocale
- func (vo *CfCategory) PublishEntry(ctx context.Context) (err error)
- func (vo *CfCategory) SetCategoryDescription(categoryDescription string, locale ...Locale) (err error)
- func (vo *CfCategory) SetIcon(icon ContentTypeSys, locale ...Locale) (err error)
- func (vo *CfCategory) SetTitle(title string, locale ...Locale) (err error)
- func (vo *CfCategory) Title(locale ...Locale) string
- func (vo *CfCategory) ToReference() (refSys ContentTypeSys)
- func (vo *CfCategory) UnpublishEntry(ctx context.Context) (err error)
- func (vo *CfCategory) UpdateEntry(ctx context.Context) (err error)
- func (vo *CfCategory) UpsertEntry(ctx context.Context) (err error)
- type CfCategoryFields
- type CfCategoryFieldsIcon
- type CfProduct
- func (vo *CfProduct) Brand(ctx context.Context, locale ...Locale) *EntryReference
- func (vo *CfProduct) Categories(ctx context.Context, locale ...Locale) []*EntryReference
- func (vo *CfProduct) DeleteEntry(ctx context.Context) (err error)
- func (vo *CfProduct) GetParents(ctx context.Context, contentType ...string) (parents []EntryReference, err error)
- func (vo *CfProduct) GetPublishingStatus() string
- func (vo *CfProduct) Image(ctx context.Context, locale ...Locale) []*contentful.AssetNoLocale
- func (vo *CfProduct) Nodes(locale ...Locale) *interface{}
- func (vo *CfProduct) Price(locale ...Locale) float64
- func (vo *CfProduct) ProductDescription(locale ...Locale) string
- func (vo *CfProduct) ProductName(locale ...Locale) string
- func (vo *CfProduct) PublishEntry(ctx context.Context) (err error)
- func (vo *CfProduct) Quantity(locale ...Locale) float64
- func (vo *CfProduct) SeoText(locale ...Locale) *interface{}
- func (vo *CfProduct) SetBrand(brand ContentTypeSys, locale ...Locale) (err error)
- func (vo *CfProduct) SetCategories(categories []ContentTypeSys, locale ...Locale) (err error)
- func (vo *CfProduct) SetImage(image []ContentTypeSys, locale ...Locale) (err error)
- func (vo *CfProduct) SetNodes(nodes interface{}, locale ...Locale) (err error)
- func (vo *CfProduct) SetPrice(price float64, locale ...Locale) (err error)
- func (vo *CfProduct) SetProductDescription(productDescription string, locale ...Locale) (err error)
- func (vo *CfProduct) SetProductName(productName string, locale ...Locale) (err error)
- func (vo *CfProduct) SetQuantity(quantity float64, locale ...Locale) (err error)
- func (vo *CfProduct) SetSeoText(seoText interface{}, locale ...Locale) (err error)
- func (vo *CfProduct) SetSizetypecolor(sizetypecolor string, locale ...Locale) (err error)
- func (vo *CfProduct) SetSku(sku string, locale ...Locale) (err error)
- func (vo *CfProduct) SetSlug(slug string, locale ...Locale) (err error)
- func (vo *CfProduct) SetSubProduct(subProduct ContentTypeSys, locale ...Locale) (err error)
- func (vo *CfProduct) SetTags(tags []string, locale ...Locale) (err error)
- func (vo *CfProduct) SetWebsite(website string, locale ...Locale) (err error)
- func (vo *CfProduct) Sizetypecolor(locale ...Locale) string
- func (vo *CfProduct) Sku(locale ...Locale) string
- func (vo *CfProduct) Slug(locale ...Locale) string
- func (vo *CfProduct) SubProduct(ctx context.Context, locale ...Locale) *EntryReference
- func (vo *CfProduct) Tags(locale ...Locale) []string
- func (vo *CfProduct) ToReference() (refSys ContentTypeSys)
- func (vo *CfProduct) UnpublishEntry(ctx context.Context) (err error)
- func (vo *CfProduct) UpdateEntry(ctx context.Context) (err error)
- func (vo *CfProduct) UpsertEntry(ctx context.Context) (err error)
- func (vo *CfProduct) Website(locale ...Locale) string
- type CfProductFields
- type ClientMode
- type ContentTypeFieldLocation
- type ContentTypeInfo
- type ContentTypeInfoMap
- type ContentTypeResult
- type ContentTypeSys
- type ContentTypeSysAttributes
- type ContentfulCache
- type ContentfulCacheMutex
- type ContentfulClient
- func (cc *ContentfulClient) BrokenReferences() (brokenReferences []BrokenReference)
- func (cc *ContentfulClient) CacheHasContentType(contentTypeID string) bool
- func (cc *ContentfulClient) ClientMode() ClientMode
- func (cc *ContentfulClient) ClientStats()
- func (cc *ContentfulClient) DeleteAsset(ctx context.Context, asset *contentful.Asset) error
- func (cc *ContentfulClient) DeleteAssetFromCache(key string) error
- func (cc *ContentfulClient) DisableTextJanitor()
- func (cc *ContentfulClient) EnableTextJanitor()
- func (cc *ContentfulClient) GetAllAssets(ctx context.Context) (map[string]*contentful.Asset, error)
- func (cc *ContentfulClient) GetAllBrand(ctx context.Context) (voMap map[string]*CfBrand, err error)
- func (cc *ContentfulClient) GetAllCategory(ctx context.Context) (voMap map[string]*CfCategory, err error)
- func (cc *ContentfulClient) GetAllGenericEntries() (map[string]*GenericEntry, error)
- func (cc *ContentfulClient) GetAllProduct(ctx context.Context) (voMap map[string]*CfProduct, err error)
- func (cc *ContentfulClient) GetAssetByID(ctx context.Context, id string, forceNoCache ...bool) (*contentful.Asset, error)
- func (cc *ContentfulClient) GetBrandByID(ctx context.Context, id string, forceNoCache ...bool) (vo *CfBrand, err error)
- func (cc *ContentfulClient) GetCacheStats() (*CacheStats, error)
- func (cc *ContentfulClient) GetCategoryByID(ctx context.Context, id string, forceNoCache ...bool) (vo *CfCategory, err error)
- func (cc *ContentfulClient) GetContentTypeOfID(ctx context.Context, id string) (string, error)
- func (cc *ContentfulClient) GetFilteredBrand(ctx context.Context, query *contentful.Query) (voMap map[string]*CfBrand, err error)
- func (cc *ContentfulClient) GetFilteredCategory(ctx context.Context, query *contentful.Query) (voMap map[string]*CfCategory, err error)
- func (cc *ContentfulClient) GetFilteredProduct(ctx context.Context, query *contentful.Query) (voMap map[string]*CfProduct, err error)
- func (cc *ContentfulClient) GetGenericEntry(entryID string) (*GenericEntry, error)
- func (cc *ContentfulClient) GetProductByID(ctx context.Context, id string, forceNoCache ...bool) (vo *CfProduct, err error)
- func (cc *ContentfulClient) ResetSync()
- func (cc *ContentfulClient) SetCacheUpdateTimeout(seconds int64)
- func (cc *ContentfulClient) SetEnvironment(environment string)
- func (cc *ContentfulClient) SetOfflineFallback(file []byte) error
- func (cc *ContentfulClient) SetProductInCache(product *CfProduct)
- func (cc *ContentfulClient) SetSyncMode(mode bool) error
- func (cc *ContentfulClient) UpdateCache(ctx context.Context, contentTypes []string, cacheAssets bool) (map[string][]string, []string, error)
- func (cc *ContentfulClient) UpdateCacheForEntity(ctx context.Context, sysType string, contentType string, entityID string) error
- type ContentfulReferencedEntry
- type ContentfulSys
- type EmbeddedEntryResolverFunc
- type EntryLinkResolverFunc
- type EntryReference
- type GenericEntry
- func (genericEntry *GenericEntry) FieldAsAny(fieldName string, locale ...Locale) (any, error)
- func (genericEntry *GenericEntry) FieldAsAsset(ctx context.Context, fieldName string, locale ...Locale) (*contentful.AssetNoLocale, error)
- func (genericEntry *GenericEntry) FieldAsBool(fieldName string, locale ...Locale) (bool, error)
- func (genericEntry *GenericEntry) FieldAsFloat64(fieldName string, locale ...Locale) (float64, error)
- func (genericEntry *GenericEntry) FieldAsMultipleReference(fieldName string, locale ...Locale) ([]*EntryReference, error)
- func (genericEntry *GenericEntry) FieldAsReference(fieldName string, locale ...Locale) (*EntryReference, error)
- func (genericEntry *GenericEntry) FieldAsString(fieldName string, locale ...Locale) (string, error)
- func (genericEntry *GenericEntry) FieldAsStringSlice(fieldName string, locale ...Locale) ([]string, error)
- func (genericEntry *GenericEntry) InheritAsAny(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) (any, error)
- func (genericEntry *GenericEntry) InheritAsBool(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) (bool, error)
- func (genericEntry *GenericEntry) InheritAsFloat64(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) (float64, error)
- func (genericEntry *GenericEntry) InheritAsMultipleReference(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) ([]*EntryReference, error)
- func (genericEntry *GenericEntry) InheritAsReference(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) (*EntryReference, error)
- func (genericEntry *GenericEntry) InheritAsString(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) (string, error)
- func (genericEntry *GenericEntry) InheritAsStringSlice(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) ([]string, error)
- func (genericEntry *GenericEntry) SetField(fieldName string, fieldValue interface{}, locale ...Locale) error
- func (genericEntry *GenericEntry) Upsert(ctx context.Context) error
- type ImageResolverFunc
- type LinkResolverFunc
- type Locale
- type RawFields
- type RawItem
- type RichTextData
- type RichTextGenericNode
- type RichTextMark
- type RichTextNode
- type RichTextNodeTextNode
Constants ¶
View Source
const ( FieldTypeLink string = "Link" FieldLinkTypeEntry string = "Entry" FieldLinkTypeAsset string = "Asset" HtmlHeading1 string = "h1" HtmlHeading2 string = "h2" HtmlHeading3 string = "h3" HtmlHeading4 string = "h4" HtmlHeading5 string = "h5" HtmlHeading6 string = "h6" HtmlParagraph string = "p" HtmlItalic string = "i" HtmlEm string = "em" HtmlBold string = "b" HtmlStrong string = "strong" HtmlUnderline string = "u" HtmlAnchor string = "a" HtmlImage string = "img" HtmlBlockquote string = "blockquote" HtmlCode string = "code" HtmlUnorderedList string = "ul" HtmlOrderedList string = "ol" HtmlListItem string = "li" HtmlBreak string = "br" HtmlHorizontalRule string = "hr" HtmlAttributeHref string = "href" HtmlTable string = "table" HtmlTableRow string = "tr" HtmlTableHeaderCell string = "th" HtmlTableCell string = "td" RichTextNodeDocument string = "document" RichTextNodeParagraph string = "paragraph" RichTextNodeHeading1 string = "heading-1" RichTextNodeHeading2 string = "heading-2" RichTextNodeHeading3 string = "heading-3" RichTextNodeHeading4 string = "heading-4" RichTextNodeHeading5 string = "heading-5" RichTextNodeHeading6 string = "heading-6" RichTextNodeHyperlink string = "hyperlink" RichTextNodeEntryHyperlink string = "entry-hyperlink" RichTextNodeAssetHyperlink string = "asset-hyperlink" RichTextNodeEmbeddedAsset string = "embedded-asset-block" RichTextNodeEmbeddedEntry string = "embedded-entry-block" RichTextNodeText string = "text" RichTextNodeUnorderedList string = "unordered-list" RichTextNodeOrderedList string = "ordered-list" RichTextNodeListItem string = "list-item" RichTextNodeBlockquote string = "blockquote" RichTextNodeHR string = "hr" RichTextNodeTable string = "table" RichTextNodeTableRow string = "table-row" RichTextNodeTableHeaderCell string = "table-header-cell" RichTextNodeTableCell string = "table-cell" RichTextMarkBold string = "bold" RichTextMarkItalic string = "italic" RichTextMarkUnderline string = "underline" RichTextMarkCode string = "code" )
View Source
const ( StatusDraft = "draft" StatusChanged = "changed" StatusPublished = "published" )
View Source
const ( LogDebug = 0 LogInfo = 1 LogWarn = 2 LogError = 3 )
View Source
const ContentTypeBrand = "brand"
View Source
const ContentTypeCategory = "category"
View Source
const ContentTypeProduct = "product"
Variables ¶
View Source
var ( ErrLocaleUnsupported = errors.New("locale not supported by this space") ErrNotSet = errors.New("field value not set") ErrNotSetNoFallback = errors.New("field value not set and no fallback locale available") ErrRefNotIncludes = errors.New("referenced entry not found in includes") ErrNoTypeOfRefEntry = errors.New("couldn't get contentType of referenced entry") ErrNoTypeOfRefAsset = errors.New("couldn't get contentType of referenced asset") InfoUpdatedEntityCache = "updated cache for entity" InfoCachedAllEntries = "cached all entries of content type" InfoCachedAllAssets = "cached all assets" InfoFallingBackToFile = "gonna use a local file" InfoLoadingFromFile = "loading space from local file" InfoCacheIsNil = "contentful cache is nil" InfoCacheWorkerStart = "contentful cache worker starting" InfoCacheUpdateQueued = "contentful cache update queued" InfoCacheUpdateCanceled = "contentful cache update canceled" InfoCacheUpdateDone = "contentful cache update returning" InfoCacheUpdateSkipped = "contentful cache update skipped, already one in the queue" InfoCacheSyncOp = "contentful cache sync op done" InfoOfflineEntitiesLoaded = "downloaded entries and assets from offline file" InfoPreservingExistingCache = "could not connect for cache update, preserving the existing cache" InfoUpdateCacheTime = "space caching done, time recorded" ErrorEnvironmentSetToMaster = "environment was empty string, set to master" ErrorEntryIsNil = "entry is nil" ErrorEntrySysIsNil = "entry.Sys is nil" ErrorEntryNotFound = "entry not found" ErrorEntrySysContentTypeIsNil = "entry.Sys.ContentType is nil" ErrorEntrySysContentTypeSysIsNil = "entry.Sys.ContentType.Sys is nil" ErrorEntryCachingFailed = "entry caching failed" )
View Source
var SpaceContentTypeInfoMap = ContentTypeInfoMap{ "brand": ContentTypeInfo{ ContentType: "brand", Title: "Brand", Description: "", }, "category": ContentTypeInfo{ ContentType: "category", Title: "Category", Description: "", }, "product": ContentTypeInfo{ ContentType: "product", Title: "Product", Description: "", }, }
View Source
var SpaceLocales = []Locale{
"de",
"fr",
}
Functions ¶
func FieldToObject ¶
func FieldToObject(jsonField interface{}, targetObject interface{}) error
func NewAssetFromURL ¶
func RichTextToHtml ¶
func RichTextToHtml(rt interface{}, linkResolver LinkResolverFunc, entryLinkResolver EntryLinkResolverFunc, imageResolver ImageResolverFunc, embeddedEntryResolver EmbeddedEntryResolverFunc, locale Locale) (string, error)
func RichTextToPlainText ¶ added in v1.1.0
Types ¶
type BrokenReference ¶
type CacheStats ¶
type CfBrand ¶
type CfBrand struct { Sys ContentfulSys `json:"sys,omitempty"` Fields CfBrandFields `json:"fields,omitempty"` RawFields RawFields `json:"-"` CC *ContentfulClient `json:"-"` }
func NewCfBrand ¶
func NewCfBrand(contentfulClient ...*ContentfulClient) (cfBrand *CfBrand)
func (*CfBrand) CompanyDescription ¶
func (*CfBrand) CompanyName ¶
func (*CfBrand) GetParents ¶
func (*CfBrand) GetPublishingStatus ¶
func (*CfBrand) Logo ¶
func (vo *CfBrand) Logo(ctx context.Context, locale ...Locale) *contentful.AssetNoLocale
func (*CfBrand) SetCompanyDescription ¶
func (*CfBrand) SetCompanyName ¶
func (*CfBrand) SetLogo ¶
func (vo *CfBrand) SetLogo(logo ContentTypeSys, locale ...Locale) (err error)
func (*CfBrand) SetTwitter ¶
func (*CfBrand) SetWebsite ¶
func (*CfBrand) ToReference ¶
func (vo *CfBrand) ToReference() (refSys ContentTypeSys)
type CfBrandFields ¶
type CfBrandFields struct { CompanyName map[string]string `json:"companyName,omitempty"` RWLockCompanyName sync.RWMutex `json:"-"` Logo map[string]ContentTypeSys `json:"logo,omitempty"` RWLockLogo sync.RWMutex `json:"-"` CompanyDescription map[string]string `json:"companyDescription,omitempty"` RWLockCompanyDescription sync.RWMutex `json:"-"` Website map[string]string `json:"website,omitempty"` RWLockWebsite sync.RWMutex `json:"-"` Twitter map[string]string `json:"twitter,omitempty"` RWLockTwitter sync.RWMutex `json:"-"` Email map[string]string `json:"email,omitempty"` RWLockEmail sync.RWMutex `json:"-"` Phone map[string][]string `json:"phone,omitempty"` RWLockPhone sync.RWMutex `json:"-"` }
CfBrandFields is a CfNameFields VO
type CfBrandFieldsLogo ¶
type CfBrandFieldsLogo struct { Entry *contentful.Asset Col *contentful.Collection }
type CfCategory ¶
type CfCategory struct { Sys ContentfulSys `json:"sys,omitempty"` Fields CfCategoryFields `json:"fields,omitempty"` RawFields RawFields `json:"-"` CC *ContentfulClient `json:"-"` }
func NewCfCategory ¶
func NewCfCategory(contentfulClient ...*ContentfulClient) (cfCategory *CfCategory)
func (*CfCategory) CategoryDescription ¶
func (vo *CfCategory) CategoryDescription(locale ...Locale) string
func (*CfCategory) DeleteEntry ¶
func (vo *CfCategory) DeleteEntry(ctx context.Context) (err error)
func (*CfCategory) GetParents ¶
func (vo *CfCategory) GetParents(ctx context.Context, contentType ...string) (parents []EntryReference, err error)
func (*CfCategory) GetPublishingStatus ¶
func (vo *CfCategory) GetPublishingStatus() string
func (*CfCategory) Icon ¶
func (vo *CfCategory) Icon(ctx context.Context, locale ...Locale) *contentful.AssetNoLocale
func (*CfCategory) PublishEntry ¶
func (vo *CfCategory) PublishEntry(ctx context.Context) (err error)
func (*CfCategory) SetCategoryDescription ¶
func (vo *CfCategory) SetCategoryDescription(categoryDescription string, locale ...Locale) (err error)
func (*CfCategory) SetIcon ¶
func (vo *CfCategory) SetIcon(icon ContentTypeSys, locale ...Locale) (err error)
func (*CfCategory) SetTitle ¶
func (vo *CfCategory) SetTitle(title string, locale ...Locale) (err error)
func (*CfCategory) Title ¶
func (vo *CfCategory) Title(locale ...Locale) string
func (*CfCategory) ToReference ¶
func (vo *CfCategory) ToReference() (refSys ContentTypeSys)
func (*CfCategory) UnpublishEntry ¶
func (vo *CfCategory) UnpublishEntry(ctx context.Context) (err error)
func (*CfCategory) UpdateEntry ¶
func (vo *CfCategory) UpdateEntry(ctx context.Context) (err error)
func (*CfCategory) UpsertEntry ¶
func (vo *CfCategory) UpsertEntry(ctx context.Context) (err error)
type CfCategoryFields ¶
type CfCategoryFields struct { Title map[string]string `json:"title,omitempty"` RWLockTitle sync.RWMutex `json:"-"` Icon map[string]ContentTypeSys `json:"icon,omitempty"` RWLockIcon sync.RWMutex `json:"-"` CategoryDescription map[string]string `json:"categoryDescription,omitempty"` RWLockCategoryDescription sync.RWMutex `json:"-"` }
CfCategoryFields is a CfNameFields VO
type CfCategoryFieldsIcon ¶
type CfCategoryFieldsIcon struct { Entry *contentful.Asset Col *contentful.Collection }
type CfProduct ¶
type CfProduct struct { Sys ContentfulSys `json:"sys,omitempty"` Fields CfProductFields `json:"fields,omitempty"` RawFields RawFields `json:"-"` CC *ContentfulClient `json:"-"` }
func NewCfProduct ¶
func NewCfProduct(contentfulClient ...*ContentfulClient) (cfProduct *CfProduct)
func (*CfProduct) Brand ¶
func (vo *CfProduct) Brand(ctx context.Context, locale ...Locale) *EntryReference
func (*CfProduct) Categories ¶
func (vo *CfProduct) Categories(ctx context.Context, locale ...Locale) []*EntryReference
func (*CfProduct) GetParents ¶
func (*CfProduct) GetPublishingStatus ¶
func (*CfProduct) Image ¶
func (vo *CfProduct) Image(ctx context.Context, locale ...Locale) []*contentful.AssetNoLocale
func (*CfProduct) ProductDescription ¶
func (*CfProduct) ProductName ¶
func (*CfProduct) SetBrand ¶
func (vo *CfProduct) SetBrand(brand ContentTypeSys, locale ...Locale) (err error)
func (*CfProduct) SetCategories ¶
func (vo *CfProduct) SetCategories(categories []ContentTypeSys, locale ...Locale) (err error)
func (*CfProduct) SetImage ¶
func (vo *CfProduct) SetImage(image []ContentTypeSys, locale ...Locale) (err error)
func (*CfProduct) SetProductDescription ¶
func (*CfProduct) SetProductName ¶
func (*CfProduct) SetQuantity ¶
func (*CfProduct) SetSeoText ¶ added in v1.0.16
func (*CfProduct) SetSizetypecolor ¶
func (*CfProduct) SetSubProduct ¶ added in v1.1.0
func (vo *CfProduct) SetSubProduct(subProduct ContentTypeSys, locale ...Locale) (err error)
func (*CfProduct) SetWebsite ¶
func (*CfProduct) Sizetypecolor ¶
func (*CfProduct) SubProduct ¶ added in v1.1.0
func (vo *CfProduct) SubProduct(ctx context.Context, locale ...Locale) *EntryReference
func (*CfProduct) ToReference ¶
func (vo *CfProduct) ToReference() (refSys ContentTypeSys)
func (*CfProduct) UnpublishEntry ¶
type CfProductFields ¶
type CfProductFields struct { ProductName map[string]string `json:"productName,omitempty"` RWLockProductName sync.RWMutex `json:"-"` Slug map[string]string `json:"slug,omitempty"` RWLockSlug sync.RWMutex `json:"-"` ProductDescription map[string]string `json:"productDescription,omitempty"` RWLockProductDescription sync.RWMutex `json:"-"` Sizetypecolor map[string]string `json:"sizetypecolor,omitempty"` RWLockSizetypecolor sync.RWMutex `json:"-"` Image map[string][]ContentTypeSys `json:"image,omitempty"` RWLockImage sync.RWMutex `json:"-"` Tags map[string][]string `json:"tags,omitempty"` RWLockTags sync.RWMutex `json:"-"` Categories map[string][]ContentTypeSys `json:"categories,omitempty"` RWLockCategories sync.RWMutex `json:"-"` Price map[string]float64 `json:"price,omitempty"` RWLockPrice sync.RWMutex `json:"-"` Brand map[string]ContentTypeSys `json:"brand,omitempty"` RWLockBrand sync.RWMutex `json:"-"` SubProduct map[string]ContentTypeSys `json:"subProduct,omitempty"` RWLockSubProduct sync.RWMutex `json:"-"` Quantity map[string]float64 `json:"quantity,omitempty"` RWLockQuantity sync.RWMutex `json:"-"` Sku map[string]string `json:"sku,omitempty"` RWLockSku sync.RWMutex `json:"-"` Website map[string]string `json:"website,omitempty"` RWLockWebsite sync.RWMutex `json:"-"` SeoText map[string]interface{} `json:"seoText,omitempty"` RWLockSeoText sync.RWMutex `json:"-"` Nodes map[string]interface{} `json:"nodes,omitempty"` RWLockNodes sync.RWMutex `json:"-"` }
CfProductFields is a CfNameFields VO
type ClientMode ¶
type ClientMode string
const ( ClientModeCDA ClientMode = "CDA" ClientModeCPA ClientMode = "CPA" ClientModeCMA ClientMode = "CMA" )
type ContentTypeInfo ¶
type ContentTypeInfoMap ¶
type ContentTypeInfoMap map[string]ContentTypeInfo
type ContentTypeResult ¶
type ContentTypeResult struct { EntryID string ContentType string References map[string][]EntryReference }
type ContentTypeSys ¶
type ContentTypeSys struct {
Sys ContentTypeSysAttributes `json:"sys,omitempty"`
}
func ToAssetReference ¶
func ToAssetReference(asset *contentful.Asset) (refSys ContentTypeSys)
type ContentfulCache ¶
type ContentfulCache struct {
// contains filtered or unexported fields
}
type ContentfulCacheMutex ¶
type ContentfulCacheMutex struct {
// contains filtered or unexported fields
}
type ContentfulClient ¶
type ContentfulClient struct { Cache *ContentfulCache Client *contentful.Contentful SpaceID string // contains filtered or unexported fields }
func NewContentfulClient ¶
func (*ContentfulClient) BrokenReferences ¶
func (cc *ContentfulClient) BrokenReferences() (brokenReferences []BrokenReference)
func (*ContentfulClient) CacheHasContentType ¶
func (cc *ContentfulClient) CacheHasContentType(contentTypeID string) bool
func (*ContentfulClient) ClientMode ¶ added in v1.1.0
func (cc *ContentfulClient) ClientMode() ClientMode
func (*ContentfulClient) ClientStats ¶
func (cc *ContentfulClient) ClientStats()
func (*ContentfulClient) DeleteAsset ¶
func (cc *ContentfulClient) DeleteAsset(ctx context.Context, asset *contentful.Asset) error
func (*ContentfulClient) DeleteAssetFromCache ¶
func (cc *ContentfulClient) DeleteAssetFromCache(key string) error
func (*ContentfulClient) DisableTextJanitor ¶ added in v1.0.16
func (cc *ContentfulClient) DisableTextJanitor()
func (*ContentfulClient) EnableTextJanitor ¶ added in v1.0.16
func (cc *ContentfulClient) EnableTextJanitor()
func (*ContentfulClient) GetAllAssets ¶
func (cc *ContentfulClient) GetAllAssets(ctx context.Context) (map[string]*contentful.Asset, error)
func (*ContentfulClient) GetAllBrand ¶
func (*ContentfulClient) GetAllCategory ¶
func (cc *ContentfulClient) GetAllCategory(ctx context.Context) (voMap map[string]*CfCategory, err error)
func (*ContentfulClient) GetAllGenericEntries ¶ added in v1.1.0
func (cc *ContentfulClient) GetAllGenericEntries() (map[string]*GenericEntry, error)
func (*ContentfulClient) GetAllProduct ¶
func (*ContentfulClient) GetAssetByID ¶
func (cc *ContentfulClient) GetAssetByID(ctx context.Context, id string, forceNoCache ...bool) (*contentful.Asset, error)
func (*ContentfulClient) GetBrandByID ¶
func (*ContentfulClient) GetCacheStats ¶
func (cc *ContentfulClient) GetCacheStats() (*CacheStats, error)
func (*ContentfulClient) GetCategoryByID ¶
func (cc *ContentfulClient) GetCategoryByID(ctx context.Context, id string, forceNoCache ...bool) (vo *CfCategory, err error)
func (*ContentfulClient) GetContentTypeOfID ¶
func (*ContentfulClient) GetFilteredBrand ¶
func (cc *ContentfulClient) GetFilteredBrand(ctx context.Context, query *contentful.Query) (voMap map[string]*CfBrand, err error)
func (*ContentfulClient) GetFilteredCategory ¶
func (cc *ContentfulClient) GetFilteredCategory(ctx context.Context, query *contentful.Query) (voMap map[string]*CfCategory, err error)
func (*ContentfulClient) GetFilteredProduct ¶
func (cc *ContentfulClient) GetFilteredProduct(ctx context.Context, query *contentful.Query) (voMap map[string]*CfProduct, err error)
func (*ContentfulClient) GetGenericEntry ¶ added in v1.1.0
func (cc *ContentfulClient) GetGenericEntry(entryID string) (*GenericEntry, error)
func (*ContentfulClient) GetProductByID ¶
func (*ContentfulClient) ResetSync ¶
func (cc *ContentfulClient) ResetSync()
func (*ContentfulClient) SetCacheUpdateTimeout ¶
func (cc *ContentfulClient) SetCacheUpdateTimeout(seconds int64)
func (*ContentfulClient) SetEnvironment ¶
func (cc *ContentfulClient) SetEnvironment(environment string)
func (*ContentfulClient) SetOfflineFallback ¶
func (cc *ContentfulClient) SetOfflineFallback(file []byte) error
func (*ContentfulClient) SetProductInCache ¶
func (cc *ContentfulClient) SetProductInCache(product *CfProduct)
func (*ContentfulClient) SetSyncMode ¶
func (cc *ContentfulClient) SetSyncMode(mode bool) error
func (*ContentfulClient) UpdateCache ¶
func (*ContentfulClient) UpdateCacheForEntity ¶
type ContentfulReferencedEntry ¶
type ContentfulReferencedEntry struct { Entry *contentful.Entry Col *contentful.Collection LogFn func( contentType string, entryID string, method string, err error, ) }
func (ContentfulReferencedEntry) ContentType ¶
func (ref ContentfulReferencedEntry) ContentType() (contentType string)
type ContentfulSys ¶
type ContentfulSys struct { ID string `json:"id,omitempty"` Type string `json:"type,omitempty"` LinkType string `json:"linkType,omitempty"` ContentType ContentTypeSys `json:"contentType,omitempty"` Environment ContentTypeSys `json:"environment,omitempty"` Space ContentTypeSys `json:"space,omitempty"` CreatedAt string `json:"createdAt,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"` Revision float64 `json:"revision,omitempty"` Version float64 `json:"version,omitempty"` PublishedCounter float64 `json:"publishedCounter,omitempty"` PublishedVersion float64 `json:"publishedVersion,omitempty"` }
type EntryLinkResolverFunc ¶
type EntryReference ¶
func (*EntryReference) GetParents ¶
func (ref *EntryReference) GetParents(cc *ContentfulClient) (parents []EntryReference, err error)
type GenericEntry ¶ added in v1.1.0
type GenericEntry struct { Sys ContentfulSys `json:"sys,omitempty"` RawFields RawFields `json:"fields,omitempty"` CC *ContentfulClient `json:"-"` }
func (*GenericEntry) FieldAsAny ¶ added in v1.1.0
func (genericEntry *GenericEntry) FieldAsAny(fieldName string, locale ...Locale) (any, error)
func (*GenericEntry) FieldAsAsset ¶ added in v1.1.0
func (genericEntry *GenericEntry) FieldAsAsset(ctx context.Context, fieldName string, locale ...Locale) (*contentful.AssetNoLocale, error)
func (*GenericEntry) FieldAsBool ¶ added in v1.1.0
func (genericEntry *GenericEntry) FieldAsBool(fieldName string, locale ...Locale) (bool, error)
func (*GenericEntry) FieldAsFloat64 ¶ added in v1.1.0
func (genericEntry *GenericEntry) FieldAsFloat64(fieldName string, locale ...Locale) (float64, error)
func (*GenericEntry) FieldAsMultipleReference ¶ added in v1.1.0
func (genericEntry *GenericEntry) FieldAsMultipleReference(fieldName string, locale ...Locale) ([]*EntryReference, error)
func (*GenericEntry) FieldAsReference ¶ added in v1.1.0
func (genericEntry *GenericEntry) FieldAsReference(fieldName string, locale ...Locale) (*EntryReference, error)
func (*GenericEntry) FieldAsString ¶ added in v1.1.0
func (genericEntry *GenericEntry) FieldAsString(fieldName string, locale ...Locale) (string, error)
func (*GenericEntry) FieldAsStringSlice ¶ added in v1.1.0
func (genericEntry *GenericEntry) FieldAsStringSlice(fieldName string, locale ...Locale) ([]string, error)
func (*GenericEntry) InheritAsAny ¶ added in v1.1.0
func (*GenericEntry) InheritAsBool ¶ added in v1.1.0
func (*GenericEntry) InheritAsFloat64 ¶ added in v1.1.0
func (*GenericEntry) InheritAsMultipleReference ¶ added in v1.1.0
func (genericEntry *GenericEntry) InheritAsMultipleReference(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) ([]*EntryReference, error)
func (*GenericEntry) InheritAsReference ¶ added in v1.1.0
func (genericEntry *GenericEntry) InheritAsReference(ctx context.Context, fieldName string, parentTypes []string, locale ...Locale) (*EntryReference, error)
func (*GenericEntry) InheritAsString ¶ added in v1.1.0
func (*GenericEntry) InheritAsStringSlice ¶ added in v1.1.0
type ImageResolverFunc ¶
type LinkResolverFunc ¶
type Locale ¶
type Locale string
const DefaultLocale Locale = SpaceLocaleGerman
const SpaceLocaleFrench Locale = "fr"
const SpaceLocaleGerman Locale = "de"
type RawFields ¶ added in v1.1.0
type RawFields map[string]interface{}
func (RawFields) GetChildIDs ¶ added in v1.1.0
type RichTextData ¶
type RichTextData struct { URI string `json:"uri,omitempty"` Target *ContentTypeSys `json:"target,omitempty"` }
type RichTextGenericNode ¶
type RichTextGenericNode struct { NodeType string `json:"nodeType"` Content []*RichTextGenericNode `json:"content"` Data map[string]interface{} `json:"data"` Value string `json:"value"` Marks []RichTextMark `json:"marks"` }
type RichTextMark ¶
type RichTextMark struct {
Type string `json:"type,omitempty"`
}
type RichTextNode ¶
type RichTextNode struct { NodeType string `json:"nodeType"` Content []interface{} `json:"content"` Data RichTextData `json:"data"` }
func HtmlToRichText ¶
func HtmlToRichText(htmlSrc string) *RichTextNode
type RichTextNodeTextNode ¶
type RichTextNodeTextNode struct { NodeType string `json:"nodeType"` Data RichTextData `json:"data"` Value string `json:"value"` Marks []RichTextMark `json:"marks"` }
Click to show internal directories.
Click to hide internal directories.