launchdarkly_api 7.0.0 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -4
  3. data/docs/AccountMembersApi.md +75 -1
  4. data/docs/CodeReferencesApi.md +5 -1
  5. data/docs/CustomRolesRep.md +24 -0
  6. data/docs/ExpandedTeamRep.md +44 -0
  7. data/docs/FeatureFlagsApi.md +1 -3
  8. data/docs/FlagTriggerInput.md +20 -0
  9. data/docs/FlagTriggersApi.md +396 -0
  10. data/docs/Integration.md +40 -0
  11. data/docs/IntegrationAuditLogSubscriptionsApi.md +376 -0
  12. data/docs/IntegrationStatusRep.md +22 -0
  13. data/docs/IntegrationSubscriptionStatusRep.md +26 -0
  14. data/docs/Integrations.md +22 -0
  15. data/docs/MemberImportItemRep.md +22 -0
  16. data/docs/MemberTeamsFormPost.md +18 -0
  17. data/docs/MetricListingRep.md +1 -1
  18. data/docs/MetricPost.md +1 -1
  19. data/docs/MetricRep.md +1 -1
  20. data/docs/MetricSeen.md +2 -2
  21. data/docs/PutBranch.md +3 -1
  22. data/docs/RecentTriggerBody.md +20 -0
  23. data/docs/Rule.md +3 -1
  24. data/docs/ScheduledChangesApi.md +1 -1
  25. data/docs/SegmentsApi.md +2 -2
  26. data/docs/SubscriptionPost.md +30 -0
  27. data/docs/TeamImportsRep.md +18 -0
  28. data/docs/TeamsBetaApi.md +84 -8
  29. data/docs/TriggerPost.md +22 -0
  30. data/docs/TriggerWorkflowCollectionRep.md +20 -0
  31. data/docs/TriggerWorkflowRep.md +42 -0
  32. data/lib/launchdarkly_api/api/account_members_api.rb +76 -2
  33. data/lib/launchdarkly_api/api/code_references_api.rb +6 -0
  34. data/lib/launchdarkly_api/api/feature_flags_api.rb +2 -5
  35. data/lib/launchdarkly_api/api/flag_triggers_api.rb +437 -0
  36. data/lib/launchdarkly_api/api/integration_audit_log_subscriptions_api.rb +377 -0
  37. data/lib/launchdarkly_api/api/scheduled_changes_api.rb +2 -2
  38. data/lib/launchdarkly_api/api/segments_api.rb +4 -4
  39. data/lib/launchdarkly_api/api/teams_beta_api.rb +77 -6
  40. data/lib/launchdarkly_api/models/custom_roles_rep.rb +247 -0
  41. data/lib/launchdarkly_api/models/expanded_team_rep.rb +349 -0
  42. data/lib/launchdarkly_api/models/flag_trigger_input.rb +230 -0
  43. data/lib/launchdarkly_api/models/integration.rb +325 -0
  44. data/lib/launchdarkly_api/models/integration_status_rep.rb +236 -0
  45. data/lib/launchdarkly_api/models/integration_subscription_status_rep.rb +256 -0
  46. data/lib/launchdarkly_api/models/integrations.rb +240 -0
  47. data/lib/launchdarkly_api/models/member_import_item_rep.rb +246 -0
  48. data/lib/launchdarkly_api/models/member_teams_form_post.rb +226 -0
  49. data/lib/launchdarkly_api/models/metric_listing_rep.rb +13 -1
  50. data/lib/launchdarkly_api/models/metric_post.rb +13 -1
  51. data/lib/launchdarkly_api/models/metric_rep.rb +13 -1
  52. data/lib/launchdarkly_api/models/metric_seen.rb +7 -7
  53. data/lib/launchdarkly_api/models/put_branch.rb +13 -4
  54. data/lib/launchdarkly_api/models/recent_trigger_body.rb +229 -0
  55. data/lib/launchdarkly_api/models/rule.rb +13 -4
  56. data/lib/launchdarkly_api/models/subscription_post.rb +293 -0
  57. data/lib/launchdarkly_api/models/team_imports_rep.rb +220 -0
  58. data/lib/launchdarkly_api/models/trigger_post.rb +245 -0
  59. data/lib/launchdarkly_api/models/trigger_workflow_collection_rep.rb +231 -0
  60. data/lib/launchdarkly_api/models/trigger_workflow_rep.rb +332 -0
  61. data/lib/launchdarkly_api/version.rb +1 -1
  62. data/lib/launchdarkly_api.rb +17 -0
  63. data/spec/api/account_members_api_spec.rb +14 -1
  64. data/spec/api/code_references_api_spec.rb +2 -0
  65. data/spec/api/feature_flags_api_spec.rb +1 -2
  66. data/spec/api/flag_triggers_api_spec.rb +110 -0
  67. data/spec/api/integration_audit_log_subscriptions_api_spec.rb +100 -0
  68. data/spec/api/scheduled_changes_api_spec.rb +1 -1
  69. data/spec/api/segments_api_spec.rb +2 -2
  70. data/spec/api/teams_beta_api_spec.rb +15 -2
  71. data/spec/models/custom_roles_rep_spec.rb +52 -0
  72. data/spec/models/expanded_team_rep_spec.rb +112 -0
  73. data/spec/models/flag_trigger_input_spec.rb +40 -0
  74. data/spec/models/integration_spec.rb +100 -0
  75. data/spec/models/integration_status_rep_spec.rb +46 -0
  76. data/spec/models/integration_subscription_status_rep_spec.rb +58 -0
  77. data/spec/models/integrations_spec.rb +46 -0
  78. data/spec/models/member_import_item_rep_spec.rb +46 -0
  79. data/spec/models/member_teams_form_post_spec.rb +34 -0
  80. data/spec/models/metric_listing_rep_spec.rb +4 -0
  81. data/spec/models/metric_post_spec.rb +4 -0
  82. data/spec/models/metric_rep_spec.rb +4 -0
  83. data/spec/models/metric_seen_spec.rb +1 -1
  84. data/spec/models/put_branch_spec.rb +6 -0
  85. data/spec/models/recent_trigger_body_spec.rb +40 -0
  86. data/spec/models/rule_spec.rb +6 -0
  87. data/spec/models/subscription_post_spec.rb +70 -0
  88. data/spec/models/team_imports_rep_spec.rb +34 -0
  89. data/spec/models/trigger_post_spec.rb +46 -0
  90. data/spec/models/trigger_workflow_collection_rep_spec.rb +40 -0
  91. data/spec/models/trigger_workflow_rep_spec.rb +106 -0
  92. metadata +70 -2
@@ -0,0 +1,377 @@
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 (for example, a single feature flag), you receive a _detailed representation_ containing all of the attributes 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. ### 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. ## 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/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: 20191212 ``` 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 the example above the version `20191212` corresponds to December 12, 2019. ### 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.
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 'cgi'
14
+
15
+ module LaunchDarklyApi
16
+ class IntegrationAuditLogSubscriptionsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create audit log subscription
23
+ # Create an audit log subscription.
24
+ # @param integration_key [String] The integration key
25
+ # @param subscription_post [SubscriptionPost]
26
+ # @param [Hash] opts the optional parameters
27
+ # @return [Integration]
28
+ def create_subscription(integration_key, subscription_post, opts = {})
29
+ data, _status_code, _headers = create_subscription_with_http_info(integration_key, subscription_post, opts)
30
+ data
31
+ end
32
+
33
+ # Create audit log subscription
34
+ # Create an audit log subscription.
35
+ # @param integration_key [String] The integration key
36
+ # @param subscription_post [SubscriptionPost]
37
+ # @param [Hash] opts the optional parameters
38
+ # @return [Array<(Integration, Integer, Hash)>] Integration data, response status code and response headers
39
+ def create_subscription_with_http_info(integration_key, subscription_post, opts = {})
40
+ if @api_client.config.debugging
41
+ @api_client.config.logger.debug 'Calling API: IntegrationAuditLogSubscriptionsApi.create_subscription ...'
42
+ end
43
+ # verify the required parameter 'integration_key' is set
44
+ if @api_client.config.client_side_validation && integration_key.nil?
45
+ fail ArgumentError, "Missing the required parameter 'integration_key' when calling IntegrationAuditLogSubscriptionsApi.create_subscription"
46
+ end
47
+ # verify the required parameter 'subscription_post' is set
48
+ if @api_client.config.client_side_validation && subscription_post.nil?
49
+ fail ArgumentError, "Missing the required parameter 'subscription_post' when calling IntegrationAuditLogSubscriptionsApi.create_subscription"
50
+ end
51
+ # resource path
52
+ local_var_path = '/api/v2/integrations/{integrationKey}'.sub('{' + 'integrationKey' + '}', CGI.escape(integration_key.to_s))
53
+
54
+ # query parameters
55
+ query_params = opts[:query_params] || {}
56
+
57
+ # header parameters
58
+ header_params = opts[:header_params] || {}
59
+ # HTTP header 'Accept' (if needed)
60
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
61
+ # HTTP header 'Content-Type'
62
+ content_type = @api_client.select_header_content_type(['application/json'])
63
+ if !content_type.nil?
64
+ header_params['Content-Type'] = content_type
65
+ end
66
+
67
+ # form parameters
68
+ form_params = opts[:form_params] || {}
69
+
70
+ # http body (model)
71
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(subscription_post)
72
+
73
+ # return_type
74
+ return_type = opts[:debug_return_type] || 'Integration'
75
+
76
+ # auth_names
77
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
78
+
79
+ new_options = opts.merge(
80
+ :operation => :"IntegrationAuditLogSubscriptionsApi.create_subscription",
81
+ :header_params => header_params,
82
+ :query_params => query_params,
83
+ :form_params => form_params,
84
+ :body => post_body,
85
+ :auth_names => auth_names,
86
+ :return_type => return_type
87
+ )
88
+
89
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
90
+ if @api_client.config.debugging
91
+ @api_client.config.logger.debug "API called: IntegrationAuditLogSubscriptionsApi#create_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
92
+ end
93
+ return data, status_code, headers
94
+ end
95
+
96
+ # Delete audit log subscription
97
+ # Delete an audit log subscription.
98
+ # @param integration_key [String] The integration key
99
+ # @param id [String] The subscription ID
100
+ # @param [Hash] opts the optional parameters
101
+ # @return [nil]
102
+ def delete_subscription(integration_key, id, opts = {})
103
+ delete_subscription_with_http_info(integration_key, id, opts)
104
+ nil
105
+ end
106
+
107
+ # Delete audit log subscription
108
+ # Delete an audit log subscription.
109
+ # @param integration_key [String] The integration key
110
+ # @param id [String] The subscription ID
111
+ # @param [Hash] opts the optional parameters
112
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
113
+ def delete_subscription_with_http_info(integration_key, id, opts = {})
114
+ if @api_client.config.debugging
115
+ @api_client.config.logger.debug 'Calling API: IntegrationAuditLogSubscriptionsApi.delete_subscription ...'
116
+ end
117
+ # verify the required parameter 'integration_key' is set
118
+ if @api_client.config.client_side_validation && integration_key.nil?
119
+ fail ArgumentError, "Missing the required parameter 'integration_key' when calling IntegrationAuditLogSubscriptionsApi.delete_subscription"
120
+ end
121
+ # verify the required parameter 'id' is set
122
+ if @api_client.config.client_side_validation && id.nil?
123
+ fail ArgumentError, "Missing the required parameter 'id' when calling IntegrationAuditLogSubscriptionsApi.delete_subscription"
124
+ end
125
+ # resource path
126
+ local_var_path = '/api/v2/integrations/{integrationKey}/{id}'.sub('{' + 'integrationKey' + '}', CGI.escape(integration_key.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
127
+
128
+ # query parameters
129
+ query_params = opts[:query_params] || {}
130
+
131
+ # header parameters
132
+ header_params = opts[:header_params] || {}
133
+ # HTTP header 'Accept' (if needed)
134
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
135
+
136
+ # form parameters
137
+ form_params = opts[:form_params] || {}
138
+
139
+ # http body (model)
140
+ post_body = opts[:debug_body]
141
+
142
+ # return_type
143
+ return_type = opts[:debug_return_type]
144
+
145
+ # auth_names
146
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
147
+
148
+ new_options = opts.merge(
149
+ :operation => :"IntegrationAuditLogSubscriptionsApi.delete_subscription",
150
+ :header_params => header_params,
151
+ :query_params => query_params,
152
+ :form_params => form_params,
153
+ :body => post_body,
154
+ :auth_names => auth_names,
155
+ :return_type => return_type
156
+ )
157
+
158
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
159
+ if @api_client.config.debugging
160
+ @api_client.config.logger.debug "API called: IntegrationAuditLogSubscriptionsApi#delete_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
161
+ end
162
+ return data, status_code, headers
163
+ end
164
+
165
+ # Get audit log subscription by ID
166
+ # Get an audit log subscription by ID.
167
+ # @param integration_key [String] The integration key
168
+ # @param id [String] The subscription ID
169
+ # @param [Hash] opts the optional parameters
170
+ # @return [Integration]
171
+ def get_subscription_by_id(integration_key, id, opts = {})
172
+ data, _status_code, _headers = get_subscription_by_id_with_http_info(integration_key, id, opts)
173
+ data
174
+ end
175
+
176
+ # Get audit log subscription by ID
177
+ # Get an audit log subscription by ID.
178
+ # @param integration_key [String] The integration key
179
+ # @param id [String] The subscription ID
180
+ # @param [Hash] opts the optional parameters
181
+ # @return [Array<(Integration, Integer, Hash)>] Integration data, response status code and response headers
182
+ def get_subscription_by_id_with_http_info(integration_key, id, opts = {})
183
+ if @api_client.config.debugging
184
+ @api_client.config.logger.debug 'Calling API: IntegrationAuditLogSubscriptionsApi.get_subscription_by_id ...'
185
+ end
186
+ # verify the required parameter 'integration_key' is set
187
+ if @api_client.config.client_side_validation && integration_key.nil?
188
+ fail ArgumentError, "Missing the required parameter 'integration_key' when calling IntegrationAuditLogSubscriptionsApi.get_subscription_by_id"
189
+ end
190
+ # verify the required parameter 'id' is set
191
+ if @api_client.config.client_side_validation && id.nil?
192
+ fail ArgumentError, "Missing the required parameter 'id' when calling IntegrationAuditLogSubscriptionsApi.get_subscription_by_id"
193
+ end
194
+ # resource path
195
+ local_var_path = '/api/v2/integrations/{integrationKey}/{id}'.sub('{' + 'integrationKey' + '}', CGI.escape(integration_key.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
196
+
197
+ # query parameters
198
+ query_params = opts[:query_params] || {}
199
+
200
+ # header parameters
201
+ header_params = opts[:header_params] || {}
202
+ # HTTP header 'Accept' (if needed)
203
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
204
+
205
+ # form parameters
206
+ form_params = opts[:form_params] || {}
207
+
208
+ # http body (model)
209
+ post_body = opts[:debug_body]
210
+
211
+ # return_type
212
+ return_type = opts[:debug_return_type] || 'Integration'
213
+
214
+ # auth_names
215
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
216
+
217
+ new_options = opts.merge(
218
+ :operation => :"IntegrationAuditLogSubscriptionsApi.get_subscription_by_id",
219
+ :header_params => header_params,
220
+ :query_params => query_params,
221
+ :form_params => form_params,
222
+ :body => post_body,
223
+ :auth_names => auth_names,
224
+ :return_type => return_type
225
+ )
226
+
227
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
228
+ if @api_client.config.debugging
229
+ @api_client.config.logger.debug "API called: IntegrationAuditLogSubscriptionsApi#get_subscription_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
230
+ end
231
+ return data, status_code, headers
232
+ end
233
+
234
+ # Get audit log subscriptions by integration
235
+ # Get all audit log subscriptions associated with a given integration.
236
+ # @param integration_key [String] The integration key
237
+ # @param [Hash] opts the optional parameters
238
+ # @return [Integrations]
239
+ def get_subscriptions(integration_key, opts = {})
240
+ data, _status_code, _headers = get_subscriptions_with_http_info(integration_key, opts)
241
+ data
242
+ end
243
+
244
+ # Get audit log subscriptions by integration
245
+ # Get all audit log subscriptions associated with a given integration.
246
+ # @param integration_key [String] The integration key
247
+ # @param [Hash] opts the optional parameters
248
+ # @return [Array<(Integrations, Integer, Hash)>] Integrations data, response status code and response headers
249
+ def get_subscriptions_with_http_info(integration_key, opts = {})
250
+ if @api_client.config.debugging
251
+ @api_client.config.logger.debug 'Calling API: IntegrationAuditLogSubscriptionsApi.get_subscriptions ...'
252
+ end
253
+ # verify the required parameter 'integration_key' is set
254
+ if @api_client.config.client_side_validation && integration_key.nil?
255
+ fail ArgumentError, "Missing the required parameter 'integration_key' when calling IntegrationAuditLogSubscriptionsApi.get_subscriptions"
256
+ end
257
+ # resource path
258
+ local_var_path = '/api/v2/integrations/{integrationKey}'.sub('{' + 'integrationKey' + '}', CGI.escape(integration_key.to_s))
259
+
260
+ # query parameters
261
+ query_params = opts[:query_params] || {}
262
+
263
+ # header parameters
264
+ header_params = opts[:header_params] || {}
265
+ # HTTP header 'Accept' (if needed)
266
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
267
+
268
+ # form parameters
269
+ form_params = opts[:form_params] || {}
270
+
271
+ # http body (model)
272
+ post_body = opts[:debug_body]
273
+
274
+ # return_type
275
+ return_type = opts[:debug_return_type] || 'Integrations'
276
+
277
+ # auth_names
278
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
279
+
280
+ new_options = opts.merge(
281
+ :operation => :"IntegrationAuditLogSubscriptionsApi.get_subscriptions",
282
+ :header_params => header_params,
283
+ :query_params => query_params,
284
+ :form_params => form_params,
285
+ :body => post_body,
286
+ :auth_names => auth_names,
287
+ :return_type => return_type
288
+ )
289
+
290
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
291
+ if @api_client.config.debugging
292
+ @api_client.config.logger.debug "API called: IntegrationAuditLogSubscriptionsApi#get_subscriptions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
293
+ end
294
+ return data, status_code, headers
295
+ end
296
+
297
+ # Update audit log subscription
298
+ # Update an audit log subscription configuration. Requires a [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes to the audit log subscription.
299
+ # @param integration_key [String] The integration key
300
+ # @param id [String] The ID of the audit log subscription
301
+ # @param patch_operation [Array<PatchOperation>]
302
+ # @param [Hash] opts the optional parameters
303
+ # @return [Integration]
304
+ def update_subscription(integration_key, id, patch_operation, opts = {})
305
+ data, _status_code, _headers = update_subscription_with_http_info(integration_key, id, patch_operation, opts)
306
+ data
307
+ end
308
+
309
+ # Update audit log subscription
310
+ # Update an audit log subscription configuration. Requires a [JSON Patch](https://datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes to the audit log subscription.
311
+ # @param integration_key [String] The integration key
312
+ # @param id [String] The ID of the audit log subscription
313
+ # @param patch_operation [Array<PatchOperation>]
314
+ # @param [Hash] opts the optional parameters
315
+ # @return [Array<(Integration, Integer, Hash)>] Integration data, response status code and response headers
316
+ def update_subscription_with_http_info(integration_key, id, patch_operation, opts = {})
317
+ if @api_client.config.debugging
318
+ @api_client.config.logger.debug 'Calling API: IntegrationAuditLogSubscriptionsApi.update_subscription ...'
319
+ end
320
+ # verify the required parameter 'integration_key' is set
321
+ if @api_client.config.client_side_validation && integration_key.nil?
322
+ fail ArgumentError, "Missing the required parameter 'integration_key' when calling IntegrationAuditLogSubscriptionsApi.update_subscription"
323
+ end
324
+ # verify the required parameter 'id' is set
325
+ if @api_client.config.client_side_validation && id.nil?
326
+ fail ArgumentError, "Missing the required parameter 'id' when calling IntegrationAuditLogSubscriptionsApi.update_subscription"
327
+ end
328
+ # verify the required parameter 'patch_operation' is set
329
+ if @api_client.config.client_side_validation && patch_operation.nil?
330
+ fail ArgumentError, "Missing the required parameter 'patch_operation' when calling IntegrationAuditLogSubscriptionsApi.update_subscription"
331
+ end
332
+ # resource path
333
+ local_var_path = '/api/v2/integrations/{integrationKey}/{id}'.sub('{' + 'integrationKey' + '}', CGI.escape(integration_key.to_s)).sub('{' + 'id' + '}', CGI.escape(id.to_s))
334
+
335
+ # query parameters
336
+ query_params = opts[:query_params] || {}
337
+
338
+ # header parameters
339
+ header_params = opts[:header_params] || {}
340
+ # HTTP header 'Accept' (if needed)
341
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
342
+ # HTTP header 'Content-Type'
343
+ content_type = @api_client.select_header_content_type(['application/json'])
344
+ if !content_type.nil?
345
+ header_params['Content-Type'] = content_type
346
+ end
347
+
348
+ # form parameters
349
+ form_params = opts[:form_params] || {}
350
+
351
+ # http body (model)
352
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(patch_operation)
353
+
354
+ # return_type
355
+ return_type = opts[:debug_return_type] || 'Integration'
356
+
357
+ # auth_names
358
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
359
+
360
+ new_options = opts.merge(
361
+ :operation => :"IntegrationAuditLogSubscriptionsApi.update_subscription",
362
+ :header_params => header_params,
363
+ :query_params => query_params,
364
+ :form_params => form_params,
365
+ :body => post_body,
366
+ :auth_names => auth_names,
367
+ :return_type => return_type
368
+ )
369
+
370
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
371
+ if @api_client.config.debugging
372
+ @api_client.config.logger.debug "API called: IntegrationAuditLogSubscriptionsApi#update_subscription\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
373
+ end
374
+ return data, status_code, headers
375
+ end
376
+ end
377
+ end
@@ -257,7 +257,7 @@ module LaunchDarklyApi
257
257
  end
258
258
 
259
259
  # Update scheduled changes workflow
260
- # Update a scheduled change, overriding existing instructions with the new ones.<br /><br />Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/#section/Updates/Updates-via-semantic-patches)
260
+ # Update a scheduled change, overriding existing instructions with the new ones.<br /><br />Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/reference#updates-via-semantic-patches).
261
261
  # @param project_key [String] The project key
262
262
  # @param feature_flag_key [String] The feature flag&#39;s key
263
263
  # @param environment_key [String] The environment key
@@ -272,7 +272,7 @@ module LaunchDarklyApi
272
272
  end
273
273
 
274
274
  # Update scheduled changes workflow
275
- # Update a scheduled change, overriding existing instructions with the new ones.&lt;br /&gt;&lt;br /&gt;Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/#section/Updates/Updates-via-semantic-patches)
275
+ # Update a scheduled change, overriding existing instructions with the new ones.&lt;br /&gt;&lt;br /&gt;Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/reference#updates-via-semantic-patches).
276
276
  # @param project_key [String] The project key
277
277
  # @param feature_flag_key [String] The feature flag&#39;s key
278
278
  # @param environment_key [String] The environment key
@@ -395,7 +395,7 @@ module LaunchDarklyApi
395
395
  end
396
396
 
397
397
  # Update expiring user targets for segment
398
- # Update the list of a segment's user targets that are scheduled for removal<br /><br />Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/#section/Updates/Updates-via-semantic-patches).<br /><br />If the request is well-formed but any of its instructions failed to process, this operation returns status code `200`. In this case, the response `errors` array will be non-empty.
398
+ # Update the list of a segment's user targets that are scheduled for removal<br /><br />Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/reference#updates-via-semantic-patches).<br /><br />If the request is well-formed but any of its instructions failed to process, this operation returns status code `200`. In this case, the response `errors` array will be non-empty.
399
399
  # @param proj_key [String] The project key.
400
400
  # @param env_key [String] The environment key.
401
401
  # @param segment_key [String] The user segment key.
@@ -408,7 +408,7 @@ module LaunchDarklyApi
408
408
  end
409
409
 
410
410
  # Update expiring user targets for segment
411
- # Update the list of a segment&#39;s user targets that are scheduled for removal&lt;br /&gt;&lt;br /&gt;Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/#section/Updates/Updates-via-semantic-patches).&lt;br /&gt;&lt;br /&gt;If the request is well-formed but any of its instructions failed to process, this operation returns status code &#x60;200&#x60;. In this case, the response &#x60;errors&#x60; array will be non-empty.
411
+ # Update the list of a segment&#39;s user targets that are scheduled for removal&lt;br /&gt;&lt;br /&gt;Requires a semantic patch representation of the desired changes to the resource. To learn more about semantic patches, read [Updates](/reference#updates-via-semantic-patches).&lt;br /&gt;&lt;br /&gt;If the request is well-formed but any of its instructions failed to process, this operation returns status code &#x60;200&#x60;. In this case, the response &#x60;errors&#x60; array will be non-empty.
412
412
  # @param proj_key [String] The project key.
413
413
  # @param env_key [String] The environment key.
414
414
  # @param segment_key [String] The user segment key.
@@ -481,7 +481,7 @@ module LaunchDarklyApi
481
481
  end
482
482
 
483
483
  # Patch segment
484
- # Update a user segment. The request body must be a valid JSON patch or JSON merge patch document. To learn more about semantic patches, read [Updates](/#section/Updates).
484
+ # Update a user segment. The request body must be a valid JSON patch or JSON merge patch document. To learn more about semantic patches, read [Updates](/#section/Overview/Updates).
485
485
  # @param proj_key [String] The project key.
486
486
  # @param env_key [String] The environment key.
487
487
  # @param key [String] The user segment key.
@@ -494,7 +494,7 @@ module LaunchDarklyApi
494
494
  end
495
495
 
496
496
  # Patch segment
497
- # Update a user segment. The request body must be a valid JSON patch or JSON merge patch document. To learn more about semantic patches, read [Updates](/#section/Updates).
497
+ # Update a user segment. The request body must be a valid JSON patch or JSON merge patch document. To learn more about semantic patches, read [Updates](/#section/Overview/Updates).
498
498
  # @param proj_key [String] The project key.
499
499
  # @param env_key [String] The environment key.
500
500
  # @param key [String] The user segment key.
@@ -86,7 +86,7 @@ module LaunchDarklyApi
86
86
  # Fetch a team by key
87
87
  # @param key [String] The team key
88
88
  # @param [Hash] opts the optional parameters
89
- # @return [TeamRep]
89
+ # @return [ExpandedTeamRep]
90
90
  def get_team(key, opts = {})
91
91
  data, _status_code, _headers = get_team_with_http_info(key, opts)
92
92
  data
@@ -96,7 +96,7 @@ module LaunchDarklyApi
96
96
  # Fetch a team by key
97
97
  # @param key [String] The team key
98
98
  # @param [Hash] opts the optional parameters
99
- # @return [Array<(TeamRep, Integer, Hash)>] TeamRep data, response status code and response headers
99
+ # @return [Array<(ExpandedTeamRep, Integer, Hash)>] ExpandedTeamRep data, response status code and response headers
100
100
  def get_team_with_http_info(key, opts = {})
101
101
  if @api_client.config.debugging
102
102
  @api_client.config.logger.debug 'Calling API: TeamsBetaApi.get_team ...'
@@ -123,7 +123,7 @@ module LaunchDarklyApi
123
123
  post_body = opts[:debug_body]
124
124
 
125
125
  # return_type
126
- return_type = opts[:debug_return_type] || 'TeamRep'
126
+ return_type = opts[:debug_return_type] || 'ExpandedTeamRep'
127
127
 
128
128
  # auth_names
129
129
  auth_names = opts[:debug_auth_names] || ['ApiKey']
@@ -216,7 +216,7 @@ module LaunchDarklyApi
216
216
  # @param key [String] The team key
217
217
  # @param team_patch_input [TeamPatchInput]
218
218
  # @param [Hash] opts the optional parameters
219
- # @return [TeamCollectionRep]
219
+ # @return [ExpandedTeamRep]
220
220
  def patch_team(key, team_patch_input, opts = {})
221
221
  data, _status_code, _headers = patch_team_with_http_info(key, team_patch_input, opts)
222
222
  data
@@ -227,7 +227,7 @@ module LaunchDarklyApi
227
227
  # @param key [String] The team key
228
228
  # @param team_patch_input [TeamPatchInput]
229
229
  # @param [Hash] opts the optional parameters
230
- # @return [Array<(TeamCollectionRep, Integer, Hash)>] TeamCollectionRep data, response status code and response headers
230
+ # @return [Array<(ExpandedTeamRep, Integer, Hash)>] ExpandedTeamRep data, response status code and response headers
231
231
  def patch_team_with_http_info(key, team_patch_input, opts = {})
232
232
  if @api_client.config.debugging
233
233
  @api_client.config.logger.debug 'Calling API: TeamsBetaApi.patch_team ...'
@@ -263,7 +263,7 @@ module LaunchDarklyApi
263
263
  post_body = opts[:debug_body] || @api_client.object_to_http_body(team_patch_input)
264
264
 
265
265
  # return_type
266
- return_type = opts[:debug_return_type] || 'TeamCollectionRep'
266
+ return_type = opts[:debug_return_type] || 'ExpandedTeamRep'
267
267
 
268
268
  # auth_names
269
269
  auth_names = opts[:debug_auth_names] || ['ApiKey']
@@ -352,5 +352,76 @@ module LaunchDarklyApi
352
352
  end
353
353
  return data, status_code, headers
354
354
  end
355
+
356
+ # Add members to team
357
+ # 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 `201` response.** A `207` 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 `207` response, if an entry contains bad user input the `message` field will contain the row number as well as the reason for the error. The `message` field will be omitted if the entry is valid. Example `207` response: ```json { \"items\": [ { \"status\": \"success\", \"value\": \"a-valid-email@launchdarkly.com\" }, { \"message\": \"Line 2: empty row\", \"status\": \"error\", \"value\": \"\" }, { \"message\": \"Line 3: email already exists in the specified team\", \"status\": \"error\", \"value\": \"existing-team-member@launchdarkly.com\" }, { \"message\": \"Line 4: invalid email formatting\", \"status\": \"error\", \"value\": \"invalid email format\" } ] } ``` 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't belong to a LaunchDarkly account member. Invite them to LaunchDarkly, then re-add them to the team. On a `400` response, the `message` field may contain errors specific to this endpoint. Example `400` response: ```json { \"code\": \"invalid_request\", \"message\": \"Unable to process file\" } ``` 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.
358
+ # @param key [String] The team key
359
+ # @param [Hash] opts the optional parameters
360
+ # @option opts [File] :file CSV file containing email addresses
361
+ # @return [TeamImportsRep]
362
+ def post_team_members(key, opts = {})
363
+ data, _status_code, _headers = post_team_members_with_http_info(key, opts)
364
+ data
365
+ end
366
+
367
+ # Add members to team
368
+ # 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.
369
+ # @param key [String] The team key
370
+ # @param [Hash] opts the optional parameters
371
+ # @option opts [File] :file CSV file containing email addresses
372
+ # @return [Array<(TeamImportsRep, Integer, Hash)>] TeamImportsRep data, response status code and response headers
373
+ def post_team_members_with_http_info(key, opts = {})
374
+ if @api_client.config.debugging
375
+ @api_client.config.logger.debug 'Calling API: TeamsBetaApi.post_team_members ...'
376
+ end
377
+ # verify the required parameter 'key' is set
378
+ if @api_client.config.client_side_validation && key.nil?
379
+ fail ArgumentError, "Missing the required parameter 'key' when calling TeamsBetaApi.post_team_members"
380
+ end
381
+ # resource path
382
+ local_var_path = '/api/v2/teams/{key}/members'.sub('{' + 'key' + '}', CGI.escape(key.to_s))
383
+
384
+ # query parameters
385
+ query_params = opts[:query_params] || {}
386
+
387
+ # header parameters
388
+ header_params = opts[:header_params] || {}
389
+ # HTTP header 'Accept' (if needed)
390
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
391
+ # HTTP header 'Content-Type'
392
+ content_type = @api_client.select_header_content_type(['multipart/form-data'])
393
+ if !content_type.nil?
394
+ header_params['Content-Type'] = content_type
395
+ end
396
+
397
+ # form parameters
398
+ form_params = opts[:form_params] || {}
399
+ form_params['file'] = opts[:'file'] if !opts[:'file'].nil?
400
+
401
+ # http body (model)
402
+ post_body = opts[:debug_body]
403
+
404
+ # return_type
405
+ return_type = opts[:debug_return_type] || 'TeamImportsRep'
406
+
407
+ # auth_names
408
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
409
+
410
+ new_options = opts.merge(
411
+ :operation => :"TeamsBetaApi.post_team_members",
412
+ :header_params => header_params,
413
+ :query_params => query_params,
414
+ :form_params => form_params,
415
+ :body => post_body,
416
+ :auth_names => auth_names,
417
+ :return_type => return_type
418
+ )
419
+
420
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
421
+ if @api_client.config.debugging
422
+ @api_client.config.logger.debug "API called: TeamsBetaApi#post_team_members\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
423
+ end
424
+ return data, status_code, headers
425
+ end
355
426
  end
356
427
  end