From de145b2a71f7b5fed2c1b8ce86449bad6db9575d Mon Sep 17 00:00:00 2001 From: Ben Fradet Date: Tue, 14 Apr 2020 12:18:11 +0200 Subject: [PATCH] Remove default parameters from interpreters, fixes #449 --- .../github4s/algebras/Repositories.scala | 3 ++ .../interpreters/ActivitiesInterpreter.scala | 6 +-- .../interpreters/AuthInterpreter.scala | 4 +- .../interpreters/GistsInterpreter.scala | 6 +-- .../interpreters/GitDataInterpreter.scala | 20 ++++---- .../interpreters/IssuesInterpreter.scala | 48 +++++++++---------- .../OrganizationsInterpreter.scala | 4 +- .../interpreters/ProjectsInterpreter.scala | 4 +- .../PullRequestsInterpreter.scala | 12 ++--- .../RepositoriesInterpreter.scala | 46 +++++++++--------- .../interpreters/UsersInterpreter.scala | 12 ++--- .../test/scala/github4s/unit/ReposSpec.scala | 9 +++- 12 files changed, 92 insertions(+), 82 deletions(-) diff --git a/github4s/src/main/scala/github4s/algebras/Repositories.scala b/github4s/src/main/scala/github4s/algebras/Repositories.scala index a57cf3193..0edfb8c9c 100644 --- a/github4s/src/main/scala/github4s/algebras/Repositories.scala +++ b/github4s/src/main/scala/github4s/algebras/Repositories.scala @@ -117,6 +117,7 @@ trait Repositories[F[_]] { * @param branch the branch name (defaults to the repository's default branch) * @param committer object containing information about the committer (filled in with authenticated user information if omitted) * @param author object containing information about the author (filled in with committer information if omitted) + * @param headers optional user headers to include in the request * @return GHResponse[WriteFileResponse] with details about the content created and the commit */ def createFile( @@ -143,6 +144,7 @@ trait Repositories[F[_]] { * @param branch the branch name (defaults to the repository's default branch) * @param committer object containing information about the committer (filled in with authenticated user information if omitted) * @param author object containing information about the author (filled in with committer information if omitted) + * @param headers optional user headers to include in the request * @return GHResponse[WriteFileResponse] with details about the content updated and the commit */ def updateFile( @@ -169,6 +171,7 @@ trait Repositories[F[_]] { * @param branch the branch name (defaults to the repository's default branch) * @param committer object containing information about the committer (filled in with authenticated user information if omitted) * @param author object containing information about the author (filled in with committer information if omitted) + * @param headers optional user headers to include in the request * @return GHResponse[WriteFileResponse] with no content and details about the commit which was added. */ def deleteFile( diff --git a/github4s/src/main/scala/github4s/interpreters/ActivitiesInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/ActivitiesInterpreter.scala index 27d3b8eb9..0f9a0f284 100644 --- a/github4s/src/main/scala/github4s/interpreters/ActivitiesInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/ActivitiesInterpreter.scala @@ -32,7 +32,7 @@ class ActivitiesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: O id: Int, subscribed: Boolean, ignored: Boolean, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Subscription]] = client.put[SubscriptionRequest, Subscription]( accessToken = accessToken, @@ -46,7 +46,7 @@ class ActivitiesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: O repo: String, timeline: Boolean, pagination: Option[Pagination], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[Stargazer]]] = client.get[List[Stargazer]]( accessToken, @@ -61,7 +61,7 @@ class ActivitiesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: O sort: Option[String], direction: Option[String], pagination: Option[Pagination], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[StarredRepository]]] = client.get[List[StarredRepository]]( accessToken, diff --git a/github4s/src/main/scala/github4s/interpreters/AuthInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/AuthInterpreter.scala index f3c46d482..52f281200 100644 --- a/github4s/src/main/scala/github4s/interpreters/AuthInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/AuthInterpreter.scala @@ -38,7 +38,7 @@ class AuthInterpreter[F[_]: Applicative]( note: String, client_id: String, client_secret: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Authorization]] = client.postAuth[NewAuthRequest, Authorization]( method = "authorizations", @@ -71,7 +71,7 @@ class AuthInterpreter[F[_]: Applicative]( code: String, redirect_uri: String, state: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[OAuthToken]] = client.postOAuth[NewOAuthRequest, OAuthToken]( url = client.config.accessTokenUrl, diff --git a/github4s/src/main/scala/github4s/interpreters/GistsInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/GistsInterpreter.scala index d503678e6..3d5d40105 100644 --- a/github4s/src/main/scala/github4s/interpreters/GistsInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/GistsInterpreter.scala @@ -30,7 +30,7 @@ class GistsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Option description: String, public: Boolean, files: Map[String, GistFile], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Gist]] = client.post[NewGistRequest, Gist]( accessToken, @@ -42,7 +42,7 @@ class GistsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Option override def getGist( gistId: String, sha: Option[String], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Gist]] = client.get[Gist]( accessToken, @@ -54,7 +54,7 @@ class GistsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Option gistId: String, description: String, files: Map[String, Option[EditGistFile]], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Gist]] = client.patch[EditGistRequest, Gist]( accessToken, diff --git a/github4s/src/main/scala/github4s/interpreters/GitDataInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/GitDataInterpreter.scala index 5514d530d..e2e61bd28 100644 --- a/github4s/src/main/scala/github4s/interpreters/GitDataInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/GitDataInterpreter.scala @@ -30,8 +30,8 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti owner: String, repo: String, ref: String, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[NonEmptyList[Ref]]] = client.get[NonEmptyList[Ref]]( accessToken, @@ -45,7 +45,7 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti repo: String, ref: String, sha: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Ref]] = client.post[CreateReferenceRequest, Ref]( accessToken, @@ -60,7 +60,7 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti ref: String, sha: String, force: Boolean, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Ref]] = client.patch[UpdateReferenceRequest, Ref]( accessToken, @@ -73,7 +73,7 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti owner: String, repo: String, sha: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[RefCommit]] = client.get[RefCommit](accessToken, s"repos/$owner/$repo/git/commits/$sha", headers) @@ -84,7 +84,7 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti tree: String, parents: List[String], author: Option[RefAuthor], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[RefCommit]] = client.post[NewCommitRequest, RefCommit]( accessToken, @@ -98,7 +98,7 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti repo: String, content: String, encoding: Option[String], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[RefInfo]] = client.post[NewBlobRequest, RefInfo]( accessToken, @@ -112,7 +112,7 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti repo: String, sha: String, recursive: Boolean, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[TreeResult]] = client.get[TreeResult]( accessToken, @@ -126,7 +126,7 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti repo: String, baseTree: Option[String], treeDataList: List[TreeData], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[TreeResult]] = client.post[NewTreeRequest, TreeResult]( accessToken, @@ -143,7 +143,7 @@ class GitDataInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Opti objectSha: String, objectType: String, author: Option[RefAuthor], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Tag]] = client.post[NewTagRequest, Tag]( accessToken, diff --git a/github4s/src/main/scala/github4s/interpreters/IssuesInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/IssuesInterpreter.scala index 558573b01..846cb698c 100644 --- a/github4s/src/main/scala/github4s/interpreters/IssuesInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/IssuesInterpreter.scala @@ -32,8 +32,8 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio override def listIssues( owner: String, repo: String, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Issue]]] = client .get[List[Issue]](accessToken, s"repos/$owner/$repo/issues", headers, pagination = pagination) @@ -42,14 +42,14 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio owner: String, repo: String, number: Int, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Issue]] = client.get[Issue](accessToken, s"repos/$owner/$repo/issues/$number", headers) override def searchIssues( query: String, searchParams: List[SearchParam], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[SearchIssuesResult]] = client.get[SearchIssuesResult]( accessToken = accessToken, @@ -66,7 +66,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio milestone: Option[Int], labels: List[String], assignees: List[String], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Issue]] = client.post[NewIssueRequest, Issue]( accessToken, @@ -85,7 +85,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio milestone: Option[Int], labels: List[String], assignees: List[String], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Issue]] = client.patch[EditIssueRequest, Issue]( accessToken, @@ -98,8 +98,8 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio owner: String, repo: String, number: Int, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Comment]]] = client .get[List[Comment]]( @@ -114,7 +114,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio repo: String, number: Int, body: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Comment]] = client.post[CommentData, Comment]( accessToken, @@ -128,7 +128,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio repo: String, id: Int, body: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Comment]] = client .patch[CommentData, Comment]( @@ -142,15 +142,15 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio owner: String, repo: String, id: Int, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Unit]] = client.delete(accessToken, s"repos/$owner/$repo/issues/comments/$id", headers) override def listLabelsRepository( owner: String, repo: String, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Label]]] = client.get[List[Label]]( accessToken, @@ -163,8 +163,8 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio owner: String, repo: String, number: Int, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Label]]] = client.get[List[Label]]( accessToken, @@ -178,7 +178,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio repo: String, number: Int, labels: List[String], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[Label]]] = client.post[List[String], List[Label]]( accessToken, @@ -192,7 +192,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio repo: String, number: Int, label: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[Label]]] = client.deleteWithResponse[List[Label]]( accessToken, @@ -203,8 +203,8 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio override def listAvailableAssignees( owner: String, repo: String, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[User]]] = client.get[List[User]]( accessToken, @@ -219,8 +219,8 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio state: Option[String], sort: Option[String], direction: Option[String], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Milestone]]] = client.get[List[Milestone]]( accessToken, @@ -238,7 +238,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio state: Option[String], description: Option[String], due_on: Option[ZonedDateTime], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Milestone]] = client.post[MilestoneData, Milestone]( accessToken, @@ -251,7 +251,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio owner: String, repo: String, number: Int, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Milestone]] = client.get[Milestone](accessToken, s"repos/$owner/$repo/milestones/$number", headers) @@ -263,7 +263,7 @@ class IssuesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Optio state: Option[String], description: Option[String], due_on: Option[ZonedDateTime], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Milestone]] = client.patch[MilestoneData, Milestone]( accessToken, s"repos/$owner/$repo/milestones/$milestone_number", diff --git a/github4s/src/main/scala/github4s/interpreters/OrganizationsInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/OrganizationsInterpreter.scala index 303f1f6d3..25efd4cae 100644 --- a/github4s/src/main/scala/github4s/interpreters/OrganizationsInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/OrganizationsInterpreter.scala @@ -30,7 +30,7 @@ class OrganizationsInterpreter[F[_]](implicit client: HttpClient[F], accessToken filter: Option[String], role: Option[String], pagination: Option[Pagination], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[User]]] = client.get[List[User]]( accessToken, @@ -47,7 +47,7 @@ class OrganizationsInterpreter[F[_]](implicit client: HttpClient[F], accessToken org: String, filter: Option[String], pagination: Option[Pagination], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[User]]] = client.get[List[User]]( accessToken, diff --git a/github4s/src/main/scala/github4s/interpreters/ProjectsInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/ProjectsInterpreter.scala index 61f71118e..c9645d7f6 100644 --- a/github4s/src/main/scala/github4s/interpreters/ProjectsInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/ProjectsInterpreter.scala @@ -30,8 +30,8 @@ class ProjectsInterpreter[F[_]]( override def listProjects( org: String, state: Option[String], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Project]]] = client.get[List[Project]]( accessToken, diff --git a/github4s/src/main/scala/github4s/interpreters/PullRequestsInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/PullRequestsInterpreter.scala index 7bd908941..06d63cfb3 100644 --- a/github4s/src/main/scala/github4s/interpreters/PullRequestsInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/PullRequestsInterpreter.scala @@ -30,7 +30,7 @@ class PullRequestsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: owner: String, repo: String, number: Int, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[PullRequest]] = client.get[PullRequest](accessToken, s"repos/$owner/$repo/pulls/$number", headers) @@ -39,7 +39,7 @@ class PullRequestsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: repo: String, filters: List[PRFilter], pagination: Option[Pagination], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[PullRequest]]] = client.get[List[PullRequest]]( accessToken, @@ -54,7 +54,7 @@ class PullRequestsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: repo: String, number: Int, pagination: Option[Pagination], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[PullRequestFile]]] = client .get[List[PullRequestFile]]( @@ -72,7 +72,7 @@ class PullRequestsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: head: String, base: String, maintainerCanModify: Option[Boolean], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[PullRequest]] = { val data: CreatePullRequest = newPullRequest match { case NewPullRequestData(title, body) => @@ -89,7 +89,7 @@ class PullRequestsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: repo: String, pullRequest: Int, pagination: Option[Pagination], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[List[PullRequestReview]]] = client.get[List[PullRequestReview]]( accessToken, @@ -104,7 +104,7 @@ class PullRequestsInterpreter[F[_]](implicit client: HttpClient[F], accessToken: repo: String, pullRequest: Int, review: Int, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[PullRequestReview]] = client.get[PullRequestReview]( accessToken, diff --git a/github4s/src/main/scala/github4s/interpreters/RepositoriesInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/RepositoriesInterpreter.scala index d957988cb..253e67108 100644 --- a/github4s/src/main/scala/github4s/interpreters/RepositoriesInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/RepositoriesInterpreter.scala @@ -30,15 +30,15 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: override def get( owner: String, repo: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Repository]] = client.get[Repository](accessToken, s"repos/$owner/$repo", headers) override def listOrgRepos( org: String, `type`: Option[String], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Repository]]] = client.get[List[Repository]]( accessToken, @@ -51,8 +51,8 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: override def listUserRepos( user: String, `type`: Option[String], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Repository]]] = client.get[List[Repository]]( accessToken, @@ -67,8 +67,8 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: repo: String, path: String, ref: Option[String], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[NonEmptyList[Content]]] = client.get[NonEmptyList[Content]]( accessToken, @@ -87,7 +87,7 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: branch: Option[String], committer: Option[Committer], author: Option[Committer], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[WriteFileResponse]] = client.put[WriteFileRequest, WriteFileResponse]( accessToken, @@ -106,7 +106,7 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: branch: Option[String], committer: Option[Committer], author: Option[Committer], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[WriteFileResponse]] = client.put[WriteFileRequest, WriteFileResponse]( accessToken, @@ -124,7 +124,7 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: branch: Option[String], committer: Option[Committer], author: Option[Committer], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[WriteFileResponse]] = client.deleteWithBody[DeleteFileRequest, WriteFileResponse]( accessToken, @@ -141,8 +141,8 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: author: Option[String], since: Option[String], until: Option[String], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Commit]]] = client.get[List[Commit]]( accessToken, @@ -164,8 +164,8 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: owner: String, repo: String, onlyProtected: Option[Boolean], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Branch]]] = client.get[List[Branch]]( accessToken, @@ -183,8 +183,8 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: owner: String, repo: String, anon: Option[String], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[User]]] = client.get[List[User]]( accessToken, @@ -202,8 +202,8 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: owner: String, repo: String, affiliation: Option[String], - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[User]]] = client.get[List[User]]( accessToken, @@ -226,7 +226,7 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: targetCommitish: Option[String], draft: Option[Boolean], prerelease: Option[Boolean], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Release]] = client.post[NewReleaseRequest, Release]( accessToken, @@ -239,7 +239,7 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: owner: String, repo: String, ref: String, - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[CombinedStatus]] = client.get[CombinedStatus](accessToken, s"repos/$owner/$repo/commits/$ref/status", headers) @@ -247,8 +247,8 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: owner: String, repo: String, ref: String, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[Status]]] = client.get[List[Status]]( accessToken, @@ -265,7 +265,7 @@ class RepositoriesInterpreter[F[_]](implicit client: HttpClient[F], accessToken: target_url: Option[String], description: Option[String], context: Option[String], - headers: Map[String, String] = Map() + headers: Map[String, String] ): F[GHResponse[Status]] = client.post[NewStatusRequest, Status]( accessToken, diff --git a/github4s/src/main/scala/github4s/interpreters/UsersInterpreter.scala b/github4s/src/main/scala/github4s/interpreters/UsersInterpreter.scala index 5623f4d2e..d970e6130 100644 --- a/github4s/src/main/scala/github4s/interpreters/UsersInterpreter.scala +++ b/github4s/src/main/scala/github4s/interpreters/UsersInterpreter.scala @@ -25,24 +25,24 @@ import github4s.Decoders._ class UsersInterpreter[F[_]](implicit client: HttpClient[F], accessToken: Option[String]) extends Users[F] { - override def get(username: String, headers: Map[String, String] = Map()): F[GHResponse[User]] = + override def get(username: String, headers: Map[String, String]): F[GHResponse[User]] = client.get[User](accessToken, s"users/$username", headers) - override def getAuth(headers: Map[String, String] = Map()): F[GHResponse[User]] = + override def getAuth(headers: Map[String, String]): F[GHResponse[User]] = client.get[User](accessToken, "user", headers) override def getUsers( since: Int, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[User]]] = client .get[List[User]](accessToken, "users", headers, Map("since" -> since.toString), pagination) override def getFollowing( username: String, - pagination: Option[Pagination] = None, - headers: Map[String, String] = Map() + pagination: Option[Pagination], + headers: Map[String, String] ): F[GHResponse[List[User]]] = client .get[List[User]](accessToken, s"users/$username/following", headers, pagination = pagination) diff --git a/github4s/src/test/scala/github4s/unit/ReposSpec.scala b/github4s/src/test/scala/github4s/unit/ReposSpec.scala index 0ceddb699..edd59db52 100644 --- a/github4s/src/test/scala/github4s/unit/ReposSpec.scala +++ b/github4s/src/test/scala/github4s/unit/ReposSpec.scala @@ -83,7 +83,14 @@ class ReposSpec extends BaseSpec { val repos = new RepositoriesInterpreter[IO] - repos.getContents(validRepoOwner, validRepoName, validFilePath, Some("master"), None, headerUserAgent) + repos.getContents( + validRepoOwner, + validRepoName, + validFilePath, + Some("master"), + None, + headerUserAgent + ) } "Repos.createFile" should "call to httpClient.put with the right parameters" in {