Activity
¶
Bases: Object
Source code in libs/apmodel/src/apmodel/core.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
|
__init__(type='Activity', id=None, actor=None, object=None, target=None, result=None, origin=None, instrument=None, proof={}, **kwargs)
¶
Represents an Activity object in Activity Streams 2.0.
The Activity class is used to express an action or event that occurs in a social context. It encapsulates various properties that describe the activity, including the actor, the object acted upon, and other related entities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
str
|
The type of the object. For this class, it is always "Activity". Defaults to "Activity". |
'Activity'
|
id
|
Optional[str]
|
A unique identifier for the activity. If not provided, a UUID will be generated. Defaults to None. |
None
|
actor
|
Optional[Union[Object, Link, str, dict]]
|
The entity that is performing the activity. This can be an Object, a Link, a string representing an identifier, or a dictionary containing the entity's data. Defaults to None. |
None
|
object
|
Optional[Union[Object, dict]]
|
The object that is the target of the activity. This can be an Object or a dictionary. Defaults to None. |
None
|
target
|
Optional[Union[Object, Link]]
|
The entity that the activity is directed towards. This can be an Object or a Link. Defaults to None. |
None
|
result
|
Optional[Union[Object, Link]]
|
The result of the activity. This can be an Object or a Link that represents the outcome of the activity. Defaults to None. |
None
|
origin
|
Optional[Union[Object, Link]]
|
The source of the activity, indicating where it originated. This can be an Object or a Link. Defaults to None. |
None
|
instrument
|
Optional[Union[Object, Link]]
|
The tool or means used to perform the activity. This can be an Object or a Link. Defaults to None. |
None
|
proof
|
Union[DataIntegrityProof, dict]
|
A proof of the integrity of the activity data, represented as a DataIntegrityProof object or a dictionary. Defaults to an empty list. |
{}
|
**kwargs
|
Additional properties that can be added to the Activity object, allowing for extensibility. |
{}
|
Note
Other values are inherited from apmodel.Object.
Raises:
Type | Description |
---|---|
ValueError
|
If the proof is not a valid DataIntegrityProof object or dictionary. |
Source code in libs/apmodel/src/apmodel/core.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
|
to_dict(_extras=None)
¶
Outputs the current object as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_extras
|
Optional[dict]
|
Arguments used internally. It is not recommended that users change them. |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Objects converted to dictionaries |
Source code in libs/apmodel/src/apmodel/core.py
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
|
Link
¶
Source code in libs/apmodel/src/apmodel/core.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 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 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
|
__init__(_context='https://www.w3.org/ns/activitystreams', type='Link', id=None, href=None, rel=None, mediaType=None, name=None, hreflang=None, height=None, width=None, preview=None, **kwargs)
¶
Represents a Link object in Activity Streams 2.0.
This class implements the Link type, which is used to represent a hyperlink to a resource. The Link object can contain various attributes that provide metadata about the link.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_context
|
Union[str, list]
|
The default value for @context. It can be a string or a list of strings. Defaults to "https://www.w3.org/ns/activitystreams". |
'https://www.w3.org/ns/activitystreams'
|
type
|
str
|
The type of the object. For this class, it is always "Link". Defaults to "Link". |
'Link'
|
id
|
Optional[str]
|
A unique identifier for the link object. This can be a URL or an IRI. Defaults to None. |
None
|
href
|
Optional[str]
|
The URL that the link points to. It must conform to the xsd:anyURI format. If provided, it must be a valid URI. Defaults to None. |
None
|
rel
|
Optional[list[str]]
|
A list of relationship types indicating the nature of the link with respect to the context of the link. Defaults to None. |
None
|
mediaType
|
Optional[str]
|
The media type of the linked resource, such as "image/jpeg". Defaults to None. |
None
|
name
|
Optional[str]
|
A human-readable name for the link. Defaults to None. |
None
|
hreflang
|
Optional[str]
|
The language of the linked resource, represented as a language tag. Defaults to None. |
None
|
height
|
Optional[int]
|
The height of the linked resource in pixels. Must be greater than or equal to 0. Defaults to None. |
None
|
width
|
Optional[int]
|
The width of the linked resource in pixels. Must be greater than or equal to 0. Defaults to None. |
None
|
preview
|
Optional[Union[Object, Link]]
|
A resource that provides a preview of the linked content, which could be another Link or an Object. Defaults to None. |
None
|
**kwargs
|
Additional properties that can be added to the Link object, allowing for extensibility. |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If |
Source code in libs/apmodel/src/apmodel/core.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 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 |
|
to_dict(_extras=None, build_context=True)
¶
Outputs the current object as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_extras
|
Optional[dict]
|
Arguments used internally. It is not recommended that users change them. |
None
|
build_context
|
bool
|
Do we automatically build @context based on the arguments? Defaults to False. |
True
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Objects converted to dictionaries |
Source code in libs/apmodel/src/apmodel/core.py
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 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
|
Object
¶
Source code in libs/apmodel/src/apmodel/core.py
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 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 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 285 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 |
|
__init__(_context='https://www.w3.org/ns/activitystreams', type='Object', id=None, attachment=[], attributedTo=None, audience=None, content=None, context=None, name=None, endTime=None, generator=None, icon=None, image=None, inReplyTo=None, location=None, preview=None, published=None, replies=None, startTime=None, summary=None, tag=None, updated=None, url=None, to=None, bto=None, cc=None, bcc=None, mediaType=None, duration=None, sensitive=None, **kwargs)
¶
Implements the "Object" primary base type of the ActivityStreams vocabulary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_context
|
Union[str, list]
|
The default value for @context. Defaults to "https://www.w3.org/ns/activitystreams". |
'https://www.w3.org/ns/activitystreams'
|
type
|
str
|
The name of the ActivityStreams type. Usually does not need to be changed. Defaults to "Object". |
'Object'
|
id
|
Optional[str]
|
The identifier for the object. Defaults to None. |
None
|
attachment
|
List[Union[Object, Link, dict]]
|
A list of resources attached to the object. Defaults to an empty list. |
[]
|
attributedTo
|
Optional[Union[Object, Link, str]]
|
The resource indicating the creator of this object. Defaults to None. |
None
|
audience
|
Optional[Union[Object, Link]]
|
The resource indicating the intended audience of this object. Defaults to None. |
None
|
content
|
Optional[str]
|
The text representing the content of the object. Defaults to None. |
None
|
context
|
Optional[Union[Object, Link]]
|
The resource indicating the context of the object. Defaults to None. |
None
|
name
|
Optional[str]
|
The name of the object. Defaults to None. |
None
|
endTime
|
Optional[str]
|
The end time of the event represented as an ISO8601 formatted string. Defaults to None. |
None
|
generator
|
Optional[Union[Object, Link]]
|
The resource indicating the application that generated the object. Defaults to None. |
None
|
icon
|
Optional[Union[Image, Link]]
|
The resource for the icon of the object. Defaults to None. |
None
|
image
|
Optional[Image]
|
The resource for the image of the object. Defaults to None. |
None
|
inReplyTo
|
Optional[Union[Image, Link]]
|
The resource indicating the target of this reply. Defaults to None. |
None
|
location
|
Optional[Union[Image, Link]]
|
The resource indicating the location of the object. Defaults to None. |
None
|
preview
|
Optional[Union[Object, Link]]
|
The resource for the preview of the object. Defaults to None. |
None
|
published
|
Optional[str]
|
The date and time when the object was published, represented as an ISO8601 formatted string. Defaults to None. |
None
|
replies
|
Optional[Collection]
|
A collection of replies to this object. Defaults to None. |
None
|
startTime
|
Optional[str]
|
The start time of the event represented as an ISO8601 formatted string. Defaults to None. |
None
|
summary
|
Optional[str]
|
A summary of the object. Defaults to None. |
None
|
tag
|
Optional[Union[Object, Link]]
|
The resource indicating tags related to the object. Defaults to None. |
None
|
updated
|
Optional[str]
|
The date and time when the object was last updated, represented as an ISO8601 formatted string. Defaults to None. |
None
|
url
|
Optional[Union[str, Link]]
|
The URL of the object. Defaults to None. |
None
|
to
|
Optional[Union[Object, Link]]
|
The resource indicating the recipient of the object. Defaults to None. |
None
|
bto
|
Optional[Union[Object, Link]]
|
The resource indicating BCC recipients. Defaults to None. |
None
|
cc
|
Optional[Union[Object, Link]]
|
The resource indicating CC recipients. Defaults to None. |
None
|
bcc
|
Optional[Union[Object, Link]]
|
The resource indicating BCC recipients. Defaults to None. |
None
|
mediaType
|
Optional[str]
|
The media type of the object. Defaults to None. |
None
|
duration
|
Optional[str]
|
A string representing the duration of the object. Defaults to None. |
None
|
sensitive
|
Optional[bool]
|
A flag indicating the sensitivity of the content. Defaults to None. |
None
|
Source code in libs/apmodel/src/apmodel/core.py
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 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
to_dict(_extras=None, build_context=True)
¶
Outputs the current object as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_extras
|
Optional[dict]
|
Arguments used internally. It is not recommended that users change them. |
None
|
build_context
|
bool
|
Do we automatically build @context based on the arguments? Defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Objects converted to dictionaries |
Source code in libs/apmodel/src/apmodel/core.py
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 285 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 |
|
StreamsLoader
¶
Source code in libs/apmodel/src/apmodel/loader.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
load(object, custom_mapper=fedi_mapper)
staticmethod
¶
convert json object to model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object
|
dict[Any, Any]
|
json object |
required |
custom_mapper
|
dict
|
Models available at the time of loading. Defaults to fedi_mapper. |
fedi_mapper
|
Returns:
Type | Description |
---|---|
Object | Link | Any | dict
|
Object | Link | dict | Any: An object converted from json. If there is no corresponding object, the dictionary type is returned. |
Source code in libs/apmodel/src/apmodel/loader.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
load(object, custom_mapper=fedi_mapper)
¶
convert json object to model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object
|
dict[Any, Any]
|
json object |
required |
custom_mapper
|
dict
|
Models available at the time of loading. Defaults to fedi_mapper. |
fedi_mapper
|
Returns:
Type | Description |
---|---|
Object | Link | dict | Any
|
Object | Link | dict | Any: An object converted from json. If there is no corresponding object, the dictionary type is returned. |
Source code in libs/apmodel/src/apmodel/loader.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
core
¶
Activity
¶
Bases: Object
Source code in libs/apmodel/src/apmodel/core.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
|
__init__(type='Activity', id=None, actor=None, object=None, target=None, result=None, origin=None, instrument=None, proof={}, **kwargs)
¶
Represents an Activity object in Activity Streams 2.0.
The Activity class is used to express an action or event that occurs in a social context. It encapsulates various properties that describe the activity, including the actor, the object acted upon, and other related entities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
type
|
str
|
The type of the object. For this class, it is always "Activity". Defaults to "Activity". |
'Activity'
|
id
|
Optional[str]
|
A unique identifier for the activity. If not provided, a UUID will be generated. Defaults to None. |
None
|
actor
|
Optional[Union[Object, Link, str, dict]]
|
The entity that is performing the activity. This can be an Object, a Link, a string representing an identifier, or a dictionary containing the entity's data. Defaults to None. |
None
|
object
|
Optional[Union[Object, dict]]
|
The object that is the target of the activity. This can be an Object or a dictionary. Defaults to None. |
None
|
target
|
Optional[Union[Object, Link]]
|
The entity that the activity is directed towards. This can be an Object or a Link. Defaults to None. |
None
|
result
|
Optional[Union[Object, Link]]
|
The result of the activity. This can be an Object or a Link that represents the outcome of the activity. Defaults to None. |
None
|
origin
|
Optional[Union[Object, Link]]
|
The source of the activity, indicating where it originated. This can be an Object or a Link. Defaults to None. |
None
|
instrument
|
Optional[Union[Object, Link]]
|
The tool or means used to perform the activity. This can be an Object or a Link. Defaults to None. |
None
|
proof
|
Union[DataIntegrityProof, dict]
|
A proof of the integrity of the activity data, represented as a DataIntegrityProof object or a dictionary. Defaults to an empty list. |
{}
|
**kwargs
|
Additional properties that can be added to the Activity object, allowing for extensibility. |
{}
|
Note
Other values are inherited from apmodel.Object.
Raises:
Type | Description |
---|---|
ValueError
|
If the proof is not a valid DataIntegrityProof object or dictionary. |
Source code in libs/apmodel/src/apmodel/core.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
|
to_dict(_extras=None)
¶
Outputs the current object as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_extras
|
Optional[dict]
|
Arguments used internally. It is not recommended that users change them. |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Objects converted to dictionaries |
Source code in libs/apmodel/src/apmodel/core.py
651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 |
|
Link
¶
Source code in libs/apmodel/src/apmodel/core.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 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 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
|
__init__(_context='https://www.w3.org/ns/activitystreams', type='Link', id=None, href=None, rel=None, mediaType=None, name=None, hreflang=None, height=None, width=None, preview=None, **kwargs)
¶
Represents a Link object in Activity Streams 2.0.
This class implements the Link type, which is used to represent a hyperlink to a resource. The Link object can contain various attributes that provide metadata about the link.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_context
|
Union[str, list]
|
The default value for @context. It can be a string or a list of strings. Defaults to "https://www.w3.org/ns/activitystreams". |
'https://www.w3.org/ns/activitystreams'
|
type
|
str
|
The type of the object. For this class, it is always "Link". Defaults to "Link". |
'Link'
|
id
|
Optional[str]
|
A unique identifier for the link object. This can be a URL or an IRI. Defaults to None. |
None
|
href
|
Optional[str]
|
The URL that the link points to. It must conform to the xsd:anyURI format. If provided, it must be a valid URI. Defaults to None. |
None
|
rel
|
Optional[list[str]]
|
A list of relationship types indicating the nature of the link with respect to the context of the link. Defaults to None. |
None
|
mediaType
|
Optional[str]
|
The media type of the linked resource, such as "image/jpeg". Defaults to None. |
None
|
name
|
Optional[str]
|
A human-readable name for the link. Defaults to None. |
None
|
hreflang
|
Optional[str]
|
The language of the linked resource, represented as a language tag. Defaults to None. |
None
|
height
|
Optional[int]
|
The height of the linked resource in pixels. Must be greater than or equal to 0. Defaults to None. |
None
|
width
|
Optional[int]
|
The width of the linked resource in pixels. Must be greater than or equal to 0. Defaults to None. |
None
|
preview
|
Optional[Union[Object, Link]]
|
A resource that provides a preview of the linked content, which could be another Link or an Object. Defaults to None. |
None
|
**kwargs
|
Additional properties that can be added to the Link object, allowing for extensibility. |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If |
Source code in libs/apmodel/src/apmodel/core.py
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 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 |
|
to_dict(_extras=None, build_context=True)
¶
Outputs the current object as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_extras
|
Optional[dict]
|
Arguments used internally. It is not recommended that users change them. |
None
|
build_context
|
bool
|
Do we automatically build @context based on the arguments? Defaults to False. |
True
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Objects converted to dictionaries |
Source code in libs/apmodel/src/apmodel/core.py
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 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
|
Object
¶
Source code in libs/apmodel/src/apmodel/core.py
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 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 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 285 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 |
|
__init__(_context='https://www.w3.org/ns/activitystreams', type='Object', id=None, attachment=[], attributedTo=None, audience=None, content=None, context=None, name=None, endTime=None, generator=None, icon=None, image=None, inReplyTo=None, location=None, preview=None, published=None, replies=None, startTime=None, summary=None, tag=None, updated=None, url=None, to=None, bto=None, cc=None, bcc=None, mediaType=None, duration=None, sensitive=None, **kwargs)
¶
Implements the "Object" primary base type of the ActivityStreams vocabulary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_context
|
Union[str, list]
|
The default value for @context. Defaults to "https://www.w3.org/ns/activitystreams". |
'https://www.w3.org/ns/activitystreams'
|
type
|
str
|
The name of the ActivityStreams type. Usually does not need to be changed. Defaults to "Object". |
'Object'
|
id
|
Optional[str]
|
The identifier for the object. Defaults to None. |
None
|
attachment
|
List[Union[Object, Link, dict]]
|
A list of resources attached to the object. Defaults to an empty list. |
[]
|
attributedTo
|
Optional[Union[Object, Link, str]]
|
The resource indicating the creator of this object. Defaults to None. |
None
|
audience
|
Optional[Union[Object, Link]]
|
The resource indicating the intended audience of this object. Defaults to None. |
None
|
content
|
Optional[str]
|
The text representing the content of the object. Defaults to None. |
None
|
context
|
Optional[Union[Object, Link]]
|
The resource indicating the context of the object. Defaults to None. |
None
|
name
|
Optional[str]
|
The name of the object. Defaults to None. |
None
|
endTime
|
Optional[str]
|
The end time of the event represented as an ISO8601 formatted string. Defaults to None. |
None
|
generator
|
Optional[Union[Object, Link]]
|
The resource indicating the application that generated the object. Defaults to None. |
None
|
icon
|
Optional[Union[Image, Link]]
|
The resource for the icon of the object. Defaults to None. |
None
|
image
|
Optional[Image]
|
The resource for the image of the object. Defaults to None. |
None
|
inReplyTo
|
Optional[Union[Image, Link]]
|
The resource indicating the target of this reply. Defaults to None. |
None
|
location
|
Optional[Union[Image, Link]]
|
The resource indicating the location of the object. Defaults to None. |
None
|
preview
|
Optional[Union[Object, Link]]
|
The resource for the preview of the object. Defaults to None. |
None
|
published
|
Optional[str]
|
The date and time when the object was published, represented as an ISO8601 formatted string. Defaults to None. |
None
|
replies
|
Optional[Collection]
|
A collection of replies to this object. Defaults to None. |
None
|
startTime
|
Optional[str]
|
The start time of the event represented as an ISO8601 formatted string. Defaults to None. |
None
|
summary
|
Optional[str]
|
A summary of the object. Defaults to None. |
None
|
tag
|
Optional[Union[Object, Link]]
|
The resource indicating tags related to the object. Defaults to None. |
None
|
updated
|
Optional[str]
|
The date and time when the object was last updated, represented as an ISO8601 formatted string. Defaults to None. |
None
|
url
|
Optional[Union[str, Link]]
|
The URL of the object. Defaults to None. |
None
|
to
|
Optional[Union[Object, Link]]
|
The resource indicating the recipient of the object. Defaults to None. |
None
|
bto
|
Optional[Union[Object, Link]]
|
The resource indicating BCC recipients. Defaults to None. |
None
|
cc
|
Optional[Union[Object, Link]]
|
The resource indicating CC recipients. Defaults to None. |
None
|
bcc
|
Optional[Union[Object, Link]]
|
The resource indicating BCC recipients. Defaults to None. |
None
|
mediaType
|
Optional[str]
|
The media type of the object. Defaults to None. |
None
|
duration
|
Optional[str]
|
A string representing the duration of the object. Defaults to None. |
None
|
sensitive
|
Optional[bool]
|
A flag indicating the sensitivity of the content. Defaults to None. |
None
|
Source code in libs/apmodel/src/apmodel/core.py
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 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 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 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
to_dict(_extras=None, build_context=True)
¶
Outputs the current object as a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_extras
|
Optional[dict]
|
Arguments used internally. It is not recommended that users change them. |
None
|
build_context
|
bool
|
Do we automatically build @context based on the arguments? Defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
dict |
Objects converted to dictionaries |
Source code in libs/apmodel/src/apmodel/core.py
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 285 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 |
|
loader
¶
StreamsLoader
¶
Source code in libs/apmodel/src/apmodel/loader.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
load(object, custom_mapper=fedi_mapper)
staticmethod
¶
convert json object to model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object
|
dict[Any, Any]
|
json object |
required |
custom_mapper
|
dict
|
Models available at the time of loading. Defaults to fedi_mapper. |
fedi_mapper
|
Returns:
Type | Description |
---|---|
Object | Link | Any | dict
|
Object | Link | dict | Any: An object converted from json. If there is no corresponding object, the dictionary type is returned. |
Source code in libs/apmodel/src/apmodel/loader.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
load(object, custom_mapper=fedi_mapper)
¶
convert json object to model
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object
|
dict[Any, Any]
|
json object |
required |
custom_mapper
|
dict
|
Models available at the time of loading. Defaults to fedi_mapper. |
fedi_mapper
|
Returns:
Type | Description |
---|---|
Object | Link | dict | Any
|
Object | Link | dict | Any: An object converted from json. If there is no corresponding object, the dictionary type is returned. |
Source code in libs/apmodel/src/apmodel/loader.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|