-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
274309f
commit f65d3fb
Showing
4 changed files
with
54 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,15 +1,28 @@ | ||
import { exec } from 'node:child_process' | ||
|
||
// eslint-disable-next-line jsdoc/require-jsdoc | ||
export async function fetchOpenAPISchema (url: string) { | ||
export async function fetchOpenAPISchema () { | ||
return await fetch('https://patreon-docs.ghostrider.workers.dev/proxy', { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
method: 'GET', | ||
url, | ||
url: openAPIUrlV2, | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
}), | ||
}).then(res => res.json()) | ||
} | ||
|
||
export const openAPIUrlV2 = 'https://raw.githubusercontent.com/ghostrider-05/patreon-api.ts/refs/heads/openapi-schema/src/schemas/v2/generated/openapi.json' | ||
const getBranch = () => new Promise<string>((resolve, reject) => { | ||
return exec('git rev-parse --abbrev-ref HEAD', (err, stdout) => { | ||
if (err) | ||
reject(`getBranch Error: ${err}`) | ||
else if (typeof stdout === 'string') | ||
resolve(stdout.trim()) | ||
}) | ||
}) | ||
|
||
export const currentBranch = await getBranch() | ||
|
||
export const openAPIUrlV2 = `https://raw.githubusercontent.com/ghostrider-05/patreon-api.ts/refs/heads/${currentBranch}/src/schemas/v2/generated/openapi.json` |
This file contains 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