Answer the question
In order to leave comments, you need to log in
How to get access to owner?
Hello, I can't figure out how to get access to the owner to get information about the user of the repository.
File itself:
{
"total_count": 355265,
"incomplete_results": false,
"items": [
{
"id": 2126244,
"node_id": "MDEwOlJlcG9zaXRvcnkyMTI2MjQ0",
"name": "bootstrap",
"full_name": "twbs/bootstrap",
"private": false,
"owner": {
"login": "twbs",
"id": 2918581,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjI5MTg1ODE=",
"avatar_url": "https://avatars.githubusercontent.com/u/2918581?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/twbs",
"html_url": "https://github.com/twbs",
"followers_url": "https://api.github.com/users/twbs/followers",
"following_url": "https://api.github.com/users/twbs/following{/other_user}",
"gists_url": "https://api.github.com/users/twbs/gists{/gist_id}",
"starred_url": "https://api.github.com/users/twbs/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/twbs/subscriptions",
"organizations_url": "https://api.github.com/users/twbs/orgs",
"repos_url": "https://api.github.com/users/twbs/repos",
"events_url": "https://api.github.com/users/twbs/events{/privacy}",
"received_events_url": "https://api.github.com/users/twbs/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/twbs/bootstrap",
"description": "The most popular HTML, CSS, and JavaScript framework for developing responsive, mobile first projects on the web.",
"fork": false,
public interface Service {
@GET("search/repositories")
Call<ItemResponce> getItems(
@Query(value = "q",encoded = true) String q
);
}
public class Item {
@SerializedName("full_name")
@Expose
private String name;
@SerializedName("avatar_url")
@Expose
private String avatarUrl;
@SerializedName("html_url")
@Expose
private String html_url;
public Item(String name,String avatarUrl,String html_url)
{
this.name = name;
this.avatarUrl=avatarUrl;
this.html_url=html_url;
}
public String getName()
{
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAvatarUrl()
{
return avatarUrl;
}
public void setAvatarUrl(String avatarUrl) {
this.avatarUrl = avatarUrl;
}
public void setHtml_url(String html_url) {
this.html_url = html_url;
}
public String getHtml_url()
{
return html_url;
}
}
public class ItemResponce {
@SerializedName("items")
@Expose
private List<Item> items;
public List<Item> getItems()
{
return items;
}
public void setItems(List<Item> items){
this.items = items;
}
}
Answer the question
In order to leave comments, you need to log in
Good afternoon.
Here, take a look at the pojo structure for your json
Was generated on the site - https://www.jsonschema2pojo.org/
-----------------------------------com.example.Example.java-----------------------------------
package com.example;
import java.util.List;
import javax.annotation.Generated;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
@Generated("jsonschema2pojo")
public class Example {
@SerializedName("total_count")
@Expose
public Long totalCount;
@SerializedName("incomplete_results")
@Expose
public Boolean incompleteResults;
@SerializedName("items")
@Expose
public List<Item> items = null;
}
-----------------------------------com.example.Item.java-----------------------------------
package com.example;
import javax.annotation.Generated;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
@Generated("jsonschema2pojo")
public class Item {
@SerializedName("id")
@Expose
public Long id;
@SerializedName("node_id")
@Expose
public String nodeId;
@SerializedName("name")
@Expose
public String name;
@SerializedName("full_name")
@Expose
public String fullName;
@SerializedName("private")
@Expose
public Boolean _private;
@SerializedName("owner")
@Expose
public Owner owner;
@SerializedName("html_url")
@Expose
public String htmlUrl;
@SerializedName("description")
@Expose
public String description;
@SerializedName("fork")
@Expose
public Boolean fork;
}
-----------------------------------com.example.Owner.java-----------------------------------
package com.example;
import javax.annotation.Generated;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
@Generated("jsonschema2pojo")
public class Owner {
@SerializedName("login")
@Expose
public String login;
@SerializedName("id")
@Expose
public Long id;
@SerializedName("node_id")
@Expose
public String nodeId;
@SerializedName("avatar_url")
@Expose
public String avatarUrl;
@SerializedName("gravatar_id")
@Expose
public String gravatarId;
@SerializedName("url")
@Expose
public String url;
@SerializedName("html_url")
@Expose
public String htmlUrl;
@SerializedName("followers_url")
@Expose
public String followersUrl;
@SerializedName("following_url")
@Expose
public String followingUrl;
@SerializedName("gists_url")
@Expose
public String gistsUrl;
@SerializedName("starred_url")
@Expose
public String starredUrl;
@SerializedName("subscriptions_url")
@Expose
public String subscriptionsUrl;
@SerializedName("organizations_url")
@Expose
public String organizationsUrl;
@SerializedName("repos_url")
@Expose
public String reposUrl;
@SerializedName("events_url")
@Expose
public String eventsUrl;
@SerializedName("received_events_url")
@Expose
public String receivedEventsUrl;
@SerializedName("type")
@Expose
public String type;
@SerializedName("site_admin")
@Expose
public Boolean siteAdmin;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question