Skip to content

Commit b6c6b54

Browse files
committed
media_type updates
1 parent 71478c7 commit b6c6b54

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Instagram/Request/MediaTypes.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
class MediaTypes {
3838
const VIDEO = 'VIDEO';
3939
const CAROUSEL = 'CAROUSEL';
40+
const REELS = 'REELS';
41+
const STORIES = 'STORIES';
4042
}
4143

4244
?>

src/Instagram/User/Media.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,12 @@ public function create( $params ) {
7878
'params' => $params ? $params : array()
7979
);
8080

81-
if ( isset( $params[Params::VIDEO_URL] ) && !isset( $postParams['params'][Params::MEDIA_TYPE] ) ) { // video container requires more params and to not overide in case REELS is passed
82-
$postParams['params'][Params::MEDIA_TYPE] = MediaTypes::VIDEO;
83-
} elseif ( isset( $params[Params::CHILDREN] ) ) { // carousel container requires more params
81+
if ( isset( $params[Params::CHILDREN] ) ) { // carousel container requires more children params
8482
$postParams['params'][Params::MEDIA_TYPE] = MediaTypes::CAROUSEL;
83+
} elseif ( isset( $params[Params::VIDEO_URL] ) && !isset( $postParams['params'][Params::MEDIA_TYPE] ) ) { // video container requires more params and to not overide in case REELS is passed
84+
$postParams['params'][Params::MEDIA_TYPE] = MediaTypes::VIDEO;
85+
} elseif ( isset( $params[Params::VIDEO_URL] && isset( $postParams['params'][Params::MEDIA_TYPE] ) { // set url and type to whatever is passed in
86+
$postParams['params'][Params::MEDIA_TYPE] = $postParams['params'][Params::MEDIA_TYPE];
8587
}
8688

8789
// ig get request

0 commit comments

Comments
 (0)