@@ -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
8888import { 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
0 commit comments