-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
39,410 additions
and
6,948 deletions.
There are no files selected for viewing
60 changes: 36 additions & 24 deletions
60
docusaurus/video/docusaurus/docs/api/_common_/CallEventModels.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.