import Foundation import HapiProtocol /// Public session shares (`hub/src/web/routes/sessionShares.ts`). Creating a /// share returns the six-digit access code once; later reads only return the /// link token, so the UI must keep the code from the create response. extension APIClient { public func createSessionShare(sessionId: String) async throws -> SessionShareCreateResponse { struct CreateRequest: Encodable { let sessionId: String } return try await request( .post, "/api/session-shares", body: CreateRequest(sessionId: sessionId) ) } public func sessionShare(sessionId: String) async throws -> SessionShare? { let response: SessionShareEnvelope = try await request( .get, "/api/session-shares/session/\(encodePathComponent(sessionId))" ) return response.share } public func revokeSessionShare(id: String) async throws { try await requestVoid( .delete, "/api/session-shares/\(encodePathComponent(id))" ) } }