contentful-labs / contentful-go Goto Github PK
View Code? Open in Web Editor NEWContentful api SDK for GoLang
License: MIT License
Contentful api SDK for GoLang
License: MIT License
Is it currently supported to use the upload api? You can find here in the docs the endpoint to which I'm referring: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/uploads
It also seems like there isn't support for linking an upload to an asset. This is described in the "Associating an upload with an asset" section here: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/uploads. More specifically the issue is that the uploadFrom
field isn't present on the asset model.
I'm currently trying to implement some tests in my code base which uses the contentful-go client but due to not being able to specify the HTTP client it makes testing very difficult. I'm opening a PR that exposes the HTTP client so consumers can set it.
Setting the QueryParams on Entries.List(space) seems to crash the application. It also looks like it's not passing on the query parameters in the request. Is this planned on being supported?
Hey @tolgaakyuz! I'm considering using Contentful at my company, and I'm interested hearing how active this project is, and if there are major missing pieces of functionality between this and the python library. Thanks!
In the example we find:
collection := cma.ContentTypes.List(space.Sys.ID)
collection, err := collection.Next()
if err != nil {
log.Fatal(err)
}
However the 2nd line here has no new variables left of :=
Hi, guys! Please, let me know a way how to create a new entry for exists content type, please. I went through source code but i can't find anything to do that.
The assets that we are using have multiple locales, and whenever we try to func (service *AssetsService) Get
OR func (service *AssetsService) List
we get a a panic: interface conversion: interface {} is nil, not string.
We believe this is due to the types as defined below:
// FileFields model
type FileFields struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
File *File `json:"file,omitempty"`
}
// Asset model
type Asset struct {
locale string
Sys *Sys `json:"sys"`
Fields *FileFields `json:"fields"`
}
whereas an example of the the json return from the get request is as follows:
{
"sys": {...},
"fields": {
"title": {
"en-GB": "..."
},
"description": {
"en-GB": "..."
},
"file": {
"en-GB": {...}
}
}
}
which would mean the assets would unmarshall into structs more like the below:
// FileFields model
type FileFields struct {
Title map[string]string `json:"title,omitempty"`
Description map[string]string `json:"description,omitempty"`
File map[string]*File `json:"file,omitempty"`
}
or similar.
We tried switching to single locale, and it still seems to have the same issue.
So basically after retrive the data from contentful and try to marshal it to string and unmarshal it into *contentful.Asset type. I got this error message:
panic: interface conversion: interface {} is map[string]interface {}, not string
Which then leads me to here
Any suggestion about it?
Collection has all the other type assertions, but lacks ToEntry(). Inlining the equivalent code achieves the desired effect, so I assume this is just a simple omission.
It seems there is no way to create filters when creating a webhook.
https://cda.contentful.com/spaces/: dial tcp: lookup cda.contentful.com on 10.0.0.10:53: no such host","level":"error"
I think the new CDA needs to be pointed at the cdn rather than the cda subdomain.
Finish remaining tests.
Could someone post an example of retreiving the actual data from a content-type. (i.e.: I have a content-type of 'product' and I want to get a complete list of the content that I have created for that content-type. I am looking at using this SDK not the API directly.
Thanks!
The README.md states that you should install the SDK using the command:
$ go get -u github.com/tolgaakyuz/contentful.go
stat github.com/tolgaakyuz/contentful.go: no such file or directory
However this fails. Please improve your burkish SDK.
{"sys":{"type":"Space","version":1},"name":"Terraform Space","defaultLocale":"en"}
{"name":"Terraform Space","defaultLocale":"en"}
asset, err := CMAClient.Assets.Get(YOUR_SPACE_ID, YOUR_ASSET_ID)
null
to string
Improve the testdata generation for test cases.
goreplay
to capture real API data.Recursive call at line 118 asset.go
causes a stack overflow, I guess you need to unmarshal
manually the json, since it's a custom handler.
func (asset *Asset) UnmarshalJSON(data []byte) error {
...
} else {
if err := json.Unmarshal(data, asset); err != nil {
return err
}
}
...
panic: interface conversion: interface {} is map[string]interface {}, not string
asset.go: 93
if err := json.Unmarshal([]byte(payload["sys"].(string)), asset.Sys); err != nil { return err }
Hi there,
Is it safe to use the master version from git?
We're using the 0.4.0 released version but there's been some significant developments (e.g. Environment use) which the docs point to but are inaccessible in the code.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.