mirror of
https://github.com/foomo/gocontentful.git
synced 2025-10-16 12:25:39 +00:00
feat: GetParents() for GenericEntry
This commit is contained in:
parent
2ed1e208e1
commit
9160851794
@ -425,6 +425,16 @@ func (cc *ContentfulClient) GetContentTypeOfID(ctx context.Context, id string) (
|
|||||||
return vo.Sys.ContentType.Sys.ID, nil
|
return vo.Sys.ContentType.Sys.ID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (vo *GenericEntry) GetParents(ctx context.Context, contentType ...string) (parents []EntryReference, err error) {
|
||||||
|
if vo == nil {
|
||||||
|
return nil, errors.New("GetParents: Value Object is nil")
|
||||||
|
}
|
||||||
|
if vo.CC == nil {
|
||||||
|
return nil, errors.New("GetParents: Value Object has no Contentful Client set")
|
||||||
|
}
|
||||||
|
return commonGetParents(ctx, vo.CC, vo.Sys.ID, contentType)
|
||||||
|
}
|
||||||
|
|
||||||
func (ref EntryReference) GetParents(ctx context.Context, contentType ...string) (parents []EntryReference, err error) {
|
func (ref EntryReference) GetParents(ctx context.Context, contentType ...string) (parents []EntryReference, err error) {
|
||||||
if ref.ID == "" {
|
if ref.ID == "" {
|
||||||
return nil, errors.New("GetParents: reference is nil")
|
return nil, errors.New("GetParents: reference is nil")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user