idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
44,200 | private function removeInlineKeyboard ( $ chatId , $ messageId ) { $ parameters = [ 'chat_id' => $ chatId , 'message_id' => $ messageId , 'inline_keyboard' => [ ] , ] ; return $ this -> http -> post ( $ this -> buildApiUrl ( 'editMessageReplyMarkup' ) , [ ] , $ parameters ) ; } | Removes the inline keyboard from an interactive message . |
44,201 | public function run ( ) { $ this -> registerFormScripts ( ) ; if ( $ this -> applyJqueryPaymentFormat || $ this -> applyJqueryPaymentValidation ) { $ this -> registerJqueryPaymentScripts ( ) ; } return parent :: run ( ) ; } | Will show the Stripe s simple form modal |
44,202 | public function registerFormScripts ( ) { $ view = $ this -> getView ( ) ; $ view -> registerJsFile ( $ this -> stripeJs , [ 'position' => \ yii \ web \ View :: POS_HEAD ] ) ; $ js = "Stripe.setPublishableKey('" . Yii :: $ app -> stripe -> publicKey . "');" ; $ view -> registerJs ( $ js , \ yii \ web \ View :: POS_BEGIN ) ; $ view -> registerJs ( $ this -> stripeResponseHandler , \ yii \ web \ View :: POS_READY ) ; $ view -> registerJs ( $ this -> stripeRequestHandler , \ yii \ web \ View :: POS_READY ) ; } | Will register mandatory javascripts to work |
44,203 | public function registerJqueryPaymentScripts ( ) { $ view = $ this -> getView ( ) ; JqueryPaymentAsset :: register ( $ view ) ; if ( $ this -> applyJqueryPaymentFormat ) { $ js = "jQuery(function($) { $('input[data-stripe=" . self :: NUMBER_ID . "]').payment('formatCardNumber'); $('input[data-stripe=" . self :: CVC_ID . "]').payment('formatCardCVC'); $('input[data-stripe=" . self :: MONTH_YEAR_ID . "]').payment('formatCardExpiry'); $('input[data-stripe=" . self :: MONTH_ID . "]').payment('restrictNumeric'); $('input[data-stripe=" . self :: YEAR_ID . "]').payment('restrictNumeric'); });" ; $ view -> registerJs ( $ js ) ; } if ( $ this -> applyJqueryPaymentValidation ) { $ js = 'jQuery(function($) { $.fn.toggleInputError = function(erred) { this.closest(".form-group").toggleClass("' . $ this -> errorClass . '", erred); return this; }; $("#' . $ this -> options [ 'id' ] . ' :submit").on("click", function(e) { var $form = $("#' . $ this -> options [ 'id' ] . '"); var $number = $("input[data-stripe=' . self :: NUMBER_ID . ']"); var $cvc = $("input[data-stripe=' . self :: CVC_ID . ']"); var $exp = $("input[data-stripe=' . self :: MONTH_YEAR_ID . ']"); var $month = $("input[data-stripe=' . self :: MONTH_ID . ']"); var $year = $("input[data-stripe=' . self :: YEAR_ID . ']"); var cardType = $.payment.cardType($number.val()); (' . $ this -> brandIdentificationHandler . ')(cardType); var validCard = $.payment.validateCardNumber($number.val()); $number.toggleInputError(!validCard); var validCVC = $.payment.validateCardCVC($cvc.val(), cardType); $cvc.toggleInputError(!validCVC); if ($exp.length) { var validExpiry = $.payment.validateCardExpiry($exp.payment("cardExpiryVal")); $exp.toggleInputError(!validExpiry); var fullDate = $exp.val(); var res = fullDate.split(" / ", 2); $month.val(res[0]); $year.val(res[1]); }else{ var validExpiry = $.payment.validateCardExpiry($month.val(), $year.val()); $month.toggleInputError(!validExpiry); $year.toggleInputError(!validExpiry); } if(!validCard || !validCVC || !validExpiry){ e.preventDefault(); return false; }else{ return true; } }); });' ; $ view -> registerJs ( $ js ) ; } } | Will register Jquery Payment scripts |
44,204 | private function registerScripts ( ) { $ view = $ this -> getView ( ) ; $ view -> registerJsFile ( $ this -> stripeJs , [ 'position' => \ yii \ web \ View :: POS_END ] ) ; if ( ! self :: $ handlerRegistered ) { $ js = "var handler = StripeCheckout.configure({ key: '" . Yii :: $ app -> stripe -> publicKey . "' });" ; $ view -> registerJs ( $ js ) ; $ js = 'jQuery("window").on("popstate", function(e) { handler.close(); });' ; $ view -> registerJs ( $ js ) ; self :: $ handlerRegistered = true ; } $ js = 'jQuery("#' . $ this -> buttonOptions [ 'id' ] . '").on("click", function(e) { handler.open({ name: "' . $ this -> name . '", description: "' . $ this -> description . '", amount: ' . $ this -> amount . ', image: "' . $ this -> image . '", currency: "' . $ this -> currency . '", panelLabel: "' . $ this -> panelLabel . '", zipCode: "' . $ this -> validateZipCode . '", email: "' . $ this -> userEmail . '", allowRememberMe: "' . $ this -> allowRemember . '", token: ' . $ this -> tokenFunction . ', opened: ' . $ this -> openedFunction . ', closed: ' . $ this -> closedFunction . ' }); e.preventDefault(); });' ; $ view -> registerJs ( $ js ) ; } | Will register the scripts . |
44,205 | private function generateButton ( ) { return Html :: tag ( 'button' , $ this -> encodeLabel ? Html :: encode ( $ this -> label ) : $ this -> label , $ this -> buttonOptions ) ; } | Will generate the pay button |
44,206 | private function generateStripeForm ( ) { return Html :: beginForm ( $ this -> action , 'POST' , $ this -> formOptions ) . $ this -> generateScriptTag ( ) . Html :: endForm ( ) ; } | Will generate the stripe form |
44,207 | private function generateScriptTag ( ) { return Html :: script ( '' , [ 'src' => $ this -> stripeJs , 'data-key' => Yii :: $ app -> stripe -> publicKey , 'data-amount' => $ this -> amount , 'data-name' => $ this -> name , 'data-description' => $ this -> description , 'data-image' => $ this -> image , 'data-currency' => $ this -> currency , 'data-panel-label' => $ this -> panelLabel , 'data-zip-code' => $ this -> validateZipCode , 'data-email' => $ this -> userEmail , 'data-label' => $ this -> label , 'data-allow-remember-me' => $ this -> allowRemember , 'data-billing-address' => $ this -> collectBillingAddress , 'class' => self :: BUTTON_CLASS , ] ) ; } | Will generate Stripe script tag with passed parameters |
44,208 | public function all ( $ role ) { if ( ! is_string ( $ role ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Expected $role of type string and got %s' , gettype ( $ role ) ) ) ; } if ( ! in_array ( strtolower ( $ role ) , array ( 'member' , 'contributor' , 'admin' ) , true ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unknown role %s' , $ role ) ) ; } return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> get ( 'teams' , array ( 'role' => $ role ) ) ; } | Get a list of teams to which the caller has access . |
44,209 | public function setAuthHeader ( $ params ) { if ( is_array ( $ params ) ) { $ this -> authHeader = $ this -> toHeader ( $ params ) ; } else { if ( strpos ( $ params , 'Authorization: ' ) !== false ) { $ params = str_replace ( 'Authorization: ' , '' , $ params ) ; } $ this -> authHeader = $ params ; } } | Set authorization header parameters |
44,210 | protected function toHeader ( array $ params ) { $ out = '' ; $ last = end ( $ params ) ; foreach ( $ params as $ k => $ v ) { $ out .= $ k . '="' . $ v . '"' ; if ( $ v != $ last ) { $ out .= ',' ; } } return $ out ; } | Build authorization header from array |
44,211 | public function get ( $ account , $ repo , $ keyId ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/deploy-keys/%s' , $ account , $ repo , $ keyId ) ) ; } | Get the key s content |
44,212 | public function create ( $ account , $ repo , $ key , $ label = null ) { $ options = array ( 'key' => $ key ) ; if ( ! is_null ( $ label ) ) { $ options [ 'label' ] = $ label ; } return $ this -> requestPost ( sprintf ( 'repositories/%s/%s/deploy-keys' , $ account , $ repo ) , $ options ) ; } | Add a new key |
44,213 | public function update ( $ account , $ repo , $ keyId , $ options = array ( ) ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/deploy-keys/%s' , $ account , $ repo , $ keyId ) , $ options ) ; } | Update an existing key |
44,214 | public function get ( $ account , $ repo , $ linkID ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/links/%d' , $ account , $ repo , $ linkID ) ) ; } | Get a link |
44,215 | public function create ( $ account , $ repo , $ handler , $ url , $ key ) { if ( ! in_array ( strtolower ( $ handler ) , array ( 'jira' , 'bamboo' , 'crucible' , 'jenkins' , 'custom' ) ) ) { throw new \ InvalidArgumentException ( 'Invalid handler provided.' ) ; } return $ this -> requestPost ( sprintf ( 'repositories/%s/%s/links' , $ account , $ repo ) , array ( 'handler' => $ handler , 'link_url' => $ url , 'link_key' => $ key ) ) ; } | Create a new link |
44,216 | public function update ( $ account , $ repo , $ linkID , $ url , $ key ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/links/%d' , $ account , $ repo , $ linkID ) , array ( 'link_url' => $ url , 'link_key' => $ key ) ) ; } | Update a link |
44,217 | public function delete ( $ account , $ repo , $ linkID ) { return $ this -> requestDelete ( sprintf ( 'repositories/%s/%s/links/%d' , $ account , $ repo , $ linkID ) ) ; } | Delete a link |
44,218 | public function get ( $ account , $ repo , $ page ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/wiki/%s' , $ account , $ repo , $ page ) ) ; } | Get the raw content of a Wiki page |
44,219 | public function update ( $ account , $ repo , $ title , $ content , $ path = null , $ rev = null ) { if ( is_null ( $ path ) ) { $ path = sprintf ( '/%s' , $ title ) ; } $ params = array ( 'data' => $ content , 'path' => $ path ) ; if ( ! is_null ( $ rev ) ) { $ params [ 'rev' ] = $ rev ; } return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/wiki/%s' , $ account , $ repo , $ title ) , $ params ) ; } | Update a page |
44,220 | protected function getAccessToken ( ) { $ response = $ this -> httpClient -> post ( self :: ENDPOINT_ACCESS_TOKEN , array ( 'grant_type' => 'client_credentials' , 'client_id' => $ this -> config [ 'client_id' ] , 'client_secret' => $ this -> config [ 'client_secret' ] , 'scope' => implode ( ',' , $ this -> config [ 'scopes' ] ) ) ) ; $ data = json_decode ( $ response -> getContent ( ) , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { $ ex = new HttpResponseException ( '[access_token] Invalid JSON: ' . json_last_error_msg ( ) ) ; $ ex -> setResponse ( $ this -> httpClient -> getLastResponse ( ) ) -> setRequest ( $ this -> httpClient -> getLastRequest ( ) ) ; throw $ ex ; } if ( false === array_key_exists ( 'access_token' , $ data ) ) { throw new HttpResponseException ( 'access_token is missing from response. ' . $ response -> getContent ( ) ) ; } return $ data ; } | Fetch access token with a grant_type of client_credentials |
44,221 | public function all ( $ account , $ repo , $ start = null , $ limit = 15 ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/changesets' , $ account , $ repo ) , array ( 'start' => $ start , 'limit' => $ limit ) ) ; } | Get a list of changesets |
44,222 | public function get ( $ account , $ repo , $ node ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/changesets/%s' , $ account , $ repo , $ node ) ) ; } | Get an individual changeset |
44,223 | public function diffstat ( $ account , $ repo , $ node ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/changesets/%s/diffstat' , $ account , $ repo , $ node ) ) ; } | Get statistics associated with an individual changeset |
44,224 | public function diff ( $ account , $ repo , $ node ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/changesets/%s/diff' , $ account , $ repo , $ node ) ) ; } | Get the diff associated with a changeset |
44,225 | public function get ( $ account , $ repo , $ milestoneID ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/issues/milestones/%d' , $ account , $ repo , $ milestoneID ) ) ; } | Get an individual milestone |
44,226 | public function update ( $ account , $ repo , $ milestoneID , $ name ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/issues/milestones/%d' , $ account , $ repo , $ milestoneID ) , array ( 'name' => $ name ) ) ; } | Update an existing milestone |
44,227 | public function delete ( $ account , $ repo , $ milestoneID ) { return $ this -> requestDelete ( sprintf ( 'repositories/%s/%s/issues/milestones/%d' , $ account , $ repo , $ milestoneID ) ) ; } | Delete an existing milestone |
44,228 | public function create ( $ account , $ name , $ description = null , $ url = null ) { $ params = array ( 'name' => $ name ) ; if ( ! is_null ( $ description ) ) { $ params [ 'description' ] = $ description ; } if ( ! is_null ( $ url ) ) { $ params [ 'url' ] = $ url ; } return $ this -> requestPost ( sprintf ( 'users/%s/consumers' , $ account ) , $ params ) ; } | Create new OAuth consumer |
44,229 | public function update ( $ account , $ name , $ keyId , $ description = null , $ url = null ) { $ params = array ( 'name' => $ name ) ; if ( ! is_null ( $ description ) ) { $ params [ 'description' ] = $ description ; } if ( ! is_null ( $ url ) ) { $ params [ 'url' ] = $ url ; } return $ this -> requestPut ( sprintf ( 'users/%s/consumers/%d' , $ account , $ keyId ) , $ params ) ; } | Update an OAuth consumer |
44,230 | public function create ( $ account , $ repo , $ params = array ( ) ) { if ( 'array' !== gettype ( $ params ) ) { if ( empty ( $ params ) ) { throw new \ InvalidArgumentException ( 'Invalid JSON provided.' ) ; } $ params = $ this -> decodeJSON ( $ params ) ; } return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> post ( sprintf ( 'repositories/%s/%s/pipelines/' , $ account , $ repo ) , json_encode ( $ params ) , array ( 'Content-Type' => 'application/json' ) ) ; } | Creates a pipeline for the specified repository . |
44,231 | public function stopPipeline ( $ account , $ repo , $ uuid ) { return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> post ( sprintf ( 'repositories/%s/%s/pipelines/%s/stopPipeline' , $ account , $ repo , $ uuid ) ) ; } | Stop a specific pipeline |
44,232 | public function group ( $ account , $ groupOwner , $ groupSlug ) { return $ this -> requestGet ( sprintf ( 'users/%s/privileges/%s/%s' , $ account , $ groupOwner , $ groupSlug ) ) ; } | Get the privileges associated with a group |
44,233 | public function update ( $ account , $ groupOwner , $ groupSlug , $ privilege ) { if ( ! in_array ( $ privilege , array ( 'admin' , 'collaborator' ) ) ) { throw new \ InvalidArgumentException ( "Invalid privilege provided." ) ; } return $ this -> requestPut ( sprintf ( 'users/%s/privileges/%s/%s' , $ account , $ groupOwner , $ groupSlug ) , array ( 'privileges' => $ privilege ) ) ; } | Updates a group s privileges on a team account |
44,234 | public function create ( $ account , $ groupOwner , $ groupSlug , $ privilege ) { if ( ! in_array ( $ privilege , array ( 'admin' , 'collaborator' ) ) ) { throw new \ InvalidArgumentException ( "Invalid privilege provided." ) ; } return $ this -> requestPost ( sprintf ( 'users/%s/privileges/%s/%s' , $ account , $ groupOwner , $ groupSlug ) , array ( 'privileges' => $ privilege ) ) ; } | Add a privilege to a group |
44,235 | public function repositories ( $ account , $ groupOwner , $ groupSlug ) { return $ this -> requestGet ( sprintf ( 'group-privileges/%s/%s/%s' , $ account , $ groupOwner , $ groupSlug ) ) ; } | Get a list of repositories with a specific privilege group |
44,236 | public function delete ( $ account , $ repo , $ groupOwner , $ groupSlug ) { return $ this -> requestDelete ( sprintf ( 'group-privileges/%s/%s/%s/%s' , $ account , $ repo , $ groupOwner , $ groupSlug ) ) ; } | Delete group privileges from a repository |
44,237 | public function get ( $ account , $ repo ) { return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> get ( sprintf ( 'repositories/%s/%s' , $ account , $ repo ) ) ; } | Get information associated with an individual repository . |
44,238 | public function create ( $ account , $ repo , $ params = array ( ) ) { if ( is_array ( $ repo ) ) { return $ this -> createLegacy ( $ account , $ repo ) ; } $ defaults = array ( 'scm' => 'git' , 'name' => $ repo , 'is_private' => true , 'description' => 'My secret repo' , 'fork_policy' => 'no_forks' , ) ; if ( 'array' !== gettype ( $ params ) ) { if ( empty ( $ params ) ) { throw new \ InvalidArgumentException ( 'Invalid JSON provided.' ) ; } $ params = $ this -> decodeJSON ( $ params ) ; } $ params = json_encode ( array_merge ( $ defaults , $ params ) ) ; return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> post ( sprintf ( 'repositories/%s/%s' , $ account , $ repo ) , $ params , array ( 'Content-Type' => 'application/json' ) ) ; } | Create a new repository |
44,239 | public function fork ( $ account , $ repo , $ name , array $ params = array ( ) ) { $ params [ 'name' ] = $ name ; return $ this -> requestPost ( sprintf ( 'repositories/%s/%s/fork' , $ account , $ repo ) , $ params ) ; } | Fork a repository |
44,240 | public function manifest ( $ account , $ repo , $ revision ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/manifest/%s' , $ account , $ repo , $ revision ) ) ; } | Get the repository manifest |
44,241 | public function raw ( $ account , $ repo , $ rev , $ path ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/raw/%s/%s' , $ account , $ repo , $ rev , $ path ) ) ; } | Get the raw source |
44,242 | public function filehistory ( $ account , $ repo , $ node , $ path ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/filehistory/%s/%s' , $ account , $ repo , $ node , $ path ) ) ; } | Get the history of a file in a changeset |
44,243 | public function all ( $ account , $ repo , $ issueID ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/issues/%d/comments' , $ account , $ repo , $ issueID ) ) ; } | Get all comments for specified issue |
44,244 | public function create ( $ account , $ repo , $ issueID , $ content ) { return $ this -> requestPost ( sprintf ( 'repositories/%s/%s/issues/%d/comments' , $ account , $ repo , $ issueID ) , array ( 'content' => $ content ) ) ; } | Add a new comment to specified issue |
44,245 | public function get ( $ account , $ repository , $ revision , $ key ) { return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> get ( sprintf ( 'repositories/%s/%s/commit/%s/statuses/build/%s' , $ account , $ repository , $ revision , $ key ) ) ; } | Returns the status for specific build associated with a commit . |
44,246 | public function create ( $ account , $ repository , $ revision , $ params ) { return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> post ( sprintf ( 'repositories/%s/%s/commit/%s/statuses/build' , $ account , $ repository , $ revision ) , json_encode ( $ params ) , array ( 'Content-Type' => 'application/json' ) ) ; } | Adds a build status to a commit . If the build is already associated with the commit a POST also updates the status . |
44,247 | public function update ( $ account , $ repository , $ revision , $ key , $ params ) { return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> put ( sprintf ( 'repositories/%s/%s/commit/%s/statuses/build/%s' , $ account , $ repository , $ revision , $ key ) , json_encode ( $ params ) , array ( 'Content-Type' => 'application/json' ) ) ; } | Updates the build status for a commit . |
44,248 | public function all ( $ account , $ repo , array $ options = array ( ) ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/issues' , $ account , $ repo ) , $ options ) ; } | GET a list of issues in a repository s tracker |
44,249 | public function get ( $ account , $ repo , $ issueID ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/issues/%d' , $ account , $ repo , $ issueID ) ) ; } | GET an individual issue |
44,250 | public function followers ( $ account , $ repo , $ issueID ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/issues/%d/followers' , $ account , $ repo , $ issueID ) ) ; } | GET a list of an issue s followers |
44,251 | public function create ( $ account , $ repo , array $ options = array ( ) ) { if ( ! isset ( $ options [ 'title' ] ) || ! isset ( $ options [ 'content' ] ) ) { throw new \ InvalidArgumentException ( 'Arguments: "title" and "content" are mandatory.' ) ; } return $ this -> requestPost ( sprintf ( 'repositories/%s/%s/issues' , $ account , $ repo ) , $ options ) ; } | POST a new issue |
44,252 | public function update ( $ account , $ repo , $ issueID , array $ options ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/issues/%d' , $ account , $ repo , $ issueID ) , $ options ) ; } | Update existing issue |
44,253 | protected function getParametersToSign ( RequestInterface $ request ) { $ params = $ this -> getOAuthParameters ( $ request ) ; if ( $ request -> getHeader ( 'Content-Type' ) === 'application/x-www-form-urlencoded' ) { $ params = array_merge ( $ params , $ this -> getContentAsParameters ( $ request ) ) ; } return $ params ; } | Include OAuth and request body parameters |
44,254 | protected function filterOAuthParameters ( array $ include ) { $ final = array ( ) ; foreach ( $ include as $ key => $ value ) { if ( ! empty ( $ this -> config [ $ value ] ) ) { $ final [ $ value ] = $ this -> config [ $ value ] ; } } return $ final ; } | White list based filter |
44,255 | public function send ( $ account , $ repo , $ email , $ permission ) { return $ this -> requestPost ( sprintf ( 'invitations/%s/%s/%s' , $ account , $ repo , $ email ) , array ( 'permission' => $ permission ) ) ; } | Sending an invite |
44,256 | public function get ( $ account , $ repo , $ requestID , $ commentID ) { return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> get ( sprintf ( 'repositories/%s/%s/pullrequests/%d/comments/%d' , $ account , $ repo , $ requestID , $ commentID ) ) ; } | Get an individual pull request comment |
44,257 | public function update ( $ account , $ repo , $ requestID , $ commentID , $ content ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/pullrequests/%d/comments/%d' , $ account , $ repo , $ requestID , $ commentID ) , array ( 'content' => $ content ) ) ; } | Update an existing comment |
44,258 | public function delete ( $ account , $ repo , $ requestID , $ commentID ) { return $ this -> requestDelete ( sprintf ( 'repositories/%s/%s/pullrequests/%d/comments/%d' , $ account , $ repo , $ requestID , $ commentID ) ) ; } | Delete a pull request comment |
44,259 | protected function executeListeners ( RequestInterface $ request , $ when = 'preSend' , MessageInterface $ response = null ) { $ haveListeners = count ( $ this -> listeners ) > 0 ; if ( ! $ haveListeners ) { return ; } $ params = array ( $ request ) ; if ( null !== $ response ) { $ params [ ] = $ response ; } ksort ( $ this -> listeners , SORT_ASC ) ; array_walk_recursive ( $ this -> listeners , function ( $ class ) use ( $ when , $ params ) { if ( $ class instanceof ListenerInterface ) { call_user_func_array ( array ( $ class , $ when ) , $ params ) ; } } ) ; } | Execute all available listeners . |
44,260 | public function get ( $ account , $ repo , $ componentID ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/issues/components/%d' , $ account , $ repo , $ componentID ) ) ; } | Get an individual component |
44,261 | public function update ( $ account , $ repo , $ componentID , $ name ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/issues/components/%d' , $ account , $ repo , $ componentID ) , array ( 'name' => $ name ) ) ; } | Update an existing component |
44,262 | public function delete ( $ account , $ repo , $ componentID ) { return $ this -> requestDelete ( sprintf ( 'repositories/%s/%s/issues/components/%d' , $ account , $ repo , $ componentID ) ) ; } | Delete an existing component |
44,263 | public function update ( $ account , $ email , $ primary = false ) { return $ this -> requestPut ( sprintf ( 'users/%s/emails/%s' , $ account , $ email ) , array ( 'primary' => ( bool ) $ primary ) ) ; } | Update an email address |
44,264 | public function setCredentials ( Authentication \ AuthenticationInterface $ auth ) { if ( $ auth instanceof Authentication \ Basic ) { $ this -> getClient ( ) -> addListener ( new Http \ Listener \ BasicAuthListener ( $ auth -> getUsername ( ) , $ auth -> getPassword ( ) ) ) ; } $ this -> auth = $ auth ; } | Set API login credentials |
44,265 | public function requestGet ( $ endpoint , $ params = array ( ) , $ headers = array ( ) ) { return $ this -> getClient ( ) -> get ( $ endpoint , $ params , $ headers ) ; } | Make an HTTP GET request to API |
44,266 | public function requestPost ( $ endpoint , $ params = array ( ) , $ headers = array ( ) ) { return $ this -> getClient ( ) -> post ( $ endpoint , $ params , $ headers ) ; } | Make an HTTP POST request to API |
44,267 | public function requestPut ( $ endpoint , $ params = array ( ) , $ headers = array ( ) ) { return $ this -> getClient ( ) -> put ( $ endpoint , $ params , $ headers ) ; } | Make an HTTP PUT request to API |
44,268 | public function requestDelete ( $ endpoint , $ params = array ( ) , $ headers = array ( ) ) { return $ this -> getClient ( ) -> delete ( $ endpoint , $ params , $ headers ) ; } | Make a HTTP DELETE request to API |
44,269 | protected function doRequest ( $ method , $ endpoint , $ params , array $ headers ) { return $ this -> getClient ( ) -> request ( $ endpoint , $ params , $ method , $ headers ) ; } | Create HTTP request |
44,270 | protected function decodeJSON ( $ body ) { $ params = json_decode ( $ body , true ) ; if ( ! is_array ( $ params ) || ( JSON_ERROR_NONE !== json_last_error ( ) ) ) { throw new \ InvalidArgumentException ( 'Invalid JSON data provided.' ) ; } return $ params ; } | Convert JSON to array with error check |
44,271 | public function repository ( $ account , $ repo , $ privilege = null ) { return $ this -> requestGet ( sprintf ( 'privileges/%s/%s' , $ account , $ repo ) , $ this -> getRepoParams ( $ privilege ) ) ; } | Get a list of user privileges granted on a repository . |
44,272 | public function account ( $ owner , $ repo , $ account ) { return $ this -> requestGet ( sprintf ( 'privileges/%s/%s/%s' , $ owner , $ repo , $ account ) ) ; } | Get privileges for an individual . |
44,273 | public function repositories ( $ account , $ privilege = null ) { return $ this -> requestGet ( sprintf ( 'privileges/%s' , $ account ) , $ this -> getRepoParams ( $ privilege ) ) ; } | Get a list of all privileges across all an account s repositories . |
44,274 | public function grant ( $ owner , $ repo , $ account , $ privilege ) { if ( ! in_array ( $ privilege , array ( 'read' , 'write' , 'admin' ) ) ) { throw new \ InvalidArgumentException ( "Invalid privilege provided." ) ; } return $ this -> requestPut ( sprintf ( 'privileges/%s/%s/%s' , $ owner , $ repo , $ account ) , $ privilege ) ; } | Grants an account a privilege on a repository . |
44,275 | public function delete ( $ owner , $ repo = null , $ account = null ) { if ( ! is_null ( $ account ) && is_null ( $ repo ) ) { throw new \ InvalidArgumentException ( "To delete an account privileges, you need to specify a repository." ) ; } $ endpoint = sprintf ( 'privileges/%s' , $ owner ) ; if ( ! is_null ( $ repo ) ) { $ endpoint .= '/' . $ repo ; } if ( ! is_null ( $ account ) ) { $ endpoint .= '/' . $ account ; } return $ this -> requestDelete ( $ endpoint ) ; } | Delete account privileges from a repository |
44,276 | public function get ( $ account , $ repo , $ serviceID ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/services/%d' , $ account , $ repo , $ serviceID ) ) ; } | Get a single service attached to your repository |
44,277 | public function update ( $ account , $ repo , $ serviceID , array $ params ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/services/%d' , $ account , $ repo , $ serviceID ) , $ params ) ; } | Update a service |
44,278 | public function delete ( $ account , $ repo , $ serviceID ) { return $ this -> requestDelete ( sprintf ( 'repositories/%s/%s/services/%d' , $ account , $ repo , $ serviceID ) ) ; } | Delete a service |
44,279 | public function all ( $ account , $ repo , array $ params = array ( ) ) { $ endpoint = sprintf ( 'repositories/%s/%s/commits' , $ account , $ repo ) ; if ( ! empty ( $ params [ 'branch' ] ) ) { $ endpoint .= '/' . $ params [ 'branch' ] ; unset ( $ params [ 'branch' ] ) ; } return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> get ( $ endpoint , $ params ) ; } | Get a list of commits |
44,280 | public function deleteApproval ( $ account , $ repo , $ revision ) { return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> delete ( sprintf ( 'repositories/%s/%s/commit/%s/approve' , $ account , $ repo , $ revision ) ) ; } | Delete a commit approval |
44,281 | public function create ( $ account , $ groupOwner , $ groupSlug , $ email ) { return $ this -> requestPut ( sprintf ( 'users/%s/invitations/%s/%s/%s' , $ account , $ email , $ groupOwner , $ groupSlug ) ) ; } | Issues an invitation to the specified account group . |
44,282 | public function deleteByGroup ( $ account , $ groupOwner , $ groupSlug , $ email ) { return $ this -> requestDelete ( sprintf ( 'users/%s/invitations/%s/%s/%s' , $ account , $ email , $ groupOwner , $ groupSlug ) ) ; } | Delete pending invitations by group |
44,283 | public function get ( $ account , array $ filters = array ( ) ) { $ endpoint = sprintf ( 'groups/%s/' , $ account ) ; if ( ! empty ( $ filters ) ) { $ endpoint = 'groups' ; if ( isset ( $ filters [ 'group' ] ) && is_array ( $ filters [ 'group' ] ) ) { $ filters [ 'group' ] = implode ( '&group=' , $ filters [ 'group' ] ) ; } } return $ this -> requestGet ( $ endpoint , $ filters ) ; } | Get a list of groups . |
44,284 | public function all ( $ account , $ repo , $ node ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/changesets/%s/comments' , $ account , $ repo , $ node ) ) ; } | Get a list of comments on a changeset |
44,285 | public function delete ( $ account , $ repo , $ node , $ commentID ) { return $ this -> requestDelete ( sprintf ( 'repositories/%s/%s/changesets/%s/comments/%d' , $ account , $ repo , $ node , $ commentID ) ) ; } | Delete a comment on a changeset |
44,286 | public function create ( $ account , $ repo , $ node , $ content , array $ options = array ( ) ) { return $ this -> requestPost ( sprintf ( 'repositories/%s/%s/changesets/%s/comments' , $ account , $ repo , $ node ) , array_merge ( array ( 'content' => $ content ) , $ options ) ) ; } | Post a new comment on a changeset |
44,287 | public function update ( $ account , $ repo , $ node , $ commentID , $ content , array $ options = array ( ) ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/changesets/%s/comments/%d' , $ account , $ repo , $ node , $ commentID ) , array_merge ( array ( 'content' => $ content ) , $ options ) ) ; } | Update an existing changeset comment |
44,288 | public function spam ( $ account , $ repo , $ node , $ commentID ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/changesets/%s/comments/spam/%d' , $ account , $ repo , $ node , $ commentID ) ) ; } | Toggle spam flag on an existing changeset comment |
44,289 | public function get ( $ account , $ repo , $ revision , $ path ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/src/%s/%s' , $ account , $ repo , $ revision , $ path ) ) ; } | Get a list of repo source |
44,290 | public function raw ( $ account , $ repo , $ revision , $ path ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/raw/%s/%s' , $ account , $ repo , $ revision , $ path ) ) ; } | Get raw content of an individual file |
44,291 | public function all ( $ owner = null , array $ params = array ( ) ) { $ endpoint = 'repositories' ; if ( ! is_null ( $ owner ) ) { $ endpoint = sprintf ( 'repositories/%s' , $ owner ) ; } return $ this -> getClient ( ) -> setApiVersion ( '2.0' ) -> get ( $ endpoint , $ params ) ; } | Get a list of repositories . |
44,292 | public function get ( $ account , $ repo , $ versionID ) { return $ this -> requestGet ( sprintf ( 'repositories/%s/%s/issues/versions/%d' , $ account , $ repo , $ versionID ) ) ; } | Get an individual version |
44,293 | public function create ( $ account , $ repo , $ name ) { return $ this -> requestPost ( sprintf ( 'repositories/%s/%s/issues/versions' , $ account , $ repo ) , array ( 'name' => $ name ) ) ; } | Add a new version |
44,294 | public function update ( $ account , $ repo , $ versionID , $ name ) { return $ this -> requestPut ( sprintf ( 'repositories/%s/%s/issues/versions/%d' , $ account , $ repo , $ versionID ) , array ( 'name' => $ name ) ) ; } | Update an existing version |
44,295 | public function delete ( $ account , $ repo , $ versionID ) { return $ this -> requestDelete ( sprintf ( 'repositories/%s/%s/issues/versions/%d' , $ account , $ repo , $ versionID ) ) ; } | Delete an existing version |
44,296 | public function add ( $ account , $ groupSlug , $ memberName ) { return $ this -> requestPut ( sprintf ( 'groups/%s/%s/members/%s' , $ account , $ groupSlug , $ memberName ) ) ; } | Add new member into a group . |
44,297 | public function delete ( $ account , $ groupSlug , $ memberName ) { return $ this -> requestDelete ( sprintf ( 'groups/%s/%s/members/%s' , $ account , $ groupSlug , $ memberName ) ) ; } | Delete a member from group . |
44,298 | public function create ( $ account , $ key , $ label = null ) { $ params = array ( 'key' => $ key ) ; if ( ! is_null ( $ label ) ) { $ params [ 'label' ] = $ label ; } return $ this -> requestPost ( sprintf ( 'users/%s/ssh-keys' , $ account ) , $ params ) ; } | Create a key on the specified account . |
44,299 | public function update ( $ account , $ keyId , $ key ) { return $ this -> requestPut ( sprintf ( 'users/%s/ssh-keys/%d' , $ account , $ keyId ) , array ( 'key' => $ key ) ) ; } | Updates a key on the specified account . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.