Skip to content

Commit 225801c

Browse files
authored
On-demand report generation docs (#56)
* Ondemand report input schema format * On-demand reporting docs * CodeRabbit suggestions * Typo
1 parent 72dca70 commit 225801c

File tree

4 files changed

+169
-0
lines changed

4 files changed

+169
-0
lines changed

docs/guides/images/api_keys.png

69.2 KB
Loading

docs/guides/ondemand-reports.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: On-demand Reports
3+
sidebar_label: On-demand Reports (Beta)
4+
description:
5+
CodeRabbit offers a way to generate on-demand reports using a simple API request
6+
sidebar_position: 5
7+
---
8+
9+
```mdx-code-block
10+
import ReportSchema from "@site/src/components/ReportSchema";
11+
```
12+
13+
:::info
14+
15+
This feature is in beta
16+
17+
:::
18+
19+
CodeRabbit offers a way to generate on-demand reports using the [CodeRabbit API](https://api.coderabbit.ai/api/swagger/).
20+
You will need an API Key to access the CodeRabbit API and generate an on-demand report.
21+
22+
## Create an API key
23+
24+
Sign in to your CodeRabbit account and navigate to the [**API Keys**](https://app.coderabbit.ai/settings/api-keys) page under 'Organization Settings' in the left sidebar.
25+
Click on the **Create API Key** button and enter a name for the API Key.
26+
Copy the API key, and keep it safe as it won't be visible again.
27+
28+
![API Keys](./images/api_keys.png)
29+
30+
## Generate an On-demand report
31+
32+
Once you have the API key, pass it in the `x-coderabbitai-api-key` header when calling the API:
33+
34+
```sh
35+
curl -X 'POST' \
36+
'https://api.coderabbit.ai/api/v1/report.generate' \
37+
-H 'accept: application/json' \
38+
-H 'x-coderabbitai-api-key: cr-xxxxxxxxxxxxx' \
39+
-H 'Content-Type: application/json' \
40+
-d '{
41+
"from": "2024-05-01",
42+
"to": "2024-05-15"
43+
}'
44+
```
45+
46+
Sample output:
47+
48+
```sh
49+
[
50+
{
51+
"group": "Developer Activity",
52+
"report": "*Developer Activity*:\n\n 🟢 **Update README.md** [#10](https://gitlab.com/master-group123/sub-group/project1/-/merge_requests/10)\n• Summary: The change updates the project description and modifies a section header for clearer instructions.\n• Last activity: 1 day ago, mergeable\n• Insights:\n - :magnifying_glass: @user2 Suggested updating the wording to make it clearer"
53+
}
54+
]
55+
```
56+
57+
58+
:::info
59+
60+
If you get a 401 UNAUTHORIZED error, check if you're passing the right API key in the `x-coderabbitai-api-key` header
61+
62+
:::
63+
64+
The on-demand report generation endpoints take in inputs as per the schema shown below:
65+
66+
```mdx-code-block
67+
<ReportSchema />
68+
```
69+
70+
[API Reference](https://api.coderabbit.ai/api/swagger/)

src/components/ReportSchema.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import Schema from "@site/static/schema/reporting.json";
2+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
3+
4+
export default function Viewer(): JSX.Element {
5+
return <JSONSchemaViewer schema={Schema} />;
6+
}

static/schema/reporting.json

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"scheduleRange": {
5+
"type": "string",
6+
"enum": [
7+
"Dates"
8+
]
9+
},
10+
"from": {
11+
"type": "string",
12+
"format": "date"
13+
},
14+
"to": {
15+
"type": "string",
16+
"format": "date"
17+
},
18+
"prompt": {
19+
"type": "string"
20+
},
21+
"promptTemplate": {
22+
"type": "string",
23+
"enum": [
24+
"Daily Standup Report",
25+
"Sprint Report",
26+
"Release Notes",
27+
"Custom"
28+
]
29+
},
30+
"parameters": {
31+
"type": "array",
32+
"items": {
33+
"type": "object",
34+
"properties": {
35+
"parameter": {
36+
"type": "string",
37+
"enum": [
38+
"REPOSITORY",
39+
"LABEL",
40+
"TEAM",
41+
"USER"
42+
]
43+
},
44+
"operator": {
45+
"type": "string",
46+
"enum": [
47+
"IN",
48+
"ALL"
49+
]
50+
},
51+
"values": {
52+
"type": "array",
53+
"items": {
54+
"type": "string"
55+
}
56+
}
57+
},
58+
"required": [
59+
"parameter",
60+
"operator",
61+
"values"
62+
],
63+
"additionalProperties": false
64+
}
65+
},
66+
"groupBy": {
67+
"type": "string",
68+
"enum": [
69+
"NONE",
70+
"REPOSITORY",
71+
"LABEL",
72+
"TEAM",
73+
"USER"
74+
]
75+
},
76+
"subgroupBy": {
77+
"type": "string",
78+
"enum": [
79+
"NONE",
80+
"REPOSITORY",
81+
"LABEL",
82+
"TEAM",
83+
"USER"
84+
]
85+
}
86+
},
87+
"required": [
88+
"from",
89+
"to"
90+
],
91+
"additionalProperties": false,
92+
"$schema": "http://json-schema.org/draft-07/schema#"
93+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy