-
Notifications
You must be signed in to change notification settings - Fork 388
feat(bannerbear): add Bannerbear plugin #969
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
Open
yuvanvk
wants to merge
12
commits into
corsairdev:main
Choose a base branch
from
yuvanvk:feat/bannerbear
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0271ff9
feat(bannerbear): add bannerbear plugin
yuvanvk 675f40b
feat(corsair): register bannerbear in providers
yuvanvk 536c6fc
fix(bannerbear): unauthenticated webhook requests close failed
yuvanvk 538365f
fix(bannerbear): propagate correct error messages
yuvanvk a600625
feat(bannerbear): Webhook tests
yuvanvk 3e6a432
fix(bannerbear): add webhook api's tests
yuvanvk 7a52990
chore: update pnpm-lock.yaml
yuvanvk 14bb24f
chore(bannerbear): re-trigger ci
yuvanvk 4b60f38
fix(bannerbear): retry reads in client not binder
ambikeesshh e9ad31c
fix(bannerbear): remap plugin to Bannerbear V5
ambikeesshh 72ffa6a
test(bannerbear): cover V5 paths, auth, and retries
ambikeesshh 16cdcfe
chore(bannerbear): merge main and resolve registration conflicts
ambikeesshh 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
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,61 @@ | ||
| import type { ApiRequestOptions, OpenAPIConfig } from 'corsair/http'; | ||
| import { ApiError, request } from 'corsair/http'; | ||
|
|
||
| export class BannerbearAPIError extends Error { | ||
| constructor( | ||
| message: string, | ||
| public readonly code?: string, | ||
| ) { | ||
| super(message); | ||
| this.name = 'BannerbearAPIError'; | ||
| } | ||
| } | ||
|
|
||
| const BANNERBEAR_API_BASE = 'https://api.bannerbear.com'; | ||
|
|
||
| export async function makeBannerbearRequest<T>( | ||
| endpoint: string, | ||
| apiKey: string, | ||
| options: { | ||
| method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'; | ||
| body?: Record<string, unknown>; | ||
| query?: Record<string, string | number | boolean | undefined>; | ||
| } = {}, | ||
| ): Promise<T> { | ||
| const { method = 'GET', body, query } = options; | ||
|
|
||
| const config: OpenAPIConfig = { | ||
| BASE: BANNERBEAR_API_BASE, | ||
| VERSION: '5.0.0', | ||
| WITH_CREDENTIALS: false, | ||
| CREDENTIALS: 'omit', | ||
| TOKEN: apiKey, | ||
| HEADERS: { | ||
| 'Content-Type': 'application/json', | ||
| Authorization: `Bearer ${apiKey}`, | ||
| }, | ||
| }; | ||
|
|
||
| const requestOptions: ApiRequestOptions = { | ||
| method, | ||
| url: endpoint, | ||
| body: | ||
| method === 'POST' || method === 'PUT' || method === 'PATCH' | ||
| ? body | ||
| : undefined, | ||
| mediaType: 'application/json; charset=utf-8', | ||
| query, | ||
| }; | ||
|
|
||
| try { | ||
| return await request<T>(config, requestOptions); | ||
| } catch (error) { | ||
| if (error instanceof ApiError) { | ||
| throw error; | ||
| } | ||
| if (error instanceof Error) { | ||
| throw new BannerbearAPIError(error.message); | ||
| } | ||
| throw new BannerbearAPIError('Unknown error'); | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: corsairdev/corsair
Length of output: 189
🏁 Script executed:
Repository: corsairdev/corsair
Length of output: 50374
🏁 Script executed:
Repository: corsairdev/corsair
Length of output: 301
🌐 Web query:
Bannerbear API v5 OpenAPI image_templates instant_urls webhooks project_id💡 Result:
The Bannerbear V5 API is the current generation of the service's API [1][2][3]. It introduces several architectural changes compared to previous versions, including new resource management and key structures [1][4]. Key concepts in the V5 API include: 1. Project IDs and Authentication Bannerbear offers two main types of API keys [5]: - Project API Keys: These are specific to a single project and do not require a project_id parameter [5][6]. - Master API Keys: These provide broader access across multiple projects. When using a Master API Key, you must include a project_id parameter in your requests to specify the target project [5][6]. 2. Image Templates In V5, the resource for templates is officially named image_templates [2][3]. You can create, update, and delete these via the API. The templates use a config object to define the canvas, including objects like text, images, and shapes [1][2]. 3. Instant URLs Instant URLs (the V5 equivalent of V2's "Signed URLs" feature) are URLs bound to a template that can be dynamically manipulated using query strings [2][4]. They support two security levels (signed or open) and two encoding modes (encoded or named_params) [2][3][4]. 4. Webhooks Webhooks are managed as a first-class resource in V5, rather than being defined as a per-request parameter [2][3]. They can be scoped to specific events or specific templates, and the API includes delivery history logging [4]. 5. Official Documentation and Libraries The authoritative source for all V5 API endpoints, request schemas, and authentication details is the official Bannerbear Developer portal at developers.bannerbear.com [7][8]. Official SDKs and libraries (such as those for Python and PHP) are available to simplify interaction with these endpoints [1][2][9].
Citations:
🏁 Script executed:
Repository: corsairdev/corsair
Length of output: 2406
Align the Bannerbear operations with the V5 OpenAPI contract.
The schema exposes
/v5/image_templatesand/v5/instant_urls, but not the package’s/v5/templates,/v5/template_sets,/v5/screenshots, orsigned_basesroutes. It also defines noproject_idproperty, and webhook creation requiresnameandurl. Rebuild the paths, schemas, exports, and tests from the V5 contract before release.🤖 Prompt for AI Agents