Skip to content

Latest commit

 

History

History
353 lines (246 loc) · 39.3 KB

README.md

File metadata and controls

353 lines (246 loc) · 39.3 KB

Analytics

Overview

Available Operations

summary

Get the totals of the project for a time window: requests, flags, flag rate, allowed, rejected and sent to review, with the window before for the trend. Also the review queue backlog and a flag-rate spike, if there is one.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use ModerationApi;
use ModerationApi\Models\Operations;

$sdk = ModerationApi\ModerationApi::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->analytics->summary(
    range: Operations\GetAnalyticsSummaryQueryParamRange::Thirtyd
);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
range ?Operations\GetAnalyticsSummaryQueryParamRange ➖ The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets.
channel ?string ➖ N/A
projectId ?string ➖ The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.

Response

?Operations\GetAnalyticsSummaryResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestError 400 application/json
Errors\AuthenticationError 401 application/json
Errors\PermissionDeniedError 403 application/json
Errors\NotFoundError 404 application/json
Errors\RateLimitError 429 application/json
Errors\InternalServerError 500 application/json
Errors\APIException 4XX, 5XX */*

policies

Get the policy labels that flagged the most content in a time window, largest first, with the count in the window before.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use ModerationApi;
use ModerationApi\Models\Operations;

$sdk = ModerationApi\ModerationApi::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->analytics->policies(
    range: Operations\GetAnalyticsPoliciesQueryParamRange::Thirtyd,
    limit: 8

);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
range ?Operations\GetAnalyticsPoliciesQueryParamRange ➖ The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets.
channel ?string ➖ N/A
limit ?int ➖ N/A
projectId ?string ➖ The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.

Response

?Operations\GetAnalyticsPoliciesResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestError 400 application/json
Errors\AuthenticationError 401 application/json
Errors\PermissionDeniedError 403 application/json
Errors\NotFoundError 404 application/json
Errors\RateLimitError 429 application/json
Errors\InternalServerError 500 application/json
Errors\APIException 4XX, 5XX */*

authors

Get the authors with the most flagged content in a time window, largest first.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use ModerationApi;
use ModerationApi\Models\Operations;

$sdk = ModerationApi\ModerationApi::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->analytics->authors(
    range: Operations\GetAnalyticsAuthorsQueryParamRange::Thirtyd,
    limit: 6

);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
range ?Operations\GetAnalyticsAuthorsQueryParamRange ➖ The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets.
channel ?string ➖ N/A
limit ?int ➖ N/A
projectId ?string ➖ The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.

Response

?Operations\GetAnalyticsAuthorsResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestError 400 application/json
Errors\AuthenticationError 401 application/json
Errors\PermissionDeniedError 403 application/json
Errors\NotFoundError 404 application/json
Errors\RateLimitError 429 application/json
Errors\InternalServerError 500 application/json
Errors\APIException 4XX, 5XX */*

channels

Get requests, flags and flag rate for each channel of the project in a time window.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use ModerationApi;
use ModerationApi\Models\Operations;

$sdk = ModerationApi\ModerationApi::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->analytics->channels(
    range: Operations\GetAnalyticsChannelsQueryParamRange::Thirtyd
);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
range ?Operations\GetAnalyticsChannelsQueryParamRange ➖ The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets.
projectId ?string ➖ The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.

Response

?Operations\GetAnalyticsChannelsResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestError 400 application/json
Errors\AuthenticationError 401 application/json
Errors\PermissionDeniedError 403 application/json
Errors\NotFoundError 404 application/json
Errors\RateLimitError 429 application/json
Errors\InternalServerError 500 application/json
Errors\APIException 4XX, 5XX */*

volumes

Get requests, flags, rejections and reviews per hour (24h) or per day (7d, 30d, 90d), oldest first.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use ModerationApi;
use ModerationApi\Models\Operations;

$sdk = ModerationApi\ModerationApi::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->analytics->volumes(
    range: Operations\GetAnalyticsVolumesQueryParamRange::Thirtyd
);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
range ?Operations\GetAnalyticsVolumesQueryParamRange ➖ The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets.
channel ?string ➖ N/A
projectId ?string ➖ The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.

Response

?Operations\GetAnalyticsVolumesResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestError 400 application/json
Errors\AuthenticationError 401 application/json
Errors\PermissionDeniedError 403 application/json
Errors\NotFoundError 404 application/json
Errors\RateLimitError 429 application/json
Errors\InternalServerError 500 application/json
Errors\APIException 4XX, 5XX */*

automation

Get how flagged content was handled in a time window: settled by rules or the casebook, or sent to human review, and what the reviewers decided.

Example Usage

declare(strict_types=1);

require 'vendor/autoload.php';

use ModerationApi;
use ModerationApi\Models\Operations;

$sdk = ModerationApi\ModerationApi::builder()
    ->setSecurity(
        '<YOUR_BEARER_TOKEN_HERE>'
    )
    ->build();



$response = $sdk->analytics->automation(
    range: Operations\GetAnalyticsAutomationQueryParamRange::Thirtyd
);

if ($response->object !== null) {
    // handle response
}

Parameters

Parameter Type Required Description
range ?Operations\GetAnalyticsAutomationQueryParamRange ➖ The time window. 24h is the last 24 hours, in hourly buckets. 7d, 30d and 90d are whole UTC days that end with today, in daily buckets.
channel ?string ➖ N/A
projectId ?string ➖ The project to act on, by ID or name. Required with an organization key unless the key reaches only one project; list projects with GET /projects. A project key acts on its own project and needs no value: naming another one is an error.

Response

?Operations\GetAnalyticsAutomationResponse

Errors

Error Type Status Code Content Type
Errors\BadRequestError 400 application/json
Errors\AuthenticationError 401 application/json
Errors\PermissionDeniedError 403 application/json
Errors\NotFoundError 404 application/json
Errors\RateLimitError 429 application/json
Errors\InternalServerError 500 application/json
Errors\APIException 4XX, 5XX */*