public void SetEndpointPresence() { httpClient.SendPut(SkypeApiUrls.EndpointPresenceUrl(messagesHost, endpointId), JObject.FromObject(new { id = "messagingService", type = "EndpointPresenceDoc", selfLink = "uri", privateInfo = new { epname = "skype" }, publicInfo = new { capabilities = "", type = 1, typ = 1, skypeNameVersion = SkypeConstants.SkypewebClientinfoVersion + "/" + SkypeConstants.SkypewebClientinfoName, nodeInfo = "xx", version = SkypeConstants.SkypewebClientinfoVersion } }), new Dictionary <string, string> { { "RegistrationToken", registrationToken } }); }
public void GetConversations() { var response = httpClient.SendGet(SkypeApiUrls.ConversationsUrl(messagesHost), new Dictionary <string, string> { { "RegistrationToken", registrationToken } }); }
public void SetPresence(string status) { httpClient.SendPut(SkypeApiUrls.PresenceUrl(messagesHost), JObject.FromObject(new { status = status }), new Dictionary <string, string> { { "RegistrationToken", registrationToken } }); }
public void SetConsumptionHorizon(string conversation, string originalArrivalTime, string clientMessageId) { string consumptionhorizon = originalArrivalTime + ";" + 0 + ";" + clientMessageId; httpClient.SendPut(SkypeApiUrls.ConversationConsumptionHorizonUrl(messagesHost, conversation), JObject.FromObject(new { consumptionhorizon = consumptionhorizon }), new Dictionary <string, string> { { "RegistrationToken", registrationToken } }); }
public void SendMessage(string conversation, string content) { httpClient.SendPost(SkypeApiUrls.ConversationMessagesUrl(messagesHost, conversation), JObject.FromObject(new { clientmessageid = "", content = content, messagetype = "RichText", contenttype = "text" }), new Dictionary <string, string> { { "RegistrationToken", registrationToken } }); }
public SkypePoll PollSubscription(int subscription) { var response = httpClient.SendPost(SkypeApiUrls.PollSubscriptionUrl(messagesHost, subscription), "", "application/json", new Dictionary <string, string> { { "RegistrationToken", registrationToken } }); if (String.IsNullOrEmpty(response.ResponseData)) { return(null); } return(JsonConvert.DeserializeObject <SkypePoll>(response.ResponseData)); }
public SkypeAuthParams Login(LoginCredentials credentials) { var response = httpClient.SendGet(SkypeApiUrls.WebLoginUrl); var postParameters = GetPostParameters(response.ResponseData); postParameters.Add("username", credentials.UserName); postParameters.Add("password", credentials.Password); var loginUrl = SkypeApiUrls.WebLoginUrlWithQuery(postParameters["client_id"]); response = httpClient.SendPost(loginUrl, postParameters); var authParams = new SkypeAuthParams { Token = GetToken(response.ResponseData) }; var customHeaders = new Dictionary <string, string>(); customHeaders["LockAndKey"] = GetLockAndKey(); customHeaders["ClientInfo"] = GetClientInfo(); customHeaders["Authentication"] = "skypetoken=" + authParams.Token; response = httpClient.SendPost(SkypeApiUrls.EndpointsUrl, new JObject(), customHeaders); if (response.ResponseHeaders.ContainsKey("Set-RegistrationToken")) { authParams.RegistrationToken = ParseRegistrationToken(response.ResponseHeaders["Set-RegistrationToken"]); authParams.EndpointId = ParseEndpointId(response.ResponseHeaders["Set-RegistrationToken"]); // the endpoint post may be redirected to another server, in which case we need to use that // in subsequent requests authParams.MessagesHost = response.ResponseUrl.Host; } return(authParams); }
public int CreateSubscription() { var response = httpClient.SendPost(SkypeApiUrls.SubscriptionsUrl(messagesHost), JObject.FromObject(new { channelType = "httpLongPoll", interestedResources = new string[] { "/v1/users/ME/conversations/ALL/properties", "/v1/users/ME/conversations/ALL/messages", "/v1/users/ME/contacts/ALL", "/v1/threads/ALL" }, template = "raw" }), new Dictionary <string, string> { { "RegistrationToken", registrationToken } }); string location = response.ResponseHeaders["Location"]; return(int.Parse(location.Substring(location.LastIndexOf('/') + 1))); }
public void AcceptAuthRequest(string skypeName) { httpClient.SendPut(SkypeApiUrls.AcceptAuthRequestUrl(skypeName)); }
public IEnumerable <SkypeProfile> SearchContacts(string query) { return(SendAndDeserialize <IEnumerable <SkypeProfile> >(SkypeApiUrls.SearchContactsUrlWithQuery(query), new SkypeProfileConverter())); }