public ChannelClipsRequest(string channelName) : base(GET_CLIPS_FOR_CHANNEL_REQUEST) { this.ChannelName = channelName; this.RequestParameters = (() => { return(new string[] { ChannelName, Since.ToString(), Limit.ToString(), Skip.ToString(), Sort.GetSortString() }); }); }
/// <inheritdoc/> protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken)) { if (User != null && Since != null && Options != null) { var userValue = User.GetValue(dc.State); var sinceValue = Since.GetValue(dc.State); var optionsValue = Options.GetValue(dc.State); return(await gitHubClient.Gist.GetAllForUser(userValue, sinceValue, optionsValue).ConfigureAwait(false)); } if (User != null && Options != null) { var userValue = User.GetValue(dc.State); var optionsValue = Options.GetValue(dc.State); return(await gitHubClient.Gist.GetAllForUser(userValue, optionsValue).ConfigureAwait(false)); } if (User != null && Since != null) { var userValue = User.GetValue(dc.State); var sinceValue = Since.GetValue(dc.State); return(await gitHubClient.Gist.GetAllForUser(userValue, sinceValue).ConfigureAwait(false)); } if (User != null) { var userValue = User.GetValue(dc.State); return(await gitHubClient.Gist.GetAllForUser(userValue).ConfigureAwait(false)); } throw new ArgumentNullException("Required [user] arguments missing for GitHubClient.Gist.GetAllForUser"); }
public OAuth2Request ToOAuth2Request(ISalesforceUser user) { if (!(Resource is SObject)) { throw new InvalidOperationException("Only SObjects can have changes. Searches and Queries not elibible."); } if (Since > Until) { throw new InvalidOperationException("Since must preceed Until."); } // var path = user.Properties ["instance_url"] + SalesforceClient.RestApiPath; // var baseUri = new Uri (path); // var queryString = String.Format("?start={0:O}&end={1:O}", Since.ToUniversalTime(), Until.ToUniversalTime()); // var changesPath = Path.Combine(Resource.AbsoluteUri.AbsolutePath, ChangeType.ToString(), queryString); // var changesUri = new Uri(changesPath); // var uri = new Uri (baseUri, changesUri); var path = user.Properties ["instance_url"] + SalesforceClient.RestApiPath; var baseUri = new Uri(path); var uri = new UriBuilder(new Uri(baseUri, Resource.AbsoluteUri)); // Custom ISO format: var since = Since.ToUniversalTime(); var sinceString = String.Format("{0}T{1}Z", since.ToString("yyyy-MM-dd"), since.ToString("HH:mm:ss")); var until = Until.ToUniversalTime(); var untilString = String.Format("{0}T{1}Z", until.ToString("yyyy-MM-dd"), until.ToString("HH:mm:ss")); uri.Query = String.Format("start={0}&end={1}", sinceString, untilString); var oauthRequest = new OAuth2Request(Method, uri.Uri, Resource.Options.Where(kvp => kvp.Value.JsonType == JsonType.String).ToDictionary(k => k.Key, v => (string)v.Value), user); return(oauthRequest); }
public override string ToString() { return(string.Join(" ", new string[] { Since > DateTimeOffset.MinValue ? "SINCE " + Since.ToString("d-MMM-yyyy") : "", !string.IsNullOrWhiteSpace(Subject)?"SUBJECT \"" + Subject + "\"":"", !string.IsNullOrWhiteSpace(From)?"FROM \"" + From + "\"":"" }.Where(s => !string.IsNullOrWhiteSpace(s)))); }
public override int GetHashCode() { var hashCode = 1724739372; hashCode = hashCode * -1521134295 + IdDoctor.GetHashCode(); hashCode = hashCode * -1521134295 + IdClinic.GetHashCode(); hashCode = hashCode * -1521134295 + Since.GetHashCode(); return(hashCode); }
public override string ToString() { StringBuilder sb = new StringBuilder(); switch (Mode) { case SearchMode.AroundWorkingDay: { sb.AppendFormat("Around the day {0}({1}): now {2} destination {3}", ReferenceTime.Date, ReferenceTime.DayOfWeek, Since.ToString("MM-dd"), Until.ToString("MM-dd")); break; } case SearchMode.WithinTheDay: { sb.AppendFormat("Within the day {0}({1}): now {2} destination {3}", ReferenceTime.Date, ReferenceTime.DayOfWeek, Since.ToString("MM-dd"), Until.ToString("MM-dd")); break; } case SearchMode.WithinTheWeek: { sb.AppendFormat("Within the week {0}({1}): now {2} destination {3}", ReferenceTime.Date, ReferenceTime.DayOfWeek, Since.ToString("MM-dd"), Until.ToString("MM-dd")); break; } case SearchMode.WithinTheMonth: { sb.AppendFormat("Within the month of {0}: now {1} destination {2}", ReferenceTime.Date, Since.ToString("yyyy-MM-dd"), Until.ToString("yyyy-MM-dd")); break; } case SearchMode.WithinTheYear: { sb.AppendFormat("Within the year of {0}: now {1} destination {2}", ReferenceTime.Date, ReferenceTime.DayOfWeek, Since.ToString("yyyy-MM-dd"), Until.ToString("yyyy-MM-dd")); break; } //case SearchMode.WithinTheDecade: // { // sb.AppendFormat("Within the decade of {0}: now {1} destination {2}", ReferenceTime.Date, ReferenceTime.DayOfWeek, // Since.ToString("yyyy-MM-dd"), Until.ToString("yyyy-MM-dd")); // break; // } default: throw new NotImplementedException(); } return(sb.ToString()); }
/// Checks if the setting is current for a specified version, based on /// the Since and/or Deprecated settings. public bool IsCurrent(Version version) { bool current = true; if (IsVersioned) { var from = Since != null?Since.ToVersion() : null; var to = Deprecated != null?Deprecated.ToVersion() : null; current = (from == null || version >= from) && (to == null || version < to); } return(current); }
/// <summary> /// Returns true if WaitingListEntry instances are equal /// </summary> /// <param name="other">Instance of WaitingListEntry to be compared</param> /// <returns>Boolean</returns> public bool Equals(WaitingListEntry other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( PatientId == other.PatientId || PatientId != null && PatientId.Equals(other.PatientId) ) && ( Since == other.Since || Since != null && Since.Equals(other.Since) ) && ( Estimated == other.Estimated || Estimated != null && Estimated.Equals(other.Estimated) ) && ( EstimatedDurationMinutes == other.EstimatedDurationMinutes || EstimatedDurationMinutes != null && EstimatedDurationMinutes.Equals(other.EstimatedDurationMinutes) ) && ( Condition == other.Condition || Condition != null && Condition.Equals(other.Condition) )); }
public override void request(OneDay oneDay) { TickDatabase db = new TickDatabase(); TickQuery query = new TickQuery(); TickReal real = new TickReal(); switch (whatNeeded()) { case Need.Past: break; case Need.PastAndFuture: Tick lastTick = null; var filter = new ActionBlock <Tick>(async tick => { if (lastTick == null || lastTick.Time < tick.Time || (lastTick.Time == tick.Time && lastTick.Volume < tick.Volume)) { // Buffer.Post(tick); await Buffer.SendAsync(tick); } lastTick = tick; }); db.Target = filter; db.Completion.ContinueWith(a => { query.Target = filter; query.Completion.ContinueWith(b => { real.Target = filter; }); }); var since = new Since { Stock = oneDay.Stock, After = RecentRecord.getTime(oneDay.Stock), Base = oneDay.Date }; real.request(oneDay); query.request(since); db.request(oneDay); break; case Need.Future: // Real의 결과를 target으로 넣는다. real.request(oneDay); break; } }
public string ToQueryString() { var queryParams = GetByIdOrName(RoomId, string.Empty); queryParams.Add("since", Since.ToString(QueryHelper.DATE_FORMAT)); if (Offset.HasValue) { queryParams.Add("offset", Offset.Value.ToString()); } if (Count.HasValue) { queryParams.Add("count", Count.Value.ToString()); } return(QueryHelper.DicToQuerystring(queryParams)); }
/// <inheritdoc/> protected override async Task <object> CallGitHubApi(DialogContext dc, Octokit.GitHubClient gitHubClient, CancellationToken cancellationToken = default(CancellationToken)) { if (Since != null && Options != null) { var sinceValue = Since.GetValue(dc.State); var optionsValue = Options.GetValue(dc.State); return(await gitHubClient.Gist.GetAllStarred(sinceValue, optionsValue).ConfigureAwait(false)); } if (Options != null) { var optionsValue = Options.GetValue(dc.State); return(await gitHubClient.Gist.GetAllStarred(optionsValue).ConfigureAwait(false)); } if (Since != null) { var sinceValue = Since.GetValue(dc.State); return(await gitHubClient.Gist.GetAllStarred(sinceValue).ConfigureAwait(false)); } else { return(await gitHubClient.Gist.GetAllStarred().ConfigureAwait(false)); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (PatientId != null) { hashCode = hashCode * 59 + PatientId.GetHashCode(); } if (Since != null) { hashCode = hashCode * 59 + Since.GetHashCode(); } if (Estimated != null) { hashCode = hashCode * 59 + Estimated.GetHashCode(); } if (EstimatedDurationMinutes != null) { hashCode = hashCode * 59 + EstimatedDurationMinutes.GetHashCode(); } if (Condition != null) { hashCode = hashCode * 59 + Condition.GetHashCode(); } return(hashCode); } }
public override string ToString() { return(String.Format("{0}: {1}-{2}, {3} records.", Name, Since.ToString("yyyyMMdd"), Until.ToString("yyyyMMdd"), Count)); }
public int CompareTo(Following other) { return(Since.CompareTo(other.Since)); }
public QueryStringFactoryTestsWithSince(Since since, string expected) { _since = since; _expected = expected; }
/// <summary> /// appends parameters for Search request /// </summary> /// <param name="parameters">list of parameters from expression tree</param> /// <param name="url">base url</param> /// <returns>base url + parameters</returns> private string BuildSearchUrlParameters(Dictionary <string, string> parameters, string url) { var urlParams = new List <string>(); if (parameters.ContainsKey("GeoCode")) { GeoCode = parameters["GeoCode"]; urlParams.Add("geocode=" + HttpUtility.UrlEncode(parameters["GeoCode"])); } if (parameters.ContainsKey("SearchLanguage")) { SearchLanguage = parameters["SearchLanguage"]; urlParams.Add("lang=" + parameters["SearchLanguage"]); } if (parameters.ContainsKey("Locale")) { Locale = parameters["Locale"]; urlParams.Add("locale=" + parameters["Locale"]); } if (parameters.ContainsKey("Page")) { Page = int.Parse(parameters["Page"]); urlParams.Add("page=" + parameters["Page"]); } if (parameters.ContainsKey("PageSize")) { PageSize = int.Parse(parameters["PageSize"]); urlParams.Add("rpp=" + parameters["PageSize"]); } if (parameters.ContainsKey("Query")) { Query = parameters["Query"]; if (Query.Length > 140) { throw new ArgumentException("Query length must be 140 characters or less.", "Query"); } urlParams.Add("q=" + HttpUtility.UrlEncode(parameters["Query"])); } if (parameters.ContainsKey("ShowUser")) { ShowUser = bool.Parse(parameters["ShowUser"]); if (ShowUser) { urlParams.Add("show_user="******"ShowUser"]); } } if (parameters.ContainsKey("Since")) { Since = DateTime.Parse(parameters["Since"]); urlParams.Add("since=" + Since.ToString("yyyy-MM-dd")); } if (parameters.ContainsKey("Until")) { Until = DateTime.Parse(parameters["Until"]); urlParams.Add("until=" + Until.ToString("yyyy-MM-dd")); } if (parameters.ContainsKey("SinceID")) { SinceID = ulong.Parse(parameters["SinceID"]); urlParams.Add("since_id=" + parameters["SinceID"]); } if (parameters.ContainsKey("MaxID")) { MaxID = ulong.Parse(parameters["MaxID"]); urlParams.Add("max_id=" + parameters["MaxID"]); } if (parameters.ContainsKey("ResultType")) { ResultType = RequestProcessorHelper.ParseQueryEnumType <ResultType>(parameters["ResultType"]); urlParams.Add("result_type=" + ResultType.ToString()); } if (parameters.ContainsKey("WordPhrase")) { WordPhrase = parameters["WordPhrase"]; urlParams.Add("exact=" + HttpUtility.UrlEncode(parameters["WordPhrase"])); } if (parameters.ContainsKey("WordAnd")) { WordAnd = parameters["WordAnd"]; urlParams.Add("ands=" + HttpUtility.UrlEncode(parameters["WordAnd"])); } if (parameters.ContainsKey("WordOr")) { WordOr = parameters["WordOr"]; urlParams.Add("ors=" + HttpUtility.UrlEncode(parameters["WordOr"])); } if (parameters.ContainsKey("WordNot")) { WordNot = parameters["WordNot"]; urlParams.Add("nots=" + HttpUtility.UrlEncode(parameters["WordNot"])); } if (parameters.ContainsKey("Hashtag")) { Hashtag = parameters["Hashtag"]; urlParams.Add("tag=" + HttpUtility.UrlEncode(parameters["Hashtag"])); } if (parameters.ContainsKey("PersonFrom")) { PersonFrom = parameters["PersonFrom"]; urlParams.Add("from=" + HttpUtility.UrlEncode(parameters["PersonFrom"])); } if (parameters.ContainsKey("PersonTo")) { PersonTo = parameters["PersonTo"]; urlParams.Add("to=" + HttpUtility.UrlEncode(parameters["PersonTo"])); } if (parameters.ContainsKey("PersonReference")) { PersonReference = parameters["PersonReference"]; urlParams.Add("ref=" + HttpUtility.UrlEncode(parameters["PersonReference"])); } if (parameters.ContainsKey("Attitude")) { Attitude = RequestProcessorHelper.ParseQueryEnumType <Attitude>(parameters["Attitude"]); if ((Attitude & Attitude.Positive) == Attitude.Positive) { urlParams.Add("tude%5B%5D=%3A%29"); } if ((Attitude & Attitude.Negative) == Attitude.Negative) { urlParams.Add("tude%5B%5D=%3A%28"); } if ((Attitude & Attitude.Question) == Attitude.Question) { urlParams.Add("tude%5B%5D=%3F"); } } if (parameters.ContainsKey("WithLinks")) { WithLinks = bool.Parse(parameters["WithLinks"]); if (WithLinks) { urlParams.Add("filter%5B%5D=links"); } } if (parameters.ContainsKey("WithRetweets")) { WithRetweets = bool.Parse(parameters["WithRetweets"]); if (WithRetweets) { urlParams.Add("include%5B%5D=retweets"); } } if (urlParams.Count > 0) { url += "?" + string.Join("&", urlParams.ToArray()); } return(url); }
public QueryStringFactoryTestsWithSince(Since since, string expected) { _since = since; _expected = expected; }
public override int GetHashCode() { int hash = 1; if (HasID) { hash ^= ID.GetHashCode(); } if (HasMethod) { hash ^= Method.GetHashCode(); } if (HasPath) { hash ^= Path.GetHashCode(); } if (HasVal) { hash ^= Val.GetHashCode(); } if (HasDir) { hash ^= Dir.GetHashCode(); } if (HasPrevValue) { hash ^= PrevValue.GetHashCode(); } if (HasPrevIndex) { hash ^= PrevIndex.GetHashCode(); } if (HasPrevExist) { hash ^= PrevExist.GetHashCode(); } if (HasExpiration) { hash ^= Expiration.GetHashCode(); } if (HasWait) { hash ^= Wait.GetHashCode(); } if (HasSince) { hash ^= Since.GetHashCode(); } if (HasRecursive) { hash ^= Recursive.GetHashCode(); } if (HasSorted) { hash ^= Sorted.GetHashCode(); } if (HasQuorum) { hash ^= Quorum.GetHashCode(); } if (HasTime) { hash ^= Time.GetHashCode(); } if (HasStream) { hash ^= Stream.GetHashCode(); } if (HasRefresh) { hash ^= Refresh.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { unchecked { return(Ascending.GetHashCode() ^ (Labels != null ? Labels.GetHashCode() : 0) ^ Open.GetHashCode() ^ Since.GetHashCode() ^ SortType.GetHashCode() ^ (Mentioned != null ? Mentioned.GetHashCode() : 0) ^ (Creator != null ? Creator.GetHashCode() : 0) ^ (Assignee != null ? Assignee.GetHashCode() : 0) ^ (Milestone != null ? Milestone.GetHashCode() : 0)); } }
public override int GetHashCode() { unchecked { return(Ascending.GetHashCode() ^ (Labels != null ? Labels.GetHashCode() : 0) ^ FilterType.GetHashCode() ^ Open.GetHashCode() ^ Since.GetHashCode() ^ SortType.GetHashCode()); } }
public override string ToString() { return(String.Format("{0}-{1}: {2} records.", Since.ToString("yyyy"), Until.ToString("yyyy"), Count)); }
public void ForBoard_TheWelcomeBoardSinceDate_ReturnsSomething() { var actions = _trelloReadOnly.Actions.ForBoard(TheWelcomeBoard(), since: Since.Date(DateTime.Parse("2012-01-01"))); Assert.That(actions.Count(), Is.GreaterThan(0)); }
public override int GetHashCode() { int shift = 4; return(shift * Since.GetHashCode() * Till.GetHashCode()); }