npm package: @legendsoflearning/lol-sdk-core
Description: Core client library for Legends of Learning API
Latest version: 0.0.4

# @legendsoflearning/lol-sdk-core

Core TypeScript SDK for Legends of Learning GraphQL APIs.

## Installation

```bash
npm install @legendsoflearning/lol-sdk-core @apollo/client graphql
```

## Available APIs

| API | Import Path | Description |
|-----|-------------|-------------|
| **Teachers** | `@legendsoflearning/lol-sdk-core/teachers` | Teacher portal - assignments, students, groups, games |
| **Public** | `@legendsoflearning/lol-sdk-core/public` | Public game access, search, questions |
| **Play** | `@legendsoflearning/lol-sdk-core/play` | Student gameplay - assignments, activities, progress |
| **Parents** | `@legendsoflearning/lol-sdk-core/parents` | Parent portal - children, subscriptions, progress |
| **Admins** | `@legendsoflearning/lol-sdk-core/admins` | Admin portal - districts, schools, users |
| **Developers** | `@legendsoflearning/lol-sdk-core/developers` | Developer portal - games, versions, uploads |
| **Agents** | `@legendsoflearning/lol-sdk-core/agents` | Internal agent management |
| **Translation Hub** | `@legendsoflearning/lol-sdk-core/translation-hub` | Translation management for games |

## Usage

### Import Types and Documents

```typescript
// Import typed documents for queries
import {
  GetAssignmentPlayDocument,
  CompleteActivityDocument,
  type GetAssignmentPlayQuery
} from '@legendsoflearning/lol-sdk-core/play'

import {
  GetCurrentUserDocument,
  ListChildrenDocument,
  type ListChildrenQuery
} from '@legendsoflearning/lol-sdk-core/parents'

import {
  GetDistrictsDocument,
  type GetDistrictsQuery
} from '@legendsoflearning/lol-sdk-core/admins'
```

### With Apollo Client

```typescript
import { useQuery, useMutation } from '@apollo/client'
import {
  GetAssignmentPlayDocument,
  CompleteActivityDocument
} from '@legendsoflearning/lol-sdk-core/play'

function AssignmentPlayer({ assignmentId }: { assignmentId: string }) {
  const { data, loading } = useQuery(GetAssignmentPlayDocument, {
    variables: { assignmentId, awakening: false }
  })

  const [completeActivity] = useMutation(CompleteActivityDocument)

  // data is fully typed!
  const play = data?.assignmentPlay

  // ...
}
```

### Agents API

```typescript
import {
  // Agent queries/mutations
  GetAgentsDocument,
  GetAgentDocument,
  CreateAgentDocument,
  UpdateAgentDocument,
  // Tool queries/mutations
  GetAgentsToolsDocument,
  GetAgentsToolDocument,
  AssignToolToAgentDocument,
  // Schedule queries/mutations
  GetAgentsSchedulesDocument,
  CreateAgentsScheduleDocument,
  // Conversation queries/mutations
  GetAgentsConversationsDocument,
  GetAgentsConversationDocument,
  SendAgentsMessageDocument,
  // Run queries/mutations
  GetAgentsRunsDocument,
  GetAgentsRunDocument,
  CancelAgentsRunDocument,
  // Usage queries
  GetAgentsUsageStatsDocument,
  GetAgentsUsageDailyDocument,
  // Admin queries/mutations
  GetAgentsCurrentAdminDocument,
  // Types
  type Agent,
  type AgentRole,
  type AgentStatus
} from '@legendsoflearning/lol-sdk-core/agents'
```

## API Coverage

### Teachers API
- User management, groups, students
- Assignments and assignment sets
- Games and learning objectives
- Questions and assessments
- Review mode

### Public API
- Public game access (`GetPublicGame`)
- Game listings (`GetGames`)
- Search collections (`SearchCollections`)
- Questions (`GetQuestions`)
- Answer checking (`CheckAnswer`)

### Play API
- Assignment play (`GetAssignmentPlay`)
- Activity management (`CompleteActivity`, `AnswerQuestion`)
- Video progress (`ReportVideoLessonProgress`)
- Mini-game progress (`ReportMiniGameProgress`, `SaveMiniGameState`)
- Real-time subscriptions (`AssignmentPaused`, `AssignmentStopped`, etc.)

### Parents API
- Current user (`GetCurrentUser`, `GetMyAccountDetails`)
- Children management (`ListChildren`, `CreateStudent`, `ConnectToStudent`)
- Student details (`GetStudentDetails`, `GetAccountPageStudentDetails`)
- Progress tracking (`GetStandardProgression`, `GetFocusAreaParentStatuses`)
- Subscriptions (`GetSubscriptionPlans`, `SubscribePlayer`)
- Fluency facts (`GetFluencyFacts`, `GetFluencyFactProgressStatuses`)

### Admins API
- Districts (`GetDistricts`)
- States (`GetStates`)
- Schools (`GetSchools`)
- Users (`GetUsers`)
- District regions (`GetDistrictRegions`)

### Developers API
- Current developer (`GetCurrentDeveloper`)
- Games management (`GetDeveloperGames`, `GetDeveloperGame`, `UpdateGame`)
- Game versions (`CreateGameVersion`, `SubmitGameVersion`)
- File uploads (`RequestSignedUploadUrl`, `CompleteFileUpload`)
- User management (`CreateDeveloperUser`, `UpdateDeveloperPassword`)

## Development

### Building

```bash
pnpm build
```

### Updating Schemas

```bash
./scripts/sync-schemas.sh
```

### Adding New Documents

See `scripts/README.md` for detailed instructions on adding new APIs or updating documents.

## Changelog

See [CHANGELOG.md](./CHANGELOG.md) for release history.