Skip to content

Commit

Permalink
Parse events from client side API
Browse files Browse the repository at this point in the history
  • Loading branch information
szuperaz committed May 13, 2024
1 parent cb1aeea commit c906efb
Show file tree
Hide file tree
Showing 3 changed files with 39,410 additions and 6,948 deletions.
60 changes: 36 additions & 24 deletions docusaurus/video/docusaurus/docs/api/_common_/CallEventModels.jsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
import React from 'react';
import OpenApiModels from './OpenApiModels';
import apiJson from '../video-openapi.json';
import apiJson from '../video-client-openapi.json';

const filter = (apiJson) =>
Object.keys(apiJson.components.schemas).filter(
(key) =>
apiJson.components.schemas[key]['x-stream-event-call-type'] === true,
);
Object.keys(apiJson.components.schemas).filter(
(key) =>
apiJson.components.schemas[key]['x-stream-event-call-type'] === true,
);

const events = filter(apiJson).map(key => {
const type = apiJson.components.schemas[key].properties.type.default || '-';
const description = apiJson.components.schemas[key].description || '-';
const events = filter(apiJson).map((key) => {
const type = apiJson.components.schemas[key].properties.type.default || '-';
const description = apiJson.components.schemas[key].description || '-';

return {key, type, description}
return { key, type, description };
});

events.sort((e1, e2) => e1.type < e2.type ? -1 : (e1.type > e2.type ? 1 : 0));
events.sort((e1, e2) => (e1.type < e2.type ? -1 : e1.type > e2.type ? 1 : 0));

const CallEventModels = () => {
return <React.Fragment>
<table>
<thead>
<th>Name</th>
<th>Description</th>
</thead>
{events.map(event => <tr>
<td><a href={'#' + event.key}><code>{event.type}</code></a></td>
<td>{event.description}</td>
</tr>)}
</table>
<OpenApiModels modelFilter={filter} recursive={true}></OpenApiModels>
return (
<React.Fragment>
<table>
<thead>
<th>Name</th>
<th>Description</th>
</thead>
{events.map((event) => (
<tr>
<td>
<a href={'#' + event.key}>
<code>{event.type}</code>
</a>
</td>
<td>{event.description}</td>
</tr>
))}
</table>
<OpenApiModels
modelFilter={filter}
recursive={true}
apiJson={apiJson}
></OpenApiModels>
</React.Fragment>
}
);
};

export default CallEventModels;
export default CallEventModels;
Loading

0 comments on commit c906efb

Please sign in to comment.