Skip to content

docs: update desktop Feature API reference to match current source#785

Merged
jaredlockhart merged 2 commits intomainfrom
2026-02-24-desktop-api-docs
Feb 24, 2026
Merged

docs: update desktop Feature API reference to match current source#785
jaredlockhart merged 2 commits intomainfrom
2026-02-24-desktop-api-docs

Conversation

@jaredlockhart
Copy link
Contributor

Summary

Updates the desktop Feature API reference and co-enrolling features docs to match the current Nimbus SDK source code.

  • Replaces removed API: getExperimentMetaData()getEnrollmentMetadata() with full documentation of the three query modes (default, experiment-only, rollout-only)
  • Documents new methods: getAllEnrollments() and getAllEnrollmentMetadata() for co-enrolling features
  • Adds Desktop co-enrollment: manifest example, JS API examples, and cross-links in coenrolling-features.mdx
  • Fixes minor issues: off()offUpdate() heading, enriched FeatureManifest.yaml example, recordExposureEvent({slug}) for co-enrolling features

Fixes #784

🤖 Generated with Claude Code

Because

* The `getExperimentMetaData()` method documented in feature-api.mdx no
  longer exists in the source code — it was replaced by
  `getEnrollmentMetadata()` on each NimbusFeatures instance
* Three new methods (`getEnrollmentMetadata`, `getAllEnrollments`,
  `getAllEnrollmentMetadata`) are undocumented
* Desktop supports co-enrollment via `allowCoenrollment` in the feature
  manifest but the docs only cover mobile
* The `off()` heading didn't match the actual method name `offUpdate()`
* The FeatureManifest.yaml example was missing required fields

This commit

* Replaces the removed `getExperimentMetaData` section with
  `getEnrollmentMetadata()` documenting all three query modes
* Adds `getAllEnrollments()` and `getAllEnrollmentMetadata()` sections
  for co-enrolling features
* Documents the `slug` parameter on `recordExposureEvent()` for
  co-enrolling features
* Fixes `off()` heading to `offUpdate()`
* Enriches the manifest example with `owner`, `hasExposure`,
  `exposureDescription`, and `allowCoenrollment`
* Adds Desktop co-enrollment support to coenrolling-features.mdx with
  manifest example, JS API example, and cross-links

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

`getAllEnrollments(): Array<{ meta: { slug, branch, isRollout }, value: object }>` (JS Only)

Returns an array of all active enrollments for this feature, each with metadata and the resolved feature variable values. This is the primary data access method for [co-enrolling features](/technical-reference/fml/coenrolling-features) where a client may be enrolled in multiple experiments or rollouts for the same feature simultaneously.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns an array of all active enrollments for this feature, each with metadata and the resolved feature variable values. This is the primary data access method for [co-enrolling features](/technical-reference/fml/coenrolling-features) where a client may be enrolled in multiple experiments or rollouts for the same feature simultaneously.
Returns an array of all active enrollments for this feature, each with metadata and the resolved feature variable values. This is the primary data access method for [co-enrolling features](/technical-reference/fml/coenrolling-features) where a client may be enrolled in multiple experiments and/or rollouts for the same feature simultaneously.

### `getEnrollmentMetadata()`

If you need to know whether an experiment is active or get access to the experiment or branch identifier (for example, to report in `utm_params`), you can use `ExperimentAPI.getExperimentMetaData`:
`getEnrollmentMetadata(enrollmentType?: "experiment" | "rollout"): { slug: string, branch: string, isRollout: boolean } | null` (JS Only)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets encourage the users to use the constants

Suggested change
`getEnrollmentMetadata(enrollmentType?: "experiment" | "rollout"): { slug: string, branch: string, isRollout: boolean } | null` (JS Only)
`getEnrollmentMetadata(enrollmentType?: EnrollmentType): { slug: string, branch: string, isRollout: boolean } | null` (JS Only)

Comment on lines 365 to 366
- **`"experiment"`** — returns only an active experiment enrollment, or `null`.
- **`"rollout"`** — returns only an active rollout enrollment, or `null`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **`"experiment"`** — returns only an active experiment enrollment, or `null`.
- **`"rollout"`** — returns only an active rollout enrollment, or `null`.
- **`EnrollmentType.EXPERIMENT`** — returns only an active experiment enrollment, or `null`.
- **`EnrollmentType.ROLLOUT`** — returns only an active rollout enrollment, or `null`.


Standard per-feature methods like `getVariable()` and `getAllVariables()` throw for co-enrolling features. Instead, use these APIs:

- **`getAllEnrollments()`** — returns `Array<{ meta: { slug, branch, isRollout }, value: object }>` with both metadata and resolved feature values for each enrollment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **`getAllEnrollments()`** — returns `Array<{ meta: { slug, branch, isRollout }, value: object }>` with both metadata and resolved feature values for each enrollment.
- **`getAllEnrollments()`** — returns `{ meta: { slug, branch, isRollout }, value: object }[]` with both metadata and resolved feature values for each enrollment.

prefer T[] over Array

Standard per-feature methods like `getVariable()` and `getAllVariables()` throw for co-enrolling features. Instead, use these APIs:

- **`getAllEnrollments()`** — returns `Array<{ meta: { slug, branch, isRollout }, value: object }>` with both metadata and resolved feature values for each enrollment.
- **`getAllEnrollmentMetadata()`** — returns `Array<{ slug, branch, isRollout }>` (metadata only).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **`getAllEnrollmentMetadata()`** — returns `Array<{ slug, branch, isRollout }>` (metadata only).
- **`getAllEnrollmentMetadata()`** — returns `{ slug, branch, isRollout }[]` (metadata only).

}

// Query for a specific enrollment type:
const rollout = NimbusFeatures.myFeature.getEnrollmentMetadata("rollout");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const rollout = NimbusFeatures.myFeature.getEnrollmentMetadata("rollout");
const rollout = NimbusFeatures.myFeature.getEnrollmentMetadata(EnrollmentType.ROLLOUT);


### `getAllEnrollmentMetadata()`

`getAllEnrollmentMetadata(): Array<{ slug: string, branch: string, isRollout: boolean }>` (JS Only)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`getAllEnrollmentMetadata(): Array<{ slug: string, branch: string, isRollout: boolean }>` (JS Only)
`getAllEnrollmentMetadata(): { slug: string, branch: string, isRollout: boolean }[]` (JS Only)


### `getAllEnrollments()`

`getAllEnrollments(): Array<{ meta: { slug, branch, isRollout }, value: object }>` (JS Only)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`getAllEnrollments(): Array<{ meta: { slug, branch, isRollout }, value: object }>` (JS Only)
`getAllEnrollments(): { meta: { slug, branch, isRollout }, value: object }[]` (JS Only)

Because

* Reviewer suggested using EnrollmentType constants instead of string
  literals to encourage best practices
* T[] syntax preferred over Array<T> for type signatures
* "and/or" more accurate than "or" for co-enrollment scenarios

This commit

* Uses EnrollmentType constants in getEnrollmentMetadata() signature,
  parameter docs, and code examples
* Adds import comment showing EnrollmentType is from the same module
* Switches all type signatures to T[] syntax
* Updates wording to "experiments and/or rollouts"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jaredlockhart jaredlockhart merged commit 93fdf4c into main Feb 24, 2026
2 checks passed
@jaredlockhart jaredlockhart deleted the 2026-02-24-desktop-api-docs branch February 24, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update desktop Feature API docs to match current source code

2 participants