From 144d51b147255a01a7fb2532163d42ffcdc6593b Mon Sep 17 00:00:00 2001 From: izzy lyseggen Date: Thu, 22 Jul 2021 09:27:32 +0100 Subject: [PATCH] docs(client): add dosctring to the `SpeckleClient` as alan noted, the default one is garbo lol hopefully this will make it clearer for users --- specklepy/api/client.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/specklepy/api/client.py b/specklepy/api/client.py index e87a5af..2ce38b4 100644 --- a/specklepy/api/client.py +++ b/specklepy/api/client.py @@ -21,6 +21,33 @@ from gql.transport.websockets import WebsocketsTransport class SpeckleClient: + """ + The `SpeckleClient` is your entry point for interacting with your Speckle Server's GraphQL API. + You'll need to have access to a server to use it, or you can use our public server `speckle.xyz`. + + To authenticate the client, you'll need to have downloaded the [Speckle Manager](https://speckle.guide/#speckle-manager) + and added your account. + + ```py + from specklepy.api.client import SpeckleClient + from specklepy.api.credentials import get_default_account + + # initialise the client + client = SpeckleClient(host="speckle.xyz") # or whatever your host is + # client = SpeckleClient(host="localhost:3000", use_ssl=False) or use local server + + # authenticate the client with a token (account has been added in Speckle Manager) + account = get_default_account() + client.authenticate(token=account.token) + + # create a new stream. this returns the stream id + new_stream_id = client.stream.create(name="a shiny new stream") + + # use that stream id to get the stream from the server + new_stream = client.stream.get(id=new_stream_id) + ``` + """ + DEFAULT_HOST = "speckle.xyz" USE_SSL = True