View Source StarkBank.Workspace (starkbankpublish v0.0.1)
Groups Workspace related functions
Summary
Functions
Workspaces are bank accounts. They have independent balances, statements, operations and permissions. The only property that is shared between your workspaces is that they are linked to your organization, which carries your basic informations, such as tax ID, name, etc.
Send a single Workspace for creation in the Stark Bank API
Same as create(), but it will unwrap the error tuple and raise in case of errors.
Receive a single Workspace struct previously created in the Stark Bank API by passing its id
Same as get(), but it will unwrap the error tuple and raise in case of errors.
Receive a list of up to 100 Workspace objects previously created in the Stark Bank API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
Same as page(), but it will unwrap the error tuple and raise in case of errors.
Receive a stream of Workspace structs previously created in the Stark Bank API
Same as query(), but it will unwrap the error tuple and raise in case of errors.
Update a Workspace by passing its ID.
Same as update(), but it will unwrap the error tuple and raise in case of errors.
Types
Functions
Workspaces are bank accounts. They have independent balances, statements, operations and permissions. The only property that is shared between your workspaces is that they are linked to your organization, which carries your basic informations, such as tax ID, name, etc.
Parameters (required):
:username
[string]: Simplified name to define the workspace URL. This name must be unique across all Stark Bank Workspaces. Ex: "starkbankworkspace":name
[string]: Full name that identifies the Workspace. This name will appear when people access the Workspace on our platform, for example. Ex: "Stark Bank Workspace"
Parameters (optional):
:allowed_tax_ids
[list of strings, default []]: list of tax IDs that will be allowed to send Deposits to this Workspace. If empty, all are allowed. ex: ["012.345.678-90", "20.018.183/0001-80"]
Attributes (return-only):
:id
[string, default nil]: unique id returned when the workspace is created. ex: "5656565656565656"
@spec create( user: StarkBank.User.Organization.t() | nil, username: binary(), name: binary(), allowed_tax_ids: [binary()] ) :: {:ok, t()} | {:error, [StarkBank.Error.t()]}
Send a single Workspace for creation in the Stark Bank API
Parameters (required):
:username
[string]: Simplified name to define the workspace URL. This name must be unique across all Stark Bank Workspaces. Ex: "starkbankworkspace":name
[string]: Full name that identifies the Workspace. This name will appear when people access the Workspace on our platform, for example. Ex: "Stark Bank Workspace"
Options:
:user
[Organization]: Organization struct with nil workspace_id. Only necessary if default organization has not been set in configs.
Return:
- Workspace struct with updated attributes
@spec create!( user: StarkBank.User.Organization.t() | nil, username: binary(), name: binary(), allowed_tax_ids: [binary()] ) :: any()
Same as create(), but it will unwrap the error tuple and raise in case of errors.
@spec get(binary(), [ {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil} ]) :: {:ok, t()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Receive a single Workspace struct previously created in the Stark Bank API by passing its id
Parameters (required):
id
[string]: struct unique id. ex: "5656565656565656"
Options:
:user
[Organization/Project, default nil]: Organization or Project struct. Only necessary if default project or organization has not been set in configs.
Return:
- Workspace struct with updated attributes
@spec get!(binary(), [ {:user, StarkBank.User.Project.t() | StarkBank.User.Organization.t() | nil} ]) :: t()
Same as get(), but it will unwrap the error tuple and raise in case of errors.
@spec page( cursor: binary(), limit: integer(), username: binary(), ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: {:ok, {binary(), [t()]}} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Receive a list of up to 100 Workspace objects previously created in the Stark Bank API and the cursor to the next page. Use this function instead of query if you want to manually page your requests.
Options:
:cursor
[string, default nil]: cursor returned on the previous page function call:limit
[integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35:username
[string]: query by the simplified name that defines the workspace URL. This name is always unique across all Stark Bank Workspaces. Ex: "starkbankworkspace":ids
[list of strings, default nil]: list of ids to filter retrieved structs. ex: ["5656565656565656", "4545454545454545"]:user
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- list of Workspace structs with updated attributes and cursor to retrieve the next page of Workspace objects
@spec page!( cursor: binary(), limit: integer(), username: binary(), ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: [t()]
Same as page(), but it will unwrap the error tuple and raise in case of errors.
@spec query( limit: integer(), username: binary(), ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: ({:cont, {:ok, [t()]}} | {:error, [StarkBank.Error.t()]} | {:halt, any()} | {:suspend, any()}, any() -> any())
Receive a stream of Workspace structs previously created in the Stark Bank API
Options:
:limit
[integer, default nil]: maximum number of structs to be retrieved. Unlimited if nil. ex: 35:username
[string]: query by the simplified name that defines the workspace URL. This name is always unique across all Stark Bank Workspaces. Ex: "starkbankworkspace":ids
[list of strings, default nil]: list of ids to filter retrieved structs. ex: ["5656565656565656", "4545454545454545"]:user
[Project]: Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- stream of Workspace structs with updated attributes
@spec query!( limit: integer(), username: binary(), ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: ({:cont, [t()]} | {:halt, any()} | {:suspend, any()}, any() -> any())
Same as query(), but it will unwrap the error tuple and raise in case of errors.
@spec update(binary(), username: binary(), name: binary(), allowed_tax_ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: {:ok, t()} | {:error, [%StarkBank.Error{code: term(), message: term()}]}
Update a Workspace by passing its ID.
Parameters (required):
:id
[string]: Invoice id. ex: '5656565656565656'
Parameters (optional):
:username
[string, default nil]: Simplified name to define the workspace URL. This name must be unique across all Stark Bank Workspaces. Ex: "starkbank-workspace":name
[string, default nil]: Full name that identifies the Workspace. This name will appear when people access the Workspace on our platform, for example. Ex: "Stark Bank Workspace":allowed_tax_ids
[list of strings, default nil]: list of tax IDs that will be allowed to send Deposits to this Workspace. If empty, all are allowed. ex: ["012.345.678-90", "20.018.183/0001-80"]:user
[Organization/Project, default nil]: Organization or Project struct returned from StarkBank.project(). Only necessary if default project or organization has not been set in configs.
Return:
- target Workspace with updated attributes
@spec update!(binary(), username: binary(), name: binary(), allowed_tax_ids: [binary()], user: StarkBank.User.Project.t() | StarkBank.User.Organization.t() ) :: t()
Same as update(), but it will unwrap the error tuple and raise in case of errors.