(ProcedureContext ctx, string url)
| 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 | { |
nothing calls this directly
no test coverage detected