launchdarkly_api 9.0.0 → 9.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +12 -9
  3. data/docs/AccountMembersApi.md +6 -6
  4. data/docs/EnvironmentsApi.md +1 -1
  5. data/docs/Experiment.md +36 -0
  6. data/docs/ExperimentCollectionRep.md +1 -1
  7. data/docs/ExperimentExpandableProperties.md +20 -0
  8. data/docs/ExperimentInfoRep.md +1 -1
  9. data/docs/ExperimentsBetaApi.md +12 -12
  10. data/docs/FeatureFlagsApi.md +1 -1
  11. data/docs/FeatureFlagsBetaApi.md +2 -2
  12. data/docs/IterationExpandableProperties.md +1 -1
  13. data/docs/IterationRep.md +4 -2
  14. data/docs/{ExperimentRep.md → LegacyExperimentRep.md} +2 -2
  15. data/docs/MetricRep.md +43 -3
  16. data/docs/MetricV2Rep.md +22 -0
  17. data/docs/OtherApi.md +1 -1
  18. data/docs/StatisticsRep.md +20 -0
  19. data/docs/TeamsBetaApi.md +9 -9
  20. data/docs/TreatmentRep.md +1 -1
  21. data/docs/UserRecord.md +1 -1
  22. data/docs/Users.md +1 -1
  23. data/docs/UsersApi.md +4 -4
  24. data/docs/UsersRep.md +22 -0
  25. data/lib/launchdarkly_api/api/account_members_api.rb +6 -6
  26. data/lib/launchdarkly_api/api/environments_api.rb +2 -2
  27. data/lib/launchdarkly_api/api/experiments_beta_api.rb +9 -9
  28. data/lib/launchdarkly_api/api/feature_flags_api.rb +2 -2
  29. data/lib/launchdarkly_api/api/feature_flags_beta_api.rb +4 -4
  30. data/lib/launchdarkly_api/api/other_api.rb +2 -2
  31. data/lib/launchdarkly_api/api/teams_beta_api.rb +12 -12
  32. data/lib/launchdarkly_api/api/users_api.rb +3 -3
  33. data/lib/launchdarkly_api/models/experiment.rb +328 -0
  34. data/lib/launchdarkly_api/models/experiment_collection_rep.rb +1 -1
  35. data/lib/launchdarkly_api/models/{decimal.rb → experiment_expandable_properties.rb} +18 -17
  36. data/lib/launchdarkly_api/models/experiment_info_rep.rb +1 -1
  37. data/lib/launchdarkly_api/models/iteration_expandable_properties.rb +1 -1
  38. data/lib/launchdarkly_api/models/iteration_rep.rb +12 -3
  39. data/lib/launchdarkly_api/models/{experiment_rep.rb → legacy_experiment_rep.rb} +3 -3
  40. data/lib/launchdarkly_api/models/metric_rep.rb +256 -4
  41. data/lib/launchdarkly_api/models/metric_v2_rep.rb +253 -0
  42. data/lib/launchdarkly_api/models/{null_decimal.rb → statistics_rep.rb} +20 -16
  43. data/lib/launchdarkly_api/models/treatment_rep.rb +1 -1
  44. data/lib/launchdarkly_api/models/users_rep.rb +250 -0
  45. data/lib/launchdarkly_api/version.rb +1 -1
  46. data/lib/launchdarkly_api.rb +6 -3
  47. data/spec/api/account_members_api_spec.rb +3 -3
  48. data/spec/api/environments_api_spec.rb +1 -1
  49. data/spec/api/experiments_beta_api_spec.rb +3 -3
  50. data/spec/api/feature_flags_api_spec.rb +1 -1
  51. data/spec/api/feature_flags_beta_api_spec.rb +2 -2
  52. data/spec/api/other_api_spec.rb +1 -1
  53. data/spec/api/teams_beta_api_spec.rb +6 -6
  54. data/spec/api/users_api_spec.rb +1 -1
  55. data/spec/models/{decimal_spec.rb → experiment_expandable_properties_spec.rb} +8 -8
  56. data/spec/models/experiment_spec.rb +88 -0
  57. data/spec/models/iteration_rep_spec.rb +6 -0
  58. data/spec/models/{experiment_rep_spec.rb → legacy_experiment_rep_spec.rb} +6 -6
  59. data/spec/models/metric_rep_spec.rb +128 -0
  60. data/spec/models/metric_v2_rep_spec.rb +46 -0
  61. data/spec/models/{null_decimal_spec.rb → statistics_rep_spec.rb} +8 -8
  62. data/spec/models/users_rep_spec.rb +46 -0
  63. metadata +26 -14
  64. data/docs/Decimal.md +0 -20
  65. data/docs/NullDecimal.md +0 -20
@@ -0,0 +1,250 @@
1
+ =begin
2
+ #LaunchDarkly REST API
3
+
4
+ ## Overview ## Authentication All REST API resources are authenticated with either [personal or service access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens), or session cookies. Other authentication mechanisms are not supported. You can manage personal access tokens on your [Account settings](https://app.launchdarkly.com/settings/tokens) page. LaunchDarkly also has SDK keys, mobile keys, and client-side IDs that are used by our server-side SDKs, mobile SDKs, and client-side SDKs, respectively. **These keys cannot be used to access our REST API**. These keys are environment-specific, and can only perform read-only operations (fetching feature flag settings). | Auth mechanism | Allowed resources | Use cases | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | [Personal access tokens](https://docs.launchdarkly.com/home/account-security/api-access-tokens) | Can be customized on a per-token basis | Building scripts, custom integrations, data export | | SDK keys | Can only access read-only SDK-specific resources and the firehose, restricted to a single environment | Server-side SDKs, Firehose API | | Mobile keys | Can only access read-only mobile SDK-specific resources, restricted to a single environment | Mobile SDKs | | Client-side ID | Single environment, only flags marked available to client-side | Client-side JavaScript | > #### Keep your access tokens and SDK keys private > > Access tokens should _never_ be exposed in untrusted contexts. Never put an access token in client-side JavaScript, or embed it in a mobile application. LaunchDarkly has special mobile keys that you can embed in mobile apps. If you accidentally expose an access token or SDK key, you can reset it from your [Account Settings](https://app.launchdarkly.com/settings#/tokens) page. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Via request header The preferred way to authenticate with the API is by adding an `Authorization` header containing your access token to your requests. The value of the `Authorization` header must be your access token. Manage personal access tokens from the [Account Settings](https://app.launchdarkly.com/settings/tokens) page. ### Via session cookie For testing purposes, you can make API calls directly from your web browser. If you're logged in to the application, the API will use your existing session to authenticate calls. If you have a [role](https://docs.launchdarkly.com/home/team/built-in-roles) other than Admin, or have a [custom role](https://docs.launchdarkly.com/home/team/custom-roles) defined, you may not have permission to perform some API calls. You will receive a `401` response code in that case. > ### Modifying the Origin header causes an error > > LaunchDarkly validates that the Origin header for any API request authenticated by a session cookie matches the expected Origin header. The expected Origin header is `https://app.launchdarkly.com`. > > If the Origin header does not match what's expected, LaunchDarkly returns an error. This error can prevent the LaunchDarkly app from working correctly. > > Any browser extension that intentionally changes the Origin header can cause this problem. For example, the `Allow-Control-Allow-Origin: *` Chrome extension changes the Origin header to `http://evil.com` and causes the app to fail. > > To prevent this error, do not modify your Origin header. > > LaunchDarkly does not require origin matching when authenticating with an access token, so this issue does not affect normal API usage. ## Representations All resources expect and return JSON response bodies. Error responses will also send a JSON body. Read [Errors](#section/Errors) for a more detailed description of the error format used by the API. In practice this means that you always get a response with a `Content-Type` header set to `application/json`. In addition, request bodies for `PUT`, `POST`, `REPORT` and `PATCH` requests must be encoded as JSON with a `Content-Type` header set to `application/json`. ### Summary and detailed representations When you fetch a list of resources, the response includes only the most important attributes of each resource. This is a _summary representation_ of the resource. When you fetch an individual resource, such as a single feature flag, you receive a _detailed representation_ of the resource. The best way to find a detailed representation is to follow links. Every summary representation includes a link to its detailed representation. In most cases, the detailed representation contains all of the attributes of the resource. In a few cases, the detailed representation contains many, but not all, of the attributes of the resource. Typically this happens when an attribute of the requested resource is itself paginated. You can request that the response include a particular attribute by using the `expand` request parameter. ### Links and addressability The best way to navigate the API is by following links. These are attributes in representations that link to other resources. The API always uses the same format for links: - Links to other resources within the API are encapsulated in a `_links` object. - If the resource has a corresponding link to HTML content on the site, it is stored in a special `_site` link. Each link has two attributes: an href (the URL) and a type (the content type). For example, a feature resource might return the following: ```json { \"_links\": { \"parent\": { \"href\": \"/api/features\", \"type\": \"application/json\" }, \"self\": { \"href\": \"/api/features/sort.order\", \"type\": \"application/json\" } }, \"_site\": { \"href\": \"/features/sort.order\", \"type\": \"text/html\" } } ``` From this, you can navigate to the parent collection of features by following the `parent` link, or navigate to the site page for the feature by following the `_site` link. Collections are always represented as a JSON object with an `items` attribute containing an array of representations. Like all other representations, collections have `_links` defined at the top level. Paginated collections include `first`, `last`, `next`, and `prev` links containing a URL with the respective set of elements in the collection. ### Expanding responses Sometimes the detailed representation of a resource does not include all of the attributes of the resource by default. If this is the case, the request method will clearly document this and describe which attributes you can include in an expanded response. To include the additional attributes, append the `expand` request parameter to your request and add a comma-separated list of the attributes to include. For example, when you append `?expand=members,roles` to the [Get team](/tag/Teams-(beta)#operation/getTeam) endpoint, the expanded response includes both of these attributes. ## Updates Resources that accept partial updates use the `PATCH` verb, and support the [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) format. Some resources also support the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) format. In addition, some resources support optional comments that can be submitted with updates. Comments appear in outgoing webhooks, the audit log, and other integrations. ### Updates via JSON Patch [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) is a way to specify the modifications to perform on a resource. For example, in this feature flag representation: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"description\": \"This is the description\", ... } ``` You can change the feature flag's description with the following patch document: ```json [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"This is the new description\" }] ``` JSON Patch documents are always arrays. You can specify multiple modifications to perform in a single request. You can also test that certain preconditions are met before applying the patch: ```json [ { \"op\": \"test\", \"path\": \"/version\", \"value\": 10 }, { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" } ] ``` The above patch request tests whether the feature flag's `version` is `10`, and if so, changes the feature flag's description. Attributes that aren't editable, like a resource's `_links`, have names that start with an underscore. ### Updates via JSON Merge Patch The API also supports the [JSON Merge Patch](https://datatracker.ietf.org/doc/html/rfc7386) format, as well as the [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource. JSON Merge Patch is less expressive than JSON Patch but in many cases, it is simpler to construct a merge patch document. For example, you can change a feature flag's description with the following merge patch document: ```json { \"description\": \"New flag description\" } ``` ### Updates with comments You can submit optional comments with `PATCH` changes. The [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) resource supports comments. To submit a comment along with a JSON Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"patch\": [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" }] } ``` To submit a comment along with a JSON Merge Patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"merge\": { \"description\": \"New flag description\" } } ``` ### Updates via semantic patches The API also supports the Semantic patch format. A semantic `PATCH` is a way to specify the modifications to perform on a resource as a set of executable instructions. JSON Patch uses paths and a limited set of operations to describe how to transform the current state of the resource into a new state. Semantic patch allows you to be explicit about intent using precise, custom instructions. In many cases, semantic patch instructions can also be defined independently of the current state of the resource. This can be useful when defining a change that may be applied at a future date. For example, in this feature flag configuration in environment Production: ```json { \"name\": \"Alternate sort order\", \"kind\": \"boolean\", \"key\": \"sort.order\", ... \"environments\": { \"production\": { \"on\": true, \"archived\": false, \"salt\": \"c29ydC5vcmRlcg==\", \"sel\": \"8de1085cb7354b0ab41c0e778376dfd3\", \"lastModified\": 1469131558260, \"version\": 81, \"targets\": [ { \"values\": [ \"Gerhard.Little@yahoo.com\" ], \"variation\": 0 }, { \"values\": [ \"1461797806429-33-861961230\", \"438580d8-02ee-418d-9eec-0085cab2bdf0\" ], \"variation\": 1 } ], \"rules\": [], \"fallthrough\": { \"variation\": 0 }, \"offVariation\": 1, \"prerequisites\": [], \"_site\": { \"href\": \"/default/production/features/sort.order\", \"type\": \"text/html\" } } } } ``` You can add a date you want a user to be removed from the feature flag's user targets. For example, “remove user 1461797806429-33-861961230 from the user target for variation 0 on the Alternate sort order flag in the production environment on Wed Jul 08 2020 at 15:27:41 pm”. This is done using the following: ```json { \"comment\": \"update expiring user targets\", \"instructions\": [ { \"kind\": \"removeExpireUserTargetDate\", \"userKey\": \"userKey\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\" }, { \"kind\": \"updateExpireUserTargetDate\", \"userKey\": \"userKey2\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1587582000000 }, { \"kind\": \"addExpireUserTargetDate\", \"userKey\": \"userKey3\", \"variationId\": \"978d53f9-7fe3-4a63-992d-97bcb4535dc8\", \"value\": 1594247266386 } ] } ``` Here is another example. In this feature flag configuration: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"environments\": { \"test\": { \"on\": true } } } ``` You can change the feature flag's description with the following patch document as a set of executable instructions. For example, “add user X to targets for variation Y and remove user A from targets for variation B for test flag”: ```json { \"comment\": \"\", \"instructions\": [ { \"kind\": \"removeUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"852cb784-54ff-46b9-8c35-5498d2e4f270\" }, { \"kind\": \"addUserTargets\", \"values\": [\"438580d8-02ee-418d-9eec-0085cab2bdf0\"], \"variationId\": \"1bb18465-33b6-49aa-a3bd-eeb6650b33ad\" } ] } ``` > ### Supported semantic patch API endpoints > > - [Update feature flag](/tag/Feature-flags#operation/patchFeatureFlag) > - [Update expiring user targets on feature flag](/tag/Feature-flags#operation/patchExpiringUserTargets) > - [Update expiring user target for flags](/tag/User-settings#operation/patchExpiringFlagsForUser) > - [Update expiring user targets on segment](/tag/Segments#operation/patchExpiringUserTargetsForSegment) ## Errors The API always returns errors in a common format. Here's an example: ```json { \"code\": \"invalid_request\", \"message\": \"A feature with that key already exists\", \"id\": \"30ce6058-87da-11e4-b116-123b93f75cba\" } ``` The general class of error is indicated by the `code`. The `message` is a human-readable explanation of what went wrong. The `id` is a unique identifier. Use it when you're working with LaunchDarkly support to debug a problem with a specific API call. ### HTTP Status - Error Response Codes | Code | Definition | Desc. | Possible Solution | | ---- | ----------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | 400 | Bad Request | A request that fails may return this HTTP response code. | Ensure JSON syntax in request body is correct. | | 401 | Unauthorized | User doesn't have permission to an API call. | Ensure your SDK key is good. | | 403 | Forbidden | User does not have permission for operation. | Ensure that the user or access token has proper permissions set. | | 409 | Conflict | The API request could not be completed because it conflicted with a concurrent API request. | Retry your request. | | 429 | Too many requests | See [Rate limiting](/#section/Rate-limiting). | Wait and try again later. | ## CORS The LaunchDarkly API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. If an `Origin` header is given in a request, it will be echoed as an explicitly allowed origin. Otherwise, a wildcard is returned: `Access-Control-Allow-Origin: *`. For more information on CORS, see the [CORS W3C Recommendation](http://www.w3.org/TR/cors). Example CORS headers might look like: ```http Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, Authorization Access-Control-Allow-Methods: OPTIONS, GET, DELETE, PATCH Access-Control-Allow-Origin: * Access-Control-Max-Age: 300 ``` You can make authenticated CORS calls just as you would make same-origin calls, using either [token or session-based authentication](#section/Authentication). If you’re using session auth, you should set the `withCredentials` property for your `xhr` request to `true`. You should never expose your access tokens to untrusted users. ## Rate limiting We use several rate limiting strategies to ensure the availability of our APIs. Rate-limited calls to our APIs will return a `429` status code. Calls to our APIs will include headers indicating the current rate limit status. The specific headers returned depend on the API route being called. The limits differ based on the route, authentication mechanism, and other factors. Routes that are not rate limited may not contain any of the headers described below. > ### Rate limiting and SDKs > > LaunchDarkly SDKs are never rate limited and do not use the API endpoints defined here. LaunchDarkly uses a different set of approaches, including streaming/server-sent events and a global CDN, to ensure availability to the routes used by LaunchDarkly SDKs. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Global rate limits Authenticated requests are subject to a global limit. This is the maximum number of calls that can be made to the API per ten seconds. All personal access tokens on the account share this limit, so exceeding the limit with one access token will impact other tokens. Calls that are subject to global rate limits will return the headers below: | Header name | Description | | ------------------------------ | -------------------------------------------------------------------------------- | | `X-Ratelimit-Global-Remaining` | The maximum number of requests the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | We do not publicly document the specific number of calls that can be made globally. This limit may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limit. ### Route-level rate limits Some authenticated routes have custom rate limits. These also reset every ten seconds. Any access tokens hitting the same route share this limit, so exceeding the limit with one access token may impact other tokens. Calls that are subject to route-level rate limits will return the headers below: | Header name | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | | `X-Ratelimit-Route-Remaining` | The maximum number of requests to the current route the account is permitted to make per ten seconds. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | A _route_ represents a specific URL pattern and verb. For example, the [Delete environment](/tag/Environments#operation/deleteEnvironment) endpoint is considered a single route, and each call to delete an environment counts against your route-level rate limit for that route. We do not publicly document the specific number of calls that can be made to each endpoint per ten seconds. These limits may change, and we encourage clients to program against the specification, relying on the two headers defined above, rather than hardcoding to the current limits. ### IP-based rate limiting We also employ IP-based rate limiting on some API routes. If you hit an IP-based rate limit, your API response will include a `Retry-After` header indicating how long to wait before re-trying the call. Clients must wait at least `Retry-After` seconds before making additional calls to our API, and should employ jitter and backoff strategies to avoid triggering rate limits again. ## OpenAPI (Swagger) We have a [complete OpenAPI (Swagger) specification](https://app.launchdarkly.com/api/v2/openapi.json) for our API. You can use this specification to generate client libraries to interact with our REST API in your language of choice. This specification is supported by several API-based tools such as Postman and Insomnia. In many cases, you can directly import our specification to ease use in navigating the APIs in the tooling. ## Client libraries We auto-generate multiple client libraries based on our OpenAPI specification. To learn more, visit [GitHub](https://github.com/search?q=topic%3Alaunchdarkly-api+org%3Alaunchdarkly&type=Repositories). ## Method Overriding Some firewalls and HTTP clients restrict the use of verbs other than `GET` and `POST`. In those environments, our API endpoints that use `PUT`, `PATCH`, and `DELETE` verbs will be inaccessible. To avoid this issue, our API supports the `X-HTTP-Method-Override` header, allowing clients to \"tunnel\" `PUT`, `PATCH`, and `DELETE` requests via a `POST` request. For example, if you wish to call one of our `PATCH` resources via a `POST` request, you can include `X-HTTP-Method-Override:PATCH` as a header. ## Beta resources We sometimes release new API resources in **beta** status before we release them with general availability. Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. We try to promote resources into general availability as quickly as possible. This happens after sufficient testing and when we're satisfied that we no longer need to make backwards-incompatible changes. We mark beta resources with a \"Beta\" callout in our documentation, pictured below: > ### This feature is in beta > > To use this feature, pass in a header including the `LD-API-Version` key with value set to `beta`. Use this header with each call. To learn more, read [Beta resources](/#section/Overview/Beta-resources). ### Using beta resources To use a beta resource, you must include a header in the request. If you call a beta resource without this header, you'll receive a `403` response. Use this header: ``` LD-API-Version: beta ``` ## Versioning We try hard to keep our REST API backwards compatible, but we occasionally have to make backwards-incompatible changes in the process of shipping new features. These breaking changes can cause unexpected behavior if you don't prepare for them accordingly. Updates to our REST API include support for the latest features in LaunchDarkly. We also release a new version of our REST API every time we make a breaking change. We provide simultaneous support for multiple API versions so you can migrate from your current API version to a new version at your own pace. ### Setting the API version per request You can set the API version on a specific request by sending an `LD-API-Version` header, as shown in the example below: ``` LD-API-Version: 20210729 ``` The header value is the version number of the API version you'd like to request. The number for each version corresponds to the date the version was released in yyyymmdd format. In the example above the version `20210729` corresponds to July 29, 2021. ### Setting the API version per access token When creating an access token, you must specify a specific version of the API to use. This ensures that integrations using this token cannot be broken by version changes. Tokens created before versioning was released have their version set to `20160426` (the version of the API that existed before versioning) so that they continue working the same way they did before versioning. If you would like to upgrade your integration to use a new API version, you can explicitly set the header described above. > ### Best practice: Set the header for every client or integration > > We recommend that you set the API version header explicitly in any client or integration you build. > > Only rely on the access token API version during manual testing. ### API version changelog | Version | Changes | |---|---| | `20210729` | <ul><li>Changed the [create approval request](/tag/Approvals#operation/postApprovalRequest) return value. It now returns HTTP Status Code `201` instead of `200`.</li><li> Changed the [get users](/tag/Users#operation/getUser) return value. It now returns a user record, not a user. </li><li> Added additional optional fields to environment, segments, flags, members, and segments, including the ability to create Big Segments. </li><li> Added default values for flag variations when new environments are created. </li><li> Added filtering and pagination for getting flags and members, including `limit`, `number`, `filter`, and `sort` query parameters. </li><li> Added endpoints for expiring user targets for flags and segments, scheduled changes, access tokens, Relay Proxy configuration, integrations and subscriptions, and approvals. </li></ul> | | `20191212` | <ul><li>[List feature flags](/tag/Feature-flags#operation/getFeatureFlags) now defaults to sending summaries of feature flag configurations, equivalent to setting the query parameter `summary=true`. Summaries omit flag targeting rules and individual user targets from the payload. </li><li> Added endpoints for flags, flag status, projects, environments, users, audit logs, members, users, custom roles, segments, usage, streams, events, and data export. </li></ul> | | `20160426` | <ul><li>Initial versioning of API. Tokens created before versioning have their version set to this.</li></ul> |
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@launchdarkly.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 5.3.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LaunchDarklyApi
17
+ class UsersRep
18
+ attr_accessor :_links
19
+
20
+ attr_accessor :total_count
21
+
22
+ attr_accessor :items
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'_links' => :'_links',
28
+ :'total_count' => :'totalCount',
29
+ :'items' => :'items'
30
+ }
31
+ end
32
+
33
+ # Returns all the JSON keys this model knows about
34
+ def self.acceptable_attributes
35
+ attribute_map.values
36
+ end
37
+
38
+ # Attribute type mapping.
39
+ def self.openapi_types
40
+ {
41
+ :'_links' => :'Hash<String, Link>',
42
+ :'total_count' => :'Integer',
43
+ :'items' => :'Array<UserRecord>'
44
+ }
45
+ end
46
+
47
+ # List of attributes with nullable: true
48
+ def self.openapi_nullable
49
+ Set.new([
50
+ ])
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ if (!attributes.is_a?(Hash))
57
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LaunchDarklyApi::UsersRep` initialize method"
58
+ end
59
+
60
+ # check to see if the attribute exists and convert string to symbol for hash key
61
+ attributes = attributes.each_with_object({}) { |(k, v), h|
62
+ if (!self.class.attribute_map.key?(k.to_sym))
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LaunchDarklyApi::UsersRep`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
64
+ end
65
+ h[k.to_sym] = v
66
+ }
67
+
68
+ if attributes.key?(:'_links')
69
+ if (value = attributes[:'_links']).is_a?(Hash)
70
+ self._links = value
71
+ end
72
+ end
73
+
74
+ if attributes.key?(:'total_count')
75
+ self.total_count = attributes[:'total_count']
76
+ end
77
+
78
+ if attributes.key?(:'items')
79
+ if (value = attributes[:'items']).is_a?(Array)
80
+ self.items = value
81
+ end
82
+ end
83
+ end
84
+
85
+ # Show invalid properties with the reasons. Usually used together with valid?
86
+ # @return Array for valid properties with the reasons
87
+ def list_invalid_properties
88
+ invalid_properties = Array.new
89
+ if @total_count.nil?
90
+ invalid_properties.push('invalid value for "total_count", total_count cannot be nil.')
91
+ end
92
+
93
+ if @items.nil?
94
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
95
+ end
96
+
97
+ invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return false if @total_count.nil?
104
+ return false if @items.nil?
105
+ true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ _links == o._links &&
114
+ total_count == o.total_count &&
115
+ items == o.items
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Integer] Hash code
126
+ def hash
127
+ [_links, total_count, items].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def self.build_from_hash(attributes)
134
+ new.build_from_hash(attributes)
135
+ end
136
+
137
+ # Builds the object from hash
138
+ # @param [Hash] attributes Model attributes in the form of hash
139
+ # @return [Object] Returns the model itself
140
+ def build_from_hash(attributes)
141
+ return nil unless attributes.is_a?(Hash)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
144
+ self.send("#{key}=", nil)
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ end
154
+ end
155
+
156
+ self
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = LaunchDarklyApi.const_get(type)
198
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -11,5 +11,5 @@ OpenAPI Generator version: 5.3.0
11
11
  =end
12
12
 
13
13
  module LaunchDarklyApi
14
- VERSION = '9.0.0'
14
+ VERSION = '9.0.1'
15
15
  end
@@ -57,7 +57,6 @@ require 'launchdarkly_api/models/custom_workflow_meta'
57
57
  require 'launchdarkly_api/models/custom_workflow_output_rep'
58
58
  require 'launchdarkly_api/models/custom_workflow_stage_meta'
59
59
  require 'launchdarkly_api/models/custom_workflows_listing_output_rep'
60
- require 'launchdarkly_api/models/decimal'
61
60
  require 'launchdarkly_api/models/default_client_side_availability_post'
62
61
  require 'launchdarkly_api/models/defaults'
63
62
  require 'launchdarkly_api/models/dependent_flag'
@@ -70,15 +69,16 @@ require 'launchdarkly_api/models/environment'
70
69
  require 'launchdarkly_api/models/environment_post'
71
70
  require 'launchdarkly_api/models/evaluation_reason'
72
71
  require 'launchdarkly_api/models/execution_output_rep'
72
+ require 'launchdarkly_api/models/experiment'
73
73
  require 'launchdarkly_api/models/experiment_allocation_rep'
74
74
  require 'launchdarkly_api/models/experiment_collection_rep'
75
75
  require 'launchdarkly_api/models/experiment_enabled_period_rep'
76
76
  require 'launchdarkly_api/models/experiment_environment_setting_rep'
77
+ require 'launchdarkly_api/models/experiment_expandable_properties'
77
78
  require 'launchdarkly_api/models/experiment_info_rep'
78
79
  require 'launchdarkly_api/models/experiment_metadata_rep'
79
80
  require 'launchdarkly_api/models/experiment_patch_input'
80
81
  require 'launchdarkly_api/models/experiment_post'
81
- require 'launchdarkly_api/models/experiment_rep'
82
82
  require 'launchdarkly_api/models/experiment_results'
83
83
  require 'launchdarkly_api/models/experiment_stats_rep'
84
84
  require 'launchdarkly_api/models/experiment_time_series_slice'
@@ -139,6 +139,7 @@ require 'launchdarkly_api/models/iteration_expandable_properties'
139
139
  require 'launchdarkly_api/models/iteration_input'
140
140
  require 'launchdarkly_api/models/iteration_rep'
141
141
  require 'launchdarkly_api/models/last_seen_metadata'
142
+ require 'launchdarkly_api/models/legacy_experiment_rep'
142
143
  require 'launchdarkly_api/models/link'
143
144
  require 'launchdarkly_api/models/member'
144
145
  require 'launchdarkly_api/models/member_data_rep'
@@ -155,12 +156,12 @@ require 'launchdarkly_api/models/metric_listing_rep'
155
156
  require 'launchdarkly_api/models/metric_post'
156
157
  require 'launchdarkly_api/models/metric_rep'
157
158
  require 'launchdarkly_api/models/metric_seen'
159
+ require 'launchdarkly_api/models/metric_v2_rep'
158
160
  require 'launchdarkly_api/models/modification'
159
161
  require 'launchdarkly_api/models/multi_environment_dependent_flag'
160
162
  require 'launchdarkly_api/models/multi_environment_dependent_flags'
161
163
  require 'launchdarkly_api/models/new_member_form'
162
164
  require 'launchdarkly_api/models/not_found_error_rep'
163
- require 'launchdarkly_api/models/null_decimal'
164
165
  require 'launchdarkly_api/models/parameter_rep'
165
166
  require 'launchdarkly_api/models/parent_resource_rep'
166
167
  require 'launchdarkly_api/models/patch_failed_error_rep'
@@ -220,6 +221,7 @@ require 'launchdarkly_api/models/statement_post_data'
220
221
  require 'launchdarkly_api/models/statement_rep'
221
222
  require 'launchdarkly_api/models/statistic_collection_rep'
222
223
  require 'launchdarkly_api/models/statistic_rep'
224
+ require 'launchdarkly_api/models/statistics_rep'
223
225
  require 'launchdarkly_api/models/statistics_root'
224
226
  require 'launchdarkly_api/models/status_conflict_error_rep'
225
227
  require 'launchdarkly_api/models/subject_data_rep'
@@ -259,6 +261,7 @@ require 'launchdarkly_api/models/user_segment'
259
261
  require 'launchdarkly_api/models/user_segment_rule'
260
262
  require 'launchdarkly_api/models/user_segments'
261
263
  require 'launchdarkly_api/models/users'
264
+ require 'launchdarkly_api/models/users_rep'
262
265
  require 'launchdarkly_api/models/value_put'
263
266
  require 'launchdarkly_api/models/variation'
264
267
  require 'launchdarkly_api/models/variation_or_rollout_rep'
@@ -46,7 +46,7 @@ describe 'AccountMembersApi' do
46
46
 
47
47
  # unit tests for get_member
48
48
  # Get account member
49
- # Get a single account member by ID
49
+ # Get a single account member by ID. &#x60;me&#x60; is a reserved value for the &#x60;id&#x60; parameter and returns the caller&#39;s member information.
50
50
  # @param id The member ID
51
51
  # @param [Hash] opts the optional parameters
52
52
  # @return [Member]
@@ -85,8 +85,8 @@ describe 'AccountMembersApi' do
85
85
  end
86
86
 
87
87
  # unit tests for post_member_teams
88
- # Add member to teams
89
- # Add member to team(s)
88
+ # Add a member to teams
89
+ # Add one member to one or more teams.
90
90
  # @param id The member ID
91
91
  # @param member_teams_post_input
92
92
  # @param [Hash] opts the optional parameters
@@ -60,7 +60,7 @@ describe 'EnvironmentsApi' do
60
60
 
61
61
  # unit tests for patch_environment
62
62
  # Update environment
63
- # Update an environment. Requires a [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes to the environment. To update fields in the environment object that are arrays, set the &#x60;path&#x60; to the name of the field and then append &#x60;/&lt;array index&gt;&#x60;. Using &#x60;/0&#x60; appends to the beginning of the array. ### Approval settings This request only returns the &#x60;approvalSettings&#x60; key if the [Flag Approvals](https://docs.launchdarkly.com/home/feature-workflows/approvals) feature is enabled. Only the &#x60;canReviewOwnRequest&#x60;, &#x60;canApplyDeclinedChanges&#x60;, &#x60;minNumApprovals&#x60;, &#x60;required&#x60; and &#x60;requiredApprovalTagsfields&#x60; are editable. If you try to patch the environment by setting both &#x60;required&#x60; and &#x60;requiredApprovalTags&#x60;, the request fails and an error appears. You can specify either required approvals for all flags in an environment or those with specific tags, but not both. Only customers on a Pro or Enterprise plan can require approval for flag updates by either mechanism.
63
+ # Update an environment. Requires a [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes to the environment. To update fields in the environment object that are arrays, set the &#x60;path&#x60; to the name of the field and then append &#x60;/&lt;array index&gt;&#x60;. Using &#x60;/0&#x60; appends to the beginning of the array. ### Approval settings This request only returns the &#x60;approvalSettings&#x60; key if the [Flag Approvals](https://docs.launchdarkly.com/home/feature-workflows/approvals) feature is enabled. Only the &#x60;canReviewOwnRequest&#x60;, &#x60;canApplyDeclinedChanges&#x60;, &#x60;minNumApprovals&#x60;, &#x60;required&#x60; and &#x60;requiredApprovalTagsfields&#x60; are editable. If you try to patch the environment by setting both &#x60;required&#x60; and &#x60;requiredApprovalTags&#x60;, the request fails and an error appears. You can specify either required approvals for all flags in an environment or those with specific tags, but not both.
64
64
  # @param project_key The project key
65
65
  # @param environment_key The environment key
66
66
  # @param patch_operation
@@ -39,7 +39,7 @@ describe 'ExperimentsBetaApi' do
39
39
  # @param environment_key The environment key
40
40
  # @param experiment_post
41
41
  # @param [Hash] opts the optional parameters
42
- # @return [ExperimentRep]
42
+ # @return [Experiment]
43
43
  describe 'create_experiment test' do
44
44
  it 'should work' do
45
45
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -68,7 +68,7 @@ describe 'ExperimentsBetaApi' do
68
68
  # @param environment_key The environment key
69
69
  # @param experiment_key The experiment key
70
70
  # @param [Hash] opts the optional parameters
71
- # @return [ExperimentRep]
71
+ # @return [Experiment]
72
72
  describe 'get_experiment test' do
73
73
  it 'should work' do
74
74
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -128,7 +128,7 @@ describe 'ExperimentsBetaApi' do
128
128
  # @param experiment_key The experiment key
129
129
  # @param experiment_patch_input
130
130
  # @param [Hash] opts the optional parameters
131
- # @return [ExperimentRep]
131
+ # @return [Experiment]
132
132
  describe 'patch_experiment test' do
133
133
  it 'should work' do
134
134
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
@@ -166,7 +166,7 @@ describe 'FeatureFlagsApi' do
166
166
 
167
167
  # unit tests for patch_feature_flag
168
168
  # Update feature flag
169
- # Perform a partial update to a feature flag. ## Using semantic patches on a feature flag To use a [semantic patch](/reference#updates-via-semantic-patches) on a feature flag resource, you must include a header in the request. If you call a semantic patch resource without this header, you will receive a &#x60;400&#x60; response because your semantic patch will be interpreted as a JSON patch. Use this header: &#x60;&#x60;&#x60; Content-Type: application/json; domain-model&#x3D;launchdarkly.semanticpatch &#x60;&#x60;&#x60; The body of a semantic patch request takes the following three properties: 1. &#x60;comment&#x60; (string): (Optional) A description of the update. 1. &#x60;environmentKey&#x60; (string): (Required) The key of the LaunchDarkly environment. 1. &#x60;instructions&#x60; (array): (Required) The list of actions to be performed by the update. Each action in the list must be an object/hash table with a &#x60;kind&#x60; property that indicates the instruction. Depending on the &#x60;kind&#x60;, the API may require other parameters. When this is the case, add the parameters as additional fields to the instruction object. Read below for more information on the specific supported semantic patch instructions. If any instruction in the patch encounters an error, the error will be returned and the flag will not be changed. In general, instructions will silently do nothing if the flag is already in the state requested by the patch instruction. For example, &#x60;removeUserTargets&#x60; does nothing when the targets have already been removed. They will generally error if a parameter refers to something that does not exist, like a variation ID that doesn&#39;t correspond to a variation on the flag or a rule ID that doesn&#39;t belong to a rule on the flag. Other specific error conditions are noted in the instruction descriptions. ### Instructions #### &#x60;turnFlagOn&#x60; Sets the flag&#39;s targeting state to on. For example, to flip a flag on, use this request body: &#x60;&#x60;&#x60;json { \&quot;environmentKey\&quot;: \&quot;example-environment-key\&quot;, \&quot;instructions\&quot;: [ { \&quot;kind\&quot;: \&quot;turnFlagOn\&quot; } ] } &#x60;&#x60;&#x60; #### &#x60;turnFlagOff&#x60; Sets the flag&#39;s targeting state to off. For example, to flip a flag off, use this request body: &#x60;&#x60;&#x60;json { \&quot;environmentKey\&quot;: \&quot;example-environment-key\&quot;, \&quot;instructions\&quot;: [ { \&quot;kind\&quot;: \&quot;turnFlagOff\&quot; } ] } &#x60;&#x60;&#x60; #### &#x60;addUserTargets&#x60; Adds the user keys in &#x60;values&#x60; to the individual user targets for the variation specified by &#x60;variationId&#x60;. Returns an error if this causes the same user key to be targeted in multiple variations. ##### Parameters - &#x60;values&#x60;: list of user keys - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;removeUserTargets&#x60; Removes the user keys in &#x60;values&#x60; to the individual user targets for the variation specified by &#x60;variationId&#x60;. Does nothing if the user keys are not targeted. ##### Parameters - &#x60;values&#x60;: list of user keys - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;replaceUserTargets&#x60; Completely replaces the existing set of user targeting. All variations must be provided. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replaceUserTargets\&quot;, \&quot;targets\&quot;: [ { \&quot;variationId\&quot;: \&quot;variation-1\&quot;, \&quot;values\&quot;: [\&quot;blah\&quot;, \&quot;foo\&quot;, \&quot;bar\&quot;] }, { \&quot;variationId\&quot;: \&quot;variation-2\&quot;, \&quot;values\&quot;: [\&quot;abc\&quot;, \&quot;def\&quot;] } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;targets&#x60;: a list of user targeting #### &#x60;clearUserTargets&#x60; Removes all individual user targets from the variation specified by &#x60;variationId&#x60; ##### Parameters - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;addPrerequisite&#x60; Adds the flag indicated by &#x60;key&#x60; with variation &#x60;variationId&#x60; as a prerequisite to the flag. ##### Parameters - &#x60;key&#x60;: flag key of another flag - &#x60;variationId&#x60;: ID of a variation of the flag with key &#x60;key&#x60; #### &#x60;removePrerequisite&#x60; Removes the prerequisite indicated by &#x60;key&#x60;. Does nothing if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: flag key of an existing prerequisite #### &#x60;updatePrerequisite&#x60; Changes the prerequisite with flag key &#x60;key&#x60; to the variation indicated by &#x60;variationId&#x60;. Returns an error if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: flag key of an existing prerequisite - &#x60;variationId&#x60;: ID of a variation of the flag with key &#x60;key&#x60; #### &#x60;replacePrerequisites&#x60; Completely replaces the existing set of prerequisites for a given flag. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replacePrerequisites\&quot;, \&quot;prerequisites\&quot;: [ { \&quot;key\&quot;: \&quot;flag-key\&quot;, \&quot;variationId\&quot;: \&quot;variation-1\&quot; }, { \&quot;key\&quot;: \&quot;another-flag\&quot;, \&quot;variationId\&quot;: \&quot;variation-2\&quot; } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;prerequisites&#x60;: a list of prerequisites #### &#x60;addRule&#x60; Adds a new rule to the flag with the given &#x60;clauses&#x60; which serves the variation indicated by &#x60;variationId&#x60; or the percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. If &#x60;beforeRuleId&#x60; is set, the rule will be added in the list of rules before the indicated rule. Otherwise, the rule will be added to the end of the list. ##### Parameters - &#x60;clauses&#x60;: Array of clauses (see &#x60;addClauses&#x60;) - &#x60;beforeRuleId&#x60;: Optional ID of a rule in the flag - &#x60;variationId&#x60;: ID of a variation of the flag - &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) - &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;removeRule&#x60; Removes the targeting rule specified by &#x60;ruleId&#x60;. Does nothing if the rule does not exist. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag #### &#x60;replaceRules&#x60; Completely replaces the existing rules for a given flag. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replaceRules\&quot;, \&quot;rules\&quot;: [ { \&quot;variationId\&quot;: \&quot;variation-1\&quot;, \&quot;description\&quot;: \&quot;myRule\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;op\&quot;: \&quot;segmentMatch\&quot;, \&quot;values\&quot;: [\&quot;test\&quot;] } ], \&quot;trackEvents\&quot;: true } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;rules&#x60;: a list of rules #### &#x60;addClauses&#x60; Adds the given clauses to the rule indicated by &#x60;ruleId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauses&#x60;: Array of clause objects, with &#x60;attribute&#x60; (string), &#x60;op&#x60; (string), and &#x60;values&#x60; (array of strings, numbers, or dates) properties. #### &#x60;removeClauses&#x60; Removes the clauses specified by &#x60;clauseIds&#x60; from the rule indicated by &#x60;ruleId&#x60;. #### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseIds&#x60;: Array of IDs of clauses in the rule #### &#x60;updateClause&#x60; Replaces the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60; with &#x60;clause&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseId&#x60;: ID of a clause in that rule - &#x60;clause&#x60;: Clause object #### &#x60;addValuesToClause&#x60; Adds &#x60;values&#x60; to the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseId&#x60;: ID of a clause in that rule - &#x60;values&#x60;: Array of strings #### &#x60;removeValuesFromClause&#x60; Removes &#x60;values&#x60; from the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. ##### Parameters &#x60;ruleId&#x60;: ID of a rule in the flag &#x60;clauseId&#x60;: ID of a clause in that rule &#x60;values&#x60;: Array of strings #### &#x60;reorderRules&#x60; Rearranges the rules to match the order given in &#x60;ruleIds&#x60;. Will return an error if &#x60;ruleIds&#x60; does not match the current set of rules on the flag. ##### Parameters - &#x60;ruleIds&#x60;: Array of IDs of all rules in the flag #### &#x60;updateRuleVariationOrRollout&#x60; Updates what the rule indicated by &#x60;ruleId&#x60; serves if its clauses evaluate to true. Can either be a fixed variation indicated by &#x60;variationId&#x60; or a percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;variationId&#x60;: ID of a variation of the flag or - &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) - &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;updateFallthroughVariationOrRollout&#x60; Updates the flag&#39;s fallthrough, which is served if none of the targeting rules match. Can either be a fixed variation indicated by &#x60;variationId&#x60; or a percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. ##### Parameters &#x60;variationId&#x60;: ID of a variation of the flag or &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;updateOffVariation&#x60; Updates the variation served when the flag&#39;s targeting is off to the variation indicated by &#x60;variationId&#x60;. ##### Parameters &#x60;variationId&#x60;: ID of a variation of the flag ### Example &#x60;&#x60;&#x60;json { \&quot;environmentKey\&quot;: \&quot;production\&quot;, \&quot;instructions\&quot;: [ { \&quot;kind\&quot;: \&quot;turnFlagOn\&quot; }, { \&quot;kind\&quot;: \&quot;turnFlagOff\&quot; }, { \&quot;kind\&quot;: \&quot;addUserTargets\&quot;, \&quot;variationId\&quot;: \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;, \&quot;values\&quot;: [\&quot;userId\&quot;, \&quot;userId2\&quot;] }, { \&quot;kind\&quot;: \&quot;removeUserTargets\&quot;, \&quot;variationId\&quot;: \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;, \&quot;values\&quot;: [\&quot;userId3\&quot;, \&quot;userId4\&quot;] }, { \&quot;kind\&quot;: \&quot;updateFallthroughVariationOrRollout\&quot;, \&quot;rolloutWeights\&quot;: { \&quot;variationId\&quot;: 50000, \&quot;variationId2\&quot;: 50000 }, \&quot;rolloutBucketBy\&quot;: null }, { \&quot;kind\&quot;: \&quot;addRule\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test-segment\&quot;] } ], \&quot;variationId\&quot;: null, \&quot;rolloutWeights\&quot;: { \&quot;variationId\&quot;: 50000, \&quot;variationId2\&quot;: 50000 }, \&quot;rolloutBucketBy\&quot;: \&quot;key\&quot; }, { \&quot;kind\&quot;: \&quot;removeRule\&quot;, \&quot;ruleId\&quot;: \&quot;99f12464-a429-40fc-86cc-b27612188955\&quot; }, { \&quot;kind\&quot;: \&quot;reorderRules\&quot;, \&quot;ruleIds\&quot;: [\&quot;2f72974e-de68-4243-8dd3-739582147a1f\&quot;, \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;] }, { \&quot;kind\&quot;: \&quot;addClauses\&quot;, \&quot;ruleId\&quot;: \&quot;1134\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;email\&quot;, \&quot;op\&quot;: \&quot;in\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test@test.com\&quot;] } ] }, { \&quot;kind\&quot;: \&quot;removeClauses\&quot;, \&quot;ruleId\&quot;: \&quot;1242529\&quot;, \&quot;clauseIds\&quot;: [\&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;] }, { \&quot;kind\&quot;: \&quot;updateClause\&quot;, \&quot;ruleId\&quot;: \&quot;2f72974e-de68-4243-8dd3-739582147a1f\&quot;, \&quot;clauseId\&quot;: \&quot;309845\&quot;, \&quot;clause\&quot;: { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test-segment\&quot;] } }, { \&quot;kind\&quot;: \&quot;updateRuleVariationOrRollout\&quot;, \&quot;ruleId\&quot;: \&quot;2342\&quot;, \&quot;rolloutWeights\&quot;: null, \&quot;rolloutBucketBy\&quot;: null }, { \&quot;kind\&quot;: \&quot;updateOffVariation\&quot;, \&quot;variationId\&quot;: \&quot;3242453\&quot; }, { \&quot;kind\&quot;: \&quot;addPrerequisite\&quot;, \&quot;variationId\&quot;: \&quot;234235\&quot;, \&quot;key\&quot;: \&quot;flagKey2\&quot; }, { \&quot;kind\&quot;: \&quot;updatePrerequisite\&quot;, \&quot;variationId\&quot;: \&quot;234235\&quot;, \&quot;key\&quot;: \&quot;flagKey2\&quot; }, { \&quot;kind\&quot;: \&quot;removePrerequisite\&quot;, \&quot;key\&quot;: \&quot;flagKey\&quot; } ] } &#x60;&#x60;&#x60; ## Using JSON Patches on a feature flag If you do not include the header described above, you can use [JSON patch](/reference#updates-via-json-patch). When using the update feature flag endpoint to add individual users to a specific variation, there are two different patch documents, depending on whether users are already being individually targeted for the variation. If a flag variation already has users individually targeted, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/environments/devint/targets/0/values/-\&quot;, \&quot;value\&quot;: \&quot;TestClient10\&quot; } &#x60;&#x60;&#x60; If a flag variation does not already have users individually targeted, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json [ { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/environments/devint/targets/-\&quot;, \&quot;value\&quot;: { \&quot;variation\&quot;: 0, \&quot;values\&quot;: [\&quot;TestClient10\&quot;] } } ] &#x60;&#x60;&#x60; ## Required approvals If a request attempts to alter a flag configuration in an environment where approvals are required for the flag, the request will fail with a 405. Changes to the flag configuration in that environment will required creating an [approval request](/tag/Approvals) or a [workflow](/tag/Workflows-(beta)). This behavior can be bypassed by users and access tokens that have a [custom role](https://docs.launchdarkly.com/home/members/custom-roles) with permission to perform the &#x60;bypassRequiredApproval&#x60; action on the flag. ## Conflicts If a flag configuration change made through this endpoint would cause a pending scheduled change or approval request to fail, this endpoint will return a 400. You can ignore this check by adding an &#x60;ignoreConflicts&#x60; query parameter set to &#x60;true&#x60;.
169
+ # Perform a partial update to a feature flag. ## Using semantic patches on a feature flag To use a [semantic patch](/reference#updates-via-semantic-patches) on a feature flag resource, you must include a header in the request. If you call a semantic patch resource without this header, you will receive a &#x60;400&#x60; response because your semantic patch will be interpreted as a JSON patch. Use this header: &#x60;&#x60;&#x60; Content-Type: application/json; domain-model&#x3D;launchdarkly.semanticpatch &#x60;&#x60;&#x60; The body of a semantic patch request takes the following three properties: 1. &#x60;comment&#x60; (string): (Optional) A description of the update. 1. &#x60;environmentKey&#x60; (string): (Required) The key of the LaunchDarkly environment. 1. &#x60;instructions&#x60; (array): (Required) The list of actions to be performed by the update. Each action in the list must be an object/hash table with a &#x60;kind&#x60; property that indicates the instruction. Depending on the &#x60;kind&#x60;, the API may require other parameters. When this is the case, add the parameters as additional fields to the instruction object. Read below for more information on the specific supported semantic patch instructions. If any instruction in the patch encounters an error, the error will be returned and the flag will not be changed. In general, instructions will silently do nothing if the flag is already in the state requested by the patch instruction. For example, &#x60;removeUserTargets&#x60; does nothing when the targets have already been removed. They will generally error if a parameter refers to something that does not exist, like a variation ID that doesn&#39;t correspond to a variation on the flag or a rule ID that doesn&#39;t belong to a rule on the flag. Other specific error conditions are noted in the instruction descriptions. ### Instructions #### &#x60;turnFlagOn&#x60; Sets the flag&#39;s targeting state to on. For example, to flip a flag on, use this request body: &#x60;&#x60;&#x60;json { \&quot;environmentKey\&quot;: \&quot;example-environment-key\&quot;, \&quot;instructions\&quot;: [ { \&quot;kind\&quot;: \&quot;turnFlagOn\&quot; } ] } &#x60;&#x60;&#x60; #### &#x60;turnFlagOff&#x60; Sets the flag&#39;s targeting state to off. For example, to flip a flag off, use this request body: &#x60;&#x60;&#x60;json { \&quot;environmentKey\&quot;: \&quot;example-environment-key\&quot;, \&quot;instructions\&quot;: [ { \&quot;kind\&quot;: \&quot;turnFlagOff\&quot; } ] } &#x60;&#x60;&#x60; #### &#x60;addUserTargets&#x60; Adds the user keys in &#x60;values&#x60; to the individual user targets for the variation specified by &#x60;variationId&#x60;. Returns an error if this causes the same user key to be targeted in multiple variations. ##### Parameters - &#x60;values&#x60;: list of user keys - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;removeUserTargets&#x60; Removes the user keys in &#x60;values&#x60; to the individual user targets for the variation specified by &#x60;variationId&#x60;. Does nothing if the user keys are not targeted. ##### Parameters - &#x60;values&#x60;: list of user keys - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;replaceUserTargets&#x60; Completely replaces the existing set of user targeting. All variations must be provided. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replaceUserTargets\&quot;, \&quot;targets\&quot;: [ { \&quot;variationId\&quot;: \&quot;variation-1\&quot;, \&quot;values\&quot;: [\&quot;blah\&quot;, \&quot;foo\&quot;, \&quot;bar\&quot;] }, { \&quot;variationId\&quot;: \&quot;variation-2\&quot;, \&quot;values\&quot;: [\&quot;abc\&quot;, \&quot;def\&quot;] } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;targets&#x60;: a list of user targeting #### &#x60;clearUserTargets&#x60; Removes all individual user targets from the variation specified by &#x60;variationId&#x60; ##### Parameters - &#x60;variationId&#x60;: ID of a variation on the flag #### &#x60;addPrerequisite&#x60; Adds the flag indicated by &#x60;key&#x60; with variation &#x60;variationId&#x60; as a prerequisite to the flag. ##### Parameters - &#x60;key&#x60;: flag key of another flag - &#x60;variationId&#x60;: ID of a variation of the flag with key &#x60;key&#x60; #### &#x60;removePrerequisite&#x60; Removes the prerequisite indicated by &#x60;key&#x60;. Does nothing if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: flag key of an existing prerequisite #### &#x60;updatePrerequisite&#x60; Changes the prerequisite with flag key &#x60;key&#x60; to the variation indicated by &#x60;variationId&#x60;. Returns an error if this prerequisite does not exist. ##### Parameters - &#x60;key&#x60;: flag key of an existing prerequisite - &#x60;variationId&#x60;: ID of a variation of the flag with key &#x60;key&#x60; #### &#x60;replacePrerequisites&#x60; Completely replaces the existing set of prerequisites for a given flag. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replacePrerequisites\&quot;, \&quot;prerequisites\&quot;: [ { \&quot;key\&quot;: \&quot;flag-key\&quot;, \&quot;variationId\&quot;: \&quot;variation-1\&quot; }, { \&quot;key\&quot;: \&quot;another-flag\&quot;, \&quot;variationId\&quot;: \&quot;variation-2\&quot; } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;prerequisites&#x60;: a list of prerequisites #### &#x60;addRule&#x60; Adds a new rule to the flag with the given &#x60;clauses&#x60; which serves the variation indicated by &#x60;variationId&#x60; or the percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. If &#x60;beforeRuleId&#x60; is set, the rule will be added in the list of rules before the indicated rule. Otherwise, the rule will be added to the end of the list. ##### Parameters - &#x60;clauses&#x60;: Array of clauses (see &#x60;addClauses&#x60;) - &#x60;beforeRuleId&#x60;: Optional ID of a rule in the flag - &#x60;variationId&#x60;: ID of a variation of the flag - &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) - &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;removeRule&#x60; Removes the targeting rule specified by &#x60;ruleId&#x60;. Does nothing if the rule does not exist. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag #### &#x60;replaceRules&#x60; Completely replaces the existing rules for a given flag. Example: &#x60;&#x60;&#x60;json { \&quot;kind\&quot;: \&quot;replaceRules\&quot;, \&quot;rules\&quot;: [ { \&quot;variationId\&quot;: \&quot;variation-1\&quot;, \&quot;description\&quot;: \&quot;myRule\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;op\&quot;: \&quot;segmentMatch\&quot;, \&quot;values\&quot;: [\&quot;test\&quot;] } ], \&quot;trackEvents\&quot;: true } ] } &#x60;&#x60;&#x60; ##### Parameters - &#x60;rules&#x60;: a list of rules #### &#x60;addClauses&#x60; Adds the given clauses to the rule indicated by &#x60;ruleId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauses&#x60;: Array of clause objects, with &#x60;attribute&#x60; (string), &#x60;op&#x60; (string), and &#x60;values&#x60; (array of strings, numbers, or dates) properties. #### &#x60;removeClauses&#x60; Removes the clauses specified by &#x60;clauseIds&#x60; from the rule indicated by &#x60;ruleId&#x60;. #### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseIds&#x60;: Array of IDs of clauses in the rule #### &#x60;updateClause&#x60; Replaces the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60; with &#x60;clause&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseId&#x60;: ID of a clause in that rule - &#x60;clause&#x60;: Clause object #### &#x60;addValuesToClause&#x60; Adds &#x60;values&#x60; to the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;clauseId&#x60;: ID of a clause in that rule - &#x60;values&#x60;: Array of strings #### &#x60;removeValuesFromClause&#x60; Removes &#x60;values&#x60; from the values of the clause indicated by &#x60;ruleId&#x60; and &#x60;clauseId&#x60;. ##### Parameters &#x60;ruleId&#x60;: ID of a rule in the flag &#x60;clauseId&#x60;: ID of a clause in that rule &#x60;values&#x60;: Array of strings #### &#x60;reorderRules&#x60; Rearranges the rules to match the order given in &#x60;ruleIds&#x60;. Will return an error if &#x60;ruleIds&#x60; does not match the current set of rules on the flag. ##### Parameters - &#x60;ruleIds&#x60;: Array of IDs of all rules in the flag #### &#x60;updateRuleVariationOrRollout&#x60; Updates what the rule indicated by &#x60;ruleId&#x60; serves if its clauses evaluate to true. Can either be a fixed variation indicated by &#x60;variationId&#x60; or a percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. ##### Parameters - &#x60;ruleId&#x60;: ID of a rule in the flag - &#x60;variationId&#x60;: ID of a variation of the flag or - &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) - &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;updateFallthroughVariationOrRollout&#x60; Updates the flag&#39;s fallthrough, which is served if none of the targeting rules match. Can either be a fixed variation indicated by &#x60;variationId&#x60; or a percent rollout indicated by &#x60;rolloutWeights&#x60; and &#x60;rolloutBucketBy&#x60;. ##### Parameters &#x60;variationId&#x60;: ID of a variation of the flag or &#x60;rolloutWeights&#x60;: Map of variationId to weight in thousandths of a percent (0-100000) &#x60;rolloutBucketBy&#x60;: Optional user attribute #### &#x60;updateOffVariation&#x60; Updates the variation served when the flag&#39;s targeting is off to the variation indicated by &#x60;variationId&#x60;. ##### Parameters &#x60;variationId&#x60;: ID of a variation of the flag ### Example &#x60;&#x60;&#x60;json { \&quot;environmentKey\&quot;: \&quot;production\&quot;, \&quot;instructions\&quot;: [ { \&quot;kind\&quot;: \&quot;turnFlagOn\&quot; }, { \&quot;kind\&quot;: \&quot;turnFlagOff\&quot; }, { \&quot;kind\&quot;: \&quot;addUserTargets\&quot;, \&quot;variationId\&quot;: \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;, \&quot;values\&quot;: [\&quot;userId\&quot;, \&quot;userId2\&quot;] }, { \&quot;kind\&quot;: \&quot;removeUserTargets\&quot;, \&quot;variationId\&quot;: \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;, \&quot;values\&quot;: [\&quot;userId3\&quot;, \&quot;userId4\&quot;] }, { \&quot;kind\&quot;: \&quot;updateFallthroughVariationOrRollout\&quot;, \&quot;rolloutWeights\&quot;: { \&quot;variationId\&quot;: 50000, \&quot;variationId2\&quot;: 50000 }, \&quot;rolloutBucketBy\&quot;: null }, { \&quot;kind\&quot;: \&quot;addRule\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test-segment\&quot;] } ], \&quot;variationId\&quot;: null, \&quot;rolloutWeights\&quot;: { \&quot;variationId\&quot;: 50000, \&quot;variationId2\&quot;: 50000 }, \&quot;rolloutBucketBy\&quot;: \&quot;key\&quot; }, { \&quot;kind\&quot;: \&quot;removeRule\&quot;, \&quot;ruleId\&quot;: \&quot;99f12464-a429-40fc-86cc-b27612188955\&quot; }, { \&quot;kind\&quot;: \&quot;reorderRules\&quot;, \&quot;ruleIds\&quot;: [\&quot;2f72974e-de68-4243-8dd3-739582147a1f\&quot;, \&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;] }, { \&quot;kind\&quot;: \&quot;addClauses\&quot;, \&quot;ruleId\&quot;: \&quot;1134\&quot;, \&quot;clauses\&quot;: [ { \&quot;attribute\&quot;: \&quot;email\&quot;, \&quot;op\&quot;: \&quot;in\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test@test.com\&quot;] } ] }, { \&quot;kind\&quot;: \&quot;removeClauses\&quot;, \&quot;ruleId\&quot;: \&quot;1242529\&quot;, \&quot;clauseIds\&quot;: [\&quot;8bfb304e-d516-47e5-8727-e7f798e8992d\&quot;] }, { \&quot;kind\&quot;: \&quot;updateClause\&quot;, \&quot;ruleId\&quot;: \&quot;2f72974e-de68-4243-8dd3-739582147a1f\&quot;, \&quot;clauseId\&quot;: \&quot;309845\&quot;, \&quot;clause\&quot;: { \&quot;attribute\&quot;: \&quot;segmentMatch\&quot;, \&quot;negate\&quot;: false, \&quot;values\&quot;: [\&quot;test-segment\&quot;] } }, { \&quot;kind\&quot;: \&quot;updateRuleVariationOrRollout\&quot;, \&quot;ruleId\&quot;: \&quot;2342\&quot;, \&quot;rolloutWeights\&quot;: null, \&quot;rolloutBucketBy\&quot;: null }, { \&quot;kind\&quot;: \&quot;updateOffVariation\&quot;, \&quot;variationId\&quot;: \&quot;3242453\&quot; }, { \&quot;kind\&quot;: \&quot;addPrerequisite\&quot;, \&quot;variationId\&quot;: \&quot;234235\&quot;, \&quot;key\&quot;: \&quot;flagKey2\&quot; }, { \&quot;kind\&quot;: \&quot;updatePrerequisite\&quot;, \&quot;variationId\&quot;: \&quot;234235\&quot;, \&quot;key\&quot;: \&quot;flagKey2\&quot; }, { \&quot;kind\&quot;: \&quot;removePrerequisite\&quot;, \&quot;key\&quot;: \&quot;flagKey\&quot; } ] } &#x60;&#x60;&#x60; ## Using JSON Patches on a feature flag If you do not include the header described above, you can use [JSON patch](/reference#updates-via-json-patch). When using the update feature flag endpoint to add individual users to a specific variation, there are two different patch documents, depending on whether users are already being individually targeted for the variation. If a flag variation already has users individually targeted, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/environments/devint/targets/0/values/-\&quot;, \&quot;value\&quot;: \&quot;TestClient10\&quot; } &#x60;&#x60;&#x60; If a flag variation does not already have users individually targeted, the path for the JSON Patch operation is: &#x60;&#x60;&#x60;json [ { \&quot;op\&quot;: \&quot;add\&quot;, \&quot;path\&quot;: \&quot;/environments/devint/targets/-\&quot;, \&quot;value\&quot;: { \&quot;variation\&quot;: 0, \&quot;values\&quot;: [\&quot;TestClient10\&quot;] } } ] &#x60;&#x60;&#x60; ## Required approvals If a request attempts to alter a flag configuration in an environment where approvals are required for the flag, the request will fail with a 405. Changes to the flag configuration in that environment will required creating an [approval request](/tag/Approvals) or a [workflow](/tag/Workflows-(beta)). ## Conflicts If a flag configuration change made through this endpoint would cause a pending scheduled change or approval request to fail, this endpoint will return a 400. You can ignore this check by adding an &#x60;ignoreConflicts&#x60; query parameter set to &#x60;true&#x60;.
170
170
  # @param project_key The project key
171
171
  # @param feature_flag_key The feature flag key. The key identifies the flag in your code.
172
172
  # @param patch_with_comment
@@ -34,7 +34,7 @@ describe 'FeatureFlagsBetaApi' do
34
34
 
35
35
  # unit tests for get_dependent_flags
36
36
  # List dependent feature flags
37
- # List dependent flags across all environments for the flag specified in the path parameters. A dependent flag is a flag that uses another flag as a prerequisite.
37
+ # &gt; ### Flag prerequisites is an Enterprise feature &gt; &gt; Flag prerequisites is available to customers on an Enterprise plan. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/). &gt; ### This feature is in beta &gt; &gt; To use this feature, pass in a header including the &#x60;LD-API-Version&#x60; key with value set to &#x60;beta&#x60;. Use this header with each call. To learn more, read [Beta resources](/#section/Overview/Beta-resources). List dependent flags across all environments for the flag specified in the path parameters. A dependent flag is a flag that uses another flag as a prerequisite. To learn more, read [Flag prerequisites](https://docs.launchdarkly.com/home/flags/prerequisites).
38
38
  # @param project_key The project key
39
39
  # @param feature_flag_key The feature flag key
40
40
  # @param [Hash] opts the optional parameters
@@ -47,7 +47,7 @@ describe 'FeatureFlagsBetaApi' do
47
47
 
48
48
  # unit tests for get_dependent_flags_by_env
49
49
  # List dependent feature flags by environment
50
- # List dependent flags across all environments for the flag specified in the path parameters. A dependent flag is a flag that uses another flag as a prerequisite.
50
+ # &gt; ### Flag prerequisites is an Enterprise feature &gt; &gt; Flag prerequisites is available to customers on an Enterprise plan. To learn more, [read about our pricing](https://launchdarkly.com/pricing/). To upgrade your plan, [contact Sales](https://launchdarkly.com/contact-sales/). &gt; ### This feature is in beta &gt; &gt; To use this feature, pass in a header including the &#x60;LD-API-Version&#x60; key with value set to &#x60;beta&#x60;. Use this header with each call. To learn more, read [Beta resources](/#section/Overview/Beta-resources). List dependent flags across all environments for the flag specified in the path parameters. A dependent flag is a flag that uses another flag as a prerequisite. To learn more, read [Flag prerequisites](https://docs.launchdarkly.com/home/flags/prerequisites).
51
51
  # @param project_key The project key
52
52
  # @param environment_key The environment key
53
53
  # @param feature_flag_key The feature flag key
@@ -34,7 +34,7 @@ describe 'OtherApi' do
34
34
 
35
35
  # unit tests for get_ips
36
36
  # Gets the public IP list
37
- # Get a list of IP ranges the LaunchDarkly service uses. You can use this list to allow LaunchDarkly through your firewall.&lt;br /&gt;&lt;br /&gt;This endpoint returns a JSON object with two attributes: &#x60;addresses&#x60; and &#x60;outboundAddresses&#x60;. The &#x60;addresses&#x60; element contains the IP addresses LaunchDarkly&#39;s service uses. The &#x60;outboundAddresses&#x60; element contains the IP addresses outgoing webhook notifications use.&lt;br /&gt;&lt;br /&gt;We post upcoming changes to this list in advance on our [status page](https://status.launchdarkly.com/).
37
+ # Get a list of IP ranges the LaunchDarkly service uses. You can use this list to allow LaunchDarkly through your firewall.&lt;br /&gt;&lt;br /&gt;This endpoint returns a JSON object with two attributes: &#x60;addresses&#x60; and &#x60;outboundAddresses&#x60;. The &#x60;addresses&#x60; element contains the IP addresses LaunchDarkly&#39;s service uses. The &#x60;outboundAddresses&#x60; element contains the IP addresses outgoing webhook notifications use. To learn more, read [Public IP list](https://docs.launchdarkly.com/home/advanced/public-ip-list).&lt;br /&gt;&lt;br /&gt;We post upcoming changes to this list in advance on our [status page](https://status.launchdarkly.com/).
38
38
  # @param [Hash] opts the optional parameters
39
39
  # @return [IpList]
40
40
  describe 'get_ips test' do
@@ -34,7 +34,7 @@ describe 'TeamsBetaApi' do
34
34
 
35
35
  # unit tests for delete_team
36
36
  # Delete team
37
- # Delete a team by key
37
+ # Delete a team by key. To learn more, read [Deleting a team](https://docs.launchdarkly.com/home/teams/managing#deleting-a-team).
38
38
  # @param team_key The team key
39
39
  # @param [Hash] opts the optional parameters
40
40
  # @return [nil]
@@ -58,7 +58,7 @@ describe 'TeamsBetaApi' do
58
58
 
59
59
  # unit tests for get_team_maintainers
60
60
  # Get team maintainers
61
- # Fetch the maintainers that have been assigned to the team.
61
+ # Fetch the maintainers that have been assigned to the team. To learn more, read [Managing team maintainers](https://docs.launchdarkly.com/home/teams/managing#managing-team-maintainers).
62
62
  # @param team_key The team key
63
63
  # @param [Hash] opts the optional parameters
64
64
  # @option opts [Integer] :limit The number of maintainers to return in the response. Defaults to 20.
@@ -72,7 +72,7 @@ describe 'TeamsBetaApi' do
72
72
 
73
73
  # unit tests for get_team_roles
74
74
  # Get team custom roles
75
- # Fetch the custom roles that have been assigned to the team.
75
+ # Fetch the custom roles that have been assigned to the team. To learn more, read [Managing team permissions](https://docs.launchdarkly.com/home/teams/managing#managing-team-permissions).
76
76
  # @param team_key The team key
77
77
  # @param [Hash] opts the optional parameters
78
78
  # @option opts [Integer] :limit The number of roles to return in the response. Defaults to 20.
@@ -113,7 +113,7 @@ describe 'TeamsBetaApi' do
113
113
 
114
114
  # unit tests for post_team
115
115
  # Create team
116
- # Create a team
116
+ # Create a team. To learn more, read [Creating a team](https://docs.launchdarkly.com/home/teams/creating).
117
117
  # @param team_post_input
118
118
  # @param [Hash] opts the optional parameters
119
119
  # @return [Team]
@@ -124,8 +124,8 @@ describe 'TeamsBetaApi' do
124
124
  end
125
125
 
126
126
  # unit tests for post_team_members
127
- # Add members to team
128
- # Add multiple members to an existing team by uploading a CSV file of member email addresses. Your CSV file must include email addresses in the first column. You can include data in additional columns, but LaunchDarkly ignores all data outside the first column. Headers are optional. **Members are only added on a &#x60;201&#x60; response.** A &#x60;207&#x60; indicates the CSV file contains a combination of valid and invalid entries and will _not_ result in any members being added to the team. On a &#x60;207&#x60; response, if an entry contains bad user input the &#x60;message&#x60; field will contain the row number as well as the reason for the error. The &#x60;message&#x60; field will be omitted if the entry is valid. Example &#x60;207&#x60; response: &#x60;&#x60;&#x60;json { \&quot;items\&quot;: [ { \&quot;status\&quot;: \&quot;success\&quot;, \&quot;value\&quot;: \&quot;a-valid-email@launchdarkly.com\&quot; }, { \&quot;message\&quot;: \&quot;Line 2: empty row\&quot;, \&quot;status\&quot;: \&quot;error\&quot;, \&quot;value\&quot;: \&quot;\&quot; }, { \&quot;message\&quot;: \&quot;Line 3: email already exists in the specified team\&quot;, \&quot;status\&quot;: \&quot;error\&quot;, \&quot;value\&quot;: \&quot;existing-team-member@launchdarkly.com\&quot; }, { \&quot;message\&quot;: \&quot;Line 4: invalid email formatting\&quot;, \&quot;status\&quot;: \&quot;error\&quot;, \&quot;value\&quot;: \&quot;invalid email format\&quot; } ] } &#x60;&#x60;&#x60; Message | Resolution --- | --- Empty row | This line is blank. Add an email address and try again. Duplicate entry | This email address appears in the file twice. Remove the email from the file and try again. Email already exists in the specified team | This member is already on your team. Remove the email from the file and try again. Invalid formatting | This email address is not formatted correctly. Fix the formatting and try again. Email does not belong to a LaunchDarkly member | The email address doesn&#39;t belong to a LaunchDarkly account member. Invite them to LaunchDarkly, then re-add them to the team. On a &#x60;400&#x60; response, the &#x60;message&#x60; field may contain errors specific to this endpoint. Example &#x60;400&#x60; response: &#x60;&#x60;&#x60;json { \&quot;code\&quot;: \&quot;invalid_request\&quot;, \&quot;message\&quot;: \&quot;Unable to process file\&quot; } &#x60;&#x60;&#x60; Message | Resolution --- | --- Unable to process file | LaunchDarkly could not process the file for an unspecified reason. Review your file for errors and try again. File exceeds 25mb | Break up your file into multiple files of less than 25mbs each. All emails have invalid formatting | None of the email addresses in the file are in the correct format. Fix the formatting and try again. All emails belong to existing team members | All listed members are already on this team. Populate the file with member emails that do not belong to the team and try again. File is empty | The CSV file does not contain any email addresses. Populate the file and try again. No emails belong to members of your LaunchDarkly organization | None of the email addresses belong to members of your LaunchDarkly account. Invite these members to LaunchDarkly, then re-add them to the team.
127
+ # Add multiple members to team
128
+ # Add multiple members to an existing team by uploading a CSV file of member email addresses. Your CSV file must include email addresses in the first column. You can include data in additional columns, but LaunchDarkly ignores all data outside the first column. Headers are optional. To learn more, read [Managing team members](https://docs.launchdarkly.com/home/teams/managing#managing-team-members). **Members are only added on a &#x60;201&#x60; response.** A &#x60;207&#x60; indicates the CSV file contains a combination of valid and invalid entries and will _not_ result in any members being added to the team. On a &#x60;207&#x60; response, if an entry contains bad user input the &#x60;message&#x60; field will contain the row number as well as the reason for the error. The &#x60;message&#x60; field will be omitted if the entry is valid. Example &#x60;207&#x60; response: &#x60;&#x60;&#x60;json { \&quot;items\&quot;: [ { \&quot;status\&quot;: \&quot;success\&quot;, \&quot;value\&quot;: \&quot;a-valid-email@launchdarkly.com\&quot; }, { \&quot;message\&quot;: \&quot;Line 2: empty row\&quot;, \&quot;status\&quot;: \&quot;error\&quot;, \&quot;value\&quot;: \&quot;\&quot; }, { \&quot;message\&quot;: \&quot;Line 3: email already exists in the specified team\&quot;, \&quot;status\&quot;: \&quot;error\&quot;, \&quot;value\&quot;: \&quot;existing-team-member@launchdarkly.com\&quot; }, { \&quot;message\&quot;: \&quot;Line 4: invalid email formatting\&quot;, \&quot;status\&quot;: \&quot;error\&quot;, \&quot;value\&quot;: \&quot;invalid email format\&quot; } ] } &#x60;&#x60;&#x60; Message | Resolution --- | --- Empty row | This line is blank. Add an email address and try again. Duplicate entry | This email address appears in the file twice. Remove the email from the file and try again. Email already exists in the specified team | This member is already on your team. Remove the email from the file and try again. Invalid formatting | This email address is not formatted correctly. Fix the formatting and try again. Email does not belong to a LaunchDarkly member | The email address doesn&#39;t belong to a LaunchDarkly account member. Invite them to LaunchDarkly, then re-add them to the team. On a &#x60;400&#x60; response, the &#x60;message&#x60; field may contain errors specific to this endpoint. Example &#x60;400&#x60; response: &#x60;&#x60;&#x60;json { \&quot;code\&quot;: \&quot;invalid_request\&quot;, \&quot;message\&quot;: \&quot;Unable to process file\&quot; } &#x60;&#x60;&#x60; Message | Resolution --- | --- Unable to process file | LaunchDarkly could not process the file for an unspecified reason. Review your file for errors and try again. File exceeds 25mb | Break up your file into multiple files of less than 25mbs each. All emails have invalid formatting | None of the email addresses in the file are in the correct format. Fix the formatting and try again. All emails belong to existing team members | All listed members are already on this team. Populate the file with member emails that do not belong to the team and try again. File is empty | The CSV file does not contain any email addresses. Populate the file and try again. No emails belong to members of your LaunchDarkly organization | None of the email addresses belong to members of your LaunchDarkly account. Invite these members to LaunchDarkly, then re-add them to the team.
129
129
  # @param team_key The team key
130
130
  # @param [Hash] opts the optional parameters
131
131
  # @option opts [File] :file CSV file containing email addresses
@@ -88,7 +88,7 @@ describe 'UsersApi' do
88
88
  # @param [Hash] opts the optional parameters
89
89
  # @option opts [Integer] :limit The number of elements to return per page
90
90
  # @option opts [String] :search_after Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the &#x60;next&#x60; link we provide instead.
91
- # @return [Users]
91
+ # @return [UsersRep]
92
92
  describe 'get_users test' do
93
93
  it 'should work' do
94
94
  # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers