Spaces:
Runtime error
Runtime error
File size: 1,533 Bytes
46252cd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /**
* Profile resource — the session's own account profile (name, about/status, picture).
*
* Backed by `src/modules/profile/profile.controller.ts` (`@Controller('sessions/:sessionId/profile')`).
* All operations require an OPERATOR-level key.
* @packageDocumentation
*/
import { encodeSegment } from '../http.js';
import type { OpenWAClient } from '../client.js';
import type { SetProfilePictureRequest, SuccessResult } from '../types.js';
export class ProfileResource {
constructor(private readonly client: OpenWAClient) {}
/** Set the account display name (max 25 chars). */
setProfileName(sessionId: string, name: string): Promise<SuccessResult> {
return this.client.request<SuccessResult>({
method: 'PUT',
path: `/api/sessions/${encodeSegment(sessionId)}/profile/name`,
body: { name },
});
}
/** Set the account about/status text (max 139 chars; empty string clears it). */
setProfileStatus(sessionId: string, status: string): Promise<SuccessResult> {
return this.client.request<SuccessResult>({
method: 'PUT',
path: `/api/sessions/${encodeSegment(sessionId)}/profile/status`,
body: { status },
});
}
/** Set the account profile picture (provide `url` OR `base64` + `mimetype`). */
setProfilePicture(sessionId: string, body: SetProfilePictureRequest): Promise<SuccessResult> {
return this.client.request<SuccessResult>({
method: 'PUT',
path: `/api/sessions/${encodeSegment(sessionId)}/profile/picture`,
body,
});
}
}
|