Skip to content
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

Tree and Refs API Calls #40

Open
rebelzach opened this issue Mar 28, 2016 · 1 comment
Open

Tree and Refs API Calls #40

rebelzach opened this issue Mar 28, 2016 · 1 comment

Comments

@rebelzach
Copy link

I'm planning to do a PR for refs and trees (then eventually files). Thought I'd share my plan and get any feedback. Here is the draft interface for trees (refs should be straightforward), the unique bit might be in how the tree structure gets returned. Composing the objects into a tree is an extra step that makes sense to me, but doesn't mirror the API response, so I'm interested to hear your thoughts.

Also, I'm wondering if truncated trees should be treated as an error response, it could certainly just be a property on the Tree object but it feels like its an error to not more explicitly handle it, I could see using a TreeResponse enum with the response case of Truncated that still passes along the tree.

/**
Getting a tree
- parameter owner: The user or organization that owns the repository.
- parameter repository: The name of the repository.
- parameter sha: sha of the commit to get the tree from
- parameter recursively: If true, composes the Tree's subdirectories in the Tree's entries property
- parameter completion: Callback for the outcome of the fetch. 
    Completion is called with a root Tree object that has an array property entries: [Tree]? 
    If recursive is true, subdirectories will have further Tree objects in their entries 
*/
func tree(owner: String, 
           repository: String, 
           sha: String, 
           recursively: Bool, 
           completion: (response: Response<Tree>) -> Void)
@rebelzach rebelzach changed the title Trees API Calls Tree and Refs API Calls Mar 28, 2016
@pietbrauer
Copy link
Member

Nice, a PR is definitely welcome! I would map the error to the GitHub response, since GitHub is returning a 200 when the truncated tree is shown I would also truncate the response. Can you see how high limited is until it is truncated?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants