You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use the GetPage API in the BlogPostsAPI, but it only supports the date-related criteria, while in the HubSpot documentation here, The document mentions we can filter all of the fields. Like language__eq=en, that results in blogs with only language=en.
The text was updated successfully, but these errors were encountered:
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
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
typeTransportFuncfunc(r*http.Request) (*http.Response, error)
func (fTransportFunc) RoundTrip(r*http.Request) (*http.Response, error) {
returnf(r)
}
c:=blog_posts.NewAPIClient(&blog_posts.Configuration{
HTTPClient: &http.Client{
Transport: TransportFunc(func(r*http.Request) (*http.Response, error) {
ifstrings.Contains(r.URL.Path, "/cms/v3/blogs/posts") {
// Modify the query string with the language filter
}
returnhttp.DefaultTransport.RoundTrip(r)
}),
},
})
c.BlogPostsApi.GetPage(context.Background()).Execute()
I'm trying to use the
GetPage
API in theBlogPostsAPI,
but it only supports the date-related criteria, while in the HubSpot documentation here, The document mentions we can filter all of the fields. Likelanguage__eq=en
, that results in blogs with onlylanguage=en
.The text was updated successfully, but these errors were encountered: