Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using VillasDirectAPITests.Helpers;
- using VillasDirectAPITests.Helpers.Models;
- using VillasDirectAPITests.Models;
- using VillasDirectAPITests.Models.Agency;
- namespace VillasDirectAPITests
- {
- public static class Actions
- {
- #region Public Methods
- public static Response<AvailabilityResponseParams> CheckAvailability(AvailabilityRequestParams requestData, string system, int agencyId)
- {
- string url = string.Format("/api/availability?system={0}&agencyId={1}", system, agencyId);
- return HttpHelper.Post<AvailabilityRequestParams, AvailabilityResponseParams>(url, requestData);
- }
- public static Response<List<AvailabilitiesResponseParams>> CheckAvailabilities(AvailabilitiesRequestParams requestData)
- {
- string url = "/api/properties/availability";
- return HttpHelper.Post<AvailabilitiesRequestParams, List<AvailabilitiesResponseParams>>(url, requestData);
- }
- public static Response<PlaceBookingResponseData> PlaceBooking(PlaceBookingModel requestData)
- {
- return HttpHelper.Post<PlaceBookingModel, PlaceBookingResponseData>("/api/b2b/availability/placebooking", requestData);
- }
- public static Response<ImportResponseModel> ExecuteImportProcess(ImportRequestModel data)
- {
- string url = string.Format(
- "/api/import/vendor?process={0}&full={1}&skipInit={2}&isInit={3}&vendor={4}&lastchange={5}&reset={6}",
- data.Process,
- data.Full,
- data.SkipInit,
- data.IsInit,
- data.Vendor,
- data.LastChange,
- data.Reset);
- return HttpHelper.Get<ImportResponseModel>(url);
- }
- public static Response<object> PutBooking(UpdateBookingModel updateBookingModel)
- {
- return HttpHelper.Put<UpdateBookingModel, object>("/api/b2b/availability/placebooking", updateBookingModel);
- }
- public static Response<GetBookingResponseData> GetBooking(int agentId, int bookingId)
- {
- string url = string.Format("api/b2b/agents/{0}/bookings/{1}", agentId, bookingId);
- return HttpHelper.Get<GetBookingResponseData>(url);
- }
- public static Response<bool> CheckTestEnvironment()
- {
- return HttpHelper.Get<bool>("api/b2b/availability/istestenv");
- }
- public static Response<CreateUserAgencyResponse> CreateUser(CreateAgencyUserModel data)
- {
- return HttpHelper.Post<CreateAgencyUserModel, CreateUserAgencyResponse>("/api/agency/user", data);
- }
- public static Response<UMT> GetUser<UMT>(string username, string password)
- where UMT : new()
- {
- return HttpHelper.Get<UMT>("/api/agency/user?username=" + username + "&password=" + password);
- }
- public static Response<UMT> GetUser<UMT>(string username)
- where UMT : new()
- {
- return HttpHelper.Get<UMT>("/api/agency/user/username?value=" + username);
- }
- public static Response<object> UpdateUser(UpdateAgencyUserModel data)
- {
- return HttpHelper.Put<UpdateAgencyUserModel, object>("/api/agency/user", data);
- }
- public static Response<List<GetAgencyUserModelBase>> ChangeStatus(int userId, bool confirmed)
- {
- string url = string.Format("/api/agency/user/{0}/confirmed", userId);
- return HttpHelper.Put<UpdateConfirmedModel, List<GetAgencyUserModelBase>>(url, new UpdateConfirmedModel(confirmed));
- }
- public static Response<object> UpdatePassword(int userId, UpdatePasswordModel data)
- {
- string url = string.Format("/api/agency/user/{0}/password", userId);
- return HttpHelper.Put<UpdatePasswordModel, object>(url, data);
- }
- public static Response<object> UpdateAgency(int agencyId, UpdateAgencyModel data)
- {
- string url = string.Format("/api/agency/{0}", agencyId);
- return HttpHelper.Put<UpdateAgencyModel, object>(url, data);
- }
- public static Response<AgencyModelGet> GetAgency(string taxNo, string countryOfInc)
- {
- return HttpHelper.Get<AgencyModelGet>("/api/agency?taxNo=" + taxNo + "&countryOfInc=" + countryOfInc);
- }
- public static Response<UsersModel> AddUsers(int agencyId, UsersModel usersModel)
- {
- return HttpHelper.Post<UsersModel, UsersModel>("/api/agency/" + agencyId + "/user", usersModel);
- }
- public static Response<object> DeleteUsers(int agencyId, UsersModel usersModel)
- {
- return HttpHelper.Put<UsersModel, object>("/api/agency/" + agencyId + "/user", usersModel);
- }
- public static Response<UsersModel> GetUsers(int agencyId)
- {
- return HttpHelper.Get<UsersModel>("/api/agency/" + agencyId + "/user");
- }
- public static Response<TimeRangeAvailabilityResponse> GetAvailabilities(int propertyId, DateTime startdate, DateTime endDate)
- {
- string url = string.Format("api/availability/property?propertyId={0}&startDateString={1}&endDateString={2}&page=1&pageSize=1", propertyId, String.Format("{0:dd-MM-yyyy}", startdate), String.Format("{0:dd-MM-yyyy}", endDate));
- var ret = HttpHelper.Get<TimeRangeAvailabilityResponse>(url);
- return ret;
- }
- #endregion Public Methods
- }
- }
Add Comment
Please, Sign In to add comment