An unofficial Swift client for the HackerRank for Work REST API, with typed models and a no-network mock backend.
Documentation | Swift Package Index
.package(url: "https://github.com/adamtheturtle/HackerRankKit.git", from: "0.8.0")Releases before 0.8.0 modelled a wire contract that did not match the API, so 0.8.0 is the earliest version worth starting from. Upgrading from an earlier one? See UPGRADING.md.
Add HackerRankKit to your app target and HackerRankKitMock to tests or demos that should run without the network.
HackerRankKit: Typed API client for tests, candidates, questions, interviews, users, teams, and the audit log.HackerRankKitMock: In-process fake API seeded with canned data.
import HackerRankKit
let client = try HackerRankClient(token: "your-personal-access-token")
let tests = try await client.testsPage()
// `duration`, `roleIDs`, and `experience` are required by the create API alongside the name.
let created = try await client.createTest(
name: "Phone screen",
duration: 60,
roleIDs: ["backend-engineer"],
experience: ["Senior"]
)Pass QuestionWriteOptions(customSystemPrompt: "Give hints without solving the task.") when creating or updating a project question.
Prompts may contain up to 15,000 characters and are sent as the top-level custom_system_prompt field, as confirmed by HackerRank support.
nil omits the field; "" explicitly clears it.
Whitespace is preserved.
Question.customSystemPrompt exposes the value when HackerRank returns it.
- Swift 6.2+
- macOS 15+, iOS 18+, tvOS 18+, watchOS 11+, or visionOS 2+
MIT. See LICENSE.
interviewArtifacts(id:) returns either available metadata or a pending result carrying the server's Retry-After delay.
Signed download URLs expire; request fresh metadata when needed.
interviewNotes(id:noteIDs:) reads permitted notes and updateInterviewNote(id:content:) replaces the current user's note.
Use auditLogCursorPage(filters:includeTotal:) for large audit collections, then pass only nextCursor to continue the same snapshot.
auditLogOffsetPage exposes offset-window exhaustion metadata.
The existing auditLogPage(userID:) now sends the documented user filter.
Interview templates support adding question IDs and removing individual questions.
resourceJSON(path:after:query:) preserves complete v3 JSON responses for integrations needing fields beyond the display models; continuation URLs are validated before authentication.
HackerRankClient.apiCatalogue() includes all 76 documented v3 and SCIM operations and their request schemas.
executeAPI(_:pathParameters:query:body:scimToken:) exposes every documented field and retains response status, headers and JSON, including empty and pending responses.
SCIM calls require a separate provisioning credential; writes are sent once.
HackerRankAPIInputs and the catalogue's resolved input schemas support API explorers and MCP integrations.