从Instagram android获取轮播数据

时间:2019-01-09 07:55:53

标签: android retrofit instagram

Instagram API现在支持“多张照片”帖子。

我尝试使用端点@GET("v1/users/self/media/recent"),但作为响应,Carousal媒体为空,但其他所有数据都可以。

InstagramResponse.java

public class InstagramResponse {

private Pagination pagination;
private List<Datum> data = null;

/**
 * No args constructor for use in serialization
 */
public InstagramResponse() {
}

/**
 * @param data
 * @param pagination
 */
public InstagramResponse(Pagination pagination, List<Datum> data) {
    super();
    this.pagination = pagination;
    this.data = data;
}

public Pagination getPagination() {
    return pagination;
}

public void setPagination(Pagination pagination) {
    this.pagination = pagination;
}

public List<Datum> getData() {
    return data;
}

public void setData(List<Datum> data) {
    this.data = data;
}

public class Images {

    private Thumbnail thumbnail;
    private LowResolution lowResolution;
    private StandardResolution standardResolution;

    /**
     * No args constructor for use in serialization
     */
    public Images() {
    }

    /**
     * @param thumbnail
     * @param lowResolution
     * @param standardResolution
     */
    public Images(Thumbnail thumbnail, LowResolution lowResolution, StandardResolution standardResolution) {
        super();
        this.thumbnail = thumbnail;
        this.lowResolution = lowResolution;
        this.standardResolution = standardResolution;
    }

    public Thumbnail getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(Thumbnail thumbnail) {
        this.thumbnail = thumbnail;
    }

    public LowResolution getLowResolution() {
        return lowResolution;
    }

    public void setLowResolution(LowResolution lowResolution) {
        this.lowResolution = lowResolution;
    }

    public StandardResolution getStandardResolution() {
        return standardResolution;
    }

    public void setStandardResolution(StandardResolution standardResolution) {
        this.standardResolution = standardResolution;
    }

}

public class Datum {

    private String id;
    private String type;
    private List<CarouselMedium> carouselMedia = null;

    /**
     * No args constructor for use in serialization
     */
    public Datum() {
    }

    /**
     * @param id
     * @param carouselMedia
     */
    public Datum(String id, String type,List<CarouselMedium> carouselMedia) {
        super();
        this.id = id;
        this.type = type;
        this.carouselMedia = carouselMedia;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public List<CarouselMedium> getCarouselMedia() {
        return carouselMedia;
    }

    public void setCarouselMedia(List<CarouselMedium> carouselMedia) {
        this.carouselMedia = carouselMedia;
    }

}

public class CarouselMedium {

    private Images images;
    private List<UsersInPhoto> usersInPhoto = null;
    private String type;

    /**
     * No args constructor for use in serialization
     */
    public CarouselMedium() {
    }

    /**
     * @param usersInPhoto
     * @param images
     * @param type
     */
    public CarouselMedium(Images images, List<UsersInPhoto> usersInPhoto, String type) {
        super();
        this.images = images;
        this.usersInPhoto = usersInPhoto;
        this.type = type;
    }

    public Images getImages() {
        return images;
    }

    public void setImages(Images images) {
        this.images = images;
    }

    public List<UsersInPhoto> getUsersInPhoto() {
        return usersInPhoto;
    }

    public void setUsersInPhoto(List<UsersInPhoto> usersInPhoto) {
        this.usersInPhoto = usersInPhoto;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

}


public class LowResolution {

    private Integer width;
    private Integer height;
    private String url;

    /**
     * No args constructor for use in serialization
     */
    public LowResolution() {
    }

    /**
     * @param height
     * @param width
     * @param url
     */
    public LowResolution(Integer width, Integer height, String url) {
        super();
        this.width = width;
        this.height = height;
        this.url = url;
    }

    public Integer getWidth() {
        return width;
    }

    public void setWidth(Integer width) {
        this.width = width;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

}

public class Pagination {


}

public class Position {

    private Float x;
    private Float y;

    /**
     * No args constructor for use in serialization
     */
    public Position() {
    }

    /**
     * @param y
     * @param x
     */
    public Position(Float x, Float y) {
        super();
        this.x = x;
        this.y = y;
    }

    public Float getX() {
        return x;
    }

    public void setX(Float x) {
        this.x = x;
    }

    public Float getY() {
        return y;
    }

    public void setY(Float y) {
        this.y = y;
    }

}


public class StandardResolution {

    private Integer width;
    private Integer height;
    private String url;

    /**
     * No args constructor for use in serialization
     */
    public StandardResolution() {
    }

    /**
     * @param height
     * @param width
     * @param url
     */
    public StandardResolution(Integer width, Integer height, String url) {
        super();
        this.width = width;
        this.height = height;
        this.url = url;
    }

    public Integer getWidth() {
        return width;
    }

    public void setWidth(Integer width) {
        this.width = width;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

}


public class Thumbnail {

    private Integer width;
    private Integer height;
    private String url;

    /**
     * No args constructor for use in serialization
     */
    public Thumbnail() {
    }

    /**
     * @param height
     * @param width
     * @param url
     */
    public Thumbnail(Integer width, Integer height, String url) {
        super();
        this.width = width;
        this.height = height;
        this.url = url;
    }

    public Integer getWidth() {
        return width;
    }

    public void setWidth(Integer width) {
        this.width = width;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

}

public class User {

    private String username;

    /**
     * No args constructor for use in serialization
     */
    public User() {
    }

    /**
     * @param username
     */
    public User(String username) {
        super();
        this.username = username;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

}

public class UsersInPhoto {

    private User user;
    private Position position;

    /**
     * No args constructor for use in serialization
     */
    public UsersInPhoto() {
    }

    /**
     * @param position
     * @param user
     */
    public UsersInPhoto(User user, Position position) {
        super();
        this.user = user;
        this.position = position;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Position getPosition() {
        return position;
    }

    public void setPosition(Position position) {
        this.position = position;
    }

}

}

好吧,我尝试从Instagram帐户获取所有图像,以某种方式我设法获取了所有图像,但无法获得Carousal Images 我不知道为什么只有Carousal数据为null, 有什么方法可以在Carousal媒体中获取数据?

0 个答案:

没有答案