Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions docs/Api/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Method | HTTP request | Description
[**getNotificationHistory()**](DefaultApi.md#getNotificationHistory) | **POST** /notifications/{notification_id}/history | Notification History
[**getNotifications()**](DefaultApi.md#getNotifications) | **GET** /notifications | View notifications
[**getOutcomes()**](DefaultApi.md#getOutcomes) | **GET** /apps/{app_id}/outcomes | View Outcomes
[**getSegment()**](DefaultApi.md#getSegment) | **GET** /apps/{app_id}/segments/{segment_id} | View Segment
[**getSegments()**](DefaultApi.md#getSegments) | **GET** /apps/{app_id}/segments | Get Segments
[**getUser()**](DefaultApi.md#getUser) | **GET** /apps/{app_id}/users/by/{alias_label}/{alias_id} |
[**rotateApiKey()**](DefaultApi.md#rotateApiKey) | **POST** /apps/{app_id}/auth/tokens/{token_id}/rotate | Rotate API key
Expand Down Expand Up @@ -2182,6 +2183,79 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference)
[[Back to README]](https://github.com/OneSignal/onesignal-php-api)

## `getSegment()`

```php
getSegment($app_id, $segment_id, $include_segment_detail): \onesignal\client\model\GetSegmentSuccessResponse
```

View Segment

Retrieve details for a single segment by its ID, including subscriber count and optionally segment metadata and filters.

### Example

```php
<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure Bearer authorization: rest_api_key
$config = onesignal\client\Configuration::getDefaultConfiguration()
->setRestApiKeyToken('YOUR_REST_API_KEY')
->setOrganizationApiKeyToken('YOUR_ORGANIZATION_API_KEY');



$apiInstance = new onesignal\client\Api\DefaultApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$app_id = 'YOUR_APP_ID'; // string | The OneSignal App ID for your app. Available in Keys & IDs.
$segment_id = 'd6c5a3e1-9f17-44a1-9d10-7c0e4a2b1c8e'; // string | The segment's unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard.
$include_segment_detail = true; // bool | Set to true to include segment metadata and filters in the response.

try {
$result = $apiInstance->getSegment($app_id, $segment_id, $include_segment_detail);
print_r($result);
} catch (\onesignal\client\ApiException $e) {
echo 'Exception when calling DefaultApi->getSegment: ', $e->getMessage(), PHP_EOL;
echo 'Status Code: ', $e->getCode(), PHP_EOL;
// getErrorMessages() flattens any error-envelope shape to a string[];
// the raw body remains on getResponseBody().
echo 'Error Messages: ', implode(', ', $e->getErrorMessages()), PHP_EOL;
echo 'Response Body: ', $e->getResponseBody(), PHP_EOL;
} catch (\Exception $e) {
echo 'Exception when calling DefaultApi->getSegment: ', $e->getMessage(), PHP_EOL;
}
```

### Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**app_id** | **string**| The OneSignal App ID for your app. Available in Keys &amp; IDs. |
**segment_id** | **string**| The segment&#39;s unique identifier. Can be found using the View Segments API or in the URL of the segment when viewing it in the dashboard. |
**include_segment_detail** | **bool**| Set to true to include segment metadata and filters in the response. | [optional]

### Return type

[**\onesignal\client\model\GetSegmentSuccessResponse**](../Model/GetSegmentSuccessResponse.md)

### Authorization

[rest_api_key](https://github.com/OneSignal/onesignal-php-api#configuration)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`

[[Back to top]](#) [[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference)
[[Back to README]](https://github.com/OneSignal/onesignal-php-api)

## `getSegments()`

```php
Expand Down
10 changes: 10 additions & 0 deletions docs/Model/GetSegmentSuccessResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# # GetSegmentSuccessResponse

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**subscriber_count** | **int** | The number of subscribers matching this segment. | [optional]
**payload** | [**\onesignal\client\model\SegmentDetails**](SegmentDetails.md) | | [optional]

[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api)
14 changes: 14 additions & 0 deletions docs/Model/SegmentDetails.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# # SegmentDetails

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **string** | The unique identifier for the segment (UUID v4). | [optional]
**name** | **string** | The segment name. | [optional]
**description** | **string** | Human-readable description for the segment. &#x60;null&#x60; when unset. Maximum 255 characters. | [optional]
**created_at** | **int** | Unix timestamp when the segment was created. | [optional]
**source** | **string** | The source of the segment. | [optional]
**filters** | [**\onesignal\client\model\FilterExpression[]**](FilterExpression.md) | Array of filter and operator objects defining the segment criteria. Uses the same format as the Create Segment API, so filters can be directly used to recreate or update the segment. | [optional]

[[Back to API list]](https://github.com/OneSignal/onesignal-php-api#full-api-reference) [[Back to README]](https://github.com/OneSignal/onesignal-php-api)
Loading