Source: client/openapi/model/GltfModel.js

  1. /**
  2. * OpenAPI definition
  3. * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
  4. *
  5. * The version of the OpenAPI document: v0
  6. *
  7. *
  8. * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
  9. * https://openapi-generator.tech
  10. * Do not edit the class manually.
  11. *
  12. */
  13. import {ApiClient} from '../ApiClient.js';
  14. import { ContentCategory } from './ContentCategory.js';
  15. /**
  16. * The GltfModel model module.
  17. * @module model/GltfModel
  18. * @version v0
  19. */
  20. export class GltfModel {
  21. /**
  22. * Constructs a new <code>GltfModel</code>.
  23. * @alias GltfModel
  24. */
  25. constructor() {
  26. GltfModel.initialize(this);
  27. }
  28. /**
  29. * Initializes the fields of this object.
  30. * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins).
  31. * Only for internal use.
  32. */
  33. static initialize(obj) {
  34. }
  35. /**
  36. * Constructs a <code>GltfModel</code> from a plain JavaScript object, optionally creating a new instance.
  37. * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
  38. * @param {Object} data The plain JavaScript object bearing properties of interest.
  39. * @param {GltfModel} obj Optional instance to populate.
  40. * @return {GltfModel} The populated <code>GltfModel</code> instance.
  41. */
  42. static constructFromObject(data, obj) {
  43. if (data) {
  44. obj = obj || new GltfModel();
  45. if (data.hasOwnProperty('fileName')) {
  46. obj['fileName'] = ApiClient.convertToType(data['fileName'], 'String');
  47. }
  48. if (data.hasOwnProperty('contentType')) {
  49. obj['contentType'] = ApiClient.convertToType(data['contentType'], 'String');
  50. }
  51. if (data.hasOwnProperty('length')) {
  52. obj['length'] = ApiClient.convertToType(data['length'], 'Number');
  53. }
  54. if (data.hasOwnProperty('uid')) {
  55. obj['uid'] = ApiClient.convertToType(data['uid'], 'String');
  56. }
  57. if (data.hasOwnProperty('uri')) {
  58. obj['uri'] = ApiClient.convertToType(data['uri'], 'String');
  59. }
  60. if (data.hasOwnProperty('name')) {
  61. obj['name'] = ApiClient.convertToType(data['name'], 'String');
  62. }
  63. if (data.hasOwnProperty('description')) {
  64. obj['description'] = ApiClient.convertToType(data['description'], 'String');
  65. }
  66. if (data.hasOwnProperty('license')) {
  67. obj['license'] = ApiClient.convertToType(data['license'], 'String');
  68. }
  69. if (data.hasOwnProperty('author')) {
  70. obj['author'] = ApiClient.convertToType(data['author'], 'String');
  71. }
  72. if (data.hasOwnProperty('categories')) {
  73. obj['categories'] = ApiClient.convertToType(data['categories'], [ContentCategory]);
  74. }
  75. if (data.hasOwnProperty('mesh')) {
  76. obj['mesh'] = ApiClient.convertToType(data['mesh'], 'String');
  77. }
  78. }
  79. return obj;
  80. }
  81. /**
  82. * Validates the JSON data with respect to <code>GltfModel</code>.
  83. * @param {Object} data The plain JavaScript object bearing properties of interest.
  84. * @return {boolean} to indicate whether the JSON data is valid with respect to <code>GltfModel</code>.
  85. */
  86. static validateJSON(data) {
  87. // ensure the json data is a string
  88. if (data['fileName'] && !(typeof data['fileName'] === 'string' || data['fileName'] instanceof String)) {
  89. throw new Error("Expected the field `fileName` to be a primitive type in the JSON string but got " + data['fileName']);
  90. }
  91. // ensure the json data is a string
  92. if (data['contentType'] && !(typeof data['contentType'] === 'string' || data['contentType'] instanceof String)) {
  93. throw new Error("Expected the field `contentType` to be a primitive type in the JSON string but got " + data['contentType']);
  94. }
  95. // ensure the json data is a string
  96. if (data['uid'] && !(typeof data['uid'] === 'string' || data['uid'] instanceof String)) {
  97. throw new Error("Expected the field `uid` to be a primitive type in the JSON string but got " + data['uid']);
  98. }
  99. // ensure the json data is a string
  100. if (data['uri'] && !(typeof data['uri'] === 'string' || data['uri'] instanceof String)) {
  101. throw new Error("Expected the field `uri` to be a primitive type in the JSON string but got " + data['uri']);
  102. }
  103. // ensure the json data is a string
  104. if (data['name'] && !(typeof data['name'] === 'string' || data['name'] instanceof String)) {
  105. throw new Error("Expected the field `name` to be a primitive type in the JSON string but got " + data['name']);
  106. }
  107. // ensure the json data is a string
  108. if (data['description'] && !(typeof data['description'] === 'string' || data['description'] instanceof String)) {
  109. throw new Error("Expected the field `description` to be a primitive type in the JSON string but got " + data['description']);
  110. }
  111. // ensure the json data is a string
  112. if (data['license'] && !(typeof data['license'] === 'string' || data['license'] instanceof String)) {
  113. throw new Error("Expected the field `license` to be a primitive type in the JSON string but got " + data['license']);
  114. }
  115. // ensure the json data is a string
  116. if (data['author'] && !(typeof data['author'] === 'string' || data['author'] instanceof String)) {
  117. throw new Error("Expected the field `author` to be a primitive type in the JSON string but got " + data['author']);
  118. }
  119. if (data['categories']) { // data not null
  120. // ensure the json data is an array
  121. if (!Array.isArray(data['categories'])) {
  122. throw new Error("Expected the field `categories` to be an array in the JSON data but got " + data['categories']);
  123. }
  124. // validate the optional field `categories` (array)
  125. for (const item of data['categories']) {
  126. ContentCategory.validateJSON(item);
  127. };
  128. }
  129. // ensure the json data is a string
  130. if (data['mesh'] && !(typeof data['mesh'] === 'string' || data['mesh'] instanceof String)) {
  131. throw new Error("Expected the field `mesh` to be a primitive type in the JSON string but got " + data['mesh']);
  132. }
  133. return true;
  134. }
  135. }
  136. /**
  137. * @member {String} fileName
  138. */
  139. GltfModel.prototype['fileName'] = undefined;
  140. /**
  141. * @member {String} contentType
  142. */
  143. GltfModel.prototype['contentType'] = undefined;
  144. /**
  145. * @member {Number} length
  146. */
  147. GltfModel.prototype['length'] = undefined;
  148. /**
  149. * @member {String} uid
  150. */
  151. GltfModel.prototype['uid'] = undefined;
  152. /**
  153. * @member {String} uri
  154. */
  155. GltfModel.prototype['uri'] = undefined;
  156. /**
  157. * @member {String} name
  158. */
  159. GltfModel.prototype['name'] = undefined;
  160. /**
  161. * @member {String} description
  162. */
  163. GltfModel.prototype['description'] = undefined;
  164. /**
  165. * @member {String} license
  166. */
  167. GltfModel.prototype['license'] = undefined;
  168. /**
  169. * @member {String} author
  170. */
  171. GltfModel.prototype['author'] = undefined;
  172. /**
  173. * @member {Array.<ContentCategory>} categories
  174. */
  175. GltfModel.prototype['categories'] = undefined;
  176. /**
  177. * @member {String} mesh
  178. */
  179. GltfModel.prototype['mesh'] = undefined;
  180. export default GltfModel;