NightFlash : a Web API

* NFEvent.cs:
* Period.cs:
* OpenDay.cs:
* WeekDay.cs:
* Position.cs:
* Schedule.cs:
* Publishing.cs:
* Periodicity.cs:
* ProvidedEvent.cs:
* NightFlashController.cs:
* ProviderPublicInfo.cs:
* PositionAndKeyphrase.cs:
This commit is contained in:
Paul Schneider 2015-04-27 17:53:50 +02:00
commit cfd023411d
12 changed files with 697 additions and 0 deletions

View file

@ -0,0 +1,80 @@
//
// NFEvent.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// NF event.
/// </summary>
public class NFEvent
{
/// <summary>
/// The title.
/// </summary>
[Required] public string Title { get; set; }
/// <summary>
/// The description.
/// </summary>
[Required] public string Description { get; set; }
/// <summary>
/// The type of the event.
/// </summary>
[Required] public string EventType { get; set; }
/// <summary>
/// The location.
/// </summary>
[Required] public Position Location { get; set; }
/// <summary>
/// The start date.
/// </summary>
[Required] public DateTime StartDate { get; set; }
/// <summary>
/// The name of the NF provider.
/// </summary>
[Required] public string NFProviderName { get; set; }
/// <summary>
/// The NF provider identifier.
/// </summary>
[Required] public string NFProviderId { get; set; }
/// <summary>
/// The type of the location.
/// </summary>
[Required] public string LocationType { get; set; }
/// <summary>
/// The promotion code.
/// </summary>
public string PromotionCode { get; set; }
/// <summary>
/// The event web page.
/// </summary>
public string EventWebPage { get; set; }
/// <summary>
/// The image locator.
/// </summary>
public string ImgLocator { get; set; }
}
}

View file

@ -0,0 +1,56 @@
//
// OpenDay.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Open day.
/// </summary>
public class OpenDay {
/// <summary>
/// The day.
/// </summary>
[Required]
public WeekDay Day;
public TimeSpan S { get; set; }
// ASSERT Start <= End
/// <summary>
/// Gets or sets the start hour.
/// </summary>
/// <value>The start.</value>
[Required]
public TimeSpan Start { get; set; }
/// <summary>
/// Gets or sets the end hour
/// (from the next day if lower than the Start).
/// </summary>
/// <value>The end.</value>
[Required]
public TimeSpan End { get; set; }
}
}

View file

@ -0,0 +1,38 @@
//
// Period.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Hollydays.
/// </summary>
public class Period {
[Required]
public DateTime Start { get; set; }
[Required]
public DateTime End { get; set; }
}
}

View file

@ -0,0 +1,43 @@
//
// Periodicity.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Periodicity.
/// </summary>
public enum Periodicity {
/// <summary>
/// The daily.
/// </summary>
Daily,
Weekly,
Monthly,
ThreeM,
SixM,
Yearly
}
}

View file

@ -0,0 +1,43 @@
//
// Position.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Position.
/// </summary>
public class Position
{
/// <summary>
/// The longitude.
/// </summary>
public double Longitude { get; set; }
/// <summary>
/// The latitude.
/// </summary>
public double Latitude { get; set; }
}
}

View file

@ -0,0 +1,42 @@
//
// PositionAndKeyphrase.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Position and keyphrase.
/// </summary>
public class PositionAndKeyphrase {
/// <summary>
/// The phrase.
/// </summary>
public string phrase;
/// <summary>
/// The position.
/// </summary>
public Position pos;
}
}

View file

@ -0,0 +1,40 @@
//
// ProvidedEvent.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Provided event.
/// </summary>
public class ProvidedEvent : NFEvent {
/// <summary>
/// The privacy.
/// </summary>
[Required]
public Publishing Privacy;
}
}

View file

@ -0,0 +1,73 @@
//
// ProviderPublicInfo.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Provider public info.
/// </summary>
public class ProviderPublicInfo {
/// <summary>
/// Gets or sets the display name.
/// </summary>
/// <value>The display name.</value>
[Required]
public string DisplayName { get; set; }
/// <summary>
/// Gets or sets the type of the location.
/// </summary>
/// <value>The type of the location.</value>
[Required]
public string LocationType { get; set; }
/// <summary>
/// Gets or sets the location.
/// </summary>
/// <value>The location.</value>
[Required]
public Position Location { get; set; }
/// <summary>
/// Gets or sets the logo image locator.
/// </summary>
/// <value>The logo image locator.</value>
public string LogoImgLocator { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
[Required]
public string Description { get; set;}
/// <summary>
/// Gets or sets the web page.
/// </summary>
/// <value>The web page.</value>
public string WebPage { get; set; }
/// <summary>
/// Gets or sets the calendar.
/// </summary>
/// <value>The calendar.</value>
public Schedule Calendar { get; set; }
}
}

View file

@ -0,0 +1,43 @@
//
// Publishing.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Publishing.
/// </summary>
public enum Publishing {
/// <summary>
/// The private.
/// </summary>
Private,
/// <summary>
/// The public.
/// </summary>
Public
}
}

View file

@ -0,0 +1,48 @@
//
// Schedule.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Schedule.
/// </summary>
public class Schedule {
public Periodicity Period { get; set; }
/// <summary>
/// Gets or sets the schedule of an open week.
/// One item by bay in the week,
/// </summary>
/// <value>The weekly workdays.</value>
public OpenDay [] WeekDays { get; set; }
/// <summary>
/// Gets or sets the hollydays.
/// </summary>
/// <value>The hollydays.</value>
[Required]
public Period [] Validity { get; set; }
}
}

View file

@ -0,0 +1,62 @@
//
// WeekDay.cs
//
// Author:
// Paul Schneider <paulschneider@free.fr>
//
// Copyright (c) 2015 Paul Schneider
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Web.Http;
using System.ComponentModel.DataAnnotations;
namespace Yavsc.ApiControllers.NightFlash.Model
{
/// <summary>
/// Week day.
/// </summary>
public enum WeekDay:int {
/// <summary>
/// The monday (0).
/// </summary>
Monday=0,
/// <summary>
/// The tuesday.
/// </summary>
Tuesday,
/// <summary>
/// The wednesday.
/// </summary>
Wednesday,
/// <summary>
/// The thursday.
/// </summary>
Thursday,
/// <summary>
/// The friday.
/// </summary>
Friday,
/// <summary>
/// The saturday.
/// </summary>
Saturday,
/// <summary>
/// The sunday.
/// </summary>
Sunday
}
}