// made with // http://jvilk.com/MakeTypes/ export interface IFlights { success: boolean; message: string; meta: Meta; data?: (IFlight)[] | null; } export interface Meta { totalCount: number; } export interface IFlight { IDFlight: string; FKGliderCategory: string; Category: string; FKCompetitionClass: string; FKCompetitionClassDesired?: null; CompetitionClass: string; FKLaunchtype: string; Launchtype: string; FKPilot: string; FirstName: string; LastName: string; Nationality: string; FKFederation?: string | null; ClubID?: string | null; ClubName?: string | null; Glider: string; FKGlider?: string | null; FKGliderBrand?: string | null; GliderBrand?: string | null; FKGliderClassification: string; GliderClassification: string; FKSeason: string; FlightDate: string; UtcOffset: string; FlightStartTime: string; FlightEndTime: string; FlightDuration: string; FirstLat: string; FirstLng: string; LastLat: string; LastLng: string; FlightMinLat: string; FlightMaxLat: string; FlightMinLng: string; FlightMaxLng: string; TakeoffCountry: string; FKTakeoffWaypoint: string; TakeoffWaypointOffset: string; TakeoffLocation?: string | null; TakeoffWaypointName: string; FKClosestWaypoint?: string | null; ClosestWaypointOffset?: string | null; LandingCountry: string; FKLandingWaypoint?: string | null; LandingWaypointOffset?: string | null; LandingWaypointName?: string | null; LandingLocation?: string | null; LinearDistance: string; MaxLinearDistance: string; ArcDistance?: string | null; FKBestTaskType: string; BestTaskType: string; BestTaskTypeKey: string; BestTaskDistance: string; BestTaskPoints: string; BestTaskDuration: string; MaxSpeed?: string | null; GroundSpeed?: string | null; BestTaskSpeed: string; TakeoffAltitude: string; MaxAltitude: string; MinAltitude: string; ElevationGain?: string | null; MeanAltitudeDiff: string; MaxClimb: string; MinClimb: string; Dataversion: string; ValidBRecordsCount?: string | null; AirspaceViolationLevel?: string | null; UserReviewComment: string; UserReviewStatus: string; ReviewRequired: string; ReviewReason: string; ReviewStatus: string; ReviewComment: string; ReviewBy: string; ReviewTime?: null; CommentsEnabled: string; CountComments: string; HasPhotos: string; IsBigSmileCandidate: string; WxcCivlID?: string | null; WxcNacStatus?: string | null; WxcSync?: string | null; WxcSyncTS?: string | null; IgcFilename: string; IgcFileHash: string; GRecordStatus: string; GValidationMessage: string; IsNew: string; CanRetract: string; StatisticsValid: string; UC?: string | null; TC: string; US: string; TS: string; } // Stores the currently-being-typechecked object for error messages. let obj: any = null; export class CFlightsProxy { public readonly success: boolean; public readonly message: string; public readonly meta: MetaProxy; public readonly data: CFlightProxy[] | null; public static Parse(d: string): CFlightsProxy { return CFlightsProxy.Create(JSON.parse(d)); } public static Create(d: any, field: string = 'root'): CFlightsProxy { if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { throwNull2NonNull(field, d); } else if (typeof(d) !== 'object') { throwNotObject(field, d, false); } else if (Array.isArray(d)) { throwIsArray(field, d, false); } checkBoolean(d.success, false, field + ".success"); checkString(d.message, false, field + ".message"); d.meta = MetaProxy.Create(d.meta, field + ".meta"); checkArray(d.data, field + ".data"); if (d.data) { for (let i = 0; i < d.data.length; i++) { d.data[i] = CFlightProxy.Create(d.data[i], field + ".data" + "[" + i + "]"); } } if (d.data === undefined) { d.data = null; } return new CFlightsProxy(d); } private constructor(d: any) { this.success = d.success; this.message = d.message; this.meta = d.meta; this.data = d.data; } } export class MetaProxy { public readonly totalCount: number; public static Parse(d: string): MetaProxy { return MetaProxy.Create(JSON.parse(d)); } public static Create(d: any, field: string = 'root'): MetaProxy { if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { throwNull2NonNull(field, d); } else if (typeof(d) !== 'object') { throwNotObject(field, d, false); } else if (Array.isArray(d)) { throwIsArray(field, d, false); } checkNumber(d.totalCount, false, field + ".totalCount"); return new MetaProxy(d); } private constructor(d: any) { this.totalCount = d.totalCount; } } export class CFlightProxy { public readonly IDFlight: string; public readonly FKGliderCategory: string; public readonly Category: string; public readonly FKCompetitionClass: string; public readonly FKCompetitionClassDesired: null; public readonly CompetitionClass: string; public readonly FKLaunchtype: string; public readonly Launchtype: string; public readonly FKPilot: string; public readonly FirstName: string; public readonly LastName: string; public readonly Nationality: string; public readonly FKFederation: string | null; public readonly ClubID: string | null; public readonly ClubName: string | null; public readonly Glider: string; public readonly FKGlider: string | null; public readonly FKGliderBrand: string | null; public readonly GliderBrand: string | null; public readonly FKGliderClassification: string; public readonly GliderClassification: string; public readonly FKSeason: string; public readonly FlightDate: string; public readonly UtcOffset: string; public readonly FlightStartTime: string; public readonly FlightEndTime: string; public readonly FlightDuration: string; public readonly FirstLat: string; public readonly FirstLng: string; public readonly LastLat: string; public readonly LastLng: string; public readonly FlightMinLat: string; public readonly FlightMaxLat: string; public readonly FlightMinLng: string; public readonly FlightMaxLng: string; public readonly TakeoffCountry: string; public readonly FKTakeoffWaypoint: string; public readonly TakeoffWaypointOffset: string; public readonly TakeoffLocation: string | null; public readonly TakeoffWaypointName: string; public readonly FKClosestWaypoint: string | null; public readonly ClosestWaypointOffset: string | null; public readonly LandingCountry: string; public readonly FKLandingWaypoint: string | null; public readonly LandingWaypointOffset: string | null; public readonly LandingWaypointName: string | null; public readonly LandingLocation: string | null; public readonly LinearDistance: string; public readonly MaxLinearDistance: string; public readonly ArcDistance: string | null; public readonly FKBestTaskType: string; public readonly BestTaskType: string; public readonly BestTaskTypeKey: string; public readonly BestTaskDistance: string; public readonly BestTaskPoints: string; public readonly BestTaskDuration: string; public readonly MaxSpeed: string | null; public readonly GroundSpeed: string | null; public readonly BestTaskSpeed: string; public readonly TakeoffAltitude: string; public readonly MaxAltitude: string; public readonly MinAltitude: string; public readonly ElevationGain: string | null; public readonly MeanAltitudeDiff: string; public readonly MaxClimb: string; public readonly MinClimb: string; public readonly Dataversion: string; public readonly ValidBRecordsCount: string | null; public readonly AirspaceViolationLevel: string | null; public readonly UserReviewComment: string; public readonly UserReviewStatus: string; public readonly ReviewRequired: string; public readonly ReviewReason: string; public readonly ReviewStatus: string; public readonly ReviewComment: string; public readonly ReviewBy: string; public readonly ReviewTime: null; public readonly CommentsEnabled: string; public readonly CountComments: string; public readonly HasPhotos: string; public readonly IsBigSmileCandidate: string; public readonly WxcCivlID: string | null; public readonly WxcNacStatus: string | null; public readonly WxcSync: string | null; public readonly WxcSyncTS: string | null; public readonly IgcFilename: string; public readonly IgcFileHash: string; public readonly GRecordStatus: string; public readonly GValidationMessage: string; public readonly IsNew: string; public readonly CanRetract: string; public readonly StatisticsValid: string; public readonly UC: string | null; public readonly TC: string; public readonly US: string; public readonly TS: string; public static Parse(d: string): CFlightProxy { return CFlightProxy.Create(JSON.parse(d)); } public static Create(d: any, field: string = 'root'): IFlightProxy { if (!field) { obj = d; field = "root"; } if (d === null || d === undefined) { throwNull2NonNull(field, d); } else if (typeof(d) !== 'object') { throwNotObject(field, d, false); } else if (Array.isArray(d)) { throwIsArray(field, d, false); } checkString(d.IDFlight, false, field + ".IDFlight"); checkString(d.FKGliderCategory, false, field + ".FKGliderCategory"); checkString(d.Category, false, field + ".Category"); checkString(d.FKCompetitionClass, false, field + ".FKCompetitionClass"); checkNull(d.FKCompetitionClassDesired, field + ".FKCompetitionClassDesired"); if (d.FKCompetitionClassDesired === undefined) { d.FKCompetitionClassDesired = null; } checkString(d.CompetitionClass, false, field + ".CompetitionClass"); checkString(d.FKLaunchtype, false, field + ".FKLaunchtype"); checkString(d.Launchtype, false, field + ".Launchtype"); checkString(d.FKPilot, false, field + ".FKPilot"); checkString(d.FirstName, false, field + ".FirstName"); checkString(d.LastName, false, field + ".LastName"); checkString(d.Nationality, false, field + ".Nationality"); checkString(d.FKFederation, true, field + ".FKFederation"); if (d.FKFederation === undefined) { d.FKFederation = null; } checkString(d.ClubID, true, field + ".ClubID"); if (d.ClubID === undefined) { d.ClubID = null; } checkString(d.ClubName, true, field + ".ClubName"); if (d.ClubName === undefined) { d.ClubName = null; } checkString(d.Glider, false, field + ".Glider"); checkString(d.FKGlider, true, field + ".FKGlider"); if (d.FKGlider === undefined) { d.FKGlider = null; } checkString(d.FKGliderBrand, true, field + ".FKGliderBrand"); if (d.FKGliderBrand === undefined) { d.FKGliderBrand = null; } checkString(d.GliderBrand, true, field + ".GliderBrand"); if (d.GliderBrand === undefined) { d.GliderBrand = null; } checkString(d.FKGliderClassification, false, field + ".FKGliderClassification"); checkString(d.GliderClassification, false, field + ".GliderClassification"); checkString(d.FKSeason, false, field + ".FKSeason"); checkString(d.FlightDate, false, field + ".FlightDate"); checkString(d.UtcOffset, false, field + ".UtcOffset"); checkString(d.FlightStartTime, false, field + ".FlightStartTime"); checkString(d.FlightEndTime, false, field + ".FlightEndTime"); checkString(d.FlightDuration, false, field + ".FlightDuration"); checkString(d.FirstLat, false, field + ".FirstLat"); checkString(d.FirstLng, false, field + ".FirstLng"); checkString(d.LastLat, false, field + ".LastLat"); checkString(d.LastLng, false, field + ".LastLng"); checkString(d.FlightMinLat, false, field + ".FlightMinLat"); checkString(d.FlightMaxLat, false, field + ".FlightMaxLat"); checkString(d.FlightMinLng, false, field + ".FlightMinLng"); checkString(d.FlightMaxLng, false, field + ".FlightMaxLng"); checkString(d.TakeoffCountry, false, field + ".TakeoffCountry"); checkString(d.FKTakeoffWaypoint, false, field + ".FKTakeoffWaypoint"); checkString(d.TakeoffWaypointOffset, false, field + ".TakeoffWaypointOffset"); checkString(d.TakeoffLocation, true, field + ".TakeoffLocation"); if (d.TakeoffLocation === undefined) { d.TakeoffLocation = null; } checkString(d.TakeoffWaypointName, false, field + ".TakeoffWaypointName"); checkString(d.FKClosestWaypoint, true, field + ".FKClosestWaypoint"); if (d.FKClosestWaypoint === undefined) { d.FKClosestWaypoint = null; } checkString(d.ClosestWaypointOffset, true, field + ".ClosestWaypointOffset"); if (d.ClosestWaypointOffset === undefined) { d.ClosestWaypointOffset = null; } checkString(d.LandingCountry, false, field + ".LandingCountry"); checkString(d.FKLandingWaypoint, true, field + ".FKLandingWaypoint"); if (d.FKLandingWaypoint === undefined) { d.FKLandingWaypoint = null; } checkString(d.LandingWaypointOffset, true, field + ".LandingWaypointOffset"); if (d.LandingWaypointOffset === undefined) { d.LandingWaypointOffset = null; } checkString(d.LandingWaypointName, true, field + ".LandingWaypointName"); if (d.LandingWaypointName === undefined) { d.LandingWaypointName = null; } checkString(d.LandingLocation, true, field + ".LandingLocation"); if (d.LandingLocation === undefined) { d.LandingLocation = null; } checkString(d.LinearDistance, false, field + ".LinearDistance"); checkString(d.MaxLinearDistance, false, field + ".MaxLinearDistance"); checkString(d.ArcDistance, true, field + ".ArcDistance"); if (d.ArcDistance === undefined) { d.ArcDistance = null; } checkString(d.FKBestTaskType, false, field + ".FKBestTaskType"); checkString(d.BestTaskType, false, field + ".BestTaskType"); checkString(d.BestTaskTypeKey, false, field + ".BestTaskTypeKey"); checkString(d.BestTaskDistance, false, field + ".BestTaskDistance"); checkString(d.BestTaskPoints, false, field + ".BestTaskPoints"); checkString(d.BestTaskDuration, false, field + ".BestTaskDuration"); checkString(d.MaxSpeed, true, field + ".MaxSpeed"); if (d.MaxSpeed === undefined) { d.MaxSpeed = null; } checkString(d.GroundSpeed, true, field + ".GroundSpeed"); if (d.GroundSpeed === undefined) { d.GroundSpeed = null; } checkString(d.BestTaskSpeed, false, field + ".BestTaskSpeed"); checkString(d.TakeoffAltitude, false, field + ".TakeoffAltitude"); checkString(d.MaxAltitude, false, field + ".MaxAltitude"); checkString(d.MinAltitude, false, field + ".MinAltitude"); checkString(d.ElevationGain, true, field + ".ElevationGain"); if (d.ElevationGain === undefined) { d.ElevationGain = null; } checkString(d.MeanAltitudeDiff, false, field + ".MeanAltitudeDiff"); checkString(d.MaxClimb, false, field + ".MaxClimb"); checkString(d.MinClimb, false, field + ".MinClimb"); checkString(d.Dataversion, false, field + ".Dataversion"); checkString(d.ValidBRecordsCount, true, field + ".ValidBRecordsCount"); if (d.ValidBRecordsCount === undefined) { d.ValidBRecordsCount = null; } checkString(d.AirspaceViolationLevel, true, field + ".AirspaceViolationLevel"); if (d.AirspaceViolationLevel === undefined) { d.AirspaceViolationLevel = null; } checkString(d.UserReviewComment, false, field + ".UserReviewComment"); checkString(d.UserReviewStatus, false, field + ".UserReviewStatus"); checkString(d.ReviewRequired, false, field + ".ReviewRequired"); checkString(d.ReviewReason, false, field + ".ReviewReason"); checkString(d.ReviewStatus, false, field + ".ReviewStatus"); checkString(d.ReviewComment, false, field + ".ReviewComment"); checkString(d.ReviewBy, false, field + ".ReviewBy"); checkNull(d.ReviewTime, field + ".ReviewTime"); if (d.ReviewTime === undefined) { d.ReviewTime = null; } checkString(d.CommentsEnabled, false, field + ".CommentsEnabled"); checkString(d.CountComments, false, field + ".CountComments"); checkString(d.HasPhotos, false, field + ".HasPhotos"); checkString(d.IsBigSmileCandidate, false, field + ".IsBigSmileCandidate"); checkString(d.WxcCivlID, true, field + ".WxcCivlID"); if (d.WxcCivlID === undefined) { d.WxcCivlID = null; } checkString(d.WxcNacStatus, true, field + ".WxcNacStatus"); if (d.WxcNacStatus === undefined) { d.WxcNacStatus = null; } checkString(d.WxcSync, true, field + ".WxcSync"); if (d.WxcSync === undefined) { d.WxcSync = null; } checkString(d.WxcSyncTS, true, field + ".WxcSyncTS"); if (d.WxcSyncTS === undefined) { d.WxcSyncTS = null; } checkString(d.IgcFilename, false, field + ".IgcFilename"); checkString(d.IgcFileHash, false, field + ".IgcFileHash"); checkString(d.GRecordStatus, false, field + ".GRecordStatus"); checkString(d.GValidationMessage, false, field + ".GValidationMessage"); checkString(d.IsNew, false, field + ".IsNew"); checkString(d.CanRetract, false, field + ".CanRetract"); checkString(d.StatisticsValid, false, field + ".StatisticsValid"); checkString(d.UC, true, field + ".UC"); if (d.UC === undefined) { d.UC = null; } checkString(d.TC, false, field + ".TC"); checkString(d.US, false, field + ".US"); checkString(d.TS, false, field + ".TS"); return new CFlightProxy(d); } private constructor(d: any) { this.IDFlight = d.IDFlight; this.FKGliderCategory = d.FKGliderCategory; this.Category = d.Category; this.FKCompetitionClass = d.FKCompetitionClass; this.FKCompetitionClassDesired = d.FKCompetitionClassDesired; this.CompetitionClass = d.CompetitionClass; this.FKLaunchtype = d.FKLaunchtype; this.Launchtype = d.Launchtype; this.FKPilot = d.FKPilot; this.FirstName = d.FirstName; this.LastName = d.LastName; this.Nationality = d.Nationality; this.FKFederation = d.FKFederation; this.ClubID = d.ClubID; this.ClubName = d.ClubName; this.Glider = d.Glider; this.FKGlider = d.FKGlider; this.FKGliderBrand = d.FKGliderBrand; this.GliderBrand = d.GliderBrand; this.FKGliderClassification = d.FKGliderClassification; this.GliderClassification = d.GliderClassification; this.FKSeason = d.FKSeason; this.FlightDate = d.FlightDate; this.UtcOffset = d.UtcOffset; this.FlightStartTime = d.FlightStartTime; this.FlightEndTime = d.FlightEndTime; this.FlightDuration = d.FlightDuration; this.FirstLat = d.FirstLat; this.FirstLng = d.FirstLng; this.LastLat = d.LastLat; this.LastLng = d.LastLng; this.FlightMinLat = d.FlightMinLat; this.FlightMaxLat = d.FlightMaxLat; this.FlightMinLng = d.FlightMinLng; this.FlightMaxLng = d.FlightMaxLng; this.TakeoffCountry = d.TakeoffCountry; this.FKTakeoffWaypoint = d.FKTakeoffWaypoint; this.TakeoffWaypointOffset = d.TakeoffWaypointOffset; this.TakeoffLocation = d.TakeoffLocation; this.TakeoffWaypointName = d.TakeoffWaypointName; this.FKClosestWaypoint = d.FKClosestWaypoint; this.ClosestWaypointOffset = d.ClosestWaypointOffset; this.LandingCountry = d.LandingCountry; this.FKLandingWaypoint = d.FKLandingWaypoint; this.LandingWaypointOffset = d.LandingWaypointOffset; this.LandingWaypointName = d.LandingWaypointName; this.LandingLocation = d.LandingLocation; this.LinearDistance = d.LinearDistance; this.MaxLinearDistance = d.MaxLinearDistance; this.ArcDistance = d.ArcDistance; this.FKBestTaskType = d.FKBestTaskType; this.BestTaskType = d.BestTaskType; this.BestTaskTypeKey = d.BestTaskTypeKey; this.BestTaskDistance = d.BestTaskDistance; this.BestTaskPoints = d.BestTaskPoints; this.BestTaskDuration = d.BestTaskDuration; this.MaxSpeed = d.MaxSpeed; this.GroundSpeed = d.GroundSpeed; this.BestTaskSpeed = d.BestTaskSpeed; this.TakeoffAltitude = d.TakeoffAltitude; this.MaxAltitude = d.MaxAltitude; this.MinAltitude = d.MinAltitude; this.ElevationGain = d.ElevationGain; this.MeanAltitudeDiff = d.MeanAltitudeDiff; this.MaxClimb = d.MaxClimb; this.MinClimb = d.MinClimb; this.Dataversion = d.Dataversion; this.ValidBRecordsCount = d.ValidBRecordsCount; this.AirspaceViolationLevel = d.AirspaceViolationLevel; this.UserReviewComment = d.UserReviewComment; this.UserReviewStatus = d.UserReviewStatus; this.ReviewRequired = d.ReviewRequired; this.ReviewReason = d.ReviewReason; this.ReviewStatus = d.ReviewStatus; this.ReviewComment = d.ReviewComment; this.ReviewBy = d.ReviewBy; this.ReviewTime = d.ReviewTime; this.CommentsEnabled = d.CommentsEnabled; this.CountComments = d.CountComments; this.HasPhotos = d.HasPhotos; this.IsBigSmileCandidate = d.IsBigSmileCandidate; this.WxcCivlID = d.WxcCivlID; this.WxcNacStatus = d.WxcNacStatus; this.WxcSync = d.WxcSync; this.WxcSyncTS = d.WxcSyncTS; this.IgcFilename = d.IgcFilename; this.IgcFileHash = d.IgcFileHash; this.GRecordStatus = d.GRecordStatus; this.GValidationMessage = d.GValidationMessage; this.IsNew = d.IsNew; this.CanRetract = d.CanRetract; this.StatisticsValid = d.StatisticsValid; this.UC = d.UC; this.TC = d.TC; this.US = d.US; this.TS = d.TS; } } function throwNull2NonNull(field: string, d: any): never { return errorHelper(field, d, "non-nullable object", false); } function throwNotObject(field: string, d: any, nullable: boolean): never { return errorHelper(field, d, "object", nullable); } function throwIsArray(field: string, d: any, nullable: boolean): never { return errorHelper(field, d, "object", nullable); } function checkArray(d: any, field: string): void { if (!Array.isArray(d) && d !== null && d !== undefined) { errorHelper(field, d, "array", true); } } function checkNumber(d: any, nullable: boolean, field: string): void { if (typeof(d) !== 'number' && (!nullable || (nullable && d !== null && d !== undefined))) { errorHelper(field, d, "number", nullable); } } function checkBoolean(d: any, nullable: boolean, field: string): void { if (typeof(d) !== 'boolean' && (!nullable || (nullable && d !== null && d !== undefined))) { errorHelper(field, d, "boolean", nullable); } } function checkString(d: any, nullable: boolean, field: string): void { if (typeof(d) !== 'string' && (!nullable || (nullable && d !== null && d !== undefined))) { errorHelper(field, d, "string", nullable); } } function checkNull(d: any, field: string): void { if (d !== null && d !== undefined) { errorHelper(field, d, "null or undefined", false); } } function errorHelper(field: string, d: any, type: string, nullable: boolean): never { if (nullable) { type += ", null, or undefined"; } throw new TypeError('Expected ' + type + " at " + field + " but found:\n" + JSON.stringify(d) + "\n\nFull object:\n" + JSON.stringify(obj)); }