public override Response Stream(Uri url, HttpMethod method, Func<HttpWebResponse, bool, Response> responseBuilderCallback, Stream contents, int bufferSize, long maxReadLength, Dictionary<string, string> headers, Dictionary<string, string> queryStringParameters, RequestSettings settings, Action<long> progressUpdated) { if (settings == null) settings = new JsonRequestSettings(); return base.Stream(url, method, responseBuilderCallback, contents, bufferSize, maxReadLength, headers, queryStringParameters, settings, progressUpdated); }
public static void Exec(string[] args) { Console.WriteLine("*** GetDocList ***"); Console.WriteLine("--- START ---"); string username = args[1]; string password = args[2]; GDataCredentials credentials = new GDataCredentials(username, password); RequestSettings settings = new RequestSettings("GDocBackup", credentials); settings.AutoPaging = true; settings.PageSize = 100; DocumentsRequest request = new DocumentsRequest(settings); Feed<Document> feed = request.GetEverything(); List<Document> docs = new List<Document>(); foreach (Document entry in feed.Entries) docs.Add(entry); StreamWriter outFile = new StreamWriter("doclist.txt", false); StreamWriter outFile2 = new StreamWriter("doclistdetails.txt", false); foreach (Document doc in docs) { string s = doc.Title + "\t" + doc.ResourceId; Console.WriteLine(s); outFile.WriteLine(s); outFile2.WriteLine(s); foreach (string pf in doc.ParentFolders) outFile2.WriteLine("\t\t\t" + pf); } outFile.Close(); outFile2.Close(); Console.WriteLine("--- END ---"); }
public static void ExportDocList(string outFolder, string username, string password) { GDataCredentials credentials = new GDataCredentials(username, password); RequestSettings settings = new RequestSettings("GDocBackup", credentials); settings.AutoPaging = true; settings.PageSize = 100; DocumentsRequest request = new DocumentsRequest(settings); Feed<Document> feed = request.GetEverything(); List<Document> docs = new List<Document>(); foreach (Document entry in feed.Entries) docs.Add(entry); using (StreamWriter outFile = new StreamWriter(Path.Combine(outFolder, "doclist.txt"), false), outFile2 = new StreamWriter(Path.Combine(outFolder, "doclistdetails.txt"), false)) { foreach (Document doc in docs) { string s = doc.Title + "\t" + doc.ResourceId; outFile.WriteLine(s); outFile2.WriteLine(s); foreach (string pf in doc.ParentFolders) outFile2.WriteLine("\t\t\t" + pf); } outFile.Close(); outFile2.Close(); } }
public override Response Execute(Uri url, HttpMethod method, Func<HttpWebResponse, bool, Response> responseBuilderCallback, string body, Dictionary<string, string> headers, Dictionary<string, string> queryStringParameters, RequestSettings settings) { if (settings == null) settings = new JsonRequestSettings(); return base.Execute(url, method, responseBuilderCallback, body, headers, queryStringParameters, settings); }
public GoogleContactsRepository(AbstractContactsConfiguration credentials) { _settings = new RequestSettings(credentials.ApplicationName, credentials.Username, credentials.Password) { AutoPaging = true }; }
public Model.Webhook GetWebhook(string resourceGroupName, string automationAccountName, string name) { Requires.Argument("ResourceGroupName", resourceGroupName).NotNull(); Requires.Argument("AutomationAccountName", automationAccountName).NotNull(); using (var request = new RequestSettings(this.automationManagementClient)) { try { var webhook = this.automationManagementClient.Webhooks.Get(resourceGroupName, automationAccountName, name) .Webhook; if (webhook == null) { throw new ResourceNotFoundException( typeof(Webhook), string.Format(CultureInfo.CurrentCulture, Resources.WebhookNotFound, name)); } return new Model.Webhook(resourceGroupName, automationAccountName, webhook); } catch (CloudException cloudException) { if (cloudException.Response.StatusCode == HttpStatusCode.NotFound) { throw new ResourceNotFoundException( typeof(Webhook), string.Format(CultureInfo.CurrentCulture, Resources.WebhookNotFound, name)); } throw; } } }
public bool Extract(NetworkCredential credential, out MailContactList list) { bool result = false; list = new MailContactList(); try { var rs = new RequestSettings("eStream-AspNetDating", credential.UserName, credential.Password) {AutoPaging = true}; var cr = new ContactsRequest(rs); Feed<Contact> f = cr.GetContacts(); foreach (Contact e in f.Entries) { foreach (var email in e.Emails) { var mailContact = new MailContact {Email = email.Address, Name = e.Title}; list.Add(mailContact); } } result = true; } catch (Exception ex) { Global.Logger.LogError(ex); } return result; }
public void Test() { RequestSettings settings = new RequestSettings("yourApp"); settings.PageSize = 50000; settings.AutoPaging = true; PicasaRequest pr = new PicasaRequest(settings); pr.Service = GetPicasaService(); Feed<Photo> feed = pr.GetPhotos(); int cnt = 0; Photo x = null; foreach (Photo p in feed.Entries) { if (p.Title.ToLower() == "2005-12-16Kovalev_Zachet.avi".ToLower()) { x = p; break; } cnt++; } var longTime = (DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalMilliseconds; x.Timestamp = Convert.ToUInt64(longTime); pr.Update(x); Console.WriteLine(cnt); }
public GridBindingSettings(IGrid grid) { this.grid = grid; Custom = new RequestSettings(); Edit = new RequestSettings(); Show = new RequestSettings(); Delete = new RequestSettings(); }
private ContactsRequest GetGoogleRequest() { if (_googleContactRequest == null) { RequestSettings rs = new RequestSettings("Avega.ContactSynchronizer", GoogleAuthentication.Username, GoogleAuthentication.Password); rs.AutoPaging = true; _googleContactRequest = new ContactsRequest(rs); } return _googleContactRequest; }
public GContact(RequestSettings rs, IContact other) { //System.Windows.Forms.MessageBox.Show("Creating a new Google contact for " + other.ToString() + " in memory"); _rs = rs; _item = new Google.Contacts.Contact(); _item.AtomEntry = new Google.GData.Contacts.ContactEntry(); MergeFrom(other); }
public string Get() { RequestSettings settings = new RequestSettings("YOUR_APPLICATION_NAME"); // Add authorization token. // ... ContactsRequest cr = new ContactsRequest(settings); return "ok"; }
private bool Authenticate(string user, string pass) { _user = user; _pass = pass; _rs = new RequestSettings("GContactSync", _user, _pass); // AutoPaging results in automatic paging in order to retrieve all contacts _rs.AutoPaging = true; return true; }
public DirectoryInfo GetConfigurationContent(string resourceGroupName, string automationAccountName, string configurationName, bool? isDraft, string outputFolder, bool overwriteExistingFile) { using (var request = new RequestSettings(this.automationManagementClient)) { if (isDraft != null) { throw new NotImplementedException(string.Format(CultureInfo.CurrentCulture, Resources.ConfigurationDraftMode)); } try { var configuration = this.automationManagementClient.Configurations.GetContent(resourceGroupName, automationAccountName, configurationName); if (configuration == null) { throw new ResourceNotFoundException(typeof(ConfigurationContent), string.Format(CultureInfo.CurrentCulture, Resources.ConfigurationContentNotFound, configurationName)); } string outputFolderFullPath = this.GetCurrentDirectory(); if (!string.IsNullOrEmpty(outputFolder)) { outputFolderFullPath = this.ValidateAndGetFullPath(outputFolder); } var slot = (isDraft == null) ? Constants.Published : Constants.Draft; const string FileExtension = ".ps1"; var outputFilePath = outputFolderFullPath + "\\" + configurationName + FileExtension; // file exists and overwrite Not specified if (File.Exists(outputFilePath) && !overwriteExistingFile) { throw new ArgumentException( string.Format(CultureInfo.CurrentCulture, Resources.ConfigurationAlreadyExists, outputFilePath)); } // Write to the file this.WriteFile(outputFilePath, configuration.Content); return new DirectoryInfo(configurationName + FileExtension); } catch (CloudException cloudException) { if (cloudException.Response.StatusCode == HttpStatusCode.NotFound) { throw new ResourceNotFoundException(typeof(ConfigurationContent), string.Format(CultureInfo.CurrentCulture, Resources.ConfigurationContentNotFound, configurationName)); } throw; } } }
/// <summary> /// constructs a new ProfilesManager and authenticate using 2-Legged OAuth /// </summary> /// <param name="consumerKey">Domain's consumer key</param> /// <param name="consumerSecret">Domain's consumer secret</param> /// <param name="adminEmail">Domain administrator's email</param> public ProfilesManager(String consumerKey, String consumerSecret, String adminEmail) { String admin = adminEmail.Substring(0, adminEmail.IndexOf('@')); this.domain = adminEmail.Substring(adminEmail.IndexOf('@') + 1); RequestSettings settings = new RequestSettings("GoogleInc-UnshareProfilesSample-1", consumerKey, consumerSecret, admin, this.domain); settings.AutoPaging = true; this.cr = new ContactsRequest(settings); this.BatchSize = 100; }
public void AddSite() { RequestSettings settings = new RequestSettings("NETUnittests", this.userName, this.passWord); WebmasterToolsRequest f = new WebmasterToolsRequest(settings); Sites site = new Sites(); site.AtomEntry = new AtomEntry(); site.AtomEntry.Content.Src = "http://www.example-five.com/"; site.AtomEntry.Content.Type = "text/plain"; Sites newSite = f.AddSite(site); Assert.IsNotNull(newSite); }
public ActionResult Delete(string id) { var webRequestManager = new HttpWebRequestManager(); var url = Constants.ServerApi + "Users/" + id ; var requestConfig = new RequestSettings { Method = HttpMethod.Delete, }; var headers = ServiceHelper.AddHeaders("application/json"); var response = webRequestManager.GetResponse(url, requestConfig, headers, null, null); var result = JsonConvert.Deserialize<User>(response); return RedirectToAction("Index"); }
public ActionResult Index() { var webRequestManager = new HttpWebRequestManager(); var url = Constants.ServerApi + "Users"; var requestConfig = new RequestSettings { Method = HttpMethod.Get, }; var headers = ServiceHelper.AddHeaders("application/json"); var response = webRequestManager.GetResponse(url, requestConfig, headers, null, null); var result = JsonConvert.Deserialize<List<User>>(response); return View(result); }
public void TestWebmasterToolsKeywordsRequest() { Tracing.TraceMsg("Entering Webmaster Tools Keywords RequestTest"); RequestSettings settings = new RequestSettings("NETUnittests", this.userName, this.passWord); WebmasterToolsRequest f = new WebmasterToolsRequest(settings); Feed<Keywords> keywords = f.GetKeywords("http%3A%2F%2Fwww%2Eexample%2Ecom%2F"); foreach (Keywords keyword in keywords.Entries) { Assert.IsTrue(keyword.AtomEntry != null, "There should be an atomentry"); } }
public void TestWebmasterToolsCrawlIssuesRequest() { Tracing.TraceMsg("Entering Webmaster Tools Crawl Issues RequestTest"); RequestSettings settings = new RequestSettings("NETUnittests", this.userName, this.passWord); WebmasterToolsRequest f = new WebmasterToolsRequest(settings); Feed<CrawlIssues> crawlIssues = f.GetCrawlIssues("http%3A%2F%2Fwww%2Eexample%2Ecom%2F"); foreach (CrawlIssues crawlIssue in crawlIssues.Entries) { Assert.IsTrue(crawlIssue.AtomEntry != null, "There should be an atomentry"); } }
public Model.Webhook CreateWebhook( string resourceGroupName, string automationAccountName, string name, string runbookName, bool isEnabled, DateTimeOffset expiryTime, Hashtable runbookParameters) { Requires.Argument("ResourceGroupName", resourceGroupName).NotNull(); Requires.Argument("AutomationAccountName", automationAccountName).NotNull(); using (var request = new RequestSettings(this.automationManagementClient)) { var rbAssociationProperty = new RunbookAssociationProperty { Name = runbookName }; var createOrUpdateProperties = new WebhookCreateOrUpdateProperties { IsEnabled = isEnabled, ExpiryTime = expiryTime, Runbook = rbAssociationProperty, Uri = this.automationManagementClient .Webhooks.GenerateUri( resourceGroupName, automationAccountName).Uri }; if (runbookParameters != null) { createOrUpdateProperties.Parameters = runbookParameters.Cast<DictionaryEntry>() .ToDictionary(kvp => (string)kvp.Key, kvp => (string)kvp.Value); } var webhookCreateOrUpdateParameters = new WebhookCreateOrUpdateParameters( name, createOrUpdateProperties); var webhook = this.automationManagementClient.Webhooks.CreateOrUpdate( resourceGroupName, automationAccountName, webhookCreateOrUpdateParameters).Webhook; return new Model.Webhook( resourceGroupName, automationAccountName, webhook, webhookCreateOrUpdateParameters.Properties.Uri); } }
private void GetDocListExec() { WriteMessage("*** GetDocList ***"); WriteMessage("--- START ---"); try { string username = tbUserName.Text; ; string password = tbPassword.Text; GDataCredentials credentials = new GDataCredentials(username, password); RequestSettings settings = new RequestSettings("GDocBackup", credentials); settings.AutoPaging = true; settings.PageSize = 100; DocumentsRequest request = new DocumentsRequest(settings); Feed<Document> feed = request.GetEverything(); List<Document> docs = new List<Document>(); foreach (Document entry in feed.Entries) docs.Add(entry); StreamWriter outFile = new StreamWriter("doclist.txt", false); StreamWriter outFile2 = new StreamWriter("doclistdetails.txt", false); WriteMessage("Exporting document list. Please wait..."); foreach (Document doc in docs) { string s = doc.Title + "\t" + doc.ResourceId; //WriteMessage(s); outFile.WriteLine(s); outFile2.WriteLine(s); foreach (string pf in doc.ParentFolders) outFile2.WriteLine("\t\t\t" + pf); } WriteMessage("Created file: doclist.txt"); WriteMessage("Created file: doclistdetails.txt"); outFile.Close(); outFile2.Close(); } catch (Exception ex) { WriteMessage("EXCEPTION: " + ex.ToString()); } WriteMessage("--- END ---"); }
public ActionResult Create(User user) { var webRequestManager = new HttpWebRequestManager(); var json = JsonConvert.Serialize(user); var url = Constants.ServerApi + "Users"; var requestConfig = new RequestSettings { Method = HttpMethod.Post, }; var headers = ServiceHelper.AddHeaders("application/json"); var response = webRequestManager.GetResponse(url, requestConfig, headers, null, json); var result = JsonConvert.Deserialize<User>(response); return RedirectToAction("Index"); //return View(); }
private List<Survey> GetSurveyListRequest(RequestSettings parameters) { try { const string endPoint = "/surveys/get_survey_list"; var o = MakeApiRequest(endPoint, parameters); List<JsonDeserializeGetSurveyList> rawSurveys = o["surveys"].ToObject<List<JsonDeserializeGetSurveyList>>(); List<Survey> surveys = rawSurveys.Select(x => x.ToSurvey()).ToList(); return surveys; } catch (Exception e) { throw new SurveyMonkeyException("Error communicating with endpoint", e); } }
static void Main(string[] args) { var email = inputReader.GetInput("Enter your email: "); var password = inputReader.GetPassword("Your Password: "******"linq2ga", email, password); var request = new AnalyticsRequest(settings); messenger.Send("Please wait. Loading your Accounts... "); var accounts = request.GetAccounts(); foreach (var account in accounts.Entries) messenger.Send(account.AccountName); inputReader.GetInput("... press enter to continue ..."); }
public Form1() { InitializeComponent(); GoogleClientLogin loginDialog = new GoogleClientLogin(new DocumentsService("GoogleDocumentsSample"), "*****@*****.**"); if (loginDialog.ShowDialog() == DialogResult.OK) { RequestSettings settings = new RequestSettings("GoogleDocumentsSample", loginDialog.Credentials); settings.AutoPaging = true; settings.PageSize = 100; if (settings != null) { this.request = new DocumentsRequest(settings); this.Text = "Successfully logged in"; Feed<Document> feed = this.request.GetEverything(); // this takes care of paging the results in foreach (Document entry in feed.Entries) { all.Add(entry); } TreeNode noFolder = null; noFolder = new TreeNode("Items with no folder"); this.documentsView.Nodes.Add(noFolder); noFolder.SelectedImageIndex = 0; noFolder.ImageIndex = 0; foreach (Document entry in all) { // let's add those with no parents for the toplevel if (entry.ParentFolders.Count == 0) { if (entry.Type != Document.DocumentType.Folder) { AddToTreeView(noFolder.Nodes, entry); } else { TreeNode n = AddToTreeView(this.documentsView.Nodes, entry); AddAllChildren(n.Nodes, entry); } } } } } }
/// <summary> /// Send authorized queries to a Request-based library /// </summary> /// <param name="service"></param> private static void RunContactsSample(OAuth2Parameters parameters) { try { RequestSettings settings = new RequestSettings(applicationName, parameters); ContactsRequest cr = new ContactsRequest(settings); Feed<Contact> f = cr.GetContacts(); foreach (Contact c in f.Entries) { Console.WriteLine(c.Name.FullName); } } catch (AppsException a) { Console.WriteLine("A Google Apps error occurred."); Console.WriteLine(); Console.WriteLine("Error code: {0}", a.ErrorCode); Console.WriteLine("Invalid input: {0}", a.InvalidInput); Console.WriteLine("Reason: {0}", a.Reason); } }
public override bool Execute() { GDataCredentials credentials = GetDataCredentials(); RequestSettings settings = new RequestSettings("code.google.com/p/exult/", credentials); settings.AutoPaging = true; settings.PageSize = 100; DocumentsRequest request = new DocumentsRequest(settings); Feed<Document> feed = request.GetFolders(); List<ITaskItem> outputs = new List<ITaskItem>(); // this takes care of paging the results in List<Document> entries = feed.Entries.ToList(); IDictionary<string, Document> documentDictionary = entries.ToDictionary(item => item.Self); RequireDirectory(TargetDirectory); foreach (Document entry in entries) { if (_Cancelled) { return false; } List<PathMapping> paths = GetPaths(entry, documentDictionary).ToList(); //handle each path, as we may allow multiple locations for a collection foreach (PathMapping path in paths) { if (Pattern == null || PatternExpression.IsMatch(path.TitlePath)) { Log.LogMessage(MessageImportance.High, "Matched \"{0}\"", path.TitlePath); outputs.Add(BuildFolder(entry, path)); } else { Log.LogMessage(MessageImportance.Low, "Skipped \"{0}\"", path.TitlePath); } } } Folders = outputs.ToArray(); return true; }
public Model.DscConfiguration GetConfiguration( string resourceGroupName, string automationAccountName, string configurationName) { using (var request = new RequestSettings(this.automationManagementClient)) { Requires.Argument("ResourceGroupName", resourceGroupName).NotNull(); Requires.Argument("AutomationAccountName", automationAccountName).NotNull(); Requires.Argument("ConfigurationName", configurationName).NotNull(); var configuration = this.automationManagementClient.Configurations.Get( resourceGroupName, automationAccountName, configurationName).Configuration; return new Model.DscConfiguration(resourceGroupName, automationAccountName, configuration); } }
protected void btnContacts_Click(object sender, EventArgs e) { //Provide Login Information ViewState["hello"] = txtPassword.Text; RequestSettings rsLoginInfo = new RequestSettings("", txtEmail.Text, txtPassword.Text); rsLoginInfo.AutoPaging = true; // Fetch contacts and dislay them in ListBox ContactsRequest cRequest = new ContactsRequest(rsLoginInfo); Feed<Contact> feedContacts = cRequest.GetContacts(); foreach (Contact gmailAddresses in feedContacts.Entries) { foreach (EMail emailId in gmailAddresses.Emails) { RadListBoxItem item = new RadListBoxItem(); item.Text = emailId.Address; RadListBoxSource.Items.Add(item); } } }
internal HttpCallProxy(RequestSettings settings, EndpointConfig config) { _settings = settings; _endpointConfig = config; }
private HttpRequestMessage BuildHttpRequestMessage <T>(string method, string path, List <KeyValuePair <string, object> > urlParams, object requestParams, string payloadKey, RequestSettings requestSettings) where T : ApiResponse { { //insert url arguments into template foreach (var arg in urlParams) { path = path.Replace(":" + arg.Key, Helpers.Stringify(arg.Value)); } } { //add querystring for GET requests if (method == "GET") { var requestArguments = Helpers.ExtractQueryStringValuesFromObject(requestParams); if (requestArguments.Count > 0) { var queryString = String.Join("&", requestArguments.Select(Helpers.QueryStringArgument)); path += "?" + queryString; } } } var httpMethod = new HttpMethod(method); var requestMessage = new HttpRequestMessage(httpMethod, new Uri(_baseUrl, path)); requestMessage.Headers.Add("User-Agent", "gocardless-dotnet/2.15.0"); requestMessage.Headers.Add("GoCardless-Version", "2015-07-06"); requestMessage.Headers.Add("GoCardless-Client-Version", "2.15.0"); requestMessage.Headers.Add("GoCardless-Client-Library", "gocardless-dotnet"); requestMessage.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", _accessToken); { //add request body for non-GETs if (method != "GET") { if (requestParams != null) { var settings = new Newtonsoft.Json.JsonSerializerSettings { Formatting = Formatting.Indented, NullValueHandling = NullValueHandling.Ignore }; var serializer = JsonSerializer.Create(settings); StringBuilder sb = new StringBuilder(); using (var sw = new StringWriter(sb)) { var jo = new JObject(); using (var jsonTextWriter = new LinuxLineEndingJsonTextWriter(sw)) { serializer.Serialize(jsonTextWriter, requestParams); jo[payloadKey] = JToken.Parse(sb.ToString()); } requestMessage.Content = new StringContent(jo.ToString(Formatting.Indented), Encoding.UTF8, "application/json"); } } } } var hasIdempotencyKey = requestParams as IHasIdempotencyKey; if (hasIdempotencyKey != null) { hasIdempotencyKey.IdempotencyKey = hasIdempotencyKey.IdempotencyKey ?? Guid.NewGuid().ToString(); requestMessage.Headers.TryAddWithoutValidation("Idempotency-Key", hasIdempotencyKey.IdempotencyKey); } if (requestSettings != null) { foreach (var header in requestSettings.Headers) { if (requestMessage.Headers.Contains(header.Key)) { requestMessage.Headers.Remove(header.Key); } requestMessage.Headers.Add(header.Key, header.Value); } } requestSettings?.CustomiseRequestMessage?.Invoke(requestMessage); return(requestMessage); }
public TestGETRequest(RequestSettings settings) : base(settings) { }
/// <summary> /// default constructor for a YouTubeRequest /// </summary> /// <param name="settings"></param> public ContactsRequest(RequestSettings settings) : base(settings) { this.Service = new ContactsService(settings.Application); PrepareService(); }
/// <summary> /// Returns a [cursor-paginated](#api-usage-cursor-pagination) list of /// your payments. /// </summary> /// <param name="request">An optional `PaymentListRequest` representing the query parameters for this list request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A set of payment resources</returns> public Task <PaymentListResponse> ListAsync(PaymentListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new PaymentListRequest(); var urlParams = new List <KeyValuePair <string, object> > { }; return(_goCardlessClient.ExecuteAsync <PaymentListResponse>(HttpMethod.Get, "/payments", urlParams, request, null, null, customiseRequestMessage)); }
/// <summary> /// Get a lazily enumerated list of payments. /// This acts like the #list method, but paginates for you automatically. /// </summary> public IEnumerable <Task <IReadOnlyList <Payment> > > AllAsync(PaymentListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new PaymentListRequest(); return(new TaskEnumerable <IReadOnlyList <Payment>, string>(async after => { request.After = after; var list = await this.ListAsync(request, customiseRequestMessage); return Tuple.Create(list.Payments, list.Meta?.Cursors?.After); })); }
/// <summary> /// Retrieves the details of a tax rate. /// </summary> /// <param name="identity">The unique identifier created by the jurisdiction, tax type and version</param> /// <param name="request">An optional `TaxRateGetRequest` representing the query parameters for this get request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A single tax rate resource</returns> public Task <TaxRateResponse> GetAsync(string identity, TaxRateGetRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new TaxRateGetRequest(); if (identity == null) { throw new ArgumentException(nameof(identity)); } var urlParams = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("identity", identity), }; return(_goCardlessClient.ExecuteAsync <TaxRateResponse>("GET", "/tax_rates/:identity", urlParams, request, null, null, customiseRequestMessage)); }
/// <summary> /// Returns a [cursor-paginated](#api-usage-cursor-pagination) list of /// all tax rates. /// </summary> /// <param name="request">An optional `TaxRateListRequest` representing the query parameters for this list request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A set of tax rate resources</returns> public Task <TaxRateListResponse> ListAsync(TaxRateListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new TaxRateListRequest(); var urlParams = new List <KeyValuePair <string, object> > { }; return(_goCardlessClient.ExecuteAsync <TaxRateListResponse>("GET", "/tax_rates", urlParams, request, null, null, customiseRequestMessage)); }
private T ExecuteRESTRequest <T>(CloudIdentity identity, Uri absoluteUri, HttpMethod method, object body, Dictionary <string, string> queryStringParameter, Dictionary <string, string> headers, bool isRetry, RequestSettings requestSettings, Func <Uri, HttpMethod, string, Dictionary <string, string>, Dictionary <string, string>, RequestSettings, T> callback) where T : Response { identity = GetDefaultIdentity(identity); if (requestSettings == null) { requestSettings = BuildDefaultRequestSettings(); } if (headers == null) { headers = new Dictionary <string, string>(); } headers["X-Auth-Token"] = IdentityProvider.GetToken(identity, isRetry).Id; string bodyStr = null; if (body != null) { if (body is JObject) { bodyStr = body.ToString(); } else if (body is string) { bodyStr = body as string; } else { bodyStr = JsonConvert.SerializeObject(body, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); } } if (string.IsNullOrWhiteSpace(requestSettings.UserAgent)) { requestSettings.UserAgent = GetUserAgentHeaderValue(); } var response = callback(absoluteUri, method, bodyStr, headers, queryStringParameter, requestSettings); // on errors try again 1 time. if (response.StatusCode == HttpStatusCode.Unauthorized) { if (!isRetry) { return(ExecuteRESTRequest <T>(identity, absoluteUri, method, body, queryStringParameter, headers, true, requestSettings, callback)); } } CheckResponse(response); return(response); }
protected Response ExecuteRESTRequest(CloudIdentity identity, Uri absoluteUri, HttpMethod method, Func <HttpWebResponse, bool, Response> buildResponseCallback, object body = null, Dictionary <string, string> queryStringParameter = null, Dictionary <string, string> headers = null, bool isRetry = false, RequestSettings settings = null) { return(ExecuteRESTRequest <Response>(identity, absoluteUri, method, body, queryStringParameter, headers, isRetry, settings, (uri, requestMethod, requestBody, requestHeaders, requestQueryParams, requestSettings) => RestService.Execute(uri, requestMethod, buildResponseCallback, requestBody, requestHeaders, requestQueryParams, requestSettings))); }
protected Response StreamRESTRequest(CloudIdentity identity, Uri absoluteUri, HttpMethod method, Stream stream, int chunkSize, long maxReadLength = 0, Dictionary <string, string> queryStringParameter = null, Dictionary <string, string> headers = null, bool isRetry = false, RequestSettings requestSettings = null, Action <long> progressUpdated = null) { identity = GetDefaultIdentity(identity); if (requestSettings == null) { requestSettings = BuildDefaultRequestSettings(); } requestSettings.Timeout = TimeSpan.FromMilliseconds(14400000); // Need to pass this in. if (headers == null) { headers = new Dictionary <string, string>(); } headers["X-Auth-Token"] = IdentityProvider.GetToken(identity, isRetry).Id; if (string.IsNullOrWhiteSpace(requestSettings.UserAgent)) { requestSettings.UserAgent = GetUserAgentHeaderValue(); } var response = RestService.Stream(absoluteUri, method, stream, chunkSize, maxReadLength, headers, queryStringParameter, requestSettings, progressUpdated); // on errors try again 1 time. if (response.StatusCode == HttpStatusCode.Unauthorized) { if (!isRetry) { return(StreamRESTRequest(identity, absoluteUri, method, stream, chunkSize, maxReadLength, queryStringParameter, headers, isRetry, requestSettings, progressUpdated)); } } CheckResponse(response); return(response); }
private async Task <Response> GetRequestSettings() { return(Response.AsJson(await RequestSettings.GetSettingsAsync())); }
/// <summary> /// Creates a new creditor. /// </summary> /// <returns>A single creditor resource</returns> public Task <CreditorResponse> CreateAsync(CreditorCreateRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new CreditorCreateRequest(); var urlParams = new List <KeyValuePair <string, object> > { }; return(_goCardlessClient.ExecuteAsync <CreditorResponse>("POST", "/creditors", urlParams, request, id => GetAsync(id, null, customiseRequestMessage), "creditors", customiseRequestMessage)); }
public GetMyTopicsServerRequest(RequestSettings requestSettings) : base(requestSettings) { }
/// <summary> /// <a name="retry_failed"></a>Retries a failed payment if the /// underlying mandate is active. You will receive a /// `resubmission_requested` webhook, but after that retrying the /// payment follows the same process as its initial creation, so you /// will receive a `submitted` webhook, followed by a `confirmed` or /// `failed` event. Any metadata supplied to this endpoint will be /// stored against the payment submission event it causes. /// /// This will return a `retry_failed` error if the payment has not /// failed. /// /// Payments can be retried up to 3 times. /// </summary> /// <param name="identity">Unique identifier, beginning with "PM".</param> /// <param name="request">An optional `PaymentRetryRequest` representing the body for this retry request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A single payment resource</returns> public Task <PaymentResponse> RetryAsync(string identity, PaymentRetryRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new PaymentRetryRequest(); if (identity == null) { throw new ArgumentException(nameof(identity)); } var urlParams = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("identity", identity), }; return(_goCardlessClient.ExecuteAsync <PaymentResponse>(HttpMethod.Post, "/payments/:identity/actions/retry", urlParams, request, null, "data", customiseRequestMessage)); }
public override List <EContact> GetContacts(string pCodeForAccessToken) { List <EContact> vListOfContacts = new List <EContact>(); EContact vEContact = null; string vParameters = string.Empty; byte[] vByteArray = null; Stream vPostStream = null; string vResponseFromServer = string.Empty; try { // Get access token HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(LocalConstants.GetGoogleTokenUrl); // https://accounts.google.com/o/oauth2/token webRequest.Method = "POST"; vParameters = string.Format("code={0}&client_id={1}&client_secret={2}&redirect_uri={3}&grant_type=authorization_code", pCodeForAccessToken, LocalConstants.GetClientID, LocalConstants.GetGoogleClientSecret, LocalConstants.GetRedirectUrl); vByteArray = Encoding.UTF8.GetBytes(vParameters); webRequest.ContentType = LocalConstants.GetRequestContentType; webRequest.ContentLength = vByteArray.Length; vPostStream = webRequest.GetRequestStream(); vPostStream.Write(vByteArray, 0, vByteArray.Length); vPostStream.Close(); WebResponse response = webRequest.GetResponse(); vPostStream = response.GetResponseStream(); StreamReader reader = new StreamReader(vPostStream); vResponseFromServer = reader.ReadToEnd(); dynamic vToken = JObject.Parse(vResponseFromServer); OAuth2Parameters oAuthparameters = new OAuth2Parameters() { Scope = LocalConstants.GetGoogleScopeContactsUrl, AccessToken = vToken.access_token, RefreshToken = vToken.refresh_token }; RequestSettings vSettings = new RequestSettings(string.Format("<var>{0}</var>", LocalConstants.GetGoogleAuthApplication), oAuthparameters); ContactsRequest vContactsRequest = new ContactsRequest(vSettings); ContactsQuery vContactsQuery = new ContactsQuery(ContactsQuery.CreateContactsUri("default")); vContactsQuery.NumberToRetrieve = 5000; Feed <Contact> feed = vContactsRequest.Get <Contact>(vContactsQuery); if (feed != null && feed.Entries != null) { foreach (Contact contact in feed.Entries) { foreach (EMail email in contact.Emails) { vEContact = new EContact(); vEContact.FullName = string.IsNullOrEmpty(contact.Title) ? email.Address : contact.Title; vEContact.Email = email.Address; vListOfContacts.Add(vEContact); } } } } catch (Exception vException) { throw vException; } return(vListOfContacts); }
/// <summary> /// Generates a PDF mandate and returns its temporary URL. /// /// Customer and bank account details can be left blank (for a blank /// mandate), provided manually, or inferred from the ID of an existing /// [mandate](#core-endpoints-mandates). /// /// By default, we'll generate PDF mandates in English. /// /// To generate a PDF mandate in another language, set the /// `Accept-Language` header when creating the PDF mandate to the /// relevant [ISO /// 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) /// language code supported for the scheme. /// /// | Scheme | Supported languages /// /// | /// | :--------------- | /// :------------------------------------------------------------------------------------------------------------------------------------------- /// | /// | ACH | English (`en`) /// /// | /// | Autogiro | English (`en`), Swedish (`sv`) /// /// | /// | Bacs | English (`en`) /// /// | /// | BECS | English (`en`) /// /// | /// | BECS NZ | English (`en`) /// /// | /// | Betalingsservice | Danish (`da`), English (`en`) /// /// | /// | PAD | English (`en`) /// /// | /// | SEPA Core | Danish (`da`), Dutch (`nl`), English (`en`), /// French (`fr`), German (`de`), Italian (`it`), Portuguese (`pt`), /// Spanish (`es`), Swedish (`sv`) | /// </summary> /// <param name="request">An optional `MandatePdfCreateRequest` representing the body for this create request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A single mandate pdf resource</returns> public Task <MandatePdfResponse> CreateAsync(MandatePdfCreateRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new MandatePdfCreateRequest(); var urlParams = new List <KeyValuePair <string, object> > { }; return(_goCardlessClient.ExecuteAsync <MandatePdfResponse>("POST", "/mandate_pdfs", urlParams, request, null, "mandate_pdfs", customiseRequestMessage)); }
public TestStateMachine(RequestSettings settings) { Event(() => Register, x => { x.CorrelateBy(p => p.MemberNumber, p => p.Message.MemberNumber); x.SelectId(context => NewId.NextGuid()); }); Request(() => ValidateAddress, x => x.ValidateAddressRequestId, settings); Request(() => ValidateName, x => x.ValidateNameRequestId, cfg => { cfg.SchedulingServiceAddress = settings.SchedulingServiceAddress; cfg.Timeout = settings.Timeout; }); Initially(When(Register) .Then(context => { Console.WriteLine("Registration received: {0}", context.Data.MemberNumber); Console.WriteLine("TestState ID: {0}", context.Instance.CorrelationId); context.Instance.Name = context.Data.Name; context.Instance.Address = context.Data.Address; context.Instance.MemberNumber = context.Data.MemberNumber; }) .Request(ValidateAddress, x => ValidateAddress.Settings.ServiceAddress, x => x.Init <ValidateAddress>(x.Instance)) .TransitionTo(ValidateAddress.Pending)); During(ValidateAddress.Pending, When(ValidateAddress.Completed) .ThenAsync(async context => { await Console.Out.WriteLineAsync("Request Completed!"); context.Instance.Address = context.Data.Address; }) .Request(ValidateName, context => context.Init <ValidateName>(context.Instance)) .TransitionTo(ValidateName.Pending), When(ValidateAddress.Faulted) .ThenAsync(async context => await Console.Out.WriteLineAsync("Request Faulted")) .TransitionTo(AddressValidationFaulted), When(ValidateAddress.TimeoutExpired) .ThenAsync(async context => await Console.Out.WriteLineAsync("Request timed out")) .TransitionTo(AddressValidationTimeout)); During(ValidateName.Pending, When(ValidateName.Completed) .ThenAsync(async context => { await Console.Out.WriteLineAsync("Request Completed!"); context.Instance.Name = context.Data.Name; }) .PublishAsync(context => context.Init <MemberRegistered>(context.Instance)) .TransitionTo(Registered), When(ValidateName.Faulted) .ThenAsync(async context => await Console.Out.WriteLineAsync("Request Faulted")) .TransitionTo(NameValidationFaulted), When(ValidateName.TimeoutExpired) .ThenAsync(async context => await Console.Out.WriteLineAsync("Request timed out")) .TransitionTo(NameValidationTimeout)); }
public void OAuth2LeggedModelContactsBatchInsertTest() { const int numberOfInserts = 37; Tracing.TraceMsg("Entering OAuth2LeggedModelContactsBatchInsertTest"); RequestSettings rs = new RequestSettings(this.ApplicationName, this.oAuthConsumerKey, this.oAuthConsumerSecret, this.oAuthUser, this.oAuthDomain); ContactsTestSuite.DeleteAllContacts(rs); rs.AutoPaging = true; ContactsRequest cr = new ContactsRequest(rs); Feed <Contact> f = cr.GetContacts(); int originalCount = f.TotalResults; PhoneNumber p = null; List <Contact> inserted = new List <Contact>(); if (f != null) { Assert.IsTrue(f.Entries != null, "the contacts needs entries"); for (int i = 0; i < numberOfInserts; i++) { Contact entry = new Contact(); entry.AtomEntry = ObjectModelHelper.CreateContactEntry(i); entry.PrimaryEmail.Address = "joe" + i.ToString() + "@doe.com"; p = entry.PrimaryPhonenumber; inserted.Add(cr.Insert(f, entry)); } } List <Contact> list = new List <Contact>(); f = cr.GetContacts(); foreach (Contact e in f.Entries) { list.Add(e); } if (inserted.Count > 0) { int iVer = numberOfInserts; // let's find those guys for (int i = 0; i < inserted.Count; i++) { Contact test = inserted[i]; foreach (Contact e in list) { if (e.Id == test.Id) { iVer--; // verify we got the phonenumber back.... Assert.IsTrue(e.PrimaryPhonenumber != null, "They should have a primary phonenumber"); Assert.AreEqual(e.PrimaryPhonenumber.Value, p.Value, "They should be identical"); } } } Assert.IsTrue(iVer == 0, "The new entries should all be part of the feed now, " + iVer + " left over"); } // now delete them again ContactsTestSuite.DeleteList(inserted, cr, new Uri(f.AtomFeed.Batch)); // now make sure they are gone if (inserted.Count > 0) { f = cr.GetContacts(); Assert.IsTrue(f.TotalResults == originalCount, "The count should be correct as well"); foreach (Contact e in f.Entries) { // let's find those guys, we should not find ANY for (int i = 0; i < inserted.Count; i++) { Contact test = inserted[i] as Contact; Assert.IsTrue(e.Id != test.Id, "The new entries should all be deleted now"); } } } }
public GoogleAdapter(string UserName, string Password, Logger logger) { rs = new RequestSettings(AppName, UserName, Password); this.logger = logger; }
private IList <IContact> GetContacts(int pageNumber, int pageSize, ISelection selection) { IList <IContact> result = new List <IContact>(); RequestSettings rs = new RequestSettings(applicationName, token.ToString()); rs.AutoPaging = true; ContactsRequest cr = new ContactsRequest(rs); Feed <Google.Contacts.Contact> contacts = cr.GetContacts(); int i = 1; if (pageNumber > 0) { foreach (Google.Contacts.Contact e in contacts.Entries) { if (i < (pageNumber * pageSize) - (pageSize - 1)) { i++; continue; } if (i > (pageNumber * pageSize)) { break; } GetContact(i++, result, e); } this.totalCount = contacts.TotalResults; } else if (selection != null) { foreach (Google.Contacts.Contact e in contacts.Entries) { if (!selection.SelectedAll && !selection.SelectedIndexs.Exists(delegate(int record) { if (record == i) { return(true); } return(false); })) { i++; continue; } if (selection.SelectedAll && selection.SelectedIndexs.Exists(delegate(int record) { if (record == i) { return(true); } return(false); })) { i++; continue; } if (e.PrimaryEmail == null) { continue; } Contact contact = new Contact(); contact.Index = i; contact.FirstName = e.Title; contact.Email = e.PrimaryEmail.Address; result.Add(contact); i++; } } else { foreach (Google.Contacts.Contact e in contacts.Entries) { GetContact(i++, result, e); } this.totalCount = contacts.TotalResults; } return(result); }
/// <summary> /// Performs a bank details lookup. As part of the lookup, a modulus /// check and /// reachability check are performed. /// /// If your request returns an [error](#api-usage-errors) or the /// `available_debit_schemes` /// attribute is an empty array, you will not be able to collect /// payments from the /// specified bank account. GoCardless may be able to collect payments /// from an account /// even if no `bic` is returned. /// /// Bank account details may be supplied using [local /// details](#appendix-local-bank-details) or an IBAN. /// /// _Note:_ Usage of this endpoint is monitored. If your organisation /// relies on GoCardless for /// modulus or reachability checking but not for payment collection, /// please get in touch. /// </summary> /// <param name="request">An optional `BankDetailsLookupCreateRequest` representing the body for this create request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A single bank details lookup resource</returns> public Task <BankDetailsLookupResponse> CreateAsync(BankDetailsLookupCreateRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new BankDetailsLookupCreateRequest(); var urlParams = new List <KeyValuePair <string, object> > { }; return(_goCardlessClient.ExecuteAsync <BankDetailsLookupResponse>("POST", "/bank_details_lookups", urlParams, request, null, "bank_details_lookups", customiseRequestMessage)); }
/// <summary> /// Declares a request that is sent by the state machine to a service, and the associated response, fault, and /// timeout handling. The property is initialized with the fully built Request. The request must be declared before /// it is used in the state/event declaration statements. /// </summary> /// <typeparam name="TRequest">The request type</typeparam> /// <typeparam name="TResponse">The response type</typeparam> /// <typeparam name="TResponse2">The alternate response type</typeparam> /// <param name="propertyExpression">The request property on the state machine</param> /// <param name="requestIdExpression">The property where the requestId is stored</param> /// <param name="settings">The request settings (which can be read from configuration, etc.)</param> protected void Request <TRequest, TResponse, TResponse2>(Expression <Func <Request <TInstance, TRequest, TResponse, TResponse2> > > propertyExpression, Expression <Func <TInstance, Guid?> > requestIdExpression, RequestSettings settings) where TRequest : class where TResponse : class where TResponse2 : class { var property = propertyExpression.GetPropertyInfo(); var request = new StateMachineRequest <TInstance, TRequest, TResponse, TResponse2>(property.Name, requestIdExpression, settings); InitializeRequest(this, property, request); Event(propertyExpression, x => x.Completed, x => x.CorrelateBy(requestIdExpression, context => context.RequestId)); Event(propertyExpression, x => x.Completed2, x => x.CorrelateBy(requestIdExpression, context => context.RequestId)); Event(propertyExpression, x => x.Faulted, x => x.CorrelateBy(requestIdExpression, context => context.RequestId)); Event(propertyExpression, x => x.TimeoutExpired, x => x.CorrelateBy(requestIdExpression, context => context.Message.RequestId)); State(propertyExpression, x => x.Pending); DuringAny( When(request.Completed) .CancelRequestTimeout(request) .ClearRequest(request), When(request.Completed2) .CancelRequestTimeout(request) .ClearRequest(request), When(request.Faulted) .CancelRequestTimeout(request) .ClearRequest(request), When(request.TimeoutExpired, request.EventFilter) .ClearRequest(request)); }
public Request(RequestSettings settings) : base(settings) { }
public SoftwareUpdateConfiguration CreateSoftwareUpdateConfiguration(string resourceGroupName, string automationAccountName, SoftwareUpdateConfiguration configuration) { using (var request = new RequestSettings(this.automationManagementClient)) { var updateConfig = configuration.UpdateConfiguration; IList <Sdk.AzureQueryProperties> azureQueries = null; if (updateConfig != null && updateConfig.Targets != null && updateConfig.Targets.AzureQueries != null) { azureQueries = new List <Sdk.AzureQueryProperties>(); foreach (var query in updateConfig.Targets.AzureQueries) { var tags = new Dictionary <string, IList <string> >(); if (query.TagSettings != null && query.TagSettings.Tags != null) { foreach (var tag in query.TagSettings.Tags) { tags.Add(tag.Key, tag.Value); } } var azureQueryProperty = new Sdk.AzureQueryProperties { Locations = query.Locations, Scope = query.Scope, TagSettings = new Sdk.TagSettingsProperties { Tags = tags, FilterOperator = query.TagSettings == null? Sdk.TagOperators.Any : (Sdk.TagOperators)query.TagSettings.FilterOperator } }; azureQueries.Add(azureQueryProperty); } } IList <Sdk.NonAzureQueryProperties> nonAzureQueries = null; if (updateConfig != null && updateConfig.Targets != null && updateConfig.Targets.NonAzureQueries != null) { nonAzureQueries = new List <Sdk.NonAzureQueryProperties>(); foreach (var query in updateConfig.Targets.NonAzureQueries) { var nonAzureQueryProperty = new Sdk.NonAzureQueryProperties { FunctionAlias = query.FunctionAlias, WorkspaceId = query.WorkspaceResourceId }; nonAzureQueries.Add(nonAzureQueryProperty); } } var sucParameters = new Sdk.SoftwareUpdateConfiguration() { ScheduleInfo = new Sdk.ScheduleProperties() { StartTime = configuration.ScheduleConfiguration.StartTime.ToUniversalTime(), ExpiryTime = configuration.ScheduleConfiguration.ExpiryTime.ToUniversalTime(), Frequency = configuration.ScheduleConfiguration.Frequency.ToString(), Interval = configuration.ScheduleConfiguration.Interval, IsEnabled = configuration.ScheduleConfiguration.IsEnabled, TimeZone = configuration.ScheduleConfiguration.TimeZone, AdvancedSchedule = configuration.ScheduleConfiguration.GetAdvancedSchedule() }, UpdateConfiguration = new Sdk.UpdateConfiguration() { OperatingSystem = updateConfig.OperatingSystem == OperatingSystemType.Windows ? Sdk.OperatingSystemType.Windows : Sdk.OperatingSystemType.Linux, Windows = updateConfig.OperatingSystem == OperatingSystemType.Linux ? null : new Sdk.WindowsProperties() { IncludedUpdateClassifications = updateConfig.Windows != null && updateConfig.Windows.IncludedUpdateClassifications != null ? string.Join(",", updateConfig.Windows.IncludedUpdateClassifications.Select(c => c.ToString())) : null, ExcludedKbNumbers = updateConfig.Windows != null ? updateConfig.Windows.ExcludedKbNumbers : null, RebootSetting = updateConfig.Windows != null?updateConfig.Windows.rebootSetting.ToString() : RebootSetting.IfRequired.ToString(), }, Linux = updateConfig.OperatingSystem == OperatingSystemType.Windows ? null : new Sdk.LinuxProperties() { IncludedPackageClassifications = updateConfig.Linux != null && updateConfig.Linux.IncludedPackageClassifications != null ? string.Join(",", updateConfig.Linux.IncludedPackageClassifications.Select(c => c.ToString())) : null, ExcludedPackageNameMasks = updateConfig.Linux != null ? updateConfig.Linux.ExcludedPackageNameMasks : null, RebootSetting = updateConfig.Windows != null?updateConfig.Windows.rebootSetting.ToString() : RebootSetting.IfRequired.ToString(), }, Duration = updateConfig.Duration, AzureVirtualMachines = updateConfig.AzureVirtualMachines, NonAzureComputerNames = updateConfig.NonAzureComputers, Targets = updateConfig.Targets == null ? null : new Sdk.TargetProperties { AzureQueries = azureQueries, NonAzureQueries = nonAzureQueries } }, Tasks = configuration.Tasks == null ? null : new Sdk.SoftwareUpdateConfigurationTasks { PreTask = configuration.Tasks.PreTask == null ? null : new Sdk.TaskProperties { Source = configuration.Tasks.PreTask.source, Parameters = configuration.Tasks.PreTask.parameters }, PostTask = configuration.Tasks.PostTask == null ? null : new Sdk.TaskProperties { Source = configuration.Tasks.PostTask.source, Parameters = configuration.Tasks.PostTask.parameters } } }; var suc = this.automationManagementClient.SoftwareUpdateConfigurations.Create(resourceGroupName, automationAccountName, configuration.Name, sucParameters); return(new SoftwareUpdateConfiguration(resourceGroupName, automationAccountName, suc)); } }
/// <summary> /// Get a lazily enumerated list of mandate import entries. /// This acts like the #list method, but paginates for you automatically. /// </summary> public IEnumerable <MandateImportEntry> All(MandateImportEntryListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new MandateImportEntryListRequest(); string cursor = null; do { request.After = cursor; var result = Task.Run(() => ListAsync(request, customiseRequestMessage)).Result; foreach (var item in result.MandateImportEntries) { yield return(item); } cursor = result.Meta?.Cursors?.After; } while (cursor != null); }
/// <summary> /// For an existing [mandate import](#core-endpoints-mandate-imports), /// this endpoint can /// be used to add individual mandates to be imported into GoCardless. /// /// You can add no more than 30,000 rows to a single mandate import. /// If you attempt to go over this limit, the API will return a /// `record_limit_exceeded` error. /// </summary> /// <param name="request">An optional `MandateImportEntryCreateRequest` representing the body for this create request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A single mandate import entry resource</returns> public Task <MandateImportEntryResponse> CreateAsync(MandateImportEntryCreateRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new MandateImportEntryCreateRequest(); var urlParams = new List <KeyValuePair <string, object> > { }; return(_goCardlessClient.ExecuteAsync <MandateImportEntryResponse>(HttpMethod.Post, "/mandate_import_entries", urlParams, request, null, "mandate_import_entries", customiseRequestMessage)); }
public SubscribersManager(RequestSettings restRequestSettings) { logger.Info("Starting"); _RESTRequestSettings = restRequestSettings; _Timer = new Timer(TimerProc, null, 1, Timeout.Infinite); }
protected Response ExecuteRESTRequest(CloudIdentity identity, Uri absoluteUri, HttpMethod method, object body = null, Dictionary <string, string> queryStringParameter = null, Dictionary <string, string> headers = null, bool isRetry = false, RequestSettings settings = null) { return(ExecuteRESTRequest <Response>(identity, absoluteUri, method, body, queryStringParameter, headers, isRetry, settings, RestService.Execute)); }
/// <summary> /// Updates a creditor object. Supports all of the fields supported when /// creating a creditor. /// </summary> /// <param name="identity">Unique identifier, beginning with "CR".</param> /// <returns>A single creditor resource</returns> public Task <CreditorResponse> UpdateAsync(string identity, CreditorUpdateRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new CreditorUpdateRequest(); if (identity == null) { throw new ArgumentException(nameof(identity)); } var urlParams = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("identity", identity), }; return(_goCardlessClient.ExecuteAsync <CreditorResponse>("PUT", "/creditors/:identity", urlParams, request, null, "creditors", customiseRequestMessage)); }