Skip to content

Commit

Permalink
Merge branch 'add-summary-feature-docs' of https://github.com/apivide…
Browse files Browse the repository at this point in the history
…o/api.video-api-client-generator into add-summary-feature-docs
  • Loading branch information
szekelyzol committed Oct 21, 2024
2 parents e1b91f7 + 771e90c commit cc00ba2
Show file tree
Hide file tree
Showing 6 changed files with 409 additions and 60 deletions.
104 changes: 77 additions & 27 deletions oas_apivideo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1059,24 +1059,9 @@ paths:
requestBody:
required: true
content:
applictaion/json:
application/json:
schema:
type: object
properties:
videoId:
type: string
description: Create a summary of a video using the video ID.
example: vi4k0jvEUuaTdRAEjQ4Jfrgz
origin:
type: string
enum: [auto]
description: |-
Use this parameter to define how the API generates the summary. The only allowed value is `auto`, which means that the API generates a summary automatically.

If you do not set this parameter, **the API will not generate a summary automatically**.

In this case, `sourceStatus` will return `missing`, and you have to manually add a summary using the `PATCH /summaries/{summaryId}/source` endpoint operation.
example: auto
$ref: '#/components/schemas/summary-creation-payload'
responses:
'201':
headers:
Expand All @@ -1096,7 +1081,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/summary-object'
$ref: '#/components/schemas/summary'
examples:
Summary created:
value:
Expand Down Expand Up @@ -1142,6 +1127,29 @@ paths:
x-client-description:
default: 'List all summarries for your videos in a project.'
operationId: GET_summaries
parameters:
- name: sortBy
in: query
description: 'Allowed: createdAt. You can search by the time watermark were created at.'
required: false
style: form
explode: true
schema:
type: string
example: createdAt
- name: sortOrder
in: query
description: 'Allowed: asc, desc. asc is ascending and sorts from A to Z. desc is descending and sorts from Z to A.'
required: false
style: form
explode: true
schema:
type: string
example: asc
- $ref: '#/components/parameters/current-page'
- $ref: '#/components/parameters/page-size'
x-group-parameters: true
x-client-paginated: true
responses:
'200':
headers:
Expand All @@ -1161,7 +1169,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/get-summaries'
$ref: '#/components/schemas/summaries-list-response'
examples:
List all summaries:
value:
Expand All @@ -1177,7 +1185,20 @@ paths:
updatedAt: '2024-07-15T23:36:07+00:00'
videoId: 'vibaBXK3N7yrRcxcMt95678'
origin: auto
sourceStatus: waiting
sourceStatus: waiting
pagination:
currentPage: 1
pageSize: 25
pagesTotal: 1
itemsTotal: 11
currentPageItems: 11
links:
- rel: self
uri: 'https://ws.api.video/summaries?currentPage=1'
- rel: first
uri: 'https://ws.api.video/summaries?currentPage=1'
- rel: last
uri: 'https://ws.api.video/summaries?currentPage=1'
/summaries/{summaryId}:
delete:
tags:
Expand Down Expand Up @@ -1222,7 +1243,7 @@ paths:
- Summaries
summary: Get summary details
description: Get all details for a summary
x-client-action: get
x-client-action: getSummarySource
x-client-description:
default: 'Get all details for a summary.'
operationId: GET_summaries-summaryId-source
Expand Down Expand Up @@ -1308,7 +1329,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/update-summary-request'
$ref: '#/components/schemas/summary-update-payload'
responses:
'201':
headers:
Expand Down Expand Up @@ -15817,7 +15838,26 @@ components:
- If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video.
required:
- title
update-summary-request:
summary-creation-payload:
required:
- videoId
type: object
properties:
videoId:
type: string
description: Create a summary of a video using the video ID.
example: vi4k0jvEUuaTdRAEjQ4Jfrgz
origin:
type: string
enum: [auto]
description: |-
Use this parameter to define how the API generates the summary. The only allowed value is `auto`, which means that the API generates a summary automatically.

If you do not set this parameter, **the API will not generate a summary automatically**.

In this case, `sourceStatus` will return `missing`, and you have to manually add a summary using the `PATCH /summaries/{summaryId}/source` endpoint operation.
example: auto
summary-update-payload:
type: object
properties:
title:
Expand Down Expand Up @@ -15877,15 +15917,21 @@ components:
- Quantum theory is complicated.
- Schrödinger's cat is neither dead, nor alive.
- Quantum computers are super cool.
get-summaries:
summaries-list-response:
type: object
title: Summaries
properties:
data:
description: An array of summary objects.
type: array
description: An array of summary objects.
items:
$ref: '#/components/schemas/summary-object'
summary-object:
$ref: '#/components/schemas/summary'
pagination:
$ref: '#/components/schemas/pagination'
required:
- data
- pagination
summary:
type: object
properties:
summaryId:
Expand All @@ -15907,6 +15953,10 @@ components:
description: The unique identifier of the video object.
example: 'vi4k0jvEUuaTdRAEjQ4Prklg'
origin:
type: string
enum:
- api
- auto
description: |-
Returns the origin of how the summary was created.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/*
* 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 video.api.client.api.ApiException;
import video.api.client.api.models.*;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

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 SummariesApi
*/
@DisplayName("SummariesApi")
public class SummariesApiTest extends AbstractApiTest {

private final SummariesApi api = apiClientMock.summaries();

@Nested
@DisplayName("create")
class create {
private static final String PAYLOADS_PATH = "/payloads/summaries/create/";

@Test
@DisplayName("required parameters")
public void requiredParametersTest() {
answerOnAnyRequest(201, "{}");

assertThatThrownBy(() -> api.create(new SummaryCreationPayload()))
.hasMessage("Missing the required parameter 'summaryCreationPayload.videoId' when calling create");

assertThatThrownBy(() -> api.create(null))
.hasMessage("Missing the required parameter 'summaryCreationPayload' when calling create");

assertThatNoException().isThrownBy(() -> api.create(new SummaryCreationPayload().videoId("123")));
}

@Test
@DisplayName("409 response")
public void responseWithStatus409Test() throws ApiException {
answerOnAnyRequest(409, readResourceFile(PAYLOADS_PATH + "responses/409.json"));

assertThatThrownBy(() -> api.create(new SummaryCreationPayload().videoId("123")))
.isInstanceOf(ApiException.class)
.satisfies(e -> assertThat(((ApiException) e).getCode()).isEqualTo(409))
.hasMessage("A summary already exists or is being created on this video.");

}
}

@Nested
@DisplayName("get")
class get {
private static final String PAYLOADS_PATH = "/payloads/summaries/getSummarySource/";

@Test
@DisplayName("required parameters")
public void requiredParametersTest() {
answerOnAnyRequest(201, "{}");

assertThatNoException().isThrownBy(() -> api.getSummarySource("summary_1CGHWuXjhxmeH4WiZ51234"));

assertThatThrownBy(() -> api.getSummarySource(null))
.hasMessage("Missing the required parameter 'summaryId' when calling getSummarySource");
}

@Test
@DisplayName("404 response")
public void responseWithStatus404Test() throws ApiException {
answerOnAnyRequest(404, readResourceFile(PAYLOADS_PATH + "responses/404.json"));

assertThatThrownBy(() -> api.getSummarySource("summary_1CGHWuXjhxmeH4WiZ51234"))
.isInstanceOf(ApiException.class)
.satisfies(e -> assertThat(((ApiException) e).getCode()).isEqualTo(404))
.hasMessage("The requested resource was not found.");

}
}

@Nested
@DisplayName("update")
class update {
private static final String PAYLOADS_PATH = "/payloads/summaries/update/";

@Test
@DisplayName("required parameters")
public void requiredParametersTest() {
answerOnAnyRequest(201, "{}");

assertThatNoException()
.isThrownBy(() -> api.update("summary_1CGHWuXjhxmeH4WiZ51234", new SummaryUpdatePayload()));
assertThatThrownBy(() -> api.update(null, null))
.hasMessage("Missing the required parameter 'summaryId' when calling update");
}

@Test
@DisplayName("409 response")
public void responseWithStatus409Test() throws ApiException {
answerOnAnyRequest(409, readResourceFile(PAYLOADS_PATH + "responses/409.json"));

assertThatThrownBy(() -> api.update("summary_1CGHWuXjhxmeH4WiZ51234", new SummaryUpdatePayload()))
.isInstanceOf(ApiException.class)
.satisfies(e -> assertThat(((ApiException) e).getCode()).isEqualTo(409))
.hasMessage("A summary already exists or is being created on this video.");
}
}

@Nested
@DisplayName("delete")
class delete {
private static final String PAYLOADS_PATH = "/payloads/summaries/delete/";

@Test
@DisplayName("required parameters")
public void requiredParametersTest() {
answerOnAnyRequest(201, "{}");

assertThatNoException().isThrownBy(() -> api.delete("summary_1CGHWuXjhxmeH4WiZ51234"));
assertThatThrownBy(() -> api.delete(null))
.hasMessage("Missing the required parameter 'summaryId' when calling delete");
}
}

@Nested
@DisplayName("list")
class list {
private static final String PAYLOADS_PATH = "/payloads/summaries/list/";

@Test
@DisplayName("required parameters")
public void requiredParametersTest() {
answerOnAnyRequest(201, "{}");

assertThatNoException().isThrownBy(() -> api.list());
assertThatNoException().isThrownBy(() -> api.list());
//
}

@Test
@DisplayName("200 response")
public void responseWithStatus200Test() throws ApiException {
answerOnAnyRequest(200, readResourceFile(PAYLOADS_PATH + "responses/200.json"));

Page<Summary> execute = api.list().execute();

}
}

}
Loading

0 comments on commit cc00ba2

Please sign in to comment.