Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListDataTypesCommand"/> class.
 /// </summary>
 /// <param name="datasetName">Name of the dataset.</param>
 /// <param name="token">The token.</param>
 /// <param name="options">The options.</param>
 /// <remarks></remarks>
 public ListDataTypesCommand(string datasetName, string token, NCDCOptions options)
     : base(
         HTTPVerb.GET,
         string.Format("datasets/{0}/datatypes.json", datasetName),
         token, options)
 {
     this.DeserializationHandler = NCDCDataTypeCollection.Deserialize;
 }
Ejemplo n.º 2
0
 // all other types must go here
 /// <summary>
 /// Initializes a new instance of the <see cref="ListDataCommand"/> class.
 /// </summary>
 /// <param name="token">The token.</param>
 /// <param name="options">The options.</param>
 /// <remarks></remarks>
 public ListDataCommand(string token, NCDCOptions options)
     : base(
         HTTPVerb.GET,
         "",
         token, options)
 {
     this.DeserializationHandler = NCDCDataCollection.Deserialize;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowDataTypesCommand"/> class.
 /// </summary>
 /// <param name="token">The token.</param>
 /// <param name="options">The options.</param>
 /// <remarks></remarks>
 public ShowDataTypesCommand(string token, NCDCOptions options)
     : base(
         HTTPVerb.GET,
         "",
         token, options)
 {
     this.DeserializationHandler = NCDCDataType.Deserialize;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NCDCCommand&lt;T&gt;"/> class.
 /// </summary>
 /// <param name="method">The method.</param>
 /// <param name="endPoint">The end point.</param>
 /// <param name="token">The token.</param>
 /// <param name="optionalProperties">The optional properties.</param>
 /// <remarks></remarks>
 protected NCDCCommand(HTTPVerb method, string endPoint, string token, NCDCOptions optionalProperties)
 {
     this.RequestParameters = new Dictionary <string, object>();
     this.Verb                  = method;
     this.Token                 = token;
     this.NCDCOptions           = optionalProperties ?? new NCDCOptions();
     NCDCUtilities.CurrentToken = this.Token;
     this.SetCommandUri(endPoint);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Inits this instance.
        /// </summary>
        /// <remarks></remarks>
        public override void Init()
        {
            NCDCOptions options = this.NCDCOptions as NCDCOptions;

            if (options == null)
            {
                this.RequestParameters.Add("page", "1");

                return;
            }

            this.RequestParameters.Add("page", options.Page > 0 ? options.Page.ToString(CultureInfo.InvariantCulture) : "1");
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListDataCommand"/> class.
 /// </summary>
 /// <param name="datasetName">Name of the dataset.</param>
 /// <param name="locationTypeName">Name of the location type.</param>
 /// <param name="locationId">The location id.</param>
 /// <param name="stationId">The station id.</param>
 /// <param name="dataTypeId">The data type id.</param>
 /// <param name="token">The token.</param>
 /// <param name="options">The options.</param>
 /// <remarks></remarks>
 public ListDataCommand(string datasetName, string locationTypeName, string locationId, string stationId, string dataTypeId, string token, NCDCOptions options)
     : base(
         HTTPVerb.GET,
         string.Format("datasets/{0}/locationtypes/{1}/locations/{2}/stations/{3}/datatypes/{4}/data.json", datasetName, locationTypeName, locationId, stationId, dataTypeId),
         token, options)
 {
     this.DataSetName            = datasetName;
     this.LocationId             = locationId;
     this.LocationTypeId         = locationTypeName;
     this.StationId              = stationId;
     this.DataTypeId             = dataTypeId;
     this.DeserializationHandler = NCDCDataCollection.Deserialize;
 }
Ejemplo n.º 7
0
 public static NCDCResponse <NCDCDataCollection> GetDataForLocationTypeLocationAndDataType(string datasetName,
                                                                                           string locationTypeId, string locationId, string dataTypeId, string token = null, NCDCOptions options = null)
 {
     token = token ?? NCDCUtilities.GetUnlockedToken(); var command = new ListDataCommand(token, options);
     command.BuildDatasetLocationTypeLocationDataTypeUri(datasetName, locationTypeId, locationId, dataTypeId);
     return(NCDCCommand <NCDCDataCollection> .PerformAction(command));
 }
Ejemplo n.º 8
0
 public static NCDCResponse <NCDCDataCollection> GetDataForDataset(string datasetName, string token = null, NCDCOptions options = null)
 {
     token = token ?? NCDCUtilities.GetUnlockedToken(); var command = new ListDataCommand(datasetName, token, options);
     return(NCDCCommand <NCDCDataCollection> .PerformAction(command));
 }
Ejemplo n.º 9
0
        public static NCDCResponse <NCDCLocation> GetLocationInformation(string datasetName, string locationId, string token = null, NCDCOptions options = null)
        {
            token = token ?? NCDCUtilities.GetUnlockedToken();
            var command = new ShowLocationCommand(datasetName, locationId, token, options);

            return(NCDCCommand <NCDCLocation> .PerformAction(command));
        }
Ejemplo n.º 10
0
 public static NCDCResponse <NCDCDataType> GetDataTypeInformationForLocation(string datasetName, string locationId, string dataTypeId, string token = null, NCDCOptions options = null)
 {
     token = token ?? NCDCUtilities.GetUnlockedToken(); var command = new ShowDataTypesCommand(token, options);
     command.BuildDatasetsLocationsUri(datasetName, locationId, dataTypeId);
     return(NCDCCommand <NCDCDataType> .PerformAction(command));
 }
Ejemplo n.º 11
0
 public static NCDCResponse <NCDCDataTypeCollection> GetDataTypesForStation(string datasetName, string stationId, string token = null, NCDCOptions options = null)
 {
     token = token ?? NCDCUtilities.GetUnlockedToken(); var command = new ListDataTypesCommand(token, options);
     command.BuildDatasetsStationsUri(datasetName, stationId);
     return(NCDCCommand <NCDCDataTypeCollection> .PerformAction(command));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListStationsCommand"/> class.
 /// </summary>
 /// <param name="datasetName">Name of the dataset.</param>
 /// <param name="locationId">The location id.</param>
 /// <param name="token">The token.</param>
 /// <param name="options">The options.</param>
 /// <remarks></remarks>
 public ListStationsCommand(string datasetName, string locationId, string token, NCDCOptions options)
     : base(
         HTTPVerb.GET,
         string.Format("datasets/{0}/locations/{1}/stations.json", datasetName, locationId),
         token, options)
 {
     this.DeserializationHandler = NCDCStationCollection.Deserialize;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ShowDataTypesCommand"/> class.
 /// </summary>
 /// <param name="datasetName">Name of the dataset.</param>
 /// <param name="dataTypeId">The data type id.</param>
 /// <param name="token">The token.</param>
 /// <param name="options">The options.</param>
 /// <remarks></remarks>
 public ShowDataTypesCommand(string datasetName, string dataTypeId, string token, NCDCOptions options)
     : base(
         HTTPVerb.GET,
         string.Format("datasets/{0}/datatypes/{1}.json", datasetName, dataTypeId),
         token, options)
 {
     this.DeserializationHandler = NCDCDataType.Deserialize;
 }