Skip to content

Commit c3d1446

Browse files
authored
feat: Add script.external_request scope and its corresponding test (#42)
1 parent ac36c6b commit c3d1446

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

.changeset/fiery-colts-send.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"google-workspace-developer-tools": patch
3+
---
4+
5+
Add Apps Script specific `https://www.googleapis.com/auth/script.external_request` which is not part of any API.

packages/vscode-extension/src/scopes.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ for (const { title, version, documentationLink, scopes } of GOOGLE_APIS || []) {
6464
}
6565
}
6666

67+
export const SCRIPT_EXTERNAL_REQUEST_SCOPE =
68+
"https://www.googleapis.com/auth/script.external_request";
69+
70+
SCOPES.set(SCRIPT_EXTERNAL_REQUEST_SCOPE, {
71+
description: "Connect to an external service",
72+
apis: [],
73+
});
74+
6775
const RESTRICTED_SCOPES = [
6876
"https://www.googleapis.com/auth/chat.admin.delete",
6977
"https://www.googleapis.com/auth/chat.app.delete",

packages/vscode-extension/src/test/scopes.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
*/
1616

1717
import * as assert from "node:assert";
18-
import { SCOPES, getScopeMarkdown } from "../scopes.js";
18+
import {
19+
SCOPES,
20+
SCRIPT_EXTERNAL_REQUEST_SCOPE,
21+
getScopeMarkdown,
22+
} from "../scopes.js";
1923

2024
suite("getScopeMarkdown", () => {
2125
test("it returns markdown for a known scope", () => {
@@ -27,4 +31,10 @@ suite("getScopeMarkdown", () => {
2731
const markdown = getScopeMarkdown("https://example.com");
2832
assert.strictEqual(markdown, "**https://example.com** (Unknown scope)");
2933
});
34+
35+
test("it returns scope for script.external_request", () => {
36+
const scope = SCOPES.get(SCRIPT_EXTERNAL_REQUEST_SCOPE);
37+
assert.ok(scope);
38+
assert.strictEqual(scope?.description, "Connect to an external service");
39+
});
3040
});

0 commit comments

Comments
 (0)