GetStream.io - Delete a feed nodejs

烂漫一生 提交于 2019-12-11 00:49:10

问题


I am using Getstream.io nodejs module.

I am creating feeds at run time and want to know if there is a way to delete a feed through code?.

I see in the code base that there is a delete interface but when I looked in to RESTFul API documentation, I did not find any end point to delete a feed.

But when I look at Ruby documentation, I see that there is way to delete a feed.

Please let me know how can I achieve deleting a feed in getstream.io from nodejs


回答1:


I was able to delete a feed using nodejs. It is just a hack but it will work.

But remember that deleting a feed means, it deletes all the activities from the feed. The feed still exists and can be seen through databrowser. The follow/following relationship still exists.

DeleteFeed = function(params,callback){
  if (params.feedId) {
     var feed = client.feed(params.feedType, params.feedId);
     //remove followings
     feed.following({limit:25,offset:0},function(err,r){
        if (!err) {
           for (var i = 0; i < r.body.results.length; i++) {
             var tempFeed = r.body.results[i].target_id.split(':');
             feed.unfollow(tempFeed[0], tempFeed[1]);
           }
        }
     });
     // do something similar as followings for followers 
     //(I did not have to worry about it hence did not write any code)
     client.delete({
       url: "feed/" + params.feedType  + "/" + params.feedId + "/",
       signature: feed.signature
     }, function (e, r) {
        //DO NOTHING
        //console.log("Error -- " + e);
        //console.log("Result -- " + JSON.stringify(r,null,2));
     });
  }
};



回答2:


The delete operation is currently not supported by the nodejs client library. There is an api endpoint that supports this operation: feed, but the delete operation is not documented on the REST docs. You can delete feeds from the databrowser on the getsream.io dashboard.



来源:https://stackoverflow.com/questions/35020776/getstream-io-delete-a-feed-nodejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!