MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / FetchAndProcess

Method FetchAndProcess

docs/test-csharp-snippets/Module.cs:133–148  ·  view source on GitHub ↗
(ProcedureContext ctx, string url)

Source from the content-addressed store, hash-verified

131 }
132
133 [SpacetimeDB.Procedure]
134 public static void FetchAndProcess(ProcedureContext ctx, string url)
135 {
136 // Fetch external data
137 var result = ctx.Http.Get(url);
138 var response = result.UnwrapOrThrow();
139 var body = response.Body.ToStringUtf8Lossy();
140 var itemId = ParseId(body);
141
142 // Process within a transaction
143 ctx.WithTx(txCtx =>
144 {
145 ProcessItemLogic(itemId);
146 return 0;
147 });
148 }
149
150 private static ulong ParseId(string body)
151 {

Callers

nothing calls this directly

Calls 4

ToStringUtf8LossyMethod · 0.80
GetMethod · 0.45
UnwrapOrThrowMethod · 0.45
WithTxMethod · 0.45

Tested by

no test coverage detected