( apiKey: string, tokenType?: RailwayTokenType )
| 12 | } |
| 13 | |
| 14 | export function railwayHeaders( |
| 15 | apiKey: string, |
| 16 | tokenType?: RailwayTokenType |
| 17 | ): Record<string, string> { |
| 18 | if (!apiKey) { |
| 19 | throw new Error('Missing API token for Railway API request') |
| 20 | } |
| 21 | |
| 22 | if (tokenType === 'project') { |
| 23 | return { |
| 24 | 'Content-Type': 'application/json', |
| 25 | 'Project-Access-Token': apiKey, |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | return { |
| 30 | 'Content-Type': 'application/json', |
| 31 | Authorization: `Bearer ${apiKey}`, |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | export async function parseRailwayGraphqlResponse<TData>( |
| 36 | response: Response |
no outgoing calls
no test coverage detected