EmofyEmofy Developers
TypeScript SDK

SDK Reference

Every public export of @emofy/dev-sdk — functions, classes, interfaces, and types — generated from the SDK's TypeScript surface via TypeDoc.

SDK Reference

Complete reference for every public export of @emofy/dev-sdk (46 symbols), generated from the SDK's TypeScript surface. For a guided introduction see the SDK overview and the quickstart.

Functions

createEmofyClient

Function

@emofy/dev-sdk — official TypeScript SDK for the Emofy Developer API (v1).

Types are generated from the frozen OpenAPI contract (PRD-223 snapshot); the runtime is a thin hand-written fetch client with V1 envelope unwrap, a typed error surface, Retry-After-aware backoff, idempotency-key transmission, and a programmatic deprecation signal.

createEmofyClient(config: EmofyClientConfig): EmofyClient

isV1Envelope

Function

Type guard: does json structurally match the V1 { data, meta } envelope?

isV1Envelope(json: unknown): json

verifyWebhookSignature

Function

Verify an Emofy-Signature header against the raw request body and your webhook secret. Returns true only if the timestamp is within the replay window AND at least one v1= segment matches — covering the secret-rotation grace window where two signatures (new + old secret) are present.

verifyWebhookSignature(payload: string | Buffer<ArrayBufferLike>, header: string | null | undefined, secret: string, options: VerifyWebhookOptions): boolean

Classes

EmofyApiError

Class

Thrown for any non-2xx response (and network failures). Carries the parsed V1 error envelope fields so a consumer can branch on error.code / error.status without re-reading the response.

MemberTypeDescription
codeEmofyApiErrorCode | undefinedCatalogued V1 error code when recognised; the raw string otherwise.
detailsunknown
isForbiddenboolean
isNetworkErrorboolean
isNotFoundboolean
isRateLimitedboolean
isUnauthorizedboolean
requestIdstring | undefined
statusnumber

Interfaces

AcademicNamespace

Interface

MemberTypeDescription
assignmentsAssignmentsResource
attendanceAttendanceResource
classroomsClassroomsResource
coursesCoursesResource
enrollmentsEnrollmentsResource
gradesGradesResource
lessonsLessonsResource
studentsStudentsResource
teachersTeachersResource

AssignmentsResource

Interface

MemberTypeDescription
createPromise<SingleResult<T>>
getPromise<SingleResult<T>>
getSubmissionsPromise<ListResult<T>>
listPromise<ListResult<T>>
submitPromise<SingleResult<T>>

AttendanceResource

Interface

MemberTypeDescription
bulkMarkPromise<SingleResult<T>>
getStudentAttendancePromise<ListResult<T>>
listPromise<ListResult<T>>
markPromise<SingleResult<T>>

ClassroomsResource

Interface

MemberTypeDescription
createPromise<SingleResult<T>>
deletePromise<SingleResult<T>>
getPromise<SingleResult<T>>
listPromise<ListResult<T>>
updatePromise<SingleResult<T>>

CoursesResource

Interface

MemberTypeDescription
createPromise<SingleResult<T>>
getPromise<SingleResult<T>>
getOfferingsPromise<ListResult<T>>
getPrerequisitesPromise<ListResult<T>>
listPromise<ListResult<T>>
listStandardsPromise<ListResult<T>>
updatePromise<SingleResult<T>>

DeprecationInfo

Interface

Programmatic signal raised when the server marks a route deprecated.

MemberTypeDescription
deprecatedAtnumber | nullParsed from Deprecation: @<unix-epoch> (RFC 9745), in ms; null if absent.
docsUrlstring | nullDocs URL from Link: <url>; rel="deprecation"; null if absent.
pathstringThe request path that returned the deprecation headers.
rawobjectRaw header values, for logging/forwarding.
sunsetAtnumber | nullParsed from Sunset: <HTTP-date> (RFC 8594), in ms; null if absent.

EmofyApiErrorBody

Interface

Shape of the error object inside a V1 error envelope.

MemberTypeDescription
code?string
details?unknown
message?string
requestId?string
timestamp?string

EmofyClient

Interface

@emofy/dev-sdk — official TypeScript SDK for the Emofy Developer API (v1).

Types are generated from the frozen OpenAPI contract (PRD-223 snapshot); the runtime is a thin hand-written fetch client with V1 envelope unwrap, a typed error surface, Retry-After-aware backoff, idempotency-key transmission, and a programmatic deprecation signal.

MemberTypeDescription
academicAcademicNamespace
familyFamilyResource
feedFeedResource
feedBookmarksFeedBookmarksResource
feedCommentsFeedCommentsResource
feedExperienceRolesFeedExperienceRolesResource
feedPollsFeedPollsResource
feedReactionsFeedReactionsResource
feedReportsFeedReportsResource
feedScheduledFeedScheduledResource
identityIdentityResource
messagingMessagingResource
profilesProfilesResource
requestPromise<SingleResult<T>>Low-level request — used by the resource accessors.
requestListPromise<ListResult<T>>Low-level list request — unwraps data: T[] + pagination meta.
storeStoreResource
tasksTasksResource & objectTasks resource — the full generated surface (list, getById, create, update, delete, complete, reopen, listProjects) PLUS the back-compat get alias for getById (the original quickstart surface, FR-7). The alias keeps client.tasks.{list,get,create} byte-compatible.
usageUsageResource

EmofyClientConfig

Interface

@emofy/dev-sdk — official TypeScript SDK for the Emofy Developer API (v1).

Types are generated from the frozen OpenAPI contract (PRD-223 snapshot); the runtime is a thin hand-written fetch client with V1 envelope unwrap, a typed error surface, Retry-After-aware backoff, idempotency-key transmission, and a programmatic deprecation signal.

MemberTypeDescription
apiKeystringOrganization-scoped API key — sent as Authorization: Bearer <apiKey>.
baseUrlstringAPI base URL, e.g. https://api.emofy.net/api/v1.
fetchImpl?(input: URL | RequestInfo, init: RequestInit) => Promise<Response>Injectable fetch — defaults to global fetch. Used by the test harness.
maxRetries?numberMax automatic retries on 429 / 5xx / network error. Default 3 (§FR-1).
onDeprecation?(info: DeprecationInfo) => voidCalled once per distinct deprecated route the client observes. Default: console.warn once per path (AC2.2). Pass a no-op to silence.
retryBaseMs?numberBase backoff in ms (exponential). Default 250.
sleepImpl?(ms: number) => Promise<void>Injectable sleep — defaults to real setTimeout. Used by fake-timer tests.

EnrollmentsResource

Interface

MemberTypeDescription
createPromise<SingleResult<T>>
getSectionEnrollmentsPromise<ListResult<T>>
listPromise<ListResult<T>>
updatePromise<SingleResult<T>>

FamilyResource

Interface

MemberTypeDescription
getChildPromise<SingleResult<T>>
getChildrenPromise<ListResult<T>>
getHealthInfoPromise<SingleResult<T>>
getMembersPromise<ListResult<T>>
getTrustedContactsPromise<ListResult<T>>

FeedBookmarksResource

Interface

MemberTypeDescription
getBookmarksPromise<ListResult<T>>
toggleBookmarkPromise<SingleResult<T>>

FeedCommentsResource

Interface

MemberTypeDescription
createCommentPromise<SingleResult<T>>
deleteCommentPromise<SingleResult<T>>
getCommentsPromise<ListResult<T>>

FeedExperienceRolesResource

Interface

MemberTypeDescription
getMembersPromise<ListResult<T>>
getRolesPromise<ListResult<T>>

FeedPollsResource

Interface

MemberTypeDescription
getPollResultsPromise<SingleResult<T>>
votePollPromise<SingleResult<T>>

FeedReactionsResource

Interface

MemberTypeDescription
getReactionsPromise<ListResult<T>>
toggleReactionPromise<SingleResult<T>>

FeedReportsResource

Interface

MemberTypeDescription
getReportsPromise<ListResult<T>>
reportPostPromise<SingleResult<T>>
reviewReportPromise<SingleResult<T>>

FeedResource

Interface

MemberTypeDescription
createPostPromise<SingleResult<T>>
deletePostPromise<SingleResult<T>>
getPostPromise<SingleResult<T>>
getTimelinePromise<ListResult<T>>
updatePostPromise<SingleResult<T>>

FeedScheduledResource

Interface

MemberTypeDescription
cancelSchedulePromise<SingleResult<T>>
getScheduledPostsPromise<ListResult<T>>
publishNowPromise<SingleResult<T>>

GeneratedResources

Interface

@emofy/dev-sdk — official TypeScript SDK for the Emofy Developer API (v1).

Types are generated from the frozen OpenAPI contract (PRD-223 snapshot); the runtime is a thin hand-written fetch client with V1 envelope unwrap, a typed error surface, Retry-After-aware backoff, idempotency-key transmission, and a programmatic deprecation signal.

MemberTypeDescription
academicAcademicNamespace
familyFamilyResource
feedFeedResource
feedBookmarksFeedBookmarksResource
feedCommentsFeedCommentsResource
feedExperienceRolesFeedExperienceRolesResource
feedPollsFeedPollsResource
feedReactionsFeedReactionsResource
feedReportsFeedReportsResource
feedScheduledFeedScheduledResource
identityIdentityResource
messagingMessagingResource
profilesProfilesResource
storeStoreResource
tasksTasksResource
usageUsageResource

GradesResource

Interface

MemberTypeDescription
bulkSubmitGradesPromise<SingleResult<T>>
createAssessmentPromise<SingleResult<T>>
getStudentGradesPromise<ListResult<T>>
listAssessmentsPromise<ListResult<T>>
listGradesPromise<ListResult<T>>
submitGradePromise<SingleResult<T>>

IdentityResource

Interface

MemberTypeDescription
getCurrentUserPromise<SingleResult<T>>
getMemberPromise<SingleResult<T>>
getUserPromise<SingleResult<T>>
listMembersPromise<ListResult<T>>
listUsersPromise<ListResult<T>>

LessonsResource

Interface

MemberTypeDescription
createPromise<SingleResult<T>>
getPromise<SingleResult<T>>
getSchedulePromise<ListResult<T>>
listPromise<ListResult<T>>
updatePromise<SingleResult<T>>

ListParams

Interface

Common pagination params for list calls (offset OR cursor).

MemberTypeDescription
cursor?string
limit?number
page?number

ListResult

Interface

Result of a list call: data plus the structured pagination meta.

MemberTypeDescription
dataT[]
metaResponseMeta
paginationPaginationMeta | undefined
rateLimitRateLimitInfo

MessagingResource

Interface

MemberTypeDescription
createConversationPromise<SingleResult<T>>
createGroupPromise<SingleResult<T>>
listConversationsPromise<ListResult<T>>
listGroupsPromise<ListResult<T>>
listMessagesPromise<ListResult<T>>
sendMessagePromise<SingleResult<T>>

PaginationMeta

Interface

Structured paginator shape carried in meta.pagination (PRD-222 AC3.1).

MemberTypeDescription
hasMoreboolean
limitnumber
nextCursor?string | null
pagenumber
total?number

ProfilesResource

Interface

MemberTypeDescription
getProfilePromise<SingleResult<T>>
listPromise<ListResult<T>>

RateLimitInfo

Interface

Rate-limit snapshot read off X-RateLimit-* headers (AC1.3).

MemberTypeDescription
limitnumber | null
remainingnumber | null
resetAtnumber | null

RequestOptions

Interface

@emofy/dev-sdk — official TypeScript SDK for the Emofy Developer API (v1).

Types are generated from the frozen OpenAPI contract (PRD-223 snapshot); the runtime is a thin hand-written fetch client with V1 envelope unwrap, a typed error surface, Retry-After-aware backoff, idempotency-key transmission, and a programmatic deprecation signal.

MemberTypeDescription
body?unknownJSON body for mutations.
headers?Record<string, string>Extra headers (merged last).
idempotencyKey?stringIdempotency key — only meaningful on mutations; sent as Idempotency-Key. The backend behavior lands in PRD-224; the SDK's job is to transmit it.
query?Record<string, string | number | boolean | null | undefined>Query params; undefined/null values are skipped.
signal?AbortSignalAbortSignal for cancellation.

ResponseMeta

Interface

The meta object on every V1 success response.

MemberTypeDescription
hasMore?boolean
limit?number
nextCursor?string | null
page?number
pagination?PaginationMeta
requestIdstring
timestampstring
total?number

SingleResult

Interface

Result of a single-resource call.

MemberTypeDescription
dataT
metaResponseMeta
rateLimitRateLimitInfo

StoreResource

Interface

MemberTypeDescription
getPromise<SingleResult<T>>Get app detail by ID
installPromise<SingleResult<T>>Install an app for the organization
listPromise<ListResult<T>>List published apps (paginated)
listInstalledPromise<ListResult<T>>List installed apps for the organization
uninstallPromise<SingleResult<T>>Uninstall an app from the organization

StudentsResource

Interface

MemberTypeDescription
getPromise<SingleResult<T>>
getEnrollmentsPromise<ListResult<T>>
listPromise<ListResult<T>>

TasksResource

Interface

MemberTypeDescription
completePromise<SingleResult<T>>
createPromise<SingleResult<T>>
deletePromise<SingleResult<T>>
getByIdPromise<SingleResult<T>>
listPromise<ListResult<T>>
listProjectsPromise<ListResult<T>>
reopenPromise<SingleResult<T>>
updatePromise<SingleResult<T>>

TeachersResource

Interface

MemberTypeDescription
getPromise<SingleResult<T>>
listPromise<ListResult<T>>

UsageResource

Interface

MemberTypeDescription
getKeyUsagePromise<SingleResult<T>>Per-API-key usage breakdown (org-owned keys only)
getOrgUsagePromise<SingleResult<T>>Org API usage time-series (requests / errors / p95 / rate-limit hits)

V1Envelope

Interface

Generic V1 success envelope.

MemberTypeDescription
dataT
metaResponseMeta

VerifyWebhookOptions

Interface

MemberTypeDescription
now?numberOverride "now" (ms) — for deterministic tests. Default Date.now().
toleranceMs?numberReplay tolerance in ms. Default 5 minutes (matches the platform contract).

Type aliases

CreateTaskBody

Type alias

Request-body type for creating a task, sourced from the generated contract.

type CreateTaskBody = components["schemas"]["V1CreateTaskDto"]

EmofyApiErrorCode

Type alias

Open union: a known code (autocompleted) OR any other string the server may return. (string & {}) preserves literal-completion for the known members.

type EmofyApiErrorCode = KnownApiErrorCode | string & object

KnownApiErrorCode

Type alias

The stable, developer-facing V1 error codes worth branching on. Casing is intentionally lower_snake (generics/domain/reserved) — it matches the live contract verbatim. Family UPPER_SNAKE codes are covered by the open fallback.

type KnownApiErrorCode = "bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "validation_error" | "rate_limit_exceeded" | "internal_error" | "unknown_error" | "report_not_found" | "report_not_pending" | "post_already_deleted" | "self_report_not_allowed" | "invalid_user_report_body" | "invalid_moderation_query" | "invalid_review_action_body" | "organization_context_required" | "membership_inactive" | "missing_initdata" | "initdata_invalid" | "initdata_expired" | "credential_not_found" | "scope_insufficient" | "scope_unmapped" | "invalid_cursor" | "idempotency_conflict" | "idempotency_key_reused" | "org_quota_exceeded"

On this page