Account object describes an account on Latch. An Account can be instantiated either using the class method Account.current() (recommended), or directly using its ID.
Account.current(), the returned Account object is different depending on the context in which it is run:
- When running in an execution, the returned
Accountcorresponds to the workspace in which the execution was run. This means that if User A runs an execution in Workspace B, the returnedAccountis for Team B. - When running inside a Pod or Plot notebooik, the returned
Accountcorresponds to the workspace in which the Pod or Plot notebook lives. - When running outside of an execution, in e.g.
latch develop, the returnedAccountcorresponds to the setting oflatch workspaceat calling time, defaulting to the user if no setting is found.
Accounts are lazy, in that they don’t perform any network requests without an explicit call to Account.load() or to a property getter.
Instance Methods
The only non-getter method on anAccount is Account.load(). This method, if called, will perform a network request and cache values for each of the Account’s properties.
Property Getters
All property getters have an optionalload_if_missing boolean argument which, if True, will call Account.load() if the requested property has not been loaded already. This defaults to True.
Account.list_registry_projects()will return a list ofProjectobjects, each correspondng to a project within the callingAccount.
Outputs
Updater
AAccount can be modified by using the Account.update() function. Account.update() returns a context manager (and hence must be called using with syntax) with the following methods:
upsert_project(name: str)will create a project with namename.
delete_project(id: str)will delete the project with idid. If no such project exists, the method call will be a noop.