-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add doc
- Loading branch information
Showing
8 changed files
with
33 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
github4s/src/main/scala/github4s/algebras/AccessToken.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package github4s.algebras | ||
|
||
import github4s.GHResponse | ||
|
||
/** | ||
* Source of static or expiring github tokens | ||
* | ||
* For github app authentication you'd want to create a token source | ||
* which calls github's installation authentication api with a jwt token, generated from a private key | ||
* These tokens have a 1h lifetime, so it's a good idea to handle expired tokens here as well | ||
* | ||
* @see https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps | ||
*/ | ||
trait AccessToken[F[_]] { | ||
|
||
def withAccessToken[T](f: Option[String] => F[GHResponse[T]]): F[GHResponse[T]] | ||
} |
13 changes: 0 additions & 13 deletions
13
github4s/src/main/scala/github4s/algebras/AccessTokens.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...b4s/interpreters/StaticAccessTokens.scala → ...ub4s/interpreters/StaticAccessToken.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
package github4s.interpreters | ||
|
||
import github4s.GHResponse | ||
import github4s.algebras.AccessTokens | ||
import github4s.algebras.AccessToken | ||
|
||
/** | ||
* A simple static version | ||
*/ | ||
class StaticAccessTokens[F[_]](accessToken: Option[String]) extends AccessTokens[F] { | ||
class StaticAccessToken[F[_]](accessToken: Option[String]) extends AccessToken[F] { | ||
|
||
override def withAccessToken[T](f: Option[String] => F[GHResponse[T]]): F[GHResponse[T]] = | ||
f(accessToken) | ||
} | ||
|
||
object StaticAccessTokens { | ||
def noToken[F[_]] = new StaticAccessTokens[F](None) | ||
object StaticAccessToken { | ||
def noToken[F[_]] = new StaticAccessToken[F](None) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters