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:
Tom Moor
2017-11-22 18:40:37 -08:00
parent bca940bedc
commit 94c2cc09ee
3 changed files with 37 additions and 27 deletions

View File

@ -58,8 +58,8 @@ class CollectionScene extends Component {
this.props.ui.setActiveCollection(collection);
this.collection = collection;
await this.props.documents.fetchRecentlyModified({
limit: 5,
collectionId: collection.id,
limit: 10,
collection: collection.id,
});
}

View File

@ -15,12 +15,12 @@ const authDocumentForUser = (ctx, document) => {
const router = new Router();
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';
const user = ctx.state.user;
let where = { teamId: user.teamId };
if (collectionId) where = { ...where, atlasId: collectionId };
if (collection) where = { ...where, atlasId: collection };
const userId = user.id;
const starredScope = { method: ['withStarred', userId] };

View File

@ -128,9 +128,9 @@ export default function Pricing() {
<p>
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
the payload using <code>token</code> parameter. If you're making{' '}
the payload using <code>token</code> parameter. If youre making{' '}
<code>GET</code> requests, header based authentication is recommended
so that your keys don't leak into logs.
so that your keys dont leak into logs.
</p>
<p>
@ -241,7 +241,7 @@ export default function Pricing() {
<Method method="collections.delete" label="Delete a collection">
<Description>
Delete a collection and all of its documents. This action can`t be
Delete a collection and all of its documents. This action cant be
undone so please be careful.
</Description>
<Arguments>
@ -249,6 +249,16 @@ export default function Pricing() {
</Arguments>
</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">
<Description>
<p>
@ -487,26 +497,6 @@ type MethodProps = {
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<*> }) => (
<p>{props.children}</p>
);
@ -536,6 +526,26 @@ const Arguments = (props: ArgumentsProps) => (
</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 = {
id: string,
required?: boolean,