-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sdk-client): getCollection method for content #28635
Conversation
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/index.ts
Outdated
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/index.ts
Outdated
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/index.ts
Outdated
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/index.ts
Outdated
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/index.ts
Outdated
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/index.ts
Outdated
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/index.ts
Outdated
Show resolved
Hide resolved
…github.com/dotCMS/core into 28634-sdk-content-api-getcollection-method
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/get-collection.ts
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/get-collection.ts
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/get-collection.ts
Outdated
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/methods/get-collection/get-collection.ts
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/shared/types.ts
Outdated
Show resolved
Hide resolved
core-web/libs/sdk/client/src/lib/client/content/shared/types.ts
Outdated
Show resolved
Hide resolved
We discussed all the remaining changes and decided to create another issue to address @fmontes feedback because we need refactors and naming changes that are out of scope of the issue. The ticket is pending to be created, I will share it when It's ready. |
Here is the ticket that will continue the work of this PR #28711 |
Quality Gate passedIssues Measures |
## Proposed Changes * Add `Content` Class to handle Content API Methods and expose it as a method of the Dotcms Client * Add `GetCollection` Class to handle the building of a query for collections and expose it as a method of `Content` Class ## Usage example for standalone `getCollection` This an example of a query with all possible methods it supports (could not be a real use case and it should be used from the `client.content`). ```typescript const requestOptions: Omit<RequestInit, 'body' | 'method'> = { cache: 'no-cache' // To simulate a valid request }; const serverUrl = 'http://localhost:8080'; const contentType = 'forceSensitive'; const client = new GetCollection(requestOptions, serverUrl, contentType); const response = await client .language(13) // Language Id .render(true) // To retrieve the content with the render .sortBy([ // Sort by multiple fields { field: 'name', order: 'asc' }, { field: 'midichlorians', order: 'desc' } ]) .depth(2) // Depth of the content for relationships .limit(20) // Limit of content per page .page(3) // Page to fetch .query( ( qb // Lucene query to append to the main query for more complex queries ) => qb .field('kyberCrystal') .equals('red') .and() .equals('blue') .field('master') .equals('Yoda') .or() .equals('Obi-Wan') ) .draft(true) // To retrieve the draft content .variant('legends-forceSensitive') // Variant of the content .rawQuery('+modDate:2024-05-28 +conhost:MyCoolSite') // Raw query to append to the main query .fetch(); // Fetch the content ```
Proposed Changes
Content
Class to handle Content API Methods and expose it as a method of the Dotcms ClientGetCollection
Class to handle the building of a query for collections and expose it as a method ofContent
ClassUsage example for standalone
getCollection
This an example of a query with all possible methods it supports (could not be a real use case and it should be used from the
client.content
).