Canvas: Github repository picker
Change-Id: Icb8f2ffbef2894b2fdea4e4c13c74c0f4970506b
diff --git a/apps/canvas/front/src/lib/github.ts b/apps/canvas/front/src/lib/github.ts
new file mode 100644
index 0000000..8537671
--- /dev/null
+++ b/apps/canvas/front/src/lib/github.ts
@@ -0,0 +1,36 @@
+export interface GitHubRepository {
+ id: number;
+ name: string;
+ full_name: string;
+ html_url: string;
+ ssh_url: string;
+ description: string | null;
+ private: boolean;
+ default_branch: string;
+}
+
+export interface GitHubService {
+ /**
+ * Fetches a list of repositories for the authenticated user
+ * @returns Promise resolving to an array of GitHub repositories
+ */
+ getRepositories(): Promise<GitHubRepository[]>;
+}
+
+export class GitHubServiceImpl implements GitHubService {
+ private projectId: string;
+
+ constructor(projectId: string) {
+ this.projectId = projectId;
+ }
+
+ async getRepositories(): Promise<GitHubRepository[]> {
+ const response = await fetch(`/api/project/${this.projectId}/repos/github`);
+
+ if (!response.ok) {
+ throw new Error(`Failed to fetch repositories: ${response.statusText}`);
+ }
+
+ return response.json();
+ }
+}
\ No newline at end of file