/// <summary>
        /// Check for any delivery reports that have been received.
        /// Delivery reports are a notification of the change in status of a message as it is being processed.
        /// Each request to the check delivery reports endpoint will return any delivery reports received that
        /// have not yet been confirmed using the confirm delivery reports endpoint. A response from the check
        /// delivery reports endpoint will have the following structure:
        /// ```json
        /// {
        ///     "delivery_reports": [
        ///         {
        ///             "callback_url": "https://my.callback.url.com",
        ///             "delivery_report_id": "01e1fa0a-6e27-4945-9cdb-18644b4de043",
        ///             "source_number": "+61491570157",
        ///             "date_received": "2017-05-20T06:30:37.642Z",
        ///             "status": "enroute",
        ///             "delay": 0,
        ///             "submitted_date": "2017-05-20T06:30:37.639Z",
        ///             "original_text": "My first message!",
        ///             "message_id": "d781dcab-d9d8-4fb2-9e03-872f07ae94ba",
        ///             "vendor_account_id": {
        ///                 "vendor_id": "MessageMedia",
        ///                 "account_id": "MyAccount"
        ///             },
        ///             "metadata": {
        ///                 "key1": "value1",
        ///                 "key2": "value2"
        ///             }
        ///         },
        ///         {
        ///             "callback_url": "https://my.callback.url.com",
        ///             "delivery_report_id": "0edf9022-7ccc-43e6-acab-480e93e98c1b",
        ///             "source_number": "+61491570158",
        ///             "date_received": "2017-05-21T01:46:42.579Z",
        ///             "status": "enroute",
        ///             "delay": 0,
        ///             "submitted_date": "2017-05-21T01:46:42.574Z",
        ///             "original_text": "My second message!",
        ///             "message_id": "fbb3b3f5-b702-4d8b-ab44-65b2ee39a281",
        ///             "vendor_account_id": {
        ///                 "vendor_id": "MessageMedia",
        ///                 "account_id": "MyAccount"
        ///             },
        ///             "metadata": {
        ///                 "key1": "value1",
        ///                 "key2": "value2"
        ///             }
        ///         }
        ///     ]
        /// }
        /// ```
        /// Each delivery report will contain details about the message, including any metadata specified
        /// and the new status of the message (as each delivery report indicates a change in status of a
        /// message) and the timestamp at which the status changed. Every delivery report will have a
        /// unique delivery report ID for use with the confirm delivery reports endpoint.
        /// *Note: The source number and destination number properties in a delivery report are the inverse of
        /// those specified in the message that the delivery report relates to. The source number of the
        /// delivery report is the destination number of the original message.*
        /// Subsequent requests to the check delivery reports endpoint will return the same delivery reports
        /// and a maximum of 100 delivery reports will be returned in each request. Applications should use the
        /// confirm delivery reports endpoint in the following pattern so that delivery reports that have been
        /// processed are no longer returned in subsequent check delivery reports requests.
        /// 1. Call check delivery reports endpoint
        /// 2. Process each delivery report
        /// 3. Confirm all processed delivery reports using the confirm delivery reports endpoint
        /// *Note: It is recommended to use the Webhooks feature to receive reply messages rather than
        /// polling the check delivery reports endpoint.*
        /// </summary>
        /// <return>Returns the Models.CheckDeliveryReportsResponse response from the API call</return>
        public async Task <Models.CheckDeliveryReportsResponse> CheckDeliveryReportsAsync()
        {
            //the base uri for api requests
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/v1/delivery_reports");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "messagemedia-messages" },
                { "accept", "application/json" }
            };

            //append authentication headers
            AuthManager.Instance.GetAuthHeaders(_queryUrl, _baseUri).ToList().ForEach(x => _headers.Add(x.Key, x.Value));

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <Models.CheckDeliveryReportsResponse>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #2
0
        /// <summary>
        /// TODO: type endpoint description here
        /// </summary>
        /// <param name="queryParameters">Additional optional query parameters are supported by this endpoint</param>
        /// <return>Returns the ServerResponse response from the API call</return>
        public async Task <ServerResponse> QueryEchoAsync(Dictionary <string, object> queryParameters = null)
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/");

            //append optional parameters to the query
            APIHelper.AppendUrlWithQueryParameters(_queryBuilder, queryParameters);


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "Stamplay SDK" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <ServerResponse>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
        /// <summary>
        /// TODO: type endpoint description here
        /// </summary>
        /// <return>Returns the dynamic response from the API call</return>
        public async Task <dynamic> Get400Async()
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/error/400");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "Stamplay SDK" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request);

            HttpContext _context = new HttpContext(_request, _response);

            //Error handling using HTTP status codes
            if ((_response.StatusCode < 200) || (_response.StatusCode > 206)) //[200,206] = HTTP OK
            {
                throw new APIException(@"HTTP Response Not OK", _context);
            }

            try
            {
                return(APIHelper.JsonDeserialize <dynamic>(_response.Body));
            }
            catch (Exception ex)
            {
                throw new APIException("Failed to parse the response: " + ex.Message, _context);
            }
        }
        /// <summary>
        /// Get redemption request actions.
        /// </summary>
        /// <return>Returns the dynamic response from the API call</return>
        public async Task <dynamic> GetRedemptionRequestActionsAsync()
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/utilities/redemption-request-actions");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "APIMATIC 2.0" },
                { "accept", "application/json" }
            };

            _headers.Add("Content-Type", Configuration.ContentType);
            _headers.Add("X-Auth-Token", Configuration.XAuthToken);

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <dynamic>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
        /// <summary>
        /// Get scheduled payments
        /// </summary>
        /// <param name="payeeUid">Required parameter: Unique identifier of the payee</param>
        /// <param name="accountUid">Required parameter: Unique identifier of the payee account</param>
        /// <return>Returns the Models.ScheduledPayments response from the API call</return>
        public async Task <ScheduledPayments> ListPaymentOrdersForAccountAsync(Guid payeeUid, Guid accountUid)
        {
            //the base uri for api requests
            var baseUri = Configuration.GetBaseURI();

            //prepare query string for API call
            var queryBuilder = new StringBuilder(baseUri);

            queryBuilder.Append("/api/v2/payees/{payeeUid}/account/{accountUid}/scheduled-payments");

            //process optional template parameters
            APIHelper.AppendUrlWithTemplateParameters(queryBuilder, new Dictionary <string, object>
            {
                { "payeeUid", payeeUid },
                { "accountUid", accountUid }
            });


            //validate and preprocess url
            var queryUrl = APIHelper.CleanUrl(queryBuilder);

            //append request with appropriate headers and parameters
            var headers = APIHelper.GetRequestHeaders();

            //prepare the API call request to fetch the response
            var request = ClientInstance.Get(queryUrl, headers);

            //invoke request and get response
            var response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(request).ConfigureAwait(false);

            var context = new HTTPContext(request, response);

            //handle errors
            ValidateResponse(response, context);

            try
            {
                return(APIHelper.JsonDeserialize <ScheduledPayments>(response.Body));
            }
            catch (Exception ex)
            {
                throw new APIException("Failed to parse the response: " + ex.Message, context);
            }
        }
Exemple #6
0
        /// <summary>
        /// TODO: type endpoint description here
        /// </summary>
        /// <param name="transferId">Required parameter: Example: </param>
        /// <return>Returns the Models.GetTransfer response from the API call</return>
        public async Task<Models.GetTransfer> GetTransferByIdAsync(string transferId)
        {
            //the base uri for api requests
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);
            _queryBuilder.Append("/transfers/{transfer_id}");

            //process optional template parameters
            APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary<string, object>()
            {
                { "transfer_id", transferId }
            });


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary<string,string>()
            {
                { "user-agent", "MundiSDK - DotNet 0.16.21" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl,_headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse) await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);
            HttpContext _context = new HttpContext(_request,_response);
            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return APIHelper.JsonDeserialize<Models.GetTransfer>(_response.Body);
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
        /// <summary>
        /// A Config object has the following attributes:+ `timezone` - Our sever timezone+ `now` - Our server timestamp+ `version` - Current version is "1.0"+ `serverUrl` - Main API URL+ `photosUrl` - Base Path to server where we store our images+ `productsSorting` - Available Products lists sorting options (can be combined with commas, for example &sort=date,-price )    + `date` - Date ascending    + `-date` - Date descending    + `price` - Price ascending    + `-price` - Price descending    + `distance` - Distance ascending (works only if `latitude`,`longitude` & `distance` parameters are provided, ignored otherwise)     + `-distance` - Distance descending (works only if `latitude`,`longitude` & `distance` parameters are provided, ignored otherwise)+ user - All important userdata for provided API key    + `name` - Name / Company / Organization    + `email` - E-Mail Address    + `uuid` - Unique ID    + `continueUrl` - Continue URL (not in use now)    + `notifyUrl` - Notify URL (not in use now)    + `suggestedMarkup` - Suggested markup, % decimal value, for example 7.5    + `defaultPagination` - Default Pagination value (per page), between 1-100    + `defaultSortBy` - Default sort by for /products (if not specified)    + `defaultCurrencyUuid` - Default currency UUID for /products (if not specified)    + `defaultCurrencyCode` - Default currency code for /products (if not specified)    + `defaultLanguageUuid` - Default language UUID  /products (if not specified)    + `defaultLanguageCode` - Default language code  /products (if not specified)    + `walletBalance` - Partner's available wallet balance, based on his deposits    + `walletAvailableBalance` - Wallet balance which is a combination of partner's deposit and assigned credit amount    + `wallet_alert_value` - Threshold value in SGD, when `walletBallance` reach this value then BMG and partner will be notified on this event+ `languages` - A list of supported languages.+ `currencies` - An array of supported currencies.+ `types` - An array of supported products types.+ `categories` - A tree of supported product categories.+ `locations` - A tree of supported locations. (Continent -> Country -> State -> City)
        /// </summary>
        /// <return>Returns the RetrieveConfigResponse response from the API call</return>
        public async Task <RetrieveConfigResponse> RetrieveConfigAsync()
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/v1/config");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "BeMyGuest.SDK.v1" },
                { "accept", "application/json" }
            };

            _headers.Add("X-Authorization", Configuration.XAuthorization);

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <RetrieveConfigResponse>(_response.Body));
            }
            catch (Exception ex)
            {
                throw new APIException("Failed to parse the response: " + ex.Message, _context);
            }
        }
        /// <summary>
        /// دریافت لیست نوع خسارت
        /// </summary>
        /// <param name="xApiKey">Required parameter: کلید اختصاصی ارتباط با سرور</param>
        /// <return>Returns the Models.BaseModelDamageType response from the API call</return>
        public async Task <Models.BaseModelDamageType> GetDamageTypeAsync(string xApiKey)
        {
            //the base uri for api requests
            string _baseUri = Configuration.GetBaseURI();

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/DamageType");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "APIMATIC 2.0" },
                { "accept", "application/json" },
                { "x-api-key", xApiKey }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <Models.BaseModelDamageType>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #9
0
        /// <summary>
        /// Health Probe
        /// </summary>
        /// <return>Returns the ModelsStatusModel response from the API call</return>
        public async Task <StatusModel> GetHealthProbeAsync()
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/health/probe");


            //validate and preprocess url
            string _queryUrl = ApiHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "accept", "application/json" }
            };

            _headers.Add("X-Moesif-Application-Id", Configuration.ApplicationId);

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(ApiHelper.JsonDeserialize <StatusModel>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #10
0
        public LeaveRecords(CARSPage page, User pUser)
        {
            InitializeComponent();

            ClientInstance.Get().FindLeavesCompleted      += new EventHandler <FindLeavesCompletedEventArgs>(client_FindLeavesCompleted);
            ClientInstance.Get().GetMyLeavesCompleted     += new EventHandler <GetMyLeavesCompletedEventArgs>(client_GetMyLeavesCompleted);
            ClientInstance.Get().GetMyTeamLeavesCompleted += new EventHandler <GetMyTeamLeavesCompletedEventArgs>(client_GetMyTeamLeavesCompleted);

            mPage = page;

            if (pUser != null)
            {
                mUser = mUserRunAs = pUser;
                RefreshData(); // no change, current user, by default
            }

            RefreshUI();

            records.SelectionChanged += new SelectionChangedEventHandler(records_SelectionChanged);
        }
        /// <summary>
        /// Retrieves the specified file.
        /// </summary>
        /// <exception>Exception</exception>
        private void Checkout(string fileName)
        {
            string normalizedPath = RepositoryPath.NormalizeFolder(fileName);

            if (IsVaultFolder(normalizedPath))
            {
                VaultClientFolder vaultClientFolder = ClientInstance.TreeCache.Repository.Root.FindFolderRecursive(normalizedPath);

                if (!String.IsNullOrEmpty(WorkingFolder))
                {
                    ClientInstance.TreeCache.SetWorkingFolder(vaultClientFolder.FullPath, WorkingFolder);
                }

                ClientInstance.CheckOut(vaultClientFolder, true, VaultCheckOutType.CheckOut, Comment);
                ClientInstance.Get(vaultClientFolder, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null);

                Version = Convert.ToInt32(vaultClientFolder.Version);
                Log.LogMessage(MessageImportance.Normal, string.Format(Properties.Resources.VaultCheckoutSuccessful), vaultClientFolder.Name);
            }

            if (IsVaultFile(normalizedPath))
            {
                VaultClientFile vaultClientFile = ClientInstance.TreeCache.Repository.Root.FindFileRecursive(normalizedPath);

                if (!String.IsNullOrEmpty(WorkingFolder))
                {
                    ClientInstance.TreeCache.SetWorkingFolder(vaultClientFile.Parent.FullPath, WorkingFolder);
                }

                ClientInstance.CheckOut(vaultClientFile, VaultCheckOutType.CheckOut, Comment);
                ClientInstance.Get(vaultClientFile, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null);

                Version = Convert.ToInt32(vaultClientFile.Version);
                Log.LogMessage(MessageImportance.Normal, string.Format(Properties.Resources.VaultCheckoutSuccessful, vaultClientFile.Name));
            }

            if (IsVaultFolder(normalizedPath) == false && IsVaultFile(normalizedPath) == false)
            {
                throw new Exception(string.Format(Properties.Resources.VaultResourceNotFound, normalizedPath));
            }
        }
        /// <summary>
        /// Check for any replies that have been received.
        /// Replies are messages that have been sent from a handset in response to a message sent by an
        /// application or messages that have been sent from a handset to a inbound number associated with
        /// an account, known as a dedicated inbound number (contact <*****@*****.**> for more
        /// information on dedicated inbound numbers).
        /// Each request to the check replies endpoint will return any replies received that have not yet
        /// been confirmed using the confirm replies endpoint. A response from the check replies endpoint
        /// will have the following structure:
        /// ```json
        /// {
        ///     "replies": [
        ///         {
        ///             "metadata": {
        ///                 "key1": "value1",
        ///                 "key2": "value2"
        ///             },
        ///             "message_id": "877c19ef-fa2e-4cec-827a-e1df9b5509f7",
        ///             "reply_id": "a175e797-2b54-468b-9850-41a3eab32f74",
        ///             "date_received": "2016-12-07T08:43:00.850Z",
        ///             "callback_url": "https://my.callback.url.com",
        ///             "destination_number": "+61491570156",
        ///             "source_number": "+61491570157",
        ///             "vendor_account_id": {
        ///                 "vendor_id": "MessageMedia",
        ///                 "account_id": "MyAccount"
        ///             },
        ///             "content": "My first reply!"
        ///         },
        ///         {
        ///             "metadata": {
        ///                 "key1": "value1",
        ///                 "key2": "value2"
        ///             },
        ///             "message_id": "8f2f5927-2e16-4f1c-bd43-47dbe2a77ae4",
        ///             "reply_id": "3d8d53d8-01d3-45dd-8cfa-4dfc81600f7f",
        ///             "date_received": "2016-12-07T08:43:00.850Z",
        ///             "callback_url": "https://my.callback.url.com",
        ///             "destination_number": "+61491570157",
        ///             "source_number": "+61491570158",
        ///             "vendor_account_id": {
        ///                 "vendor_id": "MessageMedia",
        ///                 "account_id": "MyAccount"
        ///             },
        ///             "content": "My second reply!"
        ///         }
        ///     ]
        /// }
        /// ```
        /// Each reply will contain details about the reply message, as well as details of the message the reply was sent
        /// in response to, including any metadata specified. Every reply will have a reply ID to be used with the
        /// confirm replies endpoint.
        /// *Note: The source number and destination number properties in a reply are the inverse of those
        /// specified in the message the reply is in response to. The source number of the reply message is the
        /// same as the destination number of the original message, and the destination number of the reply
        /// message is the same as the source number of the original message. If a source number
        /// wasn't specified in the original message, then the destination number property will not be present
        /// in the reply message.*
        /// Subsequent requests to the check replies endpoint will return the same reply messages and a maximum
        /// of 100 replies will be returned in each request. Applications should use the confirm replies endpoint
        /// in the following pattern so that replies that have been processed are no longer returned in
        /// subsequent check replies requests.
        /// 1. Call check replies endpoint
        /// 2. Process each reply message
        /// 3. Confirm all processed reply messages using the confirm replies endpoint
        /// *Note: It is recommended to use the Webhooks feature to receive reply messages rather than polling
        /// the check replies endpoint.*
        /// </summary>
        /// <return>Returns the Models.CheckRepliesResponse response from the API call</return>
        public async Task <Models.CheckRepliesResponse> GetCheckRepliesAsync()
        {
            //the base uri for api requests
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/v1/replies");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "messagemedia-messages-csharp-sdk-1.0.0" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <Models.CheckRepliesResponse>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #13
0
 public void RefreshData(bool showAllRecords)
 {
     if (records.SelectedItem != null)
     {
         currentGUID = ((LeaveItem)records.SelectedItem).LeaveInfo.PKLeaveInfoID;
     }
     if (mPage == CARSPage.ApplyLeave || mPage == CARSPage.PersonalInfo)
     {
         ClientInstance.ShowSpinner("Loading Leaves");
         ClientInstance.Get().GetMyLeavesAsync(mUserRunAs.Employee.PKEmployeeID.ToString());
     }
     else if (mPage == CARSPage.ApproveLeave)
     {
         ClientInstance.ShowSpinner("Loading Leaves");
         ClientInstance.Get().GetMyTeamLeavesAsync(mUserRunAs.Employee.PKEmployeeID.ToString(), showAllRecords);
     }
     else if (mPage == CARSPage.LeaveHistory)
     {
         records.ItemsSource = null;
     }
 }
        /// <summary>
        /// TODO: type endpoint description here
        /// </summary>
        /// <return>Returns the DateTime response from the API call</return>
        public async Task <DateTime> GetDatetimeAsync()
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/response/datetime");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "Stamplay SDK" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(DateTime.ParseExact(_response.Body, APIHelper.DateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
        /// <summary>
        /// gets a binary object
        /// </summary>
        /// <return>Returns the Stream response from the API call</return>
        public async Task <Stream> GetBinaryAsync()
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/response/binary");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "Stamplay SDK" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpResponse _response = await ClientInstance.ExecuteAsBinaryAsync(_request);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(_response.RawBody);
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #16
0
        /// <summary>
        /// Retrieves the specified file.
        /// </summary>
        /// <exception>Exception</exception>
        private void GetFile(string fileName)
        {
            if (IsVaultFolder(fileName))
            {
                VaultClientFolder vaultClientFolder = ClientInstance.TreeCache.Repository.Root.FindFolderRecursive(fileName);

                if (Destination.Length == 0)
                {
                    if (!String.IsNullOrEmpty(WorkingFolder))
                    {
                        ClientInstance.TreeCache.SetWorkingFolder(vaultClientFolder.FullPath, WorkingFolder);
                    }

                    ClientInstance.Get(vaultClientFolder, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null);
                }
                else
                {
                    ClientInstance.GetToNonWorkingFolder(vaultClientFolder, true, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, Destination, null);
                }
            }

            if (IsVaultFile(fileName))
            {
                VaultClientFile vaultClientFile = ClientInstance.TreeCache.Repository.Root.FindFileRecursive(fileName);

                if (Destination.Length == 0)
                {
                    if (!String.IsNullOrEmpty(WorkingFolder))
                    {
                        ClientInstance.TreeCache.SetWorkingFolder(vaultClientFile.Parent.FullPath, WorkingFolder);
                    }

                    ClientInstance.Get(vaultClientFile, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, MergeType.OverwriteWorkingCopy, null);
                }
                else
                {
                    ClientInstance.GetToNonWorkingFolder(vaultClientFile, true, true, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, vaultClientFile.Parent.FullPath, Destination, null);
                }
            }
        }
Exemple #17
0
        public LeavePreview(User pUser, LeaveItem item, string warning)
        {
            InitializeComponent();

            ClientInstance.Get().ApplyLeaveCompleted += new EventHandler <ApplyLeaveCompletedEventArgs>(client_ApplyLeaveCompleted);

            SetLeaveValue(item);
            if (warning != "")
            {
                warningInfo.Height     = double.NaN;
                warningInfo.Visibility = System.Windows.Visibility.Visible;
                warningInfo.Text       = warning;
            }
            else
            {
                warningInfo.Height     = 0;
                warningInfo.Visibility = System.Windows.Visibility.Collapsed;
            }

            user      = pUser;
            leaveItem = item;
        }
Exemple #18
0
        /// <summary>
        /// Brand names associated with the product 573-5613789
        /// </summary>
        /// <param name="authToken">Required parameter: Example: </param>
        /// <param name="xid">Required parameter: Example: </param>
        /// <return>Returns the void response from the API call</return>
        public async Task GETASIProductAsync(string authToken, string xid)
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/product/{Xid}");

            //process optional template parameters
            APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary <string, object>()
            {
                { "Xid", xid }
            });


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "APIMATIC 2.0" },
                { "AuthToken", authToken }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);
        }
Exemple #19
0
        public async Task <Models.AccountResponse> GetAccountAsync(string accountId)
        {
            string _queryUrl = Utilities.APIHelper.GetBuiltUrl("account", accountId);

            var _headers = Utilities.APIHelper.GetHeader();

            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <Models.AccountResponse>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #20
0
        public ApplyControl(CARSPage page, User pUser)
        {
            InitializeComponent();

            if (pUser != null)
            {
                mUser = mUserRunAs = pUser;
            }

            mPage = page;
            this.recallButton.Visibility = System.Windows.Visibility.Collapsed;             // by default, hide this button

            ClientInstance.Get().GetAnnualLeaveEarnedHoursCompleted += new EventHandler <GetAnnualLeaveEarnedHoursCompletedEventArgs>(client_GetAnnualLeaveEarnedHoursCompleted);
            ClientInstance.Get().GetAnnualLeaveUsedHoursCompleted   += new EventHandler <GetAnnualLeaveUsedHoursCompletedEventArgs>(client_GetAnnualLeaveUsedHoursCompleted);
            ClientInstance.Get().GetSickLeaveUsedHoursCompleted     += new EventHandler <GetSickLeaveUsedHoursCompletedEventArgs>(client_GetSickLeaveUsedHoursCompleted);
            ClientInstance.Get().ApproveLeaveCompleted  += new EventHandler <ApproveLeaveCompletedEventArgs>(client_ApproveLeaveCompleted);
            ClientInstance.Get().GetLeaveTypesCompleted += new EventHandler <GetLeaveTypesCompletedEventArgs>(client_GetLeaveTypesCompleted);
            ClientInstance.Get().GetFrozenDateCompleted += new EventHandler <GetFrozenDateCompletedEventArgs>(ApplyControl_GetFrozenDateCompleted);
            ClientInstance.Get().RecallLeaveCompleted   += ApplyControl_RecallLeaveCompleted;

            ClientInstance.Get().GetLeaveTypesAsync();
            ClientInstance.Get().GetFrozenDateAsync();
        }
Exemple #21
0
        /// <summary>
        /// Fetch product subscription details for an account holder
        /// </summary>
        /// <return>Returns the Models.AccountHolderSubscription response from the API call</return>
        public async Task <AccountHolderSubscription> GetAccountHolderSubscriptionAsync()
        {
            //the base uri for api requests
            var baseUri = Configuration.GetBaseURI();

            //prepare query string for API call
            var queryBuilder = new StringBuilder(baseUri);

            queryBuilder.Append("/api/v2/subscriptions");


            //validate and preprocess url
            var queryUrl = APIHelper.CleanUrl(queryBuilder);

            //append request with appropriate headers and parameters
            var headers = APIHelper.GetRequestHeaders();

            //prepare the API call request to fetch the response
            var request = ClientInstance.Get(queryUrl, headers);

            //invoke request and get response
            var response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(request).ConfigureAwait(false);

            var context = new HTTPContext(request, response);

            //handle errors defined at the API level
            ValidateResponse(response, context);

            try
            {
                return(APIHelper.JsonDeserialize <AccountHolderSubscription>(response.Body));
            }
            catch (Exception ex)
            {
                throw new APIException("Failed to parse the response: " + ex.Message, context);
            }
        }
        /// <summary>
        /// Check account balance
        /// </summary>
        /// <return>Returns the void response from the API call</return>
        public async Task GetBalanceAsync()
        {
            //the base uri for api requests
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/balance");


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "D7SDK 1.0" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.APIUsername, Configuration.APIPassword);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //Error handling using HTTP status codes
            if (_response.StatusCode == 500)
            {
                throw new APIException(@"Internal Server Error", _context);
            }

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);
        }
        /// <summary>
        /// this has been created to do challenge 5.
        /// </summary>
        /// <return>Returns the void response from the API call</return>
        public async Task Challenge5Async()
        {
            //the base uri for api requests
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/challenge5");

            //process optional query parameters
            APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>()
            {
                { "key", Configuration.Key }
            }, ArrayDeserializationFormat, ParameterSeparator);


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "APIMATIC 2.0" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);
        }
Exemple #24
0
        void sc_ClickSearchButton(object sender, EventArgs e)
        {
            string typeID = string.Empty;

            if (sc.leaveType.SelectedIndex != 0)
            {
                typeID = ((LeaveTypeValue)sc.leaveType.SelectedItem).TypeValue.PKLeaveTypeID.ToString();
            }

            string status = ((ComboBoxItem)sc.leaveStatus.SelectedItem).Content.ToString();

            DateTime start = sc.start.SelectedDate.HasValue ? sc.start.SelectedDate.Value : DateTime.MinValue;
            DateTime end   = sc.end.SelectedDate.HasValue ? sc.end.SelectedDate.Value : DateTime.MaxValue;

            if (end != DateTime.MaxValue)
            {
                end = end.AddDays(1);
            }
            ClientInstance.ShowSpinner("Finding");
            string supervisor = ((User)sc.supervisor.SelectedItem).UserName == "" ? "" : ((User)sc.supervisor.SelectedItem).PKEmployeeID.ToString();
            string applicant  = ((User)sc.applicant.SelectedItem).UserName == "" ? "" : ((User)sc.applicant.SelectedItem).PKEmployeeID.ToString();

            ClientInstance.Get().FindLeavesAsync(supervisor, applicant, typeID, status, start, end, sc.SupervisorsID);
        }
Exemple #25
0
        /// <summary>
        /// RESTful web service to validate the expected weight of a given parcel against a measured value.
        /// [Download the YAML for this call](API_parcel_getWeight.yaml)
        /// </summary>
        /// <param name="ulCode">Required parameter: The tote ID of the parcel being validated. Cannot be specified if `parcel_id` is specified.</param>
        /// <param name="containerId">Optional parameter: A synonym for `ul_code`; will be ignored if `ul_code` is specified. The tote ID of the parcel being validated.</param>
        /// <param name="parcelId">Optional parameter: The internal parcel ID of the parcel being validated. Must not be specified if `ul_code` or `container_id` are specified, but is REQUIRED if they are not.</param>
        /// <param name="scannerId">Optional parameter: The ID of the scale performing the validation.</param>
        /// <param name="weight">Optional parameter: The weight of the parcel being validated.</param>
        /// <param name="units">Optional parameter: (Optional) For future expansion. Currently, only weights in pounds are supported.</param>
        /// <return>Returns the Models.ParcelCheckWeightGoodResponse response from the API call</return>
        public async Task <Models.ParcelCheckWeightGoodResponse> GetValidateParcelWeightAsync(
            string ulCode,
            string containerId     = null,
            long?parcelId          = null,
            string scannerId       = null,
            double?weight          = null,
            Models.UnitsEnum?units = null)
        {
            //the base uri for api requests
            string _baseUri = Configuration.GetBaseURI();

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/v2/parcel/checkWeight");

            //process optional query parameters
            APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>()
            {
                { "ul_code", ulCode },
                { "container_id", containerId },
                { "parcel_id", parcelId },
                { "scanner_id", scannerId },
                { "weight", weight },
                { "units", (units.HasValue) ? Models.UnitsEnumHelper.ToValue(units.Value) : null }
            }, ArrayDeserializationFormat, ParameterSeparator);


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "APIMATIC 2.0" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //Error handling using HTTP status codes
            if (_response.StatusCode == 400)
            {
                throw new ParcelCheckWeightBadResponseException(@"Response on Failure", _context);
            }

            if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK
            {
                throw new GenericError2Exception(@"Unexpected error", _context);
            }

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <Models.ParcelCheckWeightGoodResponse>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #26
0
        /// <summary>
        /// RESTful web service to get order status information.
        /// [Download the YAML for this call](API_order.yaml)
        /// </summary>
        /// <param name="clientCode">Required parameter: Unique client identifier</param>
        /// <param name="detailView">Optional parameter: Return extra details in the response, not just the status of the order.</param>
        /// <param name="startTime">Optional parameter: Return all orders during the date range starting at `startTime` and ending at `endTime`. Timestamp must be in [RFC3339](https://tools.ietf.org/html/rfc3339) format, i.e. `2018-02-18T00:00:00EST`.</param>
        /// <param name="endTime">Optional parameter: Required if `startTime` is specified. Return all orders during the date range starting at `startTime` and ending at `endTime`. Timestamp must be in [RFC3339](https://tools.ietf.org/html/rfc3339) format, i.e. `2018-02-18T00:00:00EST`.</param>
        /// <param name="orderNo">Optional parameter: Return the statuses of the specified orders.</param>
        /// <param name="limit">Optional parameter: Limit the number of results to the specified value.</param>
        /// <param name="offset">Optional parameter: Start returning results after skipping the specified number of results. Only valid when used in conjunction with `limit`; otherwise it is ignored.</param>
        /// <return>Returns the Models.OrderStatusResponse1 response from the API call</return>
        public async Task <Models.OrderStatusResponse1> GetOrderStatusAsync(
            string clientCode,
            Models.DetailView1Enum?detailView = null,
            DateTime?startTime    = null,
            DateTime?endTime      = null,
            List <string> orderNo = null,
            int?limit             = null,
            int?offset            = null)
        {
            //the base uri for api requests
            string _baseUri = Configuration.GetBaseURI();

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/v2/order");

            //process optional query parameters
            APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>()
            {
                { "clientCode", clientCode },
                { "detailView", (detailView.HasValue) ? Models.DetailView1EnumHelper.ToValue(detailView.Value) : null },
                { "startTime", (startTime.HasValue) ? startTime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null },
                { "endTime", (endTime.HasValue) ? endTime.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null },
                { "orderNo", orderNo },
                { "limit", limit },
                { "offset", offset }
            }, ArrayDeserializationFormat, ParameterSeparator);


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "APIMATIC 2.0" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //Error handling using HTTP status codes
            if (_response.StatusCode == 400)
            {
                throw new OrderStatusResponse1ErrorException(@"Response on Failure", _context);
            }

            if ((_response.StatusCode < 200) || (_response.StatusCode > 208)) //[200,208] = HTTP OK
            {
                throw new GenericError2Exception(@"Unexpected error", _context);
            }

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <Models.OrderStatusResponse1>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #27
0
        private void createButton_Click(object sender, MouseButtonEventArgs e)
        {
            // email
            if (baseInfo.userName.Text == "")
            {
                ShowError("Need input your email.");
                return;
            }

            // email's validation 1
            if (!baseInfo.IsEmailValid)
            {
                ShowError("Email is not valid. Email address only allows English, numbers or underscore.");
                return;
            }

            // email's validation 2
            if (baseInfo.userName.Text.ToLower().Contains("@"))
            {
                ShowError("You don't need to input \"@Advent.com\", CARS will add email suffix on it.");
                return;
            }

            // first name
            if (baseInfo.firstName.Text == "")
            {
                ShowError("Need your first name.");
                return;
            }

            // last name
            if (baseInfo.lastName.Text == "")
            {
                ShowError("Need your last name.");
                return;
            }

            // gender
            if (baseInfo.gender.SelectedIndex == -1)
            {
                ShowError("Select your Gender.");
                return;
            }

            // service years
            float serviceYears = 0f;

            if (baseInfo.serviceYears.Text == "" || !float.TryParse(baseInfo.serviceYears.Text, out serviceYears) || !baseInfo.IsServiceYearValid)
            {
                ShowError("Need input your service years. Like: 3 or 3.5");
                return;
            }
            else if (serviceYears < 0)
            {
                ShowError("Service years must be greater than 0.");
                return;
            }
            else if (serviceYears > 60f)
            {
                ShowError("Impossible, you are already retired? Service year is too big.");
                return;
            }

            // date of hire
            if (baseInfo.dateOfHire.SelectedDate == null || !baseInfo.dateOfHire.SelectedDate.HasValue)
            {
                ShowError("Select your date of hire.");
                return;
            }

            // supervisor
            if (baseInfo.supervisor.SelectedIndex == -1)
            {
                ShowError("Who will approval your leave application? Select \"Supervisor\"");
                return;
            }

            User manager = (User)baseInfo.supervisor.SelectedItem;

            ClientInstance.ShowSpinner();
            noteLabel.Visibility = System.Windows.Visibility.Collapsed;
            ClientInstance.Get().AddEmployeeAsync(baseInfo.userName.Text.ToLower().Trim() + baseInfo.emailSuffix.Content.ToString(),
                                                  baseInfo.firstName.Text.Trim(),
                                                  baseInfo.middleName.Text.Trim(),
                                                  baseInfo.lastName.Text.Trim(),
                                                  baseInfo.legalName.Text.Trim(),
                                                  baseInfo.gender.SelectedIndex == 0 ? Sex.Female : Sex.Male,
                                                  serviceYears,
                                                  baseInfo.dateOfHire.SelectedDate.Value, manager.Email, "5030"
                                                  , 0);
        }
Exemple #28
0
        /// <summary>
        /// Lists all charges
        /// </summary>
        /// <param name="page">Optional parameter: Page number</param>
        /// <param name="size">Optional parameter: Page size</param>
        /// <param name="code">Optional parameter: Filter for charge's code</param>
        /// <param name="status">Optional parameter: Filter for charge's status</param>
        /// <param name="paymentMethod">Optional parameter: Filter for charge's payment method</param>
        /// <param name="customerId">Optional parameter: Filter for charge's customer id</param>
        /// <param name="orderId">Optional parameter: Filter for charge's order id</param>
        /// <param name="createdSince">Optional parameter: Filter for the beginning of the range for charge's creation</param>
        /// <param name="createdUntil">Optional parameter: Filter for the end of the range for charge's creation</param>
        /// <return>Returns the Models.ListChargesResponse response from the API call</return>
        public async Task <Models.ListChargesResponse> GetChargesAsync(
            int?page              = null,
            int?size              = null,
            string code           = null,
            string status         = null,
            string paymentMethod  = null,
            string customerId     = null,
            string orderId        = null,
            DateTime?createdSince = null,
            DateTime?createdUntil = null)
        {
            //the base uri for api requests
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/charges");

            //process optional query parameters
            APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>()
            {
                { "page", page },
                { "size", size },
                { "code", code },
                { "status", status },
                { "payment_method", paymentMethod },
                { "customer_id", customerId },
                { "order_id", orderId },
                { "created_since", (createdSince.HasValue) ? createdSince.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null },
                { "created_until", (createdUntil.HasValue) ? createdUntil.Value.ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss.FFFFFFFK") : null }
            }, ArrayDeserializationFormat, ParameterSeparator);


            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "MundiSDK - DotNet 0.16.21" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers, Configuration.BasicAuthUserName, Configuration.BasicAuthPassword);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request).ConfigureAwait(false);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <Models.ListChargesResponse>(_response.Body));
            }
            catch (Exception _ex)
            {
                throw new APIException("Failed to parse the response: " + _ex.Message, _context);
            }
        }
Exemple #29
0
        /// <summary>
        /// TODO: type endpoint description here
        /// </summary>
        /// <param name="callback">Required parameter: The callback function that the JSON response will be wrapped in if desired</param>
        /// <param name="color">Required parameter: Vehicle color (i.e. black, white, blue, ..etc)</param>
        /// <param name="compressorType">Required parameter: The name of the aspiration of the vehicle engine (Acceptable values are: "", "supercharger", "twin-turbocharger", "turbocharger")</param>
        /// <param name="cylinders">Required parameter: The number of cylinders the vehicle engine has</param>
        /// <param name="drivenWheels">Required parameter: Vehicle drive type name (Acceptable values are: "", "all-wheel-drive", "front-wheel-drive", "rear-wheel-drive", "four-wheel-drive")</param>
        /// <param name="fuelType">Required parameter: Name of the type of fuel the vehicle engine uses (Acceptable values are: "", "electric", "natural-gas-cng", "gas", "flex-fuel-ffv", "diesel", "hybrid")</param>
        /// <param name="makeNiceName">Required parameter: Vehicle Make niceName</param>
        /// <param name="model">Required parameter: Vehicle Model name</param>
        /// <param name="msrp">Required parameter: Vehicle MSRP</param>
        /// <param name="trim">Required parameter: Vehicle trim name</param>
        /// <param name="vehicleStyle">Required parameter: Vehicle Style name</param>
        /// <param name="year">Required parameter: Vehicle model four-digit year</param>
        /// <param name="zip">Required parameter: Five-digit zipcode</param>
        /// <return>Returns the dynamic response from the API call</return>
        public async Task <dynamic> GetPriceAsync(
            string callback,
            string color,
            string compressorType,
            string cylinders,
            string drivenWheels,
            string fuelType,
            string makeNiceName,
            string model,
            string msrp,
            string trim,
            string vehicleStyle,
            string year,
            string zip)
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/api/v1/vehicle/{makeNiceName}/{year}/price");

            //process optional template parameters
            APIHelper.AppendUrlWithTemplateParameters(_queryBuilder, new Dictionary <string, object>()
            {
                { "makeNiceName", makeNiceName },
                { "year", year }
            });

            //process optional query parameters
            APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>()
            {
                { "callback", callback },
                { "color", color },
                { "compressorType", compressorType },
                { "cylinders", cylinders },
                { "drivenWheels", drivenWheels },
                { "fuelType", fuelType },
                { "model", model },
                { "msrp", msrp },
                { "trim", trim },
                { "vehicleStyle", vehicleStyle },
                { "zip", zip },
                { "api_key", Configuration.ApiKey }
            });

            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "APIMATIC 2.0" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <dynamic>(_response.Body));
            }
            catch (Exception ex)
            {
                throw new APIException("Failed to parse the response: " + ex.Message, _context);
            }
        }
Exemple #30
0
        /// <summary>
        /// TODO: type endpoint description here
        /// </summary>
        /// <param name="callback">Required parameter: The callback function that the JSON response will be wrapped in if desired</param>
        /// <param name="colorid">Required parameter: Vehicle color ID (&amp;colorid=xxx&amp;colorid=xxx&amp;colorid=xxx for multiples)</param>
        /// <param name="condition">Required parameter: Vehicle condition (Acceptable values are: "Outstanding", "Clean", "Average", "Rough", "Damaged")</param>
        /// <param name="fmt">Required parameter: Response format (json only) (Acceptable values are: "json")</param>
        /// <param name="mileage">Required parameter: Vehicle milage (e.g. 24000)</param>
        /// <param name="optionid">Required parameter: Vehicle option ID (&amp;optionid=xxx&amp;optionid=xxx&amp;optionid=xxx for multiples)</param>
        /// <param name="styleid">Required parameter: Vehicle style ID</param>
        /// <param name="zip">Required parameter: Five-digit zipcode</param>
        /// <return>Returns the dynamic response from the API call</return>
        public async Task <dynamic> GetCalculateusedtmvAsync(
            string callback,
            string colorid,
            string condition,
            string fmt,
            string mileage,
            string optionid,
            string styleid,
            string zip)
        {
            //the base uri for api requestss
            string _baseUri = Configuration.BaseUri;

            //prepare query string for API call
            StringBuilder _queryBuilder = new StringBuilder(_baseUri);

            _queryBuilder.Append("/v1/api/tmv/tmvservice/calculateusedtmv");


            //process optional query parameters
            APIHelper.AppendUrlWithQueryParameters(_queryBuilder, new Dictionary <string, object>()
            {
                { "callback", callback },
                { "colorid", colorid },
                { "condition", condition },
                { "fmt", fmt },
                { "mileage", mileage },
                { "optionid", optionid },
                { "styleid", styleid },
                { "zip", zip },
                { "api_key", Configuration.ApiKey }
            });

            //validate and preprocess url
            string _queryUrl = APIHelper.CleanUrl(_queryBuilder);

            //append request with appropriate headers and parameters
            var _headers = new Dictionary <string, string>()
            {
                { "user-agent", "APIMATIC 2.0" },
                { "accept", "application/json" }
            };

            //prepare the API call request to fetch the response
            HttpRequest _request = ClientInstance.Get(_queryUrl, _headers);

            //invoke request and get response
            HttpStringResponse _response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(_request);

            HttpContext _context = new HttpContext(_request, _response);

            //handle errors defined at the API level
            base.ValidateResponse(_response, _context);

            try
            {
                return(APIHelper.JsonDeserialize <dynamic>(_response.Body));
            }
            catch (Exception ex)
            {
                throw new APIException("Failed to parse the response: " + ex.Message, _context);
            }
        }