Skip to content

Commit

Permalink
Remove default parameters from interpreters, fixes #449
Browse files Browse the repository at this point in the history
  • Loading branch information
BenFradet committed Apr 15, 2020
1 parent 439b411 commit 910a024
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 82 deletions.
3 changes: 3 additions & 0 deletions github4s/src/main/scala/github4s/algebras/Repositories.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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)

Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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]](
Expand All @@ -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,
Expand All @@ -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](
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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)

Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 910a024

Please sign in to comment.