Repository navigation
fix(account): match account and platform types to the API; add status, DSA report, fleet and key quota methods - #61
Merged
Merged
Conversation
…, DSA report, fleet and key quota methods - UsageSummary now has the daily usage and quota objects the API returns; getUsageSummary accepts a date. Old fields are kept, deprecated. - UsageMonthlyResult carries the verification allowance block. - Pricing, consent and audit log records use the API's field names (isPopular, ctaLink, userId); audit log details is a string. - Incident status, severity and category values match the API; rows carry policy action, recommended status and actions, capped-action fields and test-traffic marking. Review inputs take typed risk levels and categories, and batch review requires moderator_external_id like single review. - Audit receipts accept resolve/reopen reviews, harm_descriptor and external_ref. - New methods: getDsaTransparencyReport (JSON or CSV text), getStatus, ping, pingComponent (a 503 is returned, not thrown or retried), getFleet, getFleetDevice, getApiKeyQuota. Closes #60
lena-sabadina
approved these changes
Nov 8, 2026
lena-sabadina
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed the type and client changes. Wire shapes are pinned by tests, deprecated fields stay for compatibility, CI is green and the full suite passes locally.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes for users
Fixed
getUsageSummary()returned an object whose declared fields were allundefined.UsageSummarynow matches the response (apiKeyId,tier,date,usage{ totalRequests, successRequests, errorRequests },quota{ requestsPerMinute, requestsPerMonth, requestsPerDay, remainingToday }), and the method accepts an optionaldate(YYYY-MM-DD). The old fields stay on the type, optional and@deprecated, so existing code still compiles.UsageMonthlyResultcarries the optionalverificationblock that enterprise verification plans receive.PricingPlanreadsisPopular/ctaLink,ConsentRecordandAuditLogEntryreaduserId, as the API spells them; the old snake_case names are deprecated.ConsentRecordgainsip_hash;AuditLogEntrygainsip_hash,user_agent,_encrypted, anddetailsis typed as the string the API sends.AccountExportResultgainsincompleteCollections/unverifiedCollections.IncidentStatusisnew | reviewed | escalated | resolved | dismissed,IncidentSeverityislow | moderate | high | critical, and a newIncidentCategoryunion lists all 16 categories. TheIncidentStatusandRiskCategoryenums gain the missing values. List filters still accept the oldermediumandreviewingspellings. Incident rows gainrecommended_actions,policy_action,recommended_status,escalation_capped(_reason),speaker_stance,action_capped(_reason)andis_test(test traffic).new_risk_level/new_risk_categorytake the values the API accepts.batchReviewIncidentsrequiresmoderator_external_id(the API already rejected calls without it), and both review methods now check for it before sending.moderator_review.actionincludesresolveandreopen; payloads gainharm_descriptorandexternal_ref.Added
getDsaTransparencyReport({ from, to, format? }): the DSA transparency report data as a typed JSON object, or the CSV as text withformat: 'csv'.getStatus(),ping(),pingComponent(component): public health endpoints. A 503 is returned as a typed answer (status: 'major_outage'/healthy: false), not thrown, and never retried.getFleet(),getFleetDevice(deviceId): device attestation reads for the org behind the API key.getApiKeyQuota().Internally,
requestnow delegates to a sharedsendstep so the text path and the status path reuse the same timeout, header and error handling.Tests
tests/account.test.tspins each wire shape. Fixtures are typed with the SDK's own interfaces, so type-only mismatches show up intsc; runtime assertions pin paths, query strings, 503 handling and validation. Two existingreviewIncidenttests called it withoutmoderator_external_id(a field the type already required) and were updated.Before the fix
npx vitest run tests/account.test.ts: 18 failed | 11 passed (29)tscover src + tests/account.test.ts: 43 errors, including:After the fix
Closes #60