spotless/device_code/device_authorization

Types

pub type ErrorResponse {
  ErrorResponse(
    error: String,
    error_description: option.Option(String),
  )
}

Constructors

  • ErrorResponse(
      error: String,
      error_description: option.Option(String),
    )
pub type Fail {
  InvalidRequest
  InvalidClient
  InvalidScope
}

Constructors

  • InvalidRequest
  • InvalidClient
  • InvalidScope

This is a device authorization request, which is structurally different and at a different endpoint to authorization request.

pub type Request {
  Request(client_id: String, scope: List(String))
}

Constructors

  • Request(client_id: String, scope: List(String))
pub type Response {
  Response(
    device_code: String,
    user_code: String,
    verification_uri: String,
    verification_uri_complete: option.Option(String),
    expires_in: Int,
    interval: option.Option(Int),
  )
}

Constructors

  • Response(
      device_code: String,
      user_code: String,
      verification_uri: String,
      verification_uri_complete: option.Option(String),
      expires_in: Int,
      interval: option.Option(Int),
    )

Values

pub fn error_code_to_string(code: Fail) -> String
pub fn request_from_http(
  request: request.Request(BitArray),
) -> Result(Request, #(Fail, String))
pub fn request_from_params(
  params: List(#(String, String)),
) -> Result(Request, #(Fail, String))
pub fn request_to_http(
  endpoint: #(origin.Origin, String),
  device_request: Request,
) -> request.Request(BitArray)
pub fn response_from_http(
  response: response.Response(BitArray),
) -> Result(Result(Response, ErrorResponse), json.DecodeError)
pub fn response_to_body(response: Response) -> String
pub fn response_to_http(
  response: Response,
) -> response.Response(BitArray)
Search Document