Skip to content

Commit

Permalink
Handle pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierapivideo committed May 30, 2024
1 parent 952a00f commit 2fe98c0
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private void handlePagination(List<Object> allModels, CodegenOperation operation
System.out.println(model);
model.allVars.stream().filter(v -> v.name.equals("Data")).findFirst().ifPresent(codegenProperty -> {
Map<String, String> paginationProperties = new HashMap<>();
paginationProperties.put("type", codegenProperty.complexType);
paginationProperties.put("type", codegenProperty.dataType.substring(codegenProperty.dataType.indexOf("<") + 1, codegenProperty.dataType.indexOf(">")));
paginationProperties.put("getter", codegenProperty.getter);
operation.vendorExtensions.put("x-pagination", paginationProperties);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private void handlePagination(List<Object> allModels, CodegenOperation operation
System.out.println(model);
model.allVars.stream().filter(v -> v.name.equals("data")).findFirst().ifPresent(codegenProperty -> {
Map<String, String> paginationProperties = new HashMap<>();
paginationProperties.put("type", codegenProperty.complexType);
paginationProperties.put("type", codegenProperty.dataType.substring(codegenProperty.dataType.indexOf("<") + 1, codegenProperty.dataType.indexOf(">")));
paginationProperties.put("getter", codegenProperty.getter);
operation.vendorExtensions.put("x-pagination", paginationProperties);
});
Expand Down
43 changes: 37 additions & 6 deletions oas_apivideo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11663,6 +11663,8 @@ paths:
schema:
type: string
example: filterBy[continent]=EU&filterBy[country]=FR&filterBy[browser]=Safari&filterBy[browser]=Firefox
- $ref: '#/components/parameters/current-page'
- $ref: '#/components/parameters/page-size'
responses:
'200':
headers:
Expand Down Expand Up @@ -11785,6 +11787,7 @@ paths:
x-client-action: getAggregatedMetrics
x-group-parameters: true
x-client-paginated: true
x-optional-object: true
x-doctave:
code-samples:
'/data/buckets/{metric}/{breakdown}':
Expand Down Expand Up @@ -11891,6 +11894,8 @@ paths:
schema:
type: string
example: filterBy[continent]=EU&filterBy[country]=FR&filterBy[browser]=Safari&filterBy[browser]=Firefox
- $ref: '#/components/parameters/current-page'
- $ref: '#/components/parameters/page-size'
responses:
'200':
headers:
Expand Down Expand Up @@ -12028,6 +12033,7 @@ paths:
x-client-action: getMetricsBreakdown
x-group-parameters: true
x-client-paginated: true
x-optional-object: true
x-doctave:
code-samples:
'/data/timeseries/{metric}':
Expand Down Expand Up @@ -12121,6 +12127,26 @@ paths:
schema:
type: string
example: filterBy[continent]=EU&filterBy[country]=FR&filterBy[browser]=Safari&filterBy[browser]=Firefox
- name: currentPage
in: query
description: 'Choose the number of search results to return per page. Minimum value: 1'
required: false
style: form
explode: true
schema:
type: integer
default: 1
example: 2
- name: pageSize
in: query
description: 'Results per page. Allowed values 1-100, default is 25.'
required: false
style: form
explode: true
schema:
type: integer
default: 25
example: 30
responses:
'200':
headers:
Expand Down Expand Up @@ -15593,7 +15619,7 @@ components:
description: The name of the parameter that caused the error.
type: string
analytics-aggregated-metrics-response:
title: Analytics v2.0 response for aggregated metrics
title: AggregatedMetrics
type: object
properties:
context:
Expand Down Expand Up @@ -15635,12 +15661,17 @@ components:
format: date-time
example: '2024-05-29T11:15:07+00:00'
data:
type: number
format: float
example: '356.2'
items:
type: number
format: float
example: '356.2'
type: array
pagination:
$ref: '#/components/schemas/pagination'
required:
- context
- data
- context
- data
- pagination
analytics-metrics-breakdown-response:
title: Analytics v2.0 response for metrics breakdown by dimension
type: object
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* 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: [email protected]
*
* NOTE: This class is auto generated.
* Do not edit the class manually.
*/

package video.api.client.api.clients;

import org.junit.jupiter.api.DisplayName;

/**
* API tests for AnalyticsV20BetaApi
*/
@DisplayName("AnalyticsV20BetaApi")
public class AnalyticsV20BetaApiTest extends AbstractApiTest {

}

0 comments on commit 2fe98c0

Please sign in to comment.