pub struct Create;
Expand description
TODO: update these docs. Out of date. Create a player session from a jig. Requestor needs permissions over the jig.
§Flow
- Author/admin creates a player session using
POST /v1/jig/player
- This is represented by a session code/index
- Unauthed user instantiates the player session. This creates an instance of a session.
POST /v1/jig/player/session
returns:- A short lived token, which identifies the guest user and the session instance.
- The player session settings.
JigId
of the JIG on which the session was created.
- Unauthed user posts short lived token to complete the instance.
POST /v1/jig/player/session/complete
- This increments the play count of the jig.
- Deletes the completed instance from the DB.
The hierarchy here is Jig -> Player Session -> Session Instance, where each arrow is a one-to-many mapping.
Each level is uniquely identified by JigId
-> JigCode
-> token.
§Errors
400 - BadRequest
if the request is malformed.401 - Unauthorized
if authorization is not valid.403 - Forbidden
if the user does not have sufficient permission to perform the action.- ‘404 - NotFound’ if the jig does not exist.
- ‘409 - Conflict’ if a code already exists for this jig.
503 - ServiceUnavailable
if some how we have reached the maximum number of possible session codes.
§Note
The code is computed with the following procedure:
- Generate a random code in the range 0..MAX
Trait Implementations§
Source§impl ApiEndpoint for Create
impl ApiEndpoint for Create
Source§type Path = JigPlayerSessionCreatePath
type Path = JigPlayerSessionCreatePath
The path type for this endpoint.
Source§type Req = JigPlayerSessionCreateRequest
type Req = JigPlayerSessionCreateRequest
The request type for this endpoint.
Source§type Res = JigPlayerSessionCreateResponse
type Res = JigPlayerSessionCreateResponse
The response type for this endpoint.
Source§type Err = EmptyError
type Err = EmptyError
The (inner) error type for this endpoint.
Auto Trait Implementations§
impl Freeze for Create
impl RefUnwindSafe for Create
impl Send for Create
impl Sync for Create
impl Unpin for Create
impl UnwindSafe for Create
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more