-
Notifications
You must be signed in to change notification settings - Fork 32
On-demand report generation docs #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
--- | ||
title: On-demand Reports | ||
sidebar_label: On-demand Reports (Beta) | ||
description: | ||
CodeRabbit offers a way to generate on-demand reports using a simple API request | ||
sidebar_position: 5 | ||
--- | ||
|
||
```mdx-code-block | ||
import ReportSchema from "@site/src/components/ReportSchema"; | ||
``` | ||
|
||
:::info | ||
|
||
This feature is in beta | ||
|
||
::: | ||
|
||
CodeRabbit offers a way to generate on-demand reports using the [CodeRabbit API](https://api.coderabbit.ai/api/swagger/). | ||
You will need an API Key to access the CodeRabbit API and generate an on-demand report. | ||
|
||
## Create an API key | ||
|
||
Sign into your CodeRabbit account and navigate to the the [**API Keys**](https://app.coderabbit.ai/settings/api-keys) page under 'Organization Settings' in the left sidebar. | ||
Click on the **Create API Key** button and enter a name for the API Key. | ||
Copy the API key and keep it safe as it won't be visible again. | ||
|
||
 | ||
|
||
## Generate an On-demand report | ||
|
||
Once you have the API key, pass it in the `x-coderabbitai-api-key` header when calling the API: | ||
|
||
```sh | ||
curl -X 'POST' \ | ||
'https://api.coderabbit.ai/api/v1/report.generate' \ | ||
-H 'accept: application/json' \ | ||
-H 'x-coderabbitai-api-key: cr-xxxxxxxxxxxxx' \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"from": "2024-05-01", | ||
"to": "2024-05-15" | ||
}' | ||
``` | ||
|
||
Sample output: | ||
|
||
```sh | ||
[ | ||
{ | ||
"group": "Developer Activity", | ||
"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" | ||
} | ||
] | ||
``` | ||
|
||
|
||
:::info | ||
|
||
If you get a 401 UNAUTHORIZED error, check if you're passing the right API key in the `x-coderabbitai-api-key` header | ||
|
||
::: | ||
|
||
The on-demand report generation endpoints take in inputs as per the schema shown below: | ||
|
||
```mdx-code-block | ||
<ReportSchema /> | ||
``` | ||
|
||
[API Reference](https://api.coderabbit.ai/api/swagger/) |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Schema from "@site/static/schema/reporting.json"; | ||
import JSONSchemaViewer from "@theme/JSONSchemaViewer"; | ||
|
||
export default function Viewer(): JSX.Element { | ||
return <JSONSchemaViewer schema={Schema} />; | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"scheduleRange": { | ||
"type": "string", | ||
"enum": [ | ||
"Dates" | ||
] | ||
}, | ||
"from": { | ||
"type": "string", | ||
"format": "date" | ||
}, | ||
"to": { | ||
"type": "string", | ||
"format": "date" | ||
}, | ||
"prompt": { | ||
"type": "string" | ||
}, | ||
"promptTemplate": { | ||
"type": "string", | ||
"enum": [ | ||
"Daily Standup Report", | ||
"Sprint Report", | ||
"Release Notes", | ||
"Custom" | ||
] | ||
}, | ||
"parameters": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"parameter": { | ||
"type": "string", | ||
"enum": [ | ||
"REPOSITORY", | ||
"LABEL", | ||
"TEAM", | ||
"USER" | ||
] | ||
}, | ||
"operator": { | ||
"type": "string", | ||
"enum": [ | ||
"IN", | ||
"ALL" | ||
] | ||
}, | ||
"values": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"required": [ | ||
"parameter", | ||
"operator", | ||
"values" | ||
], | ||
"additionalProperties": false | ||
} | ||
}, | ||
"groupBy": { | ||
"type": "string", | ||
"enum": [ | ||
"NONE", | ||
"REPOSITORY", | ||
"LABEL", | ||
"TEAM", | ||
"USER" | ||
] | ||
}, | ||
"subgroupBy": { | ||
"type": "string", | ||
"enum": [ | ||
"NONE", | ||
"REPOSITORY", | ||
"LABEL", | ||
"TEAM", | ||
"USER" | ||
] | ||
} | ||
}, | ||
"required": [ | ||
"from", | ||
"to" | ||
], | ||
"additionalProperties": false, | ||
"$schema": "http://json-schema.org/draft-07/schema#" | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.