response

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caption

type Caption struct {
	// List of Edge which contains multiple nodes
	Edges []struct {
		// A single node which contains Caption text
		Node struct {
			Text string `json:"text"` // The raw caption text
		} `json:"node"`
	} `json:"edges"`
}

Caption contains the raw caption of the Instagram post

type Dimensions

type Dimensions struct {
	Height int `json:"height"` // Height of the media in pixels
	Width  int `json:"width"`  // Width of the media in pixels
}

Dimensions of the media

type EmbedResponse

type EmbedResponse struct {
	Media Media `json:"shortcode_media"` // Media
}

EmbedResponse base

func (EmbedResponse) ExtractMediaURL

func (s EmbedResponse) ExtractMediaURL() string

ExtractMediaURL will extract the Media URL automatically based on Media type (video or image)

func (EmbedResponse) GetCaption

func (s EmbedResponse) GetCaption() string

GetCaption of the Media

func (EmbedResponse) IsEmpty

func (s EmbedResponse) IsEmpty() bool

IsEmpty will return true if the Media object is empty

func (EmbedResponse) IsVideo

func (s EmbedResponse) IsVideo() bool

IsVideo will return true if the Media type is equals to video

type Media

type Media struct {
	Id               string     `json:"id"`                    // Unique ID of the Media
	Shortcode        string     `json:"shortcode"`             // Unique shortcode of the Media
	Type             string     `json:"__typename"`            // Type of the Media
	ProductType      string     `json:"product_type"`          // Product type of the Media
	TakenAt          types.Time `json:"taken_at_timestamp"`    // The time this media was taken/published
	CommenterCount   uint64     `json:"commenter_count"`       // Count of Users who have commented
	Comments         WithCount  `json:"edge_media_to_comment"` // Comments count
	Likes            WithCount  `json:"edge_liked_by"`         // Likes count
	Dimensions       Dimensions `json:"dimensions"`            // Dimensions of the Media
	DisplayURL       string     `json:"display_url"`           // URL of the Media (resolution is dynamic)
	DisplayResources []Resource `json:"display_resources"`     // Resource of the Media

	Caption Caption `json:"edge_media_to_caption"` // Media caption
	Owner   Owner   `json:"owner"`                 // User who has posted this Media

	IsVideo        bool   `json:"is_video"`         // Is type of the Media equals to video
	Title          string `json:"title"`            // The video title
	VideoURL       string `json:"video_url"`        // Direct URL to the Video
	VideoViewCount uint64 `json:"video_view_count"` // The number of times Video has been viewed

	SliderItems SliderItems `json:"edge_sidecar_to_children"` // Children of the Media

}

Media which contains a single Instagram post

type Owner

type Owner struct {
	Id                string        `json:"id"`                           // Unique ID of the User
	ProfilePictureURL string        `json:"profile_pic_url"`              // URL of user's profile picture
	Username          string        `json:"username"`                     // Username of the User
	HasPublicStory    bool          `json:"has_public_story"`             // Is the User stories publically available
	IsPrivate         bool          `json:"is_private"`                   // Is the User account private
	IsVerified        bool          `json:"is_verified"`                  // Is the User account verified
	Followers         WithCount     `json:"edge_followed_by"`             // Followers count
	Timeline          OwnerTimeline `json:"edge_owner_to_timeline_media"` // Timeline feeds of the User
}

Owner is a single Instagram user who owns the Media

type OwnerTimeline

type OwnerTimeline struct {
	Count uint64 `json:"count"` // Count of public posts
	// List of Edge which contains multiple nodes
	Edges []struct {
		// A single node which contains Thumbnail
		Node struct {
			Id                 string     `json:"string"`
			ThumbnailSrc       string     `json:"thumbnail_src"`
			ThumbnailResources []Resource `json:"thumbnail_resources"`
		} `json:"node"`
	} `json:"edges"`
}

OwnerTimeline contains the latest timeline feed of the Instagram user

type Resource

type Resource struct {
	Width  int    `json:"config_width"`  // Height of the resource media in pixels
	Height int    `json:"config_height"` // Height of the resource media in pixels
	Src    string `json:"src"`           // Direct URL to the Resource
}

Resource for an specific Media

type SliderItemNode

type SliderItemNode struct {
	Id               string     `json:"id"`                // Unique ID of the Media
	Shortcode        string     `json:"shortcode"`         // Unique shortcode of the Media
	Type             string     `json:"__typename"`        // Type of the Media
	ProductType      string     `json:"product_type"`      // Product type of the Media
	Dimensions       Dimensions `json:"dimensions"`        // Dimension of the Media
	DisplayURL       string     `json:"display_url"`       // URL of the Media (resolution is dynamic)
	DisplayResources []Resource `json:"display_resources"` // Resource of the Media

	IsVideo        bool   `json:"is_video"`         // Is type of the Media equals to video
	Title          string `json:"title"`            // The video title
	VideoURL       string `json:"video_url"`        // Direct URL to the Video
	VideoViewCount uint64 `json:"video_view_count"` // The number of times Video has been viewed

}

SliderItemNode contains information about the Instagram post

func (SliderItemNode) ExtractMediaURL

func (s SliderItemNode) ExtractMediaURL() string

ExtractMediaURL will extract the Media URL automatically based on Media type (video or image)

type SliderItems

type SliderItems struct {
	// List of Edge which contains multiple nodes
	Edges []struct {
		// A single node which contains Media item
		Node SliderItemNode `json:"node"`
	} `json:"edges"`
}

SliderItems contains list of the Instagram posts

type WithCount

type WithCount struct {
	Count uint64 `json:"count"` // The number of count
}

WithCount represents a single numeric Count field

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL