Skip to content

Commit

Permalink
add multiple endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
rocketapi-io committed Dec 30, 2022
1 parent 15007af commit be234bb
Show file tree
Hide file tree
Showing 2 changed files with 177 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "rocketapi/rocketapi",
"description": "RocketAPI PHP SDK",
"version": "1.0.1",
"version": "1.0.2",
"license": "MIT",
"authors": [
{
Expand Down
176 changes: 176 additions & 0 deletions src/InstagramAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,42 @@ public function getUserMedia($user_id, $count=12, $max_id=null) {
return $this->request('instagram/user/get_media', $payload);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getUserClips($user_id, $max_id=null) {
$payload = ['id' => $user_id];
if ($max_id) {
$payload['max_id'] = $max_id;
}
return $this->request('instagram/user/get_clips', $payload);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getUserGuides($user_id, $max_id=null) {
$payload = ['id' => $user_id];
if ($max_id) {
$payload['max_id'] = $max_id;
}
return $this->request('instagram/user/get_guides', $payload);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getUserTags($user_id, $count=12, $max_id=null) {
$payload = ['id' => $user_id, 'count' => $count];
if ($max_id) {
$payload['max_id'] = $max_id;
}
return $this->request('instagram/user/get_tags', $payload);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
Expand Down Expand Up @@ -123,6 +159,36 @@ public function getUserStories($user_id) {
return $this->getUserStoriesBulk([$user_id]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getUserHighlights($user_id) {
return $this->request('instagram/user/get_highlights', [
'id' => $user_id,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getUserLive($user_id) {
return $this->request('instagram/user/get_live', [
'id' => $user_id,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getUserSimilarAccounts($user_id) {
return $this->request('instagram/user/get_similar_accounts', [
'id' => $user_id,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
Expand Down Expand Up @@ -157,6 +223,104 @@ public function getMediaComments($media_id, $can_support_threading=true, $min_id
return $this->request('instagram/media/get_comments', $payload);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getMediaShortcodeById($media_id) {
return $this->request('instagram/media/get_shortcode_by_id', [
'id' => $media_id,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getMediaIdByShortcode($shortcode) {
return $this->request('instagram/media/get_id_by_shortcode', [
'shortcode' => $shortcode,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getGuideInfo($guide_id) {
return $this->request('instagram/guide/get_info', [
'id' => $guide_id,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getLocationInfo($location_id) {
return $this->request('instagram/location/get_info', [
'id' => $location_id,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getLocationMedia($location_id, $page=null, $max_id=null) {
$payload = ['id' => $location_id];
if ($page) {
$payload['page'] = $page;
}
if ($max_id) {
$payload['max_id'] = $max_id;
}
return $this->request('instagram/location/get_media', $payload);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getHashtagInfo($name) {
return $this->request('instagram/hashtag/get_info', [
'name' => $name,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getHashtagMedia($name, $page=null, $max_id=null) {
$payload = ['name' => $name];
if ($page) {
$payload['page'] = $page;
}
if ($max_id) {
$payload['max_id'] = $max_id;
}
return $this->request('instagram/hashtag/get_media', $payload);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getHighlightStoriesBulk($highlight_ids) {
return $this->request('instagram/highlight/get_stories', [
'ids' => $highlight_ids,
]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getHighlightStories($highlight_id) {
return $this->getHighlightStoriesBulk([$highlight_id]);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
Expand All @@ -168,4 +332,16 @@ public function getCommentLikes($comment_id, $max_id=null) {
}
return $this->request('instagram/comment/get_likes', $payload);
}

/**
* @throws Exceptions\NotFoundException
* @throws Exceptions\BadResponseException
*/
public function getAudioMedia($audio_id, $max_id=null) {
$payload = ['id' => $audio_id];
if ($max_id) {
$payload['max_id'] = $max_id;
}
return $this->request('instagram/audio/get_media', $payload);
}
}

0 comments on commit be234bb

Please sign in to comment.