crc-pulp-npm-client 20250819.1__py3-none-any.whl → 20250821.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of crc-pulp-npm-client might be problematic. Click here for more details.

Files changed (49) hide show
  1. crc-pulp_npm-client/api_client.py +1 -1
  2. crc-pulp_npm-client/configuration.py +3 -3
  3. {crc_pulp_npm_client-20250819.1.dist-info → crc_pulp_npm_client-20250821.1.dist-info}/METADATA +1 -1
  4. crc_pulp_npm_client-20250821.1.dist-info/RECORD +45 -0
  5. crc_pulp_npm_client-20250821.1.dist-info/top_level.txt +1 -0
  6. crc_pulp_npm_client-20250819.1.dist-info/RECORD +0 -86
  7. crc_pulp_npm_client-20250819.1.dist-info/top_level.txt +0 -2
  8. services-pulp_npm-client/__init__.py +0 -2
  9. services-pulp_npm-client/api/__init__.py +0 -9
  10. services-pulp_npm-client/api/content_packages_api.py +0 -1964
  11. services-pulp_npm-client/api/distributions_npm_api.py +0 -2934
  12. services-pulp_npm-client/api/remotes_npm_api.py +0 -2962
  13. services-pulp_npm-client/api/repositories_npm_api.py +0 -3604
  14. services-pulp_npm-client/api/repositories_npm_versions_api.py +0 -1670
  15. services-pulp_npm-client/api_client.py +0 -798
  16. services-pulp_npm-client/api_response.py +0 -21
  17. services-pulp_npm-client/configuration.py +0 -628
  18. services-pulp_npm-client/exceptions.py +0 -200
  19. services-pulp_npm-client/models/__init__.py +0 -44
  20. services-pulp_npm-client/models/async_operation_response.py +0 -88
  21. services-pulp_npm-client/models/content_summary_response.py +0 -92
  22. services-pulp_npm-client/models/npm_npm_distribution.py +0 -116
  23. services-pulp_npm-client/models/npm_npm_distribution_response.py +0 -140
  24. services-pulp_npm-client/models/npm_npm_remote.py +0 -205
  25. services-pulp_npm-client/models/npm_npm_remote_response.py +0 -199
  26. services-pulp_npm-client/models/npm_npm_remote_response_hidden_fields_inner.py +0 -90
  27. services-pulp_npm-client/models/npm_npm_repository.py +0 -112
  28. services-pulp_npm-client/models/npm_npm_repository_response.py +0 -137
  29. services-pulp_npm-client/models/npm_package_response.py +0 -113
  30. services-pulp_npm-client/models/paginated_repository_version_response_list.py +0 -112
  31. services-pulp_npm-client/models/paginatednpm_npm_distribution_response_list.py +0 -112
  32. services-pulp_npm-client/models/paginatednpm_npm_remote_response_list.py +0 -112
  33. services-pulp_npm-client/models/paginatednpm_npm_repository_response_list.py +0 -112
  34. services-pulp_npm-client/models/paginatednpm_package_response_list.py +0 -112
  35. services-pulp_npm-client/models/patchednpm_npm_distribution.py +0 -116
  36. services-pulp_npm-client/models/patchednpm_npm_remote.py +0 -205
  37. services-pulp_npm-client/models/patchednpm_npm_repository.py +0 -112
  38. services-pulp_npm-client/models/policy_enum.py +0 -39
  39. services-pulp_npm-client/models/repair.py +0 -88
  40. services-pulp_npm-client/models/repository_add_remove_content.py +0 -93
  41. services-pulp_npm-client/models/repository_sync_url.py +0 -90
  42. services-pulp_npm-client/models/repository_version_response.py +0 -121
  43. services-pulp_npm-client/models/set_label.py +0 -103
  44. services-pulp_npm-client/models/set_label_response.py +0 -103
  45. services-pulp_npm-client/models/unset_label.py +0 -96
  46. services-pulp_npm-client/models/unset_label_response.py +0 -100
  47. services-pulp_npm-client/py.typed +0 -0
  48. services-pulp_npm-client/rest.py +0 -258
  49. {crc_pulp_npm_client-20250819.1.dist-info → crc_pulp_npm_client-20250821.1.dist-info}/WHEEL +0 -0
@@ -1,137 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from datetime import datetime
22
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
23
- from typing import Any, ClassVar, Dict, List, Optional
24
- from typing_extensions import Annotated
25
- from typing import Optional, Set
26
- from typing_extensions import Self
27
-
28
- class NpmNpmRepositoryResponse(BaseModel):
29
- """
30
- A Serializer for NpmRepository. Add any new fields if defined on NpmRepository. Similar to the example above, in PackageSerializer. Additional validators can be added to the parent validators list For example:: class Meta: validators = core_serializers.RepositorySerializer.Meta.validators + [myValidator1, ...]
31
- """ # noqa: E501
32
- pulp_href: Optional[StrictStr] = None
33
- prn: Optional[StrictStr] = Field(default=None, description="The Pulp Resource Name (PRN).")
34
- pulp_created: Optional[datetime] = Field(default=None, description="Timestamp of creation.")
35
- pulp_last_updated: Optional[datetime] = Field(default=None, description="Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.")
36
- versions_href: Optional[StrictStr] = None
37
- pulp_labels: Optional[Dict[str, Optional[StrictStr]]] = None
38
- latest_version_href: Optional[StrictStr] = None
39
- name: StrictStr = Field(description="A unique name for this repository.")
40
- description: Optional[StrictStr] = Field(default=None, description="An optional description.")
41
- retain_repo_versions: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Retain X versions of the repository. Default is null which retains all versions.")
42
- remote: Optional[StrictStr] = Field(default=None, description="An optional remote to use by default when syncing.")
43
- __properties: ClassVar[List[str]] = ["pulp_href", "prn", "pulp_created", "pulp_last_updated", "versions_href", "pulp_labels", "latest_version_href", "name", "description", "retain_repo_versions", "remote"]
44
-
45
- model_config = ConfigDict(
46
- populate_by_name=True,
47
- validate_assignment=True,
48
- protected_namespaces=(),
49
- )
50
-
51
-
52
- def to_str(self) -> str:
53
- """Returns the string representation of the model using alias"""
54
- return pprint.pformat(self.model_dump(by_alias=True))
55
-
56
- def to_json(self) -> str:
57
- """Returns the JSON representation of the model using alias"""
58
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
- return json.dumps(self.to_dict())
60
-
61
- @classmethod
62
- def from_json(cls, json_str: str) -> Optional[Self]:
63
- """Create an instance of NpmNpmRepositoryResponse from a JSON string"""
64
- return cls.from_dict(json.loads(json_str))
65
-
66
- def to_dict(self) -> Dict[str, Any]:
67
- """Return the dictionary representation of the model using alias.
68
-
69
- This has the following differences from calling pydantic's
70
- `self.model_dump(by_alias=True)`:
71
-
72
- * `None` is only added to the output dict for nullable fields that
73
- were set at model initialization. Other fields with value `None`
74
- are ignored.
75
- * OpenAPI `readOnly` fields are excluded.
76
- * OpenAPI `readOnly` fields are excluded.
77
- * OpenAPI `readOnly` fields are excluded.
78
- * OpenAPI `readOnly` fields are excluded.
79
- * OpenAPI `readOnly` fields are excluded.
80
- * OpenAPI `readOnly` fields are excluded.
81
- """
82
- excluded_fields: Set[str] = set([
83
- "pulp_href",
84
- "prn",
85
- "pulp_created",
86
- "pulp_last_updated",
87
- "versions_href",
88
- "latest_version_href",
89
- ])
90
-
91
- _dict = self.model_dump(
92
- by_alias=True,
93
- exclude=excluded_fields,
94
- exclude_none=True,
95
- )
96
- # set to None if description (nullable) is None
97
- # and model_fields_set contains the field
98
- if self.description is None and "description" in self.model_fields_set:
99
- _dict['description'] = None
100
-
101
- # set to None if retain_repo_versions (nullable) is None
102
- # and model_fields_set contains the field
103
- if self.retain_repo_versions is None and "retain_repo_versions" in self.model_fields_set:
104
- _dict['retain_repo_versions'] = None
105
-
106
- # set to None if remote (nullable) is None
107
- # and model_fields_set contains the field
108
- if self.remote is None and "remote" in self.model_fields_set:
109
- _dict['remote'] = None
110
-
111
- return _dict
112
-
113
- @classmethod
114
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
115
- """Create an instance of NpmNpmRepositoryResponse from a dict"""
116
- if obj is None:
117
- return None
118
-
119
- if not isinstance(obj, dict):
120
- return cls.model_validate(obj)
121
-
122
- _obj = cls.model_validate({
123
- "pulp_href": obj.get("pulp_href"),
124
- "prn": obj.get("prn"),
125
- "pulp_created": obj.get("pulp_created"),
126
- "pulp_last_updated": obj.get("pulp_last_updated"),
127
- "versions_href": obj.get("versions_href"),
128
- "pulp_labels": obj.get("pulp_labels"),
129
- "latest_version_href": obj.get("latest_version_href"),
130
- "name": obj.get("name"),
131
- "description": obj.get("description"),
132
- "retain_repo_versions": obj.get("retain_repo_versions"),
133
- "remote": obj.get("remote")
134
- })
135
- return _obj
136
-
137
-
@@ -1,113 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from datetime import datetime
22
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
23
- from typing import Any, ClassVar, Dict, List, Optional
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class NpmPackageResponse(BaseModel):
28
- """
29
- A Serializer for Package. Add serializers for the new fields defined in Package and add those fields to the Meta class keeping fields from the parent class as well. For example:: field1 = serializers.TextField() field2 = serializers.IntegerField() field3 = serializers.CharField() class Meta: fields = core_serializers.SingleArtifactContentSerializer.Meta.fields + ( 'field1', 'field2', 'field3' ) model = models.Package
30
- """ # noqa: E501
31
- pulp_href: Optional[StrictStr] = None
32
- prn: Optional[StrictStr] = Field(default=None, description="The Pulp Resource Name (PRN).")
33
- pulp_created: Optional[datetime] = Field(default=None, description="Timestamp of creation.")
34
- pulp_last_updated: Optional[datetime] = Field(default=None, description="Timestamp of the last time this resource was updated. Note: for immutable resources - like content, repository versions, and publication - pulp_created and pulp_last_updated dates will be the same.")
35
- pulp_labels: Optional[Dict[str, Optional[StrictStr]]] = Field(default=None, description="A dictionary of arbitrary key/value pairs used to describe a specific Content instance.")
36
- artifact: Optional[StrictStr] = Field(default=None, description="Artifact file representing the physical content")
37
- relative_path: StrictStr
38
- name: StrictStr
39
- version: StrictStr
40
- __properties: ClassVar[List[str]] = ["pulp_href", "prn", "pulp_created", "pulp_last_updated", "pulp_labels", "artifact", "relative_path", "name", "version"]
41
-
42
- model_config = ConfigDict(
43
- populate_by_name=True,
44
- validate_assignment=True,
45
- protected_namespaces=(),
46
- )
47
-
48
-
49
- def to_str(self) -> str:
50
- """Returns the string representation of the model using alias"""
51
- return pprint.pformat(self.model_dump(by_alias=True))
52
-
53
- def to_json(self) -> str:
54
- """Returns the JSON representation of the model using alias"""
55
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
- return json.dumps(self.to_dict())
57
-
58
- @classmethod
59
- def from_json(cls, json_str: str) -> Optional[Self]:
60
- """Create an instance of NpmPackageResponse from a JSON string"""
61
- return cls.from_dict(json.loads(json_str))
62
-
63
- def to_dict(self) -> Dict[str, Any]:
64
- """Return the dictionary representation of the model using alias.
65
-
66
- This has the following differences from calling pydantic's
67
- `self.model_dump(by_alias=True)`:
68
-
69
- * `None` is only added to the output dict for nullable fields that
70
- were set at model initialization. Other fields with value `None`
71
- are ignored.
72
- * OpenAPI `readOnly` fields are excluded.
73
- * OpenAPI `readOnly` fields are excluded.
74
- * OpenAPI `readOnly` fields are excluded.
75
- * OpenAPI `readOnly` fields are excluded.
76
- """
77
- excluded_fields: Set[str] = set([
78
- "pulp_href",
79
- "prn",
80
- "pulp_created",
81
- "pulp_last_updated",
82
- ])
83
-
84
- _dict = self.model_dump(
85
- by_alias=True,
86
- exclude=excluded_fields,
87
- exclude_none=True,
88
- )
89
- return _dict
90
-
91
- @classmethod
92
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
- """Create an instance of NpmPackageResponse from a dict"""
94
- if obj is None:
95
- return None
96
-
97
- if not isinstance(obj, dict):
98
- return cls.model_validate(obj)
99
-
100
- _obj = cls.model_validate({
101
- "pulp_href": obj.get("pulp_href"),
102
- "prn": obj.get("prn"),
103
- "pulp_created": obj.get("pulp_created"),
104
- "pulp_last_updated": obj.get("pulp_last_updated"),
105
- "pulp_labels": obj.get("pulp_labels"),
106
- "artifact": obj.get("artifact"),
107
- "relative_path": obj.get("relative_path"),
108
- "name": obj.get("name"),
109
- "version": obj.get("version")
110
- })
111
- return _obj
112
-
113
-
@@ -1,112 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from services-pulp_npm-client.models.repository_version_response import RepositoryVersionResponse
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class PaginatedRepositoryVersionResponseList(BaseModel):
28
- """
29
- PaginatedRepositoryVersionResponseList
30
- """ # noqa: E501
31
- count: StrictInt
32
- next: Optional[StrictStr] = None
33
- previous: Optional[StrictStr] = None
34
- results: List[RepositoryVersionResponse]
35
- __properties: ClassVar[List[str]] = ["count", "next", "previous", "results"]
36
-
37
- model_config = ConfigDict(
38
- populate_by_name=True,
39
- validate_assignment=True,
40
- protected_namespaces=(),
41
- )
42
-
43
-
44
- def to_str(self) -> str:
45
- """Returns the string representation of the model using alias"""
46
- return pprint.pformat(self.model_dump(by_alias=True))
47
-
48
- def to_json(self) -> str:
49
- """Returns the JSON representation of the model using alias"""
50
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
- return json.dumps(self.to_dict())
52
-
53
- @classmethod
54
- def from_json(cls, json_str: str) -> Optional[Self]:
55
- """Create an instance of PaginatedRepositoryVersionResponseList from a JSON string"""
56
- return cls.from_dict(json.loads(json_str))
57
-
58
- def to_dict(self) -> Dict[str, Any]:
59
- """Return the dictionary representation of the model using alias.
60
-
61
- This has the following differences from calling pydantic's
62
- `self.model_dump(by_alias=True)`:
63
-
64
- * `None` is only added to the output dict for nullable fields that
65
- were set at model initialization. Other fields with value `None`
66
- are ignored.
67
- """
68
- excluded_fields: Set[str] = set([
69
- ])
70
-
71
- _dict = self.model_dump(
72
- by_alias=True,
73
- exclude=excluded_fields,
74
- exclude_none=True,
75
- )
76
- # override the default output from pydantic by calling `to_dict()` of each item in results (list)
77
- _items = []
78
- if self.results:
79
- for _item_results in self.results:
80
- if _item_results:
81
- _items.append(_item_results.to_dict())
82
- _dict['results'] = _items
83
- # set to None if next (nullable) is None
84
- # and model_fields_set contains the field
85
- if self.next is None and "next" in self.model_fields_set:
86
- _dict['next'] = None
87
-
88
- # set to None if previous (nullable) is None
89
- # and model_fields_set contains the field
90
- if self.previous is None and "previous" in self.model_fields_set:
91
- _dict['previous'] = None
92
-
93
- return _dict
94
-
95
- @classmethod
96
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
- """Create an instance of PaginatedRepositoryVersionResponseList from a dict"""
98
- if obj is None:
99
- return None
100
-
101
- if not isinstance(obj, dict):
102
- return cls.model_validate(obj)
103
-
104
- _obj = cls.model_validate({
105
- "count": obj.get("count"),
106
- "next": obj.get("next"),
107
- "previous": obj.get("previous"),
108
- "results": [RepositoryVersionResponse.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
109
- })
110
- return _obj
111
-
112
-
@@ -1,112 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from services-pulp_npm-client.models.npm_npm_distribution_response import NpmNpmDistributionResponse
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class PaginatednpmNpmDistributionResponseList(BaseModel):
28
- """
29
- PaginatednpmNpmDistributionResponseList
30
- """ # noqa: E501
31
- count: StrictInt
32
- next: Optional[StrictStr] = None
33
- previous: Optional[StrictStr] = None
34
- results: List[NpmNpmDistributionResponse]
35
- __properties: ClassVar[List[str]] = ["count", "next", "previous", "results"]
36
-
37
- model_config = ConfigDict(
38
- populate_by_name=True,
39
- validate_assignment=True,
40
- protected_namespaces=(),
41
- )
42
-
43
-
44
- def to_str(self) -> str:
45
- """Returns the string representation of the model using alias"""
46
- return pprint.pformat(self.model_dump(by_alias=True))
47
-
48
- def to_json(self) -> str:
49
- """Returns the JSON representation of the model using alias"""
50
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
- return json.dumps(self.to_dict())
52
-
53
- @classmethod
54
- def from_json(cls, json_str: str) -> Optional[Self]:
55
- """Create an instance of PaginatednpmNpmDistributionResponseList from a JSON string"""
56
- return cls.from_dict(json.loads(json_str))
57
-
58
- def to_dict(self) -> Dict[str, Any]:
59
- """Return the dictionary representation of the model using alias.
60
-
61
- This has the following differences from calling pydantic's
62
- `self.model_dump(by_alias=True)`:
63
-
64
- * `None` is only added to the output dict for nullable fields that
65
- were set at model initialization. Other fields with value `None`
66
- are ignored.
67
- """
68
- excluded_fields: Set[str] = set([
69
- ])
70
-
71
- _dict = self.model_dump(
72
- by_alias=True,
73
- exclude=excluded_fields,
74
- exclude_none=True,
75
- )
76
- # override the default output from pydantic by calling `to_dict()` of each item in results (list)
77
- _items = []
78
- if self.results:
79
- for _item_results in self.results:
80
- if _item_results:
81
- _items.append(_item_results.to_dict())
82
- _dict['results'] = _items
83
- # set to None if next (nullable) is None
84
- # and model_fields_set contains the field
85
- if self.next is None and "next" in self.model_fields_set:
86
- _dict['next'] = None
87
-
88
- # set to None if previous (nullable) is None
89
- # and model_fields_set contains the field
90
- if self.previous is None and "previous" in self.model_fields_set:
91
- _dict['previous'] = None
92
-
93
- return _dict
94
-
95
- @classmethod
96
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
- """Create an instance of PaginatednpmNpmDistributionResponseList from a dict"""
98
- if obj is None:
99
- return None
100
-
101
- if not isinstance(obj, dict):
102
- return cls.model_validate(obj)
103
-
104
- _obj = cls.model_validate({
105
- "count": obj.get("count"),
106
- "next": obj.get("next"),
107
- "previous": obj.get("previous"),
108
- "results": [NpmNpmDistributionResponse.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
109
- })
110
- return _obj
111
-
112
-
@@ -1,112 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Pulp 3 API
5
-
6
- Fetch, Upload, Organize, and Distribute Software Packages
7
-
8
- The version of the OpenAPI document: v3
9
- Contact: pulp-list@redhat.com
10
- Generated by OpenAPI Generator (https://openapi-generator.tech)
11
-
12
- Do not edit the class manually.
13
- """ # noqa: E501
14
-
15
-
16
- from __future__ import annotations
17
- import pprint
18
- import re # noqa: F401
19
- import json
20
-
21
- from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr
22
- from typing import Any, ClassVar, Dict, List, Optional
23
- from services-pulp_npm-client.models.npm_npm_remote_response import NpmNpmRemoteResponse
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
- class PaginatednpmNpmRemoteResponseList(BaseModel):
28
- """
29
- PaginatednpmNpmRemoteResponseList
30
- """ # noqa: E501
31
- count: StrictInt
32
- next: Optional[StrictStr] = None
33
- previous: Optional[StrictStr] = None
34
- results: List[NpmNpmRemoteResponse]
35
- __properties: ClassVar[List[str]] = ["count", "next", "previous", "results"]
36
-
37
- model_config = ConfigDict(
38
- populate_by_name=True,
39
- validate_assignment=True,
40
- protected_namespaces=(),
41
- )
42
-
43
-
44
- def to_str(self) -> str:
45
- """Returns the string representation of the model using alias"""
46
- return pprint.pformat(self.model_dump(by_alias=True))
47
-
48
- def to_json(self) -> str:
49
- """Returns the JSON representation of the model using alias"""
50
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
- return json.dumps(self.to_dict())
52
-
53
- @classmethod
54
- def from_json(cls, json_str: str) -> Optional[Self]:
55
- """Create an instance of PaginatednpmNpmRemoteResponseList from a JSON string"""
56
- return cls.from_dict(json.loads(json_str))
57
-
58
- def to_dict(self) -> Dict[str, Any]:
59
- """Return the dictionary representation of the model using alias.
60
-
61
- This has the following differences from calling pydantic's
62
- `self.model_dump(by_alias=True)`:
63
-
64
- * `None` is only added to the output dict for nullable fields that
65
- were set at model initialization. Other fields with value `None`
66
- are ignored.
67
- """
68
- excluded_fields: Set[str] = set([
69
- ])
70
-
71
- _dict = self.model_dump(
72
- by_alias=True,
73
- exclude=excluded_fields,
74
- exclude_none=True,
75
- )
76
- # override the default output from pydantic by calling `to_dict()` of each item in results (list)
77
- _items = []
78
- if self.results:
79
- for _item_results in self.results:
80
- if _item_results:
81
- _items.append(_item_results.to_dict())
82
- _dict['results'] = _items
83
- # set to None if next (nullable) is None
84
- # and model_fields_set contains the field
85
- if self.next is None and "next" in self.model_fields_set:
86
- _dict['next'] = None
87
-
88
- # set to None if previous (nullable) is None
89
- # and model_fields_set contains the field
90
- if self.previous is None and "previous" in self.model_fields_set:
91
- _dict['previous'] = None
92
-
93
- return _dict
94
-
95
- @classmethod
96
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
97
- """Create an instance of PaginatednpmNpmRemoteResponseList from a dict"""
98
- if obj is None:
99
- return None
100
-
101
- if not isinstance(obj, dict):
102
- return cls.model_validate(obj)
103
-
104
- _obj = cls.model_validate({
105
- "count": obj.get("count"),
106
- "next": obj.get("next"),
107
- "previous": obj.get("previous"),
108
- "results": [NpmNpmRemoteResponse.from_dict(_item) for _item in obj["results"]] if obj.get("results") is not None else None
109
- })
110
- return _obj
111
-
112
-