Delete the API if and only if there are no more stages deployed on it

@return {Promise} which resolves to the ID of the API that was deleted
432653
function(apiId) {
        return module.exports.fetchExistingStages(apiId).then(function(stages) {
            // If there are no stages, then delete the API
            if (!stages || stages.length === 0) {
                return module.exports.deleteAPI(apiId);
            }

            return apiId;
        });
    }
519500
def delete_api_method(restApiId, resourcePath, httpMethod, region=None, key=None, keyid=None, profile=None):
    '''
    

    '''
    try:
        resource = describe_api_resource(restApiId, resourcePath, region=region,
                                         key=key, keyid=keyid, profile=profile).get('resource')
        if resource:
            conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
            conn.delete_method(restApiId=restApiId, resourceId=resource['id'], httpMethod=httpMethod)
            return {'deleted': True}
        return {'deleted': False, 'error': 'get API method failed: no such resource'}
    except ClientError as e:
        return {'deleted': False, 'error': __utils__['boto3.get_error'](e)}
970952
def delete(cls, id):
        '''
        
        '''
        client = cls._new_api_client()
        return client.make_request(cls, 'delete', url_params={'id': id})
387541
def goal_delete(self, goal_id, **kwargs):
        ""
        api_path = "/api/v2/goals/{goal_id}"
        api_path = api_path.format(goal_id=goal_id)
        return self.call(api_path, method="DELETE", **kwargs)
903850
function() {
        var deactivated = OpenLayers.Control.prototype.deactivate.call(this);
        if(deactivated) {
            for (var i=0, len=this.layers.length; i<len; i++) {
                var layer = this.layers[i];
                if (layer && this.clearOnDeactivate === true) {
                    var layerCache = this.layerCache;
                    var selectionLayer = layerCache[layer.id];
                    if (selectionLayer) {
                        layer.events.un({
                            "visibilitychanged": this.coupleLayerVisiblity,
                            scope: selectionLayer});
                        selectionLayer.destroy();
                        delete layerCache[layer.id];
                    }
                }
            }
        }
        return deactivated;
    }
898725
def delete_api_key(self, api_key_id):
        
        api = self._get_api(iam.DeveloperApi)
        api.delete_api_key(api_key_id)
        return
348605
@DELETE
    @Path("/{pushAppID}")
    @Produces(MediaType.APPLICATION_JSON)
    public Response deletePushApplication(@PathParam("pushAppID") String pushApplicationID) {

        PushApplication pushApp = getSearch().findByPushApplicationIDForDeveloper(pushApplicationID);

        if (pushApp != null) {
            logger.trace("Invoke service to delete a push application");
            pushAppService.removePushApplication(pushApp);
            return Response.noContent().build();
        }
        return Response.status(Status.NOT_FOUND).entity("Could not find requested PushApplicationEntity").build();
    }
278856
def delete_stage(self, ret):
        '''
        
        '''
        deploymentId = self._get_current_deployment_id()
        if deploymentId:
            result = __salt__['boto_apigateway.delete_api_stage'](restApiId=self.restApiId,
                                                                  stageName=self._stage_name,
                                                                  **self._common_aws_args)
            if not result.get('deleted'):
                ret['abort'] = True
                ret['result'] = False
                ret['comment'] = 'delete_stage delete_api_stage, {0}'.format(result.get('error'))
            else:
                # check if it is safe to delete the deployment as well.
                if not self._one_or_more_stages_remain(deploymentId):
                    result = __salt__['boto_apigateway.delete_api_deployment'](restApiId=self.restApiId,
                                                                               deploymentId=deploymentId,
                                                                               **self._common_aws_args)
                    if not result.get('deleted'):
                        ret['abort'] = True
                        ret['result'] = False
                        ret['comment'] = 'delete_stage delete_api_deployment, {0}'.format(result.get('error'))
                else:
                    ret['comment'] = 'stage {0} has been deleted.\n'.format(self._stage_name)
        else:
            # no matching stage_name/deployment found
            ret['comment'] = 'stage {0} does not exist'.format(self._stage_name)

        return ret
237175
function() {
        var deactivated = OpenLayers.Strategy.prototype.deactivate.call(this);
        if(deactivated) {
            this.clearCache();
            this.layer.events.un({
                "beforefeaturesadded": this.cacheFeatures,
                scope: this
            });
        }
        return deactivated;
    }
218459
def c_delete(api, args, verbose=False):
    
    obj = api.get_object(args['<URL>'].split('/')[-1])
    obj.delete()
    if verbose:
        return ['deleted object at', api.url(obj)]
153292
def destroy
      return render json: { errors: { message: 'Dashboard not found' } }, status: :not_found unless dashboard

      # Abort on failure
      unless dashboard.destroy
        return render json: { errors: 'Cannot destroy dashboard' }, status: :bad_request
      end

      MnoEnterprise::EventLogger.info('dashboard_delete', current_user.id, 'Dashboard Deletion', dashboard)
      head status: :ok
    end
133338
function(){

  this.manifest = {
    apiEventType: '',
    apiModelId: '', // this is the id for this module 
    routeBase: '',  // this can be overwritten
    routes: [
    ],
    routeErrorMessages: {
      conditions: 'No query conditions were specified',
      query: 'Error querying for item(s): ',
      notFound: 'No item was found.',
      find: 'No item(s) matched your criteria.',
      findOne: 'No item matched your criteria.',
      update: 'No updates were specified.',
      updateMatch: 'No items were updated based on your criteria.',
      create: 'No data supplied for creating new item.',
      createMatch: 'No item was created based on your criteria.',
      remove: 'No data supplied for removing item.',
      removeMatch: 'No item was removed based on your criteria.'
    }
  };

  // return this object
  return this;
}
559025
def destroy
      @project = Project.find params[:project_id]
      @api = @project.apis.find(params[:id])
      @api.destroy
  
      respond_to do |format|
        format.html { redirect_to project_apis_path }
        format.json { head :no_content }
      end
    end
485757
def target_delete(self, id, **kwargs):
        ""
        api_path = "/api/v2/targets/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, method="DELETE", **kwargs)
662611
def delete_api(awsclient, api_name):
    
    _sleep()
    client_api = awsclient.get_client('apigateway')

    print('deleting api: %s' % api_name)
    api = _api_by_name(awsclient, api_name)

    if api is not None:
        print(json2table(api))

        response = client_api.delete_rest_api(
            restApiId=api['id']
        )

        print(json2table(response))
    else:
        print('API name unknown')
361695
def oauth_client_delete(self, id, **kwargs):
        ""
        api_path = "/api/v2/oauth/clients/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, method="DELETE", **kwargs)
328562
def delete(self):
        
        self.requester.delete(
            '/{endpoint}/{id}', endpoint=self.endpoint,
            id=self.id
        )
        return self