Authentication

List of public methods. Note that along with each call return value there will be a additional info obejct having

  1. a. AuthenticationValue.ServiceResult int value 0=Failed result | value >0 (1=ok, n=count of returned objects)
  2. b. AuthenticationValue.ServiceResultDescription blank if all good, else description of the issue

Get a single vehicle

        private int GetVehicle(long vehicleId)
        {
            _service = new ServiceVehicleSelects();
            _auth = new Authentication {Ticket = MyPrivateToken};

            _service.AuthenticationValue = _auth;
            VehicleProxy singleVehicle = _service.GetVehicle(vehicleId);

            if (_service.AuthenticationValue.ServiceResult > 0 && singleVehicle.Vehicle != null)
            {
                Trace.WriteLine(singleVehicle.Vehicle.ManufacturerModel);
            }
            return _service.AuthenticationValue.ServiceResult;
        }
        

Get a vehicle count

Get a count of vehicles based on the given query, Generally this function is used before calling GetVehicleCollection method, in order to figure out how many records return for Pagination.

        //Get vehicle count with blank query (requesting for all records)
        [TestMethod]
        public void VehicleCollectionCountAllRecords()
        {
            var query = new VehicleSearchQueryProxy();
            int returnVal = GetVehicleCount(query);
            Assert.IsTrue(returnVal >0);
            Trace.WriteLine(returnVal + " records found");
        }
        
        //Get vehicle count with a valid query
        [TestMethod]
        public void VehicleCollectionCountQueryTest()
        {
            var query = new VehicleSearchQueryProxy();
            query.ManufacturerNameLike = "Toyota";
            query.ModelNameLike = "Allex";
            int returnVal = GetVehicleCount(query);
            Assert.IsTrue(returnVal > 0);
            Trace.WriteLine(returnVal + " records found");
        }

        private int GetVehicleCount(VehicleSearchQueryProxy query)
        {
            _service = new ServiceVehicleSelects();
            _auth = new Authentication();

            _auth.Ticket = MyPrivateToken;
            _service.AuthenticationValue = _auth;

            return _service.GetVehicleCollectionCount(query);
        }
        

Get a list of vehicles

        
        // Get record collection with a blank query
        [TestMethod]
        public void VehicleCollectionAllRecords()
        {
            //blank query
            var query = new VehicleSearchQueryProxy();

            VehicleProxyCollection returnValue = GetVehicleCollection(query);
            Assert.IsTrue(returnValue != null && returnValue.Vehicles.Length > 0 && returnValue.Vehicles[0] != null);

            foreach (VehicleProxy vehicle in returnValue.Vehicles)
            {
                string temp = string.Empty;
                temp += "Make: " + vehicle.Vehicle.ManufacturerName;
                temp += "| Model: " + vehicle.Vehicle.ModelName;
                temp += "| Year: " + vehicle.Vehicle.Year;
                temp += "| Images: " + vehicle.Images.Length;
                Trace.WriteLine(temp);
            }
        }
        
        // Get record collection with query    
        [TestMethod]
        public void VehicleCollectionQuery()
        {
            var query = new VehicleSearchQueryProxy();
            query.ManufacturerNameLike = "Toyota";
            query.ModelNameLike = "Allex";

            VehicleProxyCollection returnValue = GetVehicleCollection(query);
            Assert.IsTrue(returnValue != null && returnValue.Vehicles.Length > 0 && returnValue.Vehicles[0] != null);

            foreach (VehicleProxy vehicle in returnValue.Vehicles)
            {
                string temp = string.Empty;
                temp += "Make: " + vehicle.Vehicle.ManufacturerName;
                temp += "| Model: " + vehicle.Vehicle.ModelName;
                temp += "| Year: " + vehicle.Vehicle.Year;
                temp += "| Images: " + vehicle.Images.Length;
                Trace.WriteLine(temp);
            }
        }
        
        private VehicleProxyCollection GetVehicleCollection(VehicleSearchQueryProxy query)
        {
            _service = new ServiceVehicleSelects();
            _auth = new Authentication();

            _auth.Ticket = MyPrivateToken;
            _service.AuthenticationValue = _auth;

            VehicleProxyCollection vehicleCollection = _service.GetVehicleCollection(query);

            if (_service.AuthenticationValue.ServiceResult > 0 && vehicleCollection.Vehicles != null)
            {
                Trace.WriteLine("Return count: " + _service.AuthenticationValue.ServiceResult);
            }
            return vehicleCollection;
        }
        

Search Query Parameters

You may pass parameteres via a ""VehicleProxy" class inorder to filter requested data.

Data Parameters

  1. ManufacturerNameLike
  2. Example "toyota", "Nissan" not case sensitive.

  3. ModelNameLike
  4. Example "Allex", "Skyline" not case sensitive.

  5. PriceFrom
  6. PriceTo
  7. TypeNameLike
  8. Allowed types are: Classic, Coach, Competition Car, Convertible, Coupe, Damaged Car, Go Karts, Hatchback,Hot Rod Kart, RV-SUV, Sedan,Station Wagon, Ute and Van.

  9. YearFrom
  10. YearTo

Control Parameters

  1. CompanyId
  2. Only applicable for multi branch dealerships.

  3. AssociateBranchId
  4. Only applicable for multi branch dealerships. Main branch is requesting another branche's records by passing the branch id.

  5. AssociateBranchList
  6. Only applicable for multi branch dealerships. Main branch is requesting records of multiple branch's, a list of branch id's seperated by comma.

  7. MaxRecords
  8. You may restrict number of records recieved my this attaribute.

  9. PageSize
  10. Used in pagination. How many records to request for one page.

  11. PageNumber
  12. Used in pagination. Which page number to retrieve.

  13. OrderByName
  14. Which filed name to sort the result collection. Any field in "VehicleProxy" class can be sorted by.

  15. SortByName
  16. "asc" or "desc".

 
 
Developers  |  Terms & Conditions  |  Copyright Notice  |  Privacy Policy  |  Contact Us   © Trade Me Ltd