/** * Get all presentations which are related to the prsentation id provided based on tag matching. * Optionally the resultset can be restricted by applying criteria * * @param int $id The id of the presentation we're relating to * @param array $criteria Find only presentations which meet the criteria provided * @return Videojuicer_Presentation_List_Response */ public function find_all_related_to($id, $criteria = array()) { $method = "presentations/{$id}/related_by_tag"; $type = Videojuicer_Request::GET; $response_class = "Videojuicer_Presentation_Response"; $exception_class = "Videojuicer_Presentation_Exception"; $permission = Videojuicer_Permission::NONE; $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class); return Videojuicer::execute_call($request); }
/** * Update the presentation with ID provided to the attributes provided * * @param int $id * @param array $attributes */ public static function update($asset_type, $id, $attributes, $token_value, $token_secret) { #TODO: Check if token value/secret is null and if so try to retrieve from VJ (Videojuicer::get_access_token()->get_token(), Videojuicer::get_access_token()->get_secret()) $method = "assets/{$asset_type}/{$id}"; $type = Videojuicer_Request::PUT; $response_class = "Videojuicer_Asset_" . ucfirst($asset_type) . "_Update_Response"; $exception_class = "Videojuicer_Asset_" . ucfirst($asset_type) . "_Update_Exception"; $permission = Videojuicer_Permission::WRITE_USER; $attributes = Videojuicer_Request::wrap_vars($attributes, "asset"); $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class); $request->set_vars($attributes); $request->set_authorized(true, $token_value, $token_secret); return Videojuicer::execute_call($request); }
/** * Find all Presentation objects that meet the conditionsv provided * * @param array $conditions * @param int $related_to * * @return Videojuicer_Presentation_List_Response */ public static function find_all($conditions = array(), $related_to = null) { $method = "presentations"; // If we want presentations related to another presentation if (is_numeric($related_to)) { $method .= "/{$related_to}/related_by_tag"; } // Modify the conditions to be specific to presentations foreach ($conditions as $key => $val) { $conditions["presentation[{$key}]"] = $val; } // Make the call $response = Videojuicer::execute_call($method, $conditions); return $response; }
/** * Retrieve an authorized request token in preperation for retrieving an access token */ public static function get_authorized_request_token($unauthorized_token_value = null, $unauthorized_token_secret = null) { // If we weren't given a token to use, retrieve it from Videojuicer class if (is_null($unauthorized_token_value) || is_null($unauthorized_token_secret)) { $token = Videojuicer::get_token(); if ($token instanceof Videojuicer_Token_Unauthorized) { $unauthorized_token_value = $token->get_token(); $unauthorized_token_secret = $token->get_secret(); } } $method = "oauth/tokens"; $type = Videojuicer_Request::GET; $response_class = "Videojuicer_Token_Authorized_Response"; $exception_class = "Videojuicer_Token_Authorized_Exception"; $permission = Videojuicer_Permission::NONE; $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class); $request->set_authorized(true, $unauthorized_token_value, $unauthorized_token_secret); $request->use_extension(false); return Videojuicer::execute_call($request); }
/** * Update the presentation with ID provided to the attributes provided * * @param int $id * @param array $attributes */ public static function delete($id, $token_value, $token_secret) { #TODO: Check if token value/secret is null and if so try to retrieve from VJ (Videojuicer::get_access_token()->get_token(), Videojuicer::get_access_token()->get_secret()) $method = "presentations/{$id}"; $type = Videojuicer_Request::DELETE; $response_class = "Videojuicer_Presentation_Delete_Response"; $exception_class = "Videojuicer_Presentation_Delete_Exception"; $permission = Videojuicer_Permission::WRITE_USER; $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class); $request->set_authorized(true, $token_value, $token_secret); return Videojuicer::execute_call($request); }
public static function remove_role($id, $role, $token_value, $token_secret) { #TODO: Check if token value/secret is null and if so try to retrieve from VJ (Videojuicer::get_access_token()->get_token(), Videojuicer::get_access_token()->get_secret()) $method = "users/{$id}/remove_role"; $type = Videojuicer_Request::POST; $response_class = "Videojuicer_User_RemoveRole_Response"; $exception_class = "Videojuicer_User_RemoveRole_Exception"; $permission = Videojuicer_Permission::NONE; $attributes = array("role" => $role); $request = new Videojuicer_Request($method, $type, $permission, $response_class, $exception_class); $request->set_authorized(true, $token_value, $token_secret); $request->set_vars($attributes); return Videojuicer::execute_call($request); }