/// <inheritdoc /> public AvailabilityRequest Build() { var request = new AvailabilityRequest(); request.RequiredDuration = this.GetRequiredDuration(); request.AvailablePeriods = this.availablePeriods.ToArray(); var participantGroups = new List <AvailabilityRequest.ParticipantGroup>(); if (this.requiredSubs.Count > 0) { var requiredGroup = new ParticipantGroupBuilder() .AddMembers(this.requiredSubs) .AllRequired(); participantGroups.Add(requiredGroup.Build()); } if (this.groups.Count > 0) { participantGroups.AddRange(this.groups); } if (this.groupBuilders.Count > 0) { participantGroups.AddRange(this.groupBuilders.Select(gb => gb.Build())); } request.Participants = participantGroups; return(request); }
/// <inheritdoc /> public SequencedAvailabilityRequest.SequenceRequest Build() { var request = new SequencedAvailabilityRequest.SequenceRequest(); request.RequiredDuration = this.GetRequiredDuration(); request.AvailablePeriods = this.availablePeriods.ToArray(); request.Ordinal = this.ordinal; request.SequenceId = this.sequenceId; var participantGroups = new List <AvailabilityRequest.ParticipantGroup>(); if (this.requiredSubs.Count > 0) { var requiredGroup = new ParticipantGroupBuilder() .AddMembers(this.requiredSubs) .AllRequired(); participantGroups.Add(requiredGroup.Build()); } if (this.eventRequest != null) { request.Event = this.eventRequest; } if (this.groups.Count > 0) { participantGroups.AddRange(this.groups); } if (this.groupBuilders.Count > 0) { participantGroups.AddRange(this.groupBuilders.Select(gb => gb.Build())); } if (this.beforeBuffer != null || this.afterBuffer != null) { request.Buffer = new AvailabilityRequest.Buffers(); if (this.beforeBuffer != null) { request.Buffer.Before = this.beforeBuffer; } if (this.afterBuffer != null) { request.Buffer.After = this.afterBuffer; } } if (this.startInterval.HasValue) { request.StartInterval = new AvailabilityRequest.Duration { Minutes = this.startInterval.Value }; } request.Participants = participantGroups; return(request); }
/// <inheritdoc /> public AvailabilityRequest Build() { var request = new AvailabilityRequest(); request.RequiredDuration = this.GetRequiredDuration(); request.AvailablePeriods = this.availablePeriods.ToArray(); var participantGroups = new List <AvailabilityRequest.ParticipantGroup>(); if (this.requiredSubs.Count > 0) { var requiredGroup = new ParticipantGroupBuilder() .AddMembers(this.requiredSubs) .AllRequired(); participantGroups.Add(requiredGroup.Build()); } if (this.groups.Count > 0) { participantGroups.AddRange(this.groups); } if (this.groupBuilders.Count > 0) { participantGroups.AddRange(this.groupBuilders.Select(gb => gb.Build())); } if (this.startInterval.HasValue) { request.StartInterval = new AvailabilityRequest.Duration { Minutes = this.startInterval.Value }; } if (this.beforeBuffer.HasValue || this.afterBuffer.HasValue) { request.Buffer = new AvailabilityRequest.Buffers(); if (this.beforeBuffer.HasValue) { request.Buffer.Before = new AvailabilityRequest.BufferDefintion { Minimum = new AvailabilityRequest.Duration { Minutes = this.beforeBuffer.Value } }; } if (this.afterBuffer.HasValue) { request.Buffer.After = new AvailabilityRequest.BufferDefintion { Minimum = new AvailabilityRequest.Duration { Minutes = this.afterBuffer.Value } }; } } request.Participants = participantGroups; return(request); }