diff --git a/README.md b/README.md index ec37aad..5405a9a 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ - [ChaptersApi](#chaptersapi) - [LiveStreamsApi](#livestreamsapi) - [PlayerThemesApi](#playerthemesapi) - - [RawStatisticsApi](#rawstatisticsapi) - [UploadTokensApi](#uploadtokensapi) - [VideosApi](#videosapi) - [WatermarksApi](#watermarksapi) @@ -234,26 +233,6 @@ Method | HTTP request | Description [**deleteLogo**](docs/PlayerThemesApi.md#deleteLogo) | **DELETE** /players/{playerId}/logo | Delete logo -### RawStatisticsApi - - -#### Retrieve an instance of RawStatisticsApi: -```java -ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY"); -RawStatisticsApi rawStatistics = client.rawStatistics() -``` - - - -#### Endpoints - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**listLiveStreamSessions**](docs/RawStatisticsApi.md#listLiveStreamSessions) | **GET** /analytics/live-streams/{liveStreamId} | List live stream player sessions -[**listSessionEvents**](docs/RawStatisticsApi.md#listSessionEvents) | **GET** /analytics/sessions/{sessionId}/events | List player session events -[**listVideoSessions**](docs/RawStatisticsApi.md#listVideoSessions) | **GET** /analytics/videos/{videoId} | List video player sessions - - ### UploadTokensApi @@ -383,9 +362,6 @@ Method | HTTP request | Description - [PlayerThemeUpdatePayload](docs/PlayerThemeUpdatePayload.md) - [PlayerThemesListResponse](docs/PlayerThemesListResponse.md) - [Quality](docs/Quality.md) - - [RawStatisticsListLiveStreamAnalyticsResponse](docs/RawStatisticsListLiveStreamAnalyticsResponse.md) - - [RawStatisticsListPlayerSessionEventsResponse](docs/RawStatisticsListPlayerSessionEventsResponse.md) - - [RawStatisticsListSessionsResponse](docs/RawStatisticsListSessionsResponse.md) - [RefreshTokenPayload](docs/RefreshTokenPayload.md) - [RestreamsRequestObject](docs/RestreamsRequestObject.md) - [RestreamsResponseObject](docs/RestreamsResponseObject.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 57e3c35..675a298 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -8406,299 +8406,6 @@ paths: \ return\n }\n\n if (response) {\n dump(response)\n\ \ }\n}\n" x-accepts: application/json - /analytics/videos/{videoId}: - get: - description: Retrieve all available user sessions for a specific video. Tutorials - that use the [analytics endpoint](https://api.video/blog/endpoints/analytics). - operationId: GET_analytics-videos-videoId - parameters: - - description: The unique identifier for the video you want to retrieve session - information for. - example: vi4k0jvEUuaTdRAEjQ4Prklg - explode: false - in: path - name: videoId - required: true - schema: - type: string - style: simple - - description: "Period must have one of the following formats: \n- For a day\ - \ : 2018-01-01,\n- For a week: 2018-W01, \n- For a month: 2018-01\n- For\ - \ a year: 2018\nFor a range period: \n- Date range: 2018-01-01/2018-01-15\n" - explode: true - in: query - name: period - required: true - schema: - format: period - type: string - style: form - - description: Metadata and [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) - filter. Send an array of key value pairs you want to filter sessios with. - example: metadata[Author]=John Doe&metadata[Format]=Tutorial - explode: true - in: query - name: metadata - required: false - schema: - additionalProperties: - type: string - type: object - style: deepObject - x-is-deep-object: true - - description: 'Choose the number of search results to return per page. Minimum - value: 1' - example: 2 - explode: true - in: query - name: currentPage - required: false - schema: - default: 1 - type: integer - style: form - - description: Results per page. Allowed values 1-100, default is 25. - example: 30 - explode: true - in: query - name: pageSize - required: false - schema: - default: 25 - type: integer - style: form - responses: - "200": - content: - application/json: - examples: - response: - value: - data: - - session: - sessionId: psEmFwGQUAXR2lFHj5nDOpy - loadedAt: 2019-06-24T11:45:01.109Z - endedAt: 2019-06-24T11:49:19.243Z - location: - country: France - city: Paris - referrer: - url: https://api.video - medium: organic - source: https://google.com - searchTerm: video encoding hosting and delivery - device: - type: desktop - vendor: Dell - model: unknown - os: - name: Microsoft Windows - shortname: W10 - version: Windows10 - client: - type: browser - name: Firefox - version: "67.0" - pagination: - currentPage: 1 - currentPageItems: 1 - pageSize: 25 - pagesTotal: 1 - itemsTotal: 1 - links: - - rel: self - uri: /analytics/sessions/psEmFwGQUAXR2lFHj5nDOpy?currentPage=1&pageSize=25 - - rel: first - uri: /analytics/sessions/psEmFwGQUAXR2lFHj5nDOpy?currentPage=1&pageSize=25 - - rel: last - uri: /analytics/sessions/psEmFwGQUAXR2lFHj5nDOpy?currentPage=1&pageSize=25 - schema: - $ref: '#/components/schemas/raw-statistics-list-sessions-response' - description: Success - "404": - content: - application/json: - examples: - response: - value: - type: https://docs.api.video/docs/resourcenot_found - title: The requested resource was not found. - name: videoId - status: 404 - schema: - $ref: '#/components/schemas/not-found' - description: Not Found - security: - - apiKey: [] - summary: List video player sessions - tags: - - Raw statistics - x-client-action: listVideoSessions - x-group-parameters: true - x-client-paginated: true - x-readme: - code-samples: - - language: go - code: "// First install the go client with \"go get github.com/apivideo/api.video-go-client\"\ - \n// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/RawStatisticsApi.md#listVideoSessions\n\ - \npackage main\n\nimport (\n \"context\"\n \"fmt\"\n \"os\"\n\ - \ apivideosdk \"github.com/apivideo/api.video-go-client\"\n)\n\nfunc\ - \ main() {\n client := apivideosdk.ClientBuilder(\"YOUR_API_KEY\").Build()\n\ - \ // if you rather like to use the sandbox environment:\n // client\ - \ := apivideosdk.SandboxClientBuilder(\"YOUR_SANDBOX_API_KEY\").Build()\n\ - \ req := apivideosdk.RawStatisticsApiListVideoSessionsRequest{}\n \ - \ \n req.VideoId(\"vi4k0jvEUuaTdRAEjQ4Prklg\") // string | The unique\ - \ identifier for the video you want to retrieve session information for.\n\ - \ req.Period(\"period_example\") // string | Period must have one of\ - \ the following formats: - For a day : 2018-01-01, - For a week: 2018-W01,\ - \ - For a month: 2018-01 - For a year: 2018 For a range period: - Date\ - \ range: 2018-01-01/2018-01-15 \n req.Metadata(map[string]string{\"\ - key\": \"Inner_example\"}) // map[string]string | Metadata and Dynamic\ - \ Metadata filter. Send an array of key value pairs you want to filter\ - \ sessios with.\n req.CurrentPage(int32(2)) // int32 | Choose the number\ - \ of search results to return per page. Minimum value: 1 (default to 1)\n\ - \ req.PageSize(int32(30)) // int32 | Results per page. Allowed values\ - \ 1-100, default is 25. (default to 25)\n\n res, err := client.RawStatistics.ListVideoSessions(videoId\ - \ string, req)\n \n\n if err != nil {\n fmt.Fprintf(os.Stderr,\ - \ \"Error when calling `RawStatistics.ListVideoSessions``: %v\\\n\", err)\n\ - \ }\n // response from `ListVideoSessions`: RawStatisticsListSessionsResponse\n\ - \ fmt.Fprintf(os.Stdout, \"Response from `RawStatistics.ListVideoSessions`:\ - \ %v\\\n\", res)\n}\n" - - language: node - code: "// First install the \"@api.video/nodejs-client\" npm package\n//\ - \ Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/RawStatisticsApi.md#listVideoSessions\n\ - \nconst client = new ApiVideoClient({ apiKey: \"YOUR_API_KEY\" });\n\n\ - const videoId = 'vi4k0jvEUuaTdRAEjQ4Prklg'; // The unique identifier for\ - \ the video you want to retrieve session information for.\nconst period\ - \ = '2018-01'; // Period must have one of the following formats: - For\ - \ a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 -\ - \ For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15\ - \ \nconst metadata = { // Metadata and Dynamic Metadata filter. Send an\ - \ array of key value pairs you want to filter sessios with.\n metadataKey:\ - \ \"metadataValue\"\n}; \nconst currentPage = 2; // Choose the number\ - \ of search results to return per page. Minimum value: 1\nconst pageSize\ - \ = 30; // Results per page. Allowed values 1-100, default is 25.\n\n\ - const videoSessions = await client.rawStatistics.listVideoSessions({ videoId,\ - \ period, metadata, currentPage, pageSize }); " - - language: python - code: | - # First install the api client with "pip install api.video" - # Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/RawStatisticsApi.md#listVideoSessions - - import apivideo - from apivideo.api import raw_statistics_api - from apivideo.model.not_found import NotFound - from apivideo.model.raw_statistics_list_sessions_response import RawStatisticsListSessionsResponse - from pprint import pprint - - # Enter a context with an instance of the API client - with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: - # Create an instance of the API class - api_instance = raw_statistics_api.RawStatisticsApi(api_client) - video_id = "vi4k0jvEUuaTdRAEjQ4Prklg" # str | The unique identifier for the video you want to retrieve session information for. - period = "period_example" # str | Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 (optional) - metadata = { - "key": "key_example", - } # {str: (str,)} | Metadata and Dynamic Metadata filter. Send an array of key value pairs you want to filter sessios with. (optional) - current_page = 2 # int | Choose the number of search results to return per page. Minimum value: 1 (optional) if omitted the server will use the default value of 1 - page_size = 30 # int | Results per page. Allowed values 1-100, default is 25. (optional) if omitted the server will use the default value of 25 - - # example passing only required values which don't have defaults set - try: - # List video player sessions - api_response = api_instance.list_video_sessions(video_id) - pprint(api_response) - except apivideo.ApiException as e: - print("Exception when calling RawStatisticsApi->list_video_sessions: %s\n" % e) - - # example passing only required values which don't have defaults set - # and optional values - try: - # List video player sessions - api_response = api_instance.list_video_sessions(video_id, period=period, metadata=metadata, current_page=current_page, page_size=page_size) - pprint(api_response) - except apivideo.ApiException as e: - print("Exception when calling RawStatisticsApi->list_video_sessions: %s\n" % e) - - language: java - code: "// First add the \"video.api:java-api-client\" maven dependency to\ - \ your project\n// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/RawStatisticsApi.md#listVideoSessions\n\ - \nimport video.api.client.ApiVideoClient;\nimport video.api.client.api.ApiException;\n\ - import video.api.client.api.models.*;\nimport video.api.client.api.clients.RawStatisticsApi;\n\ - import java.util.*;\n\npublic class Example {\n public static void main(String[]\ - \ args) {\n ApiVideoClient client = new ApiVideoClient(\"YOUR_API_KEY\"\ - );\n // if you rather like to use the sandbox environment:\n //\ - \ ApiVideoClient client = new ApiVideoClient(\"YOUR_SANDBOX_API_KEY\"\ - , ApiVideoClient.Environment.SANDBOX);\n\n RawStatisticsApi apiInstance\ - \ = client.rawStatistics();\n \n String videoId = \"vi4k0jvEUuaTdRAEjQ4Prklg\"\ - ; // The unique identifier for the video you want to retrieve session\ - \ information for.\n String period = \"period_example\"; // Period\ - \ must have one of the following formats: - For a day : 2018-01-01, -\ - \ For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For\ - \ a range period: - Date range: 2018-01-01/2018-01-15 \n Map metadata = new HashMap(); // Metadata and Dynamic Metadata filter.\ - \ Send an array of key value pairs you want to filter sessios with.\n\ - \ Integer currentPage = 1; // Choose the number of search results to\ - \ return per page. Minimum value: 1\n Integer pageSize = 25; // Results\ - \ per page. Allowed values 1-100, default is 25.\n\n try {\n Page\ - \ result = apiInstance.listVideoSessions(videoId)\n .period(period)\n\ - \ .metadata(metadata)\n .currentPage(currentPage)\n\ - \ .pageSize(pageSize)\n .execute();\n System.out.println(result);\n\ - \ } catch (ApiException e) {\n System.err.println(\"Exception\ - \ when calling RawStatisticsApi#listVideoSessions\");\n System.err.println(\"\ - Status code: \" + e.getCode());\n System.err.println(\"Reason: \"\ - \ + e.getMessage());\n System.err.println(\"Response headers: \"\ - \ + e.getResponseHeaders());\n e.printStackTrace();\n }\n }\n\ - }\n" - - language: csharp - code: "// First add the \"ApiVideo\" NuGet package to your project\n// Documentation:\ - \ https://github.com/apivideo/api.video-csharp-client/blob/main/docs/RawStatisticsApi.md#listVideoSessions\n\ - \nusing System.Diagnostics;\nusing ApiVideo.Client;\n\nnamespace Example\n\ - {\n public class listVideoSessionsExample\n {\n public static\ - \ void Main()\n {\n var basePath = ApiVideoClient.Client.Environment.SANDBOX;\n\ - \ var apiKey = \"YOUR_API_KEY\";\n\n var apiInstance\ - \ = new ApiVideoClient(apiKey,basePath);\n\n var videoId =\ - \ vi4k0jvEUuaTdRAEjQ4Prklg; // string | The unique identifier for the\ - \ video you want to retrieve session information for.\n var\ - \ period = period_example; // string | Period must have one of the following\ - \ formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a\ - \ month: 2018-01 - For a year: 2018 For a range period: - Date range:\ - \ 2018-01-01/2018-01-15 (optional) \n var metadata = new Dictionary(); // Dictionary | Metadata and Dynamic Metadata\ - \ filter. Send an array of key value pairs you want to filter sessios\ - \ with. (optional) \n var currentPage = 2; // int? | Choose\ - \ the number of search results to return per page. Minimum value: 1 (optional)\ - \ (default to 1)\n var pageSize = 30; // int? | Results per\ - \ page. Allowed values 1-100, default is 25. (optional) (default to 25)\n\ - \ var apiRawStatisticsInstance = apiInstance.RawStatistics();\n\ - \ try\n {\n // List video player\ - \ sessions\n RawStatisticsListSessionsResponse result =\ - \ apiRawStatisticsInstance.listVideoSessions(videoId, period, metadata,\ - \ currentPage, pageSize);\n Debug.WriteLine(result);\n\ - \ }\n catch (ApiException e)\n {\n \ - \ Debug.Print(\"Exception when calling RawStatisticsApi.listVideoSessions:\ - \ \" + e.Message );\n Debug.Print(\"Status Code: \"+ e.ErrorCode);\n\ - \ Debug.Print(e.StackTrace);\n }\n }\n\ - \ }\n}\n" - - language: php - code: "rawStatistics()->listVideoSessions($videoId,\ - \ array(\n 'period' => '2018-01', // Period must have one of the following\ - \ formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month:\ - \ 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15\ - \ \n 'metadata' => array( // Metadata and Dynamic Metadata filter.\ - \ Send an array of key value pairs you want to filter sessions with.\n\ - \ 'key' => 'value'\n ),\n 'currentPage' => 2, // Choose the\ - \ number of search results to return per page. Minimum ->setvalue(1)\n\ - \ 'pageSize' => 30 // Results per page. Allowed values 1-100, default\ - \ is 25.\n)); " - - language: swift - code: | - // First install the api client: https://github.com/apivideo/api.video-ios-client#getting-started - // Documentation: https://github.com/apivideo/api.video-ios-client/blob/main/docs/RawStatisticsAPI.md#listVideoSessions - x-accepts: application/json /analytics/live-streams/plays: get: description: Retrieve filtered analytics about the number of plays for your @@ -9128,716 +8835,142 @@ paths: \ today, and excluding today. - The date you set must be **within the\ \ last 30 days**. - The value you provide must follow the `YYYY-MM-DD`\ \ format. \n String filter = \"liveStreamId:li3q7HxhApxRF1c8F8r6VeaI\"\ - ; // Use this query parameter to filter your results to a specific live\ - \ stream in a project that you want analytics for. You must use the `liveStreamId:`\ - \ prefix when specifying a live stream ID.\n Integer currentPage =\ - \ 1; // Choose the number of search results to return per page. Minimum\ - \ value: 1\n Integer pageSize = 25; // Results per page. Allowed values\ - \ 1-100, default is 25.\n\n try {\n Page result\ - \ = apiInstance.getLiveStreamsPlays(from, dimension)\n .to(to)\n\ - \ .filter(filter)\n .currentPage(currentPage)\n\ - \ .pageSize(pageSize)\n .execute();\n System.out.println(result);\n\ - \ } catch (ApiException e) {\n System.err.println(\"Exception\ - \ when calling AnalyticsApi#getLiveStreamsPlays\");\n System.err.println(\"\ - Status code: \" + e.getCode());\n System.err.println(\"Reason: \"\ - \ + e.getMessage());\n System.err.println(\"Response headers: \"\ - \ + e.getResponseHeaders());\n e.printStackTrace();\n }\n }\n\ - }\n" - - language: csharp - code: "using System.Diagnostics;\nusing ApiVideo.Client;\n\nnamespace Example\n\ - {\n public class getLiveStreamsPlaysExample\n {\n public\ - \ static void Main()\n {\n var basePath = ApiVideoClient.Client.Environment.SANDBOX;\n\ - \ var apiKey = \"YOUR_API_KEY\";\n\n var apiInstance\ - \ = new ApiVideoClient(apiKey,basePath);\n\n var from = 2023-06-01;\ - \ // DateTime | Use this query parameter to set the start date for the\ - \ time period that you want analytics for. - The API returns analytics\ - \ data including the day you set in `from`. - The date you set must be\ - \ **within the last 30 days**. - The value you provide must follow the\ - \ `YYYY-MM-DD` format. \n var dimension = browser; // string\ - \ | Use this query parameter to define the dimension that you want analytics\ - \ for. - `liveStreamId`: Returns analytics based on the public live stream\ - \ identifiers. - `emittedAt`: Returns analytics based on the times of\ - \ the play events. The API returns data in specific interval groups. When\ - \ the date period you set in `from` and `to` is less than or equals to\ - \ 2 days, the response for this dimension is grouped in hourly intervals.\ - \ Otherwise, it is grouped in daily intervals. - `country`: Returns analytics\ - \ based on the viewers' country. The list of supported country names are\ - \ based on the [GeoNames public database](https://www.geonames.org/countries/).\ - \ - `deviceType`: Returns analytics based on the type of device used by\ - \ the viewers during the play event. - `operatingSystem`: Returns analytics\ - \ based on the operating system used by the viewers during the play event.\ - \ - `browser`: Returns analytics based on the browser used by the viewers\ - \ during the play event.\n var to = 2023-06-10; // DateTime?\ - \ | Use this optional query parameter to set the end date for the time\ - \ period that you want analytics for. - If you do not specify a `to` date,\ - \ the API returns analytics data starting from the `from` date up until\ - \ today, and excluding today. - The date you set must be **within the\ - \ last 30 days**. - The value you provide must follow the `YYYY-MM-DD`\ - \ format. (optional) \n var filter = liveStreamId:li3q7HxhApxRF1c8F8r6VeaI;\ - \ // string | Use this query parameter to filter your results to a specific\ - \ live stream in a project that you want analytics for. You must use the\ - \ `liveStreamId:` prefix when specifying a live stream ID. (optional)\ - \ \n var currentPage = 2; // int? | Choose the number of search\ - \ results to return per page. Minimum value: 1 (optional) (default to\ - \ 1)\n var pageSize = 30; // int? | Results per page. Allowed\ - \ values 1-100, default is 25. (optional) (default to 25)\n \ - \ var apiAnalyticsInstance = apiInstance.Analytics();\n try\n\ - \ {\n // Get play events for live stream\n \ - \ AnalyticsPlaysResponse result = apiAnalyticsInstance.getLiveStreamsPlays(from,\ - \ dimension, to, filter, currentPage, pageSize);\n Debug.WriteLine(result);\n\ - \ }\n catch (ApiException e)\n {\n \ - \ Debug.Print(\"Exception when calling AnalyticsApi.getLiveStreamsPlays:\ - \ \" + e.Message );\n Debug.Print(\"Status Code: \"+ e.ErrorCode);\n\ - \ Debug.Print(e.StackTrace);\n }\n }\n\ - \ }\n}\n" - - language: php - code: "analytics()->getLiveStreamsPlays($from,\ - \ $dimension, array(\n 'to' => new \\DateTime('2023-06-10'), // Use\ - \ this optional query parameter to set the end date for the time period\ - \ that you want analytics for. - If you do not specify a `to` date, the\ - \ API returns analytics data starting from the `from` date up until today,\ - \ and excluding today. - The date you set must be **within the last 30\ - \ days**. - The value you provide must follow the `YYYY-MM-DD` format.\ - \ \n 'filter' => \"liveStreamId:li3q7HxhApxRF1c8F8r6VeaI\", // Use\ - \ this query parameter to filter your results to a specific live stream\ - \ in a project that you want analytics for. You must use the `liveStreamId:`\ - \ prefix when specifying a live stream ID.\n 'currentPage' => 2, //\ - \ Choose the number of search results to return per page. Minimum value:\ - \ 1\n 'pageSize' => 30 // Results per page. Allowed values 1-100, default\ - \ is 25.\n));" - - language: swift - code: "// The following code samples are still beta. For any issue, please\ - \ report via http://github.com/OpenAPITools/openapi-generator/issues/new\n\ - import ApiVideoClient\n\nlet from = Date() // Date | Use this query parameter\ - \ to set the start date for the time period that you want analytics for.\ - \ - The API returns analytics data including the day you set in `from`.\ - \ - The date you set must be **within the last 30 days**. - The value\ - \ you provide must follow the `YYYY-MM-DD` format. \nlet dimension = \"\ - dimension_example\" // String | Use this query parameter to define the\ - \ dimension that you want analytics for. - `liveStreamId`: Returns analytics\ - \ based on the public live stream identifiers. - `emittedAt`: Returns\ - \ analytics based on the times of the play events. The API returns data\ - \ in specific interval groups. When the date period you set in `from`\ - \ and `to` is less than or equals to 2 days, the response for this dimension\ - \ is grouped in hourly intervals. Otherwise, it is grouped in daily intervals.\ - \ - `country`: Returns analytics based on the viewers' country. The list\ - \ of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/).\ - \ - `deviceType`: Returns analytics based on the type of device used by\ - \ the viewers during the play event. - `operatingSystem`: Returns analytics\ - \ based on the operating system used by the viewers during the play event.\ - \ - `browser`: Returns analytics based on the browser used by the viewers\ - \ during the play event.\nlet to = Date() // Date | Use this optional\ - \ query parameter to set the end date for the time period that you want\ - \ analytics for. - If you do not specify a `to` date, the API returns\ - \ analytics data starting from the `from` date up until today, and excluding\ - \ today. - The date you set must be **within the last 30 days**. - The\ - \ value you provide must follow the `YYYY-MM-DD` format. (optional)\n\ - let filter = \"filter_example\" // String | Use this query parameter to\ - \ filter your results to a specific live stream in a project that you\ - \ want analytics for. You must use the `liveStreamId:` prefix when specifying\ - \ a live stream ID. (optional)\nlet currentPage = 987 // Int | Choose\ - \ the number of search results to return per page. Minimum value: 1 (optional)\ - \ (default to 1)\nlet pageSize = 987 // Int | Results per page. Allowed\ - \ values 1-100, default is 25. (optional) (default to 25)\n\n// Get play\ - \ events for live stream\nAnalyticsAPI.getLiveStreamsPlays(from: from,\ - \ dimension: dimension, to: to, filter: filter, currentPage: currentPage,\ - \ pageSize: pageSize) { (response, error) in\n guard error == nil else\ - \ {\n print(error)\n return\n }\n\n if (response)\ - \ {\n dump(response)\n }\n}\n" - x-accepts: application/json - /analytics/live-streams/{liveStreamId}: - get: - operationId: GET_analytics-live-streams-liveStreamId - parameters: - - description: The unique identifier for the live stream you want to retrieve - analytics for. - example: vi4k0jvEUuaTdRAEjQ4Jfrgz - explode: false - in: path - name: liveStreamId - required: true - schema: - type: string - style: simple - - description: "Period must have one of the following formats: \n- For a day\ - \ : \"2018-01-01\",\n- For a week: \"2018-W01\", \n- For a month: \"2018-01\"\ - \n- For a year: \"2018\"\nFor a range period: \n- Date range: \"2018-01-01/2018-01-15\"\ - \n" - example: 2019-01-01T00:00:00.000Z - explode: true - in: query - name: period - required: true - schema: - format: period - type: string - style: form - - description: 'Choose the number of search results to return per page. Minimum - value: 1' - example: 2 - explode: true - in: query - name: currentPage - required: false - schema: - default: 1 - type: integer - style: form - - description: Results per page. Allowed values 1-100, default is 25. - example: 30 - explode: true - in: query - name: pageSize - required: false - schema: - default: 25 - type: integer - style: form - responses: - "200": - content: - application/json: - examples: - response: - value: - data: - - session: - sessionId: ps4zRWVOv2If2vzKJLMr3jQo - loadedAt: 2018-09-11T13:04:37.890Z - endedAt: 2018-09-11T14:47:22.186Z - location: - country: France - city: Paris - referrer: - url: unknown - medium: unknown - source: unknown - searchTerm: unknown - device: - type: desktop - vendor: unknown - model: unknown - os: - name: unknown - shortname: unknown - version: unknown - client: - type: browser - name: Firefox - version: "61.0" - pagination: - currentPage: 1 - currentPageItems: 1 - pageSize: 25 - pagesTotal: 1 - itemsTotal: 1 - links: - - rel: self - uri: /analytics/sessions/ps4zRWVOv2If2vzKJLMr3jQo?currentPage=1&pageSize=25 - - rel: first - uri: /analytics/sessions/ps4zRWVOv2If2vzKJLMr3jQo?currentPage=1&pageSize=25 - - rel: last - uri: /analytics/sessions/ps4zRWVOv2If2vzKJLMr3jQo?currentPage=1&pageSize=25 - schema: - $ref: '#/components/schemas/raw-statistics-list-live-stream-analytics-response' - description: Success - "404": - content: - application/json: - examples: - response: - value: - type: https://docs.api.video/docs/resourcenot_found - title: The requested resource was not found. - name: liveStreamId - status: 404 - schema: - $ref: '#/components/schemas/not-found' - description: Not Found - security: - - apiKey: [] - summary: List live stream player sessions - tags: - - Raw statistics - x-client-action: listLiveStreamSessions - x-group-parameters: true - x-client-paginated: true - x-readme: - code-samples: - - language: go - code: "// First install the go client with \"go get github.com/apivideo/api.video-go-client\"\ - \n// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/RawStatisticsApi.md#listLiveStreamSessions\n\ - \npackage main\n\nimport (\n \"context\"\n \"fmt\"\n \"os\"\n\ - \ apivideosdk \"github.com/apivideo/api.video-go-client\"\n)\n\nfunc\ - \ main() {\n client := apivideosdk.ClientBuilder(\"YOUR_API_KEY\").Build()\n\ - \ // if you rather like to use the sandbox environment:\n // client\ - \ := apivideosdk.SandboxClientBuilder(\"YOUR_SANDBOX_API_KEY\").Build()\n\ - \ req := apivideosdk.RawStatisticsApiListLiveStreamSessionsRequest{}\n\ - \ \n req.LiveStreamId(\"vi4k0jvEUuaTdRAEjQ4Jfrgz\") // string |\ - \ The unique identifier for the live stream you want to retrieve analytics\ - \ for.\n req.Period(\"2019-01-01\") // string | Period must have one\ - \ of the following formats: - For a day : \"2018-01-01\", - For a week:\ - \ \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For\ - \ a range period: - Date range: \"2018-01-01/2018-01-15\" \n req.CurrentPage(int32(2))\ - \ // int32 | Choose the number of search results to return per page. Minimum\ - \ value: 1 (default to 1)\n req.PageSize(int32(30)) // int32 | Results\ - \ per page. Allowed values 1-100, default is 25. (default to 25)\n\n \ - \ res, err := client.RawStatistics.ListLiveStreamSessions(liveStreamId\ - \ string, req)\n \n\n if err != nil {\n fmt.Fprintf(os.Stderr,\ - \ \"Error when calling `RawStatistics.ListLiveStreamSessions``: %v\\\n\ - \", err)\n }\n // response from `ListLiveStreamSessions`: RawStatisticsListLiveStreamAnalyticsResponse\n\ - \ fmt.Fprintf(os.Stdout, \"Response from `RawStatistics.ListLiveStreamSessions`:\ - \ %v\\\n\", res)\n}\n" - - language: node - code: "// First install the \"@api.video/nodejs-client\" npm package\n//\ - \ Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/RawStatisticsApi.md#listLiveStreamSessions\n\ - \nconst client = new ApiVideoClient({ apiKey: \"YOUR_API_KEY\" });\n\n\ - const liveStreamId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier\ - \ for the live stream you want to retrieve analytics for.\nconst period\ - \ = '2019-01-01'; // Period must have one of the following formats: -\ - \ For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month:\ - \ \"2018-01\" - For a year: \"2018\" For a range period: - Date range:\ - \ \"2018-01-01/2018-01-15\" \nconst currentPage = 2; // Choose the number\ - \ of search results to return per page. Minimum value: 1\nconst pageSize\ - \ = 30; // Results per page. Allowed values 1-100, default is 25.\n \n\ - const liveStreamSessions = await client.rawStatistics.listLiveStreamSessions({\ - \ liveStreamId, period, currentPage, pageSize })\n" - - language: python - code: | - # First install the api client with "pip install api.video" - # Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/RawStatisticsApi.md#listLiveStreamSessions - - import apivideo - from apivideo.api import raw_statistics_api - from apivideo.model.raw_statistics_list_live_stream_analytics_response import RawStatisticsListLiveStreamAnalyticsResponse - from apivideo.model.not_found import NotFound - from pprint import pprint - - # Enter a context with an instance of the API client - with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: - # Create an instance of the API class - api_instance = raw_statistics_api.RawStatisticsApi(api_client) - live_stream_id = "vi4k0jvEUuaTdRAEjQ4Jfrgz" # str | The unique identifier for the live stream you want to retrieve analytics for. - period = "2019-01-01" # str | Period must have one of the following formats: - For a day : "2018-01-01", - For a week: "2018-W01", - For a month: "2018-01" - For a year: "2018" For a range period: - Date range: "2018-01-01/2018-01-15" (optional) - current_page = 2 # int | Choose the number of search results to return per page. Minimum value: 1 (optional) if omitted the server will use the default value of 1 - page_size = 30 # int | Results per page. Allowed values 1-100, default is 25. (optional) if omitted the server will use the default value of 25 - - # example passing only required values which don't have defaults set - try: - # List live stream player sessions - api_response = api_instance.list_live_stream_sessions(live_stream_id) - pprint(api_response) - except apivideo.ApiException as e: - print("Exception when calling RawStatisticsApi->list_live_stream_sessions: %s\n" % e) - - # example passing only required values which don't have defaults set - # and optional values - try: - # List live stream player sessions - api_response = api_instance.list_live_stream_sessions(live_stream_id, period=period, current_page=current_page, page_size=page_size) - pprint(api_response) - except apivideo.ApiException as e: - print("Exception when calling RawStatisticsApi->list_live_stream_sessions: %s\n" % e) - - language: java - code: "// First add the \"video.api:java-api-client\" maven dependency to\ - \ your project\n// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/RawStatisticsApi.md#listLiveStreamSessions\n\ - \nimport video.api.client.ApiVideoClient;\nimport video.api.client.api.ApiException;\n\ - import video.api.client.api.models.*;\nimport video.api.client.api.clients.RawStatisticsApi;\n\ - import java.util.*;\n\npublic class Example {\n public static void main(String[]\ - \ args) {\n ApiVideoClient client = new ApiVideoClient(\"YOUR_API_KEY\"\ - );\n // if you rather like to use the sandbox environment:\n //\ - \ ApiVideoClient client = new ApiVideoClient(\"YOUR_SANDBOX_API_KEY\"\ - , ApiVideoClient.Environment.SANDBOX);\n\n RawStatisticsApi apiInstance\ - \ = client.rawStatistics();\n \n String liveStreamId = \"vi4k0jvEUuaTdRAEjQ4Jfrgz\"\ - ; // The unique identifier for the live stream you want to retrieve analytics\ - \ for.\n String period = \"2019-01-01\"; // Period must have one of\ - \ the following formats: - For a day : \"2018-01-01\", - For a week:\ - \ \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For\ - \ a range period: - Date range: \"2018-01-01/2018-01-15\" \n Integer\ - \ currentPage = 1; // Choose the number of search results to return per\ - \ page. Minimum value: 1\n Integer pageSize = 25; // Results per page.\ - \ Allowed values 1-100, default is 25.\n\n try {\n Page\ - \ result = apiInstance.listLiveStreamSessions(liveStreamId)\n \ - \ .period(period)\n .currentPage(currentPage)\n \ - \ .pageSize(pageSize)\n .execute();\n System.out.println(result);\n\ - \ } catch (ApiException e) {\n System.err.println(\"Exception\ - \ when calling RawStatisticsApi#listLiveStreamSessions\");\n System.err.println(\"\ - Status code: \" + e.getCode());\n System.err.println(\"Reason: \"\ - \ + e.getMessage());\n System.err.println(\"Response headers: \"\ - \ + e.getResponseHeaders());\n e.printStackTrace();\n }\n }\n\ - }\n" - - language: csharp - code: "// First add the \"ApiVideo\" NuGet package to your project\n// Documentation:\ - \ https://github.com/apivideo/api.video-csharp-client/blob/main/docs/RawStatisticsApi.md#listLiveStreamSessions\n\ - \nusing System.Diagnostics;\nusing ApiVideo.Client;\n\nnamespace Example\n\ - {\n public class listLiveStreamSessionsExample\n {\n public\ - \ static void Main()\n {\n var basePath = ApiVideoClient.Client.Environment.SANDBOX;\n\ - \ var apiKey = \"YOUR_API_KEY\";\n\n var apiInstance\ - \ = new ApiVideoClient(apiKey,basePath);\n\n var liveStreamId\ - \ = vi4k0jvEUuaTdRAEjQ4Jfrgz; // string | The unique identifier for the\ - \ live stream you want to retrieve analytics for.\n var period\ - \ = 2019-01-01; // string | Period must have one of the following formats:\ - \ - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month:\ - \ \"2018-01\" - For a year: \"2018\" For a range period: - Date range:\ - \ \"2018-01-01/2018-01-15\" (optional) \n var currentPage\ - \ = 2; // int? | Choose the number of search results to return per page.\ - \ Minimum value: 1 (optional) (default to 1)\n var pageSize\ - \ = 30; // int? | Results per page. Allowed values 1-100, default is\ - \ 25. (optional) (default to 25)\n var apiRawStatisticsInstance\ - \ = apiInstance.RawStatistics();\n try\n {\n \ - \ // List live stream player sessions\n RawStatisticsListLiveStreamAnalyticsResponse\ - \ result = apiRawStatisticsInstance.listLiveStreamSessions(liveStreamId,\ - \ period, currentPage, pageSize);\n Debug.WriteLine(result);\n\ - \ }\n catch (ApiException e)\n {\n \ - \ Debug.Print(\"Exception when calling RawStatisticsApi.listLiveStreamSessions:\ - \ \" + e.Message );\n Debug.Print(\"Status Code: \"+ e.ErrorCode);\n\ - \ Debug.Print(e.StackTrace);\n }\n }\n\ - \ }\n}\n" - - language: php - code: "// First install the \"@api.video/nodejs-client\" npm package\n//\ - \ Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/RawStatisticsApi.md#listLiveStreamSessions\n\ - \nconst client = new ApiVideoClient({ apiKey: \"YOUR_API_KEY\" });\n\n\ - const liveStreamId = 'vi4k0jvEUuaTdRAEjQ4Jfrgz'; // The unique identifier\ - \ for the live stream you want to retrieve analytics for.\nconst period\ - \ = '2019-01-01'; // Period must have one of the following formats: -\ - \ For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month:\ - \ \"2018-01\" - For a year: \"2018\" For a range period: - Date range:\ - \ \"2018-01-01/2018-01-15\" \nconst currentPage = 2; // Choose the number\ - \ of search results to return per page. Minimum value: 1\nconst pageSize\ - \ = 30; // Results per page. Allowed values 1-100, default is 25.\n\n\ - // RawStatisticsListLiveStreamAnalyticsResponse\nconst liveStreamSessions\ - \ = await client.rawStatistics.listLiveStreamSessions({ liveStreamId,\ - \ period, currentPage, pageSize })\n" - - language: swift - code: | - // First install the api client: https://github.com/apivideo/api.video-ios-client#getting-started - // Documentation: https://github.com/apivideo/api.video-ios-client/blob/main/docs/RawStatisticsAPI.md#listLiveStreamSessions - x-accepts: application/json - /analytics/sessions/{sessionId}/events: - get: - description: Useful to track and measure video's engagement. - operationId: GET_analytics-sessions-sessionId-events - parameters: - - description: A unique identifier you can use to reference and track a session - with. - example: psEmFwGQUAXR2lFHj5nDOpy - explode: false - in: path - name: sessionId - required: true - schema: - type: string - style: simple - - description: 'Choose the number of search results to return per page. Minimum - value: 1' - example: 2 - explode: true - in: query - name: currentPage - required: false - schema: - default: 1 - type: integer - style: form - - description: Results per page. Allowed values 1-100, default is 25. - example: 30 - explode: true - in: query - name: pageSize - required: false - schema: - default: 25 - type: integer - style: form - responses: - "200": - content: - application/json: - examples: - response: - value: - data: - - type: ready - emittedAt: 2020-09-15T09:47:42.000Z - at: 0 - - type: play - emittedAt: 2020-09-15T21:35:57.000Z - at: 0 - - type: pause - emittedAt: 2020-09-15T21:36:05.000Z - at: 7 - - type: resume - emittedAt: 2020-09-15T21:36:19.000Z - at: 21 - - type: seek.forward - emittedAt: 2020-09-15T21:36:19.000Z - from: 7 - to: 21 - - type: end - emittedAt: 2020-09-15T21:36:28.000Z - at: 30 - - type: play - emittedAt: 2020-09-15T21:36:29.000Z - at: 0 - - type: seek.backward - emittedAt: 2020-09-15T21:36:29.000Z - from: 30 - to: 0 - - type: pause - emittedAt: 2020-09-15T21:36:29.000Z - at: 21 - - type: resume - emittedAt: 2020-09-15T21:36:30.000Z - at: 21 - - type: seek.forward - emittedAt: 2020-09-15T21:36:30.000Z - from: 0 - to: 21 - - type: pause - emittedAt: 2020-09-15T21:36:33.000Z - at: 20 - - type: resume - emittedAt: 2020-09-15T21:36:33.000Z - at: 20 - - type: seek.backward - emittedAt: 2020-09-15T21:36:33.000Z - from: 24 - to: 20 - - type: pause - emittedAt: 2020-09-15T21:36:39.000Z - at: 17 - - type: resume - emittedAt: 2020-09-15T21:36:39.000Z - at: 17 - - type: seek.forward - emittedAt: 2020-09-15T21:36:39.000Z - from: 17 - to: 17 - - type: pause - emittedAt: 2020-09-15T21:36:41.000Z - at: 19 - - type: ready - emittedAt: 2020-09-17T09:20:47.000Z - at: 0 - - type: ready - emittedAt: 2020-09-17T09:41:01.000Z - at: 0 - - type: ready - emittedAt: 2020-09-17T09:41:08.000Z - at: 0 - - type: play - emittedAt: 2020-09-17T09:41:10.000Z - at: 0 - - type: pause - emittedAt: 2020-09-17T09:41:12.000Z - at: 1 - - type: resume - emittedAt: 2020-09-17T09:41:13.000Z - at: 1 - - type: pause - emittedAt: 2020-09-17T09:41:15.000Z - at: 3 - pagination: - currentPage: 1 - currentPageItems: 25 - pageSize: 25 - pagesTotal: 2 - itemsTotal: 30 - links: - - rel: self - uri: /analytics/sessions/ps5ltuhfsTOeh6bP03Tq5OWc/events?currentPage=1&pageSize=25 - - rel: first - uri: /analytics/sessions/ps5ltuhfsTOeh6bP03Tq5OWc/events?currentPage=1&pageSize=25 - - rel: next - uri: /analytics/sessions/ps5ltuhfsTOeh6bP03Tq5OWc/events?currentPage=2&pageSize=25 - - rel: last - uri: /analytics/sessions/ps5ltuhfsTOeh6bP03Tq5OWc/events?currentPage=2&pageSize=25 - schema: - $ref: '#/components/schemas/raw-statistics-list-player-session-events-response' - description: Success - "404": - content: - application/json: - examples: - response: - value: - type: https://docs.api.video/docs/resourcenot_found - title: The requested resource was not found. - name: videoId - status: 404 - schema: - $ref: '#/components/schemas/not-found' - description: Not Found - security: - - apiKey: [] - summary: List player session events - tags: - - Raw statistics - x-client-action: listSessionEvents - x-group-parameters: true - x-client-paginated: true - x-readme: - code-samples: - - language: go - code: "// First install the go client with \"go get github.com/apivideo/api.video-go-client\"\ - \n// Documentation: https://github.com/apivideo/api.video-go-client/blob/main/docs/RawStatisticsApi.md#listSessionEvents\n\ - \npackage main\n\nimport (\n \"context\"\n \"fmt\"\n \"os\"\n\ - \ apivideosdk \"github.com/apivideo/api.video-go-client\"\n)\n\nfunc\ - \ main() {\n client := apivideosdk.ClientBuilder(\"YOUR_API_KEY\").Build()\n\ - \ // if you rather like to use the sandbox environment:\n // client\ - \ := apivideosdk.SandboxClientBuilder(\"YOUR_SANDBOX_API_KEY\").Build()\n\ - \ req := apivideosdk.RawStatisticsApiListSessionEventsRequest{}\n \ - \ \n req.SessionId(\"psEmFwGQUAXR2lFHj5nDOpy\") // string | A unique\ - \ identifier you can use to reference and track a session with.\n req.CurrentPage(int32(2))\ - \ // int32 | Choose the number of search results to return per page. Minimum\ - \ value: 1 (default to 1)\n req.PageSize(int32(30)) // int32 | Results\ - \ per page. Allowed values 1-100, default is 25. (default to 25)\n\n \ - \ res, err := client.RawStatistics.ListSessionEvents(sessionId string,\ - \ req)\n \n\n if err != nil {\n fmt.Fprintf(os.Stderr, \"\ - Error when calling `RawStatistics.ListSessionEvents``: %v\\\n\", err)\n\ - \ }\n // response from `ListSessionEvents`: RawStatisticsListPlayerSessionEventsResponse\n\ - \ fmt.Fprintf(os.Stdout, \"Response from `RawStatistics.ListSessionEvents`:\ - \ %v\\\n\", res)\n}\n" - - language: node - code: "// First install the \"@api.video/nodejs-client\" npm package\n//\ - \ Documentation: https://github.com/apivideo/api.video-nodejs-client/blob/main/doc/api/RawStatisticsApi.md#listSessionEvents\n\ - \nconst client = new ApiVideoClient({ apiKey: \"YOUR_API_KEY\" });\n\n\ - const sessionId = 'psEmFwGQUAXR2lFHj5nDOpy'; // A unique identifier you\ - \ can use to reference and track a session with.\nconst currentPage =\ - \ 2; // Choose the number of search results to return per page. Minimum\ - \ value: 1\nconst pageSize = 30; // Results per page. Allowed values 1-100,\ - \ default is 25.\n\nconst sessionEvents = await client.rawStatistics.listSessionEvents({\ - \ sessionId, currentPage, pageSize }) " - - language: python - code: | - # First install the api client with "pip install api.video" - # Documentation: https://github.com/apivideo/api.video-python-client/blob/main/docs/RawStatisticsApi.md#listSessionEvents - - import apivideo - from apivideo.api import raw_statistics_api - from apivideo.model.not_found import NotFound - from apivideo.model.raw_statistics_list_player_session_events_response import RawStatisticsListPlayerSessionEventsResponse - from pprint import pprint - - # Enter a context with an instance of the API client - with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: - # Create an instance of the API class - api_instance = raw_statistics_api.RawStatisticsApi(api_client) - session_id = "psEmFwGQUAXR2lFHj5nDOpy" # str | A unique identifier you can use to reference and track a session with. - current_page = 2 # int | Choose the number of search results to return per page. Minimum value: 1 (optional) if omitted the server will use the default value of 1 - page_size = 30 # int | Results per page. Allowed values 1-100, default is 25. (optional) if omitted the server will use the default value of 25 - - # example passing only required values which don't have defaults set - try: - # List player session events - api_response = api_instance.list_session_events(session_id) - pprint(api_response) - except apivideo.ApiException as e: - print("Exception when calling RawStatisticsApi->list_session_events: %s\n" % e) - - # example passing only required values which don't have defaults set - # and optional values - try: - # List player session events - api_response = api_instance.list_session_events(session_id, current_page=current_page, page_size=page_size) - pprint(api_response) - except apivideo.ApiException as e: - print("Exception when calling RawStatisticsApi->list_session_events: %s\n" % e) - - language: java - code: "// First add the \"video.api:java-api-client\" maven dependency to\ - \ your project\n// Documentation: https://github.com/apivideo/api.video-java-client/blob/main/docs/RawStatisticsApi.md#listSessionEvents\n\ - \nimport video.api.client.ApiVideoClient;\nimport video.api.client.api.ApiException;\n\ - import video.api.client.api.models.*;\nimport video.api.client.api.clients.RawStatisticsApi;\n\ - import java.util.*;\n\npublic class Example {\n public static void main(String[]\ - \ args) {\n ApiVideoClient client = new ApiVideoClient(\"YOUR_API_KEY\"\ - );\n // if you rather like to use the sandbox environment:\n //\ - \ ApiVideoClient client = new ApiVideoClient(\"YOUR_SANDBOX_API_KEY\"\ - , ApiVideoClient.Environment.SANDBOX);\n\n RawStatisticsApi apiInstance\ - \ = client.rawStatistics();\n \n String sessionId = \"psEmFwGQUAXR2lFHj5nDOpy\"\ - ; // A unique identifier you can use to reference and track a session\ - \ with.\n Integer currentPage = 1; // Choose the number of search results\ - \ to return per page. Minimum value: 1\n Integer pageSize = 25; //\ - \ Results per page. Allowed values 1-100, default is 25.\n\n try {\n\ - \ Page result = apiInstance.listSessionEvents(sessionId)\n\ - \ .currentPage(currentPage)\n .pageSize(pageSize)\n\ - \ .execute();\n System.out.println(result);\n } catch\ - \ (ApiException e) {\n System.err.println(\"Exception when calling\ - \ RawStatisticsApi#listSessionEvents\");\n System.err.println(\"\ - Status code: \" + e.getCode());\n System.err.println(\"Reason: \"\ - \ + e.getMessage());\n System.err.println(\"Response headers: \"\ - \ + e.getResponseHeaders());\n e.printStackTrace();\n }\n }\n\ - }\n" - - language: csharp - code: | - // First add the "ApiVideo" NuGet package to your project - // Documentation: https://github.com/apivideo/api.video-csharp-client/blob/main/docs/RawStatisticsApi.md#listSessionEvents - - using System.Diagnostics; - using ApiVideo.Client; - - namespace Example - { - public class listSessionEventsExample - { - public static void Main() - { - var basePath = ApiVideoClient.Client.Environment.SANDBOX; - var apiKey = "YOUR_API_KEY"; - - var apiInstance = new ApiVideoClient(apiKey,basePath); - - var sessionId = psEmFwGQUAXR2lFHj5nDOpy; // string | A unique identifier you can use to reference and track a session with. - var currentPage = 2; // int? | Choose the number of search results to return per page. Minimum value: 1 (optional) (default to 1) - var pageSize = 30; // int? | Results per page. Allowed values 1-100, default is 25. (optional) (default to 25) - var apiRawStatisticsInstance = apiInstance.RawStatistics(); - try - { - // List player session events - RawStatisticsListPlayerSessionEventsResponse result = apiRawStatisticsInstance.listSessionEvents(sessionId, currentPage, pageSize); - Debug.WriteLine(result); - } - catch (ApiException e) - { - Debug.Print("Exception when calling RawStatisticsApi.listSessionEvents: " + e.Message ); - Debug.Print("Status Code: "+ e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } - } + ; // Use this query parameter to filter your results to a specific live\ + \ stream in a project that you want analytics for. You must use the `liveStreamId:`\ + \ prefix when specifying a live stream ID.\n Integer currentPage =\ + \ 1; // Choose the number of search results to return per page. Minimum\ + \ value: 1\n Integer pageSize = 25; // Results per page. Allowed values\ + \ 1-100, default is 25.\n\n try {\n Page result\ + \ = apiInstance.getLiveStreamsPlays(from, dimension)\n .to(to)\n\ + \ .filter(filter)\n .currentPage(currentPage)\n\ + \ .pageSize(pageSize)\n .execute();\n System.out.println(result);\n\ + \ } catch (ApiException e) {\n System.err.println(\"Exception\ + \ when calling AnalyticsApi#getLiveStreamsPlays\");\n System.err.println(\"\ + Status code: \" + e.getCode());\n System.err.println(\"Reason: \"\ + \ + e.getMessage());\n System.err.println(\"Response headers: \"\ + \ + e.getResponseHeaders());\n e.printStackTrace();\n }\n }\n\ + }\n" + - language: csharp + code: "using System.Diagnostics;\nusing ApiVideo.Client;\n\nnamespace Example\n\ + {\n public class getLiveStreamsPlaysExample\n {\n public\ + \ static void Main()\n {\n var basePath = ApiVideoClient.Client.Environment.SANDBOX;\n\ + \ var apiKey = \"YOUR_API_KEY\";\n\n var apiInstance\ + \ = new ApiVideoClient(apiKey,basePath);\n\n var from = 2023-06-01;\ + \ // DateTime | Use this query parameter to set the start date for the\ + \ time period that you want analytics for. - The API returns analytics\ + \ data including the day you set in `from`. - The date you set must be\ + \ **within the last 30 days**. - The value you provide must follow the\ + \ `YYYY-MM-DD` format. \n var dimension = browser; // string\ + \ | Use this query parameter to define the dimension that you want analytics\ + \ for. - `liveStreamId`: Returns analytics based on the public live stream\ + \ identifiers. - `emittedAt`: Returns analytics based on the times of\ + \ the play events. The API returns data in specific interval groups. When\ + \ the date period you set in `from` and `to` is less than or equals to\ + \ 2 days, the response for this dimension is grouped in hourly intervals.\ + \ Otherwise, it is grouped in daily intervals. - `country`: Returns analytics\ + \ based on the viewers' country. The list of supported country names are\ + \ based on the [GeoNames public database](https://www.geonames.org/countries/).\ + \ - `deviceType`: Returns analytics based on the type of device used by\ + \ the viewers during the play event. - `operatingSystem`: Returns analytics\ + \ based on the operating system used by the viewers during the play event.\ + \ - `browser`: Returns analytics based on the browser used by the viewers\ + \ during the play event.\n var to = 2023-06-10; // DateTime?\ + \ | Use this optional query parameter to set the end date for the time\ + \ period that you want analytics for. - If you do not specify a `to` date,\ + \ the API returns analytics data starting from the `from` date up until\ + \ today, and excluding today. - The date you set must be **within the\ + \ last 30 days**. - The value you provide must follow the `YYYY-MM-DD`\ + \ format. (optional) \n var filter = liveStreamId:li3q7HxhApxRF1c8F8r6VeaI;\ + \ // string | Use this query parameter to filter your results to a specific\ + \ live stream in a project that you want analytics for. You must use the\ + \ `liveStreamId:` prefix when specifying a live stream ID. (optional)\ + \ \n var currentPage = 2; // int? | Choose the number of search\ + \ results to return per page. Minimum value: 1 (optional) (default to\ + \ 1)\n var pageSize = 30; // int? | Results per page. Allowed\ + \ values 1-100, default is 25. (optional) (default to 25)\n \ + \ var apiAnalyticsInstance = apiInstance.Analytics();\n try\n\ + \ {\n // Get play events for live stream\n \ + \ AnalyticsPlaysResponse result = apiAnalyticsInstance.getLiveStreamsPlays(from,\ + \ dimension, to, filter, currentPage, pageSize);\n Debug.WriteLine(result);\n\ + \ }\n catch (ApiException e)\n {\n \ + \ Debug.Print(\"Exception when calling AnalyticsApi.getLiveStreamsPlays:\ + \ \" + e.Message );\n Debug.Print(\"Status Code: \"+ e.ErrorCode);\n\ + \ Debug.Print(e.StackTrace);\n }\n }\n\ + \ }\n}\n" - language: php code: "rawStatistics()->listSessionEvents($sessionId,\ - \ array(\n 'currentPage' => 2, // Choose the number of search results\ - \ to return per page. Minimum ->setvalue(1)\n 'pageSize' => 30 // Results\ - \ per page. Allowed values 1-100, default is 25.\n)); " + \n// Documentation: https://github.com/apivideo/api.video-php-client/blob/main/docs/Api/AnalyticsApi.md#getLiveStreamsPlays\n\ + \nrequire __DIR__ . '/vendor/autoload.php';\n\n$from = new \\DateTime(\"\ + 2023-06-01\"); // Use this query parameter to set the start date for the\ + \ time period that you want analytics for. - The API returns analytics\ + \ data including the day you set in `from`. - The date you set must be\ + \ **within the last 30 days**. - The value you provide must follow the\ + \ `YYYY-MM-DD` format. \n$dimension = \"liveStreamId\"; // Use this query\ + \ parameter to define the dimension that you want analytics for. - `liveStreamId`:\ + \ Returns analytics based on the public live stream identifiers. - `emittedAt`:\ + \ Returns analytics based on the times of the play events. The API returns\ + \ data in specific interval groups. When the date period you set in `from`\ + \ and `to` is less than or equals to 2 days, the response for this dimension\ + \ is grouped in hourly intervals. Otherwise, it is grouped in daily intervals.\ + \ - `country`: Returns analytics based on the viewers' country. The list\ + \ of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/).\ + \ - `deviceType`: Returns analytics based on the type of device used by\ + \ the viewers during the play event. - `operatingSystem`: Returns analytics\ + \ based on the operating system used by the viewers during the play event.\ + \ - `browser`: Returns analytics based on the browser used by the viewers\ + \ during the play event.\n\n$plays = $client->analytics()->getLiveStreamsPlays($from,\ + \ $dimension, array(\n 'to' => new \\DateTime('2023-06-10'), // Use\ + \ this optional query parameter to set the end date for the time period\ + \ that you want analytics for. - If you do not specify a `to` date, the\ + \ API returns analytics data starting from the `from` date up until today,\ + \ and excluding today. - The date you set must be **within the last 30\ + \ days**. - The value you provide must follow the `YYYY-MM-DD` format.\ + \ \n 'filter' => \"liveStreamId:li3q7HxhApxRF1c8F8r6VeaI\", // Use\ + \ this query parameter to filter your results to a specific live stream\ + \ in a project that you want analytics for. You must use the `liveStreamId:`\ + \ prefix when specifying a live stream ID.\n 'currentPage' => 2, //\ + \ Choose the number of search results to return per page. Minimum value:\ + \ 1\n 'pageSize' => 30 // Results per page. Allowed values 1-100, default\ + \ is 25.\n));" - language: swift - code: | - // First install the api client: https://github.com/apivideo/api.video-ios-client#getting-started - // Documentation: https://github.com/apivideo/api.video-ios-client/blob/main/docs/RawStatisticsAPI.md#listSessionEvents + code: "// The following code samples are still beta. For any issue, please\ + \ report via http://github.com/OpenAPITools/openapi-generator/issues/new\n\ + import ApiVideoClient\n\nlet from = Date() // Date | Use this query parameter\ + \ to set the start date for the time period that you want analytics for.\ + \ - The API returns analytics data including the day you set in `from`.\ + \ - The date you set must be **within the last 30 days**. - The value\ + \ you provide must follow the `YYYY-MM-DD` format. \nlet dimension = \"\ + dimension_example\" // String | Use this query parameter to define the\ + \ dimension that you want analytics for. - `liveStreamId`: Returns analytics\ + \ based on the public live stream identifiers. - `emittedAt`: Returns\ + \ analytics based on the times of the play events. The API returns data\ + \ in specific interval groups. When the date period you set in `from`\ + \ and `to` is less than or equals to 2 days, the response for this dimension\ + \ is grouped in hourly intervals. Otherwise, it is grouped in daily intervals.\ + \ - `country`: Returns analytics based on the viewers' country. The list\ + \ of supported country names are based on the [GeoNames public database](https://www.geonames.org/countries/).\ + \ - `deviceType`: Returns analytics based on the type of device used by\ + \ the viewers during the play event. - `operatingSystem`: Returns analytics\ + \ based on the operating system used by the viewers during the play event.\ + \ - `browser`: Returns analytics based on the browser used by the viewers\ + \ during the play event.\nlet to = Date() // Date | Use this optional\ + \ query parameter to set the end date for the time period that you want\ + \ analytics for. - If you do not specify a `to` date, the API returns\ + \ analytics data starting from the `from` date up until today, and excluding\ + \ today. - The date you set must be **within the last 30 days**. - The\ + \ value you provide must follow the `YYYY-MM-DD` format. (optional)\n\ + let filter = \"filter_example\" // String | Use this query parameter to\ + \ filter your results to a specific live stream in a project that you\ + \ want analytics for. You must use the `liveStreamId:` prefix when specifying\ + \ a live stream ID. (optional)\nlet currentPage = 987 // Int | Choose\ + \ the number of search results to return per page. Minimum value: 1 (optional)\ + \ (default to 1)\nlet pageSize = 987 // Int | Results per page. Allowed\ + \ values 1-100, default is 25. (optional) (default to 25)\n\n// Get play\ + \ events for live stream\nAnalyticsAPI.getLiveStreamsPlays(from: from,\ + \ dimension: dimension, to: to, filter: filter, currentPage: currentPage,\ + \ pageSize: pageSize) { (response, error) in\n guard error == nil else\ + \ {\n print(error)\n return\n }\n\n if (response)\ + \ {\n dump(response)\n }\n}\n" x-accepts: application/json /webhooks: get: @@ -11257,31 +10390,6 @@ components: title: LiveStream type: object live-stream-session: - example: - referrer: - searchTerm: video stream - medium: organic - source: https://google.com - url: https://api.video - os: - name: Microsoft Windows - shortname: W10 - version: Windows 10 - session: - loadedAt: 2019-06-24T11:45:01.109Z - endedAt: 2019-06-24T12:45:01.109Z - sessionId: sessionId - client: - name: Firefox - type: browser - version: "67.0" - location: - country: France - city: Paris - device: - vendor: Dell - model: unknown - type: desktop properties: session: $ref: '#/components/schemas/live-stream-session-session' @@ -11298,12 +10406,6 @@ components: title: LiveStreamSession type: object player-session-event: - example: - emittedAt: 2019-06-24T11:45:01.109Z - at: 0 - from: 6 - to: 1 - type: play properties: type: description: 'Possible values are: ready, play, pause, resume, seek.backward, @@ -12352,214 +11454,6 @@ components: description: The name of the parameter that caused the error. type: string type: object - raw-statistics-list-sessions-response: - example: - pagination: - itemsTotal: 123 - pagesTotal: 7 - pageSize: 20 - currentPage: 3 - currentPageItems: 20 - links: - first: - rel: first - uri: /videos/search?currentPage=1&pageSize=20 - previous: - rel: previous - uri: /videos/search?currentPage=2&pageSize=20 - next: - rel: next - uri: /videos/search?currentPage=4&pageSize=20 - last: - rel: last - uri: /videos/search?currentPage=6&pageSize=20 - data: - - session: - sessionId: psEmFwGQUAXR2lFHj5nDOpy - loadedAt: 2019-06-24T11:45:01.109Z - endedAt: 2019-06-24T11:49:19.243Z - location: - country: France - city: Paris - referrer: - url: https://api.video - medium: organic - source: https://google.com - searchTerm: video encoding hosting and delivery - device: - type: desktop - vendor: Dell - model: unknown - os: - name: Microsoft Windows - shortname: W10 - version: Windows10 - client: - type: browser - name: Firefox - version: "67.0" - - session: - sessionId: psEmFwGQUAXR2lFHj5nDOpy - loadedAt: 2019-06-24T11:45:01.109Z - endedAt: 2019-06-24T11:49:19.243Z - location: - country: France - city: Paris - referrer: - url: https://api.video - medium: organic - source: https://google.com - searchTerm: video encoding hosting and delivery - device: - type: desktop - vendor: Dell - model: unknown - os: - name: Microsoft Windows - shortname: W10 - version: Windows10 - client: - type: browser - name: Firefox - version: "67.0" - properties: - data: - items: - $ref: '#/components/schemas/video-session' - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - data - - pagination - title: VideoSessions - type: object - raw-statistics-list-live-stream-analytics-response: - example: - pagination: - itemsTotal: 123 - pagesTotal: 7 - pageSize: 20 - currentPage: 3 - currentPageItems: 20 - links: - first: - rel: first - uri: /videos/search?currentPage=1&pageSize=20 - previous: - rel: previous - uri: /videos/search?currentPage=2&pageSize=20 - next: - rel: next - uri: /videos/search?currentPage=4&pageSize=20 - last: - rel: last - uri: /videos/search?currentPage=6&pageSize=20 - data: - - referrer: - searchTerm: video stream - medium: organic - source: https://google.com - url: https://api.video - os: - name: Microsoft Windows - shortname: W10 - version: Windows 10 - session: - loadedAt: 2019-06-24T11:45:01.109Z - endedAt: 2019-06-24T12:45:01.109Z - sessionId: sessionId - client: - name: Firefox - type: browser - version: "67.0" - location: - country: France - city: Paris - device: - vendor: Dell - model: unknown - type: desktop - - referrer: - searchTerm: video stream - medium: organic - source: https://google.com - url: https://api.video - os: - name: Microsoft Windows - shortname: W10 - version: Windows 10 - session: - loadedAt: 2019-06-24T11:45:01.109Z - endedAt: 2019-06-24T12:45:01.109Z - sessionId: sessionId - client: - name: Firefox - type: browser - version: "67.0" - location: - country: France - city: Paris - device: - vendor: Dell - model: unknown - type: desktop - properties: - data: - items: - $ref: '#/components/schemas/live-stream-session' - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - data - - pagination - title: LiveStreamSessions - type: object - raw-statistics-list-player-session-events-response: - example: - pagination: - itemsTotal: 123 - pagesTotal: 7 - pageSize: 20 - currentPage: 3 - currentPageItems: 20 - links: - first: - rel: first - uri: /videos/search?currentPage=1&pageSize=20 - previous: - rel: previous - uri: /videos/search?currentPage=2&pageSize=20 - next: - rel: next - uri: /videos/search?currentPage=4&pageSize=20 - last: - rel: last - uri: /videos/search?currentPage=6&pageSize=20 - data: - - emittedAt: 2019-06-24T11:45:01.109Z - at: 0 - from: 6 - to: 1 - type: play - - emittedAt: 2019-06-24T11:45:01.109Z - at: 0 - from: 6 - to: 1 - type: play - properties: - data: - items: - $ref: '#/components/schemas/player-session-event' - type: array - pagination: - $ref: '#/components/schemas/pagination' - required: - - data - - pagination - title: PlayerSessionEvents - type: object webhooks-list-response: example: pagination: @@ -12842,10 +11736,6 @@ components: type: object video-session-os: description: The operating system the viewer is on. - example: - name: Microsoft Windows - shortname: W10 - version: Windows 10 properties: name: description: The name of the operating system. @@ -12910,10 +11800,6 @@ components: title: LiveStreamAssets type: object live-stream-session-session: - example: - loadedAt: 2019-06-24T11:45:01.109Z - endedAt: 2019-06-24T12:45:01.109Z - sessionId: sessionId properties: sessionId: description: A unique identifier for your session. You can use this to track @@ -12935,9 +11821,6 @@ components: type: object live-stream-session-location: description: The location of the viewer of the live stream. - example: - country: France - city: Paris properties: country: description: The country of the viewer of the live stream. @@ -12950,11 +11833,6 @@ components: title: LiveStreamSessionLocation type: object live-stream-session-referrer: - example: - searchTerm: video stream - medium: organic - source: https://google.com - url: https://api.video properties: url: description: The website the viewer of the live stream was referred to in @@ -12980,10 +11858,6 @@ components: type: object live-stream-session-device: description: What type of device the user is on when in the live stream session. - example: - vendor: Dell - model: unknown - type: desktop properties: type: description: What the type is like desktop, laptop, mobile. @@ -13002,10 +11876,6 @@ components: type: object live-stream-session-client: description: What kind of browser the viewer is using for the live stream session. - example: - name: Firefox - type: browser - version: "67.0" properties: name: description: The name of the browser used to view the live stream session. diff --git a/docs/RawStatisticsApi.md b/docs/RawStatisticsApi.md deleted file mode 100644 index 1ccf1d8..0000000 --- a/docs/RawStatisticsApi.md +++ /dev/null @@ -1,237 +0,0 @@ -# RawStatisticsApi - -All URIs are relative to *https://ws.api.video* - -Method | HTTP request | Description -------------- | ------------- | ------------- -[**listLiveStreamSessions**](RawStatisticsApi.md#listLiveStreamSessions) | **GET** /analytics/live-streams/{liveStreamId} | List live stream player sessions -[**listSessionEvents**](RawStatisticsApi.md#listSessionEvents) | **GET** /analytics/sessions/{sessionId}/events | List player session events -[**listVideoSessions**](RawStatisticsApi.md#listVideoSessions) | **GET** /analytics/videos/{videoId} | List video player sessions - - - -# **listLiveStreamSessions** -> RawStatisticsListLiveStreamAnalyticsResponse listLiveStreamSessions(liveStreamId, period).currentPage(currentPage).pageSize(pageSize).execute(); - -List live stream player sessions - -### Example -```java -import video.api.client.ApiVideoClient; -import video.api.client.api.ApiException; -import video.api.client.api.models.*; -import video.api.client.api.clients.RawStatisticsApi; -import java.util.*; - -public class Example { - public static void main(String[] args) { - ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY"); - // if you rather like to use the sandbox environment: - // ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX); - - RawStatisticsApi apiInstance = client.rawStatistics(); - - String liveStreamId = "vi4k0jvEUuaTdRAEjQ4Jfrgz"; // The unique identifier for the live stream you want to retrieve analytics for. - String period = "2019-01-01"; // Period must have one of the following formats: - For a day : "2018-01-01", - For a week: "2018-W01", - For a month: "2018-01" - For a year: "2018" For a range period: - Date range: "2018-01-01/2018-01-15" - Integer currentPage = 1; // Choose the number of search results to return per page. Minimum value: 1 - Integer pageSize = 25; // Results per page. Allowed values 1-100, default is 25. - - try { - Page result = apiInstance.listLiveStreamSessions(liveStreamId) - .period(period) - .currentPage(currentPage) - .pageSize(pageSize) - .execute(); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling RawStatisticsApi#listLiveStreamSessions"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getMessage()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **liveStreamId** | **String**| The unique identifier for the live stream you want to retrieve analytics for. | - **period** | **String**| Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a range period: - Date range: \"2018-01-01/2018-01-15\" | - **currentPage** | **Integer**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **Integer**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] - -### Return type - -[**Page**](pagination.md)<[**LiveStreamSession**](LiveStreamSession.md)> - - -### Authorization - -[API key](../README.md#api-key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | - - -# **listSessionEvents** -> RawStatisticsListPlayerSessionEventsResponse listSessionEvents(sessionId).currentPage(currentPage).pageSize(pageSize).execute(); - -List player session events - -Useful to track and measure video's engagement. - -### Example -```java -import video.api.client.ApiVideoClient; -import video.api.client.api.ApiException; -import video.api.client.api.models.*; -import video.api.client.api.clients.RawStatisticsApi; -import java.util.*; - -public class Example { - public static void main(String[] args) { - ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY"); - // if you rather like to use the sandbox environment: - // ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX); - - RawStatisticsApi apiInstance = client.rawStatistics(); - - String sessionId = "psEmFwGQUAXR2lFHj5nDOpy"; // A unique identifier you can use to reference and track a session with. - Integer currentPage = 1; // Choose the number of search results to return per page. Minimum value: 1 - Integer pageSize = 25; // Results per page. Allowed values 1-100, default is 25. - - try { - Page result = apiInstance.listSessionEvents(sessionId) - .currentPage(currentPage) - .pageSize(pageSize) - .execute(); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling RawStatisticsApi#listSessionEvents"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getMessage()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **sessionId** | **String**| A unique identifier you can use to reference and track a session with. | - **currentPage** | **Integer**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **Integer**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] - -### Return type - -[**Page**](pagination.md)<[**PlayerSessionEvent**](PlayerSessionEvent.md)> - - -### Authorization - -[API key](../README.md#api-key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | - - -# **listVideoSessions** -> RawStatisticsListSessionsResponse listVideoSessions(videoId, period).metadata(metadata).currentPage(currentPage).pageSize(pageSize).execute(); - -List video player sessions - -Retrieve all available user sessions for a specific video. Tutorials that use the [analytics endpoint](https://api.video/blog/endpoints/analytics). - -### Example -```java -import video.api.client.ApiVideoClient; -import video.api.client.api.ApiException; -import video.api.client.api.models.*; -import video.api.client.api.clients.RawStatisticsApi; -import java.util.*; - -public class Example { - public static void main(String[] args) { - ApiVideoClient client = new ApiVideoClient("YOUR_API_KEY"); - // if you rather like to use the sandbox environment: - // ApiVideoClient client = new ApiVideoClient("YOUR_SANDBOX_API_KEY", ApiVideoClient.Environment.SANDBOX); - - RawStatisticsApi apiInstance = client.rawStatistics(); - - String videoId = "vi4k0jvEUuaTdRAEjQ4Prklg"; // The unique identifier for the video you want to retrieve session information for. - String period = "period_example"; // Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 - Map metadata = new HashMap(); // Metadata and Dynamic Metadata filter. Send an array of key value pairs you want to filter sessios with. - Integer currentPage = 1; // Choose the number of search results to return per page. Minimum value: 1 - Integer pageSize = 25; // Results per page. Allowed values 1-100, default is 25. - - try { - Page result = apiInstance.listVideoSessions(videoId) - .period(period) - .metadata(metadata) - .currentPage(currentPage) - .pageSize(pageSize) - .execute(); - System.out.println(result); - } catch (ApiException e) { - System.err.println("Exception when calling RawStatisticsApi#listVideoSessions"); - System.err.println("Status code: " + e.getCode()); - System.err.println("Reason: " + e.getMessage()); - System.err.println("Response headers: " + e.getResponseHeaders()); - e.printStackTrace(); - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **videoId** | **String**| The unique identifier for the video you want to retrieve session information for. | - **period** | **String**| Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 | - **metadata** | [**Map<String, String>**](String.md)| Metadata and [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) filter. Send an array of key value pairs you want to filter sessios with. | [optional] - **currentPage** | **Integer**| Choose the number of search results to return per page. Minimum value: 1 | [optional] [default to 1] - **pageSize** | **Integer**| Results per page. Allowed values 1-100, default is 25. | [optional] [default to 25] - -### Return type - -[**Page**](pagination.md)<[**VideoSession**](VideoSession.md)> - - -### Authorization - -[API key](../README.md#api-key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | Success | - | -**404** | Not Found | - | - diff --git a/docs/RawStatisticsListLiveStreamAnalyticsResponse.md b/docs/RawStatisticsListLiveStreamAnalyticsResponse.md deleted file mode 100644 index c00af8f..0000000 --- a/docs/RawStatisticsListLiveStreamAnalyticsResponse.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# RawStatisticsListLiveStreamAnalyticsResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**List<LiveStreamSession>**](LiveStreamSession.md) | | -**pagination** | [**Pagination**](Pagination.md) | | - - -## Implemented Interfaces - -* Serializable - - diff --git a/docs/RawStatisticsListPlayerSessionEventsResponse.md b/docs/RawStatisticsListPlayerSessionEventsResponse.md deleted file mode 100644 index 954a6a0..0000000 --- a/docs/RawStatisticsListPlayerSessionEventsResponse.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# RawStatisticsListPlayerSessionEventsResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**List<PlayerSessionEvent>**](PlayerSessionEvent.md) | | -**pagination** | [**Pagination**](Pagination.md) | | - - -## Implemented Interfaces - -* Serializable - - diff --git a/docs/RawStatisticsListSessionsResponse.md b/docs/RawStatisticsListSessionsResponse.md deleted file mode 100644 index 096be72..0000000 --- a/docs/RawStatisticsListSessionsResponse.md +++ /dev/null @@ -1,17 +0,0 @@ - - -# RawStatisticsListSessionsResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**List<VideoSession>**](VideoSession.md) | | -**pagination** | [**Pagination**](Pagination.md) | | - - -## Implemented Interfaces - -* Serializable - - diff --git a/src/main/java/video/api/client/ApiVideoClient.java b/src/main/java/video/api/client/ApiVideoClient.java index d7e00c8..c5dfef9 100644 --- a/src/main/java/video/api/client/ApiVideoClient.java +++ b/src/main/java/video/api/client/ApiVideoClient.java @@ -13,7 +13,6 @@ public class ApiVideoClient { private final ChaptersApi chapters; private final LiveStreamsApi liveStreams; private final PlayerThemesApi playerThemes; - private final RawStatisticsApi rawStatistics; private final UploadTokensApi uploadTokens; private final VideosApi videos; private final WatermarksApi watermarks; @@ -88,7 +87,6 @@ public ApiVideoClient(ApiClient apiClient) { this.chapters = new ChaptersApi(this.apiClient); this.liveStreams = new LiveStreamsApi(this.apiClient); this.playerThemes = new PlayerThemesApi(this.apiClient); - this.rawStatistics = new RawStatisticsApi(this.apiClient); this.uploadTokens = new UploadTokensApi(this.apiClient); this.videos = new VideosApi(this.apiClient); this.watermarks = new WatermarksApi(this.apiClient); @@ -140,15 +138,6 @@ public PlayerThemesApi playerThemes() { return this.playerThemes; } - /** - * Get an RawStatisticsApi instance - * - * @return RawStatisticsApi - */ - public RawStatisticsApi rawStatistics() { - return this.rawStatistics; - } - /** * Get an UploadTokensApi instance * diff --git a/src/main/java/video/api/client/api/clients/RawStatisticsApi.java b/src/main/java/video/api/client/api/clients/RawStatisticsApi.java deleted file mode 100644 index adb7bab..0000000 --- a/src/main/java/video/api/client/api/clients/RawStatisticsApi.java +++ /dev/null @@ -1,1087 +0,0 @@ -/* - * api.video Java API client - * api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. - * - * The version of the OpenAPI document: 1 - * Contact: ecosystem@api.video - * - * NOTE: This class is auto generated. - * Do not edit the class manually. - */ - -package video.api.client.api.clients; - -import com.google.gson.reflect.TypeToken; - -import java.io.IOException; - -import video.api.client.api.models.NotFound; -import video.api.client.api.models.RawStatisticsListLiveStreamAnalyticsResponse; -import video.api.client.api.models.RawStatisticsListPlayerSessionEventsResponse; -import video.api.client.api.models.RawStatisticsListSessionsResponse; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import video.api.client.api.models.*; -import video.api.client.api.upload.*; -import video.api.client.api.*; - -public class RawStatisticsApi { - private ApiClient localVarApiClient; - - public RawStatisticsApi(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - /** - * Constructor for RawStatisticsApi production environment where API key is not required. - */ - public RawStatisticsApi() { - this.localVarApiClient = new ApiClient(Environment.PRODUCTION.basePath); - } - - /** - * Constructor for RawStatisticsApi with custom API base path where API key is not required. - * - * @param basePath - * the api base path. Expected Environment.PRODUCTION.basePath (default) or Environment.SANDBOX.basePath. - */ - public RawStatisticsApi(String basePath) { - this.localVarApiClient = new ApiClient(basePath); - } - - /** - * Constructor for RawStatisticsApi with custom API base path where API key is not required. - * - * @param environment - * the target environment. Expected Environment.PRODUCTION (default) or Environment.SANDBOX. - */ - public RawStatisticsApi(Environment environment) { - this.localVarApiClient = new ApiClient(environment.basePath); - } - - /** - * Constructor for RawStatisticsApi with custom API base path - * - * @param apiKey - * the api key to use to authenticate to the API - * @param basePath - * the api base path. Expected Environment.PRODUCTION.basePath (default) or Environment.SANDBOX.basePath. - */ - public RawStatisticsApi(String apiKey, String basePath) { - this.localVarApiClient = new ApiClient(apiKey, basePath); - } - - /** - * Constructor for RawStatisticsApi with custom API base path - * - * @param apiKey - * the api key to use to authenticate to the API - * @param environment - * the target environment. Expected Environment.PRODUCTION (default) or Environment.SANDBOX. - */ - public RawStatisticsApi(String apiKey, Environment environment) { - this.localVarApiClient = new ApiClient(apiKey, environment.basePath); - } - - public ApiClient getApiClient() { - return localVarApiClient; - } - - public void setApiClient(ApiClient apiClient) { - this.localVarApiClient = apiClient; - } - - private okhttp3.Call listLiveStreamSessionsCall(String liveStreamId, String period, Integer currentPage, - Integer pageSize, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/analytics/live-streams/{liveStreamId}".replaceAll("\\{" + "liveStreamId" + "\\}", - localVarApiClient.escapeString(liveStreamId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (period != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("period", period)); - } - - if (currentPage != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("currentPage", currentPage)); - } - - if (pageSize != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageSize", pageSize)); - } - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, - localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call listLiveStreamSessionsValidateBeforeCall(String liveStreamId, String period, - Integer currentPage, Integer pageSize, final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'liveStreamId' is set - if (liveStreamId == null) { - throw new ApiException("Missing the required parameter 'liveStreamId' when calling listLiveStreamSessions"); - } - - // verify the required parameter 'period' is set - if (period == null) { - throw new ApiException("Missing the required parameter 'period' when calling listLiveStreamSessions"); - } - - okhttp3.Call localVarCall = listLiveStreamSessionsCall(liveStreamId, period, currentPage, pageSize, _callback); - return localVarCall; - } - - private ApiResponse listLiveStreamSessionsWithHttpInfo( - String liveStreamId, String period, Integer currentPage, Integer pageSize) throws ApiException { - okhttp3.Call localVarCall = listLiveStreamSessionsValidateBeforeCall(liveStreamId, period, currentPage, - pageSize, null); - Type localVarReturnType = new TypeToken() { - }.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - private okhttp3.Call listLiveStreamSessionsAsync(String liveStreamId, String period, Integer currentPage, - Integer pageSize, final ApiCallback _callback) - throws ApiException { - okhttp3.Call localVarCall = listLiveStreamSessionsValidateBeforeCall(liveStreamId, period, currentPage, - pageSize, _callback); - Type localVarReturnType = new TypeToken() { - }.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - public class APIlistLiveStreamSessionsRequest { - private final String liveStreamId; - private final String period; - private Integer currentPage; - private Integer pageSize; - - private APIlistLiveStreamSessionsRequest(String liveStreamId, String period) { - this.liveStreamId = liveStreamId; - this.period = period; - } - - /** - * Set currentPage - * - * @param currentPage - * Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - * - * @return APIlistLiveStreamSessionsRequest - */ - public APIlistLiveStreamSessionsRequest currentPage(Integer currentPage) { - this.currentPage = currentPage; - return this; - } - - /** - * Set pageSize - * - * @param pageSize - * Results per page. Allowed values 1-100, default is 25. (optional, default to 25) - * - * @return APIlistLiveStreamSessionsRequest - */ - public APIlistLiveStreamSessionsRequest pageSize(Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Build call for listLiveStreamSessions - * - * @param _callback - * ApiCallback API callback - * - * @return Call to execute - * - * @throws ApiException - * If fail to serialize the request body object - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { - return listLiveStreamSessionsCall(liveStreamId, period, currentPage, pageSize, _callback); - } - - /** - * Execute listLiveStreamSessions request - * - * @return RawStatisticsListLiveStreamAnalyticsResponse - * - * @throws ApiException - * If fail to call the API, e.g. server error or cannot deserialize the response body - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public Page execute() throws ApiException { - ApiResponse localVarResp = listLiveStreamSessionsWithHttpInfo( - liveStreamId, period, currentPage, pageSize); - return new Page<>(localVarResp.getData().getData(), localVarResp.getData().getPagination(), () -> { - try { - return copy().currentPage((currentPage == null ? 1 : currentPage) + 1).execute(); - } catch (ApiException e) { - throw new RuntimeException(e); - } - }); // - } - - private APIlistLiveStreamSessionsRequest copy() { - APIlistLiveStreamSessionsRequest copy = new APIlistLiveStreamSessionsRequest(liveStreamId, period); - copy.currentPage(currentPage); - copy.pageSize(pageSize); - return copy; - } - - /** - * Execute listLiveStreamSessions request with HTTP info returned - * - * @return ApiResponse<RawStatisticsListLiveStreamAnalyticsResponse> - * - * @throws ApiException - * If fail to call the API, e.g. server error or cannot deserialize the response body - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public ApiResponse executeWithHttpInfo() throws ApiException { - return listLiveStreamSessionsWithHttpInfo(liveStreamId, period, currentPage, pageSize); - } - - /** - * Execute listLiveStreamSessions request (asynchronously) - * - * @param _callback - * The callback to be executed when the API call finishes - * - * @return The request call - * - * @throws ApiException - * If fail to process the API call, e.g. serializing the request body object - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { - ApiCallback apiCallback = new ApiCallback() { - - @Override - public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { - _callback.onFailure(e, statusCode, responseHeaders); - } - - @Override - public void onSuccess(RawStatisticsListLiveStreamAnalyticsResponse result, int statusCode, - Map> responseHeaders) { - _callback.onSuccess(new Page<>(result.getData(), result.getPagination(), () -> { - try { - return copy().currentPage((currentPage == null ? 1 : currentPage) + 1).execute(); - } catch (ApiException e) { - throw new RuntimeException(e); - } - }), statusCode, responseHeaders); - } - - @Override - public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { - _callback.onUploadProgress(bytesWritten, contentLength, done); - } - - @Override - public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { - _callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - return listLiveStreamSessionsAsync(liveStreamId, period, currentPage, pageSize, apiCallback); - } - } - - /** - * List live stream player sessions - * - * - * @param liveStreamId - * The unique identifier for the live stream you want to retrieve analytics for. (required) - * @param period - * Period must have one of the following formats: - For a day : \"2018-01-01\", - For a week: - * \"2018-W01\", - For a month: \"2018-01\" - For a year: \"2018\" For a - * range period: - Date range: \"2018-01-01/2018-01-15\" (required) - * - * @return APIlistLiveStreamSessionsRequest - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public APIlistLiveStreamSessionsRequest listLiveStreamSessions(String liveStreamId, String period) { - return new APIlistLiveStreamSessionsRequest(liveStreamId, period); - } - - private okhttp3.Call listSessionEventsCall(String sessionId, Integer currentPage, Integer pageSize, - final ApiCallback _callback) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/analytics/sessions/{sessionId}/events".replaceAll("\\{" + "sessionId" + "\\}", - localVarApiClient.escapeString(sessionId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (currentPage != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("currentPage", currentPage)); - } - - if (pageSize != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageSize", pageSize)); - } - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, - localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call listSessionEventsValidateBeforeCall(String sessionId, Integer currentPage, Integer pageSize, - final ApiCallback _callback) throws ApiException { - - // verify the required parameter 'sessionId' is set - if (sessionId == null) { - throw new ApiException("Missing the required parameter 'sessionId' when calling listSessionEvents"); - } - - okhttp3.Call localVarCall = listSessionEventsCall(sessionId, currentPage, pageSize, _callback); - return localVarCall; - } - - private ApiResponse listSessionEventsWithHttpInfo(String sessionId, - Integer currentPage, Integer pageSize) throws ApiException { - okhttp3.Call localVarCall = listSessionEventsValidateBeforeCall(sessionId, currentPage, pageSize, null); - Type localVarReturnType = new TypeToken() { - }.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - private okhttp3.Call listSessionEventsAsync(String sessionId, Integer currentPage, Integer pageSize, - final ApiCallback _callback) throws ApiException { - okhttp3.Call localVarCall = listSessionEventsValidateBeforeCall(sessionId, currentPage, pageSize, _callback); - Type localVarReturnType = new TypeToken() { - }.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - public class APIlistSessionEventsRequest { - private final String sessionId; - private Integer currentPage; - private Integer pageSize; - - private APIlistSessionEventsRequest(String sessionId) { - this.sessionId = sessionId; - } - - /** - * Set currentPage - * - * @param currentPage - * Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - * - * @return APIlistSessionEventsRequest - */ - public APIlistSessionEventsRequest currentPage(Integer currentPage) { - this.currentPage = currentPage; - return this; - } - - /** - * Set pageSize - * - * @param pageSize - * Results per page. Allowed values 1-100, default is 25. (optional, default to 25) - * - * @return APIlistSessionEventsRequest - */ - public APIlistSessionEventsRequest pageSize(Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Build call for listSessionEvents - * - * @param _callback - * ApiCallback API callback - * - * @return Call to execute - * - * @throws ApiException - * If fail to serialize the request body object - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { - return listSessionEventsCall(sessionId, currentPage, pageSize, _callback); - } - - /** - * Execute listSessionEvents request - * - * @return RawStatisticsListPlayerSessionEventsResponse - * - * @throws ApiException - * If fail to call the API, e.g. server error or cannot deserialize the response body - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public Page execute() throws ApiException { - ApiResponse localVarResp = listSessionEventsWithHttpInfo( - sessionId, currentPage, pageSize); - return new Page<>(localVarResp.getData().getData(), localVarResp.getData().getPagination(), () -> { - try { - return copy().currentPage((currentPage == null ? 1 : currentPage) + 1).execute(); - } catch (ApiException e) { - throw new RuntimeException(e); - } - }); // - } - - private APIlistSessionEventsRequest copy() { - APIlistSessionEventsRequest copy = new APIlistSessionEventsRequest(sessionId); - copy.currentPage(currentPage); - copy.pageSize(pageSize); - return copy; - } - - /** - * Execute listSessionEvents request with HTTP info returned - * - * @return ApiResponse<RawStatisticsListPlayerSessionEventsResponse> - * - * @throws ApiException - * If fail to call the API, e.g. server error or cannot deserialize the response body - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public ApiResponse executeWithHttpInfo() throws ApiException { - return listSessionEventsWithHttpInfo(sessionId, currentPage, pageSize); - } - - /** - * Execute listSessionEvents request (asynchronously) - * - * @param _callback - * The callback to be executed when the API call finishes - * - * @return The request call - * - * @throws ApiException - * If fail to process the API call, e.g. serializing the request body object - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { - ApiCallback apiCallback = new ApiCallback() { - - @Override - public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { - _callback.onFailure(e, statusCode, responseHeaders); - } - - @Override - public void onSuccess(RawStatisticsListPlayerSessionEventsResponse result, int statusCode, - Map> responseHeaders) { - _callback.onSuccess(new Page<>(result.getData(), result.getPagination(), () -> { - try { - return copy().currentPage((currentPage == null ? 1 : currentPage) + 1).execute(); - } catch (ApiException e) { - throw new RuntimeException(e); - } - }), statusCode, responseHeaders); - } - - @Override - public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { - _callback.onUploadProgress(bytesWritten, contentLength, done); - } - - @Override - public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { - _callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - return listSessionEventsAsync(sessionId, currentPage, pageSize, apiCallback); - } - } - - /** - * List player session events - * - * Useful to track and measure video's engagement. - * - * @param sessionId - * A unique identifier you can use to reference and track a session with. (required) - * - * @return APIlistSessionEventsRequest - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public APIlistSessionEventsRequest listSessionEvents(String sessionId) { - return new APIlistSessionEventsRequest(sessionId); - } - - private okhttp3.Call listVideoSessionsCall(String videoId, String period, Map metadata, - Integer currentPage, Integer pageSize, final ApiCallback _callback) throws ApiException { - Object localVarPostBody = null; - - // create path and map variables - String localVarPath = "/analytics/videos/{videoId}".replaceAll("\\{" + "videoId" + "\\}", - localVarApiClient.escapeString(videoId.toString())); - - List localVarQueryParams = new ArrayList(); - List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarCookieParams = new HashMap(); - Map localVarFormParams = new HashMap(); - - if (period != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("period", period)); - } - - if (metadata != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("metadata", metadata)); - } - - if (currentPage != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("currentPage", currentPage)); - } - - if (pageSize != null) { - localVarQueryParams.addAll(localVarApiClient.parameterToPair("pageSize", pageSize)); - } - - final String[] localVarAccepts = { "application/json" }; - final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) { - localVarHeaderParams.put("Accept", localVarAccept); - } - - final String[] localVarContentTypes = { - - }; - final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); - localVarHeaderParams.put("Content-Type", localVarContentType); - - return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, - localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, _callback); - } - - @SuppressWarnings("rawtypes") - private okhttp3.Call listVideoSessionsValidateBeforeCall(String videoId, String period, - Map metadata, Integer currentPage, Integer pageSize, final ApiCallback _callback) - throws ApiException { - - // verify the required parameter 'videoId' is set - if (videoId == null) { - throw new ApiException("Missing the required parameter 'videoId' when calling listVideoSessions"); - } - - // verify the required parameter 'period' is set - if (period == null) { - throw new ApiException("Missing the required parameter 'period' when calling listVideoSessions"); - } - - okhttp3.Call localVarCall = listVideoSessionsCall(videoId, period, metadata, currentPage, pageSize, _callback); - return localVarCall; - } - - private ApiResponse listVideoSessionsWithHttpInfo(String videoId, String period, - Map metadata, Integer currentPage, Integer pageSize) throws ApiException { - okhttp3.Call localVarCall = listVideoSessionsValidateBeforeCall(videoId, period, metadata, currentPage, - pageSize, null); - Type localVarReturnType = new TypeToken() { - }.getType(); - return localVarApiClient.execute(localVarCall, localVarReturnType); - } - - private okhttp3.Call listVideoSessionsAsync(String videoId, String period, Map metadata, - Integer currentPage, Integer pageSize, final ApiCallback _callback) - throws ApiException { - okhttp3.Call localVarCall = listVideoSessionsValidateBeforeCall(videoId, period, metadata, currentPage, - pageSize, _callback); - Type localVarReturnType = new TypeToken() { - }.getType(); - localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); - return localVarCall; - } - - public class APIlistVideoSessionsRequest { - private final String videoId; - private final String period; - private Map metadata; - private Integer currentPage; - private Integer pageSize; - - private APIlistVideoSessionsRequest(String videoId, String period) { - this.videoId = videoId; - this.period = period; - } - - /** - * Set metadata - * - * @param metadata - * Metadata and [Dynamic Metadata](https://api.video/blog/endpoints/dynamic-metadata) filter. Send an - * array of key value pairs you want to filter sessios with. (optional) - * - * @return APIlistVideoSessionsRequest - */ - public APIlistVideoSessionsRequest metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Set currentPage - * - * @param currentPage - * Choose the number of search results to return per page. Minimum value: 1 (optional, default to 1) - * - * @return APIlistVideoSessionsRequest - */ - public APIlistVideoSessionsRequest currentPage(Integer currentPage) { - this.currentPage = currentPage; - return this; - } - - /** - * Set pageSize - * - * @param pageSize - * Results per page. Allowed values 1-100, default is 25. (optional, default to 25) - * - * @return APIlistVideoSessionsRequest - */ - public APIlistVideoSessionsRequest pageSize(Integer pageSize) { - this.pageSize = pageSize; - return this; - } - - /** - * Build call for listVideoSessions - * - * @param _callback - * ApiCallback API callback - * - * @return Call to execute - * - * @throws ApiException - * If fail to serialize the request body object - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { - return listVideoSessionsCall(videoId, period, metadata, currentPage, pageSize, _callback); - } - - /** - * Execute listVideoSessions request - * - * @return RawStatisticsListSessionsResponse - * - * @throws ApiException - * If fail to call the API, e.g. server error or cannot deserialize the response body - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public Page execute() throws ApiException { - ApiResponse localVarResp = listVideoSessionsWithHttpInfo(videoId, period, - metadata, currentPage, pageSize); - return new Page<>(localVarResp.getData().getData(), localVarResp.getData().getPagination(), () -> { - try { - return copy().currentPage((currentPage == null ? 1 : currentPage) + 1).execute(); - } catch (ApiException e) { - throw new RuntimeException(e); - } - }); // - } - - private APIlistVideoSessionsRequest copy() { - APIlistVideoSessionsRequest copy = new APIlistVideoSessionsRequest(videoId, period); - copy.metadata(metadata); - copy.currentPage(currentPage); - copy.pageSize(pageSize); - return copy; - } - - /** - * Execute listVideoSessions request with HTTP info returned - * - * @return ApiResponse<RawStatisticsListSessionsResponse> - * - * @throws ApiException - * If fail to call the API, e.g. server error or cannot deserialize the response body - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public ApiResponse executeWithHttpInfo() throws ApiException { - return listVideoSessionsWithHttpInfo(videoId, period, metadata, currentPage, pageSize); - } - - /** - * Execute listVideoSessions request (asynchronously) - * - * @param _callback - * The callback to be executed when the API call finishes - * - * @return The request call - * - * @throws ApiException - * If fail to process the API call, e.g. serializing the request body object - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { - ApiCallback apiCallback = new ApiCallback() { - - @Override - public void onFailure(ApiException e, int statusCode, Map> responseHeaders) { - _callback.onFailure(e, statusCode, responseHeaders); - } - - @Override - public void onSuccess(RawStatisticsListSessionsResponse result, int statusCode, - Map> responseHeaders) { - _callback.onSuccess(new Page<>(result.getData(), result.getPagination(), () -> { - try { - return copy().currentPage((currentPage == null ? 1 : currentPage) + 1).execute(); - } catch (ApiException e) { - throw new RuntimeException(e); - } - }), statusCode, responseHeaders); - } - - @Override - public void onUploadProgress(long bytesWritten, long contentLength, boolean done) { - _callback.onUploadProgress(bytesWritten, contentLength, done); - } - - @Override - public void onDownloadProgress(long bytesRead, long contentLength, boolean done) { - _callback.onDownloadProgress(bytesRead, contentLength, done); - } - }; - return listVideoSessionsAsync(videoId, period, metadata, currentPage, pageSize, apiCallback); - } - } - - /** - * List video player sessions - * - * Retrieve all available user sessions for a specific video. Tutorials that use the [analytics - * endpoint](https://api.video/blog/endpoints/analytics). - * - * @param videoId - * The unique identifier for the video you want to retrieve session information for. (required) - * @param period - * Period must have one of the following formats: - For a day : 2018-01-01, - For a week: 2018-W01, - For - * a month: 2018-01 - For a year: 2018 For a range period: - Date range: 2018-01-01/2018-01-15 (required) - * - * @return APIlistVideoSessionsRequest - * - * @http.response.details - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Status CodeDescriptionResponse Headers
200Success-
404Not Found-
- */ - public APIlistVideoSessionsRequest listVideoSessions(String videoId, String period) { - return new APIlistVideoSessionsRequest(videoId, period); - } -} diff --git a/src/main/java/video/api/client/api/models/RawStatisticsListLiveStreamAnalyticsResponse.java b/src/main/java/video/api/client/api/models/RawStatisticsListLiveStreamAnalyticsResponse.java deleted file mode 100644 index 74d0fd8..0000000 --- a/src/main/java/video/api/client/api/models/RawStatisticsListLiveStreamAnalyticsResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * api.video Java API client - * api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. - * - * The version of the OpenAPI document: 1 - * Contact: ecosystem@api.video - * - * NOTE: This class is auto generated. - * Do not edit the class manually. - */ - -package video.api.client.api.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import video.api.client.api.models.LiveStreamSession; -import video.api.client.api.models.Pagination; -import java.io.Serializable; - -/** - * RawStatisticsListLiveStreamAnalyticsResponse - */ - -public class RawStatisticsListLiveStreamAnalyticsResponse implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private List data = new ArrayList<>(); - - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; - - public RawStatisticsListLiveStreamAnalyticsResponse data(List data) { - this.data = data; - return this; - } - - public RawStatisticsListLiveStreamAnalyticsResponse addDataItem(LiveStreamSession dataItem) { - this.data.add(dataItem); - return this; - } - - /** - * Get data - * - * @return data - **/ - @ApiModelProperty(required = true, value = "") - - public List getData() { - return data; - } - - public void setData(List data) { - this.data = data; - } - - public RawStatisticsListLiveStreamAnalyticsResponse pagination(Pagination pagination) { - this.pagination = pagination; - return this; - } - - /** - * Get pagination - * - * @return pagination - **/ - @ApiModelProperty(required = true, value = "") - - public Pagination getPagination() { - return pagination; - } - - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RawStatisticsListLiveStreamAnalyticsResponse rawStatisticsListLiveStreamAnalyticsResponse = (RawStatisticsListLiveStreamAnalyticsResponse) o; - return Objects.equals(this.data, rawStatisticsListLiveStreamAnalyticsResponse.data) - && Objects.equals(this.pagination, rawStatisticsListLiveStreamAnalyticsResponse.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(data, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RawStatisticsListLiveStreamAnalyticsResponse {\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/src/main/java/video/api/client/api/models/RawStatisticsListPlayerSessionEventsResponse.java b/src/main/java/video/api/client/api/models/RawStatisticsListPlayerSessionEventsResponse.java deleted file mode 100644 index ca9d871..0000000 --- a/src/main/java/video/api/client/api/models/RawStatisticsListPlayerSessionEventsResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * api.video Java API client - * api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. - * - * The version of the OpenAPI document: 1 - * Contact: ecosystem@api.video - * - * NOTE: This class is auto generated. - * Do not edit the class manually. - */ - -package video.api.client.api.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import video.api.client.api.models.Pagination; -import video.api.client.api.models.PlayerSessionEvent; -import java.io.Serializable; - -/** - * RawStatisticsListPlayerSessionEventsResponse - */ - -public class RawStatisticsListPlayerSessionEventsResponse implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private List data = new ArrayList<>(); - - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; - - public RawStatisticsListPlayerSessionEventsResponse data(List data) { - this.data = data; - return this; - } - - public RawStatisticsListPlayerSessionEventsResponse addDataItem(PlayerSessionEvent dataItem) { - this.data.add(dataItem); - return this; - } - - /** - * Get data - * - * @return data - **/ - @ApiModelProperty(required = true, value = "") - - public List getData() { - return data; - } - - public void setData(List data) { - this.data = data; - } - - public RawStatisticsListPlayerSessionEventsResponse pagination(Pagination pagination) { - this.pagination = pagination; - return this; - } - - /** - * Get pagination - * - * @return pagination - **/ - @ApiModelProperty(required = true, value = "") - - public Pagination getPagination() { - return pagination; - } - - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RawStatisticsListPlayerSessionEventsResponse rawStatisticsListPlayerSessionEventsResponse = (RawStatisticsListPlayerSessionEventsResponse) o; - return Objects.equals(this.data, rawStatisticsListPlayerSessionEventsResponse.data) - && Objects.equals(this.pagination, rawStatisticsListPlayerSessionEventsResponse.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(data, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RawStatisticsListPlayerSessionEventsResponse {\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/src/main/java/video/api/client/api/models/RawStatisticsListSessionsResponse.java b/src/main/java/video/api/client/api/models/RawStatisticsListSessionsResponse.java deleted file mode 100644 index 4c64ac1..0000000 --- a/src/main/java/video/api/client/api/models/RawStatisticsListSessionsResponse.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * api.video Java API client - * api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. - * - * The version of the OpenAPI document: 1 - * Contact: ecosystem@api.video - * - * NOTE: This class is auto generated. - * Do not edit the class manually. - */ - -package video.api.client.api.models; - -import java.util.Objects; -import java.util.Arrays; -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import video.api.client.api.models.Pagination; -import video.api.client.api.models.VideoSession; -import java.io.Serializable; - -/** - * RawStatisticsListSessionsResponse - */ - -public class RawStatisticsListSessionsResponse implements Serializable { - private static final long serialVersionUID = 1L; - - public static final String SERIALIZED_NAME_DATA = "data"; - @SerializedName(SERIALIZED_NAME_DATA) - private List data = new ArrayList<>(); - - public static final String SERIALIZED_NAME_PAGINATION = "pagination"; - @SerializedName(SERIALIZED_NAME_PAGINATION) - private Pagination pagination; - - public RawStatisticsListSessionsResponse data(List data) { - this.data = data; - return this; - } - - public RawStatisticsListSessionsResponse addDataItem(VideoSession dataItem) { - this.data.add(dataItem); - return this; - } - - /** - * Get data - * - * @return data - **/ - @ApiModelProperty(required = true, value = "") - - public List getData() { - return data; - } - - public void setData(List data) { - this.data = data; - } - - public RawStatisticsListSessionsResponse pagination(Pagination pagination) { - this.pagination = pagination; - return this; - } - - /** - * Get pagination - * - * @return pagination - **/ - @ApiModelProperty(required = true, value = "") - - public Pagination getPagination() { - return pagination; - } - - public void setPagination(Pagination pagination) { - this.pagination = pagination; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - RawStatisticsListSessionsResponse rawStatisticsListSessionsResponse = (RawStatisticsListSessionsResponse) o; - return Objects.equals(this.data, rawStatisticsListSessionsResponse.data) - && Objects.equals(this.pagination, rawStatisticsListSessionsResponse.pagination); - } - - @Override - public int hashCode() { - return Objects.hash(data, pagination); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class RawStatisticsListSessionsResponse {\n"); - sb.append(" data: ").append(toIndentedString(data)).append("\n"); - sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - -} diff --git a/src/test/java/video/api/client/api/clients/RawStatisticsApiTest.java b/src/test/java/video/api/client/api/clients/RawStatisticsApiTest.java deleted file mode 100644 index a6ea3ae..0000000 --- a/src/test/java/video/api/client/api/clients/RawStatisticsApiTest.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * api.video Java API client - * api.video is an API that encodes on the go to facilitate immediate playback, enhancing viewer streaming experiences across multiple devices and platforms. You can stream live or on-demand online videos within minutes. - * - * The version of the OpenAPI document: 1 - * Contact: ecosystem-team@api.video - * - * NOTE: This class is auto generated. - * Do not edit the class manually. - */ - -package video.api.client.api.clients; - -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Nested; -import org.junit.jupiter.api.Test; -import video.api.client.api.ApiException; -import video.api.client.api.models.*; - -import java.time.OffsetDateTime; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatNoException; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -/** - * API tests for RawStatisticsApi - */ -@DisplayName("RawStatisticsApi") -public class RawStatisticsApiTest extends AbstractApiTest { - - private final RawStatisticsApi api = apiClientMock.rawStatistics(); - - @Nested - @DisplayName("listLiveStreamSessions") - class listLiveStreamSessions { - private static final String PAYLOADS_PATH = "/payloads/rawstatistics/listLiveStreamSessions/"; - - @Test - @DisplayName("required parameters") - public void requiredParametersTest() { - answerOnAnyRequest(201, "{}"); - - assertThatThrownBy(() -> api.listLiveStreamSessions(null, "2022-01").execute()) - .isInstanceOf(ApiException.class) - .hasMessage("Missing the required parameter 'liveStreamId' when calling listLiveStreamSessions"); - - assertThatNoException() - .isThrownBy(() -> api.listLiveStreamSessions("vi4k0jvEUuaTdRAEjQ4Jfrgz", "2022-01").execute()); - } - - @Test - @DisplayName("200 response") - public void responseWithStatus200Test() throws ApiException { - answerOnAnyRequest(200, readResourceFile(PAYLOADS_PATH + "responses/200.json")); - - Page page = api.listLiveStreamSessions("vi4k0jvEUuaTdRAEjQ4Jfrgz", "2022-01").execute(); - - assertThat(page.getCurrentPage()).isEqualTo(1); - assertThat(page.getPageSize()).isEqualTo(25); - assertThat(page.getPagesTotal()).isEqualTo(1); - assertThat(page.getCurrentPageItems()).isEqualTo(1); - - assertThat(page.getItems()).containsExactlyInAnyOrder(new LiveStreamSession() - .session(new LiveStreamSessionSession().sessionId("ps4zRWVOv2If2vzKJLMr3jQo") - .loadedAt(OffsetDateTime.parse("2018-09-11T13:04:37.89Z")) - .endedAt(OffsetDateTime.parse("2018-09-11T14:47:22.186Z"))) - .location(new LiveStreamSessionLocation().country("France").city("Paris")) - .referrer(new LiveStreamSessionReferrer().url("unknown").medium("unknown").source("unknown") - .searchTerm("unknown")) - .device(new LiveStreamSessionDevice().type("desktop").vendor("unknown").model("unknown")) - .os(new VideoSessionOs().name("unknown").shortname("unknown").version("unknown")) - .client(new LiveStreamSessionClient().type("browser").name("Firefox").version("61.0"))); - } - - @Test - @DisplayName("404 response") - public void responseWithStatus404Test() throws ApiException { - answerOnAnyRequest(404, readResourceFile(PAYLOADS_PATH + "responses/404.json")); - - assertThatThrownBy(() -> api.listLiveStreamSessions("vi4k0jvEUuaTdRAEjQ4Jfrgz", "2022-01").execute()) - .isInstanceOf(ApiException.class) - .satisfies(e -> assertThat(((ApiException) e).getCode()).isEqualTo(404)) - .hasMessage("The requested resource was not found."); - } - } - - @Nested - @DisplayName("listSessionEvents") - class listSessionEvents { - private static final String PAYLOADS_PATH = "/payloads/rawstatistics/listSessionEvents/"; - - @Test - @DisplayName("required parameters") - public void requiredParametersTest() { - answerOnAnyRequest(201, "{}"); - - assertThatThrownBy(() -> api.listSessionEvents(null).execute()).isInstanceOf(ApiException.class) - .hasMessage("Missing the required parameter 'sessionId' when calling listSessionEvents"); - - assertThatNoException().isThrownBy(() -> api.listSessionEvents("psEmFwGQUAXR2lFHj5nDOpy").execute()); - } - - @Test - @DisplayName("200 response") - public void responseWithStatus200Test() throws ApiException { - answerOnAnyRequest(200, readResourceFile(PAYLOADS_PATH + "responses/200.json")); - - Page page = api.listSessionEvents("psEmFwGQUAXR2lFHj5nDOpy").execute(); - - assertThat(page.getCurrentPage()).isEqualTo(1); - assertThat(page.getCurrentPageItems()).isEqualTo(25); - assertThat(page.getPageSize()).isEqualTo(25); - assertThat(page.getPagesTotal()).isEqualTo(2); - assertThat(page.getItemsTotal()).isEqualTo(30); - - assertThat(page.getItems()).containsExactlyInAnyOrder( - new PlayerSessionEvent().type("ready").emittedAt(OffsetDateTime.parse("2020-09-15T09:47:42+00:00")) - .at(0), - new PlayerSessionEvent().type("play").emittedAt(OffsetDateTime.parse("2020-09-15T21:35:57+00:00")) - .at(0), - new PlayerSessionEvent().type("pause").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:05+00:00")) - .at(7), - new PlayerSessionEvent().type("resume").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:19+00:00")) - .at(21), - new PlayerSessionEvent().type("seek.forward") - .emittedAt(OffsetDateTime.parse("2020-09-15T21:36:19+00:00")).from(7).to(21), - new PlayerSessionEvent().type("end").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:28+00:00")) - .at(30), - new PlayerSessionEvent().type("play").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:29+00:00")) - .at(0), - new PlayerSessionEvent().type("seek.backward") - .emittedAt(OffsetDateTime.parse("2020-09-15T21:36:29+00:00")).from(30).to(0), - new PlayerSessionEvent().type("pause").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:29+00:00")) - .at(21), - new PlayerSessionEvent().type("resume").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:30+00:00")) - .at(21), - new PlayerSessionEvent().type("seek.forward") - .emittedAt(OffsetDateTime.parse("2020-09-15T21:36:30+00:00")).from(0).to(21), - new PlayerSessionEvent().type("pause").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:33+00:00")) - .at(20), - new PlayerSessionEvent().type("resume").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:33+00:00")) - .at(20), - new PlayerSessionEvent().type("seek.backward") - .emittedAt(OffsetDateTime.parse("2020-09-15T21:36:33+00:00")).from(24).to(20), - new PlayerSessionEvent().type("pause").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:39+00:00")) - .at(17), - new PlayerSessionEvent().type("resume").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:39+00:00")) - .at(17), - new PlayerSessionEvent().type("seek.forward") - .emittedAt(OffsetDateTime.parse("2020-09-15T21:36:39+00:00")).from(17).to(17), - new PlayerSessionEvent().type("pause").emittedAt(OffsetDateTime.parse("2020-09-15T21:36:41+00:00")) - .at(19), - new PlayerSessionEvent().type("ready").emittedAt(OffsetDateTime.parse("2020-09-17T09:20:47+00:00")) - .at(0), - new PlayerSessionEvent().type("ready").emittedAt(OffsetDateTime.parse("2020-09-17T09:41:01+00:00")) - .at(0), - new PlayerSessionEvent().type("ready").emittedAt(OffsetDateTime.parse("2020-09-17T09:41:08+00:00")) - .at(0), - new PlayerSessionEvent().type("play").emittedAt(OffsetDateTime.parse("2020-09-17T09:41:10+00:00")) - .at(0), - new PlayerSessionEvent().type("pause").emittedAt(OffsetDateTime.parse("2020-09-17T09:41:12+00:00")) - .at(1), - new PlayerSessionEvent().type("resume").emittedAt(OffsetDateTime.parse("2020-09-17T09:41:13+00:00")) - .at(1), - new PlayerSessionEvent().type("pause").emittedAt(OffsetDateTime.parse("2020-09-17T09:41:15+00:00")) - .at(3)); - } - - @Test - @DisplayName("404 response") - public void responseWithStatus404Test() throws ApiException { - answerOnAnyRequest(404, readResourceFile(PAYLOADS_PATH + "responses/404.json")); - - assertThatThrownBy(() -> api.listSessionEvents("psEmFwGQUAXR2lFHj5nDOpy").execute()) - .isInstanceOf(ApiException.class) - .satisfies(e -> assertThat(((ApiException) e).getCode()).isEqualTo(404)) - .hasMessage("The requested resource was not found."); - } - } - - @Nested - @DisplayName("listVideoSessions") - class listVideoSessions { - private static final String PAYLOADS_PATH = "/payloads/rawstatistics/listVideoSessions/"; - - @Test - @DisplayName("required parameters") - public void requiredParametersTest() { - answerOnAnyRequest(201, "{}"); - - assertThatThrownBy(() -> api.listVideoSessions(null, "2022-01").execute()).isInstanceOf(ApiException.class) - .hasMessage("Missing the required parameter 'videoId' when calling listVideoSessions"); - - assertThatNoException() - .isThrownBy(() -> api.listVideoSessions("vi4k0jvEUuaTdRAEjQ4Prklg", "2022-01").execute()); - } - - @Test - @DisplayName("200 response") - public void responseWithStatus200Test() throws ApiException { - answerOnAnyRequest(200, readResourceFile(PAYLOADS_PATH + "responses/200.json")); - - Page page = api.listVideoSessions("vi4k0jvEUuaTdRAEjQ4Prklg", "2022-01").execute(); - - assertThat(page.getCurrentPage()).isEqualTo(1); - assertThat(page.getPageSize()).isEqualTo(25); - assertThat(page.getPagesTotal()).isEqualTo(1); - assertThat(page.getCurrentPageItems()).isEqualTo(1); - - assertThat(page.getItems()).containsExactlyInAnyOrder(new VideoSession() - .session(new VideoSessionSession().sessionId("psEmFwGQUAXR2lFHj5nDOpy") - .loadedAt(OffsetDateTime.parse("2019-06-24T11:45:01.109Z")) - .endedAt(OffsetDateTime.parse("2019-06-24T11:49:19.243Z"))) - .location(new VideoSessionLocation().country("France").city("Paris")) - .referrer(new VideoSessionReferrer().url("https://api.video").medium("organic") - .source("https://google.com").searchTerm("video encoding hosting and delivery")) - .device(new VideoSessionDevice().type("desktop").vendor("Dell").model("unknown")) - .os(new VideoSessionOs().name("Microsoft Windows").shortname("W10").version("Windows10")) - .client(new VideoSessionClient().type("browser").name("Firefox").version("67.0"))); - } - - @Test - @DisplayName("404 response") - public void responseWithStatus404Test() throws ApiException { - answerOnAnyRequest(404, readResourceFile(PAYLOADS_PATH + "responses/404.json")); - - assertThatThrownBy(() -> api.listVideoSessions("vi4k0jvEUuaTdRAEjQ4Prklg", "2022-01").execute()) - .isInstanceOf(ApiException.class) - .satisfies(e -> assertThat(((ApiException) e).getCode()).isEqualTo(404)) - .hasMessage("The requested resource was not found."); - } - } - -} diff --git a/src/test/java/video/api/integration/RawStatisticsTest.java b/src/test/java/video/api/integration/RawStatisticsTest.java deleted file mode 100644 index efcdb48..0000000 --- a/src/test/java/video/api/integration/RawStatisticsTest.java +++ /dev/null @@ -1,100 +0,0 @@ -package video.api.integration; - -import okhttp3.*; -import org.junit.jupiter.api.*; -import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; -import video.api.client.api.ApiException; -import video.api.client.api.models.Metadata; -import video.api.client.api.models.Page; -import video.api.client.api.models.Video; -import video.api.client.api.models.VideoCreationPayload; -import video.api.client.api.models.VideoSession; - -import java.io.File; -import java.io.IOException; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.TimeZone; - -import static org.assertj.core.api.Assertions.assertThat; - -@DisplayName("Integration tests of api.videos() methods") -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -@EnabledIfEnvironmentVariable(named = "INTEGRATION_TESTS_API_KEY", matches = ".+") -public class RawStatisticsTest extends AbstractTest { - - @Nested - @DisplayName("list video sessions") - @TestMethodOrder(MethodOrderer.OrderAnnotation.class) - @TestInstance(TestInstance.Lifecycle.PER_CLASS) - @Disabled - class ListVideoSessions { - private Video testVideo; - - @BeforeAll - public void createVideo() throws ApiException { - this.testVideo = apiClient.videos() - .create(new VideoCreationPayload().title("[Java-SDK-tests] list video sessions") - .metadata(Collections.singletonList(new Metadata("user", "__user__")))); - } - - @Test - @Order(1) - public void uploadVideo() throws ApiException { - File mp4File = new File(this.getClass().getResource("/assets/558k.mp4").getFile()); - apiClient.videos().upload(testVideo.getVideoId(), mp4File); - } - - @Test - @Order(2) - public void logSession() throws IOException { - TimeZone tz = TimeZone.getTimeZone("UTC"); - DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'.000Z'"); // Quoted "Z" to indicate UTC, no - // timezone offset - df.setTimeZone(tz); - String nowAsISO = df.format(new Date()); - String json = "{\"emitted_at\": \"" + nowAsISO + "\",\n" - + " \"session\": {\"loaded_at\": \"" + nowAsISO + "\", \"referrer\": \"\",\n" - + " \"metadata\": [{\"user\": \"python_test\"}], \"video_id\": \"" - + this.testVideo.getVideoId() + "\"},\n" - + " \"events\": [{\"type\": \"ready\", \"emitted_at\": \"" + nowAsISO - + "\", \"at\": 0}]}"; - - RequestBody body = RequestBody.create(MediaType.parse("application/json"), json); - - Request request = new Request.Builder().url("https://collector.api.video/vod?t=1623232157262").post(body) - .build(); - - OkHttpClient client = new OkHttpClient.Builder().build(); - - Call call = client.newCall(request); - Response response = call.execute(); - } - - @Test - @Order(3) - public void retrieveSessionWithMetadata() throws ApiException, InterruptedException { - Map metadata = new HashMap<>(); - metadata.put("user", "python_test"); - Thread.sleep(5000); - Page sessions = apiClient.rawStatistics() - .listVideoSessions(this.testVideo.getVideoId(), "2022-01").metadata(metadata).execute(); - - assertThat(sessions.getItems()).hasSize(1); - assertThat(sessions.getItems().get(0).getSession().getMetadata()).hasSize(1); - assertThat(sessions.getItems().get(0).getSession().getMetadata().get(0).getKey()).isEqualTo("user"); - assertThat(sessions.getItems().get(0).getSession().getMetadata().get(0).getValue()) - .isEqualTo("python_test"); - } - - @AfterAll - public void deleteVideo() throws ApiException { - apiClient.videos().delete(testVideo.getVideoId()); - } - } - -} diff --git a/src/test/resources/payloads/rawstatistics/listLiveStreamSessions/responses/200.json b/src/test/resources/payloads/rawstatistics/listLiveStreamSessions/responses/200.json deleted file mode 100644 index 140bfd1..0000000 --- a/src/test/resources/payloads/rawstatistics/listLiveStreamSessions/responses/200.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "data" : [ { - "session" : { - "sessionId" : "ps4zRWVOv2If2vzKJLMr3jQo", - "loadedAt" : "2018-09-11T13:04:37.890Z", - "endedAt" : "2018-09-11T14:47:22.186Z" - }, - "location" : { - "country" : "France", - "city" : "Paris" - }, - "referrer" : { - "url" : "unknown", - "medium" : "unknown", - "source" : "unknown", - "searchTerm" : "unknown" - }, - "device" : { - "type" : "desktop", - "vendor" : "unknown", - "model" : "unknown" - }, - "os" : { - "name" : "unknown", - "shortname" : "unknown", - "version" : "unknown" - }, - "client" : { - "type" : "browser", - "name" : "Firefox", - "version" : "61.0" - } - } ], - "pagination" : { - "currentPage" : 1, - "currentPageItems" : 1, - "pageSize" : 25, - "pagesTotal" : 1, - "itemsTotal" : 1, - "links" : [ { - "rel" : "self", - "uri" : "/analytics/sessions/ps4zRWVOv2If2vzKJLMr3jQo?currentPage=1&pageSize=25" - }, { - "rel" : "first", - "uri" : "/analytics/sessions/ps4zRWVOv2If2vzKJLMr3jQo?currentPage=1&pageSize=25" - }, { - "rel" : "last", - "uri" : "/analytics/sessions/ps4zRWVOv2If2vzKJLMr3jQo?currentPage=1&pageSize=25" - } ] - } -} \ No newline at end of file diff --git a/src/test/resources/payloads/rawstatistics/listLiveStreamSessions/responses/404.json b/src/test/resources/payloads/rawstatistics/listLiveStreamSessions/responses/404.json deleted file mode 100644 index 9efa63b..0000000 --- a/src/test/resources/payloads/rawstatistics/listLiveStreamSessions/responses/404.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type" : "https://docs.api.video/docs/resourcenot_found", - "title" : "The requested resource was not found.", - "name" : "liveStreamId", - "status" : 404 -} \ No newline at end of file diff --git a/src/test/resources/payloads/rawstatistics/listSessionEvents/responses/200.json b/src/test/resources/payloads/rawstatistics/listSessionEvents/responses/200.json deleted file mode 100644 index e444836..0000000 --- a/src/test/resources/payloads/rawstatistics/listSessionEvents/responses/200.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "data" : [ { - "type" : "ready", - "emittedAt" : "2020-09-15T09:47:42.000Z", - "at" : 0 - }, { - "type" : "play", - "emittedAt" : "2020-09-15T21:35:57.000Z", - "at" : 0 - }, { - "type" : "pause", - "emittedAt" : "2020-09-15T21:36:05.000Z", - "at" : 7 - }, { - "type" : "resume", - "emittedAt" : "2020-09-15T21:36:19.000Z", - "at" : 21 - }, { - "type" : "seek.forward", - "emittedAt" : "2020-09-15T21:36:19.000Z", - "from" : 7, - "to" : 21 - }, { - "type" : "end", - "emittedAt" : "2020-09-15T21:36:28.000Z", - "at" : 30 - }, { - "type" : "play", - "emittedAt" : "2020-09-15T21:36:29.000Z", - "at" : 0 - }, { - "type" : "seek.backward", - "emittedAt" : "2020-09-15T21:36:29.000Z", - "from" : 30, - "to" : 0 - }, { - "type" : "pause", - "emittedAt" : "2020-09-15T21:36:29.000Z", - "at" : 21 - }, { - "type" : "resume", - "emittedAt" : "2020-09-15T21:36:30.000Z", - "at" : 21 - }, { - "type" : "seek.forward", - "emittedAt" : "2020-09-15T21:36:30.000Z", - "from" : 0, - "to" : 21 - }, { - "type" : "pause", - "emittedAt" : "2020-09-15T21:36:33.000Z", - "at" : 20 - }, { - "type" : "resume", - "emittedAt" : "2020-09-15T21:36:33.000Z", - "at" : 20 - }, { - "type" : "seek.backward", - "emittedAt" : "2020-09-15T21:36:33.000Z", - "from" : 24, - "to" : 20 - }, { - "type" : "pause", - "emittedAt" : "2020-09-15T21:36:39.000Z", - "at" : 17 - }, { - "type" : "resume", - "emittedAt" : "2020-09-15T21:36:39.000Z", - "at" : 17 - }, { - "type" : "seek.forward", - "emittedAt" : "2020-09-15T21:36:39.000Z", - "from" : 17, - "to" : 17 - }, { - "type" : "pause", - "emittedAt" : "2020-09-15T21:36:41.000Z", - "at" : 19 - }, { - "type" : "ready", - "emittedAt" : "2020-09-17T09:20:47.000Z", - "at" : 0 - }, { - "type" : "ready", - "emittedAt" : "2020-09-17T09:41:01.000Z", - "at" : 0 - }, { - "type" : "ready", - "emittedAt" : "2020-09-17T09:41:08.000Z", - "at" : 0 - }, { - "type" : "play", - "emittedAt" : "2020-09-17T09:41:10.000Z", - "at" : 0 - }, { - "type" : "pause", - "emittedAt" : "2020-09-17T09:41:12.000Z", - "at" : 1 - }, { - "type" : "resume", - "emittedAt" : "2020-09-17T09:41:13.000Z", - "at" : 1 - }, { - "type" : "pause", - "emittedAt" : "2020-09-17T09:41:15.000Z", - "at" : 3 - } ], - "pagination" : { - "currentPage" : 1, - "currentPageItems" : 25, - "pageSize" : 25, - "pagesTotal" : 2, - "itemsTotal" : 30, - "links" : [ { - "rel" : "self", - "uri" : "/analytics/sessions/ps5ltuhfsTOeh6bP03Tq5OWc/events?currentPage=1&pageSize=25" - }, { - "rel" : "first", - "uri" : "/analytics/sessions/ps5ltuhfsTOeh6bP03Tq5OWc/events?currentPage=1&pageSize=25" - }, { - "rel" : "next", - "uri" : "/analytics/sessions/ps5ltuhfsTOeh6bP03Tq5OWc/events?currentPage=2&pageSize=25" - }, { - "rel" : "last", - "uri" : "/analytics/sessions/ps5ltuhfsTOeh6bP03Tq5OWc/events?currentPage=2&pageSize=25" - } ] - } -} \ No newline at end of file diff --git a/src/test/resources/payloads/rawstatistics/listSessionEvents/responses/404.json b/src/test/resources/payloads/rawstatistics/listSessionEvents/responses/404.json deleted file mode 100644 index 69b4332..0000000 --- a/src/test/resources/payloads/rawstatistics/listSessionEvents/responses/404.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type" : "https://docs.api.video/docs/resourcenot_found", - "title" : "The requested resource was not found.", - "name" : "videoId", - "status" : 404 -} \ No newline at end of file diff --git a/src/test/resources/payloads/rawstatistics/listVideoSessions/responses/200.json b/src/test/resources/payloads/rawstatistics/listVideoSessions/responses/200.json deleted file mode 100644 index 9c2c683..0000000 --- a/src/test/resources/payloads/rawstatistics/listVideoSessions/responses/200.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "data" : [ { - "session" : { - "sessionId" : "psEmFwGQUAXR2lFHj5nDOpy", - "loadedAt" : "2019-06-24T11:45:01.109Z", - "endedAt" : "2019-06-24T11:49:19.243Z" - }, - "location" : { - "country" : "France", - "city" : "Paris" - }, - "referrer" : { - "url" : "https://api.video", - "medium" : "organic", - "source" : "https://google.com", - "searchTerm" : "video encoding hosting and delivery" - }, - "device" : { - "type" : "desktop", - "vendor" : "Dell", - "model" : "unknown" - }, - "os" : { - "name" : "Microsoft Windows", - "shortname" : "W10", - "version" : "Windows10" - }, - "client" : { - "type" : "browser", - "name" : "Firefox", - "version" : "67.0" - } - } ], - "pagination" : { - "currentPage" : 1, - "currentPageItems" : 1, - "pageSize" : 25, - "pagesTotal" : 1, - "itemsTotal" : 1, - "links" : [ { - "rel" : "self", - "uri" : "/analytics/sessions/psEmFwGQUAXR2lFHj5nDOpy?currentPage=1&pageSize=25" - }, { - "rel" : "first", - "uri" : "/analytics/sessions/psEmFwGQUAXR2lFHj5nDOpy?currentPage=1&pageSize=25" - }, { - "rel" : "last", - "uri" : "/analytics/sessions/psEmFwGQUAXR2lFHj5nDOpy?currentPage=1&pageSize=25" - } ] - } -} \ No newline at end of file diff --git a/src/test/resources/payloads/rawstatistics/listVideoSessions/responses/404.json b/src/test/resources/payloads/rawstatistics/listVideoSessions/responses/404.json deleted file mode 100644 index 69b4332..0000000 --- a/src/test/resources/payloads/rawstatistics/listVideoSessions/responses/404.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type" : "https://docs.api.video/docs/resourcenot_found", - "title" : "The requested resource was not found.", - "name" : "videoId", - "status" : 404 -} \ No newline at end of file