Comments (1)
The API clients in this package are generated directly from the Hubspot openapi spec. If there's not a filter in the code, that's because there's not a filter defined in the spec.
It looks like Hubspot lets you filter on any field as you noted, and has opted not to represent this in the spec. Two approaches we could take on this one:
Customize HTTP request with function options
One approach is to allow you to modify the HTTP request prior to sending it to the HTTP client. That would require a pretty big set of changes to function signatures from
func (a *BlogPostsApiService) GetPageExecute(r ApiGetPageRequest)
to something like this
func (a *BlogPostsApiService) GetPageExecute(r ApiGetPageRequest, options ...func(*http.Request))
and then you could apply the filters against a reference to the HTTP request. I'm not sure what kind of time I'd have to implement this in the short term, but would be happy to discuss this option and other alternatives in more depth with anyone else who would be interested in helping me implement it.
Use alternative openapi generators that support this behavior
I think that oapi-codegen might support this, but would need to investigate more to be sure. The downside to this approach is it would entirely change the current API of the generated clients.
Very bad, temporary workaround
type TransportFunc func(r *http.Request) (*http.Response, error)
func (f TransportFunc) RoundTrip(r *http.Request) (*http.Response, error) {
return f(r)
}
c := blog_posts.NewAPIClient(&blog_posts.Configuration{
HTTPClient: &http.Client{
Transport: TransportFunc(func(r *http.Request) (*http.Response, error) {
if strings.Contains(r.URL.Path, "/cms/v3/blogs/posts") {
// Modify the query string with the language filter
}
return http.DefaultTransport.RoundTrip(r)
}),
},
})
c.BlogPostsApi.GetPage(context.Background()).Execute()
from go-hubspot.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-hubspot.