diff --git a/README.lhs b/README.lhs index 78924ed..1f77590 100644 --- a/README.lhs +++ b/README.lhs @@ -85,7 +85,7 @@ getScopedAppToken = do let creds = AppCredentials {appId, privateKey} create = mempty - { repositories = ["freckle/github-app-token"] + { repositories = ["github-app-token"] , permissions = contents Read } @@ -141,6 +141,15 @@ main = do , description = "Generate an installation token for a GitHub App" } + Hspec.describe "Scoped usage" $ do + Hspec.it "works" $ do + token <- getScopedAppToken + getRepo token "freckle/github-app-token" + `Hspec.shouldReturn` Repo + { name = "github-app-token" + , description = "Generate an installation token for a GitHub App" + } + Hspec.describe "By owner" $ do Hspec.it "works" $ do token <- getOwnerAppToken diff --git a/src/GitHub/App/Token/Generate.hs b/src/GitHub/App/Token/Generate.hs index 6bd45e1..f586edc 100644 --- a/src/GitHub/App/Token/Generate.hs +++ b/src/GitHub/App/Token/Generate.hs @@ -94,9 +94,11 @@ generateOwnerToken = generateOwnerTokenScoped mempty -- | data CreateAccessToken = CreateAccessToken { repositories :: [Text] - -- ^ List of @{owner}/{name}@ values + -- ^ List of repository names that the token should have access to , repository_ids :: [Int] + -- ^ List of repository IDs that the token should have access to , permissions :: Permissions + -- ^ The permissions granted to the user access token } deriving stock (Eq, Generic) deriving anyclass (ToJSON)