internal XmlObjectSerializerReadContextComplexJson(DataContractJsonSerializer serializer, DataContract rootTypeDataContract)
     : base(serializer, serializer.MaxItemsInObjectGraph, new StreamingContext(StreamingContextStates.All), serializer.IgnoreExtensionDataObject)
 {
     this.rootTypeDataContract    = rootTypeDataContract;
     this.serializerKnownTypeList = serializer.knownTypeList;
     _dateTimeFormat            = serializer.DateTimeFormat;
     _useSimpleDictionaryFormat = serializer.UseSimpleDictionaryFormat;
 }
 internal XmlObjectSerializerReadContextComplexJson(DataContractJsonSerializerImpl serializer, DataContract rootTypeDataContract)
     : base(serializer, serializer.MaxItemsInObjectGraph, default(StreamingContext), false)
 {
     this.rootTypeDataContract    = rootTypeDataContract;
     this.serializerKnownTypeList = serializer.knownTypeList;
     _dateTimeFormat            = serializer.DateTimeFormat;
     _useSimpleDictionaryFormat = serializer.UseSimpleDictionaryFormat;
 }
 public static AttributeMetadata CreateDateTime(DateTimeFormat?format = DateTimeFormat.DateOnly, ImeMode?mode = ImeMode.Auto, string formulaDefinition = null)
 {
     return(new DateTimeAttributeMetadata
     {
         Format = format,
         ImeMode = mode,
         FormulaDefinition = formulaDefinition
     });
 }
Beispiel #4
0
 internal static DateTime ParseJsonDate(string originalDateTimeValue, DateTimeFormat?dateTimeFormat)
 {
     if (dateTimeFormat == null)
     {
         return(ParseJsonDateInDefaultFormat(originalDateTimeValue));
     }
     else
     {
         return(DateTime.ParseExact(originalDateTimeValue, dateTimeFormat.FormatString, dateTimeFormat.FormatProvider, dateTimeFormat.DateTimeStyles));
     }
 }
Beispiel #5
0
 private void Initialize(Type type,
                         XmlDictionaryString?rootName,
                         IEnumerable <Type>?knownTypes,
                         int maxItemsInObjectGraph,
                         bool ignoreExtensionDataObject,
                         EmitTypeInformation emitTypeInformation,
                         bool serializeReadOnlyTypes,
                         DateTimeFormat?dateTimeFormat,
                         bool useSimpleDictionaryFormat)
 {
     Initialize(type, knownTypes, maxItemsInObjectGraph, ignoreExtensionDataObject, emitTypeInformation, serializeReadOnlyTypes, dateTimeFormat, useSimpleDictionaryFormat);
     _rootName = ConvertXmlNameToJsonName(rootName);
     _rootNameRequiresMapping = CheckIfJsonNameRequiresMapping(_rootName);
 }
Beispiel #6
0
        private void Initialize(Type type,
                                IEnumerable <Type>?knownTypes,
                                int maxItemsInObjectGraph,
                                bool ignoreExtensionDataObject,
                                EmitTypeInformation emitTypeInformation,
                                bool serializeReadOnlyTypes,
                                DateTimeFormat?dateTimeFormat,
                                bool useSimpleDictionaryFormat)
        {
            ArgumentNullException.ThrowIfNull(type);

            _rootType = type;

            if (knownTypes != null)
            {
                this.knownTypeList = new List <Type>();
                foreach (Type knownType in knownTypes)
                {
                    this.knownTypeList.Add(knownType);
                    if (knownType != null)
                    {
                        AddCollectionItemTypeToKnownTypes(knownType);
                    }
                }
            }

            if (maxItemsInObjectGraph < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxItemsInObjectGraph), SR.ValueMustBeNonNegative);
            }
            _maxItemsInObjectGraph     = maxItemsInObjectGraph;
            _ignoreExtensionDataObject = ignoreExtensionDataObject;
            _emitTypeInformation       = emitTypeInformation;
            _serializeReadOnlyTypes    = serializeReadOnlyTypes;
            _dateTimeFormat            = dateTimeFormat;
            _useSimpleDictionaryFormat = useSimpleDictionaryFormat;
        }
Beispiel #7
0
 /// <summary>Initializes a new instance of the <see cref="T:Microsoft.Xrm.Sdk.Metadata.DateTimeAttributeMetadata"></see> class</summary>
 /// <param name="format">Type: Returns_Nullable&lt;<see cref="T:Microsoft.Xrm.Sdk.Metadata.DateTimeFormat"></see>&gt;.
 /// The date/time display format.</param>
 /// <param name="schemaName">Type: Returns_String.
 /// The schema name of the attribute.</param>
 public DateTimeAttributeMetadata(DateTimeFormat?format, string schemaName)
     : base(AttributeTypeCode.DateTime, schemaName)
 {
     this.Format = format;
 }
Beispiel #8
0
 /// <summary>Initializes a new instance of the <see cref="T:Microsoft.Xrm.Sdk.Metadata.DateTimeAttributeMetadata"></see> class</summary>
 /// <param name="format">Type: Returns_Nullable&lt;<see cref="T:Microsoft.Xrm.Sdk.Metadata.DateTimeFormat"></see>&gt;.
 /// The date/time display format.</param>
 public DateTimeAttributeMetadata(DateTimeFormat?format)
     : this(format, (string)null)
 {
 }
 public JsonWriterDelegator(XmlWriter writer, DateTimeFormat?dateTimeFormat)
     : this(writer)
 {
     _dateTimeFormat = dateTimeFormat;
 }
        /// <summary>
        /// Current Account Prices Get pricing information for a specified list of Instruments within an Account.
        /// </summary>
        /// <exception cref="GeriRemenyi.Oanda.V20.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountID">Account identifier</param>
        /// <param name="instruments">List of Instruments to get pricing for.</param>
        /// <param name="acceptDatetimeFormat">Format of DateTime fields in the request and response. (optional)</param>
        /// <param name="since">Date/Time filter to apply to the response. Only prices and home conversions (if requested) with a time later than this filter (i.e. the price has changed after the since time) will be provided, and are filtered independently. (optional)</param>
        /// <param name="includeUnitsAvailable">Flag that enables the inclusion of the unitsAvailable field in the returned Price objects. (optional)</param>
        /// <param name="includeHomeConversions">Flag that enables the inclusion of the homeConversions field in the returned response. An entry will be returned for each currency in the set of all base and quote currencies present in the requested instruments list. (optional)</param>
        /// <returns>Task of ApiResponse (PricingResponse)</returns>
        public async System.Threading.Tasks.Task <GeriRemenyi.Oanda.V20.Client.Client.ApiResponse <PricingResponse> > GetPricingAsyncWithHttpInfo(string accountID, List <InstrumentName> instruments, DateTimeFormat?acceptDatetimeFormat = default(DateTimeFormat?), string since = default(string), bool?includeUnitsAvailable = default(bool?), bool?includeHomeConversions = default(bool?))
        {
            // verify the required parameter 'accountID' is set
            if (accountID == null)
            {
                throw new GeriRemenyi.Oanda.V20.Client.Client.ApiException(400, "Missing required parameter 'accountID' when calling PricingApi->GetPricing");
            }

            // verify the required parameter 'instruments' is set
            if (instruments == null)
            {
                throw new GeriRemenyi.Oanda.V20.Client.Client.ApiException(400, "Missing required parameter 'instruments' when calling PricingApi->GetPricing");
            }


            GeriRemenyi.Oanda.V20.Client.Client.RequestOptions localVarRequestOptions = new GeriRemenyi.Oanda.V20.Client.Client.RequestOptions();

            String[] _contentTypes = new String[] {
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            localVarRequestOptions.PathParameters.Add("accountID", GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToString(accountID)); // path parameter
            localVarRequestOptions.QueryParameters.Add(GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToMultiMap("csv", "instruments", instruments));
            if (since != null)
            {
                localVarRequestOptions.QueryParameters.Add(GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToMultiMap("", "since", since));
            }
            if (includeUnitsAvailable != null)
            {
                localVarRequestOptions.QueryParameters.Add(GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToMultiMap("", "includeUnitsAvailable", includeUnitsAvailable));
            }
            if (includeHomeConversions != null)
            {
                localVarRequestOptions.QueryParameters.Add(GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToMultiMap("", "includeHomeConversions", includeHomeConversions));
            }
            if (acceptDatetimeFormat != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept-Datetime-Format", GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToString(acceptDatetimeFormat)); // header parameter
            }

            // authentication (PersonalAccessToken) required
            // bearer authentication required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.GetAsync <PricingResponse>("/accounts/{accountID}/pricing", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("GetPricing", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
        /// <summary>
        /// Current Account Prices Get pricing information for a specified list of Instruments within an Account.
        /// </summary>
        /// <exception cref="GeriRemenyi.Oanda.V20.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountID">Account identifier</param>
        /// <param name="instruments">List of Instruments to get pricing for.</param>
        /// <param name="acceptDatetimeFormat">Format of DateTime fields in the request and response. (optional)</param>
        /// <param name="since">Date/Time filter to apply to the response. Only prices and home conversions (if requested) with a time later than this filter (i.e. the price has changed after the since time) will be provided, and are filtered independently. (optional)</param>
        /// <param name="includeUnitsAvailable">Flag that enables the inclusion of the unitsAvailable field in the returned Price objects. (optional)</param>
        /// <param name="includeHomeConversions">Flag that enables the inclusion of the homeConversions field in the returned response. An entry will be returned for each currency in the set of all base and quote currencies present in the requested instruments list. (optional)</param>
        /// <returns>Task of PricingResponse</returns>
        public async System.Threading.Tasks.Task <PricingResponse> GetPricingAsync(string accountID, List <InstrumentName> instruments, DateTimeFormat?acceptDatetimeFormat = default(DateTimeFormat?), string since = default(string), bool?includeUnitsAvailable = default(bool?), bool?includeHomeConversions = default(bool?))
        {
            GeriRemenyi.Oanda.V20.Client.Client.ApiResponse <PricingResponse> localVarResponse = await GetPricingAsyncWithHttpInfo(accountID, instruments, acceptDatetimeFormat, since, includeUnitsAvailable, includeHomeConversions);

            return(localVarResponse.Data);
        }
Beispiel #12
0
        /// <summary>
        /// Close Position Closeout the open Position for a specific instrument in an Account.
        /// </summary>
        /// <exception cref="GeriRemenyi.Oanda.V20.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountID">Account identifier</param>
        /// <param name="instrument">Instrument name</param>
        /// <param name="closePositionRequest">Representation of how to close the position</param>
        /// <param name="acceptDatetimeFormat">Format of DateTime fields in the request and response. (optional)</param>
        /// <returns>Task of ApiResponse (ClosePositionResponse)</returns>
        public async System.Threading.Tasks.Task <GeriRemenyi.Oanda.V20.Client.Client.ApiResponse <ClosePositionResponse> > ClosePositionAsyncWithHttpInfo(string accountID, InstrumentName instrument, ClosePositionRequest closePositionRequest, DateTimeFormat?acceptDatetimeFormat = default(DateTimeFormat?))
        {
            // verify the required parameter 'accountID' is set
            if (accountID == null)
            {
                throw new GeriRemenyi.Oanda.V20.Client.Client.ApiException(400, "Missing required parameter 'accountID' when calling PositionApi->ClosePosition");
            }

            // verify the required parameter 'closePositionRequest' is set
            if (closePositionRequest == null)
            {
                throw new GeriRemenyi.Oanda.V20.Client.Client.ApiException(400, "Missing required parameter 'closePositionRequest' when calling PositionApi->ClosePosition");
            }


            GeriRemenyi.Oanda.V20.Client.Client.RequestOptions localVarRequestOptions = new GeriRemenyi.Oanda.V20.Client.Client.RequestOptions();

            String[] _contentTypes = new String[] {
                "application/json"
            };

            // to determine the Accept header
            String[] _accepts = new String[] {
                "application/json"
            };

            foreach (var _contentType in _contentTypes)
            {
                localVarRequestOptions.HeaderParameters.Add("Content-Type", _contentType);
            }

            foreach (var _accept in _accepts)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept", _accept);
            }

            localVarRequestOptions.PathParameters.Add("accountID", GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToString(accountID));   // path parameter
            localVarRequestOptions.PathParameters.Add("instrument", GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToString(instrument)); // path parameter
            if (acceptDatetimeFormat != null)
            {
                localVarRequestOptions.HeaderParameters.Add("Accept-Datetime-Format", GeriRemenyi.Oanda.V20.Client.Client.ClientUtils.ParameterToString(acceptDatetimeFormat)); // header parameter
            }
            localVarRequestOptions.Data = closePositionRequest;

            // authentication (PersonalAccessToken) required
            // bearer authentication required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken);
            }

            // make the HTTP request

            var localVarResponse = await this.AsynchronousClient.PutAsync <ClosePositionResponse>("/accounts/{accountID}/positions/{instrument}/close", localVarRequestOptions, this.Configuration);

            if (this.ExceptionFactory != null)
            {
                Exception _exception = this.ExceptionFactory("ClosePosition", localVarResponse);
                if (_exception != null)
                {
                    throw _exception;
                }
            }

            return(localVarResponse);
        }
Beispiel #13
0
        /// <summary>
        /// Close Position Closeout the open Position for a specific instrument in an Account.
        /// </summary>
        /// <exception cref="GeriRemenyi.Oanda.V20.Client.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountID">Account identifier</param>
        /// <param name="instrument">Instrument name</param>
        /// <param name="closePositionRequest">Representation of how to close the position</param>
        /// <param name="acceptDatetimeFormat">Format of DateTime fields in the request and response. (optional)</param>
        /// <returns>Task of ClosePositionResponse</returns>
        public async System.Threading.Tasks.Task <ClosePositionResponse> ClosePositionAsync(string accountID, InstrumentName instrument, ClosePositionRequest closePositionRequest, DateTimeFormat?acceptDatetimeFormat = default(DateTimeFormat?))
        {
            GeriRemenyi.Oanda.V20.Client.Client.ApiResponse <ClosePositionResponse> localVarResponse = await ClosePositionAsyncWithHttpInfo(accountID, instrument, closePositionRequest, acceptDatetimeFormat);

            return(localVarResponse.Data);
        }
Beispiel #14
0
 /// <summary>
 /// Close Position Closeout the open Position for a specific instrument in an Account.
 /// </summary>
 /// <exception cref="GeriRemenyi.Oanda.V20.Client.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="accountID">Account identifier</param>
 /// <param name="instrument">Instrument name</param>
 /// <param name="closePositionRequest">Representation of how to close the position</param>
 /// <param name="acceptDatetimeFormat">Format of DateTime fields in the request and response. (optional)</param>
 /// <returns>ClosePositionResponse</returns>
 public ClosePositionResponse ClosePosition(string accountID, InstrumentName instrument, ClosePositionRequest closePositionRequest, DateTimeFormat?acceptDatetimeFormat = default(DateTimeFormat?))
 {
     GeriRemenyi.Oanda.V20.Client.Client.ApiResponse <ClosePositionResponse> localVarResponse = ClosePositionWithHttpInfo(accountID, instrument, closePositionRequest, acceptDatetimeFormat);
     return(localVarResponse.Data);
 }
Beispiel #15
0
 public DateTimeArrayJsonHelperWithString(DateTimeFormat?dateTimeFormat)
 {
     _dateTimeFormat = dateTimeFormat;
 }
Beispiel #16
0
 public JsonReaderDelegator(XmlReader reader, DateTimeFormat?dateTimeFormat)
     : this(reader)
 {
     _dateTimeFormat = dateTimeFormat;
 }