From 7ab29792eb315a0aa48b6816e088947b925ca9b1 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 25 Aug 2025 11:14:34 -0600 Subject: [PATCH] update to latest Spin WIT files This includes (minimal, raw binding) support for `spin:sqlite@3.0.0` and `spin:postgres@4.0.0`. Signed-off-by: Joel Dice --- CONTRIBUTING.md | 10 +- README.md | 2 +- docs/v3/http/index.html | 159 +- docs/v3/http/poll_loop.html | 582 +++- docs/v3/index.html | 17 +- docs/v3/key_value.html | 60 +- docs/v3/llm.html | 65 +- docs/v3/mqtt.html | 35 +- docs/v3/mysql.html | 33 +- docs/v3/postgres.html | 33 +- docs/v3/redis.html | 35 +- docs/v3/sqlite.html | 49 +- docs/v3/variables.html | 27 +- docs/v3/wit/exports/inbound_redis.html | 17 +- docs/v3/wit/exports/incoming_handler.html | 17 +- docs/v3/wit/exports/index.html | 124 +- docs/v3/wit/imports/atomics.html | 71 +- docs/v3/wit/imports/batch.html | 85 +- docs/v3/wit/imports/error.html | 63 +- docs/v3/wit/imports/index.html | 27 +- docs/v3/wit/imports/key_value.html | 93 +- docs/v3/wit/imports/llm.html | 71 +- docs/v3/wit/imports/monotonic_clock.html | 64 +- docs/v3/wit/imports/mqtt.html | 45 +- docs/v3/wit/imports/mysql.html | 43 +- docs/v3/wit/imports/outgoing_handler.html | 38 +- docs/v3/wit/imports/poll.html | 72 +- docs/v3/wit/imports/postgres.html | 43 +- docs/v3/wit/imports/rdbms_types.html | 157 +- docs/v3/wit/imports/redis.html | 167 +- docs/v3/wit/imports/redis_types.html | 41 +- .../wit/imports/spin_postgres_postgres.html | 183 +- .../imports/spin_postgres_postgres_4_0_0.html | 2456 +++++++++++++++++ docs/v3/wit/imports/spin_sqlite_sqlite.html | 518 ++++ docs/v3/wit/imports/sqlite.html | 69 +- docs/v3/wit/imports/streams.html | 420 ++- docs/v3/wit/imports/types.html | 926 +++++-- docs/v3/wit/imports/variables.html | 47 +- docs/v3/wit/imports/wasi_config_store.html | 54 +- docs/v3/wit/imports/wasi_keyvalue_store.html | 168 +- docs/v3/wit/index.html | 37 +- docs/v3/wit/types.html | 29 +- .../external-lib-example/requirements.txt | 4 +- examples/hello/README.md | 4 +- examples/hello/requirements.txt | 4 +- examples/matrix-math/requirements.txt | 4 +- examples/outgoing-request/requirements.txt | 4 +- examples/redis-trigger/requirements.txt | 4 +- examples/spin-kv/requirements.txt | 4 +- examples/spin-llm/requirements.txt | 4 +- examples/spin-mysql/requirements.txt | 4 +- examples/spin-outbound-mqtt/requirements.txt | 4 +- examples/spin-postgres/requirements.txt | 4 +- examples/spin-redis/requirements.txt | 4 +- examples/spin-sqlite/requirements.txt | 4 +- examples/spin-variables/requirements.txt | 4 +- examples/streaming/requirements.txt | 4 +- pyproject.toml | 2 +- src/spin_sdk/wit/__init__.py | 2 +- .../wit/deps/keyvalue-2024-10-17/atomic.wit | 18 +- .../wit/deps/keyvalue-2024-10-17/world.wit | 2 +- .../wit/deps/spin-postgres@4.0.0/postgres.wit | 163 ++ .../wit/deps/spin-sqlite@3.0.0/sqlite.wit | 60 + .../imports/spin_postgres_postgres_4_0_0.py | 534 ++++ .../wit/imports/spin_sqlite_sqlite.py | 137 + src/spin_sdk/wit/imports/streams.py | 26 +- src/spin_sdk/wit/imports/types.py | 2 +- src/spin_sdk/wit/spin.wit | 5 + templates/http-py/content/requirements.txt | 4 +- 69 files changed, 7556 insertions(+), 711 deletions(-) create mode 100644 docs/v3/wit/imports/spin_postgres_postgres_4_0_0.html create mode 100644 docs/v3/wit/imports/spin_sqlite_sqlite.html create mode 100644 src/spin_sdk/wit/deps/spin-postgres@4.0.0/postgres.wit create mode 100644 src/spin_sdk/wit/deps/spin-sqlite@3.0.0/sqlite.wit create mode 100644 src/spin_sdk/wit/imports/spin_postgres_postgres_4_0_0.py create mode 100644 src/spin_sdk/wit/imports/spin_sqlite_sqlite.py diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9e841dd..8ec80d0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,12 +4,12 @@ - Python - `pip` -- `componentize-py` 0.16.0 +- `componentize-py` 0.17.2 Once you have `pip` installed, you can install `componentize-py` using: ```bash -pip install componentize-py==0.16.0 +pip install componentize-py==0.17.2 ``` ### Generating the bindings @@ -22,9 +22,11 @@ componentize-py \ -d src/spin_sdk/wit \ -w spin-all \ --import-interface-name fermyon:spin/postgres@2.0.0=postgres \ + --import-interface-name spin:postgres/postgres@3.0.0=spin_postgres_postgres \ + --import-interface-name fermyon:spin/sqlite@2.0.0=sqlite \ + --world-module spin_sdk.wit \ bindings \ - bindings \ - --world-module spin_sdk.wit + bindings rm -r src/spin_sdk/wit/imports src/spin_sdk/wit/exports mv bindings/spin_sdk/wit/* src/spin_sdk/wit/ rm -r bindings diff --git a/README.md b/README.md index f3da2e1..f202c6e 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ enter a virtual environment and then install the desired packages ```shell python -m venv .venv source .venv/bin/activate -pip install componentize-py==0.16.0 spin-sdk==3.3.1 mypy==1.8.0 +pip install componentize-py==0.17.2 spin-sdk==3.4.1 mypy==1.8.0 ``` ### Hello, World diff --git a/docs/v3/http/index.html b/docs/v3/http/index.html index 3db7af2..50f5070 100644 --- a/docs/v3/http/index.html +++ b/docs/v3/http/index.html @@ -3,19 +3,30 @@ - + spin_sdk.http API documentation - + @@ -45,18 +56,136 @@

Functions

def send(request: Request) ‑> Response
+
+ +Expand source code + +
def send(request: Request) -> Response:
+    """Send an HTTP request and return a response or raise an error"""
+    loop = PollLoop()
+    asyncio.set_event_loop(loop)
+    return loop.run_until_complete(send_async(request))
+

Send an HTTP request and return a response or raise an error

async def send_and_close(sink: Sink,
data: bytes)
+
+ +Expand source code + +
async def send_and_close(sink: Sink, data: bytes):
+    await sink.send(data)
+    sink.close()
+
async def send_async(request: Request) ‑> Response
+
+ +Expand source code + +
async def send_async(request: Request) -> Response:
+    match request.method:
+        case "GET":
+            method: Method = Method_Get()
+        case "HEAD":
+            method = Method_Head()
+        case "POST":
+            method = Method_Post()
+        case "PUT":
+            method = Method_Put()
+        case "DELETE":
+            method = Method_Delete()
+        case "CONNECT":
+            method = Method_Connect()
+        case "OPTIONS":
+            method = Method_Options()
+        case "TRACE":
+            method = Method_Trace()
+        case "PATCH":
+            method = Method_Patch()
+        case _:
+            method = Method_Other(request.method)
+    
+    url_parsed = parse.urlparse(request.uri)
+
+    match url_parsed.scheme:
+        case "http":
+            scheme: Scheme = Scheme_Http()
+        case "https":
+            scheme = Scheme_Https()
+        case "":
+            scheme = Scheme_Http()
+        case _:
+            scheme = Scheme_Other(url_parsed.scheme)
+
+    headers_dict = request.headers
+
+    # Add a `content-length` header if the caller didn't include one, but did
+    # specify a body:
+    if headers_dict.get('content-length') is None:
+        content_length = len(request.body) if request.body is not None else 0
+        # Make a copy rather than mutate in place, since the caller might not
+        # expect us to mutate it:
+        headers_dict = headers_dict.copy()
+        headers_dict['content-length'] = str(content_length)
+
+    headers = list(map(
+        lambda pair: (pair[0], bytes(pair[1], "utf-8")),
+        headers_dict.items()
+    ))
+
+    outgoing_request = OutgoingRequest(Fields.from_list(headers))
+    outgoing_request.set_method(method)
+    outgoing_request.set_scheme(scheme)
+    if url_parsed.netloc == '':
+        if scheme == "http":
+            authority = ":80"
+        else:
+            authority = ":443"
+    else:
+        authority = url_parsed.netloc
+
+    outgoing_request.set_authority(authority)
+
+    path_and_query = url_parsed.path
+    if url_parsed.query:
+        path_and_query += '?' + url_parsed.query
+    outgoing_request.set_path_with_query(path_and_query)
+
+    outgoing_body = request.body if request.body is not None else bytearray()
+    sink = Sink(outgoing_request.body())
+    incoming_response: IncomingResponse = (await asyncio.gather(
+        poll_loop.send(outgoing_request),
+        send_and_close(sink, outgoing_body)
+    ))[0]
+
+    response_body = Stream(incoming_response.consume())
+    body = bytearray()
+    while True:
+        chunk = await response_body.next()
+        if chunk is None:
+            headers = incoming_response.headers()
+            simple_response = Response(
+                incoming_response.status(),
+                dict(map(
+                    lambda pair: (pair[0], str(pair[1], "utf-8")),
+                    headers.entries()
+                )),
+                bytes(body)
+            )
+            headers.__exit__(None, None, None)
+            incoming_response.__exit__(None, None, None)
+            return simple_response
+        else:
+            body += chunk
+
@@ -69,18 +198,17 @@

Classes

(*args, **kwargs)
-

Simplified handler for incoming HTTP requests using blocking, buffered I/O.

Expand source code -
class IncomingHandler(exports.IncomingHandler):
+
class IncomingHandler(Base):
     """Simplified handler for incoming HTTP requests using blocking, buffered I/O."""
-    
+
     def handle_request(self, request: Request) -> Response:
         """Handle an incoming HTTP request and return a response or raise an error"""
         raise NotImplementedError
-    
+
     def handle(self, request: IncomingRequest, response_out: ResponseOutparam):
         method = request.method()
 
@@ -164,6 +292,7 @@ 

Classes

response_stream.__exit__(None, None, None) OutgoingBody.finish(response_body, None)
+

Simplified handler for incoming HTTP requests using blocking, buffered I/O.

Ancestors

  • IncomingHandler
  • @@ -176,6 +305,14 @@

    Methods

    def handle_request(self,
    request: Request) ‑> Response
    +
    + +Expand source code + +
    def handle_request(self, request: Request) -> Response:
    +    """Handle an incoming HTTP request and return a response or raise an error"""
    +    raise NotImplementedError
    +

    Handle an incoming HTTP request and return a response or raise an error

    @@ -193,7 +330,6 @@

    Inherited members

    (method: str, uri: str, headers: MutableMapping[str, str], body: bytes | None)
    -

    An HTTP request

    Expand source code @@ -206,7 +342,8 @@

    Inherited members

    headers: MutableMapping[str, str] body: Optional[bytes]
    -

    Class variables

    +

    An HTTP request

    +

    Instance variables

    var body : bytes | None
    @@ -231,7 +368,6 @@

    Class variables

    (status: int, headers: MutableMapping[str, str], body: bytes | None)
    -

    An HTTP response

    Expand source code @@ -243,7 +379,8 @@

    Class variables

    headers: MutableMapping[str, str] body: Optional[bytes]
    -

    Class variables

    +

    An HTTP response

    +

    Instance variables

    var body : bytes | None
    @@ -315,7 +452,7 @@

    Respo diff --git a/docs/v3/http/poll_loop.html b/docs/v3/http/poll_loop.html index faceaa9..ec829bd 100644 --- a/docs/v3/http/poll_loop.html +++ b/docs/v3/http/poll_loop.html @@ -3,19 +3,30 @@ - + spin_sdk.http.poll_loop API documentation - + @@ -43,12 +54,45 @@

    Functions

    async def register(loop: PollLoop,
    pollable: Pollable)
    +
    + +Expand source code + +
    async def register(loop: PollLoop, pollable: Pollable):
    +    waker = loop.create_future()
    +    loop.wakers.append((pollable, waker))
    +    await waker
    +
    async def send(request: OutgoingRequest) ‑> IncomingResponse
    +
    + +Expand source code + +
    async def send(request: OutgoingRequest) -> IncomingResponse:
    +    """Send the specified request and wait asynchronously for the response."""
    +    
    +    future = outgoing_handler.handle(request, None)
    +
    +    while True:
    +        response = future.get()
    +        if response is None:
    +            await register(cast(PollLoop, asyncio.get_event_loop()), future.subscribe())
    +        else:
    +            future.__exit__(None, None, None)
    +            
    +            if isinstance(response, Ok):
    +                if isinstance(response.value, Ok):
    +                    return response.value.value
    +                else:
    +                    raise response.value
    +            else:
    +                raise response
    +

    Send the specified request and wait asynchronously for the response.

    @@ -60,7 +104,6 @@

    Classes

    class PollLoop
    -

    Custom asyncio event loop backed by wasi:io/poll#poll.

    Expand source code @@ -321,6 +364,7 @@

    Classes

    def set_debug(self, enabled): raise NotImplementedError
    +

    Custom asyncio event loop backed by wasi:io/poll#poll.

    Ancestors

    • asyncio.events.AbstractEventLoop
    • @@ -331,54 +375,119 @@

      Methods

      def add_reader(self, fd, callback, *args)
      +
      + +Expand source code + +
      def add_reader(self, fd, callback, *args):
      +    raise NotImplementedError
      +
      def add_signal_handler(self, sig, callback, *args)
      +
      + +Expand source code + +
      def add_signal_handler(self, sig, callback, *args):
      +    raise NotImplementedError
      +
      def add_writer(self, fd, callback, *args)
      +
      + +Expand source code + +
      def add_writer(self, fd, callback, *args):
      +    raise NotImplementedError
      +
      def call_at(self, when, callback, *args, context=None)
      +
      + +Expand source code + +
      def call_at(self, when, callback, *args, context=None):
      +    raise NotImplementedError
      +
      def call_exception_handler(self, context)
      +
      + +Expand source code + +
      def call_exception_handler(self, context):
      +    self.exception = context.get('exception', None)
      +
      def call_later(self, delay, callback, *args, context=None)
      +
      + +Expand source code + +
      def call_later(self, delay, callback, *args, context=None):
      +    raise NotImplementedError
      +
      def call_soon(self, callback, *args, context=None)
      +
      + +Expand source code + +
      def call_soon(self, callback, *args, context=None):
      +    handle = asyncio.Handle(callback, args, self, context)
      +    self.handles.append(handle)
      +    return handle
      +
      def call_soon_threadsafe(self, callback, *args, context=None)
      +
      + +Expand source code + +
      def call_soon_threadsafe(self, callback, *args, context=None):
      +    raise NotImplementedError
      +
      def close(self)
      +
      + +Expand source code + +
      def close(self):
      +    self.running = False
      +

      Close the loop.

      The loop should not be running.

      This is idempotent and irreversible.

      @@ -388,6 +497,17 @@

      Methods

      async def connect_accepted_socket(self,
      protocol_factory,
      sock,
      *,
      ssl=None,
      ssl_handshake_timeout=None,
      ssl_shutdown_timeout=None)
      +
      + +Expand source code + +
      async def connect_accepted_socket(
      +        self, protocol_factory, sock,
      +        *, ssl=None,
      +        ssl_handshake_timeout=None,
      +        ssl_shutdown_timeout=None):
      +    raise NotImplementedError
      +

      Handle an accepted connection.

      This is used by servers that accept connections outside of asyncio, but use asyncio to handle connections.

      @@ -399,6 +519,13 @@

      Methods

      async def connect_read_pipe(self, protocol_factory, pipe)
      +
      + +Expand source code + +
      async def connect_read_pipe(self, protocol_factory, pipe):
      +    raise NotImplementedError
      +

      Register read pipe in event loop. Set the pipe to non-blocking mode.

      protocol_factory should instantiate object with Protocol interface. pipe is a file-like object. @@ -409,6 +536,13 @@

      Methods

      async def connect_write_pipe(self, protocol_factory, pipe)
      +
      + +Expand source code + +
      async def connect_write_pipe(self, protocol_factory, pipe):
      +    raise NotImplementedError
      +

      Register write pipe in event loop.

      protocol_factory should instantiate object with BaseProtocol interface. Pipe is file-like object already switched to nonblocking. @@ -419,12 +553,37 @@

      Methods

      async def create_connection(self,
      protocol_factory,
      host=None,
      port=None,
      *,
      ssl=None,
      family=0,
      proto=0,
      flags=0,
      sock=None,
      local_addr=None,
      server_hostname=None,
      ssl_handshake_timeout=None,
      ssl_shutdown_timeout=None,
      happy_eyeballs_delay=None,
      interleave=None)
      +
      + +Expand source code + +
      async def create_connection(
      +        self, protocol_factory, host=None, port=None,
      +        *, ssl=None, family=0, proto=0,
      +        flags=0, sock=None, local_addr=None,
      +        server_hostname=None,
      +        ssl_handshake_timeout=None,
      +        ssl_shutdown_timeout=None,
      +        happy_eyeballs_delay=None, interleave=None):
      +    raise NotImplementedError
      +
      async def create_datagram_endpoint(self,
      protocol_factory,
      local_addr=None,
      remote_addr=None,
      *,
      family=0,
      proto=0,
      flags=0,
      reuse_address=None,
      reuse_port=None,
      allow_broadcast=None,
      sock=None)
      +
      + +Expand source code + +
      async def create_datagram_endpoint(self, protocol_factory,
      +                                   local_addr=None, remote_addr=None, *,
      +                                   family=0, proto=0, flags=0,
      +                                   reuse_address=None, reuse_port=None,
      +                                   allow_broadcast=None, sock=None):
      +    raise NotImplementedError
      +

      A coroutine which creates a datagram endpoint.

      This method will try to establish the endpoint in the background. When successful, the coroutine returns a (transport, protocol) pair.

      @@ -450,12 +609,33 @@

      Methods

      def create_future(self)
      +
      + +Expand source code + +
      def create_future(self):
      +    return asyncio.Future(loop=self)
      +
      async def create_server(self,
      protocol_factory,
      host=None,
      port=None,
      *,
      family=0,
      flags=1,
      sock=None,
      backlog=100,
      ssl=None,
      reuse_address=None,
      reuse_port=None,
      ssl_handshake_timeout=None,
      ssl_shutdown_timeout=None,
      start_serving=True)
      +
      + +Expand source code + +
      async def create_server(
      +        self, protocol_factory, host=None, port=None,
      +        *, family=socket.AF_UNSPEC,
      +        flags=socket.AI_PASSIVE, sock=None, backlog=100,
      +        ssl=None, reuse_address=None, reuse_port=None,
      +        ssl_handshake_timeout=None,
      +        ssl_shutdown_timeout=None,
      +        start_serving=True):
      +    raise NotImplementedError
      +

      A coroutine which creates a TCP server bound to host and port.

      The return value is a Server object which can be used to stop the service.

      @@ -497,18 +677,49 @@

      Methods

      def create_task(self, coroutine)
      +
      + +Expand source code + +
      def create_task(self, coroutine):
      +    return asyncio.Task(coroutine, loop=self)
      +
      async def create_unix_connection(self,
      protocol_factory,
      path=None,
      *,
      ssl=None,
      sock=None,
      server_hostname=None,
      ssl_handshake_timeout=None,
      ssl_shutdown_timeout=None)
      +
      + +Expand source code + +
      async def create_unix_connection(
      +        self, protocol_factory, path=None, *,
      +        ssl=None, sock=None,
      +        server_hostname=None,
      +        ssl_handshake_timeout=None,
      +        ssl_shutdown_timeout=None):
      +    raise NotImplementedError
      +
      async def create_unix_server(self,
      protocol_factory,
      path=None,
      *,
      sock=None,
      backlog=100,
      ssl=None,
      ssl_handshake_timeout=None,
      ssl_shutdown_timeout=None,
      start_serving=True)
      +
      + +Expand source code + +
      async def create_unix_server(
      +        self, protocol_factory, path=None, *,
      +        sock=None, backlog=100, ssl=None,
      +        ssl_handshake_timeout=None,
      +        ssl_shutdown_timeout=None,
      +        start_serving=True):
      +    raise NotImplementedError
      +

      A coroutine which creates a UNIX Domain Socket server.

      The return value is a Server object, which can be used to stop the service.

      @@ -534,84 +745,214 @@

      Methods

      def default_exception_handler(self, context)
      +
      + +Expand source code + +
      def default_exception_handler(self, context):
      +    raise NotImplementedError
      +
      def get_debug(self)
      +
      + +Expand source code + +
      def get_debug(self):
      +    return False
      +
      def get_exception_handler(self)
      +
      + +Expand source code + +
      def get_exception_handler(self):
      +    raise NotImplementedError
      +
      def get_task_factory(self)
      +
      + +Expand source code + +
      def get_task_factory(self):
      +    raise NotImplementedError
      +
      async def getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0)
      +
      + +Expand source code + +
      async def getaddrinfo(self, host, port, *,
      +                      family=0, type=0, proto=0, flags=0):
      +    raise NotImplementedError
      +
      async def getnameinfo(self, sockaddr, flags=0)
      +
      + +Expand source code + +
      async def getnameinfo(self, sockaddr, flags=0):
      +    raise NotImplementedError
      +
      def is_closed(self)
      +
      + +Expand source code + +
      def is_closed(self):
      +    return not self.running
      +

      Returns True if the event loop was closed.

      def is_running(self)
      +
      + +Expand source code + +
      def is_running(self):
      +    return self.running
      +

      Return whether the event loop is currently running.

      def remove_reader(self, fd)
      +
      + +Expand source code + +
      def remove_reader(self, fd):
      +    raise NotImplementedError
      +
      def remove_signal_handler(self, sig)
      +
      + +Expand source code + +
      def remove_signal_handler(self, sig):
      +    raise NotImplementedError
      +
      def remove_writer(self, fd)
      +
      + +Expand source code + +
      def remove_writer(self, fd):
      +    raise NotImplementedError
      +
      def run_forever(self)
      +
      + +Expand source code + +
      def run_forever(self):
      +    raise NotImplementedError
      +

      Run the event loop until stop() is called.

      def run_in_executor(self, executor, func, *args)
      +
      + +Expand source code + +
      def run_in_executor(self, executor, func, *args):
      +    raise NotImplementedError
      +
      def run_until_complete(self, future)
      +
      + +Expand source code + +
      def run_until_complete(self, future):
      +    future = asyncio.ensure_future(future, loop=self)
      +
      +    self.running = True
      +    asyncio.events._set_running_loop(self)
      +    while self.running and not future.done():
      +        handles = self.handles
      +        self.handles = []
      +        for handle in handles:
      +            if not handle._cancelled:
      +                handle._run()
      +            
      +        if self.wakers:
      +            [pollables, wakers] = list(map(list, zip(*self.wakers)))
      +            
      +            new_wakers = []
      +            ready = [False] * len(pollables)
      +            for index in poll.poll(pollables):
      +                ready[index] = True
      +            
      +            for (ready, pollable), waker in zip(zip(ready, pollables), wakers):
      +                if ready:
      +                    pollable.__exit__(None, None, None)
      +                    waker.set_result(None)
      +                else:
      +                    new_wakers.append((pollable, waker))
      +
      +            self.wakers = new_wakers
      +
      +        if self.exception is not None:
      +            raise self.exception
      +        
      +    return future.result()
      +

      Run the event loop until a Future is done.

      Return the Future's result, or raise its exception.

      @@ -619,6 +960,14 @@

      Methods

      async def sendfile(self, transport, file, offset=0, count=None, *, fallback=True)
      +
      + +Expand source code + +
      async def sendfile(self, transport, file, offset=0, count=None,
      +                   *, fallback=True):
      +    raise NotImplementedError
      +

      Send a file through a transport.

      Return an amount of sent bytes.

      @@ -626,96 +975,213 @@

      Methods

      def set_debug(self, enabled)
      +
      + +Expand source code + +
      def set_debug(self, enabled):
      +    raise NotImplementedError
      +
      def set_default_executor(self, executor)
      +
      + +Expand source code + +
      def set_default_executor(self, executor):
      +    raise NotImplementedError
      +
      def set_exception_handler(self, handler)
      +
      + +Expand source code + +
      def set_exception_handler(self, handler):
      +    raise NotImplementedError
      +
      def set_task_factory(self, factory)
      +
      + +Expand source code + +
      def set_task_factory(self, factory):
      +    raise NotImplementedError
      +
      def shutdown_asyncgens(self)
      +
      + +Expand source code + +
      def shutdown_asyncgens(self):
      +    pass
      +

      Shutdown all active asynchronous generators.

      async def shutdown_default_executor(self)
      +
      + +Expand source code + +
      async def shutdown_default_executor(self):
      +    raise NotImplementedError
      +

      Schedule the shutdown of the default executor.

      async def sock_accept(self, sock)
      +
      + +Expand source code + +
      async def sock_accept(self, sock):
      +    raise NotImplementedError
      +
      async def sock_connect(self, sock, address)
      +
      + +Expand source code + +
      async def sock_connect(self, sock, address):
      +    raise NotImplementedError
      +
      async def sock_recv(self, sock, nbytes)
      +
      + +Expand source code + +
      async def sock_recv(self, sock, nbytes):
      +    raise NotImplementedError
      +
      async def sock_recv_into(self, sock, buf)
      +
      + +Expand source code + +
      async def sock_recv_into(self, sock, buf):
      +    raise NotImplementedError
      +
      async def sock_recvfrom(self, sock, bufsize)
      +
      + +Expand source code + +
      async def sock_recvfrom(self, sock, bufsize):
      +    raise NotImplementedError
      +
      async def sock_recvfrom_into(self, sock, buf, nbytes=0)
      +
      + +Expand source code + +
      async def sock_recvfrom_into(self, sock, buf, nbytes=0):
      +    raise NotImplementedError
      +
      async def sock_sendall(self, sock, data)
      +
      + +Expand source code + +
      async def sock_sendall(self, sock, data):
      +    raise NotImplementedError
      +
      async def sock_sendfile(self, sock, file, offset=0, count=None, *, fallback=None)
      +
      + +Expand source code + +
      async def sock_sendfile(self, sock, file, offset=0, count=None,
      +                        *, fallback=None):
      +    raise NotImplementedError
      +
      async def sock_sendto(self, sock, data, address)
      +
      + +Expand source code + +
      async def sock_sendto(self, sock, data, address):
      +    raise NotImplementedError
      +
      async def start_tls(self,
      transport,
      protocol,
      sslcontext,
      *,
      server_side=False,
      server_hostname=None,
      ssl_handshake_timeout=None,
      ssl_shutdown_timeout=None)
      +
      + +Expand source code + +
      async def start_tls(self, transport, protocol, sslcontext, *,
      +                    server_side=False,
      +                    server_hostname=None,
      +                    ssl_handshake_timeout=None,
      +                    ssl_shutdown_timeout=None):
      +    raise NotImplementedError
      +

      Upgrade a transport to TLS.

      Return a new transport that protocol should start using immediately.

      @@ -724,6 +1190,13 @@

      Methods

      def stop(self)
      +
      + +Expand source code + +
      def stop(self):
      +    self.running = False
      +

      Stop the event loop as soon as reasonable.

      Exactly how soon that is may depend on the implementation, but no more I/O callbacks should be scheduled.

      @@ -732,18 +1205,47 @@

      Methods

      async def subprocess_exec(self, protocol_factory, *args, stdin=-1, stdout=-1, stderr=-1, **kwargs)
      +
      + +Expand source code + +
      async def subprocess_exec(self, protocol_factory, *args,
      +                          stdin=subprocess.PIPE,
      +                          stdout=subprocess.PIPE,
      +                          stderr=subprocess.PIPE,
      +                          **kwargs):
      +    raise NotImplementedError
      +
      async def subprocess_shell(self, protocol_factory, cmd, *, stdin=-1, stdout=-1, stderr=-1, **kwargs)
      +
      + +Expand source code + +
      async def subprocess_shell(self, protocol_factory, cmd, *,
      +                           stdin=subprocess.PIPE,
      +                           stdout=subprocess.PIPE,
      +                           stderr=subprocess.PIPE,
      +                           **kwargs):
      +    raise NotImplementedError
      +
      def time(self)
      +
      + +Expand source code + +
      def time(self):
      +    raise NotImplementedError
      +
    @@ -753,7 +1255,6 @@

    Methods

    (body: OutgoingBody)
    -

    Writer abstraction over wasi-http/types#outgoing-body.

    Expand source code @@ -794,18 +1295,57 @@

    Methods

    OutgoingBody.finish(self.body, None) self.body = None
    +

    Writer abstraction over wasi-http/types#outgoing-body.

    Methods

    def close(self)
    +
    + +Expand source code + +
    def close(self):
    +    """Close the stream, indicating no further data will be written."""
    +
    +    self.stream.__exit__(None, None, None)
    +    self.stream = None
    +    OutgoingBody.finish(self.body, None)
    +    self.body = None
    +

    Close the stream, indicating no further data will be written.

    async def send(self, chunk: bytes)
    +
    + +Expand source code + +
    async def send(self, chunk: bytes):
    +    """Write the specified bytes to the sink.
    +
    +    This may need to yield according to the backpressure requirements of the sink.
    +    """
    +    offset = 0
    +    flushing = False
    +    while True:
    +        count = self.stream.check_write()
    +        if count == 0:
    +            await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
    +        elif offset == len(chunk):
    +            if flushing:
    +                return
    +            else:
    +                self.stream.flush()
    +                flushing = True
    +        else:
    +            count = min(count, len(chunk) - offset)
    +            self.stream.write(chunk[offset:offset+count])
    +            offset += count
    +

    Write the specified bytes to the sink.

    This may need to yield according to the backpressure requirements of the sink.

    @@ -816,7 +1356,6 @@

    Methods

    (body: IncomingBody)
    -

    Reader abstraction over wasi:http/types#incoming-body.

    Expand source code @@ -853,12 +1392,43 @@

    Methods

    else: raise e
    +

    Reader abstraction over wasi:http/types#incoming-body.

    Methods

    async def next(self) ‑> bytes | None
    +
    + +Expand source code + +
    async def next(self) -> Optional[bytes]:
    +    """Wait for the next chunk of data to arrive on the stream.
    +
    +    This will return `None` when the end of the stream has been reached.
    +    """
    +    while True:
    +        try:
    +            if self.stream is None:
    +                return None
    +            else:
    +                buffer = self.stream.read(READ_SIZE)
    +                if len(buffer) == 0:
    +                    await register(cast(PollLoop, asyncio.get_event_loop()), self.stream.subscribe())
    +                else:
    +                    return buffer
    +        except Err as e:
    +            if isinstance(e.value, StreamError_Closed):
    +                if self.stream is not None:
    +                    self.stream.__exit__(None, None, None)
    +                    self.stream = None
    +                if self.body is not None:
    +                    IncomingBody.finish(self.body)
    +                    self.body = None
    +            else:
    +                raise e
    +

    Wait for the next chunk of data to arrive on the stream.

    This will return None when the end of the stream has been reached.

    @@ -963,7 +1533,7 @@

    -

    Generated by pdoc 0.11.3.

    +

    Generated by pdoc 0.11.6.

    diff --git a/docs/v3/index.html b/docs/v3/index.html index ce66592..2c1f5f9 100644 --- a/docs/v3/index.html +++ b/docs/v3/index.html @@ -3,19 +3,30 @@ - + spin_sdk API documentation - + @@ -104,7 +115,7 @@

    Sub-modules

    diff --git a/docs/v3/key_value.html b/docs/v3/key_value.html index 7c4b546..5332031 100644 --- a/docs/v3/key_value.html +++ b/docs/v3/key_value.html @@ -3,19 +3,30 @@ - + spin_sdk.key_value API documentation - + @@ -38,6 +49,30 @@

    Functions

    def open(name: str) ‑> Store
    +
    + +Expand source code + +
    def open(name: str) -> Store:
    +    """
    +    Open the store with the specified name.
    +  
    +    If `name` is "default", the default store is opened.  Otherwise, `name` must
    +    refer to a store defined and configured in a runtime configuration file
    +    supplied with the application.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_NoSuchStore)` will be raised if the `name` is not recognized.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_AccessDenied)` will be raised if the requesting component does not have
    +    access to the specified store.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_StoreTableFull)` will be raised if too many stores have been opened simultaneously.
    +    Closing one or more previously opened stores might address this using the `__exit__` method.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_Other(str))` will be raised if some implementation specific error has occured (e.g I/O)
    +    """
    +    return Store.open(name)
    +

    Open the store with the specified name.

    If name is "default", the default store is opened. Otherwise, name must @@ -54,6 +89,25 @@

    Functions

    def open_default() ‑> Store
    +
    + +Expand source code + +
    def open_default() -> Store:
    +    """
    +    Open the default store.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_AccessDenied)`
    +    will be raised if the requesting component does not have access to the
    +    default store.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_StoreTableFull)` will be raised if too many stores have been opened simultaneously.
    +    Closing one or more previously opened stores might address this using the `__exit__` method.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error_Other(str))` will be raised if some implementation specific error has occured (e.g I/O)
    +    """
    +    return Store.open("default")
    +

    Open the default store.

    A Err(Error_AccessDenied) will be raised if the requesting component does not have access to the @@ -87,7 +141,7 @@

    Functions

    diff --git a/docs/v3/llm.html b/docs/v3/llm.html index 8c49ce3..a24a1c8 100644 --- a/docs/v3/llm.html +++ b/docs/v3/llm.html @@ -3,19 +3,30 @@ - + spin_sdk.llm API documentation - + @@ -38,6 +49,20 @@

    Functions

    def generate_embeddings(model: str, text: Sequence[str]) ‑> EmbeddingsResult
    +
    + +Expand source code + +
    def generate_embeddings(model: str, text: Sequence[str]) -> spin_llm.EmbeddingsResult:
    +    """
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_RuntimeError(str))` will be raised if there are any runtime errors.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_InvalidInput(str))` will be raised if an invalid input is provided.
    +    """
    +    return spin_llm.generate_embeddings(model, text)
    +

    A Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

    A Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

    A Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

    @@ -46,6 +71,21 @@

    Functions

    def infer(model: str, prompt: str) ‑> InferencingResult
    +
    + +Expand source code + +
    def infer(model: str, prompt: str) -> spin_llm.InferencingResult:
    +    """
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_RuntimeError(str))` will be raised if there are any runtime errors.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_InvalidInput(str))` will be raised if an invalid input is provided.
    +    """
    +    options = InferencingParams
    +    return spin_llm.infer(model, prompt, options)
    +

    A Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

    A Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

    A Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

    @@ -54,6 +94,21 @@

    Functions

    def infer_with_options(model: str,
    prompt: str,
    options: InferencingParams | None) ‑> InferencingResult
    +
    + +Expand source code + +
    def infer_with_options(model: str, prompt: str, options: Optional[InferencingParams]) -> spin_llm.InferencingResult:
    +    """
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_ModelNotSupported)` will be raised if the component does not have access to the specified model.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_RuntimeError(str))` will be raised if there are any runtime errors.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error_InvalidInput(str))` will be raised if an invalid input is provided.
    +    """
    +    options = options or InferencingParams
    +    return spin_llm.infer(model, prompt, options)
    +

    A Err(Error_ModelNotSupported) will be raised if the component does not have access to the specified model.

    A Err(Error_RuntimeError(str)) will be raised if there are any runtime errors.

    A Err(Error_InvalidInput(str)) will be raised if an invalid input is provided.

    @@ -68,7 +123,6 @@

    Classes

    (max_tokens: int = 100,
    repeat_penalty: float = 1.1,
    repeat_penalty_last_n_token_count: int = 64,
    temperature: float = 0.8,
    top_k: int = 40,
    top_p: float = 0.9)
    -

    InferencingParams(max_tokens: int = 100, repeat_penalty: float = 1.1, repeat_penalty_last_n_token_count: int = 64, temperature: float = 0.8, top_k: int = 40, top_p: float = 0.9)

    Expand source code @@ -82,7 +136,8 @@

    Classes

    top_k: int = 40 top_p: float = 0.9
    -

    Class variables

    +

    InferencingParams(max_tokens: int = 100, repeat_penalty: float = 1.1, repeat_penalty_last_n_token_count: int = 64, temperature: float = 0.8, top_k: int = 40, top_p: float = 0.9)

    +

    Instance variables

    var max_tokens : int
    @@ -149,7 +204,7 @@

    -

    Generated by pdoc 0.11.3.

    +

    Generated by pdoc 0.11.6.

    diff --git a/docs/v3/mqtt.html b/docs/v3/mqtt.html index ea4305b..abfde73 100644 --- a/docs/v3/mqtt.html +++ b/docs/v3/mqtt.html @@ -3,19 +3,30 @@ - + spin_sdk.mqtt API documentation - + @@ -38,6 +49,24 @@

    Functions

    def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) ‑> Connection
    +
    + +Expand source code + +
    def open(address: str, username: str, password: str, keep_alive_interval_in_secs: int) -> Connection:
    +    """
    +    Open a connection to the Mqtt instance at `address`.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error_InvalidAddress)` will be raised if the connection string is invalid.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error_TooManyConnections)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error_ConnectionFailed)` will be raised if the connection failed.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error_Other(str))` when some other error occurs.
    +    """
    +    return Connection.open(address, username, password, keep_alive_interval_in_secs)
    +

    Open a connection to the Mqtt instance at address.

    A Err(Error_InvalidAddress) will be raised if the connection string is invalid.

    A Err(Error_TooManyConnections) will be raised if there are too many open connections. Closing one or more previously opened connection using the __exit__ method might help.

    @@ -68,7 +97,7 @@

    Functions

    diff --git a/docs/v3/mysql.html b/docs/v3/mysql.html index 5756460..5a364c8 100644 --- a/docs/v3/mysql.html +++ b/docs/v3/mysql.html @@ -3,19 +3,30 @@ - + spin_sdk.mysql API documentation - + @@ -38,6 +49,22 @@

    Functions

    def open(connection_string: str) ‑> Connection
    +
    + +Expand source code + +
    def open(connection_string: str) -> Connection:
    +    """
    +    Open a connection with a MySQL database.
    +    
    +    The connection_string is the MySQL URL connection string.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error_ConnectionFailed(str))` when a connection fails.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error_Other(str))` when some other error occurs.
    +    """
    +    return Connection.open(connection_string)
    +

    Open a connection with a MySQL database.

    The connection_string is the MySQL URL connection string.

    A Err(Error_ConnectionFailed(str)) when a connection fails.

    @@ -67,7 +94,7 @@

    Functions

    diff --git a/docs/v3/postgres.html b/docs/v3/postgres.html index 0f69602..5fa8908 100644 --- a/docs/v3/postgres.html +++ b/docs/v3/postgres.html @@ -3,19 +3,30 @@ - + spin_sdk.postgres API documentation - + @@ -38,6 +49,22 @@

    Functions

    def open(connection_string: str) ‑> Connection
    +
    + +Expand source code + +
    def open(connection_string: str) -> Connection:
    +    """
    +    Open a connection with a Postgres database.
    +    
    +    The connection_string is the Postgres URL connection string.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error_ConnectionFailed(str))` when a connection fails.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error_Other(str))` when some other error occurs.
    +    """
    +    return Connection.open(connection_string)
    +

    Open a connection with a Postgres database.

    The connection_string is the Postgres URL connection string.

    A Err(Error_ConnectionFailed(str)) when a connection fails.

    @@ -67,7 +94,7 @@

    Functions

    diff --git a/docs/v3/redis.html b/docs/v3/redis.html index 054abac..17ec305 100644 --- a/docs/v3/redis.html +++ b/docs/v3/redis.html @@ -3,19 +3,30 @@ - + spin_sdk.redis API documentation - + @@ -38,6 +49,24 @@

    Functions

    def open(connection_string: str) ‑> Connection
    +
    + +Expand source code + +
    def open(connection_string: str) -> Connection:
    +    """
    +    Open a connection with a Redis database.
    +    
    +    The connection_string is the Redis URL to connect to.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error_InvalidAddress)` will be raised if the connection string is invalid.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error_TooManyConnections)` will be raised if there are too many open connections. Closing one or more previously opened connection using the `__exit__` method might help.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error_Other(str))` when some other error occurs.
    +    """
    +    return Connection.open(connection_string)
    +

    Open a connection with a Redis database.

    The connection_string is the Redis URL to connect to.

    A Err(Error_InvalidAddress) will be raised if the connection string is invalid.

    @@ -68,7 +97,7 @@

    Functions

    diff --git a/docs/v3/sqlite.html b/docs/v3/sqlite.html index a3f2b99..1c5680e 100644 --- a/docs/v3/sqlite.html +++ b/docs/v3/sqlite.html @@ -3,19 +3,30 @@ - + spin_sdk.sqlite API documentation - + @@ -38,6 +49,25 @@

    Functions

    def open(name: str) ‑> Connection
    +
    + +Expand source code + +
    def open(name: str) -> Connection:
    +    """Open a connection to a named database instance.
    +
    +    If `database` is "default", the default instance is opened.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_AccessDenied)` will be raised when the component does not have access to the specified database.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_NoSuchDatabase)` will be raised when the host does not recognize the database name requested.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_InvalidConnection)` will be raised when the provided connection string is not valid.
    +    
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_Io(str))` will be raised when implementation-specific error occured (e.g. I/O)
    +    """
    +    return Connection.open(name)
    +

    Open a connection to a named database instance.

    If database is "default", the default instance is opened.

    A Err(Error_AccessDenied) will be raised when the component does not have access to the specified database.

    @@ -49,6 +79,19 @@

    Functions

    def open_default() ‑> Connection
    +
    + +Expand source code + +
    def open_default() -> Connection:
    +    """Open the default store.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_AccessDenied)` will be raised when the component does not have access to the default database.
    +
    +    A `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error_Io(str))` will be raised when implementation-specific error occured (e.g. I/O)
    +    """
    +    return Connection.open("default")
    +

    Open the default store.

    A Err(Error_AccessDenied) will be raised when the component does not have access to the default database.

    A Err(Error_Io(str)) will be raised when implementation-specific error occured (e.g. I/O)

    @@ -78,7 +121,7 @@

    Functions

    diff --git a/docs/v3/variables.html b/docs/v3/variables.html index e89948e..f06e1a9 100644 --- a/docs/v3/variables.html +++ b/docs/v3/variables.html @@ -3,19 +3,30 @@ - + spin_sdk.variables API documentation - + @@ -38,6 +49,16 @@

    Functions

    def get(key: str)
    +
    + +Expand source code + +
    def get(key: str):
    +    """
    +    Gets the value of the given key
    +    """
    +    return variables.get(key)
    +

    Gets the value of the given key

    @@ -64,7 +85,7 @@

    Functions

    diff --git a/docs/v3/wit/exports/inbound_redis.html b/docs/v3/wit/exports/inbound_redis.html index e32a5d3..6d9e59f 100644 --- a/docs/v3/wit/exports/inbound_redis.html +++ b/docs/v3/wit/exports/inbound_redis.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.exports.inbound_redis API documentation - + @@ -49,7 +60,7 @@

    Module spin_sdk.wit.exports.inbound_redis

    diff --git a/docs/v3/wit/exports/incoming_handler.html b/docs/v3/wit/exports/incoming_handler.html index 95206ce..5ad87f0 100644 --- a/docs/v3/wit/exports/incoming_handler.html +++ b/docs/v3/wit/exports/incoming_handler.html @@ -3,20 +3,31 @@ - + spin_sdk.wit.exports.incoming_handler API documentation - + @@ -52,7 +63,7 @@

    Module spin_sdk.wit.exports.incoming_handler

    diff --git a/docs/v3/wit/exports/index.html b/docs/v3/wit/exports/index.html index 3bdbfb9..2ac6fde 100644 --- a/docs/v3/wit/exports/index.html +++ b/docs/v3/wit/exports/index.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.exports API documentation - + @@ -52,6 +63,21 @@

    Classes

    (*args, **kwargs)
    +
    + +Expand source code + +
    class InboundRedis(Protocol):
    +
    +    @abstractmethod
    +    def handle_message(self, message: bytes) -> None:
    +        """
    +        The entrypoint for a Redis handler.
    +        
    +        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
    +        """
    +        raise NotImplementedError
    +

    Base class for protocol classes.

    Protocol classes are defined as::

    class Proto(Protocol):
    @@ -78,21 +104,6 @@ 

    Classes

    def meth(self) -> T: ...
    -
    - -Expand source code - -
    class InboundRedis(Protocol):
    -
    -    @abstractmethod
    -    def handle_message(self, message: bytes) -> None:
    -        """
    -        The entrypoint for a Redis handler.
    -        
    -        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
    -        """
    -        raise NotImplementedError
    -

    Ancestors

    • typing.Protocol
    • @@ -104,6 +115,19 @@

      Methods

      def handle_message(self, message: bytes) ‑> None
      +
      + +Expand source code + +
      @abstractmethod
      +def handle_message(self, message: bytes) -> None:
      +    """
      +    The entrypoint for a Redis handler.
      +    
      +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis_types.Error)`
      +    """
      +    raise NotImplementedError
      +

      The entrypoint for a Redis handler.

      Raises: Err(Error)

      @@ -114,6 +138,28 @@

      Methods

      (*args, **kwargs)
      +
      + +Expand source code + +
      class IncomingHandler(Protocol):
      +
      +    @abstractmethod
      +    def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
      +        """
      +        This function is invoked with an incoming HTTP Request, and a resource
      +        `response-outparam` which provides the capability to reply with an HTTP
      +        Response. The response is sent by calling the `response-outparam.set`
      +        method, which allows execution to continue after the response has been
      +        sent. This enables both streaming to the response body, and performing other
      +        work.
      +        
      +        The implementor of this function must write a response to the
      +        `response-outparam` before returning, or else the caller will respond
      +        with an error on its behalf.
      +        """
      +        raise NotImplementedError
      +

      Base class for protocol classes.

      Protocol classes are defined as::

      class Proto(Protocol):
      @@ -140,28 +186,6 @@ 

      Methods

      def meth(self) -> T: ...
      -
      - -Expand source code - -
      class IncomingHandler(Protocol):
      -
      -    @abstractmethod
      -    def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
      -        """
      -        This function is invoked with an incoming HTTP Request, and a resource
      -        `response-outparam` which provides the capability to reply with an HTTP
      -        Response. The response is sent by calling the `response-outparam.set`
      -        method, which allows execution to continue after the response has been
      -        sent. This enables both streaming to the response body, and performing other
      -        work.
      -        
      -        The implementor of this function must write a response to the
      -        `response-outparam` before returning, or else the caller will respond
      -        with an error on its behalf.
      -        """
      -        raise NotImplementedError
      -

      Ancestors

      • typing.Protocol
      • @@ -177,6 +201,26 @@

        Methods

        def handle(self,
        request: IncomingRequest,
        response_out: ResponseOutparam) ‑> None
        +
        + +Expand source code + +
        @abstractmethod
        +def handle(self, request: types.IncomingRequest, response_out: types.ResponseOutparam) -> None:
        +    """
        +    This function is invoked with an incoming HTTP Request, and a resource
        +    `response-outparam` which provides the capability to reply with an HTTP
        +    Response. The response is sent by calling the `response-outparam.set`
        +    method, which allows execution to continue after the response has been
        +    sent. This enables both streaming to the response body, and performing other
        +    work.
        +    
        +    The implementor of this function must write a response to the
        +    `response-outparam` before returning, or else the caller will respond
        +    with an error on its behalf.
        +    """
        +    raise NotImplementedError
        +

        This function is invoked with an incoming HTTP Request, and a resource response-outparam which provides the capability to reply with an HTTP Response. The response is sent by calling the response-outparam.set @@ -228,7 +272,7 @@

        -

        Generated by pdoc 0.11.3.

        +

        Generated by pdoc 0.11.6.

        diff --git a/docs/v3/wit/imports/atomics.html b/docs/v3/wit/imports/atomics.html index 22480d1..78c8245 100644 --- a/docs/v3/wit/imports/atomics.html +++ b/docs/v3/wit/imports/atomics.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.atomics API documentation - + @@ -52,6 +63,24 @@

        Functions

        def increment(bucket: Bucket,
        key: str,
        delta: int) ‑> int
        +
        + +Expand source code + +
        def increment(bucket: wasi_keyvalue_store.Bucket, key: str, delta: int) -> int:
        +    """
        +    Atomically increment the value associated with the key in the store by the given delta. It
        +    returns the new value.
        +    
        +    If the key does not exist in the store, it creates a new key-value pair with the value set
        +    to the given delta.
        +    
        +    If any other error occurs, it returns an `Err(error)`.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
        +    """
        +    raise NotImplementedError
        +

        Atomically increment the value associated with the key in the store by the given delta. It returns the new value.

        If the key does not exist in the store, it creates a new key-value pair with the value set @@ -63,6 +92,19 @@

        Functions

        def swap(cas: Cas,
        value: bytes) ‑> None
        +
        + +Expand source code + +
        def swap(cas: Cas, value: bytes) -> None:
        +    """
        +    Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if
        +    the CAS operation failed.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.atomics.CasError)`
        +    """
        +    raise NotImplementedError
        +

        Perform the swap on a CAS operation. This consumes the CAS handle and returns an error if the CAS operation failed.

        Raises: Err(CasError)

        @@ -76,7 +118,6 @@

        Classes

        class Cas
        -

        A handle to a CAS (compare-and-swap) operation.

        Expand source code @@ -113,6 +154,7 @@

        Classes

        """ raise NotImplementedError
        +

        A handle to a CAS (compare-and-swap) operation.

        Static methods

        @@ -130,6 +172,19 @@

        Methods

        def current(self) ‑> bytes | None
        +
        + +Expand source code + +
        def current(self) -> Optional[bytes]:
        +    """
        +    Get the current value of the key (if it exists). This allows for avoiding reads if all
        +    that is needed to ensure the atomicity of the operation
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
        +    """
        +    raise NotImplementedError
        +

        Get the current value of the key (if it exists). This allows for avoiding reads if all that is needed to ensure the atomicity of the operation

        Raises: Err(Error)

        @@ -141,7 +196,6 @@

        Methods

        (value: Cas)
        -

        CasError_CasFailed(value: spin_sdk.wit.imports.atomics.Cas)

        Expand source code @@ -150,7 +204,8 @@

        Methods

        class CasError_CasFailed: value: Cas
        -

        Class variables

        +

        CasError_CasFailed(value: spin_sdk.wit.imports.atomics.Cas)

        +

        Instance variables

        var valueCas
        @@ -163,7 +218,6 @@

        Class variables

        (value: Error_NoSuchStore | Error_AccessDenied | Error_Other)
        -

        CasError_StoreError(value: Union[spin_sdk.wit.imports.wasi_keyvalue_store.Error_NoSuchStore, spin_sdk.wit.imports.wasi_keyvalue_store.Error_AccessDenied, spin_sdk.wit.imports.wasi_keyvalue_store.Error_Other])

        Expand source code @@ -172,7 +226,8 @@

        Class variables

        class CasError_StoreError: value: wasi_keyvalue_store.Error
        -

        Class variables

        +

        CasError_StoreError(value: Union[spin_sdk.wit.imports.wasi_keyvalue_store.Error_NoSuchStore, spin_sdk.wit.imports.wasi_keyvalue_store.Error_AccessDenied, spin_sdk.wit.imports.wasi_keyvalue_store.Error_Other])

        +

        Instance variables

        var valueError_NoSuchStore | Error_AccessDenied | Error_Other
        @@ -231,7 +286,7 @@

        -

        Generated by pdoc 0.11.3.

        +

        Generated by pdoc 0.11.6.

        diff --git a/docs/v3/wit/imports/batch.html b/docs/v3/wit/imports/batch.html index e854b8b..498a266 100644 --- a/docs/v3/wit/imports/batch.html +++ b/docs/v3/wit/imports/batch.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.batch API documentation - + @@ -51,6 +62,30 @@

        Functions

        def delete_many(bucket: Bucket,
        keys: List[str]) ‑> None
        +
        + +Expand source code + +
        def delete_many(bucket: wasi_keyvalue_store.Bucket, keys: List[str]) -> None:
        +    """
        +    Delete the key-value pairs associated with the keys in the store.
        +    
        +    Note that the key-value pairs are not guaranteed to be deleted in the order they are
        +    provided.
        +    
        +    If any of the keys do not exist in the store, it skips the key.
        +    
        +    If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not
        +    rollback the key-value pairs that were already deleted. Thus, this batch operation does not
        +    guarantee atomicity, implying that some key-value pairs could be deleted while others might
        +    fail.
        +    
        +    Other concurrent operations may also be able to see the partial results.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
        +    """
        +    raise NotImplementedError
        +

        Delete the key-value pairs associated with the keys in the store.

        Note that the key-value pairs are not guaranteed to be deleted in the order they are provided.

        @@ -66,6 +101,26 @@

        Functions

        def get_many(bucket: Bucket,
        keys: List[str]) ‑> List[Tuple[str, bytes | None]]
        +
        + +Expand source code + +
        def get_many(bucket: wasi_keyvalue_store.Bucket, keys: List[str]) -> List[Tuple[str, Optional[bytes]]]:
        +    """
        +    Get the key-value pairs associated with the keys in the store. It returns a list of
        +    key-value pairs.
        +    
        +    If any of the keys do not exist in the store, it returns a `none` value for that pair in the
        +    list.
        +    
        +    MAY show an out-of-date value if there are concurrent writes to the store.
        +    
        +    If any other error occurs, it returns an `Err(error)`.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
        +    """
        +    raise NotImplementedError
        +

        Get the key-value pairs associated with the keys in the store. It returns a list of key-value pairs.

        If any of the keys do not exist in the store, it returns a none value for that pair in the @@ -78,6 +133,30 @@

        Functions

        def set_many(bucket: Bucket,
        key_values: List[Tuple[str, bytes]]) ‑> None
        +
        + +Expand source code + +
        def set_many(bucket: wasi_keyvalue_store.Bucket, key_values: List[Tuple[str, bytes]]) -> None:
        +    """
        +    Set the values associated with the keys in the store. If the key already exists in the
        +    store, it overwrites the value.
        +    
        +    Note that the key-value pairs are not guaranteed to be set in the order they are provided.
        +    
        +    If any of the keys do not exist in the store, it creates a new key-value pair.
        +    
        +    If any other error occurs, it returns an `Err(error)`. When an error occurs, it does not
        +    rollback the key-value pairs that were already set. Thus, this batch operation does not
        +    guarantee atomicity, implying that some key-value pairs could be set while others might
        +    fail.
        +    
        +    Other concurrent operations may also be able to see the partial results.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
        +    """
        +    raise NotImplementedError
        +

        Set the values associated with the keys in the store. If the key already exists in the store, it overwrites the value.

        Note that the key-value pairs are not guaranteed to be set in the order they are provided.

        @@ -115,7 +194,7 @@

        Functions

        diff --git a/docs/v3/wit/imports/error.html b/docs/v3/wit/imports/error.html index 02997db..a401958 100644 --- a/docs/v3/wit/imports/error.html +++ b/docs/v3/wit/imports/error.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.error API documentation - + @@ -39,21 +50,6 @@

        Classes

        class Error
        -

        A resource which represents some error information.

        -

        The only method provided by this resource is to-debug-string, -which provides some human-readable information about the error.

        -

        In the wasi:io package, this resource is returned through the -wasi:io/streams/stream-error type.

        -

        To provide more specific error information, other interfaces may -provide functions to further "downcast" this error into more specific -error information. For example, errors returned in streams derived -from filesystem types to be described using the filesystem's own -error-code type, using the function -wasi:filesystem/types/filesystem-error-code, which takes a parameter -borrow<error> and returns -option<wasi:filesystem/types/error-code>.

        -

        The set of functions which can "downcast" an error into a more -concrete type is open.

        Expand source code @@ -102,12 +98,43 @@

        Classes

        """ raise NotImplementedError
        +

        A resource which represents some error information.

        +

        The only method provided by this resource is to-debug-string, +which provides some human-readable information about the error.

        +

        In the wasi:io package, this resource is returned through the +wasi:io/streams/stream-error type.

        +

        To provide more specific error information, other interfaces may +provide functions to further "downcast" this error into more specific +error information. For example, errors returned in streams derived +from filesystem types to be described using the filesystem's own +error-code type, using the function +wasi:filesystem/types/filesystem-error-code, which takes a parameter +borrow<error> and returns +option<wasi:filesystem/types/error-code>.

        +

        The set of functions which can "downcast" an error into a more +concrete type is open.

        Methods

        def to_debug_string(self) ‑> str
        +
        + +Expand source code + +
        def to_debug_string(self) -> str:
        +    """
        +    Returns a string that is suitable to assist humans in debugging
        +    this error.
        +    
        +    WARNING: The returned string should not be consumed mechanically!
        +    It may change across platforms, hosts, or other implementation
        +    details. Parsing this string is a major platform-compatibility
        +    hazard.
        +    """
        +    raise NotImplementedError
        +

        Returns a string that is suitable to assist humans in debugging this error.

        WARNING: The returned string should not be consumed mechanically! @@ -144,7 +171,7 @@

        -

        Generated by pdoc 0.11.3.

        +

        Generated by pdoc 0.11.6.

        diff --git a/docs/v3/wit/imports/index.html b/docs/v3/wit/imports/index.html index c580134..0031320 100644 --- a/docs/v3/wit/imports/index.html +++ b/docs/v3/wit/imports/index.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports API documentation - + @@ -92,6 +103,14 @@

        Sub-modules

        +
        spin_sdk.wit.imports.spin_postgres_postgres_4_0_0
        +
        +
        +
        +
        spin_sdk.wit.imports.spin_sqlite_sqlite
        +
        +
        +
        spin_sdk.wit.imports.sqlite
        @@ -155,6 +174,8 @@

        Sub-modules

      • spin_sdk.wit.imports.redis
      • spin_sdk.wit.imports.redis_types
      • spin_sdk.wit.imports.spin_postgres_postgres
      • +
      • spin_sdk.wit.imports.spin_postgres_postgres_4_0_0
      • +
      • spin_sdk.wit.imports.spin_sqlite_sqlite
      • spin_sdk.wit.imports.sqlite
      • spin_sdk.wit.imports.streams
      • spin_sdk.wit.imports.types
      • @@ -167,7 +188,7 @@

        Sub-modules

        diff --git a/docs/v3/wit/imports/key_value.html b/docs/v3/wit/imports/key_value.html index 371138e..6e641df 100644 --- a/docs/v3/wit/imports/key_value.html +++ b/docs/v3/wit/imports/key_value.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.key_value API documentation - + @@ -46,7 +57,6 @@

        Classes

        class Error_AccessDenied
        -

        Error_AccessDenied()

        Expand source code @@ -55,12 +65,12 @@

        Classes

        class Error_AccessDenied: pass
        +

        Error_AccessDenied()

        class Error_NoSuchStore
        -

        Error_NoSuchStore()

        Expand source code @@ -69,13 +79,13 @@

        Classes

        class Error_NoSuchStore: pass
        +

        Error_NoSuchStore()

        class Error_Other (value: str)
        -

        Error_Other(value: str)

        Expand source code @@ -84,7 +94,8 @@

        Classes

        class Error_Other: value: str
        -

        Class variables

        +

        Error_Other(value: str)

        +

        Instance variables

        var value : str
        @@ -96,7 +107,6 @@

        Class variables

        class Error_StoreTableFull
        -

        Error_StoreTableFull()

        Expand source code @@ -105,12 +115,12 @@

        Class variables

        class Error_StoreTableFull: pass
        +

        Error_StoreTableFull()

        class Store
        -

        An open key-value store

        Expand source code @@ -181,6 +191,7 @@

        Class variables

        """ raise NotImplementedError
        +

        An open key-value store

        Static methods

        @@ -199,6 +210,20 @@

        Methods

        def delete(self, key: str) ‑> None
        +
        + +Expand source code + +
        def delete(self, key: str) -> None:
        +    """
        +    Delete the tuple with the specified `key`
        +    
        +    No error is raised if a tuple did not previously exist for `key`.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
        +    """
        +    raise NotImplementedError
        +

        Delete the tuple with the specified key

        No error is raised if a tuple did not previously exist for key.

        Raises: Err(Error)

        @@ -207,6 +232,18 @@

        Methods

        def exists(self, key: str) ‑> bool
        +
        + +Expand source code + +
        def exists(self, key: str) -> bool:
        +    """
        +    Return whether a tuple exists for the specified `key`
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
        +    """
        +    raise NotImplementedError
        +

        Return whether a tuple exists for the specified key

        Raises: Err(Error)

        @@ -214,6 +251,20 @@

        Methods

        def get(self, key: str) ‑> bytes | None
        +
        + +Expand source code + +
        def get(self, key: str) -> Optional[bytes]:
        +    """
        +    Get the value associated with the specified `key`
        +    
        +    Returns `ok(none)` if the key does not exist.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
        +    """
        +    raise NotImplementedError
        +

        Get the value associated with the specified key

        Returns ok(none) if the key does not exist.

        Raises: Err(Error)

        @@ -222,6 +273,18 @@

        Methods

        def get_keys(self) ‑> List[str]
        +
        + +Expand source code + +
        def get_keys(self) -> List[str]:
        +    """
        +    Return a list of all the keys
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
        +    """
        +    raise NotImplementedError
        +

        Return a list of all the keys

        Raises: Err(Error)

        @@ -229,6 +292,18 @@

        Methods

        def set(self, key: str, value: bytes) ‑> None
        +
        + +Expand source code + +
        def set(self, key: str, value: bytes) -> None:
        +    """
        +    Set the `value` associated with the specified `key` overwriting any existing value.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.key_value.Error)`
        +    """
        +    raise NotImplementedError
        +

        Set the value associated with the specified key overwriting any existing value.

        Raises: Err(Error)

        @@ -286,7 +361,7 @@

        -

        Generated by pdoc 0.11.3.

        +

        Generated by pdoc 0.11.6.

        diff --git a/docs/v3/wit/imports/llm.html b/docs/v3/wit/imports/llm.html index f512fc3..d63d90b 100644 --- a/docs/v3/wit/imports/llm.html +++ b/docs/v3/wit/imports/llm.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.llm API documentation - + @@ -45,6 +56,18 @@

        Functions

        def generate_embeddings(model: str, text: List[str]) ‑> EmbeddingsResult
        +
        + +Expand source code + +
        def generate_embeddings(model: str, text: List[str]) -> EmbeddingsResult:
        +    """
        +    Generate embeddings for the supplied list of text
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
        +    """
        +    raise NotImplementedError
        +

        Generate embeddings for the supplied list of text

        Raises: Err(Error)

        @@ -52,6 +75,18 @@

        Functions

        def infer(model: str,
        prompt: str,
        params: InferencingParams | None) ‑> InferencingResult
        +
        + +Expand source code + +
        def infer(model: str, prompt: str, params: Optional[InferencingParams]) -> InferencingResult:
        +    """
        +    Perform inferencing using the provided model and prompt with the given optional params
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.llm.Error)`
        +    """
        +    raise NotImplementedError
        +

        Perform inferencing using the provided model and prompt with the given optional params

        Raises: Err(Error)

        @@ -65,7 +100,6 @@

        Classes

        (embeddings: List[List[float]],
        usage: EmbeddingsUsage)
        -

        Result of generating embeddings

        Expand source code @@ -78,7 +112,8 @@

        Classes

        embeddings: List[List[float]] usage: EmbeddingsUsage
        -

        Class variables

        +

        Result of generating embeddings

        +

        Instance variables

        var embeddings : List[List[float]]
        @@ -95,7 +130,6 @@

        Class variables

        (prompt_token_count: int)
        -

        Usage related to an embeddings generation request

        Expand source code @@ -107,7 +141,8 @@

        Class variables

        """ prompt_token_count: int
        -

        Class variables

        +

        Usage related to an embeddings generation request

        +

        Instance variables

        var prompt_token_count : int
        @@ -120,7 +155,6 @@

        Class variables

        (value: str)
        -

        Error_InvalidInput(value: str)

        Expand source code @@ -129,7 +163,8 @@

        Class variables

        class Error_InvalidInput: value: str
        -

        Class variables

        +

        Error_InvalidInput(value: str)

        +

        Instance variables

        var value : str
        @@ -141,7 +176,6 @@

        Class variables

        class Error_ModelNotSupported
        -

        Error_ModelNotSupported()

        Expand source code @@ -150,13 +184,13 @@

        Class variables

        class Error_ModelNotSupported: pass
        +

        Error_ModelNotSupported()

        class Error_RuntimeError (value: str)
        -

        Error_RuntimeError(value: str)

        Expand source code @@ -165,7 +199,8 @@

        Class variables

        class Error_RuntimeError: value: str
        -

        Class variables

        +

        Error_RuntimeError(value: str)

        +

        Instance variables

        var value : str
        @@ -178,7 +213,6 @@

        Class variables

        (max_tokens: int,
        repeat_penalty: float,
        repeat_penalty_last_n_token_count: int,
        temperature: float,
        top_k: int,
        top_p: float)
        -

        Inference request parameters

        Expand source code @@ -195,7 +229,8 @@

        Class variables

        top_k: int top_p: float
        -

        Class variables

        +

        Inference request parameters

        +

        Instance variables

        var max_tokens : int
        @@ -228,7 +263,6 @@

        Class variables

        (text: str,
        usage: InferencingUsage)
        -

        An inferencing result

        Expand source code @@ -241,7 +275,8 @@

        Class variables

        text: str usage: InferencingUsage
        -

        Class variables

        +

        An inferencing result

        +

        Instance variables

        var text : str
        @@ -258,7 +293,6 @@

        Class variables

        (prompt_token_count: int, generated_token_count: int)
        -

        Usage information related to the inferencing result

        Expand source code @@ -271,7 +305,8 @@

        Class variables

        prompt_token_count: int generated_token_count: int
        -

        Class variables

        +

        Usage information related to the inferencing result

        +

        Instance variables

        var generated_token_count : int
        @@ -368,7 +403,7 @@

        -

        Generated by pdoc 0.11.3.

        +

        Generated by pdoc 0.11.6.

        diff --git a/docs/v3/wit/imports/monotonic_clock.html b/docs/v3/wit/imports/monotonic_clock.html index 21b8c97..0f9a49a 100644 --- a/docs/v3/wit/imports/monotonic_clock.html +++ b/docs/v3/wit/imports/monotonic_clock.html @@ -3,20 +3,31 @@ - + spin_sdk.wit.imports.monotonic_clock API documentation - + @@ -45,6 +56,19 @@

        Functions

        def now() ‑> int
        +
        + +Expand source code + +
        def now() -> int:
        +    """
        +    Read the current value of the clock.
        +    
        +    The clock is monotonic, therefore calling this function repeatedly will
        +    produce a sequence of non-decreasing values.
        +    """
        +    raise NotImplementedError
        +

        Read the current value of the clock.

        The clock is monotonic, therefore calling this function repeatedly will produce a sequence of non-decreasing values.

        @@ -53,6 +77,17 @@

        Functions

        def resolution() ‑> int
        +
        + +Expand source code + +
        def resolution() -> int:
        +    """
        +    Query the resolution of the clock. Returns the duration of time
        +    corresponding to a clock tick.
        +    """
        +    raise NotImplementedError
        +

        Query the resolution of the clock. Returns the duration of time corresponding to a clock tick.

        @@ -60,6 +95,18 @@

        Functions

        def subscribe_duration(when: int) ‑> Pollable
        +
        + +Expand source code + +
        def subscribe_duration(when: int) -> poll.Pollable:
        +    """
        +    Create a `pollable` which will resolve once the given duration has
        +    elapsed, starting at the time at which this function was called.
        +    occured.
        +    """
        +    raise NotImplementedError
        +

        Create a pollable which will resolve once the given duration has elapsed, starting at the time at which this function was called. occured.

        @@ -68,6 +115,17 @@

        Functions

        def subscribe_instant(when: int) ‑> Pollable
        +
        + +Expand source code + +
        def subscribe_instant(when: int) -> poll.Pollable:
        +    """
        +    Create a `pollable` which will resolve once the specified instant
        +    occured.
        +    """
        +    raise NotImplementedError
        +

        Create a pollable which will resolve once the specified instant occured.

        @@ -98,7 +156,7 @@

        Functions

        diff --git a/docs/v3/wit/imports/mqtt.html b/docs/v3/wit/imports/mqtt.html index d72c1a9..a9539ee 100644 --- a/docs/v3/wit/imports/mqtt.html +++ b/docs/v3/wit/imports/mqtt.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.mqtt API documentation - + @@ -46,7 +57,6 @@

        Classes

        class Connection
        -
        Expand source code @@ -78,6 +88,7 @@

        Classes

        """ raise NotImplementedError
        +

        Static methods

        @@ -94,6 +105,18 @@

        Methods

        def publish(self,
        topic: str,
        payload: bytes,
        qos: Qos) ‑> None
        +
        + +Expand source code + +
        def publish(self, topic: str, payload: bytes, qos: Qos) -> None:
        +    """
        +    Publish an Mqtt message to the specified `topic`.
        +    
        +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.mqtt.Error)`
        +    """
        +    raise NotImplementedError
        +

        Publish an Mqtt message to the specified topic.

        Raises: Err(Error)

        @@ -104,7 +127,6 @@

        Methods

        (value: str)
        -

        Error_ConnectionFailed(value: str)

        Expand source code @@ -113,7 +135,8 @@

        Methods

        class Error_ConnectionFailed: value: str
        -

        Class variables

        +

        Error_ConnectionFailed(value: str)

        +

        Instance variables

        var value : str
        @@ -125,7 +148,6 @@

        Class variables

        class Error_InvalidAddress
        -

        Error_InvalidAddress()

        Expand source code @@ -134,13 +156,13 @@

        Class variables

        class Error_InvalidAddress: pass
        +

        Error_InvalidAddress()

        class Error_Other (value: str)
        -

        Error_Other(value: str)

        Expand source code @@ -149,7 +171,8 @@

        Class variables

        class Error_Other: value: str
        -

        Class variables

        +

        Error_Other(value: str)

        +

        Instance variables

        var value : str
        @@ -161,7 +184,6 @@

        Class variables

        class Error_TooManyConnections
        -

        Error_TooManyConnections()

        Expand source code @@ -170,13 +192,13 @@

        Class variables

        class Error_TooManyConnections: pass
        +

        Error_TooManyConnections()

        class Qos (*args, **kwds)
        -

        QoS for publishing Mqtt messages

        Expand source code @@ -189,6 +211,7 @@

        Class variables

        AT_LEAST_ONCE = 1 EXACTLY_ONCE = 2
        +

        QoS for publishing Mqtt messages

        Ancestors

        • enum.Enum
        • @@ -268,7 +291,7 @@

          -

          Generated by pdoc 0.11.3.

          +

          Generated by pdoc 0.11.6.

          diff --git a/docs/v3/wit/imports/mysql.html b/docs/v3/wit/imports/mysql.html index 41eafcc..8958faa 100644 --- a/docs/v3/wit/imports/mysql.html +++ b/docs/v3/wit/imports/mysql.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.mysql API documentation - + @@ -39,7 +50,6 @@

          Classes

          class Connection
          -

          A connection to a MySQL database.

          Expand source code @@ -81,6 +91,7 @@

          Classes

          """ raise NotImplementedError
          +

          A connection to a MySQL database.

          Static methods

          @@ -97,6 +108,18 @@

          Methods

          def execute(self,
          statement: str,
          params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> None
          +
          + +Expand source code + +
          def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> None:
          +    """
          +    execute command to the database: insert, update, delete
          +    
          +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
          +    """
          +    raise NotImplementedError
          +

          execute command to the database: insert, update, delete

          Raises: Err(Error)

          @@ -104,6 +127,18 @@

          Methods

          def query(self,
          statement: str,
          params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet
          +
          + +Expand source code + +
          def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
          +    """
          +    query the database: select
          +    
          +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
          +    """
          +    raise NotImplementedError
          +

          query the database: select

          Raises: Err(Error)

          @@ -138,7 +173,7 @@

          -

          Generated by pdoc 0.11.3.

          +

          Generated by pdoc 0.11.6.

          diff --git a/docs/v3/wit/imports/outgoing_handler.html b/docs/v3/wit/imports/outgoing_handler.html index 454aafd..189a86b 100644 --- a/docs/v3/wit/imports/outgoing_handler.html +++ b/docs/v3/wit/imports/outgoing_handler.html @@ -3,20 +3,31 @@ - + spin_sdk.wit.imports.outgoing_handler API documentation - + @@ -40,6 +51,27 @@

          Functions

          def handle(request: OutgoingRequest,
          options: RequestOptions | None) ‑> FutureIncomingResponse
          +
          + +Expand source code + +
          def handle(request: types.OutgoingRequest, options: Optional[types.RequestOptions]) -> types.FutureIncomingResponse:
          +    """
          +    This function is invoked with an outgoing HTTP Request, and it returns
          +    a resource `future-incoming-response` which represents an HTTP Response
          +    which may arrive in the future.
          +    
          +    The `options` argument accepts optional parameters for the HTTP
          +    protocol's transport layer.
          +    
          +    This function may return an error if the `outgoing-request` is invalid
          +    or not allowed to be made. Otherwise, protocol errors are reported
          +    through the `future-incoming-response`.
          +    
          +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.ErrorCode)`
          +    """
          +    raise NotImplementedError
          +

          This function is invoked with an outgoing HTTP Request, and it returns a resource future-incoming-response which represents an HTTP Response which may arrive in the future.

          @@ -74,7 +106,7 @@

          Functions

          diff --git a/docs/v3/wit/imports/poll.html b/docs/v3/wit/imports/poll.html index 929ce3a..4894d11 100644 --- a/docs/v3/wit/imports/poll.html +++ b/docs/v3/wit/imports/poll.html @@ -3,20 +3,31 @@ - + spin_sdk.wit.imports.poll API documentation - + @@ -40,6 +51,33 @@

          Functions

          def poll(in_: List[Pollable]) ‑> List[int]
          +
          + +Expand source code + +
          def poll(in_: List[Pollable]) -> List[int]:
          +    """
          +    Poll for completion on a set of pollables.
          +    
          +    This function takes a list of pollables, which identify I/O sources of
          +    interest, and waits until one or more of the events is ready for I/O.
          +    
          +    The result `list<u32>` contains one or more indices of handles in the
          +    argument list that is ready for I/O.
          +    
          +    If the list contains more elements than can be indexed with a `u32`
          +    value, this function traps.
          +    
          +    A timeout can be implemented by adding a pollable from the
          +    wasi-clocks API to the list.
          +    
          +    This function does not return a `result`; polling in itself does not
          +    do any I/O so it doesn't fail. If any of the I/O sources identified by
          +    the pollables has an error, it is indicated by marking the source as
          +    being reaedy for I/O.
          +    """
          +    raise NotImplementedError
          +

          Poll for completion on a set of pollables.

          This function takes a list of pollables, which identify I/O sources of interest, and waits until one or more of the events is ready for I/O.

          @@ -63,7 +101,6 @@

          Classes

          class Pollable
          -

          pollable represents a single I/O event which may be ready, or not.

          Expand source code @@ -99,12 +136,27 @@

          Classes

          """ raise NotImplementedError
          +

          pollable represents a single I/O event which may be ready, or not.

          Methods

          def block(self) ‑> None
          +
          + +Expand source code + +
          def block(self) -> None:
          +    """
          +    `block` returns immediately if the pollable is ready, and otherwise
          +    blocks until ready.
          +    
          +    This function is equivalent to calling `poll.poll` on a list
          +    containing only this pollable.
          +    """
          +    raise NotImplementedError
          +

          block returns immediately if the pollable is ready, and otherwise blocks until ready.

          This function is equivalent to calling poll.poll on a list @@ -114,6 +166,18 @@

          Methods

          def ready(self) ‑> bool
          +
          + +Expand source code + +
          def ready(self) -> bool:
          +    """
          +    Return the readiness of a pollable. This function never blocks.
          +    
          +    Returns `true` when the pollable is ready, and `false` otherwise.
          +    """
          +    raise NotImplementedError
          +

          Return the readiness of a pollable. This function never blocks.

          Returns true when the pollable is ready, and false otherwise.

          @@ -152,7 +216,7 @@

          -

          Generated by pdoc 0.11.3.

          +

          Generated by pdoc 0.11.6.

          diff --git a/docs/v3/wit/imports/postgres.html b/docs/v3/wit/imports/postgres.html index b3e8d80..d501164 100644 --- a/docs/v3/wit/imports/postgres.html +++ b/docs/v3/wit/imports/postgres.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.postgres API documentation - + @@ -39,7 +50,6 @@

          Classes

          class Connection
          -

          A connection to a postgres database.

          Expand source code @@ -81,6 +91,7 @@

          Classes

          """ raise NotImplementedError
          +

          A connection to a postgres database.

          Static methods

          @@ -97,6 +108,18 @@

          Methods

          def execute(self,
          statement: str,
          params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> int
          +
          + +Expand source code + +
          def execute(self, statement: str, params: List[rdbms_types.ParameterValue]) -> int:
          +    """
          +    Execute command to the database.
          +    
          +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
          +    """
          +    raise NotImplementedError
          +

          Execute command to the database.

          Raises: Err(Error)

          @@ -104,6 +127,18 @@

          Methods

          def query(self,
          statement: str,
          params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Uint8 | ParameterValue_Uint16 | ParameterValue_Uint32 | ParameterValue_Uint64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_DbNull]) ‑> RowSet
          +
          + +Expand source code + +
          def query(self, statement: str, params: List[rdbms_types.ParameterValue]) -> rdbms_types.RowSet:
          +    """
          +    Query the database.
          +    
          +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.rdbms_types.Error)`
          +    """
          +    raise NotImplementedError
          +

          Query the database.

          Raises: Err(Error)

          @@ -138,7 +173,7 @@

          -

          Generated by pdoc 0.11.3.

          +

          Generated by pdoc 0.11.6.

          diff --git a/docs/v3/wit/imports/rdbms_types.html b/docs/v3/wit/imports/rdbms_types.html index decc1b5..60eee77 100644 --- a/docs/v3/wit/imports/rdbms_types.html +++ b/docs/v3/wit/imports/rdbms_types.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.rdbms_types API documentation - + @@ -55,7 +66,6 @@

          Classes

          (name: str,
          data_type: DbDataType)
          -

          A database column

          Expand source code @@ -68,7 +78,8 @@

          Classes

          name: str data_type: DbDataType
          -

          Class variables

          +

          A database column

          +

          Instance variables

          var data_typeDbDataType
          @@ -85,7 +96,6 @@

          Class variables

          (*args, **kwds)
          -

          Data types for a database column

          Expand source code @@ -109,6 +119,7 @@

          Class variables

          BINARY = 12 OTHER = 13
          +

          Data types for a database column

          Ancestors

          • enum.Enum
          • @@ -178,7 +189,6 @@

            Class variables

            (value: bytes)
            -

            DbValue_Binary(value: bytes)

            Expand source code @@ -187,7 +197,8 @@

            Class variables

            class DbValue_Binary: value: bytes
            -

            Class variables

            +

            DbValue_Binary(value: bytes)

            +

            Instance variables

            var value : bytes
            @@ -200,7 +211,6 @@

            Class variables

            (value: bool)
            -

            DbValue_Boolean(value: bool)

            Expand source code @@ -209,7 +219,8 @@

            Class variables

            class DbValue_Boolean: value: bool
            -

            Class variables

            +

            DbValue_Boolean(value: bool)

            +

            Instance variables

            var value : bool
            @@ -221,7 +232,6 @@

            Class variables

            class DbValue_DbNull
            -

            DbValue_DbNull()

            Expand source code @@ -230,13 +240,13 @@

            Class variables

            class DbValue_DbNull: pass
            +

            DbValue_DbNull()

            class DbValue_Floating32 (value: float)
            -

            DbValue_Floating32(value: float)

            Expand source code @@ -245,7 +255,8 @@

            Class variables

            class DbValue_Floating32: value: float
            -

            Class variables

            +

            DbValue_Floating32(value: float)

            +

            Instance variables

            var value : float
            @@ -258,7 +269,6 @@

            Class variables

            (value: float)
            -

            DbValue_Floating64(value: float)

            Expand source code @@ -267,7 +277,8 @@

            Class variables

            class DbValue_Floating64: value: float
            -

            Class variables

            +

            DbValue_Floating64(value: float)

            +

            Instance variables

            var value : float
            @@ -280,7 +291,6 @@

            Class variables

            (value: int)
            -

            DbValue_Int16(value: int)

            Expand source code @@ -289,7 +299,8 @@

            Class variables

            class DbValue_Int16: value: int
            -

            Class variables

            +

            DbValue_Int16(value: int)

            +

            Instance variables

            var value : int
            @@ -302,7 +313,6 @@

            Class variables

            (value: int)
            -

            DbValue_Int32(value: int)

            Expand source code @@ -311,7 +321,8 @@

            Class variables

            class DbValue_Int32: value: int
            -

            Class variables

            +

            DbValue_Int32(value: int)

            +

            Instance variables

            var value : int
            @@ -324,7 +335,6 @@

            Class variables

            (value: int)
            -

            DbValue_Int64(value: int)

            Expand source code @@ -333,7 +343,8 @@

            Class variables

            class DbValue_Int64: value: int
            -

            Class variables

            +

            DbValue_Int64(value: int)

            +

            Instance variables

            var value : int
            @@ -346,7 +357,6 @@

            Class variables

            (value: int)
            -

            DbValue_Int8(value: int)

            Expand source code @@ -355,7 +365,8 @@

            Class variables

            class DbValue_Int8: value: int
            -

            Class variables

            +

            DbValue_Int8(value: int)

            +

            Instance variables

            var value : int
            @@ -368,7 +379,6 @@

            Class variables

            (value: str)
            -

            DbValue_Str(value: str)

            Expand source code @@ -377,7 +387,8 @@

            Class variables

            class DbValue_Str: value: str
            -

            Class variables

            +

            DbValue_Str(value: str)

            +

            Instance variables

            var value : str
            @@ -390,7 +401,6 @@

            Class variables

            (value: int)
            -

            DbValue_Uint16(value: int)

            Expand source code @@ -399,7 +409,8 @@

            Class variables

            class DbValue_Uint16: value: int
            -

            Class variables

            +

            DbValue_Uint16(value: int)

            +

            Instance variables

            var value : int
            @@ -412,7 +423,6 @@

            Class variables

            (value: int)
            -

            DbValue_Uint32(value: int)

            Expand source code @@ -421,7 +431,8 @@

            Class variables

            class DbValue_Uint32: value: int
            -

            Class variables

            +

            DbValue_Uint32(value: int)

            +

            Instance variables

            var value : int
            @@ -434,7 +445,6 @@

            Class variables

            (value: int)
            -

            DbValue_Uint64(value: int)

            Expand source code @@ -443,7 +453,8 @@

            Class variables

            class DbValue_Uint64: value: int
            -

            Class variables

            +

            DbValue_Uint64(value: int)

            +

            Instance variables

            var value : int
            @@ -456,7 +467,6 @@

            Class variables

            (value: int)
            -

            DbValue_Uint8(value: int)

            Expand source code @@ -465,7 +475,8 @@

            Class variables

            class DbValue_Uint8: value: int
            -

            Class variables

            +

            DbValue_Uint8(value: int)

            +

            Instance variables

            var value : int
            @@ -477,7 +488,6 @@

            Class variables

            class DbValue_Unsupported
            -

            DbValue_Unsupported()

            Expand source code @@ -486,13 +496,13 @@

            Class variables

            class DbValue_Unsupported: pass
            +

            DbValue_Unsupported()

            class Error_BadParameter (value: str)
            -

            Error_BadParameter(value: str)

            Expand source code @@ -501,7 +511,8 @@

            Class variables

            class Error_BadParameter: value: str
            -

            Class variables

            +

            Error_BadParameter(value: str)

            +

            Instance variables

            var value : str
            @@ -514,7 +525,6 @@

            Class variables

            (value: str)
            -

            Error_ConnectionFailed(value: str)

            Expand source code @@ -523,7 +533,8 @@

            Class variables

            class Error_ConnectionFailed: value: str
            -

            Class variables

            +

            Error_ConnectionFailed(value: str)

            +

            Instance variables

            var value : str
            @@ -536,7 +547,6 @@

            Class variables

            (value: str)
            -

            Error_Other(value: str)

            Expand source code @@ -545,7 +555,8 @@

            Class variables

            class Error_Other: value: str
            -

            Class variables

            +

            Error_Other(value: str)

            +

            Instance variables

            var value : str
            @@ -558,7 +569,6 @@

            Class variables

            (value: str)
            -

            Error_QueryFailed(value: str)

            Expand source code @@ -567,7 +577,8 @@

            Class variables

            class Error_QueryFailed: value: str
            -

            Class variables

            +

            Error_QueryFailed(value: str)

            +

            Instance variables

            var value : str
            @@ -580,7 +591,6 @@

            Class variables

            (value: str)
            -

            Error_ValueConversionFailed(value: str)

            Expand source code @@ -589,7 +599,8 @@

            Class variables

            class Error_ValueConversionFailed: value: str
            -

            Class variables

            +

            Error_ValueConversionFailed(value: str)

            +

            Instance variables

            var value : str
            @@ -602,7 +613,6 @@

            Class variables

            (value: bytes)
            -

            ParameterValue_Binary(value: bytes)

            Expand source code @@ -611,7 +621,8 @@

            Class variables

            class ParameterValue_Binary: value: bytes
            -

            Class variables

            +

            ParameterValue_Binary(value: bytes)

            +

            Instance variables

            var value : bytes
            @@ -624,7 +635,6 @@

            Class variables

            (value: bool)
            -

            ParameterValue_Boolean(value: bool)

            Expand source code @@ -633,7 +643,8 @@

            Class variables

            class ParameterValue_Boolean: value: bool
            -

            Class variables

            +

            ParameterValue_Boolean(value: bool)

            +

            Instance variables

            var value : bool
            @@ -645,7 +656,6 @@

            Class variables

            class ParameterValue_DbNull
            -

            ParameterValue_DbNull()

            Expand source code @@ -654,13 +664,13 @@

            Class variables

            class ParameterValue_DbNull: pass
            +

            ParameterValue_DbNull()

            class ParameterValue_Floating32 (value: float)
            -

            ParameterValue_Floating32(value: float)

            Expand source code @@ -669,7 +679,8 @@

            Class variables

            class ParameterValue_Floating32: value: float
            -

            Class variables

            +

            ParameterValue_Floating32(value: float)

            +

            Instance variables

            var value : float
            @@ -682,7 +693,6 @@

            Class variables

            (value: float)
            -

            ParameterValue_Floating64(value: float)

            Expand source code @@ -691,7 +701,8 @@

            Class variables

            class ParameterValue_Floating64: value: float
            -

            Class variables

            +

            ParameterValue_Floating64(value: float)

            +

            Instance variables

            var value : float
            @@ -704,7 +715,6 @@

            Class variables

            (value: int)
            -

            ParameterValue_Int16(value: int)

            Expand source code @@ -713,7 +723,8 @@

            Class variables

            class ParameterValue_Int16: value: int
            -

            Class variables

            +

            ParameterValue_Int16(value: int)

            +

            Instance variables

            var value : int
            @@ -726,7 +737,6 @@

            Class variables

            (value: int)
            -

            ParameterValue_Int32(value: int)

            Expand source code @@ -735,7 +745,8 @@

            Class variables

            class ParameterValue_Int32: value: int
            -

            Class variables

            +

            ParameterValue_Int32(value: int)

            +

            Instance variables

            var value : int
            @@ -748,7 +759,6 @@

            Class variables

            (value: int)
            -

            ParameterValue_Int64(value: int)

            Expand source code @@ -757,7 +767,8 @@

            Class variables

            class ParameterValue_Int64: value: int
            -

            Class variables

            +

            ParameterValue_Int64(value: int)

            +

            Instance variables

            var value : int
            @@ -770,7 +781,6 @@

            Class variables

            (value: int)
            -

            ParameterValue_Int8(value: int)

            Expand source code @@ -779,7 +789,8 @@

            Class variables

            class ParameterValue_Int8: value: int
            -

            Class variables

            +

            ParameterValue_Int8(value: int)

            +

            Instance variables

            var value : int
            @@ -792,7 +803,6 @@

            Class variables

            (value: str)
            -

            ParameterValue_Str(value: str)

            Expand source code @@ -801,7 +811,8 @@

            Class variables

            class ParameterValue_Str: value: str
            -

            Class variables

            +

            ParameterValue_Str(value: str)

            +

            Instance variables

            var value : str
            @@ -814,7 +825,6 @@

            Class variables

            (value: int)
            -

            ParameterValue_Uint16(value: int)

            Expand source code @@ -823,7 +833,8 @@

            Class variables

            class ParameterValue_Uint16: value: int
            -

            Class variables

            +

            ParameterValue_Uint16(value: int)

            +

            Instance variables

            var value : int
            @@ -836,7 +847,6 @@

            Class variables

            (value: int)
            -

            ParameterValue_Uint32(value: int)

            Expand source code @@ -845,7 +855,8 @@

            Class variables

            class ParameterValue_Uint32: value: int
            -

            Class variables

            +

            ParameterValue_Uint32(value: int)

            +

            Instance variables

            var value : int
            @@ -858,7 +869,6 @@

            Class variables

            (value: int)
            -

            ParameterValue_Uint64(value: int)

            Expand source code @@ -867,7 +877,8 @@

            Class variables

            class ParameterValue_Uint64: value: int
            -

            Class variables

            +

            ParameterValue_Uint64(value: int)

            +

            Instance variables

            var value : int
            @@ -880,7 +891,6 @@

            Class variables

            (value: int)
            -

            ParameterValue_Uint8(value: int)

            Expand source code @@ -889,7 +899,8 @@

            Class variables

            class ParameterValue_Uint8: value: int
            -

            Class variables

            +

            ParameterValue_Uint8(value: int)

            +

            Instance variables

            var value : int
            @@ -902,7 +913,6 @@

            Class variables

            (columns: List[Column],
            rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Uint8 | DbValue_Uint16 | DbValue_Uint32 | DbValue_Uint64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_DbNull | DbValue_Unsupported]])
            -

            A set of database rows

            Expand source code @@ -915,7 +925,8 @@

            Class variables

            columns: List[Column] rows: List[List[DbValue]]
            -

            Class variables

            +

            A set of database rows

            +

            Instance variables

            var columns : List[Column]
            @@ -1183,7 +1194,7 @@

            -

            Generated by pdoc 0.11.3.

            +

            Generated by pdoc 0.11.6.

            diff --git a/docs/v3/wit/imports/redis.html b/docs/v3/wit/imports/redis.html index 05cad5f..737a241 100644 --- a/docs/v3/wit/imports/redis.html +++ b/docs/v3/wit/imports/redis.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.redis API documentation - + @@ -54,7 +65,6 @@

            Classes

            class Connection
            -
            Expand source code @@ -150,6 +160,7 @@

            Classes

            """ raise NotImplementedError
            +

            Static methods

            @@ -166,6 +177,20 @@

            Methods

            def del_(self, keys: List[str]) ‑> int
            +
            + +Expand source code + +
            def del_(self, keys: List[str]) -> int:
            +    """
            +    Removes the specified keys.
            +    
            +    A key is ignored if it does not exist. Returns the number of keys deleted.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Removes the specified keys.

            A key is ignored if it does not exist. Returns the number of keys deleted.

            Raises: Err(Error)

            @@ -174,6 +199,18 @@

            Methods

            def execute(self,
            command: str,
            arguments: List[RedisParameter_Int64 | RedisParameter_Binary]) ‑> List[RedisResult_Nil | RedisResult_Status | RedisResult_Int64 | RedisResult_Binary]
            +
            + +Expand source code + +
            def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]:
            +    """
            +    Execute an arbitrary Redis command and receive the result.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Execute an arbitrary Redis command and receive the result.

            Raises: Err(Error)

            @@ -181,6 +218,18 @@

            Methods

            def get(self, key: str) ‑> bytes | None
            +
            + +Expand source code + +
            def get(self, key: str) -> Optional[bytes]:
            +    """
            +    Get the value of a key.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Get the value of a key.

            Raises: Err(Error)

            @@ -188,6 +237,22 @@

            Methods

            def incr(self, key: str) ‑> int
            +
            + +Expand source code + +
            def incr(self, key: str) -> int:
            +    """
            +    Increments the number stored at key by one.
            +    
            +    If the key does not exist, it is set to 0 before performing the operation.
            +    An `error::type-error` is returned if the key contains a value of the wrong type
            +    or contains a string that can not be represented as integer.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Increments the number stored at key by one.

            If the key does not exist, it is set to 0 before performing the operation. An error::type-error is returned if the key contains a value of the wrong type @@ -198,6 +263,18 @@

            Methods

            def publish(self, channel: str, payload: bytes) ‑> None
            +
            + +Expand source code + +
            def publish(self, channel: str, payload: bytes) -> None:
            +    """
            +    Publish a Redis message to the specified channel.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Publish a Redis message to the specified channel.

            Raises: Err(Error)

            @@ -205,6 +282,18 @@

            Methods

            def sadd(self, key: str, values: List[str]) ‑> int
            +
            + +Expand source code + +
            def sadd(self, key: str, values: List[str]) -> int:
            +    """
            +    Add the specified `values` to the set named `key`, returning the number of newly-added values.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Add the specified values to the set named key, returning the number of newly-added values.

            Raises: Err(Error)

            @@ -212,6 +301,20 @@

            Methods

            def set(self, key: str, value: bytes) ‑> None
            +
            + +Expand source code + +
            def set(self, key: str, value: bytes) -> None:
            +    """
            +    Set key to value.
            +    
            +    If key already holds a value, it is overwritten.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Set key to value.

            If key already holds a value, it is overwritten.

            Raises: Err(Error)

            @@ -220,6 +323,18 @@

            Methods

            def smembers(self, key: str) ‑> List[str]
            +
            + +Expand source code + +
            def smembers(self, key: str) -> List[str]:
            +    """
            +    Retrieve the contents of the set named `key`.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Retrieve the contents of the set named key.

            Raises: Err(Error)

            @@ -227,6 +342,18 @@

            Methods

            def srem(self, key: str, values: List[str]) ‑> int
            +
            + +Expand source code + +
            def srem(self, key: str, values: List[str]) -> int:
            +    """
            +    Remove the specified `values` from the set named `key`, returning the number of newly-removed values.
            +    
            +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)`
            +    """
            +    raise NotImplementedError
            +

            Remove the specified values from the set named key, returning the number of newly-removed values.

            Raises: Err(Error)

            @@ -236,7 +363,6 @@

            Methods

            class Error_InvalidAddress
            -

            Error_InvalidAddress()

            Expand source code @@ -245,13 +371,13 @@

            Methods

            class Error_InvalidAddress: pass
            +

            Error_InvalidAddress()

            class Error_Other (value: str)
            -

            Error_Other(value: str)

            Expand source code @@ -260,7 +386,8 @@

            Methods

            class Error_Other: value: str
            -

            Class variables

            +

            Error_Other(value: str)

            +

            Instance variables

            var value : str
            @@ -272,7 +399,6 @@

            Class variables

            class Error_TooManyConnections
            -

            Error_TooManyConnections()

            Expand source code @@ -281,12 +407,12 @@

            Class variables

            class Error_TooManyConnections: pass
            +

            Error_TooManyConnections()

            class Error_TypeError
            -

            Error_TypeError()

            Expand source code @@ -295,13 +421,13 @@

            Class variables

            class Error_TypeError: pass
            +

            Error_TypeError()

            class RedisParameter_Binary (value: bytes)
            -

            RedisParameter_Binary(value: bytes)

            Expand source code @@ -310,7 +436,8 @@

            Class variables

            class RedisParameter_Binary: value: bytes
            -

            Class variables

            +

            RedisParameter_Binary(value: bytes)

            +

            Instance variables

            var value : bytes
            @@ -323,7 +450,6 @@

            Class variables

            (value: int)
            -

            RedisParameter_Int64(value: int)

            Expand source code @@ -332,7 +458,8 @@

            Class variables

            class RedisParameter_Int64: value: int
            -

            Class variables

            +

            RedisParameter_Int64(value: int)

            +

            Instance variables

            var value : int
            @@ -345,7 +472,6 @@

            Class variables

            (value: bytes)
            -

            RedisResult_Binary(value: bytes)

            Expand source code @@ -354,7 +480,8 @@

            Class variables

            class RedisResult_Binary: value: bytes
            -

            Class variables

            +

            RedisResult_Binary(value: bytes)

            +

            Instance variables

            var value : bytes
            @@ -367,7 +494,6 @@

            Class variables

            (value: int)
            -

            RedisResult_Int64(value: int)

            Expand source code @@ -376,7 +502,8 @@

            Class variables

            class RedisResult_Int64: value: int
            -

            Class variables

            +

            RedisResult_Int64(value: int)

            +

            Instance variables

            var value : int
            @@ -388,7 +515,6 @@

            Class variables

            class RedisResult_Nil
            -

            RedisResult_Nil()

            Expand source code @@ -397,13 +523,13 @@

            Class variables

            class RedisResult_Nil: pass
            +

            RedisResult_Nil()

            class RedisResult_Status (value: str)
            -

            RedisResult_Status(value: str)

            Expand source code @@ -412,7 +538,8 @@

            Class variables

            class RedisResult_Status: value: str
            -

            Class variables

            +

            RedisResult_Status(value: str)

            +

            Instance variables

            var value : str
            @@ -511,7 +638,7 @@

            -

            Generated by pdoc 0.11.3.

            +

            Generated by pdoc 0.11.6.

            diff --git a/docs/v3/wit/imports/redis_types.html b/docs/v3/wit/imports/redis_types.html index f6b3d7b..53ab98a 100644 --- a/docs/v3/wit/imports/redis_types.html +++ b/docs/v3/wit/imports/redis_types.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.redis_types API documentation - + @@ -51,7 +62,6 @@

            Classes

            (*args, **kwds)
            -

            General purpose error.

            Expand source code @@ -63,6 +73,7 @@

            Classes

            SUCCESS = 0 ERROR = 1
            +

            General purpose error.

            Ancestors

            • enum.Enum
            • @@ -84,7 +95,6 @@

              Class variables

              (value: bytes)
              -

              RedisParameter_Binary(value: bytes)

              Expand source code @@ -93,7 +103,8 @@

              Class variables

              class RedisParameter_Binary: value: bytes
              -

              Class variables

              +

              RedisParameter_Binary(value: bytes)

              +

              Instance variables

              var value : bytes
              @@ -106,7 +117,6 @@

              Class variables

              (value: int)
              -

              RedisParameter_Int64(value: int)

              Expand source code @@ -115,7 +125,8 @@

              Class variables

              class RedisParameter_Int64: value: int
              -

              Class variables

              +

              RedisParameter_Int64(value: int)

              +

              Instance variables

              var value : int
              @@ -128,7 +139,6 @@

              Class variables

              (value: bytes)
              -

              RedisResult_Binary(value: bytes)

              Expand source code @@ -137,7 +147,8 @@

              Class variables

              class RedisResult_Binary: value: bytes
              -

              Class variables

              +

              RedisResult_Binary(value: bytes)

              +

              Instance variables

              var value : bytes
              @@ -150,7 +161,6 @@

              Class variables

              (value: int)
              -

              RedisResult_Int64(value: int)

              Expand source code @@ -159,7 +169,8 @@

              Class variables

              class RedisResult_Int64: value: int
              -

              Class variables

              +

              RedisResult_Int64(value: int)

              +

              Instance variables

              var value : int
              @@ -171,7 +182,6 @@

              Class variables

              class RedisResult_Nil
              -

              RedisResult_Nil()

              Expand source code @@ -180,13 +190,13 @@

              Class variables

              class RedisResult_Nil: pass
              +

              RedisResult_Nil()

              class RedisResult_Status (value: str)
              -

              RedisResult_Status(value: str)

              Expand source code @@ -195,7 +205,8 @@

              Class variables

              class RedisResult_Status: value: str
              -

              Class variables

              +

              RedisResult_Status(value: str)

              +

              Instance variables

              var value : str
              @@ -270,7 +281,7 @@

              -

              Generated by pdoc 0.11.3.

              +

              Generated by pdoc 0.11.6.

              diff --git a/docs/v3/wit/imports/spin_postgres_postgres.html b/docs/v3/wit/imports/spin_postgres_postgres.html index 64477cd..01bed49 100644 --- a/docs/v3/wit/imports/spin_postgres_postgres.html +++ b/docs/v3/wit/imports/spin_postgres_postgres.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.spin_postgres_postgres API documentation - + @@ -55,7 +66,6 @@

              Classes

              (name: str,
              data_type: DbDataType)
              -

              A database column

              Expand source code @@ -68,7 +78,8 @@

              Classes

              name: str data_type: DbDataType
              -

              Class variables

              +

              A database column

              +

              Instance variables

              var data_typeDbDataType
              @@ -84,7 +95,6 @@

              Class variables

              class Connection
              -

              A connection to a postgres database.

              Expand source code @@ -126,6 +136,7 @@

              Class variables

              """ raise NotImplementedError
              +

              A connection to a postgres database.

              Static methods

              @@ -142,6 +153,18 @@

              Methods

              def execute(self,
              statement: str,
              params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_DbNull]) ‑> int
              +
              + +Expand source code + +
              def execute(self, statement: str, params: List[ParameterValue]) -> int:
              +    """
              +    Execute command to the database.
              +    
              +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres.Error)`
              +    """
              +    raise NotImplementedError
              +

              Execute command to the database.

              Raises: Err(Error)

              @@ -149,6 +172,18 @@

              Methods

              def query(self,
              statement: str,
              params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_DbNull]) ‑> RowSet
              +
              + +Expand source code + +
              def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
              +    """
              +    Query the database.
              +    
              +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres.Error)`
              +    """
              +    raise NotImplementedError
              +

              Query the database.

              Raises: Err(Error)

              @@ -159,7 +194,6 @@

              Methods

              (*args, **kwds)
              -

              Data types for a database column

              Expand source code @@ -183,6 +217,7 @@

              Methods

              TIMESTAMP = 12 OTHER = 13
              +

              Data types for a database column

              Ancestors

              • enum.Enum
              • @@ -252,7 +287,6 @@

                Class variables

                (value: bytes)
                -

                DbValue_Binary(value: bytes)

                Expand source code @@ -261,7 +295,8 @@

                Class variables

                class DbValue_Binary: value: bytes
                -

                Class variables

                +

                DbValue_Binary(value: bytes)

                +

                Instance variables

                var value : bytes
                @@ -274,7 +309,6 @@

                Class variables

                (value: bool)
                -

                DbValue_Boolean(value: bool)

                Expand source code @@ -283,7 +317,8 @@

                Class variables

                class DbValue_Boolean: value: bool
                -

                Class variables

                +

                DbValue_Boolean(value: bool)

                +

                Instance variables

                var value : bool
                @@ -296,7 +331,6 @@

                Class variables

                (value: Tuple[int, int, int])
                -

                DbValue_Date(value: Tuple[int, int, int])

                Expand source code @@ -305,7 +339,8 @@

                Class variables

                class DbValue_Date: value: Tuple[int, int, int]
                -

                Class variables

                +

                DbValue_Date(value: Tuple[int, int, int])

                +

                Instance variables

                var value : Tuple[int, int, int]
                @@ -318,7 +353,6 @@

                Class variables

                (value: Tuple[int, int, int, int, int, int, int])
                -

                DbValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

                Expand source code @@ -327,7 +361,8 @@

                Class variables

                class DbValue_Datetime: value: Tuple[int, int, int, int, int, int, int]
                -

                Class variables

                +

                DbValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

                +

                Instance variables

                var value : Tuple[int, int, int, int, int, int, int]
                @@ -339,7 +374,6 @@

                Class variables

                class DbValue_DbNull
                -

                DbValue_DbNull()

                Expand source code @@ -348,13 +382,13 @@

                Class variables

                class DbValue_DbNull: pass
                +

                DbValue_DbNull()

                class DbValue_Floating32 (value: float)
                -

                DbValue_Floating32(value: float)

                Expand source code @@ -363,7 +397,8 @@

                Class variables

                class DbValue_Floating32: value: float
                -

                Class variables

                +

                DbValue_Floating32(value: float)

                +

                Instance variables

                var value : float
                @@ -376,7 +411,6 @@

                Class variables

                (value: float)
                -

                DbValue_Floating64(value: float)

                Expand source code @@ -385,7 +419,8 @@

                Class variables

                class DbValue_Floating64: value: float
                -

                Class variables

                +

                DbValue_Floating64(value: float)

                +

                Instance variables

                var value : float
                @@ -398,7 +433,6 @@

                Class variables

                (value: int)
                -

                DbValue_Int16(value: int)

                Expand source code @@ -407,7 +441,8 @@

                Class variables

                class DbValue_Int16: value: int
                -

                Class variables

                +

                DbValue_Int16(value: int)

                +

                Instance variables

                var value : int
                @@ -420,7 +455,6 @@

                Class variables

                (value: int)
                -

                DbValue_Int32(value: int)

                Expand source code @@ -429,7 +463,8 @@

                Class variables

                class DbValue_Int32: value: int
                -

                Class variables

                +

                DbValue_Int32(value: int)

                +

                Instance variables

                var value : int
                @@ -442,7 +477,6 @@

                Class variables

                (value: int)
                -

                DbValue_Int64(value: int)

                Expand source code @@ -451,7 +485,8 @@

                Class variables

                class DbValue_Int64: value: int
                -

                Class variables

                +

                DbValue_Int64(value: int)

                +

                Instance variables

                var value : int
                @@ -464,7 +499,6 @@

                Class variables

                (value: int)
                -

                DbValue_Int8(value: int)

                Expand source code @@ -473,7 +507,8 @@

                Class variables

                class DbValue_Int8: value: int
                -

                Class variables

                +

                DbValue_Int8(value: int)

                +

                Instance variables

                var value : int
                @@ -486,7 +521,6 @@

                Class variables

                (value: str)
                -

                DbValue_Str(value: str)

                Expand source code @@ -495,7 +529,8 @@

                Class variables

                class DbValue_Str: value: str
                -

                Class variables

                +

                DbValue_Str(value: str)

                +

                Instance variables

                var value : str
                @@ -508,7 +543,6 @@

                Class variables

                (value: Tuple[int, int, int, int])
                -

                DbValue_Time(value: Tuple[int, int, int, int])

                Expand source code @@ -517,7 +551,8 @@

                Class variables

                class DbValue_Time: value: Tuple[int, int, int, int]
                -

                Class variables

                +

                DbValue_Time(value: Tuple[int, int, int, int])

                +

                Instance variables

                var value : Tuple[int, int, int, int]
                @@ -530,7 +565,6 @@

                Class variables

                (value: int)
                -

                DbValue_Timestamp(value: int)

                Expand source code @@ -539,7 +573,8 @@

                Class variables

                class DbValue_Timestamp: value: int
                -

                Class variables

                +

                DbValue_Timestamp(value: int)

                +

                Instance variables

                var value : int
                @@ -551,7 +586,6 @@

                Class variables

                class DbValue_Unsupported
                -

                DbValue_Unsupported()

                Expand source code @@ -560,13 +594,13 @@

                Class variables

                class DbValue_Unsupported: pass
                +

                DbValue_Unsupported()

                class Error_BadParameter (value: str)
                -

                Error_BadParameter(value: str)

                Expand source code @@ -575,7 +609,8 @@

                Class variables

                class Error_BadParameter: value: str
                -

                Class variables

                +

                Error_BadParameter(value: str)

                +

                Instance variables

                var value : str
                @@ -588,7 +623,6 @@

                Class variables

                (value: str)
                -

                Error_ConnectionFailed(value: str)

                Expand source code @@ -597,7 +631,8 @@

                Class variables

                class Error_ConnectionFailed: value: str
                -

                Class variables

                +

                Error_ConnectionFailed(value: str)

                +

                Instance variables

                var value : str
                @@ -610,7 +645,6 @@

                Class variables

                (value: str)
                -

                Error_Other(value: str)

                Expand source code @@ -619,7 +653,8 @@

                Class variables

                class Error_Other: value: str
                -

                Class variables

                +

                Error_Other(value: str)

                +

                Instance variables

                var value : str
                @@ -632,7 +667,6 @@

                Class variables

                (value: str)
                -

                Error_QueryFailed(value: str)

                Expand source code @@ -641,7 +675,8 @@

                Class variables

                class Error_QueryFailed: value: str
                -

                Class variables

                +

                Error_QueryFailed(value: str)

                +

                Instance variables

                var value : str
                @@ -654,7 +689,6 @@

                Class variables

                (value: str)
                -

                Error_ValueConversionFailed(value: str)

                Expand source code @@ -663,7 +697,8 @@

                Class variables

                class Error_ValueConversionFailed: value: str
                -

                Class variables

                +

                Error_ValueConversionFailed(value: str)

                +

                Instance variables

                var value : str
                @@ -676,7 +711,6 @@

                Class variables

                (value: bytes)
                -

                ParameterValue_Binary(value: bytes)

                Expand source code @@ -685,7 +719,8 @@

                Class variables

                class ParameterValue_Binary: value: bytes
                -

                Class variables

                +

                ParameterValue_Binary(value: bytes)

                +

                Instance variables

                var value : bytes
                @@ -698,7 +733,6 @@

                Class variables

                (value: bool)
                -

                ParameterValue_Boolean(value: bool)

                Expand source code @@ -707,7 +741,8 @@

                Class variables

                class ParameterValue_Boolean: value: bool
                -

                Class variables

                +

                ParameterValue_Boolean(value: bool)

                +

                Instance variables

                var value : bool
                @@ -720,7 +755,6 @@

                Class variables

                (value: Tuple[int, int, int])
                -

                ParameterValue_Date(value: Tuple[int, int, int])

                Expand source code @@ -729,7 +763,8 @@

                Class variables

                class ParameterValue_Date: value: Tuple[int, int, int]
                -

                Class variables

                +

                ParameterValue_Date(value: Tuple[int, int, int])

                +

                Instance variables

                var value : Tuple[int, int, int]
                @@ -742,7 +777,6 @@

                Class variables

                (value: Tuple[int, int, int, int, int, int, int])
                -

                ParameterValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

                Expand source code @@ -751,7 +785,8 @@

                Class variables

                class ParameterValue_Datetime: value: Tuple[int, int, int, int, int, int, int]
                -

                Class variables

                +

                ParameterValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

                +

                Instance variables

                var value : Tuple[int, int, int, int, int, int, int]
                @@ -763,7 +798,6 @@

                Class variables

                class ParameterValue_DbNull
                -

                ParameterValue_DbNull()

                Expand source code @@ -772,13 +806,13 @@

                Class variables

                class ParameterValue_DbNull: pass
                +

                ParameterValue_DbNull()

                class ParameterValue_Floating32 (value: float)
                -

                ParameterValue_Floating32(value: float)

                Expand source code @@ -787,7 +821,8 @@

                Class variables

                class ParameterValue_Floating32: value: float
                -

                Class variables

                +

                ParameterValue_Floating32(value: float)

                +

                Instance variables

                var value : float
                @@ -800,7 +835,6 @@

                Class variables

                (value: float)
                -

                ParameterValue_Floating64(value: float)

                Expand source code @@ -809,7 +843,8 @@

                Class variables

                class ParameterValue_Floating64: value: float
                -

                Class variables

                +

                ParameterValue_Floating64(value: float)

                +

                Instance variables

                var value : float
                @@ -822,7 +857,6 @@

                Class variables

                (value: int)
                -

                ParameterValue_Int16(value: int)

                Expand source code @@ -831,7 +865,8 @@

                Class variables

                class ParameterValue_Int16: value: int
                -

                Class variables

                +

                ParameterValue_Int16(value: int)

                +

                Instance variables

                var value : int
                @@ -844,7 +879,6 @@

                Class variables

                (value: int)
                -

                ParameterValue_Int32(value: int)

                Expand source code @@ -853,7 +887,8 @@

                Class variables

                class ParameterValue_Int32: value: int
                -

                Class variables

                +

                ParameterValue_Int32(value: int)

                +

                Instance variables

                var value : int
                @@ -866,7 +901,6 @@

                Class variables

                (value: int)
                -

                ParameterValue_Int64(value: int)

                Expand source code @@ -875,7 +909,8 @@

                Class variables

                class ParameterValue_Int64: value: int
                -

                Class variables

                +

                ParameterValue_Int64(value: int)

                +

                Instance variables

                var value : int
                @@ -888,7 +923,6 @@

                Class variables

                (value: int)
                -

                ParameterValue_Int8(value: int)

                Expand source code @@ -897,7 +931,8 @@

                Class variables

                class ParameterValue_Int8: value: int
                -

                Class variables

                +

                ParameterValue_Int8(value: int)

                +

                Instance variables

                var value : int
                @@ -910,7 +945,6 @@

                Class variables

                (value: str)
                -

                ParameterValue_Str(value: str)

                Expand source code @@ -919,7 +953,8 @@

                Class variables

                class ParameterValue_Str: value: str
                -

                Class variables

                +

                ParameterValue_Str(value: str)

                +

                Instance variables

                var value : str
                @@ -932,7 +967,6 @@

                Class variables

                (value: Tuple[int, int, int, int])
                -

                ParameterValue_Time(value: Tuple[int, int, int, int])

                Expand source code @@ -941,7 +975,8 @@

                Class variables

                class ParameterValue_Time: value: Tuple[int, int, int, int]
                -

                Class variables

                +

                ParameterValue_Time(value: Tuple[int, int, int, int])

                +

                Instance variables

                var value : Tuple[int, int, int, int]
                @@ -954,7 +989,6 @@

                Class variables

                (value: int)
                -

                ParameterValue_Timestamp(value: int)

                Expand source code @@ -963,7 +997,8 @@

                Class variables

                class ParameterValue_Timestamp: value: int
                -

                Class variables

                +

                ParameterValue_Timestamp(value: int)

                +

                Instance variables

                var value : int
                @@ -976,7 +1011,6 @@

                Class variables

                (columns: List[Column],
                rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_DbNull | DbValue_Unsupported]])
                -

                A set of database rows

                Expand source code @@ -989,7 +1023,8 @@

                Class variables

                columns: List[Column] rows: List[List[DbValue]]
                -

                Class variables

                +

                A set of database rows

                +

                Instance variables

                var columns : List[Column]
                @@ -1265,7 +1300,7 @@

                -

                Generated by pdoc 0.11.3.

                +

                Generated by pdoc 0.11.6.

                diff --git a/docs/v3/wit/imports/spin_postgres_postgres_4_0_0.html b/docs/v3/wit/imports/spin_postgres_postgres_4_0_0.html new file mode 100644 index 0000000..a950e01 --- /dev/null +++ b/docs/v3/wit/imports/spin_postgres_postgres_4_0_0.html @@ -0,0 +1,2456 @@ + + + + + + +spin_sdk.wit.imports.spin_postgres_postgres_4_0_0 API documentation + + + + + + + + + + + +
                +
                +
                +

                Module spin_sdk.wit.imports.spin_postgres_postgres_4_0_0

                +
                +
                +
                +
                +
                +
                +

                Global variables

                +
                +
                var DbDataType
                +
                +

                Data types for a database column

                +
                +
                var DbValue
                +
                +

                Database values

                +
                +
                var Error
                +
                +

                Errors related to interacting with a database.

                +
                +
                var ParameterValue
                +
                +

                Values used in parameterized queries

                +
                +
                +
                +
                +
                +
                +

                Classes

                +
                +
                +class Column +(name: str,
                data_type: DbDataType_Boolean | DbDataType_Int8 | DbDataType_Int16 | DbDataType_Int32 | DbDataType_Int64 | DbDataType_Floating32 | DbDataType_Floating64 | DbDataType_Str | DbDataType_Binary | DbDataType_Date | DbDataType_Time | DbDataType_Datetime | DbDataType_Timestamp | DbDataType_Uuid | DbDataType_Jsonb | DbDataType_Decimal | DbDataType_RangeInt32 | DbDataType_RangeInt64 | DbDataType_RangeDecimal | DbDataType_ArrayInt32 | DbDataType_ArrayInt64 | DbDataType_ArrayDecimal | DbDataType_ArrayStr | DbDataType_Interval | DbDataType_Other)
                +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Column:
                +    """
                +    A database column
                +    """
                +    name: str
                +    data_type: DbDataType
                +
                +

                A database column

                +

                Instance variables

                +
                +
                var data_typeDbDataType_Boolean | DbDataType_Int8 | DbDataType_Int16 | DbDataType_Int32 | DbDataType_Int64 | DbDataType_Floating32 | DbDataType_Floating64 | DbDataType_Str | DbDataType_Binary | DbDataType_Date | DbDataType_Time | DbDataType_Datetime | DbDataType_Timestamp | DbDataType_Uuid | DbDataType_Jsonb | DbDataType_Decimal | DbDataType_RangeInt32 | DbDataType_RangeInt64 | DbDataType_RangeDecimal | DbDataType_ArrayInt32 | DbDataType_ArrayInt64 | DbDataType_ArrayDecimal | DbDataType_ArrayStr | DbDataType_Interval | DbDataType_Other
                +
                +
                +
                +
                var name : str
                +
                +
                +
                +
                +
                +
                +class Connection +
                +
                +
                + +Expand source code + +
                class Connection:
                +    """
                +    A connection to a postgres database.
                +    """
                +    
                +    @classmethod
                +    def open(cls, address: str) -> Self:
                +        """
                +        Open a connection to the Postgres instance at `address`.
                +        
                +        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
                +        """
                +        raise NotImplementedError
                +    def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
                +        """
                +        Query the database.
                +        
                +        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
                +        """
                +        raise NotImplementedError
                +    def execute(self, statement: str, params: List[ParameterValue]) -> int:
                +        """
                +        Execute command to the database.
                +        
                +        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
                +        """
                +        raise NotImplementedError
                +    def __enter__(self) -> Self:
                +        """Returns self"""
                +        return self
                +                                
                +    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
                +        """
                +        Release this resource.
                +        """
                +        raise NotImplementedError
                +
                +

                A connection to a postgres database.

                +

                Static methods

                +
                +
                +def open(address: str) ‑> Self +
                +
                +

                Open a connection to the Postgres instance at address.

                +

                Raises: Err(Error)

                +
                +
                +

                Methods

                +
                +
                +def execute(self,
                statement: str,
                params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> int
                +
                +
                +
                + +Expand source code + +
                def execute(self, statement: str, params: List[ParameterValue]) -> int:
                +    """
                +    Execute command to the database.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
                +    """
                +    raise NotImplementedError
                +
                +

                Execute command to the database.

                +

                Raises: Err(Error)

                +
                +
                +def query(self,
                statement: str,
                params: List[ParameterValue_Boolean | ParameterValue_Int8 | ParameterValue_Int16 | ParameterValue_Int32 | ParameterValue_Int64 | ParameterValue_Floating32 | ParameterValue_Floating64 | ParameterValue_Str | ParameterValue_Binary | ParameterValue_Date | ParameterValue_Time | ParameterValue_Datetime | ParameterValue_Timestamp | ParameterValue_Uuid | ParameterValue_Jsonb | ParameterValue_Decimal | ParameterValue_RangeInt32 | ParameterValue_RangeInt64 | ParameterValue_RangeDecimal | ParameterValue_ArrayInt32 | ParameterValue_ArrayInt64 | ParameterValue_ArrayDecimal | ParameterValue_ArrayStr | ParameterValue_Interval | ParameterValue_DbNull]) ‑> RowSet
                +
                +
                +
                + +Expand source code + +
                def query(self, statement: str, params: List[ParameterValue]) -> RowSet:
                +    """
                +    Query the database.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)`
                +    """
                +    raise NotImplementedError
                +
                +

                Query the database.

                +

                Raises: Err(Error)

                +
                +
                +
                +
                +class DbDataType_ArrayDecimal +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_ArrayDecimal:
                +    pass
                +
                +

                DbDataType_ArrayDecimal()

                +
                +
                +class DbDataType_ArrayInt32 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_ArrayInt32:
                +    pass
                +
                +

                DbDataType_ArrayInt32()

                +
                +
                +class DbDataType_ArrayInt64 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_ArrayInt64:
                +    pass
                +
                +

                DbDataType_ArrayInt64()

                +
                +
                +class DbDataType_ArrayStr +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_ArrayStr:
                +    pass
                +
                +

                DbDataType_ArrayStr()

                +
                +
                +class DbDataType_Binary +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Binary:
                +    pass
                +
                +

                DbDataType_Binary()

                +
                +
                +class DbDataType_Boolean +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Boolean:
                +    pass
                +
                +

                DbDataType_Boolean()

                +
                +
                +class DbDataType_Date +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Date:
                +    pass
                +
                +

                DbDataType_Date()

                +
                +
                +class DbDataType_Datetime +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Datetime:
                +    pass
                +
                +

                DbDataType_Datetime()

                +
                +
                +class DbDataType_Decimal +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Decimal:
                +    pass
                +
                +

                DbDataType_Decimal()

                +
                +
                +class DbDataType_Floating32 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Floating32:
                +    pass
                +
                +

                DbDataType_Floating32()

                +
                +
                +class DbDataType_Floating64 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Floating64:
                +    pass
                +
                +

                DbDataType_Floating64()

                +
                +
                +class DbDataType_Int16 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Int16:
                +    pass
                +
                +

                DbDataType_Int16()

                +
                +
                +class DbDataType_Int32 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Int32:
                +    pass
                +
                +

                DbDataType_Int32()

                +
                +
                +class DbDataType_Int64 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Int64:
                +    pass
                +
                +

                DbDataType_Int64()

                +
                +
                +class DbDataType_Int8 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Int8:
                +    pass
                +
                +

                DbDataType_Int8()

                +
                +
                +class DbDataType_Interval +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Interval:
                +    pass
                +
                +

                DbDataType_Interval()

                +
                +
                +class DbDataType_Jsonb +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Jsonb:
                +    pass
                +
                +

                DbDataType_Jsonb()

                +
                +
                +class DbDataType_Other +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Other:
                +    value: str
                +
                +

                DbDataType_Other(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class DbDataType_RangeDecimal +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_RangeDecimal:
                +    pass
                +
                +

                DbDataType_RangeDecimal()

                +
                +
                +class DbDataType_RangeInt32 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_RangeInt32:
                +    pass
                +
                +

                DbDataType_RangeInt32()

                +
                +
                +class DbDataType_RangeInt64 +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_RangeInt64:
                +    pass
                +
                +

                DbDataType_RangeInt64()

                +
                +
                +class DbDataType_Str +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Str:
                +    pass
                +
                +

                DbDataType_Str()

                +
                +
                +class DbDataType_Time +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Time:
                +    pass
                +
                +

                DbDataType_Time()

                +
                +
                +class DbDataType_Timestamp +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Timestamp:
                +    pass
                +
                +

                DbDataType_Timestamp()

                +
                +
                +class DbDataType_Uuid +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbDataType_Uuid:
                +    pass
                +
                +

                DbDataType_Uuid()

                +
                +
                +class DbError +(as_text: str,
                severity: str,
                code: str,
                message: str,
                detail: str | None,
                extras: List[Tuple[str, str]])
                +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbError:
                +    as_text: str
                +    severity: str
                +    code: str
                +    message: str
                +    detail: Optional[str]
                +    extras: List[Tuple[str, str]]
                +
                +

                DbError(as_text: str, severity: str, code: str, message: str, detail: Optional[str], extras: List[Tuple[str, str]])

                +

                Instance variables

                +
                +
                var as_text : str
                +
                +
                +
                +
                var code : str
                +
                +
                +
                +
                var detail : str | None
                +
                +
                +
                +
                var extras : List[Tuple[str, str]]
                +
                +
                +
                +
                var message : str
                +
                +
                +
                +
                var severity : str
                +
                +
                +
                +
                +
                +
                +class DbValue_ArrayDecimal +(value: List[str | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_ArrayDecimal:
                +    value: List[Optional[str]]
                +
                +

                DbValue_ArrayDecimal(value: List[Optional[str]])

                +

                Instance variables

                +
                +
                var value : List[str | None]
                +
                +
                +
                +
                +
                +
                +class DbValue_ArrayInt32 +(value: List[int | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_ArrayInt32:
                +    value: List[Optional[int]]
                +
                +

                DbValue_ArrayInt32(value: List[Optional[int]])

                +

                Instance variables

                +
                +
                var value : List[int | None]
                +
                +
                +
                +
                +
                +
                +class DbValue_ArrayInt64 +(value: List[int | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_ArrayInt64:
                +    value: List[Optional[int]]
                +
                +

                DbValue_ArrayInt64(value: List[Optional[int]])

                +

                Instance variables

                +
                +
                var value : List[int | None]
                +
                +
                +
                +
                +
                +
                +class DbValue_ArrayStr +(value: List[str | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_ArrayStr:
                +    value: List[Optional[str]]
                +
                +

                DbValue_ArrayStr(value: List[Optional[str]])

                +

                Instance variables

                +
                +
                var value : List[str | None]
                +
                +
                +
                +
                +
                +
                +class DbValue_Binary +(value: bytes) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Binary:
                +    value: bytes
                +
                +

                DbValue_Binary(value: bytes)

                +

                Instance variables

                +
                +
                var value : bytes
                +
                +
                +
                +
                +
                +
                +class DbValue_Boolean +(value: bool) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Boolean:
                +    value: bool
                +
                +

                DbValue_Boolean(value: bool)

                +

                Instance variables

                +
                +
                var value : bool
                +
                +
                +
                +
                +
                +
                +class DbValue_Date +(value: Tuple[int, int, int]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Date:
                +    value: Tuple[int, int, int]
                +
                +

                DbValue_Date(value: Tuple[int, int, int])

                +

                Instance variables

                +
                +
                var value : Tuple[int, int, int]
                +
                +
                +
                +
                +
                +
                +class DbValue_Datetime +(value: Tuple[int, int, int, int, int, int, int]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Datetime:
                +    value: Tuple[int, int, int, int, int, int, int]
                +
                +

                DbValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

                +

                Instance variables

                +
                +
                var value : Tuple[int, int, int, int, int, int, int]
                +
                +
                +
                +
                +
                +
                +class DbValue_DbNull +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_DbNull:
                +    pass
                +
                +

                DbValue_DbNull()

                +
                +
                +class DbValue_Decimal +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Decimal:
                +    value: str
                +
                +

                DbValue_Decimal(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class DbValue_Floating32 +(value: float) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Floating32:
                +    value: float
                +
                +

                DbValue_Floating32(value: float)

                +

                Instance variables

                +
                +
                var value : float
                +
                +
                +
                +
                +
                +
                +class DbValue_Floating64 +(value: float) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Floating64:
                +    value: float
                +
                +

                DbValue_Floating64(value: float)

                +

                Instance variables

                +
                +
                var value : float
                +
                +
                +
                +
                +
                +
                +class DbValue_Int16 +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Int16:
                +    value: int
                +
                +

                DbValue_Int16(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class DbValue_Int32 +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Int32:
                +    value: int
                +
                +

                DbValue_Int32(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class DbValue_Int64 +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Int64:
                +    value: int
                +
                +

                DbValue_Int64(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class DbValue_Int8 +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Int8:
                +    value: int
                +
                +

                DbValue_Int8(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class DbValue_Interval +(value: Interval) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Interval:
                +    value: Interval
                +
                +

                DbValue_Interval(value: spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Interval)

                +

                Instance variables

                +
                +
                var valueInterval
                +
                +
                +
                +
                +
                +
                +class DbValue_Jsonb +(value: bytes) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Jsonb:
                +    value: bytes
                +
                +

                DbValue_Jsonb(value: bytes)

                +

                Instance variables

                +
                +
                var value : bytes
                +
                +
                +
                +
                +
                +
                +class DbValue_RangeDecimal +(value: Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_RangeDecimal:
                +    value: Tuple[Optional[Tuple[str, RangeBoundKind]], Optional[Tuple[str, RangeBoundKind]]]
                +
                +

                DbValue_RangeDecimal(value: Tuple[Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

                +

                Instance variables

                +
                +
                var value : Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]
                +
                +
                +
                +
                +
                +
                +class DbValue_RangeInt32 +(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_RangeInt32:
                +    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
                +
                +

                DbValue_RangeInt32(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

                +

                Instance variables

                +
                +
                var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
                +
                +
                +
                +
                +
                +
                +class DbValue_RangeInt64 +(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_RangeInt64:
                +    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
                +
                +

                DbValue_RangeInt64(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

                +

                Instance variables

                +
                +
                var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
                +
                +
                +
                +
                +
                +
                +class DbValue_Str +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Str:
                +    value: str
                +
                +

                DbValue_Str(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class DbValue_Time +(value: Tuple[int, int, int, int]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Time:
                +    value: Tuple[int, int, int, int]
                +
                +

                DbValue_Time(value: Tuple[int, int, int, int])

                +

                Instance variables

                +
                +
                var value : Tuple[int, int, int, int]
                +
                +
                +
                +
                +
                +
                +class DbValue_Timestamp +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Timestamp:
                +    value: int
                +
                +

                DbValue_Timestamp(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class DbValue_Unsupported +(value: bytes) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Unsupported:
                +    value: bytes
                +
                +

                DbValue_Unsupported(value: bytes)

                +

                Instance variables

                +
                +
                var value : bytes
                +
                +
                +
                +
                +
                +
                +class DbValue_Uuid +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class DbValue_Uuid:
                +    value: str
                +
                +

                DbValue_Uuid(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class Error_BadParameter +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_BadParameter:
                +    value: str
                +
                +

                Error_BadParameter(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class Error_ConnectionFailed +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_ConnectionFailed:
                +    value: str
                +
                +

                Error_ConnectionFailed(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class Error_Other +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_Other:
                +    value: str
                +
                +

                Error_Other(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class Error_QueryFailed +(value: QueryError_Text | QueryError_DbError) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_QueryFailed:
                +    value: QueryError
                +
                +

                Error_QueryFailed(value: Union[spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.QueryError_Text, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.QueryError_DbError])

                +

                Instance variables

                +
                +
                var valueQueryError_Text | QueryError_DbError
                +
                +
                +
                +
                +
                +
                +class Error_ValueConversionFailed +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_ValueConversionFailed:
                +    value: str
                +
                +

                Error_ValueConversionFailed(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class Interval +(micros: int, days: int, months: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Interval:
                +    micros: int
                +    days: int
                +    months: int
                +
                +

                Interval(micros: int, days: int, months: int)

                +

                Instance variables

                +
                +
                var days : int
                +
                +
                +
                +
                var micros : int
                +
                +
                +
                +
                var months : int
                +
                +
                +
                +
                +
                +
                +class ParameterValue_ArrayDecimal +(value: List[str | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_ArrayDecimal:
                +    value: List[Optional[str]]
                +
                +

                ParameterValue_ArrayDecimal(value: List[Optional[str]])

                +

                Instance variables

                +
                +
                var value : List[str | None]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_ArrayInt32 +(value: List[int | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_ArrayInt32:
                +    value: List[Optional[int]]
                +
                +

                ParameterValue_ArrayInt32(value: List[Optional[int]])

                +

                Instance variables

                +
                +
                var value : List[int | None]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_ArrayInt64 +(value: List[int | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_ArrayInt64:
                +    value: List[Optional[int]]
                +
                +

                ParameterValue_ArrayInt64(value: List[Optional[int]])

                +

                Instance variables

                +
                +
                var value : List[int | None]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_ArrayStr +(value: List[str | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_ArrayStr:
                +    value: List[Optional[str]]
                +
                +

                ParameterValue_ArrayStr(value: List[Optional[str]])

                +

                Instance variables

                +
                +
                var value : List[str | None]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Binary +(value: bytes) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Binary:
                +    value: bytes
                +
                +

                ParameterValue_Binary(value: bytes)

                +

                Instance variables

                +
                +
                var value : bytes
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Boolean +(value: bool) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Boolean:
                +    value: bool
                +
                +

                ParameterValue_Boolean(value: bool)

                +

                Instance variables

                +
                +
                var value : bool
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Date +(value: Tuple[int, int, int]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Date:
                +    value: Tuple[int, int, int]
                +
                +

                ParameterValue_Date(value: Tuple[int, int, int])

                +

                Instance variables

                +
                +
                var value : Tuple[int, int, int]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Datetime +(value: Tuple[int, int, int, int, int, int, int]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Datetime:
                +    value: Tuple[int, int, int, int, int, int, int]
                +
                +

                ParameterValue_Datetime(value: Tuple[int, int, int, int, int, int, int])

                +

                Instance variables

                +
                +
                var value : Tuple[int, int, int, int, int, int, int]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_DbNull +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_DbNull:
                +    pass
                +
                +

                ParameterValue_DbNull()

                +
                +
                +class ParameterValue_Decimal +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Decimal:
                +    value: str
                +
                +

                ParameterValue_Decimal(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Floating32 +(value: float) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Floating32:
                +    value: float
                +
                +

                ParameterValue_Floating32(value: float)

                +

                Instance variables

                +
                +
                var value : float
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Floating64 +(value: float) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Floating64:
                +    value: float
                +
                +

                ParameterValue_Floating64(value: float)

                +

                Instance variables

                +
                +
                var value : float
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Int16 +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Int16:
                +    value: int
                +
                +

                ParameterValue_Int16(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Int32 +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Int32:
                +    value: int
                +
                +

                ParameterValue_Int32(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Int64 +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Int64:
                +    value: int
                +
                +

                ParameterValue_Int64(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Int8 +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Int8:
                +    value: int
                +
                +

                ParameterValue_Int8(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Interval +(value: Interval) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Interval:
                +    value: Interval
                +
                +

                ParameterValue_Interval(value: spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Interval)

                +

                Instance variables

                +
                +
                var valueInterval
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Jsonb +(value: bytes) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Jsonb:
                +    value: bytes
                +
                +

                ParameterValue_Jsonb(value: bytes)

                +

                Instance variables

                +
                +
                var value : bytes
                +
                +
                +
                +
                +
                +
                +class ParameterValue_RangeDecimal +(value: Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_RangeDecimal:
                +    value: Tuple[Optional[Tuple[str, RangeBoundKind]], Optional[Tuple[str, RangeBoundKind]]]
                +
                +

                ParameterValue_RangeDecimal(value: Tuple[Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[str, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

                +

                Instance variables

                +
                +
                var value : Tuple[Tuple[str, RangeBoundKind] | None, Tuple[str, RangeBoundKind] | None]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_RangeInt32 +(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_RangeInt32:
                +    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
                +
                +

                ParameterValue_RangeInt32(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

                +

                Instance variables

                +
                +
                var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_RangeInt64 +(value: Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_RangeInt64:
                +    value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]]
                +
                +

                ParameterValue_RangeInt64(value: Tuple[Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]], Optional[Tuple[int, spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.RangeBoundKind]]])

                +

                Instance variables

                +
                +
                var value : Tuple[Tuple[int, RangeBoundKind] | None, Tuple[int, RangeBoundKind] | None]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Str +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Str:
                +    value: str
                +
                +

                ParameterValue_Str(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Time +(value: Tuple[int, int, int, int]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Time:
                +    value: Tuple[int, int, int, int]
                +
                +

                ParameterValue_Time(value: Tuple[int, int, int, int])

                +

                Instance variables

                +
                +
                var value : Tuple[int, int, int, int]
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Timestamp +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Timestamp:
                +    value: int
                +
                +

                ParameterValue_Timestamp(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class ParameterValue_Uuid +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class ParameterValue_Uuid:
                +    value: str
                +
                +

                ParameterValue_Uuid(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class QueryError_DbError +(value: DbError) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class QueryError_DbError:
                +    value: DbError
                +
                +

                QueryError_DbError(value: spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.DbError)

                +

                Instance variables

                +
                +
                var valueDbError
                +
                +
                +
                +
                +
                +
                +class QueryError_Text +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class QueryError_Text:
                +    value: str
                +
                +

                QueryError_Text(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class RangeBoundKind +(*args, **kwds) +
                +
                +
                + +Expand source code + +
                class RangeBoundKind(Enum):
                +    """
                +    For range types, indicates if each bound is inclusive or exclusive
                +    """
                +    INCLUSIVE = 0
                +    EXCLUSIVE = 1
                +
                +

                For range types, indicates if each bound is inclusive or exclusive

                +

                Ancestors

                +
                  +
                • enum.Enum
                • +
                +

                Class variables

                +
                +
                var EXCLUSIVE
                +
                +
                +
                +
                var INCLUSIVE
                +
                +
                +
                +
                +
                +
                +class RowSet +(columns: List[Column],
                rows: List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]])
                +
                +
                +
                + +Expand source code + +
                @dataclass
                +class RowSet:
                +    """
                +    A set of database rows
                +    """
                +    columns: List[Column]
                +    rows: List[List[DbValue]]
                +
                +

                A set of database rows

                +

                Instance variables

                +
                +
                var columns : List[Column]
                +
                +
                +
                +
                var rows : List[List[DbValue_Boolean | DbValue_Int8 | DbValue_Int16 | DbValue_Int32 | DbValue_Int64 | DbValue_Floating32 | DbValue_Floating64 | DbValue_Str | DbValue_Binary | DbValue_Date | DbValue_Time | DbValue_Datetime | DbValue_Timestamp | DbValue_Uuid | DbValue_Jsonb | DbValue_Decimal | DbValue_RangeInt32 | DbValue_RangeInt64 | DbValue_RangeDecimal | DbValue_ArrayInt32 | DbValue_ArrayInt64 | DbValue_ArrayDecimal | DbValue_ArrayStr | DbValue_Interval | DbValue_DbNull | DbValue_Unsupported]]
                +
                +
                +
                +
                +
                +
                +
                +
                + +
                + + + diff --git a/docs/v3/wit/imports/spin_sqlite_sqlite.html b/docs/v3/wit/imports/spin_sqlite_sqlite.html new file mode 100644 index 0000000..9dcfab9 --- /dev/null +++ b/docs/v3/wit/imports/spin_sqlite_sqlite.html @@ -0,0 +1,518 @@ + + + + + + +spin_sdk.wit.imports.spin_sqlite_sqlite API documentation + + + + + + + + + + + +
                +
                +
                +

                Module spin_sdk.wit.imports.spin_sqlite_sqlite

                +
                +
                +
                +
                +
                +
                +

                Global variables

                +
                +
                var Error
                +
                +

                The set of errors which may be raised by functions in this interface

                +
                +
                var Value
                +
                +

                A single column's result from a database query

                +
                +
                +
                +
                +
                +
                +

                Classes

                +
                +
                +class Connection +
                +
                +
                + +Expand source code + +
                class Connection:
                +    """
                +    A handle to an open sqlite instance
                +    """
                +    
                +    @classmethod
                +    def open(cls, database: str) -> Self:
                +        """
                +        Open a connection to a named database instance.
                +        
                +        If `database` is "default", the default instance is opened.
                +        
                +        `error::no-such-database` will be raised if the `name` is not recognized.
                +        
                +        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite.Error)`
                +        """
                +        raise NotImplementedError
                +    def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
                +        """
                +        Execute a statement returning back data if there is any
                +        
                +        Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite.Error)`
                +        """
                +        raise NotImplementedError
                +    def last_insert_rowid(self) -> int:
                +        """
                +        The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
                +        there has not yet been an INSERT on the connection.
                +        """
                +        raise NotImplementedError
                +    def changes(self) -> int:
                +        """
                +        The number of rows modified, inserted or deleted by the most recently completed
                +        INSERT, UPDATE or DELETE statement on the connection.
                +        """
                +        raise NotImplementedError
                +    def __enter__(self) -> Self:
                +        """Returns self"""
                +        return self
                +                                
                +    def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None:
                +        """
                +        Release this resource.
                +        """
                +        raise NotImplementedError
                +
                +

                A handle to an open sqlite instance

                +

                Static methods

                +
                +
                +def open(database: str) ‑> Self +
                +
                +

                Open a connection to a named database instance.

                +

                If database is "default", the default instance is opened.

                +

                error::no-such-database will be raised if the name is not recognized.

                +

                Raises: Err(Error)

                +
                +
                +

                Methods

                +
                +
                +def changes(self) ‑> int +
                +
                +
                + +Expand source code + +
                def changes(self) -> int:
                +    """
                +    The number of rows modified, inserted or deleted by the most recently completed
                +    INSERT, UPDATE or DELETE statement on the connection.
                +    """
                +    raise NotImplementedError
                +
                +

                The number of rows modified, inserted or deleted by the most recently completed +INSERT, UPDATE or DELETE statement on the connection.

                +
                +
                +def execute(self,
                statement: str,
                parameters: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> QueryResult
                +
                +
                +
                + +Expand source code + +
                def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
                +    """
                +    Execute a statement returning back data if there is any
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite.Error)`
                +    """
                +    raise NotImplementedError
                +
                +

                Execute a statement returning back data if there is any

                +

                Raises: Err(Error)

                +
                +
                +def last_insert_rowid(self) ‑> int +
                +
                +
                + +Expand source code + +
                def last_insert_rowid(self) -> int:
                +    """
                +    The SQLite rowid of the most recent successful INSERT on the connection, or 0 if
                +    there has not yet been an INSERT on the connection.
                +    """
                +    raise NotImplementedError
                +
                +

                The SQLite rowid of the most recent successful INSERT on the connection, or 0 if +there has not yet been an INSERT on the connection.

                +
                +
                +
                +
                +class Error_AccessDenied +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_AccessDenied:
                +    pass
                +
                +

                Error_AccessDenied()

                +
                +
                +class Error_DatabaseFull +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_DatabaseFull:
                +    pass
                +
                +

                Error_DatabaseFull()

                +
                +
                +class Error_InvalidConnection +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_InvalidConnection:
                +    pass
                +
                +

                Error_InvalidConnection()

                +
                +
                +class Error_Io +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_Io:
                +    value: str
                +
                +

                Error_Io(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +class Error_NoSuchDatabase +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Error_NoSuchDatabase:
                +    pass
                +
                +

                Error_NoSuchDatabase()

                +
                +
                +class QueryResult +(columns: List[str],
                rows: List[RowResult])
                +
                +
                +
                + +Expand source code + +
                @dataclass
                +class QueryResult:
                +    """
                +    A result of a query
                +    """
                +    columns: List[str]
                +    rows: List[RowResult]
                +
                +

                A result of a query

                +

                Instance variables

                +
                +
                var columns : List[str]
                +
                +
                +
                +
                var rows : List[RowResult]
                +
                +
                +
                +
                +
                +
                +class RowResult +(values: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class RowResult:
                +    """
                +    A set of values for each of the columns in a query-result
                +    """
                +    values: List[Value]
                +
                +

                A set of values for each of the columns in a query-result

                +

                Instance variables

                +
                +
                var values : List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]
                +
                +
                +
                +
                +
                +
                +class Value_Blob +(value: bytes) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Value_Blob:
                +    value: bytes
                +
                +

                Value_Blob(value: bytes)

                +

                Instance variables

                +
                +
                var value : bytes
                +
                +
                +
                +
                +
                +
                +class Value_Integer +(value: int) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Value_Integer:
                +    value: int
                +
                +

                Value_Integer(value: int)

                +

                Instance variables

                +
                +
                var value : int
                +
                +
                +
                +
                +
                +
                +class Value_Null +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Value_Null:
                +    pass
                +
                +

                Value_Null()

                +
                +
                +class Value_Real +(value: float) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Value_Real:
                +    value: float
                +
                +

                Value_Real(value: float)

                +

                Instance variables

                +
                +
                var value : float
                +
                +
                +
                +
                +
                +
                +class Value_Text +(value: str) +
                +
                +
                + +Expand source code + +
                @dataclass
                +class Value_Text:
                +    value: str
                +
                +

                Value_Text(value: str)

                +

                Instance variables

                +
                +
                var value : str
                +
                +
                +
                +
                +
                +
                +
                +
                + +
                + + + diff --git a/docs/v3/wit/imports/sqlite.html b/docs/v3/wit/imports/sqlite.html index 2b7ef80..0d8ca29 100644 --- a/docs/v3/wit/imports/sqlite.html +++ b/docs/v3/wit/imports/sqlite.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.sqlite API documentation - + @@ -50,7 +61,6 @@

                Classes

                class Connection
                -

                A handle to an open sqlite instance

                Expand source code @@ -89,6 +99,7 @@

                Classes

                """ raise NotImplementedError
                +

                A handle to an open sqlite instance

                Static methods

                @@ -107,6 +118,18 @@

                Methods

                def execute(self,
                statement: str,
                parameters: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]) ‑> QueryResult
                +
                + +Expand source code + +
                def execute(self, statement: str, parameters: List[Value]) -> QueryResult:
                +    """
                +    Execute a statement returning back data if there is any
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.sqlite.Error)`
                +    """
                +    raise NotImplementedError
                +

                Execute a statement returning back data if there is any

                Raises: Err(Error)

                @@ -116,7 +139,6 @@

                Methods

                class Error_AccessDenied
                -

                Error_AccessDenied()

                Expand source code @@ -125,12 +147,12 @@

                Methods

                class Error_AccessDenied: pass
                +

                Error_AccessDenied()

                class Error_DatabaseFull
                -

                Error_DatabaseFull()

                Expand source code @@ -139,12 +161,12 @@

                Methods

                class Error_DatabaseFull: pass
                +

                Error_DatabaseFull()

                class Error_InvalidConnection
                -

                Error_InvalidConnection()

                Expand source code @@ -153,13 +175,13 @@

                Methods

                class Error_InvalidConnection: pass
                +

                Error_InvalidConnection()

                class Error_Io (value: str)
                -

                Error_Io(value: str)

                Expand source code @@ -168,7 +190,8 @@

                Methods

                class Error_Io: value: str
                -

                Class variables

                +

                Error_Io(value: str)

                +

                Instance variables

                var value : str
                @@ -180,7 +203,6 @@

                Class variables

                class Error_NoSuchDatabase
                -

                Error_NoSuchDatabase()

                Expand source code @@ -189,13 +211,13 @@

                Class variables

                class Error_NoSuchDatabase: pass
                +

                Error_NoSuchDatabase()

                class QueryResult (columns: List[str],
                rows: List[RowResult])
                -

                A result of a query

                Expand source code @@ -208,7 +230,8 @@

                Class variables

                columns: List[str] rows: List[RowResult]
                -

                Class variables

                +

                A result of a query

                +

                Instance variables

                var columns : List[str]
                @@ -225,7 +248,6 @@

                Class variables

                (values: List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null])
                -

                A set of values for each of the columns in a query-result

                Expand source code @@ -237,7 +259,8 @@

                Class variables

                """ values: List[Value]
                -

                Class variables

                +

                A set of values for each of the columns in a query-result

                +

                Instance variables

                var values : List[Value_Integer | Value_Real | Value_Text | Value_Blob | Value_Null]
                @@ -250,7 +273,6 @@

                Class variables

                (value: bytes)
                -

                Value_Blob(value: bytes)

                Expand source code @@ -259,7 +281,8 @@

                Class variables

                class Value_Blob: value: bytes
                -

                Class variables

                +

                Value_Blob(value: bytes)

                +

                Instance variables

                var value : bytes
                @@ -272,7 +295,6 @@

                Class variables

                (value: int)
                -

                Value_Integer(value: int)

                Expand source code @@ -281,7 +303,8 @@

                Class variables

                class Value_Integer: value: int
                -

                Class variables

                +

                Value_Integer(value: int)

                +

                Instance variables

                var value : int
                @@ -293,7 +316,6 @@

                Class variables

                class Value_Null
                -

                Value_Null()

                Expand source code @@ -302,13 +324,13 @@

                Class variables

                class Value_Null: pass
                +

                Value_Null()

                class Value_Real (value: float)
                -

                Value_Real(value: float)

                Expand source code @@ -317,7 +339,8 @@

                Class variables

                class Value_Real: value: float
                -

                Class variables

                +

                Value_Real(value: float)

                +

                Instance variables

                var value : float
                @@ -330,7 +353,6 @@

                Class variables

                (value: str)
                -

                Value_Text(value: str)

                Expand source code @@ -339,7 +361,8 @@

                Class variables

                class Value_Text: value: str
                -

                Class variables

                +

                Value_Text(value: str)

                +

                Instance variables

                var value : str
                @@ -439,7 +462,7 @@

                -

                Generated by pdoc 0.11.3.

                +

                Generated by pdoc 0.11.6.

                diff --git a/docs/v3/wit/imports/streams.html b/docs/v3/wit/imports/streams.html index 0e86635..248d4a4 100644 --- a/docs/v3/wit/imports/streams.html +++ b/docs/v3/wit/imports/streams.html @@ -3,20 +3,31 @@ - + spin_sdk.wit.imports.streams API documentation - + @@ -51,13 +62,6 @@

                Classes

                class InputStream
                -

                An input bytestream.

                -

                input-streams are non-blocking to the extent practical on underlying -platforms. I/O operations always return promptly; if fewer bytes are -promptly available than requested, they return the number of bytes promptly -available, which could even be zero. To wait for data to be available, -use the subscribe function to obtain a pollable which can be polled -for using wasi:io/poll.

                Expand source code @@ -152,12 +156,32 @@

                Classes

                """ raise NotImplementedError
                +

                An input bytestream.

                +

                input-streams are non-blocking to the extent practical on underlying +platforms. I/O operations always return promptly; if fewer bytes are +promptly available than requested, they return the number of bytes promptly +available, which could even be zero. To wait for data to be available, +use the subscribe function to obtain a pollable which can be polled +for using wasi:io/poll.

                Methods

                def blocking_read(self, len: int) ‑> bytes
                +
                + +Expand source code + +
                def blocking_read(self, len: int) -> bytes:
                +    """
                +    Read bytes from a stream, after blocking until at least one byte can
                +    be read. Except for blocking, behavior is identical to `read`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Read bytes from a stream, after blocking until at least one byte can be read. Except for blocking, behavior is identical to read.

                Raises: Err(StreamError)

                @@ -166,6 +190,19 @@

                Methods

                def blocking_skip(self, len: int) ‑> int
                +
                + +Expand source code + +
                def blocking_skip(self, len: int) -> int:
                +    """
                +    Skip bytes from a stream, after blocking until at least one byte
                +    can be skipped. Except for blocking behavior, identical to `skip`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Skip bytes from a stream, after blocking until at least one byte can be skipped. Except for blocking behavior, identical to skip.

                Raises: Err(StreamError)

                @@ -174,6 +211,43 @@

                Methods

                def read(self, len: int) ‑> bytes
                +
                + +Expand source code + +
                def read(self, len: int) -> bytes:
                +    """
                +    Perform a non-blocking read from the stream.
                +    
                +    When the source of a `read` is binary data, the bytes from the source
                +    are returned verbatim. When the source of a `read` is known to the
                +    implementation to be text, bytes containing the UTF-8 encoding of the
                +    text are returned.
                +    
                +    This function returns a list of bytes containing the read data,
                +    when successful. The returned list will contain up to `len` bytes;
                +    it may return fewer than requested, but not more. The list is
                +    empty when no bytes are available for reading at this time. The
                +    pollable given by `subscribe` will be ready when more bytes are
                +    available.
                +    
                +    This function fails with a `stream-error` when the operation
                +    encounters an error, giving `last-operation-failed`, or when the
                +    stream is closed, giving `closed`.
                +    
                +    When the caller gives a `len` of 0, it represents a request to
                +    read 0 bytes. If the stream is still open, this call should
                +    succeed and return an empty list, or otherwise fail with `closed`.
                +    
                +    The `len` parameter is a `u64`, which could represent a list of u8 which
                +    is not possible to allocate in wasm32, or not desirable to allocate as
                +    as a return value by the callee. The callee may return a list of bytes
                +    less than `len` in size while more bytes are available for reading.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Perform a non-blocking read from the stream.

                When the source of a read is binary data, the bytes from the source are returned verbatim. When the source of a read is known to the @@ -201,6 +275,21 @@

                Methods

                def skip(self, len: int) ‑> int
                +
                + +Expand source code + +
                def skip(self, len: int) -> int:
                +    """
                +    Skip bytes from a stream. Returns number of bytes skipped.
                +    
                +    Behaves identical to `read`, except instead of returning a list
                +    of bytes, returns the number of bytes consumed from the stream.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Skip bytes from a stream. Returns number of bytes skipped.

                Behaves identical to read, except instead of returning a list of bytes, returns the number of bytes consumed from the stream.

                @@ -210,6 +299,21 @@

                Methods

                def subscribe(self) ‑> Pollable
                +
                + +Expand source code + +
                def subscribe(self) -> poll.Pollable:
                +    """
                +    Create a `pollable` which will resolve once either the specified stream
                +    has bytes available to read or the other end of the stream has been
                +    closed.
                +    The created `pollable` is a child resource of the `input-stream`.
                +    Implementations may trap if the `input-stream` is dropped before
                +    all derived `pollable`s created with this function are dropped.
                +    """
                +    raise NotImplementedError
                +

                Create a pollable which will resolve once either the specified stream has bytes available to read or the other end of the stream has been closed. @@ -223,13 +327,6 @@

                Methods

                class OutputStream
                -

                An output bytestream.

                -

                output-streams are non-blocking to the extent practical on -underlying platforms. Except where specified otherwise, I/O operations also -always return promptly, after the number of bytes that can be written -promptly, which could even be zero. To wait for the stream to be ready to -accept data, the subscribe function to obtain a pollable which can be -polled for using wasi:io/poll.

                Expand source code @@ -292,13 +389,13 @@

                Methods

                ```text let pollable = this.subscribe(); while !contents.is_empty() { - // Wait for the stream to become writable - pollable.block(); - let Ok(n) = this.check-write(); // eliding error handling - let len = min(n, contents.len()); - let (chunk, rest) = contents.split_at(len); - this.write(chunk ); // eliding error handling - contents = rest; + // Wait for the stream to become writable + pollable.block(); + let Ok(n) = this.check-write(); // eliding error handling + let len = min(n, contents.len()); + let (chunk, rest) = contents.split_at(len); + this.write(chunk ); // eliding error handling + contents = rest; } this.flush(); // Wait for completion of `flush` @@ -373,12 +470,12 @@

                Methods

                ```text let pollable = this.subscribe(); while num_zeroes != 0 { - // Wait for the stream to become writable - pollable.block(); - let Ok(n) = this.check-write(); // eliding error handling - let len = min(n, num_zeroes); - this.write-zeroes(len); // eliding error handling - num_zeroes -= len; + // Wait for the stream to become writable + pollable.block(); + let Ok(n) = this.check-write(); // eliding error handling + let len = min(n, num_zeroes); + this.write-zeroes(len); // eliding error handling + num_zeroes -= len; } this.flush(); // Wait for completion of `flush` @@ -430,12 +527,32 @@

                Methods

                """ raise NotImplementedError
                +

                An output bytestream.

                +

                output-streams are non-blocking to the extent practical on +underlying platforms. Except where specified otherwise, I/O operations also +always return promptly, after the number of bytes that can be written +promptly, which could even be zero. To wait for the stream to be ready to +accept data, the subscribe function to obtain a pollable which can be +polled for using wasi:io/poll.

                Methods

                def blocking_flush(self) ‑> None
                +
                + +Expand source code + +
                def blocking_flush(self) -> None:
                +    """
                +    Request to flush buffered output, and block until flush completes
                +    and stream is ready for writing again.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Request to flush buffered output, and block until flush completes and stream is ready for writing again.

                Raises: Err(StreamError)

                @@ -444,6 +561,22 @@

                Methods

                def blocking_splice(self,
                src: InputStream,
                len: int) ‑> int
                +
                + +Expand source code + +
                def blocking_splice(self, src: InputStream, len: int) -> int:
                +    """
                +    Read from one stream and write to another, with blocking.
                +    
                +    This is similar to `splice`, except that it blocks until the
                +    `output-stream` is ready for writing, and the `input-stream`
                +    is ready for reading, before performing the `splice`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Read from one stream and write to another, with blocking.

                This is similar to splice, except that it blocks until the output-stream is ready for writing, and the input-stream @@ -454,6 +587,41 @@

                Methods

                def blocking_write_and_flush(self, contents: bytes) ‑> None
                +
                + +Expand source code + +
                def blocking_write_and_flush(self, contents: bytes) -> None:
                +    """
                +    Perform a write of up to 4096 bytes, and then flush the stream. Block
                +    until all of these operations are complete, or an error occurs.
                +    
                +    This is a convenience wrapper around the use of `check-write`,
                +    `subscribe`, `write`, and `flush`, and is implemented with the
                +    following pseudo-code:
                +    
                +    ```text
                +    let pollable = this.subscribe();
                +    while !contents.is_empty() {
                +        // Wait for the stream to become writable
                +        pollable.block();
                +        let Ok(n) = this.check-write(); // eliding error handling
                +        let len = min(n, contents.len());
                +        let (chunk, rest) = contents.split_at(len);
                +        this.write(chunk  );            // eliding error handling
                +        contents = rest;
                +    }
                +    this.flush();
                +    // Wait for completion of `flush`
                +    pollable.block();
                +    // Check for any errors that arose during `flush`
                +    let _ = this.check-write();         // eliding error handling
                +    ```
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Perform a write of up to 4096 bytes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

                This is a convenience wrapper around the use of check-write, @@ -461,13 +629,13 @@

                Methods

                following pseudo-code:

                let pollable = this.subscribe();
                 while !contents.is_empty() {
                -// Wait for the stream to become writable
                -pollable.block();
                -let Ok(n) = this.check-write(); // eliding error handling
                -let len = min(n, contents.len());
                -let (chunk, rest) = contents.split_at(len);
                -this.write(chunk  );            // eliding error handling
                -contents = rest;
                +    // Wait for the stream to become writable
                +    pollable.block();
                +    let Ok(n) = this.check-write(); // eliding error handling
                +    let len = min(n, contents.len());
                +    let (chunk, rest) = contents.split_at(len);
                +    this.write(chunk  );            // eliding error handling
                +    contents = rest;
                 }
                 this.flush();
                 // Wait for completion of `flush`
                @@ -481,6 +649,41 @@ 

                Methods

                def blocking_write_zeroes_and_flush(self, len: int) ‑> None
                +
                + +Expand source code + +
                def blocking_write_zeroes_and_flush(self, len: int) -> None:
                +    """
                +    Perform a write of up to 4096 zeroes, and then flush the stream.
                +    Block until all of these operations are complete, or an error
                +    occurs.
                +    
                +    This is a convenience wrapper around the use of `check-write`,
                +    `subscribe`, `write-zeroes`, and `flush`, and is implemented with
                +    the following pseudo-code:
                +    
                +    ```text
                +    let pollable = this.subscribe();
                +    while num_zeroes != 0 {
                +        // Wait for the stream to become writable
                +        pollable.block();
                +        let Ok(n) = this.check-write(); // eliding error handling
                +        let len = min(n, num_zeroes);
                +        this.write-zeroes(len);         // eliding error handling
                +        num_zeroes -= len;
                +    }
                +    this.flush();
                +    // Wait for completion of `flush`
                +    pollable.block();
                +    // Check for any errors that arose during `flush`
                +    let _ = this.check-write();         // eliding error handling
                +    ```
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Perform a write of up to 4096 zeroes, and then flush the stream. Block until all of these operations are complete, or an error occurs.

                @@ -489,12 +692,12 @@

                Methods

                the following pseudo-code:

                let pollable = this.subscribe();
                 while num_zeroes != 0 {
                -// Wait for the stream to become writable
                -pollable.block();
                -let Ok(n) = this.check-write(); // eliding error handling
                -let len = min(n, num_zeroes);
                -this.write-zeroes(len);         // eliding error handling
                -num_zeroes -= len;
                +    // Wait for the stream to become writable
                +    pollable.block();
                +    let Ok(n) = this.check-write(); // eliding error handling
                +    let len = min(n, num_zeroes);
                +    this.write-zeroes(len);         // eliding error handling
                +    num_zeroes -= len;
                 }
                 this.flush();
                 // Wait for completion of `flush`
                @@ -508,6 +711,26 @@ 

                Methods

                def check_write(self) ‑> int
                +
                + +Expand source code + +
                def check_write(self) -> int:
                +    """
                +    Check readiness for writing. This function never blocks.
                +    
                +    Returns the number of bytes permitted for the next call to `write`,
                +    or an error. Calling `write` with more bytes than this function has
                +    permitted will trap.
                +    
                +    When this function returns 0 bytes, the `subscribe` pollable will
                +    become ready when this function will report at least 1 byte, or an
                +    error.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Check readiness for writing. This function never blocks.

                Returns the number of bytes permitted for the next call to write, or an error. Calling write with more bytes than this function has @@ -521,6 +744,27 @@

                Methods

                def flush(self) ‑> None
                +
                + +Expand source code + +
                def flush(self) -> None:
                +    """
                +    Request to flush buffered output. This function never blocks.
                +    
                +    This tells the output-stream that the caller intends any buffered
                +    output to be flushed. the output which is expected to be flushed
                +    is all that has been passed to `write` prior to this call.
                +    
                +    Upon calling this function, the `output-stream` will not accept any
                +    writes (`check-write` will return `ok(0)`) until the flush has
                +    completed. The `subscribe` pollable will become ready when the
                +    flush has completed and the stream can accept more writes.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Request to flush buffered output. This function never blocks.

                This tells the output-stream that the caller intends any buffered output to be flushed. the output which is expected to be flushed @@ -535,6 +779,30 @@

                Methods

                def splice(self,
                src: InputStream,
                len: int) ‑> int
                +
                + +Expand source code + +
                def splice(self, src: InputStream, len: int) -> int:
                +    """
                +    Read from one stream and write to another.
                +    
                +    The behavior of splice is equivelant to:
                +    1. calling `check-write` on the `output-stream`
                +    2. calling `read` on the `input-stream` with the smaller of the
                +    `check-write` permitted length and the `len` provided to `splice`
                +    3. calling `write` on the `output-stream` with that read data.
                +    
                +    Any error reported by the call to `check-write`, `read`, or
                +    `write` ends the splice and reports that error.
                +    
                +    This function returns the number of bytes transferred; it may be less
                +    than `len`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Read from one stream and write to another.

                The behavior of splice is equivelant to: 1. calling check-write on the output-stream @@ -551,6 +819,25 @@

                Methods

                def subscribe(self) ‑> Pollable
                +
                + +Expand source code + +
                def subscribe(self) -> poll.Pollable:
                +    """
                +    Create a `pollable` which will resolve once the output-stream
                +    is ready for more writing, or an error has occured. When this
                +    pollable is ready, `check-write` will return `ok(n)` with n>0, or an
                +    error.
                +    
                +    If the stream is closed, this pollable is always ready immediately.
                +    
                +    The created `pollable` is a child resource of the `output-stream`.
                +    Implementations may trap if the `output-stream` is dropped before
                +    all derived `pollable`s created with this function are dropped.
                +    """
                +    raise NotImplementedError
                +

                Create a pollable which will resolve once the output-stream is ready for more writing, or an error has occured. When this pollable is ready, check-write will return ok(n) with n>0, or an @@ -564,6 +851,30 @@

                Methods

                def write(self, contents: bytes) ‑> None
                +
                + +Expand source code + +
                def write(self, contents: bytes) -> None:
                +    """
                +    Perform a write. This function never blocks.
                +    
                +    When the destination of a `write` is binary data, the bytes from
                +    `contents` are written verbatim. When the destination of a `write` is
                +    known to the implementation to be text, the bytes of `contents` are
                +    transcoded from UTF-8 into the encoding of the destination and then
                +    written.
                +    
                +    Precondition: check-write gave permit of Ok(n) and contents has a
                +    length of less than or equal to n. Otherwise, this function will trap.
                +    
                +    returns Err(closed) without writing if the stream has closed since
                +    the last call to check-write provided a permit.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Perform a write. This function never blocks.

                When the destination of a write is binary data, the bytes from contents are written verbatim. When the destination of a write is @@ -580,6 +891,23 @@

                Methods

                def write_zeroes(self, len: int) ‑> None
                +
                + +Expand source code + +
                def write_zeroes(self, len: int) -> None:
                +    """
                +    Write zeroes to a stream.
                +    
                +    This should be used precisely like `write` with the exact same
                +    preconditions (must use check-write first), but instead of
                +    passing a list of bytes, you simply pass the number of zero-bytes
                +    that should be written.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.streams.StreamError)`
                +    """
                +    raise NotImplementedError
                +

                Write zeroes to a stream.

                This should be used precisely like write with the exact same preconditions (must use check-write first), but instead of @@ -593,7 +921,6 @@

                Methods

                class StreamError_Closed
                -

                StreamError_Closed()

                Expand source code @@ -602,13 +929,13 @@

                Methods

                class StreamError_Closed: pass
                +

                StreamError_Closed()

                class StreamError_LastOperationFailed (value: Error)
                -

                StreamError_LastOperationFailed(value: spin_sdk.wit.imports.error.Error)

                Expand source code @@ -617,7 +944,8 @@

                Methods

                class StreamError_LastOperationFailed: value: error.Error
                -

                Class variables

                +

                StreamError_LastOperationFailed(value: spin_sdk.wit.imports.error.Error)

                +

                Instance variables

                var valueError
                @@ -685,7 +1013,7 @@

                -

                Generated by pdoc 0.11.3.

                +

                Generated by pdoc 0.11.6.

                diff --git a/docs/v3/wit/imports/types.html b/docs/v3/wit/imports/types.html index 8909d56..498c3aa 100644 --- a/docs/v3/wit/imports/types.html +++ b/docs/v3/wit/imports/types.html @@ -3,7 +3,7 @@ - + spin_sdk.wit.imports.types API documentation - + @@ -63,6 +74,26 @@

                Functions

                def http_error_code(err: Error) ‑> ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError | None
                +
                + +Expand source code + +
                def http_error_code(err: error.Error) -> Optional[ErrorCode]:
                +    """
                +    Attempts to extract a http-related `error` from the wasi:io `error`
                +    provided.
                +    
                +    Stream operations which return
                +    `wasi:io/stream/stream-error::last-operation-failed` have a payload of
                +    type `wasi:io/error/error` with more information about the operation
                +    that failed. This payload can be passed through to this function to see
                +    if there's http-related information about the error to return.
                +    
                +    Note that this function is fallible because not all io-errors are
                +    http-related errors.
                +    """
                +    raise NotImplementedError
                +

                Attempts to extract a http-related error from the wasi:io error provided.

                Stream operations which return @@ -83,7 +114,6 @@

                Classes

                (rcode: str | None, info_code: int | None)
                -

                Defines the case payload type for DNS-error above:

                Expand source code @@ -96,7 +126,8 @@

                Classes

                rcode: Optional[str] info_code: Optional[int]
                -

                Class variables

                +

                Defines the case payload type for DNS-error above:

                +

                Instance variables

                var info_code : int | None
                @@ -112,7 +143,6 @@

                Class variables

                class ErrorCode_ConfigurationError
                -

                ErrorCode_ConfigurationError()

                Expand source code @@ -121,12 +151,12 @@

                Class variables

                class ErrorCode_ConfigurationError: pass
                +

                ErrorCode_ConfigurationError()

                class ErrorCode_ConnectionLimitReached
                -

                ErrorCode_ConnectionLimitReached()

                Expand source code @@ -135,12 +165,12 @@

                Class variables

                class ErrorCode_ConnectionLimitReached: pass
                +

                ErrorCode_ConnectionLimitReached()

                class ErrorCode_ConnectionReadTimeout
                -

                ErrorCode_ConnectionReadTimeout()

                Expand source code @@ -149,12 +179,12 @@

                Class variables

                class ErrorCode_ConnectionReadTimeout: pass
                +

                ErrorCode_ConnectionReadTimeout()

                class ErrorCode_ConnectionRefused
                -

                ErrorCode_ConnectionRefused()

                Expand source code @@ -163,12 +193,12 @@

                Class variables

                class ErrorCode_ConnectionRefused: pass
                +

                ErrorCode_ConnectionRefused()

                class ErrorCode_ConnectionTerminated
                -

                ErrorCode_ConnectionTerminated()

                Expand source code @@ -177,12 +207,12 @@

                Class variables

                class ErrorCode_ConnectionTerminated: pass
                +

                ErrorCode_ConnectionTerminated()

                class ErrorCode_ConnectionTimeout
                -

                ErrorCode_ConnectionTimeout()

                Expand source code @@ -191,12 +221,12 @@

                Class variables

                class ErrorCode_ConnectionTimeout: pass
                +

                ErrorCode_ConnectionTimeout()

                class ErrorCode_ConnectionWriteTimeout
                -

                ErrorCode_ConnectionWriteTimeout()

                Expand source code @@ -205,12 +235,12 @@

                Class variables

                class ErrorCode_ConnectionWriteTimeout: pass
                +

                ErrorCode_ConnectionWriteTimeout()

                class ErrorCode_DestinationIpProhibited
                -

                ErrorCode_DestinationIpProhibited()

                Expand source code @@ -219,12 +249,12 @@

                Class variables

                class ErrorCode_DestinationIpProhibited: pass
                +

                ErrorCode_DestinationIpProhibited()

                class ErrorCode_DestinationIpUnroutable
                -

                ErrorCode_DestinationIpUnroutable()

                Expand source code @@ -233,12 +263,12 @@

                Class variables

                class ErrorCode_DestinationIpUnroutable: pass
                +

                ErrorCode_DestinationIpUnroutable()

                class ErrorCode_DestinationNotFound
                -

                ErrorCode_DestinationNotFound()

                Expand source code @@ -247,12 +277,12 @@

                Class variables

                class ErrorCode_DestinationNotFound: pass
                +

                ErrorCode_DestinationNotFound()

                class ErrorCode_DestinationUnavailable
                -

                ErrorCode_DestinationUnavailable()

                Expand source code @@ -261,13 +291,13 @@

                Class variables

                class ErrorCode_DestinationUnavailable: pass
                +

                ErrorCode_DestinationUnavailable()

                class ErrorCode_DnsError (value: DnsErrorPayload)
                -

                ErrorCode_DnsError(value: spin_sdk.wit.imports.types.DnsErrorPayload)

                Expand source code @@ -276,7 +306,8 @@

                Class variables

                class ErrorCode_DnsError: value: DnsErrorPayload
                -

                Class variables

                +

                ErrorCode_DnsError(value: spin_sdk.wit.imports.types.DnsErrorPayload)

                +

                Instance variables

                var valueDnsErrorPayload
                @@ -288,7 +319,6 @@

                Class variables

                class ErrorCode_DnsTimeout
                -

                ErrorCode_DnsTimeout()

                Expand source code @@ -297,12 +327,12 @@

                Class variables

                class ErrorCode_DnsTimeout: pass
                +

                ErrorCode_DnsTimeout()

                class ErrorCode_HttpProtocolError
                -

                ErrorCode_HttpProtocolError()

                Expand source code @@ -311,13 +341,13 @@

                Class variables

                class ErrorCode_HttpProtocolError: pass
                +

                ErrorCode_HttpProtocolError()

                class ErrorCode_HttpRequestBodySize (value: int | None)
                -

                ErrorCode_HttpRequestBodySize(value: Optional[int])

                Expand source code @@ -326,7 +356,8 @@

                Class variables

                class ErrorCode_HttpRequestBodySize: value: Optional[int]
                -

                Class variables

                +

                ErrorCode_HttpRequestBodySize(value: Optional[int])

                +

                Instance variables

                var value : int | None
                @@ -338,7 +369,6 @@

                Class variables

                class ErrorCode_HttpRequestDenied
                -

                ErrorCode_HttpRequestDenied()

                Expand source code @@ -347,13 +377,13 @@

                Class variables

                class ErrorCode_HttpRequestDenied: pass
                +

                ErrorCode_HttpRequestDenied()

                class ErrorCode_HttpRequestHeaderSectionSize (value: int | None)
                -

                ErrorCode_HttpRequestHeaderSectionSize(value: Optional[int])

                Expand source code @@ -362,7 +392,8 @@

                Class variables

                class ErrorCode_HttpRequestHeaderSectionSize: value: Optional[int]
                -

                Class variables

                +

                ErrorCode_HttpRequestHeaderSectionSize(value: Optional[int])

                +

                Instance variables

                var value : int | None
                @@ -375,7 +406,6 @@

                Class variables

                (value: FieldSizePayload | None)
                -

                ErrorCode_HttpRequestHeaderSize(value: Optional[spin_sdk.wit.imports.types.FieldSizePayload])

                Expand source code @@ -384,7 +414,8 @@

                Class variables

                class ErrorCode_HttpRequestHeaderSize: value: Optional[FieldSizePayload]
                -

                Class variables

                +

                ErrorCode_HttpRequestHeaderSize(value: Optional[spin_sdk.wit.imports.types.FieldSizePayload])

                +

                Instance variables

                var valueFieldSizePayload | None
                @@ -396,7 +427,6 @@

                Class variables

                class ErrorCode_HttpRequestLengthRequired
                -

                ErrorCode_HttpRequestLengthRequired()

                Expand source code @@ -405,12 +435,12 @@

                Class variables

                class ErrorCode_HttpRequestLengthRequired: pass
                +

                ErrorCode_HttpRequestLengthRequired()

                class ErrorCode_HttpRequestMethodInvalid
                -

                ErrorCode_HttpRequestMethodInvalid()

                Expand source code @@ -419,13 +449,13 @@

                Class variables

                class ErrorCode_HttpRequestMethodInvalid: pass
                +

                ErrorCode_HttpRequestMethodInvalid()

                class ErrorCode_HttpRequestTrailerSectionSize (value: int | None)
                -

                ErrorCode_HttpRequestTrailerSectionSize(value: Optional[int])

                Expand source code @@ -434,7 +464,8 @@

                Class variables

                class ErrorCode_HttpRequestTrailerSectionSize: value: Optional[int]
                -

                Class variables

                +

                ErrorCode_HttpRequestTrailerSectionSize(value: Optional[int])

                +

                Instance variables

                var value : int | None
                @@ -447,7 +478,6 @@

                Class variables

                (value: FieldSizePayload)
                -

                ErrorCode_HttpRequestTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

                Expand source code @@ -456,7 +486,8 @@

                Class variables

                class ErrorCode_HttpRequestTrailerSize: value: FieldSizePayload
                -

                Class variables

                +

                ErrorCode_HttpRequestTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

                +

                Instance variables

                var valueFieldSizePayload
                @@ -468,7 +499,6 @@

                Class variables

                class ErrorCode_HttpRequestUriInvalid
                -

                ErrorCode_HttpRequestUriInvalid()

                Expand source code @@ -477,12 +507,12 @@

                Class variables

                class ErrorCode_HttpRequestUriInvalid: pass
                +

                ErrorCode_HttpRequestUriInvalid()

                class ErrorCode_HttpRequestUriTooLong
                -

                ErrorCode_HttpRequestUriTooLong()

                Expand source code @@ -491,13 +521,13 @@

                Class variables

                class ErrorCode_HttpRequestUriTooLong: pass
                +

                ErrorCode_HttpRequestUriTooLong()

                class ErrorCode_HttpResponseBodySize (value: int | None)
                -

                ErrorCode_HttpResponseBodySize(value: Optional[int])

                Expand source code @@ -506,7 +536,8 @@

                Class variables

                class ErrorCode_HttpResponseBodySize: value: Optional[int]
                -

                Class variables

                +

                ErrorCode_HttpResponseBodySize(value: Optional[int])

                +

                Instance variables

                var value : int | None
                @@ -519,7 +550,6 @@

                Class variables

                (value: str | None)
                -

                ErrorCode_HttpResponseContentCoding(value: Optional[str])

                Expand source code @@ -528,7 +558,8 @@

                Class variables

                class ErrorCode_HttpResponseContentCoding: value: Optional[str]
                -

                Class variables

                +

                ErrorCode_HttpResponseContentCoding(value: Optional[str])

                +

                Instance variables

                var value : str | None
                @@ -541,7 +572,6 @@

                Class variables

                (value: int | None)
                -

                ErrorCode_HttpResponseHeaderSectionSize(value: Optional[int])

                Expand source code @@ -550,7 +580,8 @@

                Class variables

                class ErrorCode_HttpResponseHeaderSectionSize: value: Optional[int]
                -

                Class variables

                +

                ErrorCode_HttpResponseHeaderSectionSize(value: Optional[int])

                +

                Instance variables

                var value : int | None
                @@ -563,7 +594,6 @@

                Class variables

                (value: FieldSizePayload)
                -

                ErrorCode_HttpResponseHeaderSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

                Expand source code @@ -572,7 +602,8 @@

                Class variables

                class ErrorCode_HttpResponseHeaderSize: value: FieldSizePayload
                -

                Class variables

                +

                ErrorCode_HttpResponseHeaderSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

                +

                Instance variables

                var valueFieldSizePayload
                @@ -584,7 +615,6 @@

                Class variables

                class ErrorCode_HttpResponseIncomplete
                -

                ErrorCode_HttpResponseIncomplete()

                Expand source code @@ -593,12 +623,12 @@

                Class variables

                class ErrorCode_HttpResponseIncomplete: pass
                +

                ErrorCode_HttpResponseIncomplete()

                class ErrorCode_HttpResponseTimeout
                -

                ErrorCode_HttpResponseTimeout()

                Expand source code @@ -607,13 +637,13 @@

                Class variables

                class ErrorCode_HttpResponseTimeout: pass
                +

                ErrorCode_HttpResponseTimeout()

                class ErrorCode_HttpResponseTrailerSectionSize (value: int | None)
                -

                ErrorCode_HttpResponseTrailerSectionSize(value: Optional[int])

                Expand source code @@ -622,7 +652,8 @@

                Class variables

                class ErrorCode_HttpResponseTrailerSectionSize: value: Optional[int]
                -

                Class variables

                +

                ErrorCode_HttpResponseTrailerSectionSize(value: Optional[int])

                +

                Instance variables

                var value : int | None
                @@ -635,7 +666,6 @@

                Class variables

                (value: FieldSizePayload)
                -

                ErrorCode_HttpResponseTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

                Expand source code @@ -644,7 +674,8 @@

                Class variables

                class ErrorCode_HttpResponseTrailerSize: value: FieldSizePayload
                -

                Class variables

                +

                ErrorCode_HttpResponseTrailerSize(value: spin_sdk.wit.imports.types.FieldSizePayload)

                +

                Instance variables

                var valueFieldSizePayload
                @@ -657,7 +688,6 @@

                Class variables

                (value: str | None)
                -

                ErrorCode_HttpResponseTransferCoding(value: Optional[str])

                Expand source code @@ -666,7 +696,8 @@

                Class variables

                class ErrorCode_HttpResponseTransferCoding: value: Optional[str]
                -

                Class variables

                +

                ErrorCode_HttpResponseTransferCoding(value: Optional[str])

                +

                Instance variables

                var value : str | None
                @@ -678,7 +709,6 @@

                Class variables

                class ErrorCode_HttpUpgradeFailed
                -

                ErrorCode_HttpUpgradeFailed()

                Expand source code @@ -687,13 +717,13 @@

                Class variables

                class ErrorCode_HttpUpgradeFailed: pass
                +

                ErrorCode_HttpUpgradeFailed()

                class ErrorCode_InternalError (value: str | None)
                -

                ErrorCode_InternalError(value: Optional[str])

                Expand source code @@ -702,7 +732,8 @@

                Class variables

                class ErrorCode_InternalError: value: Optional[str]
                -

                Class variables

                +

                ErrorCode_InternalError(value: Optional[str])

                +

                Instance variables

                var value : str | None
                @@ -714,7 +745,6 @@

                Class variables

                class ErrorCode_LoopDetected
                -

                ErrorCode_LoopDetected()

                Expand source code @@ -723,13 +753,13 @@

                Class variables

                class ErrorCode_LoopDetected: pass
                +

                ErrorCode_LoopDetected()

                class ErrorCode_TlsAlertReceived (value: TlsAlertReceivedPayload)
                -

                ErrorCode_TlsAlertReceived(value: spin_sdk.wit.imports.types.TlsAlertReceivedPayload)

                Expand source code @@ -738,7 +768,8 @@

                Class variables

                class ErrorCode_TlsAlertReceived: value: TlsAlertReceivedPayload
                -

                Class variables

                +

                ErrorCode_TlsAlertReceived(value: spin_sdk.wit.imports.types.TlsAlertReceivedPayload)

                +

                Instance variables

                var valueTlsAlertReceivedPayload
                @@ -750,7 +781,6 @@

                Class variables

                class ErrorCode_TlsCertificateError
                -

                ErrorCode_TlsCertificateError()

                Expand source code @@ -759,12 +789,12 @@

                Class variables

                class ErrorCode_TlsCertificateError: pass
                +

                ErrorCode_TlsCertificateError()

                class ErrorCode_TlsProtocolError
                -

                ErrorCode_TlsProtocolError()

                Expand source code @@ -773,13 +803,13 @@

                Class variables

                class ErrorCode_TlsProtocolError: pass
                +

                ErrorCode_TlsProtocolError()

                class FieldSizePayload (field_name: str | None, field_size: int | None)
                -

                Defines the case payload type for HTTP-response-{header,trailer}-size above:

                Expand source code @@ -792,7 +822,8 @@

                Class variables

                field_name: Optional[str] field_size: Optional[int]
                -

                Class variables

                +

                Defines the case payload type for HTTP-response-{header,trailer}-size above:

                +

                Instance variables

                var field_name : str | None
                @@ -808,17 +839,6 @@

                Class variables

                class Fields
                -

                This following block defines the fields resource which corresponds to -HTTP standard Fields. Fields are a common representation used for both -Headers and Trailers.

                -

                A fields may be mutable or immutable. A fields created using the -constructor, from-list, or clone will be mutable, but a fields -resource given by other means (including, but not limited to, -incoming-request.headers, outgoing-request.headers) might be be -immutable. In an immutable fields, the set, append, and delete -operations will fail with header-error.immutable.

                -

                Construct an empty HTTP Fields.

                -

                The resulting fields is mutable.

                Expand source code @@ -938,6 +958,17 @@

                Class variables

                """ raise NotImplementedError
                +

                This following block defines the fields resource which corresponds to +HTTP standard Fields. Fields are a common representation used for both +Headers and Trailers.

                +

                A fields may be mutable or immutable. A fields created using the +constructor, from-list, or clone will be mutable, but a fields +resource given by other means (including, but not limited to, +incoming-request.headers, outgoing-request.headers) might be be +immutable. In an immutable fields, the set, append, and delete +operations will fail with header-error.immutable.

                +

                Construct an empty HTTP Fields.

                +

                The resulting fields is mutable.

                Static methods

                @@ -964,6 +995,21 @@

                Methods

                def append(self, name: str, value: bytes) ‑> None
                +
                + +Expand source code + +
                def append(self, name: str, value: bytes) -> None:
                +    """
                +    Append a value for a key. Does not change or delete any existing
                +    values for that key.
                +    
                +    Fails with `header-error.immutable` if the `fields` are immutable.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
                +    """
                +    raise NotImplementedError
                +

                Append a value for a key. Does not change or delete any existing values for that key.

                Fails with header-error.immutable if the fields are immutable.

                @@ -973,6 +1019,18 @@

                Methods

                def clone(self) ‑> Self
                +
                + +Expand source code + +
                def clone(self) -> Self:
                +    """
                +    Make a deep copy of the Fields. Equivelant in behavior to calling the
                +    `fields` constructor on the return value of `entries`. The resulting
                +    `fields` is mutable.
                +    """
                +    raise NotImplementedError
                +

                Make a deep copy of the Fields. Equivelant in behavior to calling the fields constructor on the return value of entries. The resulting fields is mutable.

                @@ -981,6 +1039,21 @@

                Methods

                def delete(self, name: str) ‑> None
                +
                + +Expand source code + +
                def delete(self, name: str) -> None:
                +    """
                +    Delete all values for a key. Does nothing if no values for the key
                +    exist.
                +    
                +    Fails with `header-error.immutable` if the `fields` are immutable.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
                +    """
                +    raise NotImplementedError
                +

                Delete all values for a key. Does nothing if no values for the key exist.

                Fails with header-error.immutable if the fields are immutable.

                @@ -990,6 +1063,21 @@

                Methods

                def entries(self) ‑> List[Tuple[str, bytes]]
                +
                + +Expand source code + +
                def entries(self) -> List[Tuple[str, bytes]]:
                +    """
                +    Retrieve the full set of keys and values in the Fields. Like the
                +    constructor, the list represents each key-value pair.
                +    
                +    The outer list represents each key-value pair in the Fields. Keys
                +    which have multiple values are represented by multiple entries in this
                +    list with the same key.
                +    """
                +    raise NotImplementedError
                +

                Retrieve the full set of keys and values in the Fields. Like the constructor, the list represents each key-value pair.

                The outer list represents each key-value pair in the Fields. Keys @@ -1000,6 +1088,19 @@

                Methods

                def get(self, name: str) ‑> List[bytes]
                +
                + +Expand source code + +
                def get(self, name: str) -> List[bytes]:
                +    """
                +    Get all of the values corresponding to a key. If the key is not present
                +    in this `fields`, an empty list is returned. However, if the key is
                +    present but empty, this is represented by a list with one or more
                +    empty field-values present.
                +    """
                +    raise NotImplementedError
                +

                Get all of the values corresponding to a key. If the key is not present in this fields, an empty list is returned. However, if the key is present but empty, this is represented by a list with one or more @@ -1009,6 +1110,17 @@

                Methods

                def has(self, name: str) ‑> bool
                +
                + +Expand source code + +
                def has(self, name: str) -> bool:
                +    """
                +    Returns `true` when the key is present in this `fields`. If the key is
                +    syntactically invalid, `false` is returned.
                +    """
                +    raise NotImplementedError
                +

                Returns true when the key is present in this fields. If the key is syntactically invalid, false is returned.

                @@ -1016,6 +1128,21 @@

                Methods

                def set(self, name: str, value: List[bytes]) ‑> None
                +
                + +Expand source code + +
                def set(self, name: str, value: List[bytes]) -> None:
                +    """
                +    Set all of the values for a key. Clears any existing values for that
                +    key, if they have been set.
                +    
                +    Fails with `header-error.immutable` if the `fields` are immutable.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.types.HeaderError)`
                +    """
                +    raise NotImplementedError
                +

                Set all of the values for a key. Clears any existing values for that key, if they have been set.

                Fails with header-error.immutable if the fields are immutable.

                @@ -1027,10 +1154,6 @@

                Methods

                class FutureIncomingResponse
                -

                Represents a future which may eventaully return an incoming HTTP -Response, or an error.

                -

                This resource is returned by the wasi:http/outgoing-handler interface to -provide the HTTP Response corresponding to the sent Request.

                Expand source code @@ -1079,12 +1202,39 @@

                Methods

                """ raise NotImplementedError
                +

                Represents a future which may eventaully return an incoming HTTP +Response, or an error.

                +

                This resource is returned by the wasi:http/outgoing-handler interface to +provide the HTTP Response corresponding to the sent Request.

                Methods

                def get(self) ‑> Ok[Ok[IncomingResponse] | Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]] | Err[None] | None
                +
                + +Expand source code + +
                def get(self) -> Optional[Result[Result[IncomingResponse, ErrorCode], None]]:
                +    """
                +    Returns the incoming HTTP Response, or an error, once one is ready.
                +    
                +    The outer `option` represents future readiness. Users can wait on this
                +    `option` to become `some` using the `subscribe` method.
                +    
                +    The outer `result` is used to retrieve the response or error at most
                +    once. It will be success on the first call in which the outer option
                +    is `some`, and error on subsequent calls.
                +    
                +    The inner `result` represents that either the incoming HTTP Response
                +    status and headers have recieved successfully, or that an error
                +    occured. Errors may also occur while consuming the response body,
                +    but those will be reported by the `incoming-body` and its
                +    `output-stream` child.
                +    """
                +    raise NotImplementedError
                +

                Returns the incoming HTTP Response, or an error, once one is ready.

                The outer option represents future readiness. Users can wait on this option to become some using the subscribe method.

                @@ -1101,6 +1251,18 @@

                Methods

                def subscribe(self) ‑> Pollable
                +
                + +Expand source code + +
                def subscribe(self) -> poll.Pollable:
                +    """
                +    Returns a pollable which becomes ready when either the Response has
                +    been received, or an error has occured. When this pollable is ready,
                +    the `get` method will return `some`.
                +    """
                +    raise NotImplementedError
                +

                Returns a pollable which becomes ready when either the Response has been received, or an error has occured. When this pollable is ready, the get method will return some.

                @@ -1111,10 +1273,6 @@

                Methods

                class FutureTrailers
                -

                Represents a future which may eventaully return trailers, or an error.

                -

                In the case that the incoming HTTP Request or Response did not have any -trailers, this future will resolve to the empty set of trailers once the -complete Request or Response body has been received.

                Expand source code @@ -1168,12 +1326,44 @@

                Methods

                """ raise NotImplementedError
                +

                Represents a future which may eventaully return trailers, or an error.

                +

                In the case that the incoming HTTP Request or Response did not have any +trailers, this future will resolve to the empty set of trailers once the +complete Request or Response body has been received.

                Methods

                def get(self) ‑> Ok[Ok[Fields | None] | Err[ErrorCode_DnsTimeout | ErrorCode_DnsError | ErrorCode_DestinationNotFound | ErrorCode_DestinationUnavailable | ErrorCode_DestinationIpProhibited | ErrorCode_DestinationIpUnroutable | ErrorCode_ConnectionRefused | ErrorCode_ConnectionTerminated | ErrorCode_ConnectionTimeout | ErrorCode_ConnectionReadTimeout | ErrorCode_ConnectionWriteTimeout | ErrorCode_ConnectionLimitReached | ErrorCode_TlsProtocolError | ErrorCode_TlsCertificateError | ErrorCode_TlsAlertReceived | ErrorCode_HttpRequestDenied | ErrorCode_HttpRequestLengthRequired | ErrorCode_HttpRequestBodySize | ErrorCode_HttpRequestMethodInvalid | ErrorCode_HttpRequestUriInvalid | ErrorCode_HttpRequestUriTooLong | ErrorCode_HttpRequestHeaderSectionSize | ErrorCode_HttpRequestHeaderSize | ErrorCode_HttpRequestTrailerSectionSize | ErrorCode_HttpRequestTrailerSize | ErrorCode_HttpResponseIncomplete | ErrorCode_HttpResponseHeaderSectionSize | ErrorCode_HttpResponseHeaderSize | ErrorCode_HttpResponseBodySize | ErrorCode_HttpResponseTrailerSectionSize | ErrorCode_HttpResponseTrailerSize | ErrorCode_HttpResponseTransferCoding | ErrorCode_HttpResponseContentCoding | ErrorCode_HttpResponseTimeout | ErrorCode_HttpUpgradeFailed | ErrorCode_HttpProtocolError | ErrorCode_LoopDetected | ErrorCode_ConfigurationError | ErrorCode_InternalError]] | Err[None] | None
                +
                + +Expand source code + +
                def get(self) -> Optional[Result[Result[Optional[Fields], ErrorCode], None]]:
                +    """
                +    Returns the contents of the trailers, or an error which occured,
                +    once the future is ready.
                +    
                +    The outer `option` represents future readiness. Users can wait on this
                +    `option` to become `some` using the `subscribe` method.
                +    
                +    The outer `result` is used to retrieve the trailers or error at most
                +    once. It will be success on the first call in which the outer option
                +    is `some`, and error on subsequent calls.
                +    
                +    The inner `result` represents that either the HTTP Request or Response
                +    body, as well as any trailers, were received successfully, or that an
                +    error occured receiving them. The optional `trailers` indicates whether
                +    or not trailers were present in the body.
                +    
                +    When some `trailers` are returned by this method, the `trailers`
                +    resource is immutable, and a child. Use of the `set`, `append`, or
                +    `delete` methods will return an error, and the resource must be
                +    dropped before the parent `future-trailers` is dropped.
                +    """
                +    raise NotImplementedError
                +

                Returns the contents of the trailers, or an error which occured, once the future is ready.

                The outer option represents future readiness. Users can wait on this @@ -1194,6 +1384,18 @@

                Methods

                def subscribe(self) ‑> Pollable
                +
                + +Expand source code + +
                def subscribe(self) -> poll.Pollable:
                +    """
                +    Returns a pollable which becomes ready when either the trailers have
                +    been received, or an error has occured. When this pollable is ready,
                +    the `get` method will return `some`.
                +    """
                +    raise NotImplementedError
                +

                Returns a pollable which becomes ready when either the trailers have been received, or an error has occured. When this pollable is ready, the get method will return some.

                @@ -1204,7 +1406,6 @@

                Methods

                class HeaderError_Forbidden
                -

                HeaderError_Forbidden()

                Expand source code @@ -1213,12 +1414,12 @@

                Methods

                class HeaderError_Forbidden: pass
                +

                HeaderError_Forbidden()

                class HeaderError_Immutable
                -

                HeaderError_Immutable()

                Expand source code @@ -1227,12 +1428,12 @@

                Methods

                class HeaderError_Immutable: pass
                +

                HeaderError_Immutable()

                class HeaderError_InvalidSyntax
                -

                HeaderError_InvalidSyntax()

                Expand source code @@ -1241,18 +1442,12 @@

                Methods

                class HeaderError_InvalidSyntax: pass
                +

                HeaderError_InvalidSyntax()

                class IncomingBody
                -

                Represents an incoming HTTP Request or Response's Body.

                -

                A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, indicating that the full contents of the -body have been received. This resource represents the contents as -an input-stream and the delivery of trailers as a future-trailers, -and ensures that the user of this interface may only be consuming either -the body contents or waiting on trailers at any given time.

                Expand source code @@ -1307,6 +1502,13 @@

                Methods

                """ raise NotImplementedError
                +

                Represents an incoming HTTP Request or Response's Body.

                +

                A body has both its contents - a stream of bytes - and a (possibly +empty) set of trailers, indicating that the full contents of the +body have been received. This resource represents the contents as +an input-stream and the delivery of trailers as a future-trailers, +and ensures that the user of this interface may only be consuming either +the body contents or waiting on trailers at any given time.

                Static methods

                @@ -1323,6 +1525,32 @@

                Methods

                def stream(self) ‑> InputStream
                +
                + +Expand source code + +
                def stream(self) -> streams.InputStream:
                +    """
                +    Returns the contents of the body, as a stream of bytes.
                +    
                +    Returns success on first call: the stream representing the contents
                +    can be retrieved at most once. Subsequent calls will return error.
                +    
                +    The returned `input-stream` resource is a child: it must be dropped
                +    before the parent `incoming-body` is dropped, or consumed by
                +    `incoming-body.finish`.
                +    
                +    This invariant ensures that the implementation can determine whether
                +    the user is consuming the contents of the body, waiting on the
                +    `future-trailers` to be ready, or neither. This allows for network
                +    backpressure is to be applied when the user is consuming the body,
                +    and for that backpressure to not inhibit delivery of the trailers if
                +    the user does not read the entire body.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Returns the contents of the body, as a stream of bytes.

                Returns success on first call: the stream representing the contents can be retrieved at most once. Subsequent calls will return error.

                @@ -1343,7 +1571,6 @@

                Methods

                class IncomingRequest
                -

                Represents an incoming HTTP Request.

                Expand source code @@ -1403,18 +1630,42 @@

                Methods

                """ raise NotImplementedError
                +

                Represents an incoming HTTP Request.

                Methods

                def authority(self) ‑> str | None
                -

                Returns the authority from the request, if it was present.

                -
                -
                +
                + +Expand source code + +
                def authority(self) -> Optional[str]:
                +    """
                +    Returns the authority from the request, if it was present.
                +    """
                +    raise NotImplementedError
                +
                +

                Returns the authority from the request, if it was present.

                +
                +
                def consume(self) ‑> IncomingBody
                +
                + +Expand source code + +
                def consume(self) -> IncomingBody:
                +    """
                +    Gives the `incoming-body` associated with this request. Will only
                +    return success at most once, and subsequent calls will return error.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Gives the incoming-body associated with this request. Will only return success at most once, and subsequent calls will return error.

                Raises: Err(None)

                @@ -1423,6 +1674,23 @@

                Methods

                def headers(self) ‑> Fields
                +
                + +Expand source code + +
                def headers(self) -> Fields:
                +    """
                +    Get the `headers` associated with the request.
                +    
                +    The returned `headers` resource is immutable: `set`, `append`, and
                +    `delete` operations will fail with `header-error.immutable`.
                +    
                +    The `headers` returned are a child resource: it must be dropped before
                +    the parent `incoming-request` is dropped. Dropping this
                +    `incoming-request` before all children are dropped will trap.
                +    """
                +    raise NotImplementedError
                +

                Get the headers associated with the request.

                The returned headers resource is immutable: set, append, and delete operations will fail with header-error.immutable.

                @@ -1434,18 +1702,48 @@

                Methods

                def method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other
                +
                + +Expand source code + +
                def method(self) -> Method:
                +    """
                +    Returns the method of the incoming request.
                +    """
                +    raise NotImplementedError
                +

                Returns the method of the incoming request.

                def path_with_query(self) ‑> str | None
                +
                + +Expand source code + +
                def path_with_query(self) -> Optional[str]:
                +    """
                +    Returns the path with query parameters from the request, as a string.
                +    """
                +    raise NotImplementedError
                +

                Returns the path with query parameters from the request, as a string.

                def scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None
                +
                + +Expand source code + +
                def scheme(self) -> Optional[Scheme]:
                +    """
                +    Returns the protocol scheme from the request.
                +    """
                +    raise NotImplementedError
                +

                Returns the protocol scheme from the request.

                @@ -1454,7 +1752,6 @@

                Methods

                class IncomingResponse
                -

                Represents an incoming HTTP Response.

                Expand source code @@ -1498,12 +1795,26 @@

                Methods

                """ raise NotImplementedError
                +

                Represents an incoming HTTP Response.

                Methods

                def consume(self) ‑> IncomingBody
                +
                + +Expand source code + +
                def consume(self) -> IncomingBody:
                +    """
                +    Returns the incoming body. May be called at most once. Returns error
                +    if called additional times.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Returns the incoming body. May be called at most once. Returns error if called additional times.

                Raises: Err(None)

                @@ -1512,6 +1823,22 @@

                Methods

                def headers(self) ‑> Fields
                +
                + +Expand source code + +
                def headers(self) -> Fields:
                +    """
                +    Returns the headers from the incoming response.
                +    
                +    The returned `headers` resource is immutable: `set`, `append`, and
                +    `delete` operations will fail with `header-error.immutable`.
                +    
                +    This headers resource is a child: it must be dropped before the parent
                +    `incoming-response` is dropped.
                +    """
                +    raise NotImplementedError
                +

                Returns the headers from the incoming response.

                The returned headers resource is immutable: set, append, and delete operations will fail with header-error.immutable.

                @@ -1522,6 +1849,16 @@

                Methods

                def status(self) ‑> int
                +
                + +Expand source code + +
                def status(self) -> int:
                +    """
                +    Returns the status code from the incoming response.
                +    """
                +    raise NotImplementedError
                +

                Returns the status code from the incoming response.

                @@ -1530,7 +1867,6 @@

                Methods

                class Method_Connect
                -

                Method_Connect()

                Expand source code @@ -1539,12 +1875,12 @@

                Methods

                class Method_Connect: pass
                +

                Method_Connect()

                class Method_Delete
                -

                Method_Delete()

                Expand source code @@ -1553,12 +1889,12 @@

                Methods

                class Method_Delete: pass
                +

                Method_Delete()

                class Method_Get
                -

                Method_Get()

                Expand source code @@ -1567,12 +1903,12 @@

                Methods

                class Method_Get: pass
                +

                Method_Get()

                class Method_Head
                -

                Method_Head()

                Expand source code @@ -1581,12 +1917,12 @@

                Methods

                class Method_Head: pass
                +

                Method_Head()

                class Method_Options
                -

                Method_Options()

                Expand source code @@ -1595,13 +1931,13 @@

                Methods

                class Method_Options: pass
                +

                Method_Options()

                class Method_Other (value: str)
                -

                Method_Other(value: str)

                Expand source code @@ -1610,7 +1946,8 @@

                Methods

                class Method_Other: value: str
                -

                Class variables

                +

                Method_Other(value: str)

                +

                Instance variables

                var value : str
                @@ -1622,7 +1959,6 @@

                Class variables

                class Method_Patch
                -

                Method_Patch()

                Expand source code @@ -1631,12 +1967,12 @@

                Class variables

                class Method_Patch: pass
                +

                Method_Patch()

                class Method_Post
                -

                Method_Post()

                Expand source code @@ -1645,12 +1981,12 @@

                Class variables

                class Method_Post: pass
                +

                Method_Post()

                class Method_Put
                -

                Method_Put()

                Expand source code @@ -1659,12 +1995,12 @@

                Class variables

                class Method_Put: pass
                +

                Method_Put()

                class Method_Trace
                -

                Method_Trace()

                Expand source code @@ -1673,25 +2009,12 @@

                Class variables

                class Method_Trace: pass
                +

                Method_Trace()

                class OutgoingBody
                -

                Represents an outgoing HTTP Request or Response's Body.

                -

                A body has both its contents - a stream of bytes - and a (possibly -empty) set of trailers, inducating the full contents of the body -have been sent. This resource represents the contents as an -output-stream child resource, and the completion of the body (with -optional trailers) with a static function that consumes the -outgoing-body resource, and ensures that the user of this interface -may not write to the body contents after the body has been finished.

                -

                If the user code drops this resource, as opposed to calling the static -method finish, the implementation should treat the body as incomplete, -and that an error has occured. The implementation should propogate this -error to the HTTP protocol by whatever means it has available, -including: corrupting the body on the wire, aborting the associated -Request, or sending a late status code for the Response.

                Expand source code @@ -1757,6 +2080,20 @@

                Class variables

                """ raise NotImplementedError
                +

                Represents an outgoing HTTP Request or Response's Body.

                +

                A body has both its contents - a stream of bytes - and a (possibly +empty) set of trailers, inducating the full contents of the body +have been sent. This resource represents the contents as an +output-stream child resource, and the completion of the body (with +optional trailers) with a static function that consumes the +outgoing-body resource, and ensures that the user of this interface +may not write to the body contents after the body has been finished.

                +

                If the user code drops this resource, as opposed to calling the static +method finish, the implementation should treat the body as incomplete, +and that an error has occured. The implementation should propogate this +error to the HTTP protocol by whatever means it has available, +including: corrupting the body on the wire, aborting the associated +Request, or sending a late status code for the Response.

                Static methods

                @@ -1780,6 +2117,26 @@

                Methods

                def write(self) ‑> OutputStream
                +
                + +Expand source code + +
                def write(self) -> streams.OutputStream:
                +    """
                +    Returns a stream for writing the body contents.
                +    
                +    The returned `output-stream` is a child resource: it must be dropped
                +    before the parent `outgoing-body` resource is dropped (or finished),
                +    otherwise the `outgoing-body` drop or `finish` will trap.
                +    
                +    Returns success on the first call: the `output-stream` resource for
                +    this `outgoing-body` may be retrieved at most once. Subsequent calls
                +    will return error.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Returns a stream for writing the body contents.

                The returned output-stream is a child resource: it must be dropped before the parent outgoing-body resource is dropped (or finished), @@ -1796,17 +2153,6 @@

                Methods

                (headers: Fields)
                -

                Represents an outgoing HTTP Request.

                -

                Construct a new outgoing-request with a default method of GET, and -none values for path-with-query, scheme, and authority.

                -
                  -
                • headers is the HTTP Headers for the Request.
                • -
                -

                It is possible to construct, or manipulate with the accessor functions -below, an outgoing-request with an invalid combination of scheme -and authority, or headers which are not permitted to be sent. -It is the obligation of the outgoing-handler.handle implementation -to reject invalid constructions of outgoing-request.

                Expand source code @@ -1925,12 +2271,35 @@

                Methods

                """ raise NotImplementedError
                +

                Represents an outgoing HTTP Request.

                +

                Construct a new outgoing-request with a default method of GET, and +none values for path-with-query, scheme, and authority.

                +
                  +
                • headers is the HTTP Headers for the Request.
                • +
                +

                It is possible to construct, or manipulate with the accessor functions +below, an outgoing-request with an invalid combination of scheme +and authority, or headers which are not permitted to be sent. +It is the obligation of the outgoing-handler.handle implementation +to reject invalid constructions of outgoing-request.

                Methods

                def authority(self) ‑> str | None
                +
                + +Expand source code + +
                def authority(self) -> Optional[str]:
                +    """
                +    Get the HTTP Authority for the Request. A value of `none` may be used
                +    with Related Schemes which do not require an Authority. The HTTP and
                +    HTTPS schemes always require an authority.
                +    """
                +    raise NotImplementedError
                +

                Get the HTTP Authority for the Request. A value of none may be used with Related Schemes which do not require an Authority. The HTTP and HTTPS schemes always require an authority.

                @@ -1939,6 +2308,23 @@

                Methods

                def body(self) ‑> OutgoingBody
                +
                + +Expand source code + +
                def body(self) -> OutgoingBody:
                +    """
                +    Returns the resource corresponding to the outgoing Body for this
                +    Request.
                +    
                +    Returns success on the first call: the `outgoing-body` resource for
                +    this `outgoing-request` can be retrieved at most once. Subsequent
                +    calls will return error.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Returns the resource corresponding to the outgoing Body for this Request.

                Returns success on the first call: the outgoing-body resource for @@ -1950,6 +2336,23 @@

                Methods

                def headers(self) ‑> Fields
                +
                + +Expand source code + +
                def headers(self) -> Fields:
                +    """
                +    Get the headers associated with the Request.
                +    
                +    The returned `headers` resource is immutable: `set`, `append`, and
                +    `delete` operations will fail with `header-error.immutable`.
                +    
                +    This headers resource is a child: it must be dropped before the parent
                +    `outgoing-request` is dropped, or its ownership is transfered to
                +    another component by e.g. `outgoing-handler.handle`.
                +    """
                +    raise NotImplementedError
                +

                Get the headers associated with the Request.

                The returned headers resource is immutable: set, append, and delete operations will fail with header-error.immutable.

                @@ -1961,12 +2364,33 @@

                Methods

                def method(self) ‑> Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other
                +
                + +Expand source code + +
                def method(self) -> Method:
                +    """
                +    Get the Method for the Request.
                +    """
                +    raise NotImplementedError
                +

                Get the Method for the Request.

                def path_with_query(self) ‑> str | None
                +
                + +Expand source code + +
                def path_with_query(self) -> Optional[str]:
                +    """
                +    Get the combination of the HTTP Path and Query for the Request.
                +    When `none`, this represents an empty Path and empty Query.
                +    """
                +    raise NotImplementedError
                +

                Get the combination of the HTTP Path and Query for the Request. When none, this represents an empty Path and empty Query.

                @@ -1974,6 +2398,17 @@

                Methods

                def scheme(self) ‑> Scheme_Http | Scheme_Https | Scheme_Other | None
                +
                + +Expand source code + +
                def scheme(self) -> Optional[Scheme]:
                +    """
                +    Get the HTTP Related Scheme for the Request. When `none`, the
                +    implementation may choose an appropriate default scheme.
                +    """
                +    raise NotImplementedError
                +

                Get the HTTP Related Scheme for the Request. When none, the implementation may choose an appropriate default scheme.

                @@ -1981,6 +2416,21 @@

                Methods

                def set_authority(self, authority: str | None) ‑> None
                +
                + +Expand source code + +
                def set_authority(self, authority: Optional[str]) -> None:
                +    """
                +    Set the HTTP Authority for the Request. A value of `none` may be used
                +    with Related Schemes which do not require an Authority. The HTTP and
                +    HTTPS schemes always require an authority. Fails if the string given is
                +    not a syntactically valid uri authority.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Set the HTTP Authority for the Request. A value of none may be used with Related Schemes which do not require an Authority. The HTTP and HTTPS schemes always require an authority. Fails if the string given is @@ -1991,6 +2441,19 @@

                Methods

                def set_method(self,
                method: Method_Get | Method_Head | Method_Post | Method_Put | Method_Delete | Method_Connect | Method_Options | Method_Trace | Method_Patch | Method_Other) ‑> None
                +
                + +Expand source code + +
                def set_method(self, method: Method) -> None:
                +    """
                +    Set the Method for the Request. Fails if the string present in a
                +    `method.other` argument is not a syntactically valid method.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Set the Method for the Request. Fails if the string present in a method.other argument is not a syntactically valid method.

                Raises: Err(None)

                @@ -1999,6 +2462,20 @@

                Methods

                def set_path_with_query(self, path_with_query: str | None) ‑> None
                +
                + +Expand source code + +
                def set_path_with_query(self, path_with_query: Optional[str]) -> None:
                +    """
                +    Set the combination of the HTTP Path and Query for the Request.
                +    When `none`, this represents an empty Path and empty Query. Fails is the
                +    string given is not a syntactically valid path and query uri component.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Set the combination of the HTTP Path and Query for the Request. When none, this represents an empty Path and empty Query. Fails is the string given is not a syntactically valid path and query uri component.

                @@ -2008,6 +2485,20 @@

                Methods

                def set_scheme(self,
                scheme: Scheme_Http | Scheme_Https | Scheme_Other | None) ‑> None
                +
                + +Expand source code + +
                def set_scheme(self, scheme: Optional[Scheme]) -> None:
                +    """
                +    Set the HTTP Related Scheme for the Request. When `none`, the
                +    implementation may choose an appropriate default scheme. Fails if the
                +    string given is not a syntactically valid uri scheme.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Set the HTTP Related Scheme for the Request. When none, the implementation may choose an appropriate default scheme. Fails if the string given is not a syntactically valid uri scheme.

                @@ -2020,13 +2511,6 @@

                Methods

                (headers: Fields)
                -

                Represents an outgoing HTTP Response.

                -

                Construct an outgoing-response, with a default status-code of 200. -If a different status-code is needed, it must be set via the -set-status-code method.

                -
                  -
                • headers is the HTTP Headers for the Response.
                • -
                Expand source code @@ -2092,12 +2576,35 @@

                Methods

                """ raise NotImplementedError
                +

                Represents an outgoing HTTP Response.

                +

                Construct an outgoing-response, with a default status-code of 200. +If a different status-code is needed, it must be set via the +set-status-code method.

                +
                  +
                • headers is the HTTP Headers for the Response.
                • +

                Methods

                def body(self) ‑> OutgoingBody
                +
                + +Expand source code + +
                def body(self) -> OutgoingBody:
                +    """
                +    Returns the resource corresponding to the outgoing Body for this Response.
                +    
                +    Returns success on the first call: the `outgoing-body` resource for
                +    this `outgoing-response` can be retrieved at most once. Subsequent
                +    calls will return error.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Returns the resource corresponding to the outgoing Body for this Response.

                Returns success on the first call: the outgoing-body resource for this outgoing-response can be retrieved at most once. Subsequent @@ -2108,6 +2615,23 @@

                Methods

                def headers(self) ‑> Fields
                +
                + +Expand source code + +
                def headers(self) -> Fields:
                +    """
                +    Get the headers associated with the Request.
                +    
                +    The returned `headers` resource is immutable: `set`, `append`, and
                +    `delete` operations will fail with `header-error.immutable`.
                +    
                +    This headers resource is a child: it must be dropped before the parent
                +    `outgoing-request` is dropped, or its ownership is transfered to
                +    another component by e.g. `outgoing-handler.handle`.
                +    """
                +    raise NotImplementedError
                +

                Get the headers associated with the Request.

                The returned headers resource is immutable: set, append, and delete operations will fail with header-error.immutable.

                @@ -2119,6 +2643,19 @@

                Methods

                def set_status_code(self, status_code: int) ‑> None
                +
                + +Expand source code + +
                def set_status_code(self, status_code: int) -> None:
                +    """
                +    Set the HTTP Status Code for the Response. Fails if the status-code
                +    given is not a valid http status code.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Set the HTTP Status Code for the Response. Fails if the status-code given is not a valid http status code.

                Raises: Err(None)

                @@ -2127,6 +2664,16 @@

                Methods

                def status_code(self) ‑> int
                +
                + +Expand source code + +
                def status_code(self) -> int:
                +    """
                +    Get the HTTP Status Code for the Response.
                +    """
                +    raise NotImplementedError
                +

                Get the HTTP Status Code for the Response.

                @@ -2135,12 +2682,6 @@

                Methods

                class RequestOptions
                -

                Parameters for making an HTTP Request. Each of these parameters is -currently an optional timeout applicable to the transport layer of the -HTTP protocol.

                -

                These timeouts are separate from any the user may use to bound a -blocking call to wasi:io/poll.poll.

                -

                Construct a default request-options value.

                Expand source code @@ -2212,12 +2753,29 @@

                Methods

                """ raise NotImplementedError
                +

                Parameters for making an HTTP Request. Each of these parameters is +currently an optional timeout applicable to the transport layer of the +HTTP protocol.

                +

                These timeouts are separate from any the user may use to bound a +blocking call to wasi:io/poll.poll.

                +

                Construct a default request-options value.

                Methods

                def between_bytes_timeout(self) ‑> int | None
                +
                + +Expand source code + +
                def between_bytes_timeout(self) -> Optional[int]:
                +    """
                +    The timeout for receiving subsequent chunks of bytes in the Response
                +    body stream.
                +    """
                +    raise NotImplementedError
                +

                The timeout for receiving subsequent chunks of bytes in the Response body stream.

                @@ -2225,18 +2783,52 @@

                Methods

                def connect_timeout(self) ‑> int | None
                +
                + +Expand source code + +
                def connect_timeout(self) -> Optional[int]:
                +    """
                +    The timeout for the initial connect to the HTTP Server.
                +    """
                +    raise NotImplementedError
                +

                The timeout for the initial connect to the HTTP Server.

                def first_byte_timeout(self) ‑> int | None
                +
                + +Expand source code + +
                def first_byte_timeout(self) -> Optional[int]:
                +    """
                +    The timeout for receiving the first byte of the Response body.
                +    """
                +    raise NotImplementedError
                +

                The timeout for receiving the first byte of the Response body.

                def set_between_bytes_timeout(self, duration: int | None) ‑> None
                +
                + +Expand source code + +
                def set_between_bytes_timeout(self, duration: Optional[int]) -> None:
                +    """
                +    Set the timeout for receiving subsequent chunks of bytes in the Response
                +    body stream. An error return value indicates that this timeout is not
                +    supported.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Set the timeout for receiving subsequent chunks of bytes in the Response body stream. An error return value indicates that this timeout is not supported.

                @@ -2246,6 +2838,19 @@

                Methods

                def set_connect_timeout(self, duration: int | None) ‑> None
                +
                + +Expand source code + +
                def set_connect_timeout(self, duration: Optional[int]) -> None:
                +    """
                +    Set the timeout for the initial connect to the HTTP Server. An error
                +    return value indicates that this timeout is not supported.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Set the timeout for the initial connect to the HTTP Server. An error return value indicates that this timeout is not supported.

                Raises: Err(None)

                @@ -2254,6 +2859,19 @@

                Methods

                def set_first_byte_timeout(self, duration: int | None) ‑> None
                +
                + +Expand source code + +
                def set_first_byte_timeout(self, duration: Optional[int]) -> None:
                +    """
                +    Set the timeout for receiving the first byte of the Response body. An
                +    error return value indicates that this timeout is not supported.
                +    
                +    Raises: `spin_sdk.wit.types.Err(None)`
                +    """
                +    raise NotImplementedError
                +

                Set the timeout for receiving the first byte of the Response body. An error return value indicates that this timeout is not supported.

                Raises: Err(None)

                @@ -2264,10 +2882,6 @@

                Methods

                class ResponseOutparam
                -

                Represents the ability to send an HTTP Response.

                -

                This resource is used by the wasi:http/incoming-handler interface to -allow a Response to be sent corresponding to the Request provided as the -other argument to incoming-handler.handle.

                Expand source code @@ -2305,6 +2919,10 @@

                Methods

                """ raise NotImplementedError
                +

                Represents the ability to send an HTTP Response.

                +

                This resource is used by the wasi:http/incoming-handler interface to +allow a Response to be sent corresponding to the Request provided as the +other argument to incoming-handler.handle.

                Static methods

                @@ -2325,7 +2943,6 @@

                Static methods

                class Scheme_Http
                -

                Scheme_Http()

                Expand source code @@ -2334,12 +2951,12 @@

                Static methods

                class Scheme_Http: pass
                +

                Scheme_Http()

                class Scheme_Https
                -

                Scheme_Https()

                Expand source code @@ -2348,13 +2965,13 @@

                Static methods

                class Scheme_Https: pass
                +

                Scheme_Https()

                class Scheme_Other (value: str)
                -

                Scheme_Other(value: str)

                Expand source code @@ -2363,7 +2980,8 @@

                Static methods

                class Scheme_Other: value: str
                -

                Class variables

                +

                Scheme_Other(value: str)

                +

                Instance variables

                var value : str
                @@ -2376,7 +2994,6 @@

                Class variables

                (alert_id: int | None, alert_message: str | None)
                -

                Defines the case payload type for TLS-alert-received above:

                Expand source code @@ -2389,7 +3006,8 @@

                Class variables

                alert_id: Optional[int] alert_message: Optional[str]
                -

                Class variables

                +

                Defines the case payload type for TLS-alert-received above:

                +

                Instance variables

                var alert_id : int | None
                @@ -2773,7 +3391,7 @@

                -

                Generated by pdoc 0.11.3.

                +

                Generated by pdoc 0.11.6.

                diff --git a/docs/v3/wit/imports/variables.html b/docs/v3/wit/imports/variables.html index bdc3e26..48d2175 100644 --- a/docs/v3/wit/imports/variables.html +++ b/docs/v3/wit/imports/variables.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.variables API documentation - + @@ -44,6 +55,20 @@

                Functions

                def get(name: str) ‑> str
                +
                + +Expand source code + +
                def get(name: str) -> str:
                +    """
                +    Get an application variable value for the current component.
                +    
                +    The name must match one defined in in the component manifest.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.variables.Error)`
                +    """
                +    raise NotImplementedError
                +

                Get an application variable value for the current component.

                The name must match one defined in in the component manifest.

                Raises: Err(Error)

                @@ -58,7 +83,6 @@

                Classes

                (value: str)
                -

                Error_InvalidName(value: str)

                Expand source code @@ -67,7 +91,8 @@

                Classes

                class Error_InvalidName: value: str
                -

                Class variables

                +

                Error_InvalidName(value: str)

                +

                Instance variables

                var value : str
                @@ -80,7 +105,6 @@

                Class variables

                (value: str)
                -

                Error_Other(value: str)

                Expand source code @@ -89,7 +113,8 @@

                Class variables

                class Error_Other: value: str
                -

                Class variables

                +

                Error_Other(value: str)

                +

                Instance variables

                var value : str
                @@ -102,7 +127,6 @@

                Class variables

                (value: str)
                -

                Error_Provider(value: str)

                Expand source code @@ -111,7 +135,8 @@

                Class variables

                class Error_Provider: value: str
                -

                Class variables

                +

                Error_Provider(value: str)

                +

                Instance variables

                var value : str
                @@ -124,7 +149,6 @@

                Class variables

                (value: str)
                -

                Error_Undefined(value: str)

                Expand source code @@ -133,7 +157,8 @@

                Class variables

                class Error_Undefined: value: str
                -

                Class variables

                +

                Error_Undefined(value: str)

                +

                Instance variables

                var value : str
                @@ -196,7 +221,7 @@

                -

                Generated by pdoc 0.11.3.

                +

                Generated by pdoc 0.11.6.

                diff --git a/docs/v3/wit/imports/wasi_config_store.html b/docs/v3/wit/imports/wasi_config_store.html index 05b07c2..77f405a 100644 --- a/docs/v3/wit/imports/wasi_config_store.html +++ b/docs/v3/wit/imports/wasi_config_store.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.wasi_config_store API documentation - + @@ -44,6 +55,21 @@

                Functions

                def get(key: str) ‑> str | None
                +
                + +Expand source code + +
                def get(key: str) -> Optional[str]:
                +    """
                +    Gets a configuration value of type `string` associated with the `key`.
                +    
                +    The value is returned as an `option<string>`. If the key is not found,
                +    `Ok(none)` is returned. If an error occurs, an `Err(error)` is returned.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_config_store.Error)`
                +    """
                +    raise NotImplementedError
                +

                Gets a configuration value of type string associated with the key.

                The value is returned as an option<string>. If the key is not found, Ok(none) is returned. If an error occurs, an Err(error) is returned.

                @@ -53,6 +79,20 @@

                Functions

                def get_all() ‑> List[Tuple[str, str]]
                +
                + +Expand source code + +
                def get_all() -> List[Tuple[str, str]]:
                +    """
                +    Gets a list of configuration key-value pairs of type `string`.
                +    
                +    If an error occurs, an `Err(error)` is returned.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_config_store.Error)`
                +    """
                +    raise NotImplementedError
                +

                Gets a list of configuration key-value pairs of type string.

                If an error occurs, an Err(error) is returned.

                Raises: Err(Error)

                @@ -67,7 +107,6 @@

                Classes

                (value: str)
                -

                Error_Io(value: str)

                Expand source code @@ -76,7 +115,8 @@

                Classes

                class Error_Io: value: str
                -

                Class variables

                +

                Error_Io(value: str)

                +

                Instance variables

                var value : str
                @@ -89,7 +129,6 @@

                Class variables

                (value: str)
                -

                Error_Upstream(value: str)

                Expand source code @@ -98,7 +137,8 @@

                Class variables

                class Error_Upstream: value: str
                -

                Class variables

                +

                Error_Upstream(value: str)

                +

                Instance variables

                var value : str
                @@ -150,7 +190,7 @@

                diff --git a/docs/v3/wit/imports/wasi_keyvalue_store.html b/docs/v3/wit/imports/wasi_keyvalue_store.html index d9f216e..bfe6999 100644 --- a/docs/v3/wit/imports/wasi_keyvalue_store.html +++ b/docs/v3/wit/imports/wasi_keyvalue_store.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.imports.wasi_keyvalue_store API documentation - + @@ -65,6 +76,22 @@

                Functions

                def open(identifier: str) ‑> Bucket
                +
                + +Expand source code + +
                def open(identifier: str) -> Bucket:
                +    """
                +    Get the bucket with the specified identifier.
                +    
                +    `identifier` must refer to a bucket provided by the host.
                +    
                +    `error::no-such-store` will be raised if the `identifier` is not recognized.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
                +    """
                +    raise NotImplementedError
                +

                Get the bucket with the specified identifier.

                identifier must refer to a bucket provided by the host.

                error::no-such-store will be raised if the identifier is not recognized.

                @@ -79,20 +106,6 @@

                Classes

                class Bucket
                -

                A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the -bucket, and the bucket itself acts as a collection of all these entries.

                -

                It is worth noting that the exact terminology for bucket in key-value stores can very -depending on the specific implementation. For example:

                -
                  -
                1. Amazon DynamoDB calls a collection of key-value pairs a table
                2. -
                3. Redis has hashes, sets, and sorted sets as different types of collections
                4. -
                5. Cassandra calls a collection of key-value pairs a column family
                6. -
                7. MongoDB calls a collection of key-value pairs a collection
                8. -
                9. Riak calls a collection of key-value pairs a bucket
                10. -
                11. Memcached calls a collection of key-value pairs a slab
                12. -
                13. Azure Cosmos DB calls a collection of key-value pairs a container
                14. -
                -

                In this interface, we use the term bucket to refer to a collection of key-value pairs

                Expand source code @@ -196,12 +209,42 @@

                Classes

                """ raise NotImplementedError
                +

                A bucket is a collection of key-value pairs. Each key-value pair is stored as a entry in the +bucket, and the bucket itself acts as a collection of all these entries.

                +

                It is worth noting that the exact terminology for bucket in key-value stores can very +depending on the specific implementation. For example:

                +
                  +
                1. Amazon DynamoDB calls a collection of key-value pairs a table
                2. +
                3. Redis has hashes, sets, and sorted sets as different types of collections
                4. +
                5. Cassandra calls a collection of key-value pairs a column family
                6. +
                7. MongoDB calls a collection of key-value pairs a collection
                8. +
                9. Riak calls a collection of key-value pairs a bucket
                10. +
                11. Memcached calls a collection of key-value pairs a slab
                12. +
                13. Azure Cosmos DB calls a collection of key-value pairs a container
                14. +
                +

                In this interface, we use the term bucket to refer to a collection of key-value pairs

                Methods

                def delete(self, key: str) ‑> None
                +
                + +Expand source code + +
                def delete(self, key: str) -> None:
                +    """
                +    Delete the key-value pair associated with the key in the store.
                +    
                +    If the key does not exist in the store, it does nothing.
                +    
                +    If any other error occurs, it returns an `Err(error)`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
                +    """
                +    raise NotImplementedError
                +

                Delete the key-value pair associated with the key in the store.

                If the key does not exist in the store, it does nothing.

                If any other error occurs, it returns an Err(error).

                @@ -211,6 +254,23 @@

                Methods

                def exists(self, key: str) ‑> bool
                +
                + +Expand source code + +
                def exists(self, key: str) -> bool:
                +    """
                +    Check if the key exists in the store.
                +    
                +    If the key exists in the store, it returns `Ok(true)`. If the key does
                +    not exist in the store, it returns `Ok(false)`.
                +    
                +    If any other error occurs, it returns an `Err(error)`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
                +    """
                +    raise NotImplementedError
                +

                Check if the key exists in the store.

                If the key exists in the store, it returns Ok(true). If the key does not exist in the store, it returns Ok(false).

                @@ -221,6 +281,24 @@

                Methods

                def get(self, key: str) ‑> bytes | None
                +
                + +Expand source code + +
                def get(self, key: str) -> Optional[bytes]:
                +    """
                +    Get the value associated with the specified `key`
                +    
                +    The value is returned as an option. If the key-value pair exists in the
                +    store, it returns `Ok(value)`. If the key does not exist in the
                +    store, it returns `Ok(none)`.
                +    
                +    If any other error occurs, it returns an `Err(error)`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
                +    """
                +    raise NotImplementedError
                +

                Get the value associated with the specified key

                The value is returned as an option. If the key-value pair exists in the store, it returns Ok(value). If the key does not exist in the @@ -232,6 +310,33 @@

                Methods

                def list_keys(self, cursor: str | None) ‑> KeyResponse
                +
                + +Expand source code + +
                def list_keys(self, cursor: Optional[str]) -> KeyResponse:
                +    """
                +    Get all the keys in the store with an optional cursor (for use in pagination). It
                +    returns a list of keys. Please note that for most KeyValue implementations, this is a
                +    can be a very expensive operation and so it should be used judiciously. Implementations
                +    can return any number of keys in a single response, but they should never attempt to
                +    send more data than is reasonable (i.e. on a small edge device, this may only be a few
                +    KB, while on a large machine this could be several MB). Any response should also return
                +    a cursor that can be used to fetch the next page of keys. See the `key-response` record
                +    for more information.
                +    
                +    Note that the keys are not guaranteed to be returned in any particular order.
                +    
                +    If the store is empty, it returns an empty list.
                +    
                +    MAY show an out-of-date list of keys if there are concurrent writes to the store.
                +    
                +    If any error occurs, it returns an `Err(error)`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
                +    """
                +    raise NotImplementedError
                +

                Get all the keys in the store with an optional cursor (for use in pagination). It returns a list of keys. Please note that for most KeyValue implementations, this is a can be a very expensive operation and so it should be used judiciously. Implementations @@ -250,6 +355,23 @@

                Methods

                def set(self, key: str, value: bytes) ‑> None
                +
                + +Expand source code + +
                def set(self, key: str, value: bytes) -> None:
                +    """
                +    Set the value associated with the key in the store. If the key already
                +    exists in the store, it overwrites the value.
                +    
                +    If the key does not exist in the store, it creates a new key-value pair.
                +    
                +    If any other error occurs, it returns an `Err(error)`.
                +    
                +    Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.wasi_keyvalue_store.Error)`
                +    """
                +    raise NotImplementedError
                +

                Set the value associated with the key in the store. If the key already exists in the store, it overwrites the value.

                If the key does not exist in the store, it creates a new key-value pair.

                @@ -262,7 +384,6 @@

                Methods

                class Error_AccessDenied
                -

                Error_AccessDenied()

                Expand source code @@ -271,12 +392,12 @@

                Methods

                class Error_AccessDenied: pass
                +

                Error_AccessDenied()

                class Error_NoSuchStore
                -

                Error_NoSuchStore()

                Expand source code @@ -285,13 +406,13 @@

                Methods

                class Error_NoSuchStore: pass
                +

                Error_NoSuchStore()

                class Error_Other (value: str)
                -

                Error_Other(value: str)

                Expand source code @@ -300,7 +421,8 @@

                Methods

                class Error_Other: value: str
                -

                Class variables

                +

                Error_Other(value: str)

                +

                Instance variables

                var value : str
                @@ -313,7 +435,6 @@

                Class variables

                (keys: List[str], cursor: str | None)
                -

                A response to a list-keys operation.

                Expand source code @@ -326,7 +447,8 @@

                Class variables

                keys: List[str] cursor: Optional[str]
                -

                Class variables

                +

                A response to a list-keys operation.

                +

                Instance variables

                var cursor : str | None
                @@ -398,7 +520,7 @@

                -

                Generated by pdoc 0.11.3.

                +

                Generated by pdoc 0.11.6.

                diff --git a/docs/v3/wit/index.html b/docs/v3/wit/index.html index f704375..f374d59 100644 --- a/docs/v3/wit/index.html +++ b/docs/v3/wit/index.html @@ -3,19 +3,30 @@ - + spin_sdk.wit API documentation - + @@ -51,11 +62,18 @@

                Sub-modules

                Classes

                -
                -class SpinAll +
                +class SpinSdkWit (*args, **kwargs)
                +
                + +Expand source code + +
                class SpinSdkWit(Protocol):
                +    pass
                +

                Base class for protocol classes.

                Protocol classes are defined as::

                class Proto(Protocol):
                @@ -82,13 +100,6 @@ 

                Classes

                def meth(self) -> T: ...
                -
                - -Expand source code - -
                class SpinAll(Protocol):
                -    pass
                -

                Ancestors

                • typing.Protocol
                • @@ -118,7 +129,7 @@

                  Ancestors

                • Classes

                • @@ -126,7 +137,7 @@

                  SpinAll diff --git a/docs/v3/wit/types.html b/docs/v3/wit/types.html index 4ddeb0d..be2f196 100644 --- a/docs/v3/wit/types.html +++ b/docs/v3/wit/types.html @@ -3,19 +3,30 @@ - + spin_sdk.wit.types API documentation - + @@ -40,7 +51,6 @@

                  Classes

                  (value: ~E)
                  -

                  Err(value: ~E)

                  Expand source code @@ -49,13 +59,14 @@

                  Classes

                  class Err(Generic[E], Exception): value: E
                  +

                  Err(value: ~E)

                  Ancestors

                  • typing.Generic
                  • builtins.Exception
                  • builtins.BaseException
                  -

                  Class variables

                  +

                  Instance variables

                  var value : ~E
                  @@ -68,7 +79,6 @@

                  Class variables

                  (value: ~T)
                  -

                  Ok(value: ~T)

                  Expand source code @@ -77,11 +87,12 @@

                  Class variables

                  class Ok(Generic[T]): value: T
                  +

                  Ok(value: ~T)

                  Ancestors

                  • typing.Generic
                  -

                  Class variables

                  +

                  Instance variables

                  var value : ~T
                  @@ -94,7 +105,6 @@

                  Class variables

                  (value: ~S)
                  -

                  Some(value: ~S)

                  Expand source code @@ -103,11 +113,12 @@

                  Class variables

                  class Some(Generic[S]): value: S
                  +

                  Some(value: ~S)

                  Ancestors

                  • typing.Generic
                  -

                  Class variables

                  +

                  Instance variables

                  var value : ~S
                  @@ -154,7 +165,7 @@

                  Som diff --git a/examples/external-lib-example/requirements.txt b/examples/external-lib-example/requirements.txt index b530200..dda20ab 100644 --- a/examples/external-lib-example/requirements.txt +++ b/examples/external-lib-example/requirements.txt @@ -1,3 +1,3 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 +spin-sdk == 3.4.1 +componentize-py == 0.17.2 http-router == 4.1.2 \ No newline at end of file diff --git a/examples/hello/README.md b/examples/hello/README.md index 4409ebe..612c814 100644 --- a/examples/hello/README.md +++ b/examples/hello/README.md @@ -26,6 +26,6 @@ spin build --up ## Testing the App ```bash -$ curl localhost:3000 +$ curl localhost:3000 Hello from Python! -``` \ No newline at end of file +``` diff --git a/examples/hello/requirements.txt b/examples/hello/requirements.txt index 3a89937..2738aef 100644 --- a/examples/hello/requirements.txt +++ b/examples/hello/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/matrix-math/requirements.txt b/examples/matrix-math/requirements.txt index 3a89937..2738aef 100644 --- a/examples/matrix-math/requirements.txt +++ b/examples/matrix-math/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/outgoing-request/requirements.txt b/examples/outgoing-request/requirements.txt index 3a89937..2738aef 100644 --- a/examples/outgoing-request/requirements.txt +++ b/examples/outgoing-request/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/redis-trigger/requirements.txt b/examples/redis-trigger/requirements.txt index 3a89937..2738aef 100644 --- a/examples/redis-trigger/requirements.txt +++ b/examples/redis-trigger/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/spin-kv/requirements.txt b/examples/spin-kv/requirements.txt index 3a89937..2738aef 100644 --- a/examples/spin-kv/requirements.txt +++ b/examples/spin-kv/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/spin-llm/requirements.txt b/examples/spin-llm/requirements.txt index 3a89937..2738aef 100644 --- a/examples/spin-llm/requirements.txt +++ b/examples/spin-llm/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/spin-mysql/requirements.txt b/examples/spin-mysql/requirements.txt index 3a89937..2738aef 100644 --- a/examples/spin-mysql/requirements.txt +++ b/examples/spin-mysql/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/spin-outbound-mqtt/requirements.txt b/examples/spin-outbound-mqtt/requirements.txt index 3a89937..2738aef 100644 --- a/examples/spin-outbound-mqtt/requirements.txt +++ b/examples/spin-outbound-mqtt/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/spin-postgres/requirements.txt b/examples/spin-postgres/requirements.txt index 3a89937..2738aef 100644 --- a/examples/spin-postgres/requirements.txt +++ b/examples/spin-postgres/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/spin-redis/requirements.txt b/examples/spin-redis/requirements.txt index 4bcdb6f..ab7cdf0 100644 --- a/examples/spin-redis/requirements.txt +++ b/examples/spin-redis/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 +spin-sdk == 3.4.1 +componentize-py == 0.17.2 diff --git a/examples/spin-sqlite/requirements.txt b/examples/spin-sqlite/requirements.txt index 3a89937..2738aef 100644 --- a/examples/spin-sqlite/requirements.txt +++ b/examples/spin-sqlite/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/spin-variables/requirements.txt b/examples/spin-variables/requirements.txt index 3a89937..2738aef 100644 --- a/examples/spin-variables/requirements.txt +++ b/examples/spin-variables/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/examples/streaming/requirements.txt b/examples/streaming/requirements.txt index 3a89937..2738aef 100644 --- a/examples/streaming/requirements.txt +++ b/examples/streaming/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 \ No newline at end of file +spin-sdk == 3.4.1 +componentize-py == 0.17.2 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 75fcc2a..2a0ff9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "spin-sdk" -version = "3.3.1" +version = "3.4.1" description = "Experimental SDK for Spin and Componentize-Py" readme = "README.md" license = { file = "LICENSE" } diff --git a/src/spin_sdk/wit/__init__.py b/src/spin_sdk/wit/__init__.py index 5bf4139..90406be 100644 --- a/src/spin_sdk/wit/__init__.py +++ b/src/spin_sdk/wit/__init__.py @@ -11,5 +11,5 @@ -class SpinAll(Protocol): +class SpinSdkWit(Protocol): pass diff --git a/src/spin_sdk/wit/deps/keyvalue-2024-10-17/atomic.wit b/src/spin_sdk/wit/deps/keyvalue-2024-10-17/atomic.wit index 2c3e0d0..4a02c58 100644 --- a/src/spin_sdk/wit/deps/keyvalue-2024-10-17/atomic.wit +++ b/src/spin_sdk/wit/deps/keyvalue-2024-10-17/atomic.wit @@ -13,22 +13,22 @@ interface atomics { /// The error returned by a CAS operation variant cas-error { - /// A store error occurred when performing the operation - store-error(error), + /// A store error occurred when performing the operation + store-error(error), /// The CAS operation failed because the value was too old. This returns a new CAS handle /// for easy retries. Implementors MUST return a CAS handle that has been updated to the /// latest version or transaction. - cas-failed(cas), + cas-failed(cas), } /// A handle to a CAS (compare-and-swap) operation. resource cas { - /// Construct a new CAS operation. Implementors can map the underlying functionality - /// (transactions, versions, etc) as desired. - new: static func(bucket: borrow, key: string) -> result; - /// Get the current value of the key (if it exists). This allows for avoiding reads if all - /// that is needed to ensure the atomicity of the operation - current: func() -> result>, error>; + /// Construct a new CAS operation. Implementors can map the underlying functionality + /// (transactions, versions, etc) as desired. + new: static func(bucket: borrow, key: string) -> result; + /// Get the current value of the key (if it exists). This allows for avoiding reads if all + /// that is needed to ensure the atomicity of the operation + current: func() -> result>, error>; } /// Atomically increment the value associated with the key in the store by the given delta. It diff --git a/src/spin_sdk/wit/deps/keyvalue-2024-10-17/world.wit b/src/spin_sdk/wit/deps/keyvalue-2024-10-17/world.wit index 64eb4e1..e8fb821 100644 --- a/src/spin_sdk/wit/deps/keyvalue-2024-10-17/world.wit +++ b/src/spin_sdk/wit/deps/keyvalue-2024-10-17/world.wit @@ -1,4 +1,4 @@ -package wasi: keyvalue@0.2.0-draft2; +package wasi:keyvalue@0.2.0-draft2; /// The `wasi:keyvalue/imports` world provides common APIs for interacting with key-value stores. /// Components targeting this world will be able to do: diff --git a/src/spin_sdk/wit/deps/spin-postgres@4.0.0/postgres.wit b/src/spin_sdk/wit/deps/spin-postgres@4.0.0/postgres.wit new file mode 100644 index 0000000..652703a --- /dev/null +++ b/src/spin_sdk/wit/deps/spin-postgres@4.0.0/postgres.wit @@ -0,0 +1,163 @@ +package spin:postgres@4.0.0; + +interface postgres { + /// Errors related to interacting with a database. + variant error { + connection-failed(string), + bad-parameter(string), + query-failed(query-error), + value-conversion-failed(string), + other(string) + } + + variant query-error { + /// An error occurred but we do not have structured info for it + text(string), + /// Postgres returned a structured database error + db-error(db-error), + } + + record db-error { + /// Stringised version of the error. This is primarily to facilitate migration of older code. + as-text: string, + severity: string, + code: string, + message: string, + detail: option, + /// Any error information provided by Postgres and not captured above. + extras: list>, + } + + /// Data types for a database column + variant db-data-type { + boolean, + int8, + int16, + int32, + int64, + floating32, + floating64, + str, + binary, + date, + time, + datetime, + timestamp, + uuid, + jsonb, + decimal, + range-int32, + range-int64, + range-decimal, + array-int32, + array-int64, + array-decimal, + array-str, + interval, + other(string), + } + + /// Database values + variant db-value { + boolean(bool), + int8(s8), + int16(s16), + int32(s32), + int64(s64), + floating32(f32), + floating64(f64), + str(string), + binary(list), + date(tuple), // (year, month, day) + time(tuple), // (hour, minute, second, nanosecond) + /// Date-time types are always treated as UTC (without timezone info). + /// The instant is represented as a (year, month, day, hour, minute, second, nanosecond) tuple. + datetime(tuple), + /// Unix timestamp (seconds since epoch) + timestamp(s64), + uuid(string), + jsonb(list), + decimal(string), // I admit defeat. Base 10 + range-int32(tuple>, option>>), + range-int64(tuple>, option>>), + range-decimal(tuple>, option>>), + array-int32(list>), + array-int64(list>), + array-decimal(list>), + array-str(list>), + interval(interval), + db-null, + unsupported(list), + } + + /// Values used in parameterized queries + variant parameter-value { + boolean(bool), + int8(s8), + int16(s16), + int32(s32), + int64(s64), + floating32(f32), + floating64(f64), + str(string), + binary(list), + date(tuple), // (year, month, day) + time(tuple), // (hour, minute, second, nanosecond) + /// Date-time types are always treated as UTC (without timezone info). + /// The instant is represented as a (year, month, day, hour, minute, second, nanosecond) tuple. + datetime(tuple), + /// Unix timestamp (seconds since epoch) + timestamp(s64), + uuid(string), + jsonb(list), + decimal(string), // base 10 + range-int32(tuple>, option>>), + range-int64(tuple>, option>>), + range-decimal(tuple>, option>>), + array-int32(list>), + array-int64(list>), + array-decimal(list>), + array-str(list>), + interval(interval), + db-null, + } + + record interval { + micros: s64, + days: s32, + months: s32, + } + + /// A database column + record column { + name: string, + data-type: db-data-type, + } + + /// A database row + type row = list; + + /// A set of database rows + record row-set { + columns: list, + rows: list, + } + + /// For range types, indicates if each bound is inclusive or exclusive + enum range-bound-kind { + inclusive, + exclusive, + } + + /// A connection to a postgres database. + resource connection { + /// Open a connection to the Postgres instance at `address`. + open: static func(address: string) -> result; + + /// Query the database. + query: func(statement: string, params: list) -> result; + + /// Execute command to the database. + execute: func(statement: string, params: list) -> result; + } +} diff --git a/src/spin_sdk/wit/deps/spin-sqlite@3.0.0/sqlite.wit b/src/spin_sdk/wit/deps/spin-sqlite@3.0.0/sqlite.wit new file mode 100644 index 0000000..6b41696 --- /dev/null +++ b/src/spin_sdk/wit/deps/spin-sqlite@3.0.0/sqlite.wit @@ -0,0 +1,60 @@ +package spin:sqlite@3.0.0; + +interface sqlite { + /// A handle to an open sqlite instance + resource connection { + /// Open a connection to a named database instance. + /// + /// If `database` is "default", the default instance is opened. + /// + /// `error::no-such-database` will be raised if the `name` is not recognized. + open: static func(database: string) -> result; + + /// Execute a statement returning back data if there is any + execute: func(statement: string, parameters: list) -> result; + + /// The SQLite rowid of the most recent successful INSERT on the connection, or 0 if + /// there has not yet been an INSERT on the connection. + last-insert-rowid: func() -> s64; + + /// The number of rows modified, inserted or deleted by the most recently completed + /// INSERT, UPDATE or DELETE statement on the connection. + changes: func() -> u64; + } + + /// The set of errors which may be raised by functions in this interface + variant error { + /// The host does not recognize the database name requested. + no-such-database, + /// The requesting component does not have access to the specified database (which may or may not exist). + access-denied, + /// The provided connection is not valid + invalid-connection, + /// The database has reached its capacity + database-full, + /// Some implementation-specific error has occurred (e.g. I/O) + io(string) + } + + /// A result of a query + record query-result { + /// The names of the columns retrieved in the query + columns: list, + /// the row results each containing the values for all the columns for a given row + rows: list, + } + + /// A set of values for each of the columns in a query-result + record row-result { + values: list + } + + /// A single column's result from a database query + variant value { + integer(s64), + real(f64), + text(string), + blob(list), + null + } +} diff --git a/src/spin_sdk/wit/imports/spin_postgres_postgres_4_0_0.py b/src/spin_sdk/wit/imports/spin_postgres_postgres_4_0_0.py new file mode 100644 index 0000000..76b24e7 --- /dev/null +++ b/src/spin_sdk/wit/imports/spin_postgres_postgres_4_0_0.py @@ -0,0 +1,534 @@ +from typing import TypeVar, Generic, Union, Optional, Protocol, Tuple, List, Any, Self +from types import TracebackType +from enum import Flag, Enum, auto +from dataclasses import dataclass +from abc import abstractmethod +import weakref + +from ..types import Result, Ok, Err, Some + + +@dataclass +class DbError: + as_text: str + severity: str + code: str + message: str + detail: Optional[str] + extras: List[Tuple[str, str]] + + +@dataclass +class QueryError_Text: + value: str + + +@dataclass +class QueryError_DbError: + value: DbError + + +QueryError = Union[QueryError_Text, QueryError_DbError] + + + +@dataclass +class Error_ConnectionFailed: + value: str + + +@dataclass +class Error_BadParameter: + value: str + + +@dataclass +class Error_QueryFailed: + value: QueryError + + +@dataclass +class Error_ValueConversionFailed: + value: str + + +@dataclass +class Error_Other: + value: str + + +Error = Union[Error_ConnectionFailed, Error_BadParameter, Error_QueryFailed, Error_ValueConversionFailed, Error_Other] +""" +Errors related to interacting with a database. +""" + + + +@dataclass +class DbDataType_Boolean: + pass + + +@dataclass +class DbDataType_Int8: + pass + + +@dataclass +class DbDataType_Int16: + pass + + +@dataclass +class DbDataType_Int32: + pass + + +@dataclass +class DbDataType_Int64: + pass + + +@dataclass +class DbDataType_Floating32: + pass + + +@dataclass +class DbDataType_Floating64: + pass + + +@dataclass +class DbDataType_Str: + pass + + +@dataclass +class DbDataType_Binary: + pass + + +@dataclass +class DbDataType_Date: + pass + + +@dataclass +class DbDataType_Time: + pass + + +@dataclass +class DbDataType_Datetime: + pass + + +@dataclass +class DbDataType_Timestamp: + pass + + +@dataclass +class DbDataType_Uuid: + pass + + +@dataclass +class DbDataType_Jsonb: + pass + + +@dataclass +class DbDataType_Decimal: + pass + + +@dataclass +class DbDataType_RangeInt32: + pass + + +@dataclass +class DbDataType_RangeInt64: + pass + + +@dataclass +class DbDataType_RangeDecimal: + pass + + +@dataclass +class DbDataType_ArrayInt32: + pass + + +@dataclass +class DbDataType_ArrayInt64: + pass + + +@dataclass +class DbDataType_ArrayDecimal: + pass + + +@dataclass +class DbDataType_ArrayStr: + pass + + +@dataclass +class DbDataType_Interval: + pass + + +@dataclass +class DbDataType_Other: + value: str + + +DbDataType = Union[DbDataType_Boolean, DbDataType_Int8, DbDataType_Int16, DbDataType_Int32, DbDataType_Int64, DbDataType_Floating32, DbDataType_Floating64, DbDataType_Str, DbDataType_Binary, DbDataType_Date, DbDataType_Time, DbDataType_Datetime, DbDataType_Timestamp, DbDataType_Uuid, DbDataType_Jsonb, DbDataType_Decimal, DbDataType_RangeInt32, DbDataType_RangeInt64, DbDataType_RangeDecimal, DbDataType_ArrayInt32, DbDataType_ArrayInt64, DbDataType_ArrayDecimal, DbDataType_ArrayStr, DbDataType_Interval, DbDataType_Other] +""" +Data types for a database column +""" + + +@dataclass +class Interval: + micros: int + days: int + months: int + +@dataclass +class Column: + """ + A database column + """ + name: str + data_type: DbDataType + +class RangeBoundKind(Enum): + """ + For range types, indicates if each bound is inclusive or exclusive + """ + INCLUSIVE = 0 + EXCLUSIVE = 1 + + +@dataclass +class DbValue_Boolean: + value: bool + + +@dataclass +class DbValue_Int8: + value: int + + +@dataclass +class DbValue_Int16: + value: int + + +@dataclass +class DbValue_Int32: + value: int + + +@dataclass +class DbValue_Int64: + value: int + + +@dataclass +class DbValue_Floating32: + value: float + + +@dataclass +class DbValue_Floating64: + value: float + + +@dataclass +class DbValue_Str: + value: str + + +@dataclass +class DbValue_Binary: + value: bytes + + +@dataclass +class DbValue_Date: + value: Tuple[int, int, int] + + +@dataclass +class DbValue_Time: + value: Tuple[int, int, int, int] + + +@dataclass +class DbValue_Datetime: + value: Tuple[int, int, int, int, int, int, int] + + +@dataclass +class DbValue_Timestamp: + value: int + + +@dataclass +class DbValue_Uuid: + value: str + + +@dataclass +class DbValue_Jsonb: + value: bytes + + +@dataclass +class DbValue_Decimal: + value: str + + +@dataclass +class DbValue_RangeInt32: + value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]] + + +@dataclass +class DbValue_RangeInt64: + value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]] + + +@dataclass +class DbValue_RangeDecimal: + value: Tuple[Optional[Tuple[str, RangeBoundKind]], Optional[Tuple[str, RangeBoundKind]]] + + +@dataclass +class DbValue_ArrayInt32: + value: List[Optional[int]] + + +@dataclass +class DbValue_ArrayInt64: + value: List[Optional[int]] + + +@dataclass +class DbValue_ArrayDecimal: + value: List[Optional[str]] + + +@dataclass +class DbValue_ArrayStr: + value: List[Optional[str]] + + +@dataclass +class DbValue_Interval: + value: Interval + + +@dataclass +class DbValue_DbNull: + pass + + +@dataclass +class DbValue_Unsupported: + value: bytes + + +DbValue = Union[DbValue_Boolean, DbValue_Int8, DbValue_Int16, DbValue_Int32, DbValue_Int64, DbValue_Floating32, DbValue_Floating64, DbValue_Str, DbValue_Binary, DbValue_Date, DbValue_Time, DbValue_Datetime, DbValue_Timestamp, DbValue_Uuid, DbValue_Jsonb, DbValue_Decimal, DbValue_RangeInt32, DbValue_RangeInt64, DbValue_RangeDecimal, DbValue_ArrayInt32, DbValue_ArrayInt64, DbValue_ArrayDecimal, DbValue_ArrayStr, DbValue_Interval, DbValue_DbNull, DbValue_Unsupported] +""" +Database values +""" + + + +@dataclass +class ParameterValue_Boolean: + value: bool + + +@dataclass +class ParameterValue_Int8: + value: int + + +@dataclass +class ParameterValue_Int16: + value: int + + +@dataclass +class ParameterValue_Int32: + value: int + + +@dataclass +class ParameterValue_Int64: + value: int + + +@dataclass +class ParameterValue_Floating32: + value: float + + +@dataclass +class ParameterValue_Floating64: + value: float + + +@dataclass +class ParameterValue_Str: + value: str + + +@dataclass +class ParameterValue_Binary: + value: bytes + + +@dataclass +class ParameterValue_Date: + value: Tuple[int, int, int] + + +@dataclass +class ParameterValue_Time: + value: Tuple[int, int, int, int] + + +@dataclass +class ParameterValue_Datetime: + value: Tuple[int, int, int, int, int, int, int] + + +@dataclass +class ParameterValue_Timestamp: + value: int + + +@dataclass +class ParameterValue_Uuid: + value: str + + +@dataclass +class ParameterValue_Jsonb: + value: bytes + + +@dataclass +class ParameterValue_Decimal: + value: str + + +@dataclass +class ParameterValue_RangeInt32: + value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]] + + +@dataclass +class ParameterValue_RangeInt64: + value: Tuple[Optional[Tuple[int, RangeBoundKind]], Optional[Tuple[int, RangeBoundKind]]] + + +@dataclass +class ParameterValue_RangeDecimal: + value: Tuple[Optional[Tuple[str, RangeBoundKind]], Optional[Tuple[str, RangeBoundKind]]] + + +@dataclass +class ParameterValue_ArrayInt32: + value: List[Optional[int]] + + +@dataclass +class ParameterValue_ArrayInt64: + value: List[Optional[int]] + + +@dataclass +class ParameterValue_ArrayDecimal: + value: List[Optional[str]] + + +@dataclass +class ParameterValue_ArrayStr: + value: List[Optional[str]] + + +@dataclass +class ParameterValue_Interval: + value: Interval + + +@dataclass +class ParameterValue_DbNull: + pass + + +ParameterValue = Union[ParameterValue_Boolean, ParameterValue_Int8, ParameterValue_Int16, ParameterValue_Int32, ParameterValue_Int64, ParameterValue_Floating32, ParameterValue_Floating64, ParameterValue_Str, ParameterValue_Binary, ParameterValue_Date, ParameterValue_Time, ParameterValue_Datetime, ParameterValue_Timestamp, ParameterValue_Uuid, ParameterValue_Jsonb, ParameterValue_Decimal, ParameterValue_RangeInt32, ParameterValue_RangeInt64, ParameterValue_RangeDecimal, ParameterValue_ArrayInt32, ParameterValue_ArrayInt64, ParameterValue_ArrayDecimal, ParameterValue_ArrayStr, ParameterValue_Interval, ParameterValue_DbNull] +""" +Values used in parameterized queries +""" + + +@dataclass +class RowSet: + """ + A set of database rows + """ + columns: List[Column] + rows: List[List[DbValue]] + +class Connection: + """ + A connection to a postgres database. + """ + + @classmethod + def open(cls, address: str) -> Self: + """ + Open a connection to the Postgres instance at `address`. + + Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)` + """ + raise NotImplementedError + def query(self, statement: str, params: List[ParameterValue]) -> RowSet: + """ + Query the database. + + Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)` + """ + raise NotImplementedError + def execute(self, statement: str, params: List[ParameterValue]) -> int: + """ + Execute command to the database. + + Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_postgres_postgres_4_0_0.Error)` + """ + raise NotImplementedError + def __enter__(self) -> Self: + """Returns self""" + return self + + def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None: + """ + Release this resource. + """ + raise NotImplementedError + + + diff --git a/src/spin_sdk/wit/imports/spin_sqlite_sqlite.py b/src/spin_sdk/wit/imports/spin_sqlite_sqlite.py new file mode 100644 index 0000000..446a270 --- /dev/null +++ b/src/spin_sdk/wit/imports/spin_sqlite_sqlite.py @@ -0,0 +1,137 @@ +from typing import TypeVar, Generic, Union, Optional, Protocol, Tuple, List, Any, Self +from types import TracebackType +from enum import Flag, Enum, auto +from dataclasses import dataclass +from abc import abstractmethod +import weakref + +from ..types import Result, Ok, Err, Some + + + +@dataclass +class Error_NoSuchDatabase: + pass + + +@dataclass +class Error_AccessDenied: + pass + + +@dataclass +class Error_InvalidConnection: + pass + + +@dataclass +class Error_DatabaseFull: + pass + + +@dataclass +class Error_Io: + value: str + + +Error = Union[Error_NoSuchDatabase, Error_AccessDenied, Error_InvalidConnection, Error_DatabaseFull, Error_Io] +""" +The set of errors which may be raised by functions in this interface +""" + + + +@dataclass +class Value_Integer: + value: int + + +@dataclass +class Value_Real: + value: float + + +@dataclass +class Value_Text: + value: str + + +@dataclass +class Value_Blob: + value: bytes + + +@dataclass +class Value_Null: + pass + + +Value = Union[Value_Integer, Value_Real, Value_Text, Value_Blob, Value_Null] +""" +A single column's result from a database query +""" + + +@dataclass +class RowResult: + """ + A set of values for each of the columns in a query-result + """ + values: List[Value] + +@dataclass +class QueryResult: + """ + A result of a query + """ + columns: List[str] + rows: List[RowResult] + +class Connection: + """ + A handle to an open sqlite instance + """ + + @classmethod + def open(cls, database: str) -> Self: + """ + Open a connection to a named database instance. + + If `database` is "default", the default instance is opened. + + `error::no-such-database` will be raised if the `name` is not recognized. + + Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite.Error)` + """ + raise NotImplementedError + def execute(self, statement: str, parameters: List[Value]) -> QueryResult: + """ + Execute a statement returning back data if there is any + + Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.spin_sqlite_sqlite.Error)` + """ + raise NotImplementedError + def last_insert_rowid(self) -> int: + """ + The SQLite rowid of the most recent successful INSERT on the connection, or 0 if + there has not yet been an INSERT on the connection. + """ + raise NotImplementedError + def changes(self) -> int: + """ + The number of rows modified, inserted or deleted by the most recently completed + INSERT, UPDATE or DELETE statement on the connection. + """ + raise NotImplementedError + def __enter__(self) -> Self: + """Returns self""" + return self + + def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None: + """ + Release this resource. + """ + raise NotImplementedError + + + diff --git a/src/spin_sdk/wit/imports/streams.py b/src/spin_sdk/wit/imports/streams.py index 9405b63..2347a31 100644 --- a/src/spin_sdk/wit/imports/streams.py +++ b/src/spin_sdk/wit/imports/streams.py @@ -182,13 +182,13 @@ def blocking_write_and_flush(self, contents: bytes) -> None: ```text let pollable = this.subscribe(); while !contents.is_empty() { - // Wait for the stream to become writable - pollable.block(); - let Ok(n) = this.check-write(); // eliding error handling - let len = min(n, contents.len()); - let (chunk, rest) = contents.split_at(len); - this.write(chunk ); // eliding error handling - contents = rest; + // Wait for the stream to become writable + pollable.block(); + let Ok(n) = this.check-write(); // eliding error handling + let len = min(n, contents.len()); + let (chunk, rest) = contents.split_at(len); + this.write(chunk ); // eliding error handling + contents = rest; } this.flush(); // Wait for completion of `flush` @@ -263,12 +263,12 @@ def blocking_write_zeroes_and_flush(self, len: int) -> None: ```text let pollable = this.subscribe(); while num_zeroes != 0 { - // Wait for the stream to become writable - pollable.block(); - let Ok(n) = this.check-write(); // eliding error handling - let len = min(n, num_zeroes); - this.write-zeroes(len); // eliding error handling - num_zeroes -= len; + // Wait for the stream to become writable + pollable.block(); + let Ok(n) = this.check-write(); // eliding error handling + let len = min(n, num_zeroes); + this.write-zeroes(len); // eliding error handling + num_zeroes -= len; } this.flush(); // Wait for completion of `flush` diff --git a/src/spin_sdk/wit/imports/types.py b/src/spin_sdk/wit/imports/types.py index 2495d15..9702cdf 100644 --- a/src/spin_sdk/wit/imports/types.py +++ b/src/spin_sdk/wit/imports/types.py @@ -317,7 +317,7 @@ class ErrorCode_InternalError: ErrorCode = Union[ErrorCode_DnsTimeout, ErrorCode_DnsError, ErrorCode_DestinationNotFound, ErrorCode_DestinationUnavailable, ErrorCode_DestinationIpProhibited, ErrorCode_DestinationIpUnroutable, ErrorCode_ConnectionRefused, ErrorCode_ConnectionTerminated, ErrorCode_ConnectionTimeout, ErrorCode_ConnectionReadTimeout, ErrorCode_ConnectionWriteTimeout, ErrorCode_ConnectionLimitReached, ErrorCode_TlsProtocolError, ErrorCode_TlsCertificateError, ErrorCode_TlsAlertReceived, ErrorCode_HttpRequestDenied, ErrorCode_HttpRequestLengthRequired, ErrorCode_HttpRequestBodySize, ErrorCode_HttpRequestMethodInvalid, ErrorCode_HttpRequestUriInvalid, ErrorCode_HttpRequestUriTooLong, ErrorCode_HttpRequestHeaderSectionSize, ErrorCode_HttpRequestHeaderSize, ErrorCode_HttpRequestTrailerSectionSize, ErrorCode_HttpRequestTrailerSize, ErrorCode_HttpResponseIncomplete, ErrorCode_HttpResponseHeaderSectionSize, ErrorCode_HttpResponseHeaderSize, ErrorCode_HttpResponseBodySize, ErrorCode_HttpResponseTrailerSectionSize, ErrorCode_HttpResponseTrailerSize, ErrorCode_HttpResponseTransferCoding, ErrorCode_HttpResponseContentCoding, ErrorCode_HttpResponseTimeout, ErrorCode_HttpUpgradeFailed, ErrorCode_HttpProtocolError, ErrorCode_LoopDetected, ErrorCode_ConfigurationError, ErrorCode_InternalError] """ These cases are inspired by the IANA HTTP Proxy Error Types: -https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types + https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types """ diff --git a/src/spin_sdk/wit/spin.wit b/src/spin_sdk/wit/spin.wit index 79d678b..206f4dd 100644 --- a/src/spin_sdk/wit/spin.wit +++ b/src/spin_sdk/wit/spin.wit @@ -1,7 +1,12 @@ package fermyon:spin@2.0.0; world spin-imports { + include wasi:keyvalue/imports@0.2.0-draft2; import wasi:http/outgoing-handler@0.2.0; + import wasi:config/store@0.2.0-draft-2024-09-27; + import spin:postgres/postgres@3.0.0; + import spin:postgres/postgres@4.0.0; + import spin:sqlite/sqlite@3.0.0; import llm; import redis; import postgres; diff --git a/templates/http-py/content/requirements.txt b/templates/http-py/content/requirements.txt index 4bcdb6f..ab7cdf0 100644 --- a/templates/http-py/content/requirements.txt +++ b/templates/http-py/content/requirements.txt @@ -1,2 +1,2 @@ -spin-sdk == 3.3.1 -componentize-py == 0.16.0 +spin-sdk == 3.4.1 +componentize-py == 0.17.2