@@ -550,6 +550,49 @@ class Repository extends Requestable {
550
550
return this . _request ( 'DELETE' , `/repos/${ this . __fullname } /hooks/${ id } ` , null , cb ) ;
551
551
}
552
552
553
+ /**
554
+ * List the deploy keys for the repository
555
+ * @see https://developer.github.com/v3/repos/keys/#list-deploy-keys
556
+ * @param {Requestable.callback } cb - will receive the list of deploy keys
557
+ * @return {Promise } - the promise for the http request
558
+ */
559
+ listKeys ( cb ) {
560
+ return this . _request ( 'GET' , `/repos/${ this . __fullname } /keys` , null , cb ) ;
561
+ }
562
+
563
+ /**
564
+ * Get a deploy key for the repository
565
+ * @see https://developer.github.com/v3/repos/keys/#get-a-deploy-key
566
+ * @param {number } id - the id of the deploy key
567
+ * @param {Requestable.callback } cb - will receive the details of the deploy key
568
+ * @return {Promise } - the promise for the http request
569
+ */
570
+ getKey ( id , cb ) {
571
+ return this . _request ( 'GET' , `/repos/${ this . __fullname } /keys/${ id } ` , null , cb ) ;
572
+ }
573
+
574
+ /**
575
+ * Add a new deploy key to the repository
576
+ * @see https://developer.github.com/v3/repos/keys/#add-a-new-deploy-key
577
+ * @param {Object } options - the configuration describing the new deploy key
578
+ * @param {Requestable.callback } cb - will receive the new deploy key
579
+ * @return {Promise } - the promise for the http request
580
+ */
581
+ createKey ( options , cb ) {
582
+ return this . _request ( 'POST' , `/repos/${ this . __fullname } /keys` , options , cb ) ;
583
+ }
584
+
585
+ /**
586
+ * Delete a deploy key
587
+ * @see https://developer.github.com/v3/repos/keys/#remove-a-deploy-key
588
+ * @param {number } id - the id of the deploy key to be deleted
589
+ * @param {Requestable.callback } cb - will receive true if the call is successful
590
+ * @return {Promise } - the promise for the http request
591
+ */
592
+ deleteKey ( id , cb ) {
593
+ return this . _request ( 'DELETE' , `/repos/${ this . __fullname } /keys/${ id } ` , null , cb ) ;
594
+ }
595
+
553
596
/**
554
597
* Delete a file from a branch
555
598
* @see https://developer.github.com/v3/repos/contents/#delete-a-file
0 commit comments