|
| 1 | +// Get rum cohort users returns "Successful response with cohort users" response |
| 2 | + |
| 3 | +import com.datadog.api.client.ApiClient; |
| 4 | +import com.datadog.api.client.ApiException; |
| 5 | +import com.datadog.api.client.v2.api.CohortApi; |
| 6 | +import com.datadog.api.client.v2.model.GetCohortUsersRequest; |
| 7 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestData; |
| 8 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestDataAttributes; |
| 9 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestDataAttributesDefinition; |
| 10 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestDataAttributesDefinitionAudienceFilters; |
| 11 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems; |
| 12 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems; |
| 13 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems; |
| 14 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestDataAttributesTime; |
| 15 | +import com.datadog.api.client.v2.model.GetCohortUsersRequestDataType; |
| 16 | +import com.datadog.api.client.v2.model.GetCohortUsersResponse; |
| 17 | +import java.util.Collections; |
| 18 | + |
| 19 | +public class Example { |
| 20 | + public static void main(String[] args) { |
| 21 | + ApiClient defaultClient = ApiClient.getDefaultApiClient(); |
| 22 | + defaultClient.setUnstableOperationEnabled("v2.getRumCohortUsers", true); |
| 23 | + CohortApi apiInstance = new CohortApi(defaultClient); |
| 24 | + |
| 25 | + GetCohortUsersRequest body = |
| 26 | + new GetCohortUsersRequest() |
| 27 | + .data( |
| 28 | + new GetCohortUsersRequestData() |
| 29 | + .attributes( |
| 30 | + new GetCohortUsersRequestDataAttributes() |
| 31 | + .definition( |
| 32 | + new GetCohortUsersRequestDataAttributesDefinition() |
| 33 | + .audienceFilters( |
| 34 | + new GetCohortUsersRequestDataAttributesDefinitionAudienceFilters() |
| 35 | + .accounts( |
| 36 | + Collections.singletonList( |
| 37 | + new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersAccountsItems() |
| 38 | + .name(""))) |
| 39 | + .segments( |
| 40 | + Collections.singletonList( |
| 41 | + new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersSegmentsItems() |
| 42 | + .name("") |
| 43 | + .segmentId(""))) |
| 44 | + .users( |
| 45 | + Collections.singletonList( |
| 46 | + new GetCohortUsersRequestDataAttributesDefinitionAudienceFiltersUsersItems() |
| 47 | + .name(""))))) |
| 48 | + .time(new GetCohortUsersRequestDataAttributesTime())) |
| 49 | + .type(GetCohortUsersRequestDataType.COHORT_USERS_REQUEST)); |
| 50 | + |
| 51 | + try { |
| 52 | + GetCohortUsersResponse result = apiInstance.getRumCohortUsers(body); |
| 53 | + System.out.println(result); |
| 54 | + } catch (ApiException e) { |
| 55 | + System.err.println("Exception when calling CohortApi#getRumCohortUsers"); |
| 56 | + System.err.println("Status code: " + e.getCode()); |
| 57 | + System.err.println("Reason: " + e.getResponseBody()); |
| 58 | + System.err.println("Response headers: " + e.getResponseHeaders()); |
| 59 | + e.printStackTrace(); |
| 60 | + } |
| 61 | + } |
| 62 | +} |
0 commit comments