-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
GetMediaInfoResponse.ts
155 lines (139 loc) · 3.74 KB
/
GetMediaInfoResponse.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import { MediaProductType } from '../../../Enums';
import { AbstractResponse } from '../../AbstractResponse';
import { MediaData } from '../../data/MediaData';
/**
* Class that represents a response from a Media request.
*
* @author Tiago Grosso <tiagogrosso99@gmail.com>
* @since 0.1.0
*/
export class GetMediaInfoResponse extends AbstractResponse<MediaData> {
/**
* Gets the id of the media object.
*
* @returns the id of the media object.
*/
public getId(): string {
return this.data.id;
}
/**
* Gets the caption of the media object.
*
* @returns the caption of the media object.
*/
public getCaption(): string | undefined {
return this.data.caption;
}
/**
* Gets the ig_id of the media object.
*
* @returns the ig_id of the media object.
*/
public getIgId(): string | undefined {
return this.data.ig_id;
}
/**
* Gets the comments count of the media object.
*
* @returns the comments count of the media object.
*/
public getCommentsCount(): number | undefined {
return this.data.comments_count;
}
/**
* Whether comments are enabled on the media object.
*
* @returns whether comments are enabled on the media object.
*/
public isCommentsEnabled(): boolean | undefined {
return this.data.is_comment_enabled;
}
/**
* Gets the like count of the media object.
*
* @returns the like count of the media object.
*/
public getLikeCount(): number | undefined {
return this.data.like_count;
}
/**
* Gets the type of the media object.
*
* @returns the type of the media object.
*/
public getMediaType(): string | undefined {
return this.data.media_type;
}
/**
* Gets the URL of the media object.
*
* @returns the URL of the media object.
*/
public getMediaUrl(): string | undefined {
return this.data.media_url;
}
/**
* Gets the owner of the media object.
*
* @returns the owner of the media object.
*/
public getOwner(): { id: string } | undefined {
return this.data.owner;
}
/**
* Gets the owner id of the media object.
*
* @returns the owner id of the media object.
*/
public getOwnerId(): string | undefined {
return this.data.owner?.id;
}
/**
* Gets the permalink of the media object.
*
* @returns the permalink of the media object.
*/
public getPermalink(): string | undefined {
return this.data.permalink;
}
/**
* Gets the shortcode of the media object.
*
* @returns the shortcode of the media object.
*/
public getShortcode(): string | undefined {
return this.data.shortcode;
}
/**
* Gets the timestamp of the media object.
*
* @returns the timestamp of the media object.
*/
public getTimestamp(): Date | undefined {
return this.data.timestamp != undefined ? new Date(this.data.timestamp) : undefined;
}
/**
* Gets the username of the media object.
*
* @returns the username of the media object.
*/
public getUsername(): string | undefined {
return this.data.username;
}
/**
* Gets the surface where the media is published.
*
* @returns the surface where the media is published.
*/
public getMediaProductType(): MediaProductType | undefined {
return this.data.media_product_type;
}
/**
* Gets the video title of the IGTV media object.
*
* @returns the video title of the IGTV media object.
*/
public getVideoTitle(): string | undefined {
return this.data.video_title;
}
}