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
Missing Test and Docs #132
Conversation
Create empty docs Fix changelog Add description in integration test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass on the doc 👍
docs/src/main/tut/auth.md
Outdated
Github4s supports the [Authentication API](https://developer.github.com/v3/oauth_authorizations/). As a result, | ||
with github4s, you can: | ||
|
||
- [New authentication](#new-authentication) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a new authorization token
would be better I think
docs/src/main/tut/auth.md
Outdated
with github4s, you can: | ||
|
||
- [New authentication](#new-authentication) | ||
- [Authorize url](#authorize-url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Authorize a URL
docs/src/main/tut/auth.md
Outdated
|
||
- [New authentication](#new-authentication) | ||
- [Authorize url](#authorize-url) | ||
- [Get access token](#get-access-token) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get an access token
docs/src/main/tut/auth.md
Outdated
|
||
## Authentication | ||
|
||
### New authentication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a new authorization token
docs/src/main/tut/auth.md
Outdated
|
||
|
||
Call to request a new authorization given a basic authentication, the returned object Authorization includes an | ||
access token |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newAuth
can be used to request a new auth token given basic authentication, the returned [Authorization][auth-scala] includes the created token. It takes as arguments:
docs/src/main/tut/user.md
Outdated
def getAuth: GHIO[GHResponse[User]] = O.getAuthUser(accessToken) | ||
|
||
The `result` on the right is the corresponding [List[User]][user-scala]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
User
docs/src/main/tut/user.md
Outdated
The `result` on the right is the corresponding [List[User]][user-scala]. | ||
|
||
See [the API doc](https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription) for full reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong link
docs/src/main/tut/user.md
Outdated
*/ | ||
def getUsers(since: Int, pagination: Option[Pagination] = None): GHIO[GHResponse[List[User]]] = | ||
O.getUsers(since, pagination, accessToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
docs/src/main/tut/user.md
Outdated
The `result` on the right is the corresponding [List[User]][user-scala]. | ||
|
||
See [the API doc](https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription) for full reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
docs/src/main/tut/user.md
Outdated
See [the API doc](https://developer.github.com/v3/activity/notifications/#set-a-thread-subscription) for full reference. | ||
|
||
As you can see, a few features of the activity endpoint are missing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user
Thanks for the feedback. A big part of the changes requested are from the wip |
@AdrianRaFo I thought you still wanted a review since you requested reviewers, my bad. |
set default pagination
docs/src/main/tut/auth.md
Outdated
|
||
``` | ||
|
||
They also make use of `cats.Id` but any type container implementing `MonadError[M, Throwable]` will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could remove this sentence too
docs/src/main/tut/auth.md
Outdated
# Authentication API | ||
|
||
Github4s supports the [Authentication API](https://developer.github.com/v3/oauth_authorizations/). As a result, | ||
with github4s, you can: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-with github4s
+with Github4s
docs/src/main/tut/auth.md
Outdated
|
||
### Create a new authorization token | ||
|
||
Used to request a new auth token given basic authentication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
at the end of the sentence.
docs/src/main/tut/auth.md
Outdated
|
||
Used to request a new auth token given basic authentication | ||
|
||
You can create a tree using `newAuth`, it takes as arguments: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create a tree
?
delete default pagination
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made another pass on the last commit 👍 .
I'm also wondering about the change to the default pagination?
docs/src/main/tut/auth.md
Outdated
|
||
```scala | ||
val newAuth = Github(accessToken).auth.newAuth( | ||
val newAuth = Github(None).auth.newAuth( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for indicating that no token is required? If so it might be nice to document it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's None
because you don't have any accessToken yet, anyway i'm going to document it
docs/src/main/tut/auth.md
Outdated
@@ -63,16 +60,16 @@ See [the API doc](https://developer.github.com/v3/oauth_authorizations/#create-a | |||
|
|||
### Authorize a url | |||
|
|||
Generates the authorize url with a random state, both are returned within Authorize object | |||
Generates the authorize url with a random state, both are returned within Authorize object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
within an Authorize
object.
docs/src/main/tut/issue.md
Outdated
## Issues | ||
|
||
### Create an issue | ||
|
||
You can create an issue using `createIssue`, it takes as arguments: | ||
|
||
- the repository coordinates (owner and name of the repository) | ||
- the content of the issue (title and body) | ||
- the repository coordinates (owner and name of the repository). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is owner
and name
in the other doc (true for the others in issue.md)
Codecov Report
@@ Coverage Diff @@
## master #132 +/- ##
=====================================
Coverage 88% 88%
=====================================
Files 36 36
Lines 550 550
Branches 2 2
=====================================
Hits 484 484
Misses 66 66
Continue to review full report at Codecov.
|
docs/src/main/tut/auth.md
Outdated
|
||
### Get an access token | ||
|
||
Requests an access token based on the code retrieved in the [Create a new authorization token](#create-a-new-authorization-token) step of the oAuth process |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
docs/src/main/tut/auth.md
Outdated
|
||
See [the API doc](https://developer.github.com/v3/oauth/#web-application-flow) for full reference. | ||
|
||
As you can see, a few features of the activity endpoint are missing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence should be changed, we're not in the activity section, right?
docs/src/main/tut/git_data.md
Outdated
|
||
Support for `cats.Id`, `cats.Eval` and `Future` (the only supported option for scala-js) are | ||
provided out of the box when importing `github4s.{js,jvm}.Implicits._`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove the two paragraphs above?
docs/src/main/tut/git_data.md
Outdated
provided out of the box when importing `github4s.{js,jvm}.Implicits._`. | ||
|
||
|
||
## Git Data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
See [the API doc](https://developer.github.com/v3/git/blobs/#create-a-blob) for full reference. | ||
|
||
## Trees | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with @BenFradet . We could some background about trees here:
As you probably know, Git can be considered as a tree structure. Each commit creates a new node in that tree. Even we could assume that all the Git commands or methods provided by the API, are just tools that serve to navigate on this tree and to manipulate it.
In the next sections, let's see how Github4s API provides some methods to wrap the Github API.
docs/src/main/tut/git_data.md
Outdated
|
||
See [the API doc](https://developer.github.com/v3/git/tags/#create-a-tag-object) for full reference. | ||
|
||
As you can see, a few features of the repository endpoint are missing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
docs/src/main/tut/user.md
Outdated
``` | ||
|
||
They also make use of `cats.Id` but any type container implementing `MonadError[M, Throwable]` will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, do we need the next two paragraphs?
docs/src/main/tut/user.md
Outdated
### Get a user | ||
|
||
Get information for a particular user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
docs/src/main/tut/user.md
Outdated
### Get an authenticated user | ||
|
||
Get information of the authenticated user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
This is great, thanks @AdrianRaFo ! Let's wait to @BenFradet for final review though :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few nits regarding the doc but this looks great! 👍
@@ -0,0 +1,123 @@ | |||
--- | |||
layout: docs | |||
title: Authentication API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is tangential / should be treated in another issue/pr but I wonder if we shouldn't rename the API Authorization
instead of Authentication
to better stick to what github is saying, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, we could file an issue to tackle it before releasing the next version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on it 👍
docs/src/main/tut/auth.md
Outdated
**NOTE**: In the examples you will see `Github(None)` | ||
because if you are authenticating for the first time you don't have any accessToken yet. | ||
|
||
## Authentication |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This level isn't needed since this API only deals with auth
docs/src/main/tut/auth.md
Outdated
// if you're using ScalaJS, replace occurrences of HttpResponse by SimpleHttpResponse | ||
//import github4s.js.Implicits._ | ||
//import fr.hmil.roshttp.response.SimpleHttpResponse | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty line
docs/src/main/tut/auth.md
Outdated
``` | ||
|
||
**NOTE**: In the examples you will see `Github(None)` | ||
because if you are authenticating for the first time you don't have any accessToken yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
access token
docs/src/main/tut/auth.md
Outdated
|
||
### Authorize a url | ||
|
||
Generates the authorize url with a random state, both are returned within an Authorize object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"an authorized URL" and "[Authorize][auth-scala]"
docs/src/main/tut/pull_request.md
Outdated
@@ -100,9 +99,10 @@ createPullRequestData.exec[cats.Id, HttpResponse[String]]() match { | |||
} | |||
``` | |||
|
|||
On the other hand, we can pass a `issue` id (through `NewPullRequestIssue` object) instead of the title and the body to get this parameter of the issue | |||
On the other hand, we can pass a `issue` id (through `NewPullRequestIssue` object) | |||
instead of the title and the body to get this parameter of the issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other hand, we can pass an issue
id (through a NewPullRequestIssue
object) instead of the title and body.
docs/src/main/tut/pull_request.md
Outdated
|
||
**NOTE**: This option deletes the issue | ||
**NOTE**: This option deletes the issue. | ||
|
||
```scala | ||
val createPullRequestIssue = Github(accessToken).pullRequests.create("47deg", "github4s", NewPullRequestIssue("105"),"my-branch","base-branch",Some(true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no spaces between params and weird indent
docs/src/main/tut/user.md
Outdated
### Get an authenticated user | ||
|
||
Get information of the authenticated user. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add: "making the API call" at the end of the sentence
def getUsers( | ||
accessToken: Option[String] = None, | ||
headers: Map[String, String] = Map(), | ||
since: Int, | ||
pagination: Option[Pagination] = None | ||
pagination: Option[Pagination] = Some(httpClient.defaultPagination) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just curious as to why the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just have setted the same default pagination for all APIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get back to None
, I don't see any benefit changing it .
@@ -87,6 +108,82 @@ class ReposSpec extends BaseSpec { | |||
) | |||
} | |||
|
|||
"Repos.listcommit" should "call to httpClient.get with the right parameters" in { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
listCommits
minor fixes
@AdrianRaFo do you need me to have another look? |
feel free to do it or approve it for merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍
From #131 , this PR covers: