Skip to content

Commit a37ef5e

Browse files
Update data models
1 parent 0535852 commit a37ef5e

33 files changed

+1258
-51
lines changed
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
import * as Joi from 'joi';
2+
import { OaValidationError } from '../oaValidationError';
3+
import * as oa from '../oa';
4+
import * as schema from '../schema';
5+
/**
6+
* test:AttendeeAbsentSimulateAction
7+
*
8+
* [NOTICE: This class is part of the Open Booking API Test Interface, and MUST NOT be used in production.]
9+
*
10+
* This type is derived from https://schema.org/Action, which means that any of this type's properties within schema.org may also be used.
11+
*/
12+
export declare type AttendeeAbsentSimulateAction = {
13+
'@type': 'AttendeeAbsentSimulateAction';
14+
'@context'?: string | string[];
15+
/**
16+
* The identifier property represents any kind of identifier for any kind of [[Thing]], such as ISBNs, GTIN codes, UUIDs etc. Schema.org provides dedicated properties for representing many of these, either as textual strings or as URL (URI) links. See [background notes](/docs/datamodel.html#identifierBg) for more details.
17+
*
18+
*/
19+
identifier?: schema.PropertyValueOrSubClass | string;
20+
/**
21+
* The name of the item.
22+
*/
23+
name?: string;
24+
/**
25+
* A description of the item.
26+
*/
27+
description?: string;
28+
/**
29+
* A unique url based identifier for the record
30+
*/
31+
'@id'?: string;
32+
/**
33+
* The object upon which the action is carried out, whose state is kept intact or changed.
34+
*
35+
* ```json
36+
* "object": {
37+
* "@type": "SessionSeries",
38+
* "@id": "https://id.booking-system.example.com/session-series/42"
39+
* }
40+
* ```
41+
*/
42+
object?: oa.OrderOrSubClass | oa.Event_OrSubClass;
43+
/**
44+
* The startTime of something. For a reserved event or service (e.g. FoodEstablishmentReservation), the time that it is expected to start. For actions that span a period of time, when the action was performed. e.g. John wrote a book from *January* to December. For media, including audio and video, it's the time offset of the start of a clip within a larger file.\n\nNote that Event uses startDate/endDate instead of startTime/endTime, even when describing dates with times. This situation may be clarified in future revisions.
45+
*/
46+
startTime?: string;
47+
/**
48+
* The object that helped the agent perform the action. e.g. John wrote a book with *a pen*.
49+
*/
50+
instrument?: schema.ThingOrSubClass | string;
51+
/**
52+
* Indicates the current disposition of the Action.
53+
*/
54+
actionStatus?: schema.ActionStatusTypeOrSubClass | string;
55+
/**
56+
* The direct performer or driver of the action (animate or inanimate). e.g. *John* wrote a book.
57+
*/
58+
agent?: schema.PersonOrSubClass | schema.OrganizationOrSubClass | string;
59+
/**
60+
* Other co-agents that participated in the action indirectly. e.g. John wrote a book with *Steve*.
61+
*/
62+
participant?: schema.PersonOrSubClass | schema.OrganizationOrSubClass | string;
63+
/**
64+
* Indicates a target EntryPoint for an Action.
65+
*/
66+
target?: schema.EntryPointOrSubClass | string;
67+
/**
68+
* The endTime of something. For a reserved event or service (e.g. FoodEstablishmentReservation), the time that it is expected to end. For actions that span a period of time, when the action was performed. e.g. John wrote a book from January to *December*. For media, including audio and video, it's the time offset of the end of a clip within a larger file.\n\nNote that Event uses startDate/endDate instead of startTime/endTime, even when describing dates with times. This situation may be clarified in future revisions.
69+
*/
70+
endTime?: string;
71+
/**
72+
* For failed actions, more information on the cause of the failure.
73+
*/
74+
error?: schema.ThingOrSubClass | string;
75+
/**
76+
* The result produced in the action. e.g. John wrote *a book*.
77+
*/
78+
result?: schema.ThingOrSubClass | string;
79+
/**
80+
* The location of, for example, where an event is happening, where an organization is located, or where an action takes place.
81+
*/
82+
location?: schema.PlaceOrSubClass | string | schema.VirtualLocationOrSubClass | schema.PostalAddressOrSubClass;
83+
/**
84+
* URL of a reference Web page that unambiguously indicates the item's identity. E.g. the URL of the item's Wikipedia page, Wikidata entry, or official website.
85+
*/
86+
sameAs?: string;
87+
/**
88+
* A CreativeWork or Event about this Thing.
89+
*/
90+
subjectOf?: schema.Event_OrSubClass | schema.CreativeWorkOrSubClass | string;
91+
/**
92+
* Indicates a potential Action, which describes an idealized action in which this thing would play an 'object' role.
93+
*/
94+
potentialAction?: schema.ActionOrSubClass | string;
95+
/**
96+
* Indicates a page (or other CreativeWork) for which this thing is the main entity being described. See [background notes](/docs/datamodel.html#mainEntityBackground) for details.
97+
*/
98+
mainEntityOfPage?: schema.CreativeWorkOrSubClass | string;
99+
/**
100+
* An additional type for the item, typically used for adding more specific types from external vocabularies in microdata syntax. This is a relationship between something and a class that the thing is in. In RDFa syntax, it is better to use the native RDFa syntax - the 'typeof' attribute - for multiple types. Schema.org tools may have only weaker understanding of extra types, in particular those defined externally.
101+
*/
102+
additionalType?: string;
103+
/**
104+
* An alias for the item.
105+
*/
106+
alternateName?: string;
107+
/**
108+
* URL of the item.
109+
*/
110+
url?: string;
111+
/**
112+
* An image of the item. This can be a [[URL]] or a fully described [[ImageObject]].
113+
*/
114+
image?: schema.ImageObjectOrSubClass | string;
115+
/**
116+
* A sub property of description. A short description of the item used to disambiguate from other, similar items. Information from other properties (in particular, name) may be necessary for the description to be useful for disambiguation.
117+
*/
118+
disambiguatingDescription?: string;
119+
};
120+
/**
121+
* test:AttendeeAbsentSimulateAction
122+
*
123+
* [NOTICE: This class is part of the Open Booking API Test Interface, and MUST NOT be used in production.]
124+
*
125+
* This type is derived from https://schema.org/Action, which means that any of this type's properties within schema.org may also be used.
126+
*
127+
* This differs from AttendeeAbsentSimulateAction because it also allows for objects that have the type of a model that
128+
* sub-classes this model. e.g. `Event_OrSubClass` allows `Event`s as well as `ScheduledSession`s, `SessionSeries`,
129+
* etc.
130+
*/
131+
export declare type AttendeeAbsentSimulateActionOrSubClass = AttendeeAbsentSimulateAction;
132+
/**
133+
* test:AttendeeAbsentSimulateAction - Validation schema (w/ JOI)
134+
*
135+
* [NOTICE: This class is part of the Open Booking API Test Interface, and MUST NOT be used in production.]
136+
*
137+
* This type is derived from https://schema.org/Action, which means that any of this type's properties within schema.org may also be used.
138+
*/
139+
export declare const AttendeeAbsentSimulateActionJoiSchema: Joi.ObjectSchema;
140+
/**
141+
* test:AttendeeAbsentSimulateAction - Validation schema (w/ JOI)
142+
*
143+
* [NOTICE: This class is part of the Open Booking API Test Interface, and MUST NOT be used in production.]
144+
*
145+
* This type is derived from https://schema.org/Action, which means that any of this type's properties within schema.org may also be used.
146+
*
147+
* This differs from AttendeeAbsentSimulateActionJoiSchema because it also allows for objects that have the type of a model that
148+
* sub-classes this model. e.g. `Event.OrSubClassJoiSchema` allows `Event`s as well as `ScheduledSession`s,
149+
* `SessionSeries`, etc.
150+
*/
151+
export declare const AttendeeAbsentSimulateActionOrSubClassJoiSchema: Joi.AlternativesSchema;
152+
/**
153+
* Runtime validator for test:AttendeeAbsentSimulateAction.
154+
*
155+
* If some data has a structure which matches a test:AttendeeAbsentSimulateAction, it will be returned with the correct type.
156+
* Otherwise, this function returns an OAValidationError with details about why the data does not match.
157+
*
158+
* Use this to e.g. check a JSON object received in an HTTP request. Example usage (for an express request handler):
159+
*
160+
* ```ts
161+
* const maybeAttendeeAbsentSimulateAction = validateAttendeeAbsentSimulateAction(req.body); // `req.body` will have type `any` or `unknown`
162+
* if (maybeAttendeeAbsentSimulateAction instanceof OaValidationError) {
163+
* // From this point on, `maybeAttendeeAbsentSimulateAction` will have type `OaValidationError`
164+
* const error = maybeAttendeeAbsentSimulateAction;
165+
* // Do something with the error. Maybe ignore it? Or log it? Or throw? Up to you.
166+
* }
167+
* // From this point on, `maybeAttendeeAbsentSimulateAction` will have type `AttendeeAbsentSimulateAction`
168+
* const attendeeAbsentSimulateAction = maybeAttendeeAbsentSimulateAction;
169+
* ```
170+
*/
171+
export declare function validateAttendeeAbsentSimulateAction(maybeAttendeeAbsentSimulateAction: unknown): AttendeeAbsentSimulateAction | OaValidationError;
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.validateAttendeeAbsentSimulateAction = exports.AttendeeAbsentSimulateActionOrSubClassJoiSchema = exports.AttendeeAbsentSimulateActionJoiSchema = void 0;
4+
// This file was generated
5+
const Joi = require("joi");
6+
const oaValidationError_1 = require("../oaValidationError");
7+
const oa = require("../oa");
8+
const schema = require("../schema");
9+
/**
10+
* test:AttendeeAbsentSimulateAction - Validation schema (w/ JOI)
11+
*
12+
* [NOTICE: This class is part of the Open Booking API Test Interface, and MUST NOT be used in production.]
13+
*
14+
* This type is derived from https://schema.org/Action, which means that any of this type's properties within schema.org may also be used.
15+
*/
16+
exports.AttendeeAbsentSimulateActionJoiSchema = Joi.object({
17+
'@type': Joi.string().valid('AttendeeAbsentSimulateAction').required(),
18+
'@context': Joi.alternatives().try([Joi.string(), Joi.array().items(Joi.string())]),
19+
identifier: Joi.alternatives().try(Joi.lazy(() => schema.PropertyValueOrSubClassJoiSchema), Joi.string().uri(), Joi.string()),
20+
name: Joi.string(),
21+
description: Joi.string(),
22+
'@id': Joi.string().uri(),
23+
object: Joi.alternatives().try(Joi.lazy(() => oa.OrderOrSubClassJoiSchema), Joi.lazy(() => oa.Event_OrSubClassJoiSchema)),
24+
startTime: Joi.alternatives().try(Joi.string().isoDate(), Joi.string()),
25+
instrument: Joi.alternatives().try(Joi.lazy(() => schema.ThingOrSubClassJoiSchema), Joi.string().uri()),
26+
actionStatus: Joi.alternatives().try(Joi.lazy(() => schema.ActionStatusTypeOrSubClassJoiSchema), Joi.string().uri()),
27+
agent: Joi.alternatives().try(Joi.lazy(() => schema.PersonOrSubClassJoiSchema), Joi.lazy(() => schema.OrganizationOrSubClassJoiSchema), Joi.string().uri()),
28+
participant: Joi.alternatives().try(Joi.lazy(() => schema.PersonOrSubClassJoiSchema), Joi.lazy(() => schema.OrganizationOrSubClassJoiSchema), Joi.string().uri()),
29+
target: Joi.alternatives().try(Joi.lazy(() => schema.EntryPointOrSubClassJoiSchema), Joi.string().uri()),
30+
endTime: Joi.alternatives().try(Joi.string().isoDate(), Joi.string()),
31+
error: Joi.alternatives().try(Joi.lazy(() => schema.ThingOrSubClassJoiSchema), Joi.string().uri()),
32+
result: Joi.alternatives().try(Joi.lazy(() => schema.ThingOrSubClassJoiSchema), Joi.string().uri()),
33+
location: Joi.alternatives().try(Joi.lazy(() => schema.PlaceOrSubClassJoiSchema), Joi.string(), Joi.lazy(() => schema.VirtualLocationOrSubClassJoiSchema), Joi.lazy(() => schema.PostalAddressOrSubClassJoiSchema), Joi.string().uri()),
34+
sameAs: Joi.string().uri(),
35+
subjectOf: Joi.alternatives().try(Joi.lazy(() => schema.Event_OrSubClassJoiSchema), Joi.lazy(() => schema.CreativeWorkOrSubClassJoiSchema), Joi.string().uri()),
36+
potentialAction: Joi.alternatives().try(Joi.lazy(() => schema.ActionOrSubClassJoiSchema), Joi.string().uri()),
37+
mainEntityOfPage: Joi.alternatives().try(Joi.lazy(() => schema.CreativeWorkOrSubClassJoiSchema), Joi.string().uri()),
38+
additionalType: Joi.string().uri(),
39+
alternateName: Joi.string(),
40+
url: Joi.string().uri(),
41+
image: Joi.alternatives().try(Joi.lazy(() => schema.ImageObjectOrSubClassJoiSchema), Joi.string().uri()),
42+
disambiguatingDescription: Joi.string(),
43+
});
44+
/**
45+
* test:AttendeeAbsentSimulateAction - Validation schema (w/ JOI)
46+
*
47+
* [NOTICE: This class is part of the Open Booking API Test Interface, and MUST NOT be used in production.]
48+
*
49+
* This type is derived from https://schema.org/Action, which means that any of this type's properties within schema.org may also be used.
50+
*
51+
* This differs from AttendeeAbsentSimulateActionJoiSchema because it also allows for objects that have the type of a model that
52+
* sub-classes this model. e.g. `Event.OrSubClassJoiSchema` allows `Event`s as well as `ScheduledSession`s,
53+
* `SessionSeries`, etc.
54+
*/
55+
exports.AttendeeAbsentSimulateActionOrSubClassJoiSchema = Joi.alternatives().try([
56+
exports.AttendeeAbsentSimulateActionJoiSchema,
57+
]);
58+
/**
59+
* Runtime validator for test:AttendeeAbsentSimulateAction.
60+
*
61+
* If some data has a structure which matches a test:AttendeeAbsentSimulateAction, it will be returned with the correct type.
62+
* Otherwise, this function returns an OAValidationError with details about why the data does not match.
63+
*
64+
* Use this to e.g. check a JSON object received in an HTTP request. Example usage (for an express request handler):
65+
*
66+
* ```ts
67+
* const maybeAttendeeAbsentSimulateAction = validateAttendeeAbsentSimulateAction(req.body); // `req.body` will have type `any` or `unknown`
68+
* if (maybeAttendeeAbsentSimulateAction instanceof OaValidationError) {
69+
* // From this point on, `maybeAttendeeAbsentSimulateAction` will have type `OaValidationError`
70+
* const error = maybeAttendeeAbsentSimulateAction;
71+
* // Do something with the error. Maybe ignore it? Or log it? Or throw? Up to you.
72+
* }
73+
* // From this point on, `maybeAttendeeAbsentSimulateAction` will have type `AttendeeAbsentSimulateAction`
74+
* const attendeeAbsentSimulateAction = maybeAttendeeAbsentSimulateAction;
75+
* ```
76+
*/
77+
function validateAttendeeAbsentSimulateAction(maybeAttendeeAbsentSimulateAction) {
78+
const { value, error } = exports.AttendeeAbsentSimulateActionJoiSchema.validate(maybeAttendeeAbsentSimulateAction);
79+
if (error) {
80+
return new oaValidationError_1.OaValidationError('AttendeeAbsentSimulateAction', maybeAttendeeAbsentSimulateAction, error);
81+
}
82+
/* Joi does not implement TS Type Guards, so TS does not implicitly know that this has now been validated
83+
to have the right type. Therefore, we just cast it to the right type. */
84+
return value;
85+
}
86+
exports.validateAttendeeAbsentSimulateAction = validateAttendeeAbsentSimulateAction;

0 commit comments

Comments
 (0)