Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(web): add desktop user profile API contract

Richie McIlroy82776348fa91
diff --git a/packages/web-api-contract-effect/src/index.ts b/packages/web-api-contract-effect/src/index.ts
index 078692fa1..dca827a1d 100644
--- a/packages/web-api-contract-effect/src/index.ts
+++ b/packages/web-api-contract-effect/src/index.ts
@@ -148,6 +148,17 @@ export class ApiContract extends HttpApi.make("cap-web-api")
}),
),
)
+ .add(
+ HttpApiEndpoint.get("getUserProfile", "/desktop/user/profile")
+ .setHeaders(AuthHeaders)
+ .addSuccess(
+ Schema.Struct({
+ name: Schema.NullOr(Schema.String),
+ email: Schema.NullOr(Schema.String),
+ imageUrl: Schema.NullOr(Schema.String),
+ }),
+ ),
+ )
.add(
HttpApiEndpoint.get("getS3Config", "/desktop/s3/config/get")
.setHeaders(AuthHeaders)
diff --git a/packages/web-api-contract/src/desktop.ts b/packages/web-api-contract/src/desktop.ts
index 990245ef9..9d4edf756 100644
--- a/packages/web-api-contract/src/desktop.ts
+++ b/packages/web-api-contract/src/desktop.ts
@@ -143,6 +143,17 @@ const protectedContract = c.router(
}),
},
},
+ getUserProfile: {
+ method: "GET",
+ path: "/desktop/user/profile",
+ responses: {
+ 200: z.object({
+ name: z.string().nullable(),
+ email: z.string().nullable(),
+ imageUrl: z.string().nullable(),
+ }),
+ },
+ },
getS3Config: {
method: "GET",
path: "/desktop/s3/config/get",