public AddUrlSegment ( string key, string value ) : void | ||
key | string | |
value | string | |
Résultat | void |
/// <summary> /// Gets the tracked links. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="take">The take.</param> /// <returns>RecieveTrackedLinks.</returns> public static RecieveTrackedLinks GetTrackedLinks(this WowClient self, string clientId, int take) { var request = new RestRequest { Resource = "client/{clientId}/trackedlinks/{take}" }; request.AddUrlSegment("clientId", clientId); request.AddUrlSegment("take", take.ToString(CultureInfo.InvariantCulture)); var result = AsyncHelpers.RunSync(() => self.Client.ExecuteAsync<RecieveTrackedLinks>(request)); return result; }
/// <summary> /// Companies the details. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="leadId">The lead identifier.</param> /// <returns>CompanyDetails.</returns> public static CompanyDetails CompanyDetails(this WowClient self, string clientId, Guid leadId) { var request = new RestRequest { Resource = "client/{clientid}/company/{leadid}" }; request.AddUrlSegment("leadid", leadId.ToString()); request.AddUrlSegment("clientid", clientId); var result = AsyncHelpers.RunSync(() => self.Client.ExecuteAsync<CompanyDetails>(request)); return result; }
/// <summary> /// Companies the details. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="leadId">The lead identifier.</param> /// <returns>Task<CompanyDetails>.</returns> /// <exception cref="HttpRequestException"> /// Throws an exception if the <see cref="P:System.Net.Http.HttpResponseMessage.IsSuccessStatusCode" /> property for the HTTP response is false. /// </exception> public async static Task<CompanyDetails> CompanyDetailsAsync(this WowClient self, string clientId, Guid leadId) { var request = new RestRequest { Resource = "client/{clientid}/company/{leadid}" }; request.AddUrlSegment("leadid", leadId.ToString()); request.AddUrlSegment("clientid", clientId); var result = await self.Client.ExecuteAsync<CompanyDetails>(request); return result; }
/// <summary> /// Marks the tracked links processed. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="processId">The process identifier.</param> /// <returns>Task<System.Boolean>.</returns> /// <exception cref="HttpRequestException"> /// Throws an exception if the <see cref="P:System.Net.Http.HttpResponseMessage.IsSuccessStatusCode" /> property for the HTTP response is false. /// </exception> public async static Task<bool> MarkTrackedLinksProcessedAsync(this WowClient self, string clientId, Guid processId) { var request = new RestRequest { Resource = "client/{clientId}/trackedlinks/markprocessed/{processId}" }; request.AddHeader("api-version", "1"); request.AddUrlSegment("clientId", clientId); request.AddUrlSegment("processId", processId.ToString()); var result = await self.Client.ExecuteAsync<BasicResult>(request); return result.Result; }
private RestRequest GetPopulatedRequest(string resourceUrl) { if (string.IsNullOrWhiteSpace(TokenResponse.AccessToken)) throw new Exception(); var request = new RestRequest(resourceUrl) { ContentType = ContentTypes.Json }; request.AddUrlSegment("namespace", "music"); return request; }
/// <summary> /// Gets the latest leads. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="lastMinutes">The last minutes.</param> /// <param name="numberToGet">The number to get.</param> /// <returns>List<Lead>.</returns> /// <exception cref="System.ArgumentException">You can only get the leads for the last 60 minutes;lastMinutes</exception> public static List<Lead> GetLatestLeads(this WowClient self, string clientId, int lastMinutes, int numberToGet = 10) { if (lastMinutes > 60) { throw new ArgumentException("You can only get the leads for the last 60 minutes", "lastMinutes"); } var request = new RestRequest { Resource = "latestleads/{clientId}/{minutes}/{numberToGet}" }; request.AddUrlSegment("clientId", clientId); request.AddUrlSegment("minutes", lastMinutes.ToString()); request.AddUrlSegment("numberToGet", numberToGet.ToString()); var result = AsyncHelpers.RunSync(() => self.Client.ExecuteAsync<List<Lead>>(request)); return result; }
/// <summary> /// Gets the client details. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <returns>ClientDetails.</returns> public static ClientDetails GetClientDetails(this WowClient self, string clientId) { var request = new RestRequest { Resource = "clients/{clientId}" }; request.AddUrlSegment("clientId", clientId); var result = AsyncHelpers.RunSync(() => self.Client.ExecuteAsync<ClientDetails>(request)); return result; }
/// <summary> /// get client details as an asynchronous operation. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <returns>Task<ClientDetails>.</returns> /// <exception cref="HttpRequestException">Throws an exception if the <see cref="P:System.Net.Http.HttpResponseMessage.IsSuccessStatusCode" /> property for the HTTP response is false.</exception> public async static Task<ClientDetails> GetClientDetailsAsync(this WowClient self, string clientId) { var request = new RestRequest { Resource = "clients/{clientId}" }; request.AddUrlSegment("clientId", clientId); var result = await self.Client.ExecuteAsync<ClientDetails>(request); return result; }
/// <summary> /// Gets a new <see cref="RestRequest"/> populated with the common values for every request. /// </summary> /// <param name="resourceUrl"></param> /// <returns>A new <see cref="RestRequest"/> populated with the common values for every request</returns> private RestRequest GetPopulatedRequest(string resourceUrl) { if (string.IsNullOrWhiteSpace(TokenResponse.AccessToken)) { throw new Exception("The Xbox Music Client was unable to obtain an AccessToken from the authentication service."); } var request = new RestRequest(resourceUrl) { ContentType = ContentTypes.Json }; request.AddUrlSegment("namespace", "music"); if (!string.IsNullOrWhiteSpace(Language)) { request.AddQueryString("language", Language); } if (!string.IsNullOrWhiteSpace(Country)) { request.AddQueryString("country", Country); } return request; }
/// <summary> /// get leads as an asynchronous operation. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="type">The type.</param> /// <param name="startDate">The start date.</param> /// <param name="endDate">The end date.</param> /// <param name="page">The page.</param> /// <param name="take">The take.</param> /// <returns>Task<LeadApiPagedList>.</returns> /// <exception cref="HttpRequestException"> /// Throws an exception if the <see cref="P:System.Net.Http.HttpResponseMessage.IsSuccessStatusCode" /> property for the HTTP response is false. /// </exception> public async static Task<LeadApiPagedList> GetLeadsAsync(this WowClient self, string clientId, string type, DateTime startDate, DateTime endDate, int page, int take) { var request = new RestRequest { Resource = "client/{clientId}/leads/{type}/{startDate}/{endDate}/{page}/{take}", ContentType = ContentTypes.Json }; request.AddUrlSegment("clientId", clientId); request.AddUrlSegment("type", type); request.AddUrlSegment("startDate", startDate.ToString("yyyy-MM-dd")); request.AddUrlSegment("endDate", endDate.ToString("yyyy-MM-dd")); request.AddUrlSegment("page", page.ToString()); request.AddUrlSegment("take", take.ToString()); var result = await self.Client.ExecuteAsync<LeadApiPagedList>(request); return result; }
/// <summary> /// Gets the lead types. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <returns>List<LeadTypeCount>.</returns> public static List<LeadTypeCount> GetLeadTypes(this WowClient self, string clientId) { var request = new RestRequest { Resource = "client/{clientId}/leads/types" }; request.AddUrlSegment("clientId", clientId); var result = AsyncHelpers.RunSync(() => self.Client.ExecuteAsync<List<LeadTypeCount>>(request)); return result; }
/// <summary> /// get lead types as an asynchronous operation. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <returns>Task<List<LeadTypeCount>>.</returns> /// <exception cref="HttpRequestException"> /// Throws an exception if the <see cref="P:System.Net.Http.HttpResponseMessage.IsSuccessStatusCode" /> property for the HTTP response is false. /// </exception> public async static Task<List<LeadTypeCount>> GetLeadTypesAsync(this WowClient self, string clientId) { var request = new RestRequest { Resource = "client/{clientId}/leads/types" }; request.AddUrlSegment("clientId", clientId); var result = await self.Client.ExecuteAsync<List<LeadTypeCount>>(request); return result; }
/// <summary> /// Gets the lead types. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="startDate">The start date.</param> /// <param name="endDate">The end date.</param> /// <returns>List<LeadTypeCount>.</returns> public static List<LeadTypeCount> GetLeadTypes(this WowClient self, string clientId, DateTime startDate, DateTime endDate) { var request = new RestRequest { Resource = "client/{clientId}/leads/types/{startDate}/{endDate}" }; request.AddUrlSegment("clientId", clientId); request.AddUrlSegment("startDate", startDate.ToString("yyyy-MM-dd")); request.AddUrlSegment("endDate", endDate.ToString("yyyy-MM-dd")); var result = AsyncHelpers.RunSync(() => self.Client.ExecuteAsync<List<LeadTypeCount>>(request)); return result; }
/// <summary> /// Gets the lead. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="leadId">The lead identifier.</param> /// <returns>Lead.</returns> public static Lead GetLead(this WowClient self, string clientId, Guid leadId) { var request = new RestRequest { Resource = "client/{clientId}/lead/{leadId}" }; request.AddUrlSegment("clientId", clientId); request.AddUrlSegment("leadId", leadId.ToString()); var result = AsyncHelpers.RunSync(() => self.Client.ExecuteAsync<Lead>(request)); return result; }
/// <summary> /// Gets the lead. /// </summary> /// <param name="self">The self.</param> /// <param name="clientId">The client identifier.</param> /// <param name="leadId">The lead identifier.</param> /// <returns>Task<Lead>.</returns> /// <exception cref="HttpRequestException">Throws an exception if the <see cref="P:System.Net.Http.HttpResponseMessage.IsSuccessStatusCode" /> property for the HTTP response is false.</exception> public async static Task<Lead> GetLeadAsync(this WowClient self, string clientId, Guid leadId) { var request = new RestRequest { Resource = "client/{clientId}/lead/{leadId}" }; request.AddUrlSegment("clientId", clientId); request.AddUrlSegment("leadId", leadId.ToString()); var result = await self.Client.ExecuteAsync<Lead>(request); return result; }
private RestRequest GetPopulatedRequest(string resourceUrl) { if (string.IsNullOrWhiteSpace(Token.AccessToken)) { throw new Exception("Unable to obtain an AccessToken."); } var request = new RestRequest(resourceUrl) {ContentType = ContentTypes.Json}; request.AddUrlSegment("namespace", "music"); if (!string.IsNullOrWhiteSpace(Language)) request.AddQueryString("language", Language); if (!string.IsNullOrWhiteSpace(Country)) request.AddQueryString("country", Country); return request; }