cattle_grid.account.server¶
cattle_grid.account.server ¶
signin
async
¶
signin(
data: SignInData, session: CommittingSession
) -> TokenResponse
Allows one to sign in to an account on cattle_grid. The response a token to be included using bearer authentication.
Source code in cattle_grid/account/server/__init__.py
account ¶
create_actor_method
async
¶
create_actor_method(
body: CreateActorRequest,
account: CurrentAccount,
session: CommittingSession,
)
Allows one to create a new actor. The allowed values for base_url can be retrieved using the info endpoint.
Source code in cattle_grid/account/server/account.py
event_history
async
¶
event_history(
account: CurrentAccount,
start_from: str,
session: SqlSession,
) -> EventHistoryResponse
Not implemented yet
Source code in cattle_grid/account/server/account.py
return_account_information
async
¶
return_account_information(
account: CurrentAccount,
method_information: MethodInformation,
session: SqlSession,
) -> InformationResponse
Returns information about the server and the account.
Source code in cattle_grid/account/server/account.py
stream
async
¶
stream(
event_type: EventType,
account: CurrentAccount,
request: Request,
stream_messages=Depends(get_message_streamer),
)
EventSource corresponding to all messages received by the account.
This method returns an EventSource providing server sent events.
Source code in cattle_grid/account/server/account.py
actor ¶
lookup
async
¶
lookup(
body: LookupRequest,
account: CurrentAccount,
requester: ActivityExchangeRequester,
session: SqlSession,
) -> dict
Looks up the resource given by uri as the actor with
actor id actor_id. Here looking up the actor means that
the request is signed using a private key belonging to that actor.
Source code in cattle_grid/account/server/actor.py
trigger_action
async
¶
trigger_action(
method: str,
body: PerformRequest,
account: CurrentAccount,
publisher: ActivityExchangePublisher,
session: SqlSession,
)
This method allows one to trigger asynchronous activities through a synchronous request. The basic result is that the data is posted to the ActivityExchange with the routing_key specified.
Source code in cattle_grid/account/server/actor.py
app ¶
Helper class to create documentation for the API
dependencies ¶
responses ¶
CreateActorRequest ¶
Bases: BaseModel
Used to create an actor for the account
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
Base url of the actor. The actor URI will be
of the form |
required |
handle
|
str | None
|
If present, an acct-uri of the form |
None
|
name
|
str | None
|
Internal name of the actor. Used to simplify display of the actor. |
None
|
Source code in cattle_grid/account/server/responses.py
EventHistoryResponse ¶
LookupRequest ¶
LookupResponse ¶
PerformRequest ¶
SignInData ¶
testing ¶
actor_with_account
async
¶
actor_with_account(sql_session, account_for_test) -> Actor
Fixture to create an actor with an account
Source code in cattle_grid/testing/fixtures.py
loaded_config ¶
sql_engine_for_tests
async
¶
Provides the sql engine (as in memory sqlite) for tests
This fixture has autouse=True, meaning that by importing
it will run automatically. The engine is initialized in the place cattle_grid expects it.
Source code in cattle_grid/testing/fixtures.py
sql_session
async
¶
Returns an AsyncSession to be used by tests