1 | |
2 | type Xero = { |
3 | token: string |
4 | } |
5 | |
6 | * Retrieves the payment services for a specific branding theme |
7 | * |
8 | */ |
9 | export async function main(auth: Xero, BrandingThemeID: string, xero_tenant_id: string) { |
10 | const url = new URL( |
11 | `https://api.xero.com/api.xro/2.0/BrandingThemes/${BrandingThemeID}/PaymentServices` |
12 | ) |
13 |
|
14 | const response = await fetch(url, { |
15 | method: 'GET', |
16 | headers: { |
17 | Accept: 'application/json', |
18 | 'xero-tenant-id': xero_tenant_id, |
19 | Authorization: 'Bearer ' + auth.token |
20 | }, |
21 | body: undefined |
22 | }) |
23 | if (!response.ok) { |
24 | const text = await response.text() |
25 | throw new Error(`${response.status} ${text}`) |
26 | } |
27 | return await response.json() |
28 | } |
29 |
|