janivihervas / contentful-go Goto Github PK
View Code? Open in Web Editor NEWSimple Contentful SDK for Go for fetching data
License: MIT License
Simple Contentful SDK for Go for fetching data
License: MIT License
Create traces using trace.StartSpan
It would be used in search
function: https://github.com/janivihervas/contentful-go/blob/master/search.go#L128
Interface could look something like this:
type CacheEntry struct {
URL string
JSON []byte
ETag string
}
type Cache interface {
Get(ctx context.Context, url string) (CacheEntry, error)
Save(ctx context.Context, entry CacheEntry) error
}
Request handling:
If an entry is in cache, supply the etag in If-None-Match
header
Response handling:
If cache implementation is not supplied to constructor, response with non-200 status code would still fail. If cache is supplied, 200 status code would Save
the result and 304 status code would serve it from cache.
Requires a new extensible constructor function to prevent breaking changes.
Requires a cache pruning functionality, as Contentful web hooks only specify the entry id that was modified, and cache keys will in most cases be search queries instead of searching by id
Use select
in here to allow the context to be manually cancelled
Document the external urls that the SDK will use, so they can be allowed explicitly in strict environments like Istio
Implementation is using http.DefaultClient
. Implement a functionality to provide a custom http.Client to provide e.g. OpenCensus capability.
In order to keep backwards-compatibility, either export the client field or set it with a method like
cms := contentful.New(...)
cms.WithHttpClient(&http.Client{...})
Fetch the next pages -if any- and put them in the same response.
Contentful Delivery API docs: https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/collection-resources-and-pagination
Investigate if there is a need for custom metrics and if so, implement and export default view.View
s and stat
s
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.