Skip to content

Commit eea711e

Browse files
Matthew Sweeneykodiakhq[bot]
Matthew Sweeney
authored andcommitted
Add Limits Page (#1136)
* initial component and file * add map * remove render wrapper * add limits page * remove unused import * remove logs * add example * add examples * improve examples * change to seconds * add link from api rate limits * update kodiak label * update example
1 parent 94427b7 commit eea711e

File tree

7 files changed

+120
-2
lines changed

7 files changed

+120
-2
lines changed

Diff for: .kodiak.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version = 1
22

33
[merge]
44
require_automerge_label = false
5-
blacklist_labels = ["in progress"]
5+
blacklist_labels = ["In Progress"]
66
method = "squash"
77
delete_branch_on_merge = true
88
block_on_reviews_requested = false

Diff for: components/limits/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './limits'

Diff for: components/limits/limits.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { useEffect, useState } from 'react'
2+
import { API_LIMITS } from '../../lib/constants'
3+
import { InlineCode } from '../text/code'
4+
import {
5+
Table,
6+
TableHead,
7+
TableBody,
8+
TableRow,
9+
TableRowCell,
10+
TableHeadCell
11+
} from '~/components/table'
12+
13+
function Limits() {
14+
const [limits, setLimits] = useState([])
15+
useEffect(() => {
16+
async function getLimits() {
17+
const res = await fetch(API_LIMITS)
18+
const data = await res.json()
19+
setLimits({ ...data })
20+
return null
21+
}
22+
getLimits()
23+
}, [])
24+
console.log(limits)
25+
return limits && limits.rateLimits ? (
26+
<Table>
27+
<TableHead>
28+
<TableRow>
29+
<TableHeadCell className="head-cell">Description</TableHeadCell>
30+
<TableHeadCell className="head-cell">Limit</TableHeadCell>
31+
<TableHeadCell className="head-cell">
32+
Duration (Seconds)
33+
</TableHeadCell>
34+
<TableHeadCell className="head-cell">Scope</TableHeadCell>
35+
</TableRow>
36+
</TableHead>
37+
<TableBody>
38+
{limits.rateLimits.map(l => (
39+
<TableRow>
40+
<TableRowCell>{l.description}</TableRowCell>
41+
<TableRowCell>{l.max}</TableRowCell>
42+
<TableRowCell>{l.duration / 1000}</TableRowCell>
43+
<TableRowCell>
44+
<InlineCode>{l.scope}</InlineCode>
45+
</TableRowCell>
46+
</TableRow>
47+
))}
48+
</TableBody>
49+
</Table>
50+
) : null
51+
}
52+
53+
export default Limits

Diff for: lib/constants.js

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ export const API_USER = '/api/www/user'
66
export const API_USER_TOKEN_TESTING = '/api/user/tokens/testing'
77
export const API_TEAMS = '/api/teams'
88
export const API_DOCS_FEEDBACK = 'https://api.zeit.co/v1/feedback/docs'
9+
export const API_LIMITS = 'https://api.zeit.co/v1/ratelimits'

Diff for: lib/data/v2/docs.js

+4
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ export default [
183183
name: 'Glossary',
184184
href: '/docs/v2/advanced/platform/glossary'
185185
},
186+
{
187+
name: 'Limits',
188+
href: '/docs/v2/advanced/platform/limits'
189+
},
186190
{
187191
name: 'Changes in ZEIT Now 2.0',
188192
href: '/docs/v2/advanced/platform/changes-in-now-2-0'

Diff for: pages/docs/api/v2/api-docs-mdx/api-basics/rate-limits.mdx

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import Example from '~/components/example'
22
import { Code, RequestHeader } from '~/components/text/code'
33
import Caption from '~/components/text/caption'
4+
import Note from '~/components/text/note'
5+
import { GenericLink } from '~/components/text/link'
46

57
export const meta = {
68
editUrl: 'pages/docs/api/v2/api-docs-mdx/api-basics/rate-limits.mdx',
7-
lastEdited: '2019-08-15T12:51:17.000Z'
9+
lastEdited: '2019-08-15T22:07:24.000Z'
810
}
911

1012
## Rate Limits
@@ -31,3 +33,11 @@ status "**429 Too Many Requests**":
3133
}`}</Code>
3234
<Caption>An example of a rate limit exceeded error.</Caption>
3335
</Example>
36+
37+
<Note>
38+
You can find the complete list of rate limits in the{' '}
39+
<GenericLink href="/docs/v2/advanced/platform/limits/">
40+
limits documentation
41+
</GenericLink>
42+
.
43+
</Note>

Diff for: pages/docs/v2/advanced/platform/limits.mdx

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import Doc from '~/components/layout/docs'
2+
import { InlineCode } from '~/components/text/code'
3+
import Caption from '~/components/text/caption'
4+
import Card from '~/components/card'
5+
import Note from '~/components/text/note'
6+
import { GenericLink } from '~/components/text/link'
7+
import Limits from '~/components/limits'
8+
9+
export const meta = {
10+
title: 'Limits',
11+
description: 'A list of rate limits that apply on the ZEIT Now platform.',
12+
editUrl: 'pages/docs/v2/advanced/platform/limits.mdx',
13+
lastEdited: '2019-08-16T10:45:09.000Z'
14+
}
15+
16+
This page outlines all relevant limits on the ZEIT Now platform.
17+
18+
The table consists of the following four columns:
19+
20+
- **Description** - A brief description of the limit which, where relevant, will advise what type of plan it applies to.
21+
- **Limit** - The amount of actions permitted within the amount of time (**Duration**) specified.
22+
- **Duration** - The amount of time (seconds) in which you can perform the specified amount of actions in. Once a rate limit is hit, it will be reset after the **Duration** has expired.
23+
- **Scope** - Who the limit applies to, `owner` refers to the account owner, `user` refers to an individual user on a **Team** account.
24+
25+
## Examples
26+
27+
Below are three examples that provide further information on how the rate limits work.
28+
29+
### Project Creation
30+
31+
Taking the domains deletion rate limit as an example, you are allowed to delete up to `60` domains every `60` seconds (1 minute). Should you hit the rate limit, you will need to wait another minute before deleting another domain.
32+
33+
### Team Deletion
34+
35+
With the team deletion rate limit, you are able to delete up to `20` teams every `3600` seconds (1 hour). Should you hit the rate limit, you will need to wait another hour before deleting another team.
36+
37+
### Username Update
38+
39+
For the username update rate limit, you are able to change your username up to `6` times every `604800` seconds (1 week). Should you hit the rate limit, you will need to wait another week before changing your username again.
40+
41+
---
42+
43+
<Limits />
44+
45+
export default ({ children }) => <Doc meta={meta}>{children}</Doc>
46+
47+
export const config = {
48+
amp: 'hybrid'
49+
}

0 commit comments

Comments
 (0)