Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ServiceContract]
- public interface IPublic
- {
- #region GET
- /// <summary>
- /// test
- /// <para>appKey</para>
- /// </summary>
- /// <returns></returns>
- [OperationContract]
- [WebInvoke(Method = "GET", BodyStyle=WebMessageBodyStyle.Wrapped, UriTemplate = "GetOperators?appKey={apk}",
- RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
- ResultList GetOperators(string apk);
- /// <summary>
- /// Get a list of all the stop names for a specific operator
- /// </summary>
- /// <param name=appKey>api access key</param>
- /// <param name=op>operator name</param>
- /// <returns>ResultList object</returns>
- [OperationContract]
- [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "GetStopNames?appKey={apk}&op={op}"
- ,RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
- ResultList GetStopNames(string apk,string op);
- /// <summary>
- /// Get the best route to take from one location to another,
- /// using a specific operator.
- /// </summary>
- /// <param name=appKey>api access key</param>
- /// <param name=op>operator name</param>
- /// <returns>ScheduleResult object</returns>
- [OperationContract]
- [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "GetSchedule?appKey={apk}&op={op}&loc={loc}&dest={dest}&date={date}&time={time}",
- RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
- ScheduleResult GetSchedule(string apk, string op, string loc, string dest, string date, string time);
- #endregion
- #region POST
- [OperationContract]
- [WebInvoke(Method = "POST", UriTemplate = "OperatorFeedback",
- RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
- ResultList OperatorFeedback();
- #endregion
- }
- /// <summary>
- /// Most basic DataContract, contains an array of strings and a status message
- /// </summary>
- [DataContract]
- public class ResultList
- {
- [DataMember]
- public string Status = "No Data";
- [DataMember]
- public string Error = "";
- [DataMember]
- public string [] Results { get; set; }
- public ResultList(string [] result, string status, string error)
- {
- Results = result;
- Status = status;
- Error = error;
- }
- }
- /// <summary>
- /// Represent the result of a routing query
- /// </summary>
- [DataContract]
- public class ScheduleResult
- {
- /// <summary>
- /// Status of the result.
- /// Can be "SUCCESS", "ERROR" or "EMPTY"
- /// </summary>
- [DataMember]
- public string Status = "No Data";
- /// <summary>
- /// Any extra details regarding errors go here
- /// </summary>
- [DataMember]
- public string Error = "";
- /// <summary>
- /// Total cost to travel this route.
- /// </summary>
- [DataMember]
- public string Cost;
- /// <summary>
- /// Time from now until the first route starts.
- /// </summary>
- [DataMember]
- public string StartingTime;
- /// <summary>
- /// Array of SchedItems, containing the actual route information.
- /// </summary>
- [DataMember]
- public SchedItem[] Path;
- }
- /// <summary>
- /// A single segment of a route
- /// </summary>
- [DataContract]
- public class SchedItem
- {
- [DataMember]
- public SchedStop Stop;
- [DataMember]
- public string Time;
- [DataMember]
- public string Direction;
- [DataMember]
- public string Operator;
- [DataMember]
- public string Type;
- [DataMember]
- public string RouteName;
- [DataMember]
- public string RouteColor;
- [DataMember]
- public string Vehicle;
- }
- /// <summary>
- /// Information regarding a stop
- /// </summary>
- [DataContract]
- public class SchedStop
- {
- [DataMember]
- public string Name;
- [DataMember]
- public SchedLocation Location;
- }
- /// <summary>
- /// A location with latitude and longitude
- /// </summary>
- [DataContract]
- public class SchedLocation
- {
- [DataMember]
- public float latitude;
- [DataMember]
- public float longitude;
- }
- /// <summary>
- /// A list of stops with names and locations.
- /// </summary>
- [DataContract]
- public class SchedStopList
- {
- [DataMember]
- public string Status = "No Data";
- [DataMember]
- public string Error = "";
- [DataMember]
- public SchedStop[] Stops;
- public SchedStopList(int length, string status, string err)
- {
- Stops = new SchedStop[length];
- Status = status;
- Error = err;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement