Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structural output - LoginGoogleAccount #1866

Closed
jan-goral opened this issue Apr 26, 2021 · 1 comment · Fixed by #2106
Closed

Structural output - LoginGoogleAccount #1866

jan-goral opened this issue Apr 26, 2021 · 1 comment · Fixed by #2106

Comments

@jan-goral
Copy link
Contributor

jan-goral commented Apr 26, 2021

Plan

According to the description of epic #1728, prepare a specification document for the structural output based on the following requirements:

  • Identify all places that are producing console logs and list them in the specification.
  • Specify dedicated types and structures for logs with places (packages and namespaces) for them.
  • Specify proposition how to pass out function reference to low-level functions that producing logs.

Make sure that specification is sufficient to implement structured output without a doubt.

Command

LoginGoogleAccount

@piotradamczyk5
Copy link
Contributor

piotradamczyk5 commented Jul 26, 2021

Places which produce output logs

  1. Printing URL to loginUserAuth#L92-93

    logLn("Visit the following URL in your browser:")
    logLn(url)

    `

  2. User token saved ftl.client.google.UserAuth#L118-119

    logLn()
    logLn("User token saved to $userToken")

Structures for messages

sealed interface LoginState {
    data class LoginStarted(val url: String) : LoginState
    data class LoginFinished(val tokenLocation: String) : LoginState
}

Proposition of passing out function

  • UserAuth#requestmethod will return Flow<LoginState>

  • api contract will be changed
    from

    object UserAuthorization {
        interface Request : () -> Unit
    }

    to

    object UserAuthorization {
        interface Request : () -> Flow<LoginState>
    }
  • LoginGoogleAcount#invoke will observe new flow and pass all collected LoginStateto out() function

  • LoginCommandwill be responsible for printing correct message based on the LoginState

@mergify mergify bot closed this as completed in #2106 Jul 28, 2021
mergify bot pushed a commit that referenced this issue Jul 28, 2021
Fixes #1866

## Test Plan
> How do we know the code works?

All outputs logs and behavior of command `flank auth login` works like previously
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants