Skip to content

Async Core API: Resources (GET Operations) #117

@btoron

Description

@btoron

User Story

As a developer using pyOFSC in async applications
I want async versions of resource GET (read-only) methods
So that I can fetch resource data without blocking in async/await contexts

Description

Implement async versions of all resource GET operations in AsyncOFSCore.

Methods to Implement (18 total)

Currently in Sync Client

  • get_resources() - GET /rest/ofscCore/v1/resources
  • get_resource(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}
  • get_resource_descendants(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/descendants
  • get_resource_users(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/users
  • get_resource_inventories(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/inventories
  • get_resource_workskills(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/workSkills
  • get_resource_workzones(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/workZones
  • get_resource_workschedules(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/workSchedules
  • get_resource_calendar(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/workSchedules/calendarView
  • get_resource_locations(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/locations
  • get_position_history(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/positionHistory
  • get_assigned_locations(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/assignedLocations
  • get_resource_route(resource_id, date) - GET /rest/ofscCore/v1/resources/{resourceId}/routes/{date}

New Methods (Not in Sync)

  • get_resource_children(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/children
  • get_resource_assistants(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/assistants
  • get_resource_location(resource_id, location_id) - GET /rest/ofscCore/v1/resources/{resourceId}/locations/{locationId}
  • get_resource_plans(resource_id) - GET /rest/ofscCore/v1/resources/{resourceId}/plans
  • get_calendars() - GET /rest/ofscCore/v1/calendars

Acceptance Criteria

  • All methods use Pydantic models only (no raw dict responses)
  • Models exist/created in ofsc/models.py for all responses
  • Saved responses captured in tests/saved_responses/resources/
  • Live tests with @pytest.mark.uses_real_data marker
  • Model validation tests against saved responses
  • Methods follow async pattern (httpx, error handling)
  • All tests passing

Technical Design

File: ofsc/async_client/core.py
Pattern: Follow async metadata implementation pattern

Related Files

  • ofsc/async_client/core.py - Implement async methods
  • ofsc/models.py - Resource models
  • tests/async/test_async_resources_get.py - Create test file
  • tests/saved_responses/resources/ - API response files

Metadata

Metadata

Assignees

No one assigned

    Labels

    asyncAsync client implementationcoreCore API moduleenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions