أمثلة الشيفرة
لا توجد حزم SDK جاهزة. واجهة HTTP هي العقد، وهذه الأمثلة صغيرة بما يكفي لنسخها.
| اللغة | الملف |
|---|---|
| cURL | examples/curl/quickstart.sh |
| Python | examples/python/quickstart.py |
| Node / TypeScript | examples/node/quickstart.ts |
| Laravel / PHP | examples/laravel/WarkaClient.php |
| Expo, Android, iOS | examples/mobile/README.md |
AttendanceController.php
$session = $warka->startSession($employee->warka_identity_id);
// Return capture_token and upload_url to the app. The API key stays here.
$result = $warka->verify($employee->warka_identity_id, $sessionId);
match ($warka->nextStep($result)) {
'record_attendance' => Attendance::record($employee),
'supervisor_queue' => ReviewQueue::push($employee, $result['id']),
'ask_employee_to_retry' => response()->json(['retry' => $result['guidance']]),
default => ExceptionProcess::open($employee, $result['id']),
};