Auth->Login("your@email.com", "your_password"); // var_dump($a->Articles->GetArticles()); require_once 'HTTP/Request2.php'; // Only when installed with PEAR /**************************************************** * Enumerations used by the API * ****************************************************/ enum DTO_BillStatus: int { case Open = 1; case Paid = 2; case Canceled = 3; case Replaced = 4; case Current = 5; case Draft = 10; case Finalized = 11; } enum DTO_AircraftType: int { case Glider = 1; case PoweredGlider = 2; case Airplane = 3; case Balloon = 4; case Helicopter = 5; case Gyrocopter = 6; case Airship = 7; } enum DTO_FlightLogTypes: int { case Departure = 1; case Arrival = 2; case Circuits_LocalFlight = 3; case ExternalArrival = 4; case ExternalDeparture = 5; } enum DTO_PreferredForAircraftType: int { case All = 0; case Motor = 1; case Glider = 2; } enum DTO_UnitTypes: int { case Single = 1; case Minutes = 2; case Liters = 3; } enum DTO_ArticleType: int { case Membership = 1; case FuelSale = 2; case Instruction = 3; case AircraftRentPricing = 4; case AircraftLandingPricing = 5; case AircraftStartPricing = 6; case FuelReimbursement = 7; case Towing = 8; case Facility = 9; case PaperBill = 10; case TrialFlight = 11; case Sightseeing = 12; case TowingForInstruction = 13; case DepartureOverBorder = 14; case ArrivalOverBorder = 15; case FirstReminder = 51; case SecondReminder = 52; case ThirdReminder = 53; case Rounding = 80; case Credits = 90; case Other = 100; } enum DTO_AccountType: int { case Debitor = 1; case Account = 2; case MeansOfPayment = 3; case TransferAccount = 4; case RoundingDifference = 5; } enum DTO_FlightActivityLogic: int { case None = 0; case Maintenance = 1; case Private = 2; case DualFlightInstruction = 3; case SingleFlightInstruction = 4; case TowedPrivate = 5; case TowedInstruction = 6; case Towing = 7; case TowingInstruction = 8; case Sightseeing = 9; } enum DTO_InstructionState: int { case Filled = 1; case Accepted = 2; case Refused = 3; } enum DTO_NewsVisibility: int { case Outside = 1; case Inside = 2; case Both = 3; case Calendar = 4; case WelcomeEmail = 5; case Home = 6; case OPS = 7; case Events = 8; case Billing = 9; case AircraftCategory = 10; case Aircraft = 11; case SailplaneMissingArrival = 12; case FirstReminder = 13; case SecondReminder = 14; case ThirdReminder = 15; } enum DTO_TechLogStatus: int { case Closed = 1; case CRS = 2; case CRS_Check = 3; case DD_NotFlightRelevant = 4; case DD_Restriction = 5; case ForInformationOnly = 6; case NotAirworthy = 7; case NotFlightRelevant = 8; case FlightRelevant_AOG = 9; case ARC = 10; } enum DTO_Recuring: int { case NotRecuring = 0; case Annually = 1; case Monthly = 2; case Weekly = 3; } /**************************************************** * DTOs used by the API * ****************************************************/ /** * @property string $url * @property string $title * @property string $when * @property int $nbMinutes * @property string $details */ interface DTO_VisitedPage { } /** * @property int $id * @property int $flightActivityTypeId * @property int $aircraftId * @property ?int $startCounter * @property ?int $endCounter * @property int $memberId * @property ?int $instructorId * @property ?string $departureTime * @property string $startPlace * @property ?string $arrivalTime * @property string $landingPlace * @property ?int $nbLandings * @property ?float $fuelLiters * @property string $callSign * @property string $flightActivityType * @property string $member */ interface DTO_AircraftLog { } /** * @property int $id * @property string $icaoType * @property string $manufacturer * @property string $modelType * @property string $marketingDesignation * @property string $displayName */ interface DTO_AircraftModel { } /** * @property int $id * @property string $callSign * @property string $display * @property bool $visible * @property int $order * @property DTO_AircraftType $aircraftType * @property ?bool $inCAMO * @property ?bool $canBeBooked * @property string $timeCounter * @property ?int $timeCounterMinutes * @property ?int $modelId * @property ?int $nextControl * @property string $nextControlTimer * @property ?bool $homeBase * @property ?int $landingCounter * @property string $mainOwner * @property ?int $mainMemberId * @property ?string $nextAnnual * @property ?string $nextArcReview * @property ?string $nextArcExtension * @property ?int $aircraftCategoryId * @property ?DTO_FlightLogTypes $lastLogType * @property string $lastAirport * @property DTO_FlightActivityType[] $allowedActivities * @property string $expectedDestination * @property ?bool $isValid * @property ?bool $hasCounter */ interface DTO_Aircraft { } /** * @property string $callSign * @property ?int $timeCounter * @property string $remaining * @property ?int $landingCounter * @property ?int $nextControl * @property ?int $nextControlTimer * @property ?string $nextAnnual * @property ?string $nextArcReview * @property ?string $nextArcExtension */ interface DTO_AircraftCAMO { } /** * @property int $id * @property string $name * @property string $description * @property ?int $nbPlaces * @property ?bool $isActive */ interface DTO_AircraftCategory { } /** * @property int $id * @property string $name */ interface DTO_IdName { } /** * @property string $icao * @property string $name * @property string $display * @property ?bool $vatFree * @property ?bool $overBorder */ interface DTO_Airport { } /** * @property int $id * @property string $name * @property DTO_PreferredForAircraftType $preferredFor * @property ?bool $isValid */ interface DTO_Runway { } /** * @property int $id * @property int $catalogId * @property string $description * @property string $display * @property float $pricePerUnit * @property DTO_UnitTypes $unit * @property ?bool $isValid * @property DTO_ArticleType $articleType * @property ?int $aircraftCategoryId * @property ?int $membershipId * @property ?int $requiredAdditionalMembershipId * @property ?int $supersedeId * @property ?int $accountPlanId * @property ?int $vatTypeId * @property ?int $fuelCardArticleId * @property ?int $costCenterId * @property ?int $costUnitId * @property string $importId */ interface DTO_Article { } /** * @property int $id * @property int $articleId * @property float $pricePerUnit * @property ?int $aircraftCategoryId * @property ?int $membershipId * @property ?int $aircraftWeightCategoryId * @property ?int $aircraftNoiseCategoryId * @property ?int $priceValidityId */ interface DTO_ArticlePrice { } /** * @property string $name * @property string $size * @property string $date */ interface DTO_DocumentInfo { } /** * @property DTO_Aircraft[] $aircrafts * @property DTO_CalendarReservation[] $reservations * @property string $start * @property string $end * @property DTO_ReservationType[] $reservationTypes * @property int $weekNumber * @property DTO_CalendarReservation[] $ownEntries * @property DTO_WeatherForecast[] $weather * @property int $sunRise * @property int $sunSet * @property DTO_AircraftLog[] $aircraftLogs * @property DTO_CalendarHoliday[] $holidays */ interface DTO_CalendarData { } /** * @property int $id * @property string $name * @property ?string $validFrom * @property ?string $validTo * @property ?bool $isActive */ interface DTO_Catalog { } /** * @property string $shortName * @property string $name * @property string $display */ interface DTO_Currency { } /** * @property float $cpuLoad * @property float $swapLoad * @property float $memoryLoad */ interface DTO_DiagnosticInfo { } /** * @property string $filename * @property string $path */ interface DTO_Document { } /** * @property int $id * @property string $company * @property string $title * @property string $firstName * @property string $lastName * @property string $address * @property string $zipCode * @property string $city * @property string $country * @property string $accountNumber * @property string $referenceNumber * @property string $vatNumber * @property string $email * @property string $phoneNumber * @property string $bankName * @property string $bankLocation * @property ?int $importId * @property ?string $validFrom * @property ?string $validTill * @property ?int $mainDebtorId * @property ?int $paymentTerms */ interface DTO_VatAccount { } /** * @property int $id * @property string $name * @property string $accountNumber * @property DTO_AccountType $accountType * @property ?int $importId * @property int $vatAccountId */ interface DTO_AccountPlan { } /** * @property int $id * @property string $shortName * @property string $name * @property string $accountNumber * @property float $amount * @property int $vatAccountId * @property ?int $importId */ interface DTO_VatType { } /** * @property int $id * @property string $name * @property DTO_FlightActivityLogic $activityLogic * @property bool $requiresInstructor * @property bool $isTowed * @property bool $isSightseeing */ interface DTO_FlightActivityType { } /** * @property string $lastEntry * @property int $lastEntryId * @property int $nbEntries */ interface DTO_TableStat { } /** * @property int $id * @property int $instructorId * @property int $studentId * @property string $startDate * @property string $endDate * @property int $nbMinutes * @property DTO_InstructionState $state * @property string $comment * @property int $instructionTypeId */ interface DTO_Instruction { } /** * @property int $id * @property string $name * @property int $displayOrder * @property string $url */ interface DTO_HomeLink { } /** * @property int $memberId * @property int $membershipId * @property string $createdOn * @property string $validTill */ interface DTO_MemberMembership { } /** * @property int $id * @property string $email * @property string $display * @property string $firstName * @property string $lastName */ interface DTO_MemberShort { } /** * @property int $id * @property string $company * @property string $title * @property string $fullName * @property string $email * @property string $display * @property string $firstName * @property string $lastName * @property string $password * @property string $address * @property string $phone * @property string $importFrom * @property string $importId * @property string $emergencyContact * @property ?string $birthday * @property ?string $lastBooking * @property string $zipCode * @property string $city * @property string $country * @property ?int $deposit * @property bool $canLog * @property ?bool $verified * @property string $licenseNumber * @property ?string $ratingValidTill * @property ?string $medicalValidTill * @property ?string $languageValidTill * @property ?string $fiCriValidTill * @property ?string $refreshFlightDue * @property ?string $tmgValidTill * @property ?string $entryDate */ interface DTO_Member { } /** * @property int $id * @property int $memberId * @property int $writtenById * @property string $writtenBy * @property string $storedWhen * @property string $content */ interface DTO_MemberHistory { } /** * @property int $id * @property DTO_FlightLogTypes $logType * @property int $flightActivityTypeId * @property string $callSign * @property ?int $aircraftId * @property string $guestPilot * @property ?int $memberId * @property ?int $instructorId * @property ?string $departureTime * @property string $startPlace * @property ?string $arrivalTime * @property string $landingPlace * @property ?int $nbLandings * @property ?int $goArrounds * @property ?int $runwayId * @property ?int $arrivalSectorId * @property ?int $departureRouteId * @property string $requestedTowingJob * @property string $hiddenTowingJob * @property ?bool $externalTowingPaid * @property ?bool $mustBeBilled * @property ?int $startCounter * @property ?int $endCounter * @property ?int $towedWithId * @property string $pilot */ interface DTO_FlightLog { } /** * @property int $id * @property string $name * @property DTO_PreferredForAircraftType $preferredFor */ interface DTO_IdNamePreferredFor { } /** * @property int $id * @property string $title * @property string $content * @property string $postedOn * @property ?int $postedById * @property DTO_NewsVisibility $visibility */ interface DTO_News { } /** * @property int $id * @property string $start * @property string $end * @property int $aircraftId * @property ?bool $isStandby * @property ?bool $isProvisory * @property ?bool $isDeleted * @property int $reservationTypeId * @property int $memberId * @property ?int $instructorId * @property string $comment * @property ?int $plannedTime * @property ?string $aircraftAcceptedOn * @property ?string $aircraftReturnedOn */ interface DTO_Reservation { } /** * @property int $id * @property string $name * @property int $priority * @property ?bool $canDoubleBook * @property ?bool $requiresInstructor * @property ?int $requiredRightTypeId * @property string $cssColor */ interface DTO_ReservationType { } /** * @property string $url * @property string $category * @property string $description */ interface DTO_SearchResult { } /** * @property ?int $nextControl * @property string $hoursRemaining * @property DTO_DisplayTechlogEntry[] $entries * @property ?int $nextControlTimer * @property ?int $timeCounter * @property bool $isMaintenance */ interface DTO_DisplayTechlog { } /** * @property int $id * @property ?int $responseToId * @property ?int $responseById * @property int $aircraftId * @property ?int $flightLogId * @property ?int $reportedMemberId * @property string $entryReport * @property string $entryDate * @property ?int $duplicateOfId * @property DTO_TechLogStatus $status * @property ?int $importId */ interface DTO_TechLog { } /** * @property int $id * @property string $createdWhen * @property ?int $registeredById * @property int $memberId * @property ?int $articleId * @property ?int $aircraftId * @property float $price * @property float $quantity * @property ?int $flightLogId * @property ?int $instructionId * @property ?int $articlePriceId * @property ?int $accountPlanId * @property ?int $vatTypeId * @property ?float $vatAmount * @property ?int $billId * @property ?bool $shouldBeBilled * @property string $importId * @property string $customDescription * @property string $description */ interface DTO_Transaction { } /** * @property int $id * @property string $referenceNumber * @property int $memberId * @property int $vatAccountId * @property float $total * @property ?int $newBillId * @property string $createdOn * @property string $dueOn * @property ?string $paidOn * @property DTO_BillStatus $status * @property ?int $importId */ interface DTO_Bill { } /** * @property int $id * @property string $start * @property string $end * @property string $callSign * @property bool $isStandby * @property bool $isProvisory * @property ?string $aircraftAcceptedOn * @property string $cssColor * @property int $reservationTypeId * @property string $reservationType * @property int $priority * @property string $member * @property string $lastName * @property string $phone * @property int $memberId * @property string $instructor * @property int $instructorId * @property bool $ownReservation * @property bool $canAcceptAircraft * @property bool $canReturnAircraft * @property bool $aircraftAccepted * @property bool $aircraftReturned */ interface DTO_CalendarReservation { } /** * @property string $date * @property string $forecast * @property string $icon */ interface DTO_WeatherForecast { } /** * @property int $id * @property string $name * @property string $date * @property DTO_Recuring $recuring */ interface DTO_CalendarHoliday { } /** * @property int $id * @property ?int $responseToId * @property string $reportedMember * @property string $entryReport * @property string $entryDate * @property ?string $resolutionTime * @property DTO_TechLogStatus $status * @property string $statusText */ interface DTO_DisplayTechlogEntry { } /** * API For the Action History Menu */ class FlyingFleet_ActionHistory { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } public function GetHistory(string $q = null): ?array { $request = new HTTP_Request2($this->parent->url . "api/ActionHistory/" . urlEncode($q), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Aircraft Log */ class FlyingFleet_AircraftLogs { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of the last 100 movements. * @param ?string $start * @param ?string $end * @return DTO_AircraftLog[] */ public function GetLogs(?string $start = null, ?string $end = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/AircraftLogs?token=" . urlEncode($this->parent->token) . "&start=" . urlEncode($start == null ? "" : json_encode($start)) . "&end=" . urlEncode($end == null ? "" : json_encode($end)) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new aircraft log. * @param DTO_AircraftLog $aircraftLog * @return DTO_AircraftLog */ public function AddAircraftLog($aircraftLog): ?DTO_AircraftLog { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/AircraftLogs?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($aircraftLog)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert new aircraft logs. * @param DTO_AircraftLog[] $aircraftLogs * @return DTO_AircraftLog[] */ public function AddAircraftLogs($aircraftLogs): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/AircraftLogs/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($aircraftLogs)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Aircraft Models */ class FlyingFleet_AircraftModels { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the list of all the aircraft models known * @param string $q * @return DTO_AircraftModel[] */ public function GetAircraftModels(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/AircraftModels/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Counts the number of aircraft given the optional search parameter * @param string $q * @return int */ public function GetAircraftModelsCount(string $q = null): ?int { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/AircraftModels/No/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the model information based on the provided id * @param int $id * @return DTO_AircraftModel */ public function GetAircraftModel(int $id): ?DTO_AircraftModel { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/AircraftModels/ById/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new aircraft model * @param DTO_AircraftModel $model * @return DTO_AircraftModel */ public function AddModel($model): ?DTO_AircraftModel { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/AircraftModels?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($model)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Aircrafts */ class FlyingFleet_Aircrafts { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the list of all the aircrafts known * @param string $q * @param bool $onlyCharter * @param bool $forTenant * @return DTO_Aircraft[] */ public function GetAircrafts(string $q = null, bool $onlyCharter = False, bool $forTenant = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&onlyCharter=" . urlEncode($onlyCharter == null ? "" : json_encode($onlyCharter)) . "&forTenant=" . urlEncode($forTenant == null ? "" : json_encode($forTenant)) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the number of aircrafts given the optional search parameter * @param string $q * @param bool $onlyCharter * @return int */ public function GetAircraftsCount(string $q = null, bool $onlyCharter = False): ?int { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/No/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&onlyCharter=" . urlEncode($onlyCharter == null ? "" : json_encode($onlyCharter)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get all the aircraft CAMO information */ public function GetAircraftCamos() { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/CAMO?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the aircraft CAMO information based on the provided callsign * @param string $callsign * @return DTO_AircraftCAMO */ public function GetAircraftCamo(string $callsign): ?DTO_AircraftCAMO { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/CAMO/" . urlEncode($callsign) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the aircraft information based on the provided callsign * @param string $callsign * @return DTO_Aircraft */ public function GetAircraftByCallSign(string $callsign): ?DTO_Aircraft { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/ByCallSign/" . urlEncode($callsign) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the aircraft information based on the provided id * @param int $id * @return DTO_Aircraft */ public function GetAircraftById(int $id): ?DTO_Aircraft { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/ById/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Add a new aircraft * @param DTO_Aircraft $aircraft * @return DTO_Aircraft */ public function UpdateAircraft($aircraft): ?DTO_Aircraft { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($aircraft)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Retrieves the list of the aircrafts that can be rented * @param bool $forTenant * @return DTO_Aircraft[] */ public function GetAircraftsToRent(bool $forTenant = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/ToRent?token=" . urlEncode($this->parent->token) . "&forTenant=" . urlEncode($forTenant == null ? "" : json_encode($forTenant)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Retrieves the list of the id / names of the aircrafts categories * @param bool $forTenant * @return DTO_AircraftCategory[] */ public function GetAircraftsCategories(bool $forTenant = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/Categories?token=" . urlEncode($this->parent->token) . "&forTenant=" . urlEncode($forTenant == null ? "" : json_encode($forTenant)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Retrieves the list of the id / names of the aircrafts memberships * @param bool $forTenant * @return DTO_IdName[] */ public function GetAircraftsMemberships(bool $forTenant = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/Memberships?token=" . urlEncode($this->parent->token) . "&forTenant=" . urlEncode($forTenant == null ? "" : json_encode($forTenant)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Retrieves the list of the id / names of the aircrafts weight categories * @return DTO_IdName[] */ public function GetAircraftsWeightCategories(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/WeightCategories?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Retrieves the list of the id / names of the aircrafts noise categories * @return DTO_IdName[] */ public function GetAircraftsNoiseCategories(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/NoiseCategories?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Set the allowed flight activity types for an aircraft * @param int $aircraftId * @param int[] $allowedActivities * @return bool */ public function SetAllowedFlightActivityTypes($allowedActivities, int $aircraftId): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts/AllowedFlightActivityTypes?token=" . urlEncode($this->parent->token) . "&aircraftId=" . urlEncode($aircraftId == null ? "" : json_encode($aircraftId)), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($allowedActivities)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new aircraft * @param DTO_Aircraft $aircraft * @return DTO_Aircraft */ public function AddAircraft($aircraft): ?DTO_Aircraft { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Aircrafts?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($aircraft)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Airports */ class FlyingFleet_Airports { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the list of all the airports known * @param string $q * @return DTO_Airport[] */ public function GetAirports(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Airports/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the number of airports known. * @param string $q * @return int */ public function GetAirportsCount(string $q = null): ?int { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Airports/No/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Return all the available runways * @param string $q * @return DTO_Runway[] */ public function GetRunways(string $q = null): ?array { $request = new HTTP_Request2($this->parent->url . "api/Airports/Runways?q=" . urlEncode($q), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Return all the available Arrival Sectors * @param string $q * @return DTO_IdName[] */ public function GetArrivalSectors(string $q = null): ?array { $request = new HTTP_Request2($this->parent->url . "api/Airports/ArrivalSectors?q=" . urlEncode($q), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Return all the Departure Routes * @param string $q * @return DTO_IdName[] */ public function GetDepartureRoutes(string $q = null): ?array { $request = new HTTP_Request2($this->parent->url . "api/Airports/DepartureRoutes?q=" . urlEncode($q), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Refreshes the airports list. * @return bool */ public function RefreshAirports(): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Airports/Refresh?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_POST); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Articles */ class FlyingFleet_Articles { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of articles. * @param string $q * @param ?int $vatAccount * @param bool $forVatResponsible * @return DTO_Article[] */ public function GetArticles(string $q = null, ?int $vatAccount = null, bool $forVatResponsible = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&vatAccount=" . urlEncode($vatAccount == null ? "" : json_encode($vatAccount)) . "&forVatResponsible=" . urlEncode($forVatResponsible == null ? "" : json_encode($forVatResponsible)) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the number of articles. * @param string $q * @return int */ public function GetArticlesCount(string $q = null): ?int { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles/No/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the article information based on the provided id * @param int $id * @return DTO_Article */ public function GetArticleById(int $id): ?DTO_Article { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles/ById/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new article * @param DTO_Article $article * @return DTO_Article */ public function AddArticle($article): ?DTO_Article { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($article)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a batch of new articles * @param DTO_Article[] $articles * @return DTO_Article[] */ public function AddArticles($articles): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($articles)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update an article * @param DTO_Article $article * @return DTO_Article */ public function UpdateArticle($article): ?DTO_Article { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($article)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns all the articles which are used by the fleet pricing. * @param bool $forTenant * @return DTO_Article[] */ public function GetArticleForAircraftCategory(bool $forTenant = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles/AircraftCategory?token=" . urlEncode($this->parent->token) . "&forTenant=" . urlEncode($forTenant == null ? "" : json_encode($forTenant)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns all the articles which are used by the fleet pricing. * @return DTO_Article[] */ public function GetArticleForAircraftNoiseWeight(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles/AircraftNoiseWeight?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns all the articles which are used by the fleet pricing. * @param bool $forTenant * @return DTO_ArticlePrice[] */ public function GetArticleRentingPrices(bool $forTenant = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles/ArticlePrices/Renting?token=" . urlEncode($this->parent->token) . "&forTenant=" . urlEncode($forTenant == null ? "" : json_encode($forTenant)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns all the articles which are used by the fleet pricing. * @return DTO_ArticlePrice[] */ public function GetArticleLandingPrices(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Articles/ArticlePrices/Landing?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Authorization */ class FlyingFleet_Auth { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Tries to log in a user. * @param string $email * @param string $password * @return string */ public function Login(string $email, string $password): ?string { $request = new HTTP_Request2($this->parent->url . "api/Auth?email=" . urlEncode($email) . "&password=" . urlEncode($password), HTTP_Request2::METHOD_POST); $response = $request->send(); if($response->getStatus() == 200) { $this->parent->token = $response->getBody(); return $this->parent->token; } else { $this->parent->token = null; throw new Exception("Not authorized"); } } /** * Logout a user. * @return bool */ public function Logout(): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Auth?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_DELETE); $response = $request->send(); $this->parent->token = null; return null; } /** * Refresh a token (to avoid a timeout). * @return bool */ public function Refresh(): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Auth?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API to access the backups */ class FlyingFleet_Backups { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of files in the backup folder * @return DTO_DocumentInfo[] */ public function GetList(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Backups?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the file from the backup folder as binary content * @param string $filename */ public function GetFile(string $filename) { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Backups/" . urlEncode($filename) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } public function GetPowershell() { $request = new HTTP_Request2($this->parent->url . "api/Backups/Powershell", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the bills */ class FlyingFleet_Bill { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * API to check the status of the billing * @return string */ public function Status(): ?string { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Bill/Status?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * API to recalculate the bill total * @param int $billId * @return bool */ public function ReCalc(int $billId): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Bill/ReCalc/" . urlEncode($billId) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * API to recalculate the bill total * @param int $nbMonths * @return bool */ public function ReCalcLast(int $nbMonths): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Bill/ReCalcLast/" . urlEncode($nbMonths) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Calendar */ class FlyingFleet_Calendar { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the calendar data for a given week. Authentification through the session (used by the web interface). * @param string $startDate * @return DTO_CalendarData */ public function ReadCalendarWeb(string $startDate = null): ?DTO_CalendarData { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Calendar/" . urlEncode($startDate) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Set the user preference for a given reservation type. * @param int $resType * @param string $color */ public function ChangeColor(int $resType, string $color) { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Calendar/ChangeColor/" . urlEncode($resType) . "?token=" . urlEncode($this->parent->token) . "&color=" . urlEncode($color), HTTP_Request2::METHOD_POST); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Toggle the visibility of a given aircraft from the calendar. * @param string $callSign */ public function ChangeVisibilityWeb(string $callSign) { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Calendar/ChangeVisibility/" . urlEncode($callSign) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } public function ChangeOrder(string $order) { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Calendar/ChangeOrder?token=" . urlEncode($this->parent->token) . "&order=" . urlEncode($order), HTTP_Request2::METHOD_POST); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Checks if a reservation exists for a given date range. * @param string $c * @param string $s * @param string $e * @param ?int $id * @return bool */ public function CheckDate(string $c, string $s, string $e, ?int $id): ?bool { $request = new HTTP_Request2($this->parent->url . "api/Calendar/CheckDate?c=" . urlEncode($c) . "&s=" . urlEncode($s) . "&e=" . urlEncode($e) . "&id=" . urlEncode($id == null ? "" : json_encode($id)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Catalogs */ class FlyingFleet_Catalogs { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Return the list of catalogs * @param string $q * @return DTO_Catalog[] */ public function GetCatalogs(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Catalogs?token=" . urlEncode($this->parent->token) . "&q=" . urlEncode($q) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Currencies */ class FlyingFleet_Currencies { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of currencies. * @param string $q * @return DTO_Currency[] */ public function GetCurrencies(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Currencies/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the count of currencies. * @param string $q * @return int */ public function GetCurrenciesCount(string $q = null): ?int { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Currencies/No/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For diagnostic purpose */ class FlyingFleet_Diagnostic { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns system information like CPU, Memory, or Swap usage. * @return DTO_DiagnosticInfo */ public function GetSystemInformation(): ?DTO_DiagnosticInfo { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Diagnostic?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Reset the caches. * @return bool */ public function ResetCache(): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Diagnostic/ResetCache?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Documents */ class FlyingFleet_Documents { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the list of all the documents known * @param string $q * @return DTO_Document[] */ public function GetDocuments(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Documents/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Create a document & its path * @param string $path * @param string $filename * @param int[] $data * @return bool */ public function CreateDocument($data, string $path, string $filename): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Documents?token=" . urlEncode($this->parent->token) . "&path=" . urlEncode($path) . "&filename=" . urlEncode($filename), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($data)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Finances account */ class FlyingFleet_Finances { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of all the VAT Accounts. * @return DTO_VatAccount[] */ public function GetVatAccounts(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatAccounts?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete a VAT Account. * @param int $id * @return bool */ public function DeleteVatAccount(int $id): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatAccount?token=" . urlEncode($this->parent->token) . "&id=" . urlEncode($id == null ? "" : json_encode($id)), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Add a VAT Account. * @param DTO_VatAccount $account * @return DTO_VatAccount */ public function AddVatAccount($account): ?DTO_VatAccount { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatAccount?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($account)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update a VAT Account. * @param DTO_VatAccount $account * @return DTO_VatAccount */ public function UpdateVatAccount($account): ?DTO_VatAccount { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatAccount?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($account)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of all the Accounts Plan. * @param int $vatId * @return DTO_AccountPlan[] */ public function GetAccounts(int $vatId): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/Accounts/" . urlEncode($vatId) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete an Account Plan. * @param int $id * @return bool */ public function DeleteAccount(int $id): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/Account?token=" . urlEncode($this->parent->token) . "&id=" . urlEncode($id == null ? "" : json_encode($id)), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Add an Account Plan. * @param DTO_AccountPlan $account * @return DTO_AccountPlan */ public function AddAccount($account): ?DTO_AccountPlan { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/Account?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($account)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update an Account Plan. * @param DTO_AccountPlan $account * @return DTO_AccountPlan */ public function ChangeAccount($account): ?DTO_AccountPlan { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/Account?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($account)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get all VAT Account Types * @return DTO_VatType[] */ public function GetVatTypes(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatTypes?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get all VAT Account Types for a given VAT * @param int $vatId * @return DTO_VatType[] */ public function GetVatTypesById(int $vatId): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatTypes/" . urlEncode($vatId) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete a VAT Account Type. * @param int $id * @return bool */ public function DeleteVatType(int $id): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatType?token=" . urlEncode($this->parent->token) . "&id=" . urlEncode($id == null ? "" : json_encode($id)), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Add a VAT Account Type. * @param DTO_VatType $vatType * @return DTO_VatType */ public function AddVatType($vatType): ?DTO_VatType { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatType?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($vatType)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update a VAT Account Type. * @param DTO_VatType $vatType * @return DTO_VatType */ public function ChangeVatType($vatType): ?DTO_VatType { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Finances/VatType?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($vatType)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the FlightActivityTypes */ class FlyingFleet_FlightActivityTypes { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the list of all the reservation types known * @param string $q * @return DTO_FlightActivityType[] */ public function GetFlightActivityType(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/FlightActivityTypes/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Instructions */ class FlyingFleet_Instructions { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Return the statistics about the instructions * @return DTO_TableStat */ public function GetStats(): ?DTO_TableStat { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions/Stats?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of instructions between two dates. * @param ?string $start * @param ?string $end * @return DTO_Instruction[] */ public function GetInstructions(?string $start, ?string $end): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions?token=" . urlEncode($this->parent->token) . "&start=" . urlEncode($start == null ? "" : json_encode($start)) . "&end=" . urlEncode($end == null ? "" : json_encode($end)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of instruction types. * @return DTO_IdName[] */ public function GetInstructionTypes(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions/Types?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new instruction * @param DTO_Instruction $instruction * @return DTO_Instruction */ public function AddInstruction($instruction): ?DTO_Instruction { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($instruction)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new instructions * @param DTO_Instruction[] $instructions * @return DTO_Instruction[] */ public function AddInstructions($instructions): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($instructions)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update an instruction * @param DTO_Instruction $instruction * @return DTO_Instruction */ public function UpdateInstruction($instruction): ?DTO_Instruction { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($instruction)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete completely an instruction * @param int $id * @return bool */ public function DeleteInstruction(int $id): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions?token=" . urlEncode($this->parent->token) . "&id=" . urlEncode($id == null ? "" : json_encode($id)), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete a bunch of instructions * @param int[] $ids * @return bool */ public function DeleteInstructions($ids): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_DELETE); $request->setBody(json_encode($ids)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Checks if the current user has instructions * @return bool */ public function HasInstructions(): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Instructions/Check?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Instructions Types */ class FlyingFleet_InstructionTypes { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of instruction types. * @param string $q * @return DTO_IdName[] */ public function GetInstructionTypes(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/InstructionTypes/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the instruction type information based on the provided id * @param int $id * @return DTO_IdName */ public function GetInstructionType(int $id): ?DTO_IdName { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/InstructionTypes/ById/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the home Links */ class FlyingFleet_Links { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the list of all the links known * @param string $q * @return DTO_HomeLink[] */ public function GetLinks(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Links/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Add a new home link * @param DTO_HomeLink $link * @return DTO_HomeLink */ public function AddLink($link): ?DTO_HomeLink { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Links?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($link)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the MemberMembership */ class FlyingFleet_MemberMemberships { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Add a membership to a member * @param DTO_MemberMembership $memberMembership * @return DTO_MemberMembership */ public function AddMemberMembership($memberMembership): ?DTO_MemberMembership { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/MemberMemberships?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_POST); $request->setBody(json_encode($memberMembership)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Remove a membership from a member * @param int $memberId * @param int $membershipId * @return bool */ public function RemoveMemberMembership(int $memberId, int $membershipId): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/MemberMemberships/" . urlEncode($memberId) . "?token=" . urlEncode($this->parent->token) . "&membershipId=" . urlEncode($membershipId == null ? "" : json_encode($membershipId)), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete all memberships of a member * @param int $memberId * @return bool */ public function DeleteMemberMemberships(int $memberId): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/MemberMemberships/AllMembershipsOf?token=" . urlEncode($this->parent->token) . "&memberId=" . urlEncode($memberId == null ? "" : json_encode($memberId)), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Members */ class FlyingFleet_Members { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of members. * @param string $q * @param ?bool $canlogin * @return DTO_MemberShort[] */ public function GetMembers(string $q = null, ?bool $canlogin = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&canlogin=" . urlEncode($canlogin == null ? "" : json_encode($canlogin)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of members. * @param ?bool $canlogin * @return DTO_Member[] */ public function GetMembers(?bool $canlogin = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/Full?token=" . urlEncode($this->parent->token) . "&canlogin=" . urlEncode($canlogin == null ? "" : json_encode($canlogin)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of members. * @param string $q * @param bool $all * @return DTO_Member[] */ public function GetMembersDetails(string $q = null, bool $all = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/Details/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&all=" . urlEncode($all == null ? "" : json_encode($all)) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of members. * @param string $q * @return DTO_MemberShort[] */ public function GetInstructors(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/Instructors/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the count of members. * @param string $q * @return int */ public function GetMembersCount(string $q = null): ?int { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/No/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the member information based on the provided id * @param int $id * @return DTO_MemberShort */ public function GetMemberById(int $id): ?DTO_MemberShort { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/ById/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the member information based on the provided email * @param string $email * @return DTO_MemberShort */ public function GetMemberByEmail(string $email): ?DTO_MemberShort { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/ByEmail/" . urlEncode($email) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } public function GetMemberInfoByEmail(string $email): ?DTO_Member { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/InfoByEmail/" . urlEncode($email) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the member history * @param int $id * @return DTO_MemberHistory[] */ public function GetMemberHistoryId(int $id): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/History/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Add one history entry to a member * @param DTO_MemberHistory $history * @return DTO_MemberHistory */ public function AddMemberHistory($history): ?DTO_MemberHistory { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/History?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($history)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Add multiple histories * @param DTO_MemberHistory[] $histories * @return DTO_MemberHistory[] */ public function AddMemberHistories($histories): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/History/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($histories)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new member * @param DTO_Member $member * @return DTO_Member */ public function AddMember($member): ?DTO_Member { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($member)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a batch of new members * @param DTO_Member[] $members * @return DTO_Member[] */ public function AddMembers($members): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($members)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update a member * @param DTO_Member $member * @return DTO_Member */ public function UpdateMember($member): ?DTO_Member { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($member)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Add roles to a member * @param int $memberId * @param int[] $roles * @return bool */ public function AddRoles($roles, int $memberId): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/" . urlEncode($memberId) . "/Roles?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($roles)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Remove roles from a member * @param int $memberId * @param int[] $roles * @return bool */ public function RemoveRoles($roles, int $memberId): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/" . urlEncode($memberId) . "/Roles?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_DELETE); $request->setBody(json_encode($roles)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Set the allowed aircraft categories for a given user * @param int $memberId * @param int[] $aircraftCategories * @return bool */ public function SetCategories($aircraftCategories, int $memberId): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/" . urlEncode($memberId) . "/AllowedCategories?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($aircraftCategories)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete a member * @param int $id * @return bool */ public function DeleteMember(int $id): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members?token=" . urlEncode($this->parent->token) . "&id=" . urlEncode($id == null ? "" : json_encode($id)), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Clean cache and wait for rebuild * @return bool */ public function CleanCache(): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Members/CleanCache?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Membership */ class FlyingFleet_Memberships { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of memberships. * @param string $q * @param bool $forTenant * @return DTO_IdName[] */ public function GetMemberships(string $q = null, bool $forTenant = False): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Memberships/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&forTenant=" . urlEncode($forTenant == null ? "" : json_encode($forTenant)) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the number of memberships known. * @param string $q * @return int */ public function GetMembershipCount(string $q = null): ?int { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Memberships/No/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the membership information based on the provided id. * @param int $id * @return DTO_IdName */ public function GetMembershipById(int $id): ?DTO_IdName { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Memberships/ById/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Aircraft Movements */ class FlyingFleet_Movements { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of the last 100 movements. * @return DTO_FlightLog[] */ public function Lasts(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/Lasts?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of the arrival sectors. * @return DTO_IdNamePreferredFor[] */ public function ArrivalSectors(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/ArrivalSectors?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of the departure sectors. * @return DTO_IdNamePreferredFor[] */ public function DepartureRoutes(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/DepartureRoutes?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of the runways. * @return DTO_Runway[] */ public function Runways(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/Runways?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Return the statistics about the movements * @return DTO_TableStat */ public function GetStats(): ?DTO_TableStat { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/Stats?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of the last 100 movements. * @param ?string $start * @param ?string $end * @return DTO_FlightLog[] */ public function GetMovements(?string $start = null, ?string $end = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements?token=" . urlEncode($this->parent->token) . "&start=" . urlEncode($start == null ? "" : json_encode($start)) . "&end=" . urlEncode($end == null ? "" : json_encode($end)) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new movement * @param DTO_FlightLog $movement * @return DTO_FlightLog */ public function AddMovement($movement): ?DTO_FlightLog { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($movement)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } public function UpdateMovement($movement): ?DTO_FlightLog { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($movement)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } public function DeleteMovements(int $id): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } public function DeleteMovements($movementIds): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_DELETE); $request->setBody(json_encode($movementIds)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert new movements * @param DTO_FlightLog[] $movements * @return DTO_FlightLog[] */ public function AddMovements($movements): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($movements)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Clean cache and wait for rebuild * @return bool */ public function CleanCache(): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Movements/CleanCache?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the News */ class FlyingFleet_News { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the list of all the news known * @param string $q * @return DTO_News[] */ public function GetNews(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/News/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Inserts a news * @param DTO_News $news * @return DTO_News */ public function AddNews($news): ?DTO_News { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/News?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($news)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Attaches a document to a news * @param int $newsId * @param string $filename * @param int[] $data * @return bool */ public function AddNewsAttachement(int $newsId, string $filename, array $data): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/News/Attachement?token=" . urlEncode($this->parent->token) . "&newsId=" . urlEncode($newsId == null ? "" : json_encode($newsId)) . "&filename=" . urlEncode($filename) . "&data=" . urlEncode($data == null ? "" : json_encode($data)), HTTP_Request2::METHOD_PUT); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Reservations (not directly used by the Calendar UI) */ class FlyingFleet_Reservations { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Return the statistics about the reservations * @return DTO_TableStat */ public function GetStats(): ?DTO_TableStat { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Reservations/Stats?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of reservations between two dates. * @param ?string $start * @param ?string $end * @return DTO_Reservation[] */ public function GetReservations(?string $start, ?string $end): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Reservations?token=" . urlEncode($this->parent->token) . "&start=" . urlEncode($start == null ? "" : json_encode($start)) . "&end=" . urlEncode($end == null ? "" : json_encode($end)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new reservation * @param DTO_Reservation $reservation * @return DTO_Reservation */ public function AddReservation($reservation): ?DTO_Reservation { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Reservations?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($reservation)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new batch of reservations * @param DTO_Reservation[] $reservations * @return DTO_Reservation[] */ public function AddReservations($reservations): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Reservations/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($reservations)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update a reservation * @param DTO_Reservation $reservation * @return DTO_Reservation */ public function UpdateReservation($reservation): ?DTO_Reservation { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Reservations?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($reservation)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete a reservation * @param int $id * @return bool */ public function DeleteReservation(int $id): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Reservations?token=" . urlEncode($this->parent->token) . "&id=" . urlEncode($id == null ? "" : json_encode($id)), HTTP_Request2::METHOD_DELETE); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Delete a batch of reservations * @param int[] $ids * @param bool $completely * @return bool */ public function DeleteReservations($ids, bool $completely = False): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Reservations/Batch?token=" . urlEncode($this->parent->token) . "&completely=" . urlEncode($completely == null ? "" : json_encode($completely)), HTTP_Request2::METHOD_DELETE); $request->setBody(json_encode($ids)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Reservation Types */ class FlyingFleet_ReservationTypes { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Get the list of all the reservation types known * @param string $q * @return DTO_ReservationType[] */ public function GetReservationTypes(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/ReservationTypes/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Right Types */ class FlyingFleet_RightTypes { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of right types. * @return DTO_IdName[] */ public function GetRightTypes(): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/RightTypes?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Role Types */ class FlyingFleet_RoleTypes { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of right types. * @param string $q * @return DTO_IdName[] */ public function GetRolesTypes(string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/RoleTypes/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the count of right types. * @param string $q * @return int */ public function GetRoleTypeCount(string $q = null): ?int { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/RoleTypes/No/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the role type information based on the provided id * @param int $id * @return DTO_IdName */ public function GetRoleType(int $id): ?DTO_IdName { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/RoleTypes/ById/" . urlEncode($id) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new role type * @param DTO_IdName $role * @return DTO_IdName */ public function AddRoleType(DTO_IdName $role): ?DTO_IdName { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/RoleTypes?token=" . urlEncode($this->parent->token) . "&role=" . urlEncode($role == null ? "" : json_encode($role)), HTTP_Request2::METHOD_PUT); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a batch of new members * @param DTO_IdName[] $roles * @return DTO_IdName[] */ public function AddRoleTypes(array $roles): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/RoleTypes/Batch?token=" . urlEncode($this->parent->token) . "&roles=" . urlEncode($roles == null ? "" : json_encode($roles)), HTTP_Request2::METHOD_PUT); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Set the rights for a given role * @param int $roleId * @param int[] $rights * @return bool */ public function SetRoleRight($rights, int $roleId): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/RoleTypes/Rights?token=" . urlEncode($this->parent->token) . "&roleId=" . urlEncode($roleId == null ? "" : json_encode($roleId)), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($rights)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Global Search */ class FlyingFleet_Search { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns all the possible match for a given string. * @param string $q * @return DTO_SearchResult[] */ public function Search(string $q): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Search/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the TechLog */ class FlyingFleet_TechLog { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Return the statistics about the techlogs * @return DTO_TableStat */ public function GetStats(): ?DTO_TableStat { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/TechLog/Stats?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the techlog for a given aircraft. * @param string $callsign * @param string $type * @return DTO_DisplayTechlog */ public function GetTechLogsByCallSign(string $callsign, string $type = null): ?DTO_DisplayTechlog { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/TechLog/ByCallSign/" . urlEncode($callsign) . "?token=" . urlEncode($this->parent->token) . "&type=" . urlEncode($type), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Returns the list of the entries. * @param ?string $start * @param ?string $end * @return DTO_TechLog[] */ public function GetLogs(?string $start = null, ?string $end = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/TechLog?token=" . urlEncode($this->parent->token) . "&start=" . urlEncode($start == null ? "" : json_encode($start)) . "&end=" . urlEncode($end == null ? "" : json_encode($end)) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new Techlog * @param DTO_TechLog $log * @return DTO_TechLog */ public function AddEntry($log): ?DTO_TechLog { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/TechLog?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($log)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new techlogs * @param DTO_TechLog[] $logs * @return DTO_TechLog[] */ public function AddEntries($logs): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/TechLog/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($logs)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update an existing techlog * @param DTO_TechLog $log * @return bool */ public function UpdateEntry($log): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/TechLog?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PATCH); $request->setBody(json_encode($log)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * API For the Transactions */ class FlyingFleet_Transactions { private $parent = null; public function __construct($apiObject) { $this->parent = $apiObject; } /** * Returns the list of transactions. * @param ?int $vatAccountId * @param string $q * @return DTO_Transaction[] */ public function GetTransactions(?int $vatAccountId, string $q = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Transactions/" . urlEncode($q) . "?token=" . urlEncode($this->parent->token) . "&vatAccountId=" . urlEncode($vatAccountId == null ? "" : json_encode($vatAccountId)) . "&limit=-1", HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert a new transaction. * @param DTO_Transaction $transaction * @return DTO_FlightLog */ public function AddTransaction($transaction): ?DTO_FlightLog { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Transactions?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($transaction)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Insert new transactions. * @param DTO_Transaction[] $transactions * @return DTO_Transaction[] */ public function AddTransactions($transactions): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Transactions/Batch?token=" . urlEncode($this->parent->token), HTTP_Request2::METHOD_PUT); $request->setBody(json_encode($transactions)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Get the list of bills. * @param ?int $vatAccountId * @return DTO_Bill[] */ public function GetBills(?int $vatAccountId = null): ?array { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Transactions/Bills?token=" . urlEncode($this->parent->token) . "&vatAccountId=" . urlEncode($vatAccountId == null ? "" : json_encode($vatAccountId)), HTTP_Request2::METHOD_GET); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Create a bill from transactions. * @param int[] $transactions * @param string $creationDate * @param DTO_BillStatus $status * @param ?string $paidOn * @param ?int $importId * @return DTO_Bill */ public function CreateFromTransactions($transactions, string $creationDate, DTO_BillStatus $status, ?string $paidOn, ?int $importId = null): ?DTO_Bill { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Transactions/Bill/CreateFrom?token=" . urlEncode($this->parent->token) . "&creationDate=" . urlEncode($creationDate == null ? "" : json_encode($creationDate)) . "&status=" . urlEncode($status == null ? "" : json_encode($status)) . "&paidOn=" . urlEncode($paidOn == null ? "" : json_encode($paidOn)) . "&importId=" . urlEncode($importId == null ? "" : json_encode($importId)), HTTP_Request2::METHOD_POST); $request->setBody(json_encode($transactions)); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } /** * Update the status of a bill. * @param int $billId * @param DTO_BillStatus $status * @param ?string $paidOn * @return bool */ public function UpdateBill(int $billId, DTO_BillStatus $status, ?string $paidOn): ?bool { if($this->parent->token == null) throw new Exception("Not authorized"); $request = new HTTP_Request2($this->parent->url . "api/Transactions/Bill/UpdateStatus?token=" . urlEncode($this->parent->token) . "&billId=" . urlEncode($billId == null ? "" : json_encode($billId)) . "&status=" . urlEncode($status == null ? "" : json_encode($status)) . "&paidOn=" . urlEncode($paidOn == null ? "" : json_encode($paidOn)), HTTP_Request2::METHOD_POST); $response = $request->send(); if($response->getStatus() == 200) return json_decode($response->getBody()); else return null; } } /** * FlyingFleet API. Each API class is accessible via the appropriate fields. Before calling most API calls, a call to the Auth.Login is required. */ class FlyingFleetApi { public $url = "https://operations.birrfeld.ch/"; // URL of the API to use public $token = null; /** * API For the Action History Menu */ public ?FlyingFleet_ActionHistory $ActionHistory = null; /** * API For the Aircraft Log */ public ?FlyingFleet_AircraftLogs $AircraftLogs = null; /** * API For the Aircraft Models */ public ?FlyingFleet_AircraftModels $AircraftModels = null; /** * API For the Aircrafts */ public ?FlyingFleet_Aircrafts $Aircrafts = null; /** * API For the Airports */ public ?FlyingFleet_Airports $Airports = null; /** * API For the Articles */ public ?FlyingFleet_Articles $Articles = null; /** * API For the Authorization */ public ?FlyingFleet_Auth $Auth = null; /** * API to access the backups */ public ?FlyingFleet_Backups $Backups = null; /** * API For the bills */ public ?FlyingFleet_Bill $Bill = null; /** * API For the Calendar */ public ?FlyingFleet_Calendar $Calendar = null; /** * API For the Catalogs */ public ?FlyingFleet_Catalogs $Catalogs = null; /** * API For the Currencies */ public ?FlyingFleet_Currencies $Currencies = null; /** * API For diagnostic purpose */ public ?FlyingFleet_Diagnostic $Diagnostic = null; /** * API For the Documents */ public ?FlyingFleet_Documents $Documents = null; /** * API For the Finances account */ public ?FlyingFleet_Finances $Finances = null; /** * API For the FlightActivityTypes */ public ?FlyingFleet_FlightActivityTypes $FlightActivityTypes = null; /** * API For the Instructions */ public ?FlyingFleet_Instructions $Instructions = null; /** * API For the Instructions Types */ public ?FlyingFleet_InstructionTypes $InstructionTypes = null; /** * API For the home Links */ public ?FlyingFleet_Links $Links = null; /** * API For the MemberMembership */ public ?FlyingFleet_MemberMemberships $MemberMemberships = null; /** * API For the Members */ public ?FlyingFleet_Members $Members = null; /** * API For the Membership */ public ?FlyingFleet_Memberships $Memberships = null; /** * API For the Aircraft Movements */ public ?FlyingFleet_Movements $Movements = null; /** * API For the News */ public ?FlyingFleet_News $News = null; /** * API For the Reservations (not directly used by the Calendar UI) */ public ?FlyingFleet_Reservations $Reservations = null; /** * API For the Reservation Types */ public ?FlyingFleet_ReservationTypes $ReservationTypes = null; /** * API For the Right Types */ public ?FlyingFleet_RightTypes $RightTypes = null; /** * API For the Role Types */ public ?FlyingFleet_RoleTypes $RoleTypes = null; /** * API For the Global Search */ public ?FlyingFleet_Search $Search = null; /** * API For the TechLog */ public ?FlyingFleet_TechLog $TechLog = null; /** * API For the Transactions */ public ?FlyingFleet_Transactions $Transactions = null; function __construct() { $this->ActionHistory = new FlyingFleet_ActionHistory($this); $this->AircraftLogs = new FlyingFleet_AircraftLogs($this); $this->AircraftModels = new FlyingFleet_AircraftModels($this); $this->Aircrafts = new FlyingFleet_Aircrafts($this); $this->Airports = new FlyingFleet_Airports($this); $this->Articles = new FlyingFleet_Articles($this); $this->Auth = new FlyingFleet_Auth($this); $this->Backups = new FlyingFleet_Backups($this); $this->Bill = new FlyingFleet_Bill($this); $this->Calendar = new FlyingFleet_Calendar($this); $this->Catalogs = new FlyingFleet_Catalogs($this); $this->Currencies = new FlyingFleet_Currencies($this); $this->Diagnostic = new FlyingFleet_Diagnostic($this); $this->Documents = new FlyingFleet_Documents($this); $this->Finances = new FlyingFleet_Finances($this); $this->FlightActivityTypes = new FlyingFleet_FlightActivityTypes($this); $this->Instructions = new FlyingFleet_Instructions($this); $this->InstructionTypes = new FlyingFleet_InstructionTypes($this); $this->Links = new FlyingFleet_Links($this); $this->MemberMemberships = new FlyingFleet_MemberMemberships($this); $this->Members = new FlyingFleet_Members($this); $this->Memberships = new FlyingFleet_Memberships($this); $this->Movements = new FlyingFleet_Movements($this); $this->News = new FlyingFleet_News($this); $this->Reservations = new FlyingFleet_Reservations($this); $this->ReservationTypes = new FlyingFleet_ReservationTypes($this); $this->RightTypes = new FlyingFleet_RightTypes($this); $this->RoleTypes = new FlyingFleet_RoleTypes($this); $this->Search = new FlyingFleet_Search($this); $this->TechLog = new FlyingFleet_TechLog($this); $this->Transactions = new FlyingFleet_Transactions($this); } }