vectorize_client.models.source_connector_input_config
Vectorize API
API for Vectorize services (Beta)
The version of the OpenAPI document: 0.1.2 Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3""" 4 Vectorize API 5 6 API for Vectorize services (Beta) 7 8 The version of the OpenAPI document: 0.1.2 9 Generated by OpenAPI Generator (https://openapi-generator.tech) 10 11 Do not edit the class manually. 12""" # noqa: E501 13 14 15from __future__ import annotations 16import json 17import pprint 18from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator 19from typing import Any, List, Optional 20from vectorize_client.models.awss3_config import AWSS3Config 21from vectorize_client.models.azureblob_config import AZUREBLOBConfig 22from vectorize_client.models.confluence_config import CONFLUENCEConfig 23from vectorize_client.models.discord_config import DISCORDConfig 24from vectorize_client.models.docusign_config import DOCUSIGNConfig 25from vectorize_client.models.dropbox_config import DROPBOXConfig 26from vectorize_client.models.firecrawl_config import FIRECRAWLConfig 27from vectorize_client.models.fireflies_config import FIREFLIESConfig 28from vectorize_client.models.gcs_config import GCSConfig 29from vectorize_client.models.github_config import GITHUBConfig 30from vectorize_client.models.gmail_config import GMAILConfig 31from vectorize_client.models.googledrive_config import GOOGLEDRIVEConfig 32from vectorize_client.models.googledriveoauth_config import GOOGLEDRIVEOAUTHConfig 33from vectorize_client.models.googledriveoauthmulti_config import GOOGLEDRIVEOAUTHMULTIConfig 34from vectorize_client.models.googledriveoauthmulticustom_config import GOOGLEDRIVEOAUTHMULTICUSTOMConfig 35from vectorize_client.models.intercom_config import INTERCOMConfig 36from vectorize_client.models.notion_config import NOTIONConfig 37from vectorize_client.models.onedrive_config import ONEDRIVEConfig 38from vectorize_client.models.sharepoint_config import SHAREPOINTConfig 39from vectorize_client.models.webcrawler_config import WEBCRAWLERConfig 40from pydantic import StrictStr, Field 41from typing import Union, List, Set, Optional, Dict 42from typing_extensions import Literal, Self 43 44SOURCECONNECTORINPUTCONFIG_ONE_OF_SCHEMAS = ["AWSS3Config", "AZUREBLOBConfig", "CONFLUENCEConfig", "DISCORDConfig", "DOCUSIGNConfig", "DROPBOXConfig", "FIRECRAWLConfig", "FIREFLIESConfig", "GCSConfig", "GITHUBConfig", "GMAILConfig", "GOOGLEDRIVEConfig", "GOOGLEDRIVEOAUTHConfig", "GOOGLEDRIVEOAUTHMULTICUSTOMConfig", "GOOGLEDRIVEOAUTHMULTIConfig", "INTERCOMConfig", "NOTIONConfig", "ONEDRIVEConfig", "SHAREPOINTConfig", "WEBCRAWLERConfig"] 45 46class SourceConnectorInputConfig(BaseModel): 47 """ 48 Configuration specific to the connector type 49 """ 50 # data type: AWSS3Config 51 oneof_schema_1_validator: Optional[AWSS3Config] = None 52 # data type: AZUREBLOBConfig 53 oneof_schema_2_validator: Optional[AZUREBLOBConfig] = None 54 # data type: CONFLUENCEConfig 55 oneof_schema_3_validator: Optional[CONFLUENCEConfig] = None 56 # data type: DISCORDConfig 57 oneof_schema_4_validator: Optional[DISCORDConfig] = None 58 # data type: DROPBOXConfig 59 oneof_schema_5_validator: Optional[DROPBOXConfig] = None 60 # data type: GOOGLEDRIVEOAUTHConfig 61 oneof_schema_6_validator: Optional[GOOGLEDRIVEOAUTHConfig] = None 62 # data type: GOOGLEDRIVEConfig 63 oneof_schema_7_validator: Optional[GOOGLEDRIVEConfig] = None 64 # data type: GOOGLEDRIVEOAUTHMULTIConfig 65 oneof_schema_8_validator: Optional[GOOGLEDRIVEOAUTHMULTIConfig] = None 66 # data type: GOOGLEDRIVEOAUTHMULTICUSTOMConfig 67 oneof_schema_9_validator: Optional[GOOGLEDRIVEOAUTHMULTICUSTOMConfig] = None 68 # data type: FIRECRAWLConfig 69 oneof_schema_10_validator: Optional[FIRECRAWLConfig] = None 70 # data type: GCSConfig 71 oneof_schema_11_validator: Optional[GCSConfig] = None 72 # data type: INTERCOMConfig 73 oneof_schema_12_validator: Optional[INTERCOMConfig] = None 74 # data type: NOTIONConfig 75 oneof_schema_13_validator: Optional[NOTIONConfig] = None 76 # data type: ONEDRIVEConfig 77 oneof_schema_14_validator: Optional[ONEDRIVEConfig] = None 78 # data type: SHAREPOINTConfig 79 oneof_schema_15_validator: Optional[SHAREPOINTConfig] = None 80 # data type: WEBCRAWLERConfig 81 oneof_schema_16_validator: Optional[WEBCRAWLERConfig] = None 82 # data type: GITHUBConfig 83 oneof_schema_17_validator: Optional[GITHUBConfig] = None 84 # data type: FIREFLIESConfig 85 oneof_schema_18_validator: Optional[FIREFLIESConfig] = None 86 # data type: DOCUSIGNConfig 87 oneof_schema_19_validator: Optional[DOCUSIGNConfig] = None 88 # data type: GMAILConfig 89 oneof_schema_20_validator: Optional[GMAILConfig] = None 90 actual_instance: Optional[Union[AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig]] = None 91 one_of_schemas: Set[str] = { "AWSS3Config", "AZUREBLOBConfig", "CONFLUENCEConfig", "DISCORDConfig", "DOCUSIGNConfig", "DROPBOXConfig", "FIRECRAWLConfig", "FIREFLIESConfig", "GCSConfig", "GITHUBConfig", "GMAILConfig", "GOOGLEDRIVEConfig", "GOOGLEDRIVEOAUTHConfig", "GOOGLEDRIVEOAUTHMULTICUSTOMConfig", "GOOGLEDRIVEOAUTHMULTIConfig", "INTERCOMConfig", "NOTIONConfig", "ONEDRIVEConfig", "SHAREPOINTConfig", "WEBCRAWLERConfig" } 92 93 model_config = ConfigDict( 94 validate_assignment=True, 95 protected_namespaces=(), 96 ) 97 98 99 def __init__(self, *args, **kwargs) -> None: 100 if args: 101 if len(args) > 1: 102 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 103 if kwargs: 104 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 105 super().__init__(actual_instance=args[0]) 106 else: 107 super().__init__(**kwargs) 108 109 @field_validator('actual_instance') 110 def actual_instance_must_validate_oneof(cls, v): 111 instance = SourceConnectorInputConfig.model_construct() 112 error_messages = [] 113 match = 0 114 # validate data type: AWSS3Config 115 if not isinstance(v, AWSS3Config): 116 error_messages.append(f"Error! Input type `{type(v)}` is not `AWSS3Config`") 117 else: 118 match += 1 119 # validate data type: AZUREBLOBConfig 120 if not isinstance(v, AZUREBLOBConfig): 121 error_messages.append(f"Error! Input type `{type(v)}` is not `AZUREBLOBConfig`") 122 else: 123 match += 1 124 # validate data type: CONFLUENCEConfig 125 if not isinstance(v, CONFLUENCEConfig): 126 error_messages.append(f"Error! Input type `{type(v)}` is not `CONFLUENCEConfig`") 127 else: 128 match += 1 129 # validate data type: DISCORDConfig 130 if not isinstance(v, DISCORDConfig): 131 error_messages.append(f"Error! Input type `{type(v)}` is not `DISCORDConfig`") 132 else: 133 match += 1 134 # validate data type: DROPBOXConfig 135 if not isinstance(v, DROPBOXConfig): 136 error_messages.append(f"Error! Input type `{type(v)}` is not `DROPBOXConfig`") 137 else: 138 match += 1 139 # validate data type: GOOGLEDRIVEOAUTHConfig 140 if not isinstance(v, GOOGLEDRIVEOAUTHConfig): 141 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHConfig`") 142 else: 143 match += 1 144 # validate data type: GOOGLEDRIVEConfig 145 if not isinstance(v, GOOGLEDRIVEConfig): 146 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEConfig`") 147 else: 148 match += 1 149 # validate data type: GOOGLEDRIVEOAUTHMULTIConfig 150 if not isinstance(v, GOOGLEDRIVEOAUTHMULTIConfig): 151 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHMULTIConfig`") 152 else: 153 match += 1 154 # validate data type: GOOGLEDRIVEOAUTHMULTICUSTOMConfig 155 if not isinstance(v, GOOGLEDRIVEOAUTHMULTICUSTOMConfig): 156 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHMULTICUSTOMConfig`") 157 else: 158 match += 1 159 # validate data type: FIRECRAWLConfig 160 if not isinstance(v, FIRECRAWLConfig): 161 error_messages.append(f"Error! Input type `{type(v)}` is not `FIRECRAWLConfig`") 162 else: 163 match += 1 164 # validate data type: GCSConfig 165 if not isinstance(v, GCSConfig): 166 error_messages.append(f"Error! Input type `{type(v)}` is not `GCSConfig`") 167 else: 168 match += 1 169 # validate data type: INTERCOMConfig 170 if not isinstance(v, INTERCOMConfig): 171 error_messages.append(f"Error! Input type `{type(v)}` is not `INTERCOMConfig`") 172 else: 173 match += 1 174 # validate data type: NOTIONConfig 175 if not isinstance(v, NOTIONConfig): 176 error_messages.append(f"Error! Input type `{type(v)}` is not `NOTIONConfig`") 177 else: 178 match += 1 179 # validate data type: ONEDRIVEConfig 180 if not isinstance(v, ONEDRIVEConfig): 181 error_messages.append(f"Error! Input type `{type(v)}` is not `ONEDRIVEConfig`") 182 else: 183 match += 1 184 # validate data type: SHAREPOINTConfig 185 if not isinstance(v, SHAREPOINTConfig): 186 error_messages.append(f"Error! Input type `{type(v)}` is not `SHAREPOINTConfig`") 187 else: 188 match += 1 189 # validate data type: WEBCRAWLERConfig 190 if not isinstance(v, WEBCRAWLERConfig): 191 error_messages.append(f"Error! Input type `{type(v)}` is not `WEBCRAWLERConfig`") 192 else: 193 match += 1 194 # validate data type: GITHUBConfig 195 if not isinstance(v, GITHUBConfig): 196 error_messages.append(f"Error! Input type `{type(v)}` is not `GITHUBConfig`") 197 else: 198 match += 1 199 # validate data type: FIREFLIESConfig 200 if not isinstance(v, FIREFLIESConfig): 201 error_messages.append(f"Error! Input type `{type(v)}` is not `FIREFLIESConfig`") 202 else: 203 match += 1 204 # validate data type: DOCUSIGNConfig 205 if not isinstance(v, DOCUSIGNConfig): 206 error_messages.append(f"Error! Input type `{type(v)}` is not `DOCUSIGNConfig`") 207 else: 208 match += 1 209 # validate data type: GMAILConfig 210 if not isinstance(v, GMAILConfig): 211 error_messages.append(f"Error! Input type `{type(v)}` is not `GMAILConfig`") 212 else: 213 match += 1 214 if match > 1: 215 # more than 1 match 216 raise ValueError("Multiple matches found when setting `actual_instance` in SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 217 elif match == 0: 218 # no match 219 raise ValueError("No match found when setting `actual_instance` in SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 220 else: 221 return v 222 223 @classmethod 224 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 225 return cls.from_json(json.dumps(obj)) 226 227 @classmethod 228 def from_json(cls, json_str: str) -> Self: 229 """Returns the object represented by the json string""" 230 instance = cls.model_construct() 231 error_messages = [] 232 match = 0 233 234 # deserialize data into AWSS3Config 235 try: 236 instance.actual_instance = AWSS3Config.from_json(json_str) 237 match += 1 238 except (ValidationError, ValueError) as e: 239 error_messages.append(str(e)) 240 # deserialize data into AZUREBLOBConfig 241 try: 242 instance.actual_instance = AZUREBLOBConfig.from_json(json_str) 243 match += 1 244 except (ValidationError, ValueError) as e: 245 error_messages.append(str(e)) 246 # deserialize data into CONFLUENCEConfig 247 try: 248 instance.actual_instance = CONFLUENCEConfig.from_json(json_str) 249 match += 1 250 except (ValidationError, ValueError) as e: 251 error_messages.append(str(e)) 252 # deserialize data into DISCORDConfig 253 try: 254 instance.actual_instance = DISCORDConfig.from_json(json_str) 255 match += 1 256 except (ValidationError, ValueError) as e: 257 error_messages.append(str(e)) 258 # deserialize data into DROPBOXConfig 259 try: 260 instance.actual_instance = DROPBOXConfig.from_json(json_str) 261 match += 1 262 except (ValidationError, ValueError) as e: 263 error_messages.append(str(e)) 264 # deserialize data into GOOGLEDRIVEOAUTHConfig 265 try: 266 instance.actual_instance = GOOGLEDRIVEOAUTHConfig.from_json(json_str) 267 match += 1 268 except (ValidationError, ValueError) as e: 269 error_messages.append(str(e)) 270 # deserialize data into GOOGLEDRIVEConfig 271 try: 272 instance.actual_instance = GOOGLEDRIVEConfig.from_json(json_str) 273 match += 1 274 except (ValidationError, ValueError) as e: 275 error_messages.append(str(e)) 276 # deserialize data into GOOGLEDRIVEOAUTHMULTIConfig 277 try: 278 instance.actual_instance = GOOGLEDRIVEOAUTHMULTIConfig.from_json(json_str) 279 match += 1 280 except (ValidationError, ValueError) as e: 281 error_messages.append(str(e)) 282 # deserialize data into GOOGLEDRIVEOAUTHMULTICUSTOMConfig 283 try: 284 instance.actual_instance = GOOGLEDRIVEOAUTHMULTICUSTOMConfig.from_json(json_str) 285 match += 1 286 except (ValidationError, ValueError) as e: 287 error_messages.append(str(e)) 288 # deserialize data into FIRECRAWLConfig 289 try: 290 instance.actual_instance = FIRECRAWLConfig.from_json(json_str) 291 match += 1 292 except (ValidationError, ValueError) as e: 293 error_messages.append(str(e)) 294 # deserialize data into GCSConfig 295 try: 296 instance.actual_instance = GCSConfig.from_json(json_str) 297 match += 1 298 except (ValidationError, ValueError) as e: 299 error_messages.append(str(e)) 300 # deserialize data into INTERCOMConfig 301 try: 302 instance.actual_instance = INTERCOMConfig.from_json(json_str) 303 match += 1 304 except (ValidationError, ValueError) as e: 305 error_messages.append(str(e)) 306 # deserialize data into NOTIONConfig 307 try: 308 instance.actual_instance = NOTIONConfig.from_json(json_str) 309 match += 1 310 except (ValidationError, ValueError) as e: 311 error_messages.append(str(e)) 312 # deserialize data into ONEDRIVEConfig 313 try: 314 instance.actual_instance = ONEDRIVEConfig.from_json(json_str) 315 match += 1 316 except (ValidationError, ValueError) as e: 317 error_messages.append(str(e)) 318 # deserialize data into SHAREPOINTConfig 319 try: 320 instance.actual_instance = SHAREPOINTConfig.from_json(json_str) 321 match += 1 322 except (ValidationError, ValueError) as e: 323 error_messages.append(str(e)) 324 # deserialize data into WEBCRAWLERConfig 325 try: 326 instance.actual_instance = WEBCRAWLERConfig.from_json(json_str) 327 match += 1 328 except (ValidationError, ValueError) as e: 329 error_messages.append(str(e)) 330 # deserialize data into GITHUBConfig 331 try: 332 instance.actual_instance = GITHUBConfig.from_json(json_str) 333 match += 1 334 except (ValidationError, ValueError) as e: 335 error_messages.append(str(e)) 336 # deserialize data into FIREFLIESConfig 337 try: 338 instance.actual_instance = FIREFLIESConfig.from_json(json_str) 339 match += 1 340 except (ValidationError, ValueError) as e: 341 error_messages.append(str(e)) 342 # deserialize data into DOCUSIGNConfig 343 try: 344 instance.actual_instance = DOCUSIGNConfig.from_json(json_str) 345 match += 1 346 except (ValidationError, ValueError) as e: 347 error_messages.append(str(e)) 348 # deserialize data into GMAILConfig 349 try: 350 instance.actual_instance = GMAILConfig.from_json(json_str) 351 match += 1 352 except (ValidationError, ValueError) as e: 353 error_messages.append(str(e)) 354 355 if match > 1: 356 # more than 1 match 357 raise ValueError("Multiple matches found when deserializing the JSON string into SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 358 elif match == 0: 359 # no match 360 raise ValueError("No match found when deserializing the JSON string into SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 361 else: 362 return instance 363 364 def to_json(self) -> str: 365 """Returns the JSON representation of the actual instance""" 366 if self.actual_instance is None: 367 return "null" 368 369 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 370 return self.actual_instance.to_json() 371 else: 372 return json.dumps(self.actual_instance) 373 374 def to_dict(self) -> Optional[Union[Dict[str, Any], AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig]]: 375 """Returns the dict representation of the actual instance""" 376 if self.actual_instance is None: 377 return None 378 379 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 380 return self.actual_instance.to_dict() 381 else: 382 # primitive type 383 return self.actual_instance 384 385 def to_str(self) -> str: 386 """Returns the string representation of the actual instance""" 387 return pprint.pformat(self.model_dump())
47class SourceConnectorInputConfig(BaseModel): 48 """ 49 Configuration specific to the connector type 50 """ 51 # data type: AWSS3Config 52 oneof_schema_1_validator: Optional[AWSS3Config] = None 53 # data type: AZUREBLOBConfig 54 oneof_schema_2_validator: Optional[AZUREBLOBConfig] = None 55 # data type: CONFLUENCEConfig 56 oneof_schema_3_validator: Optional[CONFLUENCEConfig] = None 57 # data type: DISCORDConfig 58 oneof_schema_4_validator: Optional[DISCORDConfig] = None 59 # data type: DROPBOXConfig 60 oneof_schema_5_validator: Optional[DROPBOXConfig] = None 61 # data type: GOOGLEDRIVEOAUTHConfig 62 oneof_schema_6_validator: Optional[GOOGLEDRIVEOAUTHConfig] = None 63 # data type: GOOGLEDRIVEConfig 64 oneof_schema_7_validator: Optional[GOOGLEDRIVEConfig] = None 65 # data type: GOOGLEDRIVEOAUTHMULTIConfig 66 oneof_schema_8_validator: Optional[GOOGLEDRIVEOAUTHMULTIConfig] = None 67 # data type: GOOGLEDRIVEOAUTHMULTICUSTOMConfig 68 oneof_schema_9_validator: Optional[GOOGLEDRIVEOAUTHMULTICUSTOMConfig] = None 69 # data type: FIRECRAWLConfig 70 oneof_schema_10_validator: Optional[FIRECRAWLConfig] = None 71 # data type: GCSConfig 72 oneof_schema_11_validator: Optional[GCSConfig] = None 73 # data type: INTERCOMConfig 74 oneof_schema_12_validator: Optional[INTERCOMConfig] = None 75 # data type: NOTIONConfig 76 oneof_schema_13_validator: Optional[NOTIONConfig] = None 77 # data type: ONEDRIVEConfig 78 oneof_schema_14_validator: Optional[ONEDRIVEConfig] = None 79 # data type: SHAREPOINTConfig 80 oneof_schema_15_validator: Optional[SHAREPOINTConfig] = None 81 # data type: WEBCRAWLERConfig 82 oneof_schema_16_validator: Optional[WEBCRAWLERConfig] = None 83 # data type: GITHUBConfig 84 oneof_schema_17_validator: Optional[GITHUBConfig] = None 85 # data type: FIREFLIESConfig 86 oneof_schema_18_validator: Optional[FIREFLIESConfig] = None 87 # data type: DOCUSIGNConfig 88 oneof_schema_19_validator: Optional[DOCUSIGNConfig] = None 89 # data type: GMAILConfig 90 oneof_schema_20_validator: Optional[GMAILConfig] = None 91 actual_instance: Optional[Union[AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig]] = None 92 one_of_schemas: Set[str] = { "AWSS3Config", "AZUREBLOBConfig", "CONFLUENCEConfig", "DISCORDConfig", "DOCUSIGNConfig", "DROPBOXConfig", "FIRECRAWLConfig", "FIREFLIESConfig", "GCSConfig", "GITHUBConfig", "GMAILConfig", "GOOGLEDRIVEConfig", "GOOGLEDRIVEOAUTHConfig", "GOOGLEDRIVEOAUTHMULTICUSTOMConfig", "GOOGLEDRIVEOAUTHMULTIConfig", "INTERCOMConfig", "NOTIONConfig", "ONEDRIVEConfig", "SHAREPOINTConfig", "WEBCRAWLERConfig" } 93 94 model_config = ConfigDict( 95 validate_assignment=True, 96 protected_namespaces=(), 97 ) 98 99 100 def __init__(self, *args, **kwargs) -> None: 101 if args: 102 if len(args) > 1: 103 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 104 if kwargs: 105 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 106 super().__init__(actual_instance=args[0]) 107 else: 108 super().__init__(**kwargs) 109 110 @field_validator('actual_instance') 111 def actual_instance_must_validate_oneof(cls, v): 112 instance = SourceConnectorInputConfig.model_construct() 113 error_messages = [] 114 match = 0 115 # validate data type: AWSS3Config 116 if not isinstance(v, AWSS3Config): 117 error_messages.append(f"Error! Input type `{type(v)}` is not `AWSS3Config`") 118 else: 119 match += 1 120 # validate data type: AZUREBLOBConfig 121 if not isinstance(v, AZUREBLOBConfig): 122 error_messages.append(f"Error! Input type `{type(v)}` is not `AZUREBLOBConfig`") 123 else: 124 match += 1 125 # validate data type: CONFLUENCEConfig 126 if not isinstance(v, CONFLUENCEConfig): 127 error_messages.append(f"Error! Input type `{type(v)}` is not `CONFLUENCEConfig`") 128 else: 129 match += 1 130 # validate data type: DISCORDConfig 131 if not isinstance(v, DISCORDConfig): 132 error_messages.append(f"Error! Input type `{type(v)}` is not `DISCORDConfig`") 133 else: 134 match += 1 135 # validate data type: DROPBOXConfig 136 if not isinstance(v, DROPBOXConfig): 137 error_messages.append(f"Error! Input type `{type(v)}` is not `DROPBOXConfig`") 138 else: 139 match += 1 140 # validate data type: GOOGLEDRIVEOAUTHConfig 141 if not isinstance(v, GOOGLEDRIVEOAUTHConfig): 142 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHConfig`") 143 else: 144 match += 1 145 # validate data type: GOOGLEDRIVEConfig 146 if not isinstance(v, GOOGLEDRIVEConfig): 147 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEConfig`") 148 else: 149 match += 1 150 # validate data type: GOOGLEDRIVEOAUTHMULTIConfig 151 if not isinstance(v, GOOGLEDRIVEOAUTHMULTIConfig): 152 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHMULTIConfig`") 153 else: 154 match += 1 155 # validate data type: GOOGLEDRIVEOAUTHMULTICUSTOMConfig 156 if not isinstance(v, GOOGLEDRIVEOAUTHMULTICUSTOMConfig): 157 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHMULTICUSTOMConfig`") 158 else: 159 match += 1 160 # validate data type: FIRECRAWLConfig 161 if not isinstance(v, FIRECRAWLConfig): 162 error_messages.append(f"Error! Input type `{type(v)}` is not `FIRECRAWLConfig`") 163 else: 164 match += 1 165 # validate data type: GCSConfig 166 if not isinstance(v, GCSConfig): 167 error_messages.append(f"Error! Input type `{type(v)}` is not `GCSConfig`") 168 else: 169 match += 1 170 # validate data type: INTERCOMConfig 171 if not isinstance(v, INTERCOMConfig): 172 error_messages.append(f"Error! Input type `{type(v)}` is not `INTERCOMConfig`") 173 else: 174 match += 1 175 # validate data type: NOTIONConfig 176 if not isinstance(v, NOTIONConfig): 177 error_messages.append(f"Error! Input type `{type(v)}` is not `NOTIONConfig`") 178 else: 179 match += 1 180 # validate data type: ONEDRIVEConfig 181 if not isinstance(v, ONEDRIVEConfig): 182 error_messages.append(f"Error! Input type `{type(v)}` is not `ONEDRIVEConfig`") 183 else: 184 match += 1 185 # validate data type: SHAREPOINTConfig 186 if not isinstance(v, SHAREPOINTConfig): 187 error_messages.append(f"Error! Input type `{type(v)}` is not `SHAREPOINTConfig`") 188 else: 189 match += 1 190 # validate data type: WEBCRAWLERConfig 191 if not isinstance(v, WEBCRAWLERConfig): 192 error_messages.append(f"Error! Input type `{type(v)}` is not `WEBCRAWLERConfig`") 193 else: 194 match += 1 195 # validate data type: GITHUBConfig 196 if not isinstance(v, GITHUBConfig): 197 error_messages.append(f"Error! Input type `{type(v)}` is not `GITHUBConfig`") 198 else: 199 match += 1 200 # validate data type: FIREFLIESConfig 201 if not isinstance(v, FIREFLIESConfig): 202 error_messages.append(f"Error! Input type `{type(v)}` is not `FIREFLIESConfig`") 203 else: 204 match += 1 205 # validate data type: DOCUSIGNConfig 206 if not isinstance(v, DOCUSIGNConfig): 207 error_messages.append(f"Error! Input type `{type(v)}` is not `DOCUSIGNConfig`") 208 else: 209 match += 1 210 # validate data type: GMAILConfig 211 if not isinstance(v, GMAILConfig): 212 error_messages.append(f"Error! Input type `{type(v)}` is not `GMAILConfig`") 213 else: 214 match += 1 215 if match > 1: 216 # more than 1 match 217 raise ValueError("Multiple matches found when setting `actual_instance` in SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 218 elif match == 0: 219 # no match 220 raise ValueError("No match found when setting `actual_instance` in SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 221 else: 222 return v 223 224 @classmethod 225 def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: 226 return cls.from_json(json.dumps(obj)) 227 228 @classmethod 229 def from_json(cls, json_str: str) -> Self: 230 """Returns the object represented by the json string""" 231 instance = cls.model_construct() 232 error_messages = [] 233 match = 0 234 235 # deserialize data into AWSS3Config 236 try: 237 instance.actual_instance = AWSS3Config.from_json(json_str) 238 match += 1 239 except (ValidationError, ValueError) as e: 240 error_messages.append(str(e)) 241 # deserialize data into AZUREBLOBConfig 242 try: 243 instance.actual_instance = AZUREBLOBConfig.from_json(json_str) 244 match += 1 245 except (ValidationError, ValueError) as e: 246 error_messages.append(str(e)) 247 # deserialize data into CONFLUENCEConfig 248 try: 249 instance.actual_instance = CONFLUENCEConfig.from_json(json_str) 250 match += 1 251 except (ValidationError, ValueError) as e: 252 error_messages.append(str(e)) 253 # deserialize data into DISCORDConfig 254 try: 255 instance.actual_instance = DISCORDConfig.from_json(json_str) 256 match += 1 257 except (ValidationError, ValueError) as e: 258 error_messages.append(str(e)) 259 # deserialize data into DROPBOXConfig 260 try: 261 instance.actual_instance = DROPBOXConfig.from_json(json_str) 262 match += 1 263 except (ValidationError, ValueError) as e: 264 error_messages.append(str(e)) 265 # deserialize data into GOOGLEDRIVEOAUTHConfig 266 try: 267 instance.actual_instance = GOOGLEDRIVEOAUTHConfig.from_json(json_str) 268 match += 1 269 except (ValidationError, ValueError) as e: 270 error_messages.append(str(e)) 271 # deserialize data into GOOGLEDRIVEConfig 272 try: 273 instance.actual_instance = GOOGLEDRIVEConfig.from_json(json_str) 274 match += 1 275 except (ValidationError, ValueError) as e: 276 error_messages.append(str(e)) 277 # deserialize data into GOOGLEDRIVEOAUTHMULTIConfig 278 try: 279 instance.actual_instance = GOOGLEDRIVEOAUTHMULTIConfig.from_json(json_str) 280 match += 1 281 except (ValidationError, ValueError) as e: 282 error_messages.append(str(e)) 283 # deserialize data into GOOGLEDRIVEOAUTHMULTICUSTOMConfig 284 try: 285 instance.actual_instance = GOOGLEDRIVEOAUTHMULTICUSTOMConfig.from_json(json_str) 286 match += 1 287 except (ValidationError, ValueError) as e: 288 error_messages.append(str(e)) 289 # deserialize data into FIRECRAWLConfig 290 try: 291 instance.actual_instance = FIRECRAWLConfig.from_json(json_str) 292 match += 1 293 except (ValidationError, ValueError) as e: 294 error_messages.append(str(e)) 295 # deserialize data into GCSConfig 296 try: 297 instance.actual_instance = GCSConfig.from_json(json_str) 298 match += 1 299 except (ValidationError, ValueError) as e: 300 error_messages.append(str(e)) 301 # deserialize data into INTERCOMConfig 302 try: 303 instance.actual_instance = INTERCOMConfig.from_json(json_str) 304 match += 1 305 except (ValidationError, ValueError) as e: 306 error_messages.append(str(e)) 307 # deserialize data into NOTIONConfig 308 try: 309 instance.actual_instance = NOTIONConfig.from_json(json_str) 310 match += 1 311 except (ValidationError, ValueError) as e: 312 error_messages.append(str(e)) 313 # deserialize data into ONEDRIVEConfig 314 try: 315 instance.actual_instance = ONEDRIVEConfig.from_json(json_str) 316 match += 1 317 except (ValidationError, ValueError) as e: 318 error_messages.append(str(e)) 319 # deserialize data into SHAREPOINTConfig 320 try: 321 instance.actual_instance = SHAREPOINTConfig.from_json(json_str) 322 match += 1 323 except (ValidationError, ValueError) as e: 324 error_messages.append(str(e)) 325 # deserialize data into WEBCRAWLERConfig 326 try: 327 instance.actual_instance = WEBCRAWLERConfig.from_json(json_str) 328 match += 1 329 except (ValidationError, ValueError) as e: 330 error_messages.append(str(e)) 331 # deserialize data into GITHUBConfig 332 try: 333 instance.actual_instance = GITHUBConfig.from_json(json_str) 334 match += 1 335 except (ValidationError, ValueError) as e: 336 error_messages.append(str(e)) 337 # deserialize data into FIREFLIESConfig 338 try: 339 instance.actual_instance = FIREFLIESConfig.from_json(json_str) 340 match += 1 341 except (ValidationError, ValueError) as e: 342 error_messages.append(str(e)) 343 # deserialize data into DOCUSIGNConfig 344 try: 345 instance.actual_instance = DOCUSIGNConfig.from_json(json_str) 346 match += 1 347 except (ValidationError, ValueError) as e: 348 error_messages.append(str(e)) 349 # deserialize data into GMAILConfig 350 try: 351 instance.actual_instance = GMAILConfig.from_json(json_str) 352 match += 1 353 except (ValidationError, ValueError) as e: 354 error_messages.append(str(e)) 355 356 if match > 1: 357 # more than 1 match 358 raise ValueError("Multiple matches found when deserializing the JSON string into SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 359 elif match == 0: 360 # no match 361 raise ValueError("No match found when deserializing the JSON string into SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 362 else: 363 return instance 364 365 def to_json(self) -> str: 366 """Returns the JSON representation of the actual instance""" 367 if self.actual_instance is None: 368 return "null" 369 370 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 371 return self.actual_instance.to_json() 372 else: 373 return json.dumps(self.actual_instance) 374 375 def to_dict(self) -> Optional[Union[Dict[str, Any], AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig]]: 376 """Returns the dict representation of the actual instance""" 377 if self.actual_instance is None: 378 return None 379 380 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 381 return self.actual_instance.to_dict() 382 else: 383 # primitive type 384 return self.actual_instance 385 386 def to_str(self) -> str: 387 """Returns the string representation of the actual instance""" 388 return pprint.pformat(self.model_dump())
Configuration specific to the connector type
100 def __init__(self, *args, **kwargs) -> None: 101 if args: 102 if len(args) > 1: 103 raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") 104 if kwargs: 105 raise ValueError("If a position argument is used, keyword arguments cannot be used.") 106 super().__init__(actual_instance=args[0]) 107 else: 108 super().__init__(**kwargs)
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError
][pydantic_core.ValidationError] if the input data cannot be
validated to form a valid model.
self
is explicitly positional-only to allow self
as a field name.
Configuration for the model, should be a dictionary conforming to [ConfigDict
][pydantic.config.ConfigDict].
110 @field_validator('actual_instance') 111 def actual_instance_must_validate_oneof(cls, v): 112 instance = SourceConnectorInputConfig.model_construct() 113 error_messages = [] 114 match = 0 115 # validate data type: AWSS3Config 116 if not isinstance(v, AWSS3Config): 117 error_messages.append(f"Error! Input type `{type(v)}` is not `AWSS3Config`") 118 else: 119 match += 1 120 # validate data type: AZUREBLOBConfig 121 if not isinstance(v, AZUREBLOBConfig): 122 error_messages.append(f"Error! Input type `{type(v)}` is not `AZUREBLOBConfig`") 123 else: 124 match += 1 125 # validate data type: CONFLUENCEConfig 126 if not isinstance(v, CONFLUENCEConfig): 127 error_messages.append(f"Error! Input type `{type(v)}` is not `CONFLUENCEConfig`") 128 else: 129 match += 1 130 # validate data type: DISCORDConfig 131 if not isinstance(v, DISCORDConfig): 132 error_messages.append(f"Error! Input type `{type(v)}` is not `DISCORDConfig`") 133 else: 134 match += 1 135 # validate data type: DROPBOXConfig 136 if not isinstance(v, DROPBOXConfig): 137 error_messages.append(f"Error! Input type `{type(v)}` is not `DROPBOXConfig`") 138 else: 139 match += 1 140 # validate data type: GOOGLEDRIVEOAUTHConfig 141 if not isinstance(v, GOOGLEDRIVEOAUTHConfig): 142 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHConfig`") 143 else: 144 match += 1 145 # validate data type: GOOGLEDRIVEConfig 146 if not isinstance(v, GOOGLEDRIVEConfig): 147 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEConfig`") 148 else: 149 match += 1 150 # validate data type: GOOGLEDRIVEOAUTHMULTIConfig 151 if not isinstance(v, GOOGLEDRIVEOAUTHMULTIConfig): 152 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHMULTIConfig`") 153 else: 154 match += 1 155 # validate data type: GOOGLEDRIVEOAUTHMULTICUSTOMConfig 156 if not isinstance(v, GOOGLEDRIVEOAUTHMULTICUSTOMConfig): 157 error_messages.append(f"Error! Input type `{type(v)}` is not `GOOGLEDRIVEOAUTHMULTICUSTOMConfig`") 158 else: 159 match += 1 160 # validate data type: FIRECRAWLConfig 161 if not isinstance(v, FIRECRAWLConfig): 162 error_messages.append(f"Error! Input type `{type(v)}` is not `FIRECRAWLConfig`") 163 else: 164 match += 1 165 # validate data type: GCSConfig 166 if not isinstance(v, GCSConfig): 167 error_messages.append(f"Error! Input type `{type(v)}` is not `GCSConfig`") 168 else: 169 match += 1 170 # validate data type: INTERCOMConfig 171 if not isinstance(v, INTERCOMConfig): 172 error_messages.append(f"Error! Input type `{type(v)}` is not `INTERCOMConfig`") 173 else: 174 match += 1 175 # validate data type: NOTIONConfig 176 if not isinstance(v, NOTIONConfig): 177 error_messages.append(f"Error! Input type `{type(v)}` is not `NOTIONConfig`") 178 else: 179 match += 1 180 # validate data type: ONEDRIVEConfig 181 if not isinstance(v, ONEDRIVEConfig): 182 error_messages.append(f"Error! Input type `{type(v)}` is not `ONEDRIVEConfig`") 183 else: 184 match += 1 185 # validate data type: SHAREPOINTConfig 186 if not isinstance(v, SHAREPOINTConfig): 187 error_messages.append(f"Error! Input type `{type(v)}` is not `SHAREPOINTConfig`") 188 else: 189 match += 1 190 # validate data type: WEBCRAWLERConfig 191 if not isinstance(v, WEBCRAWLERConfig): 192 error_messages.append(f"Error! Input type `{type(v)}` is not `WEBCRAWLERConfig`") 193 else: 194 match += 1 195 # validate data type: GITHUBConfig 196 if not isinstance(v, GITHUBConfig): 197 error_messages.append(f"Error! Input type `{type(v)}` is not `GITHUBConfig`") 198 else: 199 match += 1 200 # validate data type: FIREFLIESConfig 201 if not isinstance(v, FIREFLIESConfig): 202 error_messages.append(f"Error! Input type `{type(v)}` is not `FIREFLIESConfig`") 203 else: 204 match += 1 205 # validate data type: DOCUSIGNConfig 206 if not isinstance(v, DOCUSIGNConfig): 207 error_messages.append(f"Error! Input type `{type(v)}` is not `DOCUSIGNConfig`") 208 else: 209 match += 1 210 # validate data type: GMAILConfig 211 if not isinstance(v, GMAILConfig): 212 error_messages.append(f"Error! Input type `{type(v)}` is not `GMAILConfig`") 213 else: 214 match += 1 215 if match > 1: 216 # more than 1 match 217 raise ValueError("Multiple matches found when setting `actual_instance` in SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 218 elif match == 0: 219 # no match 220 raise ValueError("No match found when setting `actual_instance` in SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 221 else: 222 return v
228 @classmethod 229 def from_json(cls, json_str: str) -> Self: 230 """Returns the object represented by the json string""" 231 instance = cls.model_construct() 232 error_messages = [] 233 match = 0 234 235 # deserialize data into AWSS3Config 236 try: 237 instance.actual_instance = AWSS3Config.from_json(json_str) 238 match += 1 239 except (ValidationError, ValueError) as e: 240 error_messages.append(str(e)) 241 # deserialize data into AZUREBLOBConfig 242 try: 243 instance.actual_instance = AZUREBLOBConfig.from_json(json_str) 244 match += 1 245 except (ValidationError, ValueError) as e: 246 error_messages.append(str(e)) 247 # deserialize data into CONFLUENCEConfig 248 try: 249 instance.actual_instance = CONFLUENCEConfig.from_json(json_str) 250 match += 1 251 except (ValidationError, ValueError) as e: 252 error_messages.append(str(e)) 253 # deserialize data into DISCORDConfig 254 try: 255 instance.actual_instance = DISCORDConfig.from_json(json_str) 256 match += 1 257 except (ValidationError, ValueError) as e: 258 error_messages.append(str(e)) 259 # deserialize data into DROPBOXConfig 260 try: 261 instance.actual_instance = DROPBOXConfig.from_json(json_str) 262 match += 1 263 except (ValidationError, ValueError) as e: 264 error_messages.append(str(e)) 265 # deserialize data into GOOGLEDRIVEOAUTHConfig 266 try: 267 instance.actual_instance = GOOGLEDRIVEOAUTHConfig.from_json(json_str) 268 match += 1 269 except (ValidationError, ValueError) as e: 270 error_messages.append(str(e)) 271 # deserialize data into GOOGLEDRIVEConfig 272 try: 273 instance.actual_instance = GOOGLEDRIVEConfig.from_json(json_str) 274 match += 1 275 except (ValidationError, ValueError) as e: 276 error_messages.append(str(e)) 277 # deserialize data into GOOGLEDRIVEOAUTHMULTIConfig 278 try: 279 instance.actual_instance = GOOGLEDRIVEOAUTHMULTIConfig.from_json(json_str) 280 match += 1 281 except (ValidationError, ValueError) as e: 282 error_messages.append(str(e)) 283 # deserialize data into GOOGLEDRIVEOAUTHMULTICUSTOMConfig 284 try: 285 instance.actual_instance = GOOGLEDRIVEOAUTHMULTICUSTOMConfig.from_json(json_str) 286 match += 1 287 except (ValidationError, ValueError) as e: 288 error_messages.append(str(e)) 289 # deserialize data into FIRECRAWLConfig 290 try: 291 instance.actual_instance = FIRECRAWLConfig.from_json(json_str) 292 match += 1 293 except (ValidationError, ValueError) as e: 294 error_messages.append(str(e)) 295 # deserialize data into GCSConfig 296 try: 297 instance.actual_instance = GCSConfig.from_json(json_str) 298 match += 1 299 except (ValidationError, ValueError) as e: 300 error_messages.append(str(e)) 301 # deserialize data into INTERCOMConfig 302 try: 303 instance.actual_instance = INTERCOMConfig.from_json(json_str) 304 match += 1 305 except (ValidationError, ValueError) as e: 306 error_messages.append(str(e)) 307 # deserialize data into NOTIONConfig 308 try: 309 instance.actual_instance = NOTIONConfig.from_json(json_str) 310 match += 1 311 except (ValidationError, ValueError) as e: 312 error_messages.append(str(e)) 313 # deserialize data into ONEDRIVEConfig 314 try: 315 instance.actual_instance = ONEDRIVEConfig.from_json(json_str) 316 match += 1 317 except (ValidationError, ValueError) as e: 318 error_messages.append(str(e)) 319 # deserialize data into SHAREPOINTConfig 320 try: 321 instance.actual_instance = SHAREPOINTConfig.from_json(json_str) 322 match += 1 323 except (ValidationError, ValueError) as e: 324 error_messages.append(str(e)) 325 # deserialize data into WEBCRAWLERConfig 326 try: 327 instance.actual_instance = WEBCRAWLERConfig.from_json(json_str) 328 match += 1 329 except (ValidationError, ValueError) as e: 330 error_messages.append(str(e)) 331 # deserialize data into GITHUBConfig 332 try: 333 instance.actual_instance = GITHUBConfig.from_json(json_str) 334 match += 1 335 except (ValidationError, ValueError) as e: 336 error_messages.append(str(e)) 337 # deserialize data into FIREFLIESConfig 338 try: 339 instance.actual_instance = FIREFLIESConfig.from_json(json_str) 340 match += 1 341 except (ValidationError, ValueError) as e: 342 error_messages.append(str(e)) 343 # deserialize data into DOCUSIGNConfig 344 try: 345 instance.actual_instance = DOCUSIGNConfig.from_json(json_str) 346 match += 1 347 except (ValidationError, ValueError) as e: 348 error_messages.append(str(e)) 349 # deserialize data into GMAILConfig 350 try: 351 instance.actual_instance = GMAILConfig.from_json(json_str) 352 match += 1 353 except (ValidationError, ValueError) as e: 354 error_messages.append(str(e)) 355 356 if match > 1: 357 # more than 1 match 358 raise ValueError("Multiple matches found when deserializing the JSON string into SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 359 elif match == 0: 360 # no match 361 raise ValueError("No match found when deserializing the JSON string into SourceConnectorInputConfig with oneOf schemas: AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig. Details: " + ", ".join(error_messages)) 362 else: 363 return instance
Returns the object represented by the json string
365 def to_json(self) -> str: 366 """Returns the JSON representation of the actual instance""" 367 if self.actual_instance is None: 368 return "null" 369 370 if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): 371 return self.actual_instance.to_json() 372 else: 373 return json.dumps(self.actual_instance)
Returns the JSON representation of the actual instance
375 def to_dict(self) -> Optional[Union[Dict[str, Any], AWSS3Config, AZUREBLOBConfig, CONFLUENCEConfig, DISCORDConfig, DOCUSIGNConfig, DROPBOXConfig, FIRECRAWLConfig, FIREFLIESConfig, GCSConfig, GITHUBConfig, GMAILConfig, GOOGLEDRIVEConfig, GOOGLEDRIVEOAUTHConfig, GOOGLEDRIVEOAUTHMULTICUSTOMConfig, GOOGLEDRIVEOAUTHMULTIConfig, INTERCOMConfig, NOTIONConfig, ONEDRIVEConfig, SHAREPOINTConfig, WEBCRAWLERConfig]]: 376 """Returns the dict representation of the actual instance""" 377 if self.actual_instance is None: 378 return None 379 380 if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): 381 return self.actual_instance.to_dict() 382 else: 383 # primitive type 384 return self.actual_instance
Returns the dict representation of the actual instance