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

Change the fields getter method to get -> opt of RepositoryApi #43

Open
sukeshni opened this issue May 22, 2015 · 4 comments
Open

Change the fields getter method to get -> opt of RepositoryApi #43

sukeshni opened this issue May 22, 2015 · 4 comments

Comments

@sukeshni
Copy link
Contributor

In SearchApi for searchRepositories, I am using Repository for items in reponse, since searchRepositories returns Repositories.
Few fields
For Ex.

  • updated_at
  • size
  • stargazers_count
  • forks_count
    which are required to test but are not included in Repository,
    If we create a new class for items which is list of Repositories it will be redunduncy
    So we should convert the getter methods of class repository so that it can be reused.
@sukeshni sukeshni assigned sukeshni and fanwashere and unassigned sukeshni May 22, 2015
@shunjikonishi shunjikonishi added this to the Sprint3 milestone May 25, 2015
@shunjikonishi
Copy link
Contributor

@sukeshni @fanwashere
How about this?

@fanwashere
Copy link
Contributor

@shunjikonishi I am finishing up Issues API. Right after I will double check and implement any missing fields for this issue.

@fanwashere
Copy link
Contributor

@sukeshni fix me. I looked at the response and added these fields in. This is not committed, you should add the fields in as you see fit.

case class Repository(value: JValue) extends AbstractJson(value) {
  def id = get("id").toLong
  def name = get("name")
  def full_name = get("full_name")

  lazy val owner = User(value \ "owner")

  def `private` = boolean("private")
  def html_url = get("html_url")
  def description = opt("description")
  def fork = boolean("fork")
  def url = get("url")
  //Many types of urls here, I don't think is necessary

  def created_at = getDate("created_at")
  def updated_at = getDate("updated_at")
  def pushed_at = dateOpt("pushed_at") //Not sure if this could return null

  def homepage = opt("homepage")
  def size = get("size").toLong
  def stargazers_count = get("stargazers_count")
  def language = get("language")
  def has_issues = boolean("has_issues")
  def has_downloads = boolean("has_downloads")
  def has_wiki = boolean("has_wiki")
  def has_pages = boolean("has_pages")
  def forks_count = get("forks_count").toInt
  def mirror_url = opt("mirror_url")
  def open_issues_count = get("open_issues_count").toInt
  def forks = get("forks").toInt
  def open_issues = get("open_issues").toInt
  def watchers = get("watchers").toInt
  def default_branch = get("default_branch")
  def score = get("score").toLong

  lazy val permissions = Permissions(value \ "permissions")
}

There were a lot of url fields in between that may or may not be necessary. I have only tested a few of the fields so further testing is definitely required.

Also, I did not noticed any response object called "permission", though I assume that is used in another operation.

@sukeshni
Copy link
Contributor Author

@fanwashere Thank you for your reply, will add the required fields. Object permission is not in the response, it is used by other operations.

@fanwashere fanwashere removed their assignment Jun 19, 2015
@takayukioda takayukioda modified the milestone: Sprint3 Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants