Skip to content

Commit d289d4c

Browse files
committed
Merge branch 'Create-New-Workspace-Menubar' of https://github.com/henit-chobisa/Gitpod-Raycast-Extension into develop
2 parents d136597 + 9a6f370 commit d289d4c

17 files changed

+1333
-7637
lines changed

package-lock.json

Lines changed: 760 additions & 7268 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -22,49 +22,17 @@
2222
"description": "Choose your Preferred editor for Gitpod",
2323
"type": "dropdown",
2424
"data": [
25-
{
26-
"title": "VS Code Browser",
27-
"value": "code"
28-
},
2925
{
3026
"title": "VS Code Desktop",
3127
"value": "code-desktop"
3228
},
3329
{
34-
"title": "Vim",
35-
"value": "vim"
36-
},
37-
{
38-
"title": "IntelliJ",
39-
"value": "intellij"
40-
},
41-
{
42-
"title": "GoLand",
43-
"value": "goland"
44-
},
45-
{
46-
"title": "PhpStorm",
47-
"value": "phpstorm"
48-
},
49-
{
50-
"title": "PyCharm",
51-
"value": "pycharm"
52-
},
53-
{
54-
"title": "RubyMine",
55-
"value": "rubymine"
56-
},
57-
{
58-
"title": "WebStorm",
59-
"value": "webstorm"
60-
},
61-
{
62-
"title": "Rider",
63-
"value": "rider"
30+
"title": "VS Code Browser",
31+
"value": "code"
6432
},
6533
{
66-
"title": "CLion",
67-
"value": "clion"
34+
"title": "Vim",
35+
"value": "vim"
6836
}
6937
],
7038
"required": true
@@ -101,6 +69,14 @@
10169
"description": "Configure your custom Gitpod URL for Dedicated and Self-Hosted",
10270
"type": "textfield",
10371
"required": false
72+
},
73+
{
74+
"name": "access_token",
75+
"title": "Gitpod Access Token",
76+
"placeholder": "Gitpod Access Token",
77+
"description": "Generate and Enter a Gitpod Access Token from Gitpod with Full Access.",
78+
"type": "password",
79+
"required": false
10480
}
10581
],
10682
"commands": [
@@ -133,17 +109,7 @@
133109
"title": "List Gitpod Workspaces",
134110
"subtitle": "List Workspaces",
135111
"description": "List All Workspaces on your gitpod Dashboard",
136-
"mode": "view",
137-
"preferences": [
138-
{
139-
"name": "cookie_token",
140-
"title": "Gitpod Session Cookie",
141-
"placeholder": "Only for Gitpod Beta Testers",
142-
"description": "Enter Gitpod Session Cookie from Browser",
143-
"type": "password",
144-
"required": true
145-
}
146-
]
112+
"mode": "view"
147113
},
148114
{
149115
"name": "menubar",
@@ -158,20 +124,13 @@
158124
"recent repositories",
159125
"menubar",
160126
"workspaces"
161-
],
162-
"preferences": [
163-
{
164-
"name": "cookie_token",
165-
"title": "Gitpod Session Cookie",
166-
"placeholder": "Only for Gitpod Beta Testers",
167-
"description": "Enter Gitpod Session Cookie from Browser",
168-
"type": "password",
169-
"required": false
170-
}
171127
]
172128
}
173129
],
174130
"dependencies": {
131+
"@bufbuild/connect": "^0.8.6",
132+
"@bufbuild/connect-node": "^0.8.6",
133+
"@bufbuild/protobuf": "^1.2.0",
175134
"@graphql-codegen/cli": "^2.16.2",
176135
"@graphql-codegen/typescript-graphql-request": "^4.5.8",
177136
"@graphql-codegen/typescript-operations": "^2.5.11",
@@ -204,4 +163,4 @@
204163
"publish": "ray publish",
205164
"generate": "graphql-codegen --config codegen.ts"
206165
}
207-
}
166+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export interface IOrganizationError extends Error {
2+
code: number,
3+
message: string,
4+
}
5+
6+
export function NewIOrganizationErrorObject(jsonObj: any): IOrganizationError{
7+
const error :IOrganizationError = {
8+
name : "OrganizationError",
9+
code : jsonObj.code ?? 0,
10+
message: jsonObj.message ?? ""
11+
}
12+
return error;
13+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import fetch from "node-fetch";
2+
3+
import { IOrganizationError } from "./IOrganizationError";
4+
import { GitpodDataModel } from "./Model";
5+
6+
const organizationURLs = {
7+
getOrganizations: "https://api.gitpod.io/gitpod.experimental.v1.TeamsService/ListTeams"
8+
}
9+
10+
export class IOrganization implements GitpodDataModel {
11+
private token: string;
12+
public orgId: string;
13+
public name: string;
14+
public slug: string;
15+
16+
constructor(organization: any ,token: string) {
17+
this.orgId = organization.id;
18+
this.name = organization.name;
19+
this.slug = organization.slug;
20+
21+
this.token = token;
22+
}
23+
24+
parse(json: string): IOrganization {
25+
const data = JSON.parse(json);
26+
27+
this.orgId = data.id ?? "";
28+
this.name = data.name ?? "";
29+
this.slug = data.slug ?? "";
30+
31+
return this
32+
}
33+
34+
static fetchOrganization = async (token: string): Promise<IOrganization[]> => {
35+
const organizations: IOrganization[] = []
36+
const response = await fetch(organizationURLs.getOrganizations, {
37+
method: "POST",
38+
headers: {
39+
"content-type": "application/json",
40+
"Authorization": `Bearer ${token}`,
41+
},
42+
body: JSON.stringify({}),
43+
})
44+
45+
if (response.status !== 200){
46+
const error : IOrganizationError = {
47+
name: "OrganizationFetchError",
48+
code: response.status,
49+
message: response.statusText
50+
}
51+
throw error;
52+
}
53+
54+
const json = await response.json() as any;
55+
56+
json.teams.map((organization: unknown) => {
57+
const org = new IOrganization(organization, token);
58+
organizations.push(org)
59+
})
60+
61+
return organizations
62+
}
63+
}

0 commit comments

Comments
 (0)