niceSmartCRM API Documentation
crm_cmd
Created on 2024-01-12
@author: wf
CrmCmd
Bases: WebserverCmd
Command line for Customer Relationship Management
Source code in crm/crm_cmd.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
getArgParser(description, version_msg)
override the default argparser call
Source code in crm/crm_cmd.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
main(argv=None)
main call
Source code in crm/crm_cmd.py
40 41 42 43 44 45 46 47 48 49 |
|
crm_core
Created on 2024-01-12
@author: wf
Organizations
Bases: EntityManager
get organizations
Source code in crm/crm_core.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
from_smartcrm(smartcrm_org_lod)
Convert a list of organizations from the smartcrm_org_lod format to a list of dictionaries with appropriate field names and types.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
smartcrm_org_lod |
List[Dict]
|
List of organizations in smartcrm_org_lod format. |
required |
Returns:
Type | Description |
---|---|
List[Dict]
|
List[Dict]: A list of dictionaries with converted field names and types. |
Source code in crm/crm_core.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
db
Created on 2024-01-13
@author: wf
DB
Database wrapper for managing direct database connections and executing queries using PyMySQL.
Attributes:
Name | Type | Description |
---|---|---|
config |
Dict[str, Any]
|
Database configuration details. |
connection |
Connection
|
PyMySQL connection instance. |
Source code in crm/db.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
__init__(config_path=None)
Initializes the database connection using provided configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_path |
str
|
Path to the configuration YAML file. Defaults to '~/.smartcrm/db_config.yaml'. |
None
|
Source code in crm/db.py
23 24 25 26 27 28 29 30 31 32 33 34 |
|
close()
Closes the database connection.
Source code in crm/db.py
80 81 82 83 84 85 |
|
create_connection()
Creates a PyMySQL connection using the loaded configuration.
Returns:
Type | Description |
---|---|
Connection
|
pymysql.connections.Connection: PyMySQL connection instance. |
Source code in crm/db.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
execute_query(query)
Executes a SQL query and returns the results.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The SQL query to execute. |
required |
Returns:
Type | Description |
---|---|
List[Dict[str, Any]]
|
List[Dict[str, Any]]: The result of the SQL query execution. |
Source code in crm/db.py
66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
load_config(path)
Loads the database configuration from a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
str
|
The file path of the YAML configuration file. |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
Dict[str, Any]: A dictionary containing database configuration. |
Source code in crm/db.py
36 37 38 39 40 41 42 43 44 45 46 47 |
|
em
Created on 2024-01-13
@author: wf
CRM
CRM
Source code in crm/em.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
|
root_path()
classmethod
Get the root path dynamically based on the home directory.
Source code in crm/em.py
22 23 24 25 26 27 28 29 30 |
|
EntityManager
Generic Entity Manager
Source code in crm/em.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
from_db(db)
Fetch entities from the database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db |
DB
|
Database object to execute queries. |
required |
Returns:
Type | Description |
---|---|
List[Dict]
|
List[Dict]: A list of entity dictionaries. |
Source code in crm/em.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
from_json_file(json_path=None)
read my lod from the given json_path
Source code in crm/em.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
smart_crm
Created on 2024-01-13
@author: wf
version
Created on 2023-11-06
@author: wf
Version
dataclass
Version handling for niceSmartCRM
Source code in crm/version.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
xmi
Created on 2024-01-14
@author: wf
Class
dataclass
Bases: ModelElement
Source code in crm/xmi.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
as_plantuml(indentation='')
Generate PlantUML representation for this Class and its contents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indentation |
str
|
Indentation for the PlantUML code. |
''
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The PlantUML representation for this Class and its contents. |
Source code in crm/xmi.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
|
Model
dataclass
Bases: Package
Model with option to read from XMI files which have been converted to JSON
Source code in crm/xmi.py
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
|
create_lookup()
create the lookup dict
Source code in crm/xmi.py
398 399 400 401 402 403 |
|
from_xmi_json(file_path)
classmethod
read the XMI file which has been converted to JSON with xq
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
the file_path to read from |
required |
Returns:
Name | Type | Description |
---|---|---|
Model |
Model
|
the Model instance |
Source code in crm/xmi.py
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
|
raw_read_xmi_json(file_path)
classmethod
read the XMI file which has been converted to JSON with xq
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
the file_path to read from |
required |
Source code in crm/xmi.py
370 371 372 373 374 375 376 377 378 379 380 |
|
to_plant_uml()
Generate a PlantUML representation of the model.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The PlantUML string. |
Source code in crm/xmi.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
|
ModelElement
dataclass
Base model element class
Source code in crm/xmi.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|
short_name: str
property
for name: Logical View::com::bitplan::smartCRM::Organisation::Name return "Name"
from_xmi_dict(parent, node)
classmethod
Create a ModelElement instance from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent |
ModelElement
|
the parent ModelElement or None for the Model itself |
required |
node |
Dict
|
A dictionary representing a ModelElement. |
required |
Returns:
Name | Type | Description |
---|---|---|
ModelElement |
ModelElement
|
An instance of ModelElement. |
Source code in crm/xmi.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
multi_line_doc(limit)
Returns the documentation as a multiline string with a limited length per line. Lines are broken at whitespace.
:param limit: The maximum length of each line. :return: Multiline string.
Source code in crm/xmi.py
57 58 59 60 61 62 63 64 65 66 |
|
Operation
dataclass
Bases: ModelElement
Source code in crm/xmi.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
as_plantuml(indentation='')
Generate PlantUML representation for this Operation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indentation |
str
|
Indentation for the PlantUML code. |
''
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The PlantUML representation for this Operation. |
Source code in crm/xmi.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
|
Package
dataclass
Bases: ModelElement
Source code in crm/xmi.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
|
as_plantuml(indentation='')
Generate PlantUML representation for this Package and its contents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indentation |
str
|
Indentation for the PlantUML code. |
''
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The PlantUML representation for this Package and its contents. |
Source code in crm/xmi.py
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
|
from_xmi_dict(parent, node)
classmethod
Create a Package instance from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
Dict
|
A dictionary representing a Package, with keys for package attributes. |
required |
Returns:
Name | Type | Description |
---|---|---|
Package |
Package
|
An instance of Package. |
Source code in crm/xmi.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
|
TaggedValue
dataclass
Source code in crm/xmi.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|
from_xmi_dict(node)
classmethod
Create a TaggedValue instance from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
Dict
|
A dictionary representing a TaggedValue, with keys '@name' and 'Value'. |
required |
Returns:
Name | Type | Description |
---|---|---|
TaggedValue |
TaggedValue
|
An instance of TaggedValue. |
Source code in crm/xmi.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
|