Skip to content

Commit c2aeaca

Browse files
authored
Merge pull request #21724 from dannon/client-api-updates
Update client-api dependencies and expand usage examples
2 parents a7fedfa + 0eb00cb commit c2aeaca

File tree

7 files changed

+2054
-85
lines changed

7 files changed

+2054
-85
lines changed

client-api/README.md

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -80,30 +80,62 @@ const myHistory: HistorySummary = {
8080

8181
## Examples
8282

83-
See more in `src/example.ts` that demonstrate how to use the client:
83+
See `src/example.ts` for more complete examples. Here are some common operations:
8484

85-
### Basic Example
85+
### Working with Histories
8686

8787
```typescript
8888
import { createGalaxyApi } from "@galaxyproject/galaxy-api-client";
8989

90-
// Create a client with a specific Galaxy instance
91-
const api = createGalaxyApi("https://usegalaxy.org");
90+
const api = createGalaxyApi({
91+
baseUrl: "https://usegalaxy.org",
92+
apiKey: "your-api-key",
93+
});
9294

93-
// Example: Get a list of tools
94-
async function getTools() {
95-
const { data, error } = await api.GET("/api/tools");
95+
// List all histories
96+
const { data: histories, error } = await api.GET("/api/histories");
9697

97-
if (error) {
98-
console.error("Error fetching tools:", error);
99-
return [];
100-
}
98+
// Get most recently used history
99+
const { data: recent } = await api.GET("/api/histories/most_recently_used");
101100

102-
// Log tool count
103-
console.log(`Found ${data.length} tools`);
101+
// Get history details
102+
const { data: history } = await api.GET("/api/histories/{history_id}", {
103+
params: { path: { history_id: "abc123" } },
104+
});
104105

105-
return data;
106-
}
106+
// Update a history
107+
const { data: updated } = await api.PUT("/api/histories/{history_id}", {
108+
params: { path: { history_id: "abc123" } },
109+
body: { name: "My Analysis", annotation: "RNA-seq experiment" },
110+
});
111+
```
112+
113+
### Working with Workflows
114+
115+
```typescript
116+
// List workflows
117+
const { data: workflows } = await api.GET("/api/workflows");
118+
119+
// Get workflow details
120+
const { data: workflow } = await api.GET("/api/workflows/{workflow_id}", {
121+
params: { path: { workflow_id: "def456" } },
122+
});
123+
124+
// Check invocation status
125+
const { data: invocation } = await api.GET("/api/invocations/{invocation_id}", {
126+
params: { path: { invocation_id: "ghi789" } },
127+
});
128+
```
129+
130+
### Checking Job Status
131+
132+
```typescript
133+
// Get job details
134+
const { data: job } = await api.GET("/api/jobs/{job_id}", {
135+
params: { path: { job_id: "jkl012" } },
136+
});
137+
138+
console.log(`Job state: ${job.state}`);
107139
```
108140

109141
## Notes
@@ -160,7 +192,7 @@ This package maintains version parity with Galaxy to indicate API compatibility.
160192
}
161193
```
162194

163-
There's also a script to automate this process of syncing with galaxy version that we may want to use in other contexts, too?:
195+
There's also a script to automate syncing with the Galaxy version:
164196
165197
```bash
166198
# Using npm script

client-api/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
"author": "Galaxy Community",
3636
"license": "MIT",
3737
"dependencies": {
38-
"openapi-fetch": "^0.12.0"
38+
"openapi-fetch": "^0.15.0"
3939
},
4040
"peerDependencies": {
4141
"typescript": ">=4.5.0"
4242
},
4343
"devDependencies": {
44-
"jsdom": "^26.1.0",
44+
"jsdom": "^28.0.0",
4545
"rimraf": "^6.0.1",
4646
"ts-node": "^10.9.2",
4747
"tsup": "^8.4.0",
48-
"typescript": "^5.8.3",
49-
"vitest": "^3.1.3"
48+
"typescript": "^5.7.3",
49+
"vitest": "^4.0.14"
5050
}
5151
}

0 commit comments

Comments
 (0)