@andamio/db-api-types 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # @andamio/db-api-types
2
+
3
+ TypeScript types for the Andamio DB API, auto-generated from the OpenAPI specification.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @andamio/db-api-types
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### Basic Type Imports
14
+
15
+ ```typescript
16
+ import type {
17
+ CourseResponse,
18
+ CreateCourseRequest,
19
+ ModuleStatus,
20
+ } from "@andamio/db-api-types";
21
+
22
+ // Use in your code
23
+ const course: CourseResponse = {
24
+ course_code: "CS101",
25
+ title: "Introduction to Programming",
26
+ course_nft_policy_id: "abc123...",
27
+ };
28
+
29
+ const newCourse: CreateCourseRequest = {
30
+ course_code: "CS102",
31
+ title: "Advanced Programming",
32
+ };
33
+ ```
34
+
35
+ ### With openapi-fetch (Recommended)
36
+
37
+ For a fully typed API client, use with [openapi-fetch](https://openapi-ts.pages.dev/openapi-fetch/):
38
+
39
+ ```bash
40
+ npm install openapi-fetch
41
+ ```
42
+
43
+ ```typescript
44
+ import createClient from "openapi-fetch";
45
+ import type { paths } from "@andamio/db-api-types";
46
+
47
+ const client = createClient<paths>({
48
+ baseUrl: "https://api.andamio.io/api/v0",
49
+ });
50
+
51
+ // Fully typed request and response!
52
+ const { data, error } = await client.GET("/course/public/course/get/{policy_id}", {
53
+ params: {
54
+ path: { policy_id: "abc123..." },
55
+ },
56
+ });
57
+
58
+ if (data) {
59
+ console.log(data.title); // TypeScript knows this is a string
60
+ }
61
+ ```
62
+
63
+ ### Available Types
64
+
65
+ #### Request Types
66
+ - `CreateCourseRequest`, `UpdateCourseRequest`
67
+ - `CreateModuleRequest`
68
+ - `CreateSLTRequest`
69
+ - `CreateLessonRequest`
70
+ - `CreateAssignmentRequest`
71
+ - `CreateAssignmentCommitmentRequest`
72
+ - `ReviewAssignmentCommitmentRequest`
73
+ - `CreateIntroductionRequest`
74
+ - `ValidateSignatureRequest`
75
+ - `BatchUpdateModuleStatusRequest`
76
+ - `BatchConfirmModuleTransactionRequest`
77
+ - `UpdateProjectRequest`
78
+ - `CreateTaskRequest`, `UpdateTaskRequest`
79
+ - `CreateTaskCommitmentRequest`
80
+
81
+ #### Response Types
82
+ - `HealthResponse`
83
+ - `LoginSessionResponse`, `ValidateSignatureResponse`
84
+ - `CourseResponse`, `CourseListResponse`
85
+ - `CourseModuleResponse`, `CourseModuleListResponse`
86
+ - `SLTResponse`, `SLTListResponse`, `SLTSummary`
87
+ - `LessonResponse`, `LessonListResponse`
88
+ - `AssignmentResponse`
89
+ - `IntroductionResponse`
90
+ - `AssignmentCommitmentResponse`, `AssignmentCommitmentListResponse`
91
+ - `TreasuryResponse`, `TreasuryListResponse`
92
+ - `TaskResponse`, `TaskListResponse`
93
+ - `TaskCommitmentResponse`
94
+ - `ContributorResponse`
95
+ - `ContributorPrerequisiteResponse`, `ContributorPrerequisiteListResponse`
96
+ - `UserCourseStatusResponse`
97
+ - `PendingTransactionResponse`, `PendingTransactionListResponse`
98
+ - `BatchResultResponse`
99
+ - `ErrorResponse`
100
+
101
+ #### Enum Types
102
+ - `ModuleStatus`: `"DRAFT" | "PENDING_TX" | "ON_CHAIN"`
103
+ - `CommitmentStatus`: `"DRAFT" | "PENDING_TX" | "ON_CHAIN"`
104
+ - `ReviewDecision`: `"approve" | "reject"`
105
+
106
+ ## Regenerating Types
107
+
108
+ Types are generated from the OpenAPI specification. To regenerate:
109
+
110
+ ```bash
111
+ # From the typescript directory
112
+ npm run generate # From local openapi.json
113
+ npm run generate:remote # From production API
114
+
115
+ npm run build # Compile TypeScript
116
+ ```
117
+
118
+ Or using make from the project root:
119
+
120
+ ```bash
121
+ make types-all # Full workflow: install deps, generate, build
122
+ ```
123
+
124
+ ## API Documentation
125
+
126
+ - Swagger UI: https://andamio-db-api-343753432212.us-central1.run.app/docs/
127
+ - OpenAPI JSON: https://andamio-db-api-343753432212.us-central1.run.app/docs/doc.json
128
+
129
+ ## License
130
+
131
+ Apache 2.0