示例#1
0
        public async Task <NlsLabeledItemSet <ManufacturingItem> > GetManufacturingItem(string _mfgItemId)
        {
            string searchManufacturingItems = string.Format("{0}{1}/{2}", GetBaseResource(), MANUFACTURING_ITEM, _mfgItemId);

            ManufacturingItemMask mfgItemMask = ManufacturingItemMask.Default;

            // masks
            Dictionary <string, string> queryParams = new Dictionary <string, string>();

            queryParams.Add("$mask", mfgItemMask.GetString());

            IRestResponse requestResponse = await GetAsync(searchManufacturingItems, queryParams);

            if (requestResponse.StatusCode != System.Net.HttpStatusCode.OK)
            {
                //handle according to established exception policy
                throw (new ManufacturingResponseException(requestResponse));
            }

            return(JsonConvert.DeserializeObject <NlsLabeledItemSet <ManufacturingItem> >(requestResponse.Content, new ManufacturingItemDetailsConverter()));
        }
示例#2
0
        public async Task <NlsLabeledItemSet <ManufacturingItemDetails> > SearchWithDetails(SearchQuery _searchQuery, long _skip = 0, long _top = 100)
        {
            string searchManufacturingItems = string.Format("{0}{1}{2}", GetBaseResource(), MANUFACTURING_ITEM, SEARCH);

            ManufacturingItemMask mfgItemMask = ManufacturingItemMask.Details;

            // masks
            Dictionary <string, string> queryParams = new Dictionary <string, string>();

            queryParams.Add("$mask", mfgItemMask.GetString());
            queryParams.Add("$skip", _skip.ToString());
            queryParams.Add("$top", _top.ToString());
            queryParams.Add("$searchStr", _searchQuery.GetSearchString());

            IRestResponse requestResponse = await GetAsync(searchManufacturingItems, queryParams);

            if (requestResponse.StatusCode != System.Net.HttpStatusCode.OK)
            {
                //handle according to established exception policy
                throw (new ManufacturingResponseException(requestResponse));
            }

            return(JsonConvert.DeserializeObject <NlsLabeledItemSet <ManufacturingItemDetails> >(requestResponse.Content, new ManufacturingItemDetailsConverter()));
        }