Added documents.list endpoint to documentation (fixed some bad formatting)
Updated collection parameter Increased fetch to 10 records, 5 looks dumb on larger screens
This commit is contained in:
@ -58,8 +58,8 @@ class CollectionScene extends Component {
|
|||||||
this.props.ui.setActiveCollection(collection);
|
this.props.ui.setActiveCollection(collection);
|
||||||
this.collection = collection;
|
this.collection = collection;
|
||||||
await this.props.documents.fetchRecentlyModified({
|
await this.props.documents.fetchRecentlyModified({
|
||||||
limit: 5,
|
limit: 10,
|
||||||
collectionId: collection.id,
|
collection: collection.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,12 +15,12 @@ const authDocumentForUser = (ctx, document) => {
|
|||||||
const router = new Router();
|
const router = new Router();
|
||||||
|
|
||||||
router.post('documents.list', auth(), pagination(), async ctx => {
|
router.post('documents.list', auth(), pagination(), async ctx => {
|
||||||
let { sort = 'updatedAt', direction, collectionId } = ctx.body;
|
let { sort = 'updatedAt', direction, collection } = ctx.body;
|
||||||
if (direction !== 'ASC') direction = 'DESC';
|
if (direction !== 'ASC') direction = 'DESC';
|
||||||
|
|
||||||
const user = ctx.state.user;
|
const user = ctx.state.user;
|
||||||
let where = { teamId: user.teamId };
|
let where = { teamId: user.teamId };
|
||||||
if (collectionId) where = { ...where, atlasId: collectionId };
|
if (collection) where = { ...where, atlasId: collection };
|
||||||
|
|
||||||
const userId = user.id;
|
const userId = user.id;
|
||||||
const starredScope = { method: ['withStarred', userId] };
|
const starredScope = { method: ['withStarred', userId] };
|
||||||
|
@ -128,9 +128,9 @@ export default function Pricing() {
|
|||||||
<p>
|
<p>
|
||||||
To authenticate with Outline API, you can supply the API key as a
|
To authenticate with Outline API, you can supply the API key as a
|
||||||
header (<code>Authorization: Bearer YOUR_API_KEY</code>) or as part of
|
header (<code>Authorization: Bearer YOUR_API_KEY</code>) or as part of
|
||||||
the payload using <code>token</code> parameter. If you're making{' '}
|
the payload using <code>token</code> parameter. If you’re making{' '}
|
||||||
<code>GET</code> requests, header based authentication is recommended
|
<code>GET</code> requests, header based authentication is recommended
|
||||||
so that your keys don't leak into logs.
|
so that your keys don’t leak into logs.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@ -241,7 +241,7 @@ export default function Pricing() {
|
|||||||
|
|
||||||
<Method method="collections.delete" label="Delete a collection">
|
<Method method="collections.delete" label="Delete a collection">
|
||||||
<Description>
|
<Description>
|
||||||
Delete a collection and all of its documents. This action can`t be
|
Delete a collection and all of its documents. This action can’t be
|
||||||
undone so please be careful.
|
undone so please be careful.
|
||||||
</Description>
|
</Description>
|
||||||
<Arguments>
|
<Arguments>
|
||||||
@ -249,6 +249,16 @@ export default function Pricing() {
|
|||||||
</Arguments>
|
</Arguments>
|
||||||
</Method>
|
</Method>
|
||||||
|
|
||||||
|
<Method method="documents.list" label="List your documents">
|
||||||
|
<Description>List all your documents.</Description>
|
||||||
|
<Arguments pagination>
|
||||||
|
<Argument
|
||||||
|
id="collection"
|
||||||
|
description="Collection id to filter by"
|
||||||
|
/>
|
||||||
|
</Arguments>
|
||||||
|
</Method>
|
||||||
|
|
||||||
<Method method="documents.info" label="Get a document">
|
<Method method="documents.info" label="Get a document">
|
||||||
<Description>
|
<Description>
|
||||||
<p>
|
<p>
|
||||||
@ -487,26 +497,6 @@ type MethodProps = {
|
|||||||
children: React.Element<*>,
|
children: React.Element<*>,
|
||||||
};
|
};
|
||||||
|
|
||||||
const Method = (props: MethodProps) => {
|
|
||||||
const children = React.Children.toArray(props.children);
|
|
||||||
const description = children.find(child => child.type === Description);
|
|
||||||
const apiArgs = children.find(child => child.type === Arguments);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<MethodContainer>
|
|
||||||
<h3 id={props.method}>
|
|
||||||
<code>{props.method}</code> - {props.label}
|
|
||||||
</h3>
|
|
||||||
<div>{description}</div>
|
|
||||||
<Request>HTTP request & arguments</Request>
|
|
||||||
<p>
|
|
||||||
<code>{`${process.env.URL}/api/${props.method}`}</code>
|
|
||||||
</p>
|
|
||||||
{apiArgs}
|
|
||||||
</MethodContainer>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Description = (props: { children: React.Element<*> }) => (
|
const Description = (props: { children: React.Element<*> }) => (
|
||||||
<p>{props.children}</p>
|
<p>{props.children}</p>
|
||||||
);
|
);
|
||||||
@ -536,6 +526,26 @@ const Arguments = (props: ArgumentsProps) => (
|
|||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const Method = (props: MethodProps) => {
|
||||||
|
const children = React.Children.toArray(props.children);
|
||||||
|
const description = children.find(child => child.type === Description);
|
||||||
|
const apiArgs = children.find(child => child.type === Arguments);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MethodContainer>
|
||||||
|
<h3 id={props.method}>
|
||||||
|
<code>{props.method}</code> - {props.label}
|
||||||
|
</h3>
|
||||||
|
<div>{description}</div>
|
||||||
|
<Request>HTTP request & arguments</Request>
|
||||||
|
<p>
|
||||||
|
<code>{`${process.env.URL}/api/${props.method}`}</code>
|
||||||
|
</p>
|
||||||
|
{apiArgs}
|
||||||
|
</MethodContainer>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
type ArgumentProps = {
|
type ArgumentProps = {
|
||||||
id: string,
|
id: string,
|
||||||
required?: boolean,
|
required?: boolean,
|
||||||
|
Reference in New Issue
Block a user