Open refacktor opened 1 month ago
Most of my code that uses this stuff was written at my former employer, but I think call
syntax is supposed to closely follow the HTTP method arguments as in the following:
let query = %* { "delimiter": "/", "max-keys": 1000 }
let path = %* { "Bucket": "some-bucket" }
# create the recallable
let recall = listObjectsV2.call(query = query, path = path)
# issue the call and close the fd
let reply = recall.issueAndClose()
if reply.code.is2xx:
var stream = newStringStream reply.body
let xml = parseXml stream
let contents = xml.findAll "Contents"
# ...
else:
raise KeyError.newException reply.uncompressed
This probably looks really verbose to you, but realize that these APIs are all wrappers generated from the OpenAPI specifications; the verbosity of the generated API can be really critical to allowing the user to hack together any crazy combination of input validators, service url transmogrification, response processors, threaded clients, mocked calls, and so on. It's really designed to be the layer beneath the API that you write for "normal" use.
I am now using version 2626.5.2 with the latest fixes.
Trying to list the contents of an S3 bucket.
After looking at the example in the
README
and looking at the code ins3_20060301.nim
, this was my best attempt:Output:
This probably is user error. I don't know enough Nim yet to be able to debug further. e.g.
echo rs.headers
doesn't compile.Any tips on where to look next, would be appreciated!