Package com.launchdarkly.api.api
Class SegmentsApi
- java.lang.Object
-
- com.launchdarkly.api.api.SegmentsApi
-
public class SegmentsApi extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description SegmentsApi()SegmentsApi(ApiClient apiClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateBigSegmentExport(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Create big segment export Starts a new export process for a big segment.okhttp3.CallcreateBigSegmentExportAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback<java.lang.Void> _callback)Create big segment export (asynchronously) Starts a new export process for a big segment.okhttp3.CallcreateBigSegmentExportCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback _callback)Build call for createBigSegmentExportApiResponse<java.lang.Void>createBigSegmentExportWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Create big segment export Starts a new export process for a big segment.voidcreateBigSegmentImport(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.io.File _file, java.lang.String mode, java.lang.Boolean waitOnApprovals)Create big segment import Start a new import process for a big segment.okhttp3.CallcreateBigSegmentImportAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.io.File _file, java.lang.String mode, java.lang.Boolean waitOnApprovals, ApiCallback<java.lang.Void> _callback)Create big segment import (asynchronously) Start a new import process for a big segment.okhttp3.CallcreateBigSegmentImportCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.io.File _file, java.lang.String mode, java.lang.Boolean waitOnApprovals, ApiCallback _callback)Build call for createBigSegmentImportApiResponse<java.lang.Void>createBigSegmentImportWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.io.File _file, java.lang.String mode, java.lang.Boolean waitOnApprovals)Create big segment import Start a new import process for a big segment.voiddeleteSegment(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Delete segment Delete a segment.okhttp3.CalldeleteSegmentAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback<java.lang.Void> _callback)Delete segment (asynchronously) Delete a segment.okhttp3.CalldeleteSegmentCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback _callback)Build call for deleteSegmentApiResponse<java.lang.Void>deleteSegmentWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Delete segment Delete a segment.ApiClientgetApiClient()ExportgetBigSegmentExport(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String exportID)Get big segment export Returns information about a big segment export process.okhttp3.CallgetBigSegmentExportAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String exportID, ApiCallback<Export> _callback)Get big segment export (asynchronously) Returns information about a big segment export process.okhttp3.CallgetBigSegmentExportCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String exportID, ApiCallback _callback)Build call for getBigSegmentExportApiResponse<Export>getBigSegmentExportWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String exportID)Get big segment export Returns information about a big segment export process.ModelImportgetBigSegmentImport(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String importID)Get big segment import Returns information about a big segment import process.okhttp3.CallgetBigSegmentImportAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String importID, ApiCallback<ModelImport> _callback)Get big segment import (asynchronously) Returns information about a big segment import process.okhttp3.CallgetBigSegmentImportCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String importID, ApiCallback _callback)Build call for getBigSegmentImportApiResponse<ModelImport>getBigSegmentImportWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String importID)Get big segment import Returns information about a big segment import process.ContextInstanceSegmentMembershipsgetContextInstanceSegmentsMembershipByEnv(java.lang.String projectKey, java.lang.String environmentKey, java.util.Map<java.lang.String,java.lang.Object> requestBody)List segment memberships for context instance For a given context instance with attributes, get membership details for all segments.okhttp3.CallgetContextInstanceSegmentsMembershipByEnvAsync(java.lang.String projectKey, java.lang.String environmentKey, java.util.Map<java.lang.String,java.lang.Object> requestBody, ApiCallback<ContextInstanceSegmentMemberships> _callback)List segment memberships for context instance (asynchronously) For a given context instance with attributes, get membership details for all segments.okhttp3.CallgetContextInstanceSegmentsMembershipByEnvCall(java.lang.String projectKey, java.lang.String environmentKey, java.util.Map<java.lang.String,java.lang.Object> requestBody, ApiCallback _callback)Build call for getContextInstanceSegmentsMembershipByEnvApiResponse<ContextInstanceSegmentMemberships>getContextInstanceSegmentsMembershipByEnvWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.util.Map<java.lang.String,java.lang.Object> requestBody)List segment memberships for context instance For a given context instance with attributes, get membership details for all segments.java.lang.StringgetCustomBaseUrl()ExpiringTargetGetResponsegetExpiringTargetsForSegment(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Get expiring targets for segment Get a list of a segment's context targets that are scheduled for removal.okhttp3.CallgetExpiringTargetsForSegmentAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback<ExpiringTargetGetResponse> _callback)Get expiring targets for segment (asynchronously) Get a list of a segment's context targets that are scheduled for removal.okhttp3.CallgetExpiringTargetsForSegmentCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback _callback)Build call for getExpiringTargetsForSegmentApiResponse<ExpiringTargetGetResponse>getExpiringTargetsForSegmentWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Get expiring targets for segment Get a list of a segment's context targets that are scheduled for removal.ExpiringUserTargetGetResponsegetExpiringUserTargetsForSegment(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Get expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint.okhttp3.CallgetExpiringUserTargetsForSegmentAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback<ExpiringUserTargetGetResponse> _callback)Get expiring user targets for segment (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint.okhttp3.CallgetExpiringUserTargetsForSegmentCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback _callback)Build call for getExpiringUserTargetsForSegmentApiResponse<ExpiringUserTargetGetResponse>getExpiringUserTargetsForSegmentWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Get expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint.intgetHostIndex()UserSegmentgetSegment(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Get segment Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced.okhttp3.CallgetSegmentAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback<UserSegment> _callback)Get segment (asynchronously) Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced.okhttp3.CallgetSegmentCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, ApiCallback _callback)Build call for getSegmentBigSegmentTargetgetSegmentMembershipForContext(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String contextKey)Get big segment membership for context Get the membership status (included/excluded) for a given context in this big segment.okhttp3.CallgetSegmentMembershipForContextAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String contextKey, ApiCallback<BigSegmentTarget> _callback)Get big segment membership for context (asynchronously) Get the membership status (included/excluded) for a given context in this big segment.okhttp3.CallgetSegmentMembershipForContextCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String contextKey, ApiCallback _callback)Build call for getSegmentMembershipForContextApiResponse<BigSegmentTarget>getSegmentMembershipForContextWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String contextKey)Get big segment membership for context Get the membership status (included/excluded) for a given context in this big segment.BigSegmentTargetgetSegmentMembershipForUser(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String userKey)Get big segment membership for user > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint.okhttp3.CallgetSegmentMembershipForUserAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String userKey, ApiCallback<BigSegmentTarget> _callback)Get big segment membership for user (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint.okhttp3.CallgetSegmentMembershipForUserCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String userKey, ApiCallback _callback)Build call for getSegmentMembershipForUserApiResponse<BigSegmentTarget>getSegmentMembershipForUserWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, java.lang.String userKey)Get big segment membership for user > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint.UserSegmentsgetSegments(java.lang.String projectKey, java.lang.String environmentKey, java.lang.Long limit, java.lang.Long offset, java.lang.String sort, java.lang.String filter)List segments Get a list of all segments in the given project.okhttp3.CallgetSegmentsAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.Long limit, java.lang.Long offset, java.lang.String sort, java.lang.String filter, ApiCallback<UserSegments> _callback)List segments (asynchronously) Get a list of all segments in the given project.okhttp3.CallgetSegmentsCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.Long limit, java.lang.Long offset, java.lang.String sort, java.lang.String filter, ApiCallback _callback)Build call for getSegmentsApiResponse<UserSegments>getSegmentsWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.Long limit, java.lang.Long offset, java.lang.String sort, java.lang.String filter)List segments Get a list of all segments in the given project.ApiResponse<UserSegment>getSegmentWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey)Get segment Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced.ExpiringTargetPatchResponsepatchExpiringTargetsForSegment(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchSegmentExpiringTargetInputRep patchSegmentExpiringTargetInputRep)Update expiring targets for segment Update expiring context targets for a segment.okhttp3.CallpatchExpiringTargetsForSegmentAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchSegmentExpiringTargetInputRep patchSegmentExpiringTargetInputRep, ApiCallback<ExpiringTargetPatchResponse> _callback)Update expiring targets for segment (asynchronously) Update expiring context targets for a segment.okhttp3.CallpatchExpiringTargetsForSegmentCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchSegmentExpiringTargetInputRep patchSegmentExpiringTargetInputRep, ApiCallback _callback)Build call for patchExpiringTargetsForSegmentApiResponse<ExpiringTargetPatchResponse>patchExpiringTargetsForSegmentWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchSegmentExpiringTargetInputRep patchSegmentExpiringTargetInputRep)Update expiring targets for segment Update expiring context targets for a segment.ExpiringUserTargetPatchResponsepatchExpiringUserTargetsForSegment(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchSegmentRequest patchSegmentRequest)Update expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint.okhttp3.CallpatchExpiringUserTargetsForSegmentAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchSegmentRequest patchSegmentRequest, ApiCallback<ExpiringUserTargetPatchResponse> _callback)Update expiring user targets for segment (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint.okhttp3.CallpatchExpiringUserTargetsForSegmentCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchSegmentRequest patchSegmentRequest, ApiCallback _callback)Build call for patchExpiringUserTargetsForSegmentApiResponse<ExpiringUserTargetPatchResponse>patchExpiringUserTargetsForSegmentWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchSegmentRequest patchSegmentRequest)Update expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint.UserSegmentpatchSegment(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchWithComment patchWithComment, java.lang.Boolean dryRun)Patch segment Update a segment.okhttp3.CallpatchSegmentAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchWithComment patchWithComment, java.lang.Boolean dryRun, ApiCallback<UserSegment> _callback)Patch segment (asynchronously) Update a segment.okhttp3.CallpatchSegmentCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchWithComment patchWithComment, java.lang.Boolean dryRun, ApiCallback _callback)Build call for patchSegmentApiResponse<UserSegment>patchSegmentWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, PatchWithComment patchWithComment, java.lang.Boolean dryRun)Patch segment Update a segment.UserSegmentpostSegment(java.lang.String projectKey, java.lang.String environmentKey, SegmentBody segmentBody)Create segment Create a new segment.okhttp3.CallpostSegmentAsync(java.lang.String projectKey, java.lang.String environmentKey, SegmentBody segmentBody, ApiCallback<UserSegment> _callback)Create segment (asynchronously) Create a new segment.okhttp3.CallpostSegmentCall(java.lang.String projectKey, java.lang.String environmentKey, SegmentBody segmentBody, ApiCallback _callback)Build call for postSegmentApiResponse<UserSegment>postSegmentWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, SegmentBody segmentBody)Create segment Create a new segment.voidsetApiClient(ApiClient apiClient)voidsetCustomBaseUrl(java.lang.String customBaseUrl)voidsetHostIndex(int hostIndex)voidupdateBigSegmentContextTargets(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, SegmentUserState segmentUserState)Update context targets on a big segment Update context targets included or excluded in a big segment.okhttp3.CallupdateBigSegmentContextTargetsAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, SegmentUserState segmentUserState, ApiCallback<java.lang.Void> _callback)Update context targets on a big segment (asynchronously) Update context targets included or excluded in a big segment.okhttp3.CallupdateBigSegmentContextTargetsCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, SegmentUserState segmentUserState, ApiCallback _callback)Build call for updateBigSegmentContextTargetsApiResponse<java.lang.Void>updateBigSegmentContextTargetsWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, SegmentUserState segmentUserState)Update context targets on a big segment Update context targets included or excluded in a big segment.voidupdateBigSegmentTargets(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, SegmentUserState segmentUserState)Update user context targets on a big segment Update user context targets included or excluded in a big segment.okhttp3.CallupdateBigSegmentTargetsAsync(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, SegmentUserState segmentUserState, ApiCallback<java.lang.Void> _callback)Update user context targets on a big segment (asynchronously) Update user context targets included or excluded in a big segment.okhttp3.CallupdateBigSegmentTargetsCall(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, SegmentUserState segmentUserState, ApiCallback _callback)Build call for updateBigSegmentTargetsApiResponse<java.lang.Void>updateBigSegmentTargetsWithHttpInfo(java.lang.String projectKey, java.lang.String environmentKey, java.lang.String segmentKey, SegmentUserState segmentUserState)Update user context targets on a big segment Update user context targets included or excluded in a big segment.
-
-
-
Constructor Detail
-
SegmentsApi
public SegmentsApi()
-
SegmentsApi
public SegmentsApi(ApiClient apiClient)
-
-
Method Detail
-
getApiClient
public ApiClient getApiClient()
-
setApiClient
public void setApiClient(ApiClient apiClient)
-
getHostIndex
public int getHostIndex()
-
setHostIndex
public void setHostIndex(int hostIndex)
-
getCustomBaseUrl
public java.lang.String getCustomBaseUrl()
-
setCustomBaseUrl
public void setCustomBaseUrl(java.lang.String customBaseUrl)
-
createBigSegmentExportCall
public okhttp3.Call createBigSegmentExportCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback _callback) throws ApiExceptionBuild call for createBigSegmentExport- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
createBigSegmentExport
public void createBigSegmentExport(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiExceptionCreate big segment export Starts a new export process for a big segment. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
createBigSegmentExportWithHttpInfo
public ApiResponse<java.lang.Void> createBigSegmentExportWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiException
Create big segment export Starts a new export process for a big segment. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Returns:
- ApiResponse<Void>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
createBigSegmentExportAsync
public okhttp3.Call createBigSegmentExportAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback<java.lang.Void> _callback) throws ApiExceptionCreate big segment export (asynchronously) Starts a new export process for a big segment. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
createBigSegmentImportCall
public okhttp3.Call createBigSegmentImportCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nullable java.io.File _file, @Nullable java.lang.String mode, @Nullable java.lang.Boolean waitOnApprovals, ApiCallback _callback) throws ApiExceptionBuild call for createBigSegmentImport- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_file- CSV file containing keys (optional)mode- Import mode. Use either `merge` or `replace` (optional)waitOnApprovals- Whether to wait for approvals before processing the import (optional)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
createBigSegmentImport
public void createBigSegmentImport(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nullable java.io.File _file, @Nullable java.lang.String mode, @Nullable java.lang.Boolean waitOnApprovals) throws ApiExceptionCreate big segment import Start a new import process for a big segment. This is an import for a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_file- CSV file containing keys (optional)mode- Import mode. Use either `merge` or `replace` (optional)waitOnApprovals- Whether to wait for approvals before processing the import (optional)- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
createBigSegmentImportWithHttpInfo
public ApiResponse<java.lang.Void> createBigSegmentImportWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nullable java.io.File _file, @Nullable java.lang.String mode, @Nullable java.lang.Boolean waitOnApprovals) throws ApiException
Create big segment import Start a new import process for a big segment. This is an import for a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_file- CSV file containing keys (optional)mode- Import mode. Use either `merge` or `replace` (optional)waitOnApprovals- Whether to wait for approvals before processing the import (optional)- Returns:
- ApiResponse<Void>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
createBigSegmentImportAsync
public okhttp3.Call createBigSegmentImportAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nullable java.io.File _file, @Nullable java.lang.String mode, @Nullable java.lang.Boolean waitOnApprovals, ApiCallback<java.lang.Void> _callback) throws ApiExceptionCreate big segment import (asynchronously) Start a new import process for a big segment. This is an import for a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_file- CSV file containing keys (optional)mode- Import mode. Use either `merge` or `replace` (optional)waitOnApprovals- Whether to wait for approvals before processing the import (optional)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
deleteSegmentCall
public okhttp3.Call deleteSegmentCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback _callback) throws ApiExceptionBuild call for deleteSegment- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
deleteSegment
public void deleteSegment(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiExceptionDelete segment Delete a segment.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
deleteSegmentWithHttpInfo
public ApiResponse<java.lang.Void> deleteSegmentWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiException
Delete segment Delete a segment.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Returns:
- ApiResponse<Void>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
deleteSegmentAsync
public okhttp3.Call deleteSegmentAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback<java.lang.Void> _callback) throws ApiExceptionDelete segment (asynchronously) Delete a segment.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getBigSegmentExportCall
public okhttp3.Call getBigSegmentExportCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String exportID, ApiCallback _callback) throws ApiExceptionBuild call for getBigSegmentExport- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)exportID- The export ID (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getBigSegmentExport
public Export getBigSegmentExport(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String exportID) throws ApiException
Get big segment export Returns information about a big segment export process. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)exportID- The export ID (required)- Returns:
- Export
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getBigSegmentExportWithHttpInfo
public ApiResponse<Export> getBigSegmentExportWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String exportID) throws ApiException
Get big segment export Returns information about a big segment export process. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)exportID- The export ID (required)- Returns:
- ApiResponse<Export>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getBigSegmentExportAsync
public okhttp3.Call getBigSegmentExportAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String exportID, ApiCallback<Export> _callback) throws ApiExceptionGet big segment export (asynchronously) Returns information about a big segment export process. This is an export for a synced segment or a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)exportID- The export ID (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getBigSegmentImportCall
public okhttp3.Call getBigSegmentImportCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String importID, ApiCallback _callback) throws ApiExceptionBuild call for getBigSegmentImport- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)importID- The import ID (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getBigSegmentImport
public ModelImport getBigSegmentImport(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String importID) throws ApiException
Get big segment import Returns information about a big segment import process. This is the import of a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)importID- The import ID (required)- Returns:
- ModelImport
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getBigSegmentImportWithHttpInfo
public ApiResponse<ModelImport> getBigSegmentImportWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String importID) throws ApiException
Get big segment import Returns information about a big segment import process. This is the import of a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)importID- The import ID (required)- Returns:
- ApiResponse<ModelImport>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getBigSegmentImportAsync
public okhttp3.Call getBigSegmentImportAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String importID, ApiCallback<ModelImport> _callback) throws ApiExceptionGet big segment import (asynchronously) Returns information about a big segment import process. This is the import of a list-based segment that can include more than 15,000 entries.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)importID- The import ID (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getContextInstanceSegmentsMembershipByEnvCall
public okhttp3.Call getContextInstanceSegmentsMembershipByEnvCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.util.Map<java.lang.String,java.lang.Object> requestBody, ApiCallback _callback) throws ApiExceptionBuild call for getContextInstanceSegmentsMembershipByEnv- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)requestBody- (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getContextInstanceSegmentsMembershipByEnv
public ContextInstanceSegmentMemberships getContextInstanceSegmentsMembershipByEnv(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.util.Map<java.lang.String,java.lang.Object> requestBody) throws ApiException
List segment memberships for context instance For a given context instance with attributes, get membership details for all segments. In the request body, pass in the context instance.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)requestBody- (required)- Returns:
- ContextInstanceSegmentMemberships
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getContextInstanceSegmentsMembershipByEnvWithHttpInfo
public ApiResponse<ContextInstanceSegmentMemberships> getContextInstanceSegmentsMembershipByEnvWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.util.Map<java.lang.String,java.lang.Object> requestBody) throws ApiException
List segment memberships for context instance For a given context instance with attributes, get membership details for all segments. In the request body, pass in the context instance.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)requestBody- (required)- Returns:
- ApiResponse<ContextInstanceSegmentMemberships>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getContextInstanceSegmentsMembershipByEnvAsync
public okhttp3.Call getContextInstanceSegmentsMembershipByEnvAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.util.Map<java.lang.String,java.lang.Object> requestBody, ApiCallback<ContextInstanceSegmentMemberships> _callback) throws ApiExceptionList segment memberships for context instance (asynchronously) For a given context instance with attributes, get membership details for all segments. In the request body, pass in the context instance.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)requestBody- (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getExpiringTargetsForSegmentCall
public okhttp3.Call getExpiringTargetsForSegmentCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback _callback) throws ApiExceptionBuild call for getExpiringTargetsForSegment- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getExpiringTargetsForSegment
public ExpiringTargetGetResponse getExpiringTargetsForSegment(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiException
Get expiring targets for segment Get a list of a segment's context targets that are scheduled for removal.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Returns:
- ExpiringTargetGetResponse
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getExpiringTargetsForSegmentWithHttpInfo
public ApiResponse<ExpiringTargetGetResponse> getExpiringTargetsForSegmentWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiException
Get expiring targets for segment Get a list of a segment's context targets that are scheduled for removal.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Returns:
- ApiResponse<ExpiringTargetGetResponse>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getExpiringTargetsForSegmentAsync
public okhttp3.Call getExpiringTargetsForSegmentAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback<ExpiringTargetGetResponse> _callback) throws ApiExceptionGet expiring targets for segment (asynchronously) Get a list of a segment's context targets that are scheduled for removal.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getExpiringUserTargetsForSegmentCall
public okhttp3.Call getExpiringUserTargetsForSegmentCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback _callback) throws ApiExceptionBuild call for getExpiringUserTargetsForSegment- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getExpiringUserTargetsForSegment
public ExpiringUserTargetGetResponse getExpiringUserTargetsForSegment(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiException
Get expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Get a list of a segment's user targets that are scheduled for removal.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Returns:
- ExpiringUserTargetGetResponse
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getExpiringUserTargetsForSegmentWithHttpInfo
public ApiResponse<ExpiringUserTargetGetResponse> getExpiringUserTargetsForSegmentWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiException
Get expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Get a list of a segment's user targets that are scheduled for removal.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Returns:
- ApiResponse<ExpiringUserTargetGetResponse>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getExpiringUserTargetsForSegmentAsync
public okhttp3.Call getExpiringUserTargetsForSegmentAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback<ExpiringUserTargetGetResponse> _callback) throws ApiExceptionGet expiring user targets for segment (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Get a list of a segment's user targets that are scheduled for removal.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getSegmentCall
public okhttp3.Call getSegmentCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback _callback) throws ApiExceptionBuild call for getSegment- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getSegment
public UserSegment getSegment(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiException
Get segment Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Returns:
- UserSegment
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getSegmentWithHttpInfo
public ApiResponse<UserSegment> getSegmentWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey) throws ApiException
Get segment Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)- Returns:
- ApiResponse<UserSegment>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getSegmentAsync
public okhttp3.Call getSegmentAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, ApiCallback<UserSegment> _callback) throws ApiExceptionGet segment (asynchronously) Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getSegmentMembershipForContextCall
public okhttp3.Call getSegmentMembershipForContextCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String contextKey, ApiCallback _callback) throws ApiExceptionBuild call for getSegmentMembershipForContext- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)contextKey- The context key (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getSegmentMembershipForContext
public BigSegmentTarget getSegmentMembershipForContext(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String contextKey) throws ApiException
Get big segment membership for context Get the membership status (included/excluded) for a given context in this big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)contextKey- The context key (required)- Returns:
- BigSegmentTarget
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getSegmentMembershipForContextWithHttpInfo
public ApiResponse<BigSegmentTarget> getSegmentMembershipForContextWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String contextKey) throws ApiException
Get big segment membership for context Get the membership status (included/excluded) for a given context in this big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)contextKey- The context key (required)- Returns:
- ApiResponse<BigSegmentTarget>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getSegmentMembershipForContextAsync
public okhttp3.Call getSegmentMembershipForContextAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String contextKey, ApiCallback<BigSegmentTarget> _callback) throws ApiExceptionGet big segment membership for context (asynchronously) Get the membership status (included/excluded) for a given context in this big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)contextKey- The context key (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getSegmentMembershipForUserCall
public okhttp3.Call getSegmentMembershipForUserCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String userKey, ApiCallback _callback) throws ApiExceptionBuild call for getSegmentMembershipForUser- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)userKey- The user key (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getSegmentMembershipForUser
public BigSegmentTarget getSegmentMembershipForUser(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String userKey) throws ApiException
Get big segment membership for user > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Get the membership status (included/excluded) for a given user in this big segment. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)userKey- The user key (required)- Returns:
- BigSegmentTarget
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getSegmentMembershipForUserWithHttpInfo
public ApiResponse<BigSegmentTarget> getSegmentMembershipForUserWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String userKey) throws ApiException
Get big segment membership for user > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Get the membership status (included/excluded) for a given user in this big segment. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)userKey- The user key (required)- Returns:
- ApiResponse<BigSegmentTarget>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getSegmentMembershipForUserAsync
public okhttp3.Call getSegmentMembershipForUserAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull java.lang.String userKey, ApiCallback<BigSegmentTarget> _callback) throws ApiExceptionGet big segment membership for user (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Get expiring targets for segment](https://launchdarkly.com/docs/api/segments/get-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Get the membership status (included/excluded) for a given user in this big segment. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)userKey- The user key (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
getSegmentsCall
public okhttp3.Call getSegmentsCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nullable java.lang.Long limit, @Nullable java.lang.Long offset, @Nullable java.lang.String sort, @Nullable java.lang.String filter, ApiCallback _callback) throws ApiExceptionBuild call for getSegments- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)limit- The number of segments to return. Defaults to 20. (optional)offset- Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)sort- Accepts sorting order and fields. Fields can be comma separated. Possible fields are 'creationDate', 'name', 'lastModified'. Example: `sort=name` sort by names ascending or `sort=-name,creationDate` sort by names descending and creationDate ascending. (optional)filter- Accepts filter by `excludedKeys`, `external`, `includedKeys`, `query`, `tags`, `unbounded`, `view`. To learn more about the filter syntax, read the 'Filtering segments' section above. (optional)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
getSegments
public UserSegments getSegments(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nullable java.lang.Long limit, @Nullable java.lang.Long offset, @Nullable java.lang.String sort, @Nullable java.lang.String filter) throws ApiException
List segments Get a list of all segments in the given project. Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments. ### Filtering segments The `filter` parameter supports the following operators: `equals`, `anyOf`, and `exists`. You can also combine filters in the following ways: - Use a comma (`,`) as an AND operator - Use a vertical bar (`|`) as an OR operator - Use parentheses (`()`) to group filters #### Supported fields and operators You can only filter certain fields in segments when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for segments, the `filter` parameter supports the following fields and operators: |<div style=\"width:120px\">Field</div> |Description |Supported operators | |---|---|---| | `excludedKeys` | The segment keys of segments to exclude from the results. | `anyOf` | | `external` | Whether the segment is a synced segment. | `exists` | | `includedKeys` | The segment keys of segments to include in the results. | `anyOf` | | `query` | A \"fuzzy\" search across segment key, name, and description. Supply a string or list of strings to the operator. | `equals` | | `tags` | The segment tags. | `anyOf` | | `unbounded` | Whether the segment is a standard segment (`false`) or a big segment (`true`). Standard segments include rule-based segments and smaller list-based segments. Big segments include larger list-based segments and synced segments. | `equals` | Here are a few examples: * The filter `?filter=tags anyOf [\"enterprise\", \"beta\"],query equals \"toggle\"` matches segments with \"toggle\" in their key, name, or description that also have \"enterprise\" or \"beta\" as a tag. * The filter `?filter=excludedKeys anyOf [\"segmentKey1\", \"segmentKey2\"]` excludes the segments with those keys from the results. * The filter `?filter=unbounded equals true` matches larger list-based segments and synced segments. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags anyOf [\"enterprise\", \"beta\"]` must be encoded to `%5B`.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)limit- The number of segments to return. Defaults to 20. (optional)offset- Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)sort- Accepts sorting order and fields. Fields can be comma separated. Possible fields are 'creationDate', 'name', 'lastModified'. Example: `sort=name` sort by names ascending or `sort=-name,creationDate` sort by names descending and creationDate ascending. (optional)filter- Accepts filter by `excludedKeys`, `external`, `includedKeys`, `query`, `tags`, `unbounded`, `view`. To learn more about the filter syntax, read the 'Filtering segments' section above. (optional)- Returns:
- UserSegments
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getSegmentsWithHttpInfo
public ApiResponse<UserSegments> getSegmentsWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nullable java.lang.Long limit, @Nullable java.lang.Long offset, @Nullable java.lang.String sort, @Nullable java.lang.String filter) throws ApiException
List segments Get a list of all segments in the given project. Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments. ### Filtering segments The `filter` parameter supports the following operators: `equals`, `anyOf`, and `exists`. You can also combine filters in the following ways: - Use a comma (`,`) as an AND operator - Use a vertical bar (`|`) as an OR operator - Use parentheses (`()`) to group filters #### Supported fields and operators You can only filter certain fields in segments when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for segments, the `filter` parameter supports the following fields and operators: |<div style=\"width:120px\">Field</div> |Description |Supported operators | |---|---|---| | `excludedKeys` | The segment keys of segments to exclude from the results. | `anyOf` | | `external` | Whether the segment is a synced segment. | `exists` | | `includedKeys` | The segment keys of segments to include in the results. | `anyOf` | | `query` | A \"fuzzy\" search across segment key, name, and description. Supply a string or list of strings to the operator. | `equals` | | `tags` | The segment tags. | `anyOf` | | `unbounded` | Whether the segment is a standard segment (`false`) or a big segment (`true`). Standard segments include rule-based segments and smaller list-based segments. Big segments include larger list-based segments and synced segments. | `equals` | Here are a few examples: * The filter `?filter=tags anyOf [\"enterprise\", \"beta\"],query equals \"toggle\"` matches segments with \"toggle\" in their key, name, or description that also have \"enterprise\" or \"beta\" as a tag. * The filter `?filter=excludedKeys anyOf [\"segmentKey1\", \"segmentKey2\"]` excludes the segments with those keys from the results. * The filter `?filter=unbounded equals true` matches larger list-based segments and synced segments. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags anyOf [\"enterprise\", \"beta\"]` must be encoded to `%5B`.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)limit- The number of segments to return. Defaults to 20. (optional)offset- Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)sort- Accepts sorting order and fields. Fields can be comma separated. Possible fields are 'creationDate', 'name', 'lastModified'. Example: `sort=name` sort by names ascending or `sort=-name,creationDate` sort by names descending and creationDate ascending. (optional)filter- Accepts filter by `excludedKeys`, `external`, `includedKeys`, `query`, `tags`, `unbounded`, `view`. To learn more about the filter syntax, read the 'Filtering segments' section above. (optional)- Returns:
- ApiResponse<UserSegments>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
getSegmentsAsync
public okhttp3.Call getSegmentsAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nullable java.lang.Long limit, @Nullable java.lang.Long offset, @Nullable java.lang.String sort, @Nullable java.lang.String filter, ApiCallback<UserSegments> _callback) throws ApiExceptionList segments (asynchronously) Get a list of all segments in the given project. Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments. ### Filtering segments The `filter` parameter supports the following operators: `equals`, `anyOf`, and `exists`. You can also combine filters in the following ways: - Use a comma (`,`) as an AND operator - Use a vertical bar (`|`) as an OR operator - Use parentheses (`()`) to group filters #### Supported fields and operators You can only filter certain fields in segments when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for segments, the `filter` parameter supports the following fields and operators: |<div style=\"width:120px\">Field</div> |Description |Supported operators | |---|---|---| | `excludedKeys` | The segment keys of segments to exclude from the results. | `anyOf` | | `external` | Whether the segment is a synced segment. | `exists` | | `includedKeys` | The segment keys of segments to include in the results. | `anyOf` | | `query` | A \"fuzzy\" search across segment key, name, and description. Supply a string or list of strings to the operator. | `equals` | | `tags` | The segment tags. | `anyOf` | | `unbounded` | Whether the segment is a standard segment (`false`) or a big segment (`true`). Standard segments include rule-based segments and smaller list-based segments. Big segments include larger list-based segments and synced segments. | `equals` | Here are a few examples: * The filter `?filter=tags anyOf [\"enterprise\", \"beta\"],query equals \"toggle\"` matches segments with \"toggle\" in their key, name, or description that also have \"enterprise\" or \"beta\" as a tag. * The filter `?filter=excludedKeys anyOf [\"segmentKey1\", \"segmentKey2\"]` excludes the segments with those keys from the results. * The filter `?filter=unbounded equals true` matches larger list-based segments and synced segments. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags anyOf [\"enterprise\", \"beta\"]` must be encoded to `%5B`.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)limit- The number of segments to return. Defaults to 20. (optional)offset- Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. (optional)sort- Accepts sorting order and fields. Fields can be comma separated. Possible fields are 'creationDate', 'name', 'lastModified'. Example: `sort=name` sort by names ascending or `sort=-name,creationDate` sort by names descending and creationDate ascending. (optional)filter- Accepts filter by `excludedKeys`, `external`, `includedKeys`, `query`, `tags`, `unbounded`, `view`. To learn more about the filter syntax, read the 'Filtering segments' section above. (optional)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
patchExpiringTargetsForSegmentCall
public okhttp3.Call patchExpiringTargetsForSegmentCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchSegmentExpiringTargetInputRep patchSegmentExpiringTargetInputRep, ApiCallback _callback) throws ApiExceptionBuild call for patchExpiringTargetsForSegment- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchSegmentExpiringTargetInputRep- (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
patchExpiringTargetsForSegment
public ExpiringTargetPatchResponse patchExpiringTargetsForSegment(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchSegmentExpiringTargetInputRep patchSegmentExpiringTargetInputRep) throws ApiException
Update expiring targets for segment Update expiring context targets for a segment. Updating a context target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring context targets. <details> <summary>Click to expand instructions for <strong>updating expiring context targets</strong></summary> #### addExpiringTarget Schedules a date and time when LaunchDarkly will remove a context from segment targeting. The segment must already have the context as an individual target. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The date when the context should expire from the segment targeting, in Unix milliseconds. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754092860000 }] } ``` #### updateExpiringTarget Updates the date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The new date when the context should expire from the segment targeting, in Unix milliseconds. - `version`: (Optional) The version of the expiring target to update. If included, update will fail if version doesn't match current version of the expiring target. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754179260000 }] } ``` #### removeExpiringTarget Removes the scheduled expiration for the context in the segment. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", }] } ``` </details>- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchSegmentExpiringTargetInputRep- (required)- Returns:
- ExpiringTargetPatchResponse
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
patchExpiringTargetsForSegmentWithHttpInfo
public ApiResponse<ExpiringTargetPatchResponse> patchExpiringTargetsForSegmentWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchSegmentExpiringTargetInputRep patchSegmentExpiringTargetInputRep) throws ApiException
Update expiring targets for segment Update expiring context targets for a segment. Updating a context target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring context targets. <details> <summary>Click to expand instructions for <strong>updating expiring context targets</strong></summary> #### addExpiringTarget Schedules a date and time when LaunchDarkly will remove a context from segment targeting. The segment must already have the context as an individual target. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The date when the context should expire from the segment targeting, in Unix milliseconds. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754092860000 }] } ``` #### updateExpiringTarget Updates the date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The new date when the context should expire from the segment targeting, in Unix milliseconds. - `version`: (Optional) The version of the expiring target to update. If included, update will fail if version doesn't match current version of the expiring target. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754179260000 }] } ``` #### removeExpiringTarget Removes the scheduled expiration for the context in the segment. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", }] } ``` </details>- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchSegmentExpiringTargetInputRep- (required)- Returns:
- ApiResponse<ExpiringTargetPatchResponse>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
patchExpiringTargetsForSegmentAsync
public okhttp3.Call patchExpiringTargetsForSegmentAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchSegmentExpiringTargetInputRep patchSegmentExpiringTargetInputRep, ApiCallback<ExpiringTargetPatchResponse> _callback) throws ApiExceptionUpdate expiring targets for segment (asynchronously) Update expiring context targets for a segment. Updating a context target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring context targets. <details> <summary>Click to expand instructions for <strong>updating expiring context targets</strong></summary> #### addExpiringTarget Schedules a date and time when LaunchDarkly will remove a context from segment targeting. The segment must already have the context as an individual target. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The date when the context should expire from the segment targeting, in Unix milliseconds. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754092860000 }] } ``` #### updateExpiringTarget Updates the date and time when LaunchDarkly will remove a context from segment targeting. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. - `value`: The new date when the context should expire from the segment targeting, in Unix milliseconds. - `version`: (Optional) The version of the expiring target to update. If included, update will fail if version doesn't match current version of the expiring target. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", \"value\": 1754179260000 }] } ``` #### removeExpiringTarget Removes the scheduled expiration for the context in the segment. ##### Parameters - `targetType`: The type of individual target for this context. Must be either `included` or `excluded`. - `contextKey`: The context key. - `contextKind`: The kind of context being targeted. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExpiringTarget\", \"targetType\": \"included\", \"contextKey\": \"user-key-123abc\", \"contextKind\": \"user\", }] } ``` </details>- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchSegmentExpiringTargetInputRep- (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
patchExpiringUserTargetsForSegmentCall
public okhttp3.Call patchExpiringUserTargetsForSegmentCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchSegmentRequest patchSegmentRequest, ApiCallback _callback) throws ApiExceptionBuild call for patchExpiringUserTargetsForSegment- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchSegmentRequest- (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
patchExpiringUserTargetsForSegment
public ExpiringUserTargetPatchResponse patchExpiringUserTargetsForSegment(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchSegmentRequest patchSegmentRequest) throws ApiException
Update expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Update expiring user targets for a segment. Updating a user target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring user targets. <details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary> #### addExpireUserTargetDate Schedules a date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The date when the user should expire from the segment targeting, in Unix milliseconds. #### updateExpireUserTargetDate Updates the date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The new date when the user should expire from the segment targeting, in Unix milliseconds. - `version`: The segment version. #### removeExpireUserTargetDate Removes the scheduled expiration for the user in the segment. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. </details>- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchSegmentRequest- (required)- Returns:
- ExpiringUserTargetPatchResponse
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
patchExpiringUserTargetsForSegmentWithHttpInfo
public ApiResponse<ExpiringUserTargetPatchResponse> patchExpiringUserTargetsForSegmentWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchSegmentRequest patchSegmentRequest) throws ApiException
Update expiring user targets for segment > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Update expiring user targets for a segment. Updating a user target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring user targets. <details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary> #### addExpireUserTargetDate Schedules a date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The date when the user should expire from the segment targeting, in Unix milliseconds. #### updateExpireUserTargetDate Updates the date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The new date when the user should expire from the segment targeting, in Unix milliseconds. - `version`: The segment version. #### removeExpireUserTargetDate Removes the scheduled expiration for the user in the segment. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. </details>- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchSegmentRequest- (required)- Returns:
- ApiResponse<ExpiringUserTargetPatchResponse>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
patchExpiringUserTargetsForSegmentAsync
public okhttp3.Call patchExpiringUserTargetsForSegmentAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchSegmentRequest patchSegmentRequest, ApiCallback<ExpiringUserTargetPatchResponse> _callback) throws ApiExceptionUpdate expiring user targets for segment (asynchronously) > ### Contexts are now available > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use [Update expiring targets for segment](https://launchdarkly.com/docs/api/segments/patch-expiring-targets-for-segment) instead of this endpoint. To learn more, read [Contexts](https://launchdarkly.com/docs/home/observability/contexts). Update expiring user targets for a segment. Updating a user target expiration uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). 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. ### Instructions Semantic patch requests support the following `kind` instructions for updating expiring user targets. <details> <summary>Click to expand instructions for <strong>updating expiring user targets</strong></summary> #### addExpireUserTargetDate Schedules a date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The date when the user should expire from the segment targeting, in Unix milliseconds. #### updateExpireUserTargetDate Updates the date and time when LaunchDarkly will remove a user from segment targeting. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. - `value`: The new date when the user should expire from the segment targeting, in Unix milliseconds. - `version`: The segment version. #### removeExpireUserTargetDate Removes the scheduled expiration for the user in the segment. ##### Parameters - `targetType`: A segment's target type, must be either `included` or `excluded`. - `userKey`: The user key. </details>- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchSegmentRequest- (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
patchSegmentCall
public okhttp3.Call patchSegmentCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchWithComment patchWithComment, @Nullable java.lang.Boolean dryRun, ApiCallback _callback) throws ApiExceptionBuild call for patchSegment- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchWithComment- (required)dryRun- If true, the patch will be validated but not persisted. Returns a preview of the segment after the patch is applied. (optional)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
patchSegment
public UserSegment patchSegment(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchWithComment patchWithComment, @Nullable java.lang.Boolean dryRun) throws ApiException
Patch segment Update a segment. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read [Updates](https://launchdarkly.com/docs/api#updates). ### Using semantic patches on a segment To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). The body of a semantic patch request for updating segments requires an `environmentKey` in addition to `instructions` and an optional `comment`. The body of the request takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. ### Instructions Semantic patch requests support the following `kind` instructions for updating segments. <details> <summary>Click to expand instructions for <strong>updating segment details and settings</strong></summary> #### addTags Adds tags to the segment. ##### Parameters - `values`: A list of tags to add. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addTags\", \"values\": [\"tag1\", \"tag2\"] }] } ``` #### removeTags Removes tags from the segment. ##### Parameters - `values`: A list of tags to remove. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeTags\", \"values\": [\"tag1\", \"tag2\"] }] } ``` #### updateName Updates the name of the segment. ##### Parameters - `value`: Name of the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateName\", \"value\": \"Updated segment name\" }] } ``` </details> <details> <summary>Click to expand instructions for <strong>updating segment individual targets</strong></summary> #### addExcludedTargets Adds context keys to the individual context targets excluded from the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExcludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addExcludedUsers Adds user keys to the individual user targets excluded from the segment. Returns an error if this causes the same user key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. If you are working with contexts, use `addExcludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExcludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### addIncludedTargets Adds context keys to the individual context targets included in the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addIncludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addIncludedUsers Adds user keys to the individual user targets included in the segment. Returns an error if this causes the same user key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. If you are working with contexts, use `addIncludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addIncludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### removeExcludedTargets Removes context keys from the individual context targets excluded from the segment for the specified `contextKind`. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExcludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeExcludedUsers Removes user keys from the individual user targets excluded from the segment. If you are working with contexts, use `removeExcludedTargets` instead of this instruction. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExcludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### removeIncludedTargets Removes context keys from the individual context targets included in the segment for the specified `contextKind`. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeIncludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeIncludedUsers Removes user keys from the individual user targets included in the segment. If you are working with contexts, use `removeIncludedTargets` instead of this instruction. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeIncludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` </details> <details> <summary>Click to expand instructions for <strong>updating segment targeting rules</strong></summary> #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `ruleId`: ID of a rule in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addClauses\", \"clauses\": [ { \"attribute\": \"email\", \"negate\": false, \"op\": \"contains\", \"values\": [\"value1\"] } ], \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", }] } ``` #### addRule Adds a new targeting rule to the segment. The rule may contain `clauses`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `description`: A description of the rule. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addRule\", \"clauses\": [ { \"attribute\": \"email\", \"op\": \"contains\", \"negate\": false, \"values\": [\"@launchdarkly.com\"] } ], \"description\": \"Targeting rule for LaunchDarkly employees\", }] } ``` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addValuesToClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseIds`: Array of IDs of clauses in the rule. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseIds\": [\"10a58772-3121-400f-846b-b8a04e8944ed\", \"36a461dc-235e-4b08-97b9-73ce9365873e\"] }] } ``` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeRule\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeValuesFromClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules in the segment. ##### Parameters - `ruleIds`: Array of IDs of all targeting rules in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleIds\": [\"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"63c238d1-835d-435e-8f21-c8d5e40b2a3d\"] }] } ``` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10c7462a-2062-45ba-a8bb-dfb3de0f8af5\", \"clause\": { \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"Mexico\", \"Canada\"] } }] } ``` #### updateRuleDescription Updates the description of the segment targeting rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateRuleDescription\", \"description\": \"New rule description\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### updateRuleRolloutAndContextKind For a rule that includes a percentage of targets, updates the percentage and the context kind of the targets to include. ##### Parameters - `ruleId`: The ID of a targeting rule in the segment that includes a percentage of targets. - `weight`: The weight, in thousandths of a percent (0-100000). - `contextKind`: The context kind. Here's an example: ```json { \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"weight\": \"20000\", \"contextKind\": \"device\" }] } ``` </details> <details> <summary>Click to expand instructions for <strong>working with Big Segments</strong></summary> A \"big segment\" is a segment that is either a synced segment, or a list-based segment with more than 15,000 entries that includes only one targeted context kind. LaunchDarkly uses different implementations for different types of segments so that all of your segments have good performance. The following semantic patch instructions apply only to these [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments). #### addBigSegmentExcludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets excluded from the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addBigSegmentExcludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addBigSegmentIncludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets included in the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addBigSegmentIncludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### processBigSegmentImport For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Processes a segment import. ##### Parameters - `importId`: The ID of the import. The import ID is returned in the `Location` header as part of the [Create big segment import](https://launchdarkly.com/docs/api/segments/create-big-segment-import) request. Here's an example: ```json { \"instructions\": [{ \"kind\": \"processBigSegmentImport\", \"importId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### removeBigSegmentExcludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets excluded from the segment. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeBigSegmentExcludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeBigSegmentIncludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets included in the segment. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeBigSegmentIncludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` </details> ### Using JSON patches on a segment If you do not include the header described above, you can use a [JSON patch](https://launchdarkly.com/docs/api#updates-using-json-patch) or [JSON merge patch](https://datatracker.ietf.org/doc/html/rfc7386) representation of the desired changes. For example, to update the description for a segment with a JSON patch, use the following request body: ```json { \"patch\": [ { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"new description\" } ] } ``` To update fields in the segment that are arrays, set the `path` to the name of the field and then append `/<array index>`. Use `/0` to add the new entry to the beginning of the array. Use `/-` to add the new entry to the end of the array. For example, to add a rule to a segment, use the following request body: ```json { \"patch\":[ { \"op\": \"add\", \"path\": \"/rules/0\", \"value\": { \"clauses\": [{ \"contextKind\": \"user\", \"attribute\": \"email\", \"op\": \"endsWith\", \"values\": [\".edu\"], \"negate\": false }] } } ] } ``` To add or remove targets from segments, we recommend using semantic patch. Semantic patch for segments includes specific instructions for adding and removing both included and excluded targets.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchWithComment- (required)dryRun- If true, the patch will be validated but not persisted. Returns a preview of the segment after the patch is applied. (optional)- Returns:
- UserSegment
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
patchSegmentWithHttpInfo
public ApiResponse<UserSegment> patchSegmentWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchWithComment patchWithComment, @Nullable java.lang.Boolean dryRun) throws ApiException
Patch segment Update a segment. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read [Updates](https://launchdarkly.com/docs/api#updates). ### Using semantic patches on a segment To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). The body of a semantic patch request for updating segments requires an `environmentKey` in addition to `instructions` and an optional `comment`. The body of the request takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. ### Instructions Semantic patch requests support the following `kind` instructions for updating segments. <details> <summary>Click to expand instructions for <strong>updating segment details and settings</strong></summary> #### addTags Adds tags to the segment. ##### Parameters - `values`: A list of tags to add. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addTags\", \"values\": [\"tag1\", \"tag2\"] }] } ``` #### removeTags Removes tags from the segment. ##### Parameters - `values`: A list of tags to remove. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeTags\", \"values\": [\"tag1\", \"tag2\"] }] } ``` #### updateName Updates the name of the segment. ##### Parameters - `value`: Name of the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateName\", \"value\": \"Updated segment name\" }] } ``` </details> <details> <summary>Click to expand instructions for <strong>updating segment individual targets</strong></summary> #### addExcludedTargets Adds context keys to the individual context targets excluded from the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExcludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addExcludedUsers Adds user keys to the individual user targets excluded from the segment. Returns an error if this causes the same user key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. If you are working with contexts, use `addExcludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExcludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### addIncludedTargets Adds context keys to the individual context targets included in the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addIncludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addIncludedUsers Adds user keys to the individual user targets included in the segment. Returns an error if this causes the same user key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. If you are working with contexts, use `addIncludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addIncludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### removeExcludedTargets Removes context keys from the individual context targets excluded from the segment for the specified `contextKind`. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExcludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeExcludedUsers Removes user keys from the individual user targets excluded from the segment. If you are working with contexts, use `removeExcludedTargets` instead of this instruction. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExcludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### removeIncludedTargets Removes context keys from the individual context targets included in the segment for the specified `contextKind`. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeIncludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeIncludedUsers Removes user keys from the individual user targets included in the segment. If you are working with contexts, use `removeIncludedTargets` instead of this instruction. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeIncludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` </details> <details> <summary>Click to expand instructions for <strong>updating segment targeting rules</strong></summary> #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `ruleId`: ID of a rule in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addClauses\", \"clauses\": [ { \"attribute\": \"email\", \"negate\": false, \"op\": \"contains\", \"values\": [\"value1\"] } ], \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", }] } ``` #### addRule Adds a new targeting rule to the segment. The rule may contain `clauses`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `description`: A description of the rule. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addRule\", \"clauses\": [ { \"attribute\": \"email\", \"op\": \"contains\", \"negate\": false, \"values\": [\"@launchdarkly.com\"] } ], \"description\": \"Targeting rule for LaunchDarkly employees\", }] } ``` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addValuesToClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseIds`: Array of IDs of clauses in the rule. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseIds\": [\"10a58772-3121-400f-846b-b8a04e8944ed\", \"36a461dc-235e-4b08-97b9-73ce9365873e\"] }] } ``` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeRule\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeValuesFromClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules in the segment. ##### Parameters - `ruleIds`: Array of IDs of all targeting rules in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleIds\": [\"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"63c238d1-835d-435e-8f21-c8d5e40b2a3d\"] }] } ``` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10c7462a-2062-45ba-a8bb-dfb3de0f8af5\", \"clause\": { \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"Mexico\", \"Canada\"] } }] } ``` #### updateRuleDescription Updates the description of the segment targeting rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateRuleDescription\", \"description\": \"New rule description\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### updateRuleRolloutAndContextKind For a rule that includes a percentage of targets, updates the percentage and the context kind of the targets to include. ##### Parameters - `ruleId`: The ID of a targeting rule in the segment that includes a percentage of targets. - `weight`: The weight, in thousandths of a percent (0-100000). - `contextKind`: The context kind. Here's an example: ```json { \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"weight\": \"20000\", \"contextKind\": \"device\" }] } ``` </details> <details> <summary>Click to expand instructions for <strong>working with Big Segments</strong></summary> A \"big segment\" is a segment that is either a synced segment, or a list-based segment with more than 15,000 entries that includes only one targeted context kind. LaunchDarkly uses different implementations for different types of segments so that all of your segments have good performance. The following semantic patch instructions apply only to these [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments). #### addBigSegmentExcludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets excluded from the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addBigSegmentExcludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addBigSegmentIncludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets included in the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addBigSegmentIncludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### processBigSegmentImport For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Processes a segment import. ##### Parameters - `importId`: The ID of the import. The import ID is returned in the `Location` header as part of the [Create big segment import](https://launchdarkly.com/docs/api/segments/create-big-segment-import) request. Here's an example: ```json { \"instructions\": [{ \"kind\": \"processBigSegmentImport\", \"importId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### removeBigSegmentExcludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets excluded from the segment. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeBigSegmentExcludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeBigSegmentIncludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets included in the segment. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeBigSegmentIncludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` </details> ### Using JSON patches on a segment If you do not include the header described above, you can use a [JSON patch](https://launchdarkly.com/docs/api#updates-using-json-patch) or [JSON merge patch](https://datatracker.ietf.org/doc/html/rfc7386) representation of the desired changes. For example, to update the description for a segment with a JSON patch, use the following request body: ```json { \"patch\": [ { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"new description\" } ] } ``` To update fields in the segment that are arrays, set the `path` to the name of the field and then append `/<array index>`. Use `/0` to add the new entry to the beginning of the array. Use `/-` to add the new entry to the end of the array. For example, to add a rule to a segment, use the following request body: ```json { \"patch\":[ { \"op\": \"add\", \"path\": \"/rules/0\", \"value\": { \"clauses\": [{ \"contextKind\": \"user\", \"attribute\": \"email\", \"op\": \"endsWith\", \"values\": [\".edu\"], \"negate\": false }] } } ] } ``` To add or remove targets from segments, we recommend using semantic patch. Semantic patch for segments includes specific instructions for adding and removing both included and excluded targets.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchWithComment- (required)dryRun- If true, the patch will be validated but not persisted. Returns a preview of the segment after the patch is applied. (optional)- Returns:
- ApiResponse<UserSegment>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
patchSegmentAsync
public okhttp3.Call patchSegmentAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull PatchWithComment patchWithComment, @Nullable java.lang.Boolean dryRun, ApiCallback<UserSegment> _callback) throws ApiExceptionPatch segment (asynchronously) Update a segment. The request body must be a valid semantic patch, JSON patch, or JSON merge patch. To learn more the different formats, read [Updates](https://launchdarkly.com/docs/api#updates). ### Using semantic patches on a segment To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch). The body of a semantic patch request for updating segments requires an `environmentKey` in addition to `instructions` and an optional `comment`. The body of the request takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required) The key of the LaunchDarkly environment. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the action requires parameters, you must include those parameters as additional fields in the object. ### Instructions Semantic patch requests support the following `kind` instructions for updating segments. <details> <summary>Click to expand instructions for <strong>updating segment details and settings</strong></summary> #### addTags Adds tags to the segment. ##### Parameters - `values`: A list of tags to add. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addTags\", \"values\": [\"tag1\", \"tag2\"] }] } ``` #### removeTags Removes tags from the segment. ##### Parameters - `values`: A list of tags to remove. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeTags\", \"values\": [\"tag1\", \"tag2\"] }] } ``` #### updateName Updates the name of the segment. ##### Parameters - `value`: Name of the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateName\", \"value\": \"Updated segment name\" }] } ``` </details> <details> <summary>Click to expand instructions for <strong>updating segment individual targets</strong></summary> #### addExcludedTargets Adds context keys to the individual context targets excluded from the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExcludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addExcludedUsers Adds user keys to the individual user targets excluded from the segment. Returns an error if this causes the same user key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. If you are working with contexts, use `addExcludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addExcludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### addIncludedTargets Adds context keys to the individual context targets included in the segment for the specified `contextKind`. Returns an error if this causes the same context key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be added to. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addIncludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addIncludedUsers Adds user keys to the individual user targets included in the segment. Returns an error if this causes the same user key to be both included and excluded, or if the number of operations on targets exceeds the batch limit of 1,500. If you are working with contexts, use `addIncludedTargets` instead of this instruction. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addIncludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### removeExcludedTargets Removes context keys from the individual context targets excluded from the segment for the specified `contextKind`. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExcludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeExcludedUsers Removes user keys from the individual user targets excluded from the segment. If you are working with contexts, use `removeExcludedTargets` instead of this instruction. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeExcludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` #### removeIncludedTargets Removes context keys from the individual context targets included in the segment for the specified `contextKind`. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `contextKind`: The context kind the targets should be removed from. - `values`: List of keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeIncludedTargets\", \"contextKind\": \"org\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeIncludedUsers Removes user keys from the individual user targets included in the segment. If you are working with contexts, use `removeIncludedTargets` instead of this instruction. Returns an error if the number of operations on targets exceeds the batch limit of 1,500. ##### Parameters - `values`: List of user keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeIncludedUsers\", \"values\": [ \"user-key-123abc\", \"user-key-456def\" ] }] } ``` </details> <details> <summary>Click to expand instructions for <strong>updating segment targeting rules</strong></summary> #### addClauses Adds the given clauses to the rule indicated by `ruleId`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `ruleId`: ID of a rule in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addClauses\", \"clauses\": [ { \"attribute\": \"email\", \"negate\": false, \"op\": \"contains\", \"values\": [\"value1\"] } ], \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", }] } ``` #### addRule Adds a new targeting rule to the segment. The rule may contain `clauses`. ##### Parameters - `clauses`: Array of clause objects, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. - `description`: A description of the rule. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addRule\", \"clauses\": [ { \"attribute\": \"email\", \"op\": \"contains\", \"negate\": false, \"values\": [\"@launchdarkly.com\"] } ], \"description\": \"Targeting rule for LaunchDarkly employees\", }] } ``` #### addValuesToClause Adds `values` to the values of the clause that `ruleId` and `clauseId` indicate. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addValuesToClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### removeClauses Removes the clauses specified by `clauseIds` from the rule indicated by `ruleId`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseIds`: Array of IDs of clauses in the rule. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeClauses\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseIds\": [\"10a58772-3121-400f-846b-b8a04e8944ed\", \"36a461dc-235e-4b08-97b9-73ce9365873e\"] }] } ``` #### removeRule Removes the targeting rule specified by `ruleId`. Does nothing if the rule does not exist. ##### Parameters - `ruleId`: ID of a rule in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeRule\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### removeValuesFromClause Removes `values` from the values of the clause indicated by `ruleId` and `clauseId`. Does not update the context kind, attribute, or operator. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `values`: Array of strings, case sensitive. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeValuesFromClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10a58772-3121-400f-846b-b8a04e8944ed\", \"values\": [\"beta_testers\"] }] } ``` #### reorderRules Rearranges the rules to match the order given in `ruleIds`. Returns an error if `ruleIds` does not match the current set of rules in the segment. ##### Parameters - `ruleIds`: Array of IDs of all targeting rules in the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleIds\": [\"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"63c238d1-835d-435e-8f21-c8d5e40b2a3d\"] }] } ``` #### updateClause Replaces the clause indicated by `ruleId` and `clauseId` with `clause`. ##### Parameters - `ruleId`: ID of a rule in the segment. - `clauseId`: ID of a clause in that rule. - `clause`: New `clause` object, with `contextKind` (string), `attribute` (string), `op` (string), `negate` (boolean), and `values` (array of strings, numbers, or dates) properties. The `contextKind`, if not provided, defaults to `user`. The `contextKind`, `attribute`, and `values` are case sensitive. The `op` must be lower-case. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateClause\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"clauseId\": \"10c7462a-2062-45ba-a8bb-dfb3de0f8af5\", \"clause\": { \"contextKind\": \"user\", \"attribute\": \"country\", \"op\": \"in\", \"negate\": false, \"values\": [\"Mexico\", \"Canada\"] } }] } ``` #### updateRuleDescription Updates the description of the segment targeting rule. ##### Parameters - `description`: The new human-readable description for this rule. - `ruleId`: The ID of the rule. You can retrieve this by making a GET request for the segment. Here's an example: ```json { \"instructions\": [{ \"kind\": \"updateRuleDescription\", \"description\": \"New rule description\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### updateRuleRolloutAndContextKind For a rule that includes a percentage of targets, updates the percentage and the context kind of the targets to include. ##### Parameters - `ruleId`: The ID of a targeting rule in the segment that includes a percentage of targets. - `weight`: The weight, in thousandths of a percent (0-100000). - `contextKind`: The context kind. Here's an example: ```json { \"instructions\": [{ \"kind\": \"reorderRules\", \"ruleId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\", \"weight\": \"20000\", \"contextKind\": \"device\" }] } ``` </details> <details> <summary>Click to expand instructions for <strong>working with Big Segments</strong></summary> A \"big segment\" is a segment that is either a synced segment, or a list-based segment with more than 15,000 entries that includes only one targeted context kind. LaunchDarkly uses different implementations for different types of segments so that all of your segments have good performance. The following semantic patch instructions apply only to these [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments). #### addBigSegmentExcludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets excluded from the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addBigSegmentExcludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### addBigSegmentIncludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Adds context keys to the context targets included in the segment. Returns an error if this causes the same context key to be both included and excluded. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"addBigSegmentIncludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### processBigSegmentImport For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Processes a segment import. ##### Parameters - `importId`: The ID of the import. The import ID is returned in the `Location` header as part of the [Create big segment import](https://launchdarkly.com/docs/api/segments/create-big-segment-import) request. Here's an example: ```json { \"instructions\": [{ \"kind\": \"processBigSegmentImport\", \"importId\": \"a902ef4a-2faf-4eaf-88e1-ecc356708a29\" }] } ``` #### removeBigSegmentExcludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets excluded from the segment. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeBigSegmentExcludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` #### removeBigSegmentIncludedTargets For use with [larger list-based segments](https://launchdarkly.com/docs/home/flags/segments-create#create-larger-list-based-segments) ONLY. Removes context keys from the context targets included in the segment. ##### Parameters - `values`: List of context keys. Here's an example: ```json { \"instructions\": [{ \"kind\": \"removeBigSegmentIncludedTargets\", \"values\": [ \"org-key-123abc\", \"org-key-456def\" ] }] } ``` </details> ### Using JSON patches on a segment If you do not include the header described above, you can use a [JSON patch](https://launchdarkly.com/docs/api#updates-using-json-patch) or [JSON merge patch](https://datatracker.ietf.org/doc/html/rfc7386) representation of the desired changes. For example, to update the description for a segment with a JSON patch, use the following request body: ```json { \"patch\": [ { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"new description\" } ] } ``` To update fields in the segment that are arrays, set the `path` to the name of the field and then append `/<array index>`. Use `/0` to add the new entry to the beginning of the array. Use `/-` to add the new entry to the end of the array. For example, to add a rule to a segment, use the following request body: ```json { \"patch\":[ { \"op\": \"add\", \"path\": \"/rules/0\", \"value\": { \"clauses\": [{ \"contextKind\": \"user\", \"attribute\": \"email\", \"op\": \"endsWith\", \"values\": [\".edu\"], \"negate\": false }] } } ] } ``` To add or remove targets from segments, we recommend using semantic patch. Semantic patch for segments includes specific instructions for adding and removing both included and excluded targets.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)patchWithComment- (required)dryRun- If true, the patch will be validated but not persisted. Returns a preview of the segment after the patch is applied. (optional)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
postSegmentCall
public okhttp3.Call postSegmentCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull SegmentBody segmentBody, ApiCallback _callback) throws ApiExceptionBuild call for postSegment- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentBody- (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
postSegment
public UserSegment postSegment(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull SegmentBody segmentBody) throws ApiException
Create segment Create a new segment.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentBody- (required)- Returns:
- UserSegment
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
postSegmentWithHttpInfo
public ApiResponse<UserSegment> postSegmentWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull SegmentBody segmentBody) throws ApiException
Create segment Create a new segment.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentBody- (required)- Returns:
- ApiResponse<UserSegment>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
postSegmentAsync
public okhttp3.Call postSegmentAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull SegmentBody segmentBody, ApiCallback<UserSegment> _callback) throws ApiExceptionCreate segment (asynchronously) Create a new segment.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentBody- (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
updateBigSegmentContextTargetsCall
public okhttp3.Call updateBigSegmentContextTargetsCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull SegmentUserState segmentUserState, ApiCallback _callback) throws ApiExceptionBuild call for updateBigSegmentContextTargets- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)segmentUserState- (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
updateBigSegmentContextTargets
public void updateBigSegmentContextTargets(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull SegmentUserState segmentUserState) throws ApiExceptionUpdate context targets on a big segment Update context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)segmentUserState- (required)- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
updateBigSegmentContextTargetsWithHttpInfo
public ApiResponse<java.lang.Void> updateBigSegmentContextTargetsWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull SegmentUserState segmentUserState) throws ApiException
Update context targets on a big segment Update context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)segmentUserState- (required)- Returns:
- ApiResponse<Void>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
updateBigSegmentContextTargetsAsync
public okhttp3.Call updateBigSegmentContextTargetsAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull SegmentUserState segmentUserState, ApiCallback<java.lang.Void> _callback) throws ApiExceptionUpdate context targets on a big segment (asynchronously) Update context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)segmentUserState- (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
updateBigSegmentTargetsCall
public okhttp3.Call updateBigSegmentTargetsCall(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull SegmentUserState segmentUserState, ApiCallback _callback) throws ApiExceptionBuild call for updateBigSegmentTargets- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)segmentUserState- (required)_callback- Callback for upload/download progress- Returns:
- Call to execute
- Throws:
ApiException- If fail to serialize the request body object
-
updateBigSegmentTargets
public void updateBigSegmentTargets(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull SegmentUserState segmentUserState) throws ApiExceptionUpdate user context targets on a big segment Update user context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)segmentUserState- (required)- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
updateBigSegmentTargetsWithHttpInfo
public ApiResponse<java.lang.Void> updateBigSegmentTargetsWithHttpInfo(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull SegmentUserState segmentUserState) throws ApiException
Update user context targets on a big segment Update user context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)segmentUserState- (required)- Returns:
- ApiResponse<Void>
- Throws:
ApiException- If fail to call the API, e.g. server error or cannot deserialize the response body
-
updateBigSegmentTargetsAsync
public okhttp3.Call updateBigSegmentTargetsAsync(@Nonnull java.lang.String projectKey, @Nonnull java.lang.String environmentKey, @Nonnull java.lang.String segmentKey, @Nonnull SegmentUserState segmentUserState, ApiCallback<java.lang.Void> _callback) throws ApiExceptionUpdate user context targets on a big segment (asynchronously) Update user context targets included or excluded in a big segment. Big segments include larger list-based segments and synced segments. This operation does not support standard segments.- Parameters:
projectKey- The project key (required)environmentKey- The environment key (required)segmentKey- The segment key (required)segmentUserState- (required)_callback- The callback to be executed when the API call finishes- Returns:
- The request call
- Throws:
ApiException- If fail to process the API call, e.g. serializing the request body object
-
-