feat: adds eligible licenses and available licenses#2951
feat: adds eligible licenses and available licenses#2951dineshswamy (dineshswamy) wants to merge 10 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds SDK support for two new license collection resources: organization-level Available Licenses and space-level Eligible Licenses, including REST endpoints, entity types, and unit tests.
Changes:
- Introduce
AvailableLicenseandEligibleLicenseREST endpoints (getMany) and register them in the REST endpoint index. - Add new entity type definitions + collection wrappers for available/eligible licenses.
- Extend Space/Organization APIs with
getEligibleLicenses/getAvailableLicensesand add corresponding unit tests/mocks.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/unit/mocks/entities.ts | Adds mock entities + wrapper mocks for the new license resources. |
| test/unit/create-space-api.test.ts | Adds unit tests for space.getEligibleLicenses(). |
| test/unit/create-organization-api.test.ts | Adds unit tests for organization.getAvailableLicenses(). |
| lib/entities/eligible-license.ts | Introduces Eligible License entity types + wrapping helpers. |
| lib/entities/available-license.ts | Introduces Available License entity types + wrapping helpers. |
| lib/create-space-api.ts | Adds getEligibleLicenses method to the space API. |
| lib/create-organization-api.ts | Adds getAvailableLicenses method to the organization API. |
| lib/common-types.ts | Extends request/action typing to include the new resources. |
| lib/adapters/REST/endpoints/index.ts | Registers the new endpoints in the REST endpoint map. |
| lib/adapters/REST/endpoints/eligible-license.ts | Implements REST endpoint for space eligible licenses. |
| lib/adapters/REST/endpoints/available-license.ts | Implements REST endpoint for org available licenses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Changelist by BitoThis pull request implements the following key changes.
|
Impact Analysis by BitoInteraction DiagramsequenceDiagram
participant Developer
participant OrganizationApi as OrganizationApi<br/>🔄 Updated | ●●● High
participant MakeRequest
participant AvailableLicenseEndpoint as AvailableLicenseEndpoint<br/>🟩 Added | ●●● High
participant RawAdapter
participant Axios
participant ContentfulAPI
Note over Developer, ContentfulAPI: License data retrieved and transformed through entity wrapping
Developer->>OrganizationApi: getAvailableLicenses(query)
OrganizationApi->>MakeRequest: makeRequest(entityType: AvailableLicense, action: getMany)
MakeRequest->>AvailableLicenseEndpoint: getMany(http, params)
AvailableLicenseEndpoint->>RawAdapter: raw.get<CollectionProp>(http, url, config)
RawAdapter->>Axios: http.get(url, config)
Axios->>ContentfulAPI: GET /organizations/{id}/available_licenses
ContentfulAPI-->>Axios: response data
Axios-->>RawAdapter: response.data
RawAdapter-->>AvailableLicenseEndpoint: CollectionProp<AvailableLicenseProps>
AvailableLicenseEndpoint-->>MakeRequest: data
MakeRequest->>OrganizationApi: wrapAvailableLicenseCollection(data)
OrganizationApi-->>Developer: wrapped collection
This MR adds license management features by introducing new API methods for available and eligible licenses, including REST endpoints, entity definitions, and data transformation through entity wrapping. It integrates with the external Contentful API for license data retrieval and includes comprehensive testing. Code Paths AnalyzedImpact: Flow: Direct Changes (Diff Files): Repository Impact: Cross-Repository Dependencies: Database/Caching Impact: API Contract Violations: Infrastructure Dependencies: Additional Insights: Testing RecommendationsFrontend Impact: Service Integration: Data Serialization: Privacy Compliance: Backward Compatibility: OAuth Functionality: Reliability Testing: Additional Insights: Analysis based on known dependency patterns and edges. Actual impact may vary. |
There was a problem hiding this comment.
Code Review Agent Run #72b56b
Actionable Suggestions - 1
-
test/unit/create-space-api.test.ts - 1
- Incorrect test helper usage for query-based collection method · Line 646-658
Review Details
-
Files reviewed - 11 · Commit Range:
f67e445..33b92ad- lib/adapters/REST/endpoints/available-license.ts
- lib/adapters/REST/endpoints/eligible-license.ts
- lib/adapters/REST/endpoints/index.ts
- lib/common-types.ts
- lib/create-organization-api.ts
- lib/create-space-api.ts
- lib/entities/available-license.ts
- lib/entities/eligible-license.ts
- test/unit/create-organization-api.test.ts
- test/unit/create-space-api.test.ts
- test/unit/mocks/entities.ts
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.
Documentation & Help
Code Review Agent Run #7f9b6eActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #4b5ac3Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
Can we add an integration test? It is fine even if it will return empty licenses |
Code Review Agent Run #27f112Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
There was a problem hiding this comment.
Code Review Agent Run #645143
Actionable Suggestions - 1
-
test/integration/space-add-on-integration.test.ts - 1
- Missing test assertion for license count · Line 54-60
Additional Suggestions - 1
-
test/integration/space-add-on-integration.test.ts - 1
-
Inconsistent limit assertion in pagination test · Line 67-69The pagination test conditionally checks response.limit only if defined, unlike the similar space add-on test which directly asserts the expected limit value. This inconsistency could mask issues if the API fails to return limit when requested.
-
Review Details
-
Files reviewed - 1 · Commit Range:
eeab5b6..ed8403e- test/integration/space-add-on-integration.test.ts
-
Files skipped - 0
-
Tools
- Whispers (Secret Scanner) - ✔︎ Successful
- Detect-secrets (Secret Scanner) - ✔︎ Successful
- Eslint (Linter) - ✔︎ Successful
Bito Usage Guide
Commands
Type the following command in the pull request comment and save the comment.
-
/review- Manually triggers a full AI review. -
/pause- Pauses automatic reviews on this pull request. -
/resume- Resumes automatic reviews. -
/resolve- Marks all Bito-posted review comments as resolved. -
/abort- Cancels all in-progress reviews.
Refer to the documentation for additional commands.
Configuration
This repository uses Default Agent You can customize the agent settings here or contact your Bito workspace admin at jared.jolton@contentful.com.
Documentation & Help
Code Review Agent Run #537b99Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
This pull request introduces support for two new API resources: Available Licenses at the organization level and Eligible Licenses at the space level. It adds endpoint implementations, entity definitions, and updates the SDK's type system to enable retrieving these license collections.
https://contentful.atlassian.net/browse/HEJO-8476
New License Resource Support
getAvailableLicenses) on organizations and Eligible Licenses (getEligibleLicenses) on spaces, including integration into the main endpoint index and API factories.Summary
Description
Motivation and Context
PR Checklist
CONTRIBUTING.mdfileSummary by Bito
This pull request introduces support for two new API resources: Available Licenses at the organization level and Eligible Licenses at the space level. It adds endpoint implementations, entity definitions, and updates the SDK's type system to enable retrieving these license collections. This functionality allows developers to query license availability and eligibility for better license management.
Detailed Changes