private ChatterResponse MakeRestCall(string call, RestSharp.Method method, Dictionary <string, string> postParams) { var request = new RestRequest("data/v25.0/chatter/" + call, method); request.AddHeader("Authorization", "Bearer " + _token.access_token); if (postParams != null) { foreach (KeyValuePair <String, String> entry in postParams) { request.AddParameter(entry.Key, entry.Value); } } /// execute the request if (logService) { string content = _client.Execute(request).Content; // raw content as string WriteLogToFile(call + " : " + method); WriteLogToFile(content); } //return content; ChatterResponse response = _client.Execute <ChatterResponse>(request).Data; return(response); }
public ChatterResponse GetPreviousPage(ChatterResponse resp) { if (resp.previousPageUrl != null) { String call = resp.nextPageUrl.Substring(resp.previousPageUrl.IndexOf("/chatter/") + 9); return(MakeRestCall(call, Method.GET, null)); } return(null); }
public ChatterResponse Unfollow(string viewerId, string ownerId) { // find the subscription for this relationship and then delete it ChatterResponse cresp = GetFollowing(viewerId); while (cresp != null && cresp.following != null) { foreach (ChatterSubscription csub in cresp.following) { if (csub.subject.id.StartsWith(ownerId)) { return(MakeRestCall("subscriptions/" + csub.id, Method.DELETE, null)); } } cresp = GetNextPage(cresp); } return(cresp); }
public ChatterResponse GetPreviousPage(ChatterResponse resp) { if (resp.previousPageUrl != null) { String call = resp.nextPageUrl.Substring(resp.previousPageUrl.IndexOf("/chatter/") + 9); return MakeRestCall(call, Method.GET, null); } return null; }