This repository was archived by the owner on Jun 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
[WIP] Implement event activity API #108
Open
dhruvsinghal
wants to merge
27
commits into
master
Choose a base branch
from
activity-api
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
54d5aeb
Added a parameter to the search API that specifies the options to use…
dhruvsinghal0 bc5867b
Started implementation of a generic service API
dhruvsinghal0 24466ef
Redesigned URI parameter handling.
dhruvsinghal0 38dc762
Updated tests
dhruvsinghal0 e26fe28
Fixed the Search URI
dhruvsinghal0 0097f97
Refactored Search UI to accept URI in the service functions. Removed …
dhruvsinghal0 3d817d3
Merge branch 'master' into service-refactoring-proof-of-concept
dhruvsinghal0 7921f24
Made uri an argument to the service functions
dhruvsinghal0 044ad6c
Renamed e to err
dhruvsinghal0 b5898e0
Fixed typos
dhruvsinghal0 a05609b
Merge branch 'service-refactoring-proof-of-concept' of https://github…
dannysperling c6360d9
Fix rename e to err
dannysperling 0048164
Merge branch 'service-refactoring-proof-of-concept' of github.com:oct…
dhruvsinghal0 1541706
Merge branch 'temp-restore' into search-refactoring
dhruvsinghal0 3f4771c
Merge branch 'master' into search-refactoring
feiranchen 23b538d
deprecating old template
feiranchen c4b6ae9
Upates Issues API to use the new pattern
dhruvsinghal0 019e734
Added additional parameters to the Issues URL template
dhruvsinghal0 b8fbac0
Changed returning empty slice to returning nil
dhruvsinghal0 2dd5b3f
Renamed the RepoIssuesURL to a more consice form
dhruvsinghal0 3147b13
Implemented (untested) One and All for public activity events
dhruvsinghal0 57da5e0
Merge branch 'master' into issues-refactoring
dhruvsinghal0 17c1431
Merge pull request #93 from octokit/search-refactoring
pengwynn 3ee5bf3
Merge pull request #98 from octokit/issues-refactoring
pengwynn d378898
Merge pull request #106 from dannysperling/update-gists
pengwynn d05aa18
Implemented (untested) One and All for public activity events
dhruvsinghal0 34a7f85
Merge branch 'activity-api' of github.com:octokit/go-octokit into act…
dhruvsinghal0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,73 @@ | ||
| package octokit | ||
|
|
||
| import ( | ||
| "time" | ||
| ) | ||
|
|
||
| var ( | ||
| PublicEventsURL = Hyperlink("/events") | ||
| ) | ||
|
|
||
| func (c *Client) ActivityEvents() *ActivityEventsService { | ||
| return &ActivityEventsService{client: c} | ||
| } | ||
|
|
||
| // ActivityEventsService is a service providing access to event activity | ||
| type ActivityEventsService struct { | ||
| client *Client | ||
| } | ||
|
|
||
| func (r *ActivityEventsService) One(uri *Hyperlink, params M) (event *Event, | ||
| result *Result) { | ||
| if uri == nil { | ||
| uri = &PublicEventsURL | ||
| } | ||
| url, err := uri.Expand(params) | ||
| if err != nil { | ||
| return nil, &Result{Err: err} | ||
| } | ||
| result = r.client.get(url, &event) | ||
| return | ||
| } | ||
|
|
||
| // All gets a list of all events associated with the url of the service | ||
| func (r *ActivityEventsService) All(uri *Hyperlink, params M) ( | ||
| events []Event, result *Result) { | ||
| if uri == nil { | ||
| uri = &PublicEventsURL | ||
| } | ||
| url, err := uri.Expand(params) | ||
| if err != nil { | ||
| return nil, &Result{Err: err} | ||
| } | ||
| result = r.client.get(url, &events) | ||
| return | ||
| } | ||
|
|
||
| type Actor struct { | ||
| ID int `json:"id,omitempty"` | ||
| Login string `json:"login,omitempty"` | ||
| GravatarID string `json:"gravatar_id,omitempty"` | ||
| URL string `json:"url,omitempty"` | ||
| AvatarURL string `json:"avatar_url,omitempty"` | ||
| } | ||
|
|
||
| type Payload struct { | ||
| PushID int `json:"push_id,omitempty"` | ||
| Size int `json:"size,omitempty"` | ||
| DistinctSize int `json:"distinct_size,omitempty"` | ||
| Ref string `json:"ref,omitempty"` | ||
| Head string `json:"head,omitempty"` | ||
| Before string `json:"before,omitempty"` | ||
| Commits []Commit `json:"commits,omitempty"` | ||
| } | ||
|
|
||
| type Event struct { | ||
| ID string `json:"id,omitempty"` | ||
| Type string `json:"type,omitempty"` | ||
| Actor Actor `json:"actor,omitempty"` | ||
| Repo Repository `json:"repo,omitempty"` | ||
| Payload Payload `json:"payload,omitempty"` | ||
| Public bool `json:"public,omitempty"` | ||
| CreatedAt *time.Time `json:"created_at,omitempty"` | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@dhruvsinghal: Upon closer look, I don't think this service has a
.One()use case does it?