onepostly 0.1.0__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.
- onepostly/__init__.py +109 -0
- onepostly/requester.py +108 -0
- onepostly/resources/__init__.py +19 -0
- onepostly/resources/comments.py +53 -0
- onepostly/resources/connections.py +122 -0
- onepostly/resources/engagement.py +65 -0
- onepostly/resources/insights.py +28 -0
- onepostly/resources/media.py +26 -0
- onepostly/resources/posts.py +38 -0
- onepostly/resources/webhooks.py +48 -0
- onepostly/types.py +87 -0
- onepostly-0.1.0.dist-info/METADATA +115 -0
- onepostly-0.1.0.dist-info/RECORD +15 -0
- onepostly-0.1.0.dist-info/WHEEL +4 -0
- onepostly-0.1.0.dist-info/licenses/LICENSE +201 -0
onepostly/__init__.py
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""Official Onepostly Python SDK.
|
|
2
|
+
|
|
3
|
+
Example:
|
|
4
|
+
from onepostly import Onepostly
|
|
5
|
+
|
|
6
|
+
client = Onepostly(api_key=os.environ["ONEPOSTLY_API_KEY"])
|
|
7
|
+
|
|
8
|
+
client.posts.create(
|
|
9
|
+
text="Hello from Onepostly",
|
|
10
|
+
media_kind="text",
|
|
11
|
+
destinations=[{"connectionId": "..."}],
|
|
12
|
+
)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from typing import Any, Dict, Optional
|
|
18
|
+
|
|
19
|
+
from .requester import ConfigurationError, OnepostlyError, _Requester, is_insufficient_wallet
|
|
20
|
+
from .resources import (
|
|
21
|
+
CommentsResource,
|
|
22
|
+
ConnectionsResource,
|
|
23
|
+
EngagementResource,
|
|
24
|
+
InsightsResource,
|
|
25
|
+
MediaResource,
|
|
26
|
+
PostsResource,
|
|
27
|
+
WebhooksResource,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"Onepostly",
|
|
32
|
+
"OnepostlyError",
|
|
33
|
+
"ConfigurationError",
|
|
34
|
+
"is_insufficient_wallet",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
MEDIA_KINDS = ("text", "image", "multi-image", "video", "stories")
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class Onepostly:
|
|
41
|
+
"""Official Onepostly API client.
|
|
42
|
+
|
|
43
|
+
Args:
|
|
44
|
+
api_key: Workspace API key (``op_…``). Falls back to the
|
|
45
|
+
``ONEPOSTLY_API_KEY`` environment variable.
|
|
46
|
+
base_url: API base URL. Defaults to ``https://api.onepostly.com``.
|
|
47
|
+
timeout: Request timeout in seconds.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def __init__(
|
|
51
|
+
self,
|
|
52
|
+
api_key: Optional[str] = None,
|
|
53
|
+
*,
|
|
54
|
+
base_url: Optional[str] = None,
|
|
55
|
+
timeout: float = 60.0,
|
|
56
|
+
) -> None:
|
|
57
|
+
self._requester = _Requester(api_key, base_url=base_url, timeout=timeout)
|
|
58
|
+
self.connections = ConnectionsResource(self._requester)
|
|
59
|
+
self.media = MediaResource(self._requester)
|
|
60
|
+
self.posts = PostsResource(self._requester)
|
|
61
|
+
self.insights = InsightsResource(self._requester)
|
|
62
|
+
self.comments = CommentsResource(self._requester)
|
|
63
|
+
self.engagement = EngagementResource(self._requester)
|
|
64
|
+
self.webhooks = WebhooksResource(self._requester)
|
|
65
|
+
|
|
66
|
+
# ------------------------------------------------------------------
|
|
67
|
+
# Convenience wrapper: snake_case kwargs -> REST camelCase body
|
|
68
|
+
# ------------------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
def create_post(
|
|
71
|
+
self,
|
|
72
|
+
text: Optional[str] = None,
|
|
73
|
+
*,
|
|
74
|
+
destinations: List[Dict[str, Any]],
|
|
75
|
+
media_kind: str = "text",
|
|
76
|
+
media_urls: Optional[List[str]] = None,
|
|
77
|
+
thread: Optional[List[str]] = None,
|
|
78
|
+
scheduled_for: Optional[str] = None,
|
|
79
|
+
timezone: Optional[str] = None,
|
|
80
|
+
**extra: Any,
|
|
81
|
+
) -> Dict[str, Any]:
|
|
82
|
+
"""Create a post. Destination dicts use REST field names
|
|
83
|
+
(``connectionId``; camelCase) and may carry per-platform extras
|
|
84
|
+
such as ``boardId`` or ``privacyLevel``."""
|
|
85
|
+
body: Dict[str, Any] = {
|
|
86
|
+
"mediaKind": media_kind,
|
|
87
|
+
"destinations": destinations,
|
|
88
|
+
**extra,
|
|
89
|
+
}
|
|
90
|
+
if text is not None:
|
|
91
|
+
body["text"] = text
|
|
92
|
+
if media_urls is not None:
|
|
93
|
+
body["mediaUrls"] = media_urls
|
|
94
|
+
if thread is not None:
|
|
95
|
+
body["thread"] = thread
|
|
96
|
+
if scheduled_for is not None:
|
|
97
|
+
body["scheduledFor"] = scheduled_for
|
|
98
|
+
if timezone is not None:
|
|
99
|
+
body["timezone"] = timezone
|
|
100
|
+
return self.posts.create(body)
|
|
101
|
+
|
|
102
|
+
def close(self) -> None:
|
|
103
|
+
self._requester.close()
|
|
104
|
+
|
|
105
|
+
def __enter__(self) -> "Onepostly":
|
|
106
|
+
return self
|
|
107
|
+
|
|
108
|
+
def __exit__(self, *exc: Any) -> None:
|
|
109
|
+
self.close()
|
onepostly/requester.py
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""Core HTTP layer for the Onepostly client."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from typing import Any, Dict, Optional
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
DEFAULT_BASE_URL = "https://api.onepostly.com"
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ConfigurationError(Exception):
|
|
14
|
+
"""Raised when constructor options fail client-side validation."""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class OnepostlyError(Exception):
|
|
18
|
+
"""Raised for any non-2xx API response and for transport failures."""
|
|
19
|
+
|
|
20
|
+
def __init__(
|
|
21
|
+
self,
|
|
22
|
+
message: str,
|
|
23
|
+
*,
|
|
24
|
+
code: str,
|
|
25
|
+
status: Optional[int] = None,
|
|
26
|
+
body: Optional[Dict[str, Any]] = None,
|
|
27
|
+
cause: Optional[BaseException] = None,
|
|
28
|
+
) -> None:
|
|
29
|
+
super().__init__(message)
|
|
30
|
+
self.code = code
|
|
31
|
+
self.status = status
|
|
32
|
+
self.body = body
|
|
33
|
+
self.__cause__ = cause
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def is_insufficient_wallet(error: Any) -> bool:
|
|
37
|
+
"""True when the workspace wallet ran out mid-action (HTTP 402)."""
|
|
38
|
+
return isinstance(error, OnepostlyError) and error.status == 402
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class _Requester:
|
|
42
|
+
def __init__(
|
|
43
|
+
self,
|
|
44
|
+
api_key: Optional[str] = None,
|
|
45
|
+
base_url: Optional[str] = None,
|
|
46
|
+
timeout: float = 60.0,
|
|
47
|
+
) -> None:
|
|
48
|
+
key = api_key or os.environ.get("ONEPOSTLY_API_KEY")
|
|
49
|
+
if not key:
|
|
50
|
+
raise ConfigurationError(
|
|
51
|
+
"Missing API key. Pass api_key= or set the ONEPOSTLY_API_KEY environment variable."
|
|
52
|
+
)
|
|
53
|
+
self._api_key = key
|
|
54
|
+
self._base_url = (base_url or DEFAULT_BASE_URL).rstrip("/")
|
|
55
|
+
self._client = httpx.Client(
|
|
56
|
+
timeout=timeout,
|
|
57
|
+
headers={"x-api-key": key, "accept": "application/json"},
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
def request(
|
|
61
|
+
self,
|
|
62
|
+
method: str,
|
|
63
|
+
path: str,
|
|
64
|
+
*,
|
|
65
|
+
json_body: Any = None,
|
|
66
|
+
files: Optional[Any] = None,
|
|
67
|
+
params: Optional[Dict[str, Any]] = None,
|
|
68
|
+
) -> Any:
|
|
69
|
+
clean_params = {k: v for k, v in (params or {}).items() if v is not None}
|
|
70
|
+
try:
|
|
71
|
+
response = self._client.request(
|
|
72
|
+
method,
|
|
73
|
+
f"{self._base_url}{path}",
|
|
74
|
+
json=json_body,
|
|
75
|
+
files=files,
|
|
76
|
+
params=clean_params,
|
|
77
|
+
)
|
|
78
|
+
except httpx.HTTPError as error:
|
|
79
|
+
raise OnepostlyError(
|
|
80
|
+
"Could not reach the Onepostly API.",
|
|
81
|
+
code="NETWORK_ERROR",
|
|
82
|
+
cause=error,
|
|
83
|
+
) from error
|
|
84
|
+
|
|
85
|
+
if 200 <= response.status_code < 300:
|
|
86
|
+
if response.status_code == 204 or not response.content:
|
|
87
|
+
return None
|
|
88
|
+
return response.json()
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
payload = response.json()
|
|
92
|
+
except ValueError:
|
|
93
|
+
payload = None
|
|
94
|
+
error_body = payload if isinstance(payload, dict) and "error" in payload else None
|
|
95
|
+
message = (
|
|
96
|
+
error_body["error"].get("message")
|
|
97
|
+
if error_body
|
|
98
|
+
else f"Request failed with status {response.status_code}."
|
|
99
|
+
)
|
|
100
|
+
raise OnepostlyError(
|
|
101
|
+
message,
|
|
102
|
+
code=(error_body or {}).get("error", {}).get("code", "UNKNOWN_ERROR"),
|
|
103
|
+
status=response.status_code,
|
|
104
|
+
body=error_body,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
def close(self) -> None:
|
|
108
|
+
self._client.close()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Resource subpackage: one module per REST resource group."""
|
|
2
|
+
|
|
3
|
+
from .comments import CommentsResource
|
|
4
|
+
from .connections import ConnectionsResource
|
|
5
|
+
from .engagement import EngagementResource
|
|
6
|
+
from .insights import InsightsResource
|
|
7
|
+
from .media import MediaResource
|
|
8
|
+
from .posts import PostsResource
|
|
9
|
+
from .webhooks import WebhooksResource
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"CommentsResource",
|
|
13
|
+
"ConnectionsResource",
|
|
14
|
+
"EngagementResource",
|
|
15
|
+
"InsightsResource",
|
|
16
|
+
"MediaResource",
|
|
17
|
+
"PostsResource",
|
|
18
|
+
"WebhooksResource",
|
|
19
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Comments: list, reply, and delete own comments."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from ..requester import _Requester
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CommentsResource:
|
|
11
|
+
def __init__(self, request: _Requester) -> None:
|
|
12
|
+
self._request = request
|
|
13
|
+
|
|
14
|
+
def list(
|
|
15
|
+
self,
|
|
16
|
+
post_id: str,
|
|
17
|
+
*,
|
|
18
|
+
destination_id: Optional[str] = None,
|
|
19
|
+
limit: Optional[int] = None,
|
|
20
|
+
cursor: Optional[str] = None,
|
|
21
|
+
) -> Dict[str, Any]:
|
|
22
|
+
return self._request.request(
|
|
23
|
+
"GET",
|
|
24
|
+
f"/v1/posts/{post_id}/comments",
|
|
25
|
+
params={
|
|
26
|
+
"destinationId": destination_id,
|
|
27
|
+
"limit": limit,
|
|
28
|
+
"cursor": cursor,
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
def create(
|
|
33
|
+
self,
|
|
34
|
+
post_id: str,
|
|
35
|
+
*,
|
|
36
|
+
destination_id: str,
|
|
37
|
+
text: str,
|
|
38
|
+
parent_comment_id: Optional[str] = None,
|
|
39
|
+
) -> Dict[str, Any]:
|
|
40
|
+
body: Dict[str, Any] = {
|
|
41
|
+
"destinationId": destination_id,
|
|
42
|
+
"text": text,
|
|
43
|
+
}
|
|
44
|
+
if parent_comment_id is not None:
|
|
45
|
+
body["parentCommentId"] = parent_comment_id
|
|
46
|
+
return self._request.request(
|
|
47
|
+
"POST", f"/v1/posts/{post_id}/comments", json_body=body
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def delete(self, post_id: str, comment_id: str) -> None:
|
|
51
|
+
self._request.request(
|
|
52
|
+
"DELETE", f"/v1/posts/{post_id}/comments/{comment_id}"
|
|
53
|
+
)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""Connections: list connected accounts and manage per-connection resources."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from ..requester import _Requester
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ConnectionsResource:
|
|
11
|
+
def __init__(self, request: _Requester) -> None:
|
|
12
|
+
self._request = request
|
|
13
|
+
|
|
14
|
+
def list(self) -> Dict[str, Any]:
|
|
15
|
+
"""List every connected account in the workspace."""
|
|
16
|
+
return self._request.request("GET", "/v1/connections")
|
|
17
|
+
|
|
18
|
+
def stats(self, connection_id: str) -> Dict[str, Any]:
|
|
19
|
+
"""Platform account stats for one connection (followers, counts, ...)."""
|
|
20
|
+
return self._request.request(
|
|
21
|
+
"GET", f"/v1/connections/{connection_id}/stats"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
def media(
|
|
25
|
+
self,
|
|
26
|
+
connection_id: str,
|
|
27
|
+
*,
|
|
28
|
+
limit: Optional[int] = None,
|
|
29
|
+
cursor: Optional[str] = None,
|
|
30
|
+
) -> Dict[str, Any]:
|
|
31
|
+
"""Recent creator media for one connection (TikTok/Instagram)."""
|
|
32
|
+
return self._request.request(
|
|
33
|
+
"GET",
|
|
34
|
+
f"/v1/connections/{connection_id}/media",
|
|
35
|
+
params={"limit": limit, "cursor": cursor},
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
def tiktok_creator_info(self, connection_id: str) -> Dict[str, Any]:
|
|
39
|
+
"""TikTok creator privacy/interaction capabilities for one connection."""
|
|
40
|
+
return self._request.request(
|
|
41
|
+
"GET", f"/v1/connections/{connection_id}/tiktok/creator-info"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
def pinterest_boards(self, connection_id: str) -> Dict[str, Any]:
|
|
45
|
+
"""Boards of a Pinterest connection."""
|
|
46
|
+
return self._request.request(
|
|
47
|
+
"GET", f"/v1/connections/{connection_id}/pinterest/boards"
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def create_pinterest_board(
|
|
51
|
+
self, connection_id: str, *, name: str, description: Optional[str] = None
|
|
52
|
+
) -> Dict[str, Any]:
|
|
53
|
+
"""Create a board on a Pinterest connection."""
|
|
54
|
+
body: Dict[str, Any] = {"name": name}
|
|
55
|
+
if description is not None:
|
|
56
|
+
body["description"] = description
|
|
57
|
+
return self._request.request(
|
|
58
|
+
"POST",
|
|
59
|
+
f"/v1/connections/{connection_id}/pinterest/boards",
|
|
60
|
+
json_body=body,
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
def connect_bluesky(
|
|
64
|
+
self,
|
|
65
|
+
*,
|
|
66
|
+
identifier: str,
|
|
67
|
+
app_password: str,
|
|
68
|
+
reconnect_id: Optional[str] = None,
|
|
69
|
+
) -> Dict[str, Any]:
|
|
70
|
+
"""Connect a Bluesky account with an app password (no OAuth)."""
|
|
71
|
+
body: Dict[str, Any] = {
|
|
72
|
+
"identifier": identifier,
|
|
73
|
+
"appPassword": app_password,
|
|
74
|
+
}
|
|
75
|
+
if reconnect_id is not None:
|
|
76
|
+
body["reconnectId"] = reconnect_id
|
|
77
|
+
return self._request.request(
|
|
78
|
+
"POST", "/v1/connections/bluesky/connect", json_body=body
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
def start_oauth(
|
|
82
|
+
self,
|
|
83
|
+
platform: str,
|
|
84
|
+
*,
|
|
85
|
+
redirect_url: Optional[str] = None,
|
|
86
|
+
reconnect: Optional[str] = None,
|
|
87
|
+
) -> str:
|
|
88
|
+
"""Get a platform authorization URL. API keys must pass redirect_url."""
|
|
89
|
+
params = {k: v for k, v in {
|
|
90
|
+
"redirect_url": redirect_url,
|
|
91
|
+
"reconnect": reconnect,
|
|
92
|
+
}.items() if v is not None}
|
|
93
|
+
result = self._request.request(
|
|
94
|
+
"GET", f"/v1/connections/oauth/{platform}/start", params=params
|
|
95
|
+
)
|
|
96
|
+
return result["url"]
|
|
97
|
+
|
|
98
|
+
def facebook_pages(self, temp_token: str) -> Dict[str, Any]:
|
|
99
|
+
"""Facebook only: Pages available for a pending headless connect."""
|
|
100
|
+
return self._request.request(
|
|
101
|
+
"GET",
|
|
102
|
+
"/v1/connections/oauth/facebook/pages",
|
|
103
|
+
params={"tempToken": temp_token},
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
def select_facebook_page(
|
|
107
|
+
self,
|
|
108
|
+
*,
|
|
109
|
+
temp_token: str,
|
|
110
|
+
page_id: str,
|
|
111
|
+
redirect_url: Optional[str] = None,
|
|
112
|
+
) -> Dict[str, Any]:
|
|
113
|
+
"""Facebook only: finish a headless connect by selecting a Page."""
|
|
114
|
+
body: Dict[str, Any] = {
|
|
115
|
+
"tempToken": temp_token,
|
|
116
|
+
"pageId": page_id,
|
|
117
|
+
}
|
|
118
|
+
if redirect_url is not None:
|
|
119
|
+
body["redirect_url"] = redirect_url
|
|
120
|
+
return self._request.request(
|
|
121
|
+
"POST", "/v1/connections/oauth/facebook/select", json_body=body
|
|
122
|
+
)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Engagement (X): retweet, like, bookmark, and quote actions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from ..requester import _Requester
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class EngagementResource:
|
|
11
|
+
def __init__(self, request: _Requester) -> None:
|
|
12
|
+
self._request = request
|
|
13
|
+
|
|
14
|
+
def list_retweeters(
|
|
15
|
+
self,
|
|
16
|
+
post_id: str,
|
|
17
|
+
*,
|
|
18
|
+
destination_id: Optional[str] = None,
|
|
19
|
+
limit: Optional[int] = None,
|
|
20
|
+
cursor: Optional[str] = None,
|
|
21
|
+
) -> Dict[str, Any]:
|
|
22
|
+
return self._request.request(
|
|
23
|
+
"GET",
|
|
24
|
+
f"/v1/posts/{post_id}/retweets",
|
|
25
|
+
params={
|
|
26
|
+
"destinationId": destination_id,
|
|
27
|
+
"limit": limit,
|
|
28
|
+
"cursor": cursor,
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
def _action(self, path: str, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
33
|
+
return self._request.request(
|
|
34
|
+
"POST",
|
|
35
|
+
f"/v1/posts/{post_id}/{path}",
|
|
36
|
+
json_body={"destinationId": destination_id},
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def _undo(self, path: str, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
40
|
+
return self._request.request(
|
|
41
|
+
"DELETE",
|
|
42
|
+
f"/v1/posts/{post_id}/{path}",
|
|
43
|
+
params={"destinationId": destination_id},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def retweet(self, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
47
|
+
return self._action("retweets", post_id, destination_id)
|
|
48
|
+
|
|
49
|
+
def undo_retweet(self, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
50
|
+
return self._undo("retweets", post_id, destination_id)
|
|
51
|
+
|
|
52
|
+
def like(self, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
53
|
+
return self._action("likes", post_id, destination_id)
|
|
54
|
+
|
|
55
|
+
def unlike(self, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
56
|
+
return self._undo("likes", post_id, destination_id)
|
|
57
|
+
|
|
58
|
+
def bookmark(self, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
59
|
+
return self._action("bookmarks", post_id, destination_id)
|
|
60
|
+
|
|
61
|
+
def remove_bookmark(self, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
62
|
+
return self._undo("bookmarks", post_id, destination_id)
|
|
63
|
+
|
|
64
|
+
def quote(self, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
65
|
+
return self._action("quotes", post_id, destination_id)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Insights: normalized metrics and daily timelines per destination."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from ..requester import _Requester
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class InsightsResource:
|
|
11
|
+
def __init__(self, request: _Requester) -> None:
|
|
12
|
+
self._request = request
|
|
13
|
+
|
|
14
|
+
def get(self, post_id: str) -> Dict[str, Any]:
|
|
15
|
+
return self._request.request("GET", f"/v1/posts/{post_id}/insights")
|
|
16
|
+
|
|
17
|
+
def timeline(
|
|
18
|
+
self,
|
|
19
|
+
post_id: str,
|
|
20
|
+
*,
|
|
21
|
+
from_: Optional[str] = None,
|
|
22
|
+
to: Optional[str] = None,
|
|
23
|
+
) -> Dict[str, Any]:
|
|
24
|
+
"""Daily cumulative metrics per destination."""
|
|
25
|
+
params = {k: v for k, v in {"from": from_, "to": to}.items() if v is not None}
|
|
26
|
+
return self._request.request(
|
|
27
|
+
"GET", f"/v1/posts/{post_id}/insights/timeline", params=params
|
|
28
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Media: upload, list, and delete media assets."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from ..requester import _Requester
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MediaResource:
|
|
11
|
+
def __init__(self, request: _Requester) -> None:
|
|
12
|
+
self._request = request
|
|
13
|
+
|
|
14
|
+
def upload(self, file: Any, filename: str = "upload") -> Dict[str, Any]:
|
|
15
|
+
"""Upload a media asset (file-like object opened in binary mode)."""
|
|
16
|
+
return self._request.request(
|
|
17
|
+
"POST", "/v1/media", files={"file": (filename, file)}
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def list(self, *, limit: Optional[int] = None, offset: Optional[int] = None) -> Dict[str, Any]:
|
|
21
|
+
return self._request.request(
|
|
22
|
+
"GET", "/v1/media", params={"limit": limit, "offset": offset}
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
def delete(self, id: str) -> None:
|
|
26
|
+
self._request.request("DELETE", f"/v1/media/{id}")
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Posts: create, list, cancel, and remote-delete posts."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, List, Optional
|
|
6
|
+
|
|
7
|
+
from ..requester import _Requester
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _query(params: Dict[str, Any]) -> Dict[str, str]:
|
|
11
|
+
return {k: str(v) for k, v in params.items() if v is not None}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class PostsResource:
|
|
15
|
+
def __init__(self, request: _Requester) -> None:
|
|
16
|
+
self._request = request
|
|
17
|
+
|
|
18
|
+
def create(self, body: Dict[str, Any]) -> Dict[str, Any]:
|
|
19
|
+
"""Create a post for one or more destinations."""
|
|
20
|
+
return self._request.request("POST", "/v1/posts", json_body=body)
|
|
21
|
+
|
|
22
|
+
def list(self, *, limit: Optional[int] = None, offset: Optional[int] = None) -> Dict[str, Any]:
|
|
23
|
+
return self._request.request(
|
|
24
|
+
"GET", "/v1/posts", params={"limit": limit, "offset": offset}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
def get(self, id: str) -> Dict[str, Any]:
|
|
28
|
+
return self._request.request("GET", f"/v1/posts/{id}")
|
|
29
|
+
|
|
30
|
+
def cancel(self, id: str) -> Dict[str, Any]:
|
|
31
|
+
"""Cancel a queued/processing/scheduled post."""
|
|
32
|
+
return self._request.request("DELETE", f"/v1/posts/{id}")
|
|
33
|
+
|
|
34
|
+
def remote_delete(self, post_id: str, destination_id: str) -> Dict[str, Any]:
|
|
35
|
+
"""Delete a published post on the platform itself."""
|
|
36
|
+
return self._request.request(
|
|
37
|
+
"DELETE", f"/v1/posts/{post_id}/destinations/{destination_id}"
|
|
38
|
+
)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""Webhooks: manage endpoints and inspect deliveries."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from ..requester import _Requester
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WebhooksResource:
|
|
11
|
+
def __init__(self, request: _Requester) -> None:
|
|
12
|
+
self._request = request
|
|
13
|
+
|
|
14
|
+
def event_types(self) -> Dict[str, Any]:
|
|
15
|
+
"""List available event types with their group metadata."""
|
|
16
|
+
return self._request.request("GET", "/v1/webhooks/events")
|
|
17
|
+
|
|
18
|
+
def list(self) -> Dict[str, Any]:
|
|
19
|
+
return self._request.request("GET", "/v1/webhooks")
|
|
20
|
+
|
|
21
|
+
def get(self, id: str) -> Dict[str, Any]:
|
|
22
|
+
return self._request.request("GET", f"/v1/webhooks/{id}")
|
|
23
|
+
|
|
24
|
+
def create(self, body: Dict[str, Any]) -> Dict[str, Any]:
|
|
25
|
+
return self._request.request("POST", "/v1/webhooks", json_body=body)
|
|
26
|
+
|
|
27
|
+
def update(self, id: str, body: Dict[str, Any]) -> Dict[str, Any]:
|
|
28
|
+
return self._request.request("PATCH", f"/v1/webhooks/{id}", json_body=body)
|
|
29
|
+
|
|
30
|
+
def delete(self, id: str) -> None:
|
|
31
|
+
self._request.request("DELETE", f"/v1/webhooks/{id}")
|
|
32
|
+
|
|
33
|
+
def rotate_secret(self, id: str) -> Dict[str, Any]:
|
|
34
|
+
"""Regenerate the signing secret for an endpoint."""
|
|
35
|
+
return self._request.request("POST", f"/v1/webhooks/{id}/rotate-secret")
|
|
36
|
+
|
|
37
|
+
def deliveries(
|
|
38
|
+
self, id: str, *, limit: Optional[int] = None, offset: Optional[int] = None
|
|
39
|
+
) -> Dict[str, Any]:
|
|
40
|
+
return self._request.request(
|
|
41
|
+
"GET",
|
|
42
|
+
f"/v1/webhooks/{id}/deliveries",
|
|
43
|
+
params={"limit": limit, "offset": offset},
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
def test(self, id: str) -> Dict[str, Any]:
|
|
47
|
+
"""Send a test event to the endpoint."""
|
|
48
|
+
return self._request.request("POST", f"/v1/webhooks/{id}/test")
|
onepostly/types.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""Shared response shapes. Field names match the REST API (snake_case mirrors)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import List, Optional
|
|
6
|
+
|
|
7
|
+
from typing_extensions import TypedDict
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PostDestination(TypedDict):
|
|
11
|
+
id: str
|
|
12
|
+
connectionId: str
|
|
13
|
+
platform: str
|
|
14
|
+
status: str
|
|
15
|
+
externalPostId: Optional[str]
|
|
16
|
+
externalUrl: Optional[str]
|
|
17
|
+
errorCode: Optional[str]
|
|
18
|
+
errorMessage: Optional[str]
|
|
19
|
+
publishedAt: Optional[str]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class Post(TypedDict):
|
|
23
|
+
id: str
|
|
24
|
+
text: str
|
|
25
|
+
mediaUrls: List[str]
|
|
26
|
+
mediaKind: str
|
|
27
|
+
status: str
|
|
28
|
+
scheduledFor: Optional[str]
|
|
29
|
+
timezone: Optional[str]
|
|
30
|
+
destinations: List[PostDestination]
|
|
31
|
+
createdAt: str
|
|
32
|
+
updatedAt: str
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Connection(TypedDict, total=False):
|
|
36
|
+
id: str
|
|
37
|
+
platform: str
|
|
38
|
+
displayName: str
|
|
39
|
+
handle: str
|
|
40
|
+
avatarUrl: Optional[str]
|
|
41
|
+
status: str
|
|
42
|
+
authHealth: str
|
|
43
|
+
createdAt: str
|
|
44
|
+
updatedAt: str
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class NormalizedMetrics(TypedDict, total=False):
|
|
48
|
+
impressions: Optional[int]
|
|
49
|
+
reach: Optional[int]
|
|
50
|
+
likes: Optional[int]
|
|
51
|
+
comments: Optional[int]
|
|
52
|
+
shares: Optional[int]
|
|
53
|
+
saves: Optional[int]
|
|
54
|
+
plays: Optional[int]
|
|
55
|
+
engagement: Optional[float]
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class Actor(TypedDict, total=False):
|
|
59
|
+
id: str
|
|
60
|
+
username: Optional[str]
|
|
61
|
+
displayName: Optional[str]
|
|
62
|
+
avatarUrl: Optional[str]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class Comment(TypedDict, total=False):
|
|
66
|
+
id: str
|
|
67
|
+
text: str
|
|
68
|
+
username: Optional[str]
|
|
69
|
+
likeCount: Optional[int]
|
|
70
|
+
timestamp: Optional[str]
|
|
71
|
+
parentId: Optional[str]
|
|
72
|
+
replies: List["Comment"]
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class MediaItem(TypedDict, total=False):
|
|
76
|
+
id: str
|
|
77
|
+
url: str
|
|
78
|
+
contentType: str
|
|
79
|
+
sizeBytes: int
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class WebhookEndpoint(TypedDict, total=False):
|
|
83
|
+
id: str
|
|
84
|
+
name: str
|
|
85
|
+
url: str
|
|
86
|
+
enabled: bool
|
|
87
|
+
events: List[str]
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: onepostly
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official Python SDK for the Onepostly API. Publish, schedule, and read results across X, Instagram, LinkedIn, TikTok, YouTube, Facebook, Threads, Pinterest, and Bluesky with one request shape.
|
|
5
|
+
Project-URL: Homepage, https://onepostly.com
|
|
6
|
+
Author-email: Onepostly <enes@onepostly.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: api,bluesky,facebook,instagram,linkedin,onepostly,pinterest,sdk,social-media,threads,tiktok,twitter,x,youtube
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Requires-Dist: httpx>=0.24
|
|
22
|
+
Requires-Dist: typing-extensions>=4.5; python_version < '3.10'
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# onepostly
|
|
26
|
+
|
|
27
|
+
Official Python SDK for the [Onepostly API](https://onepostly.com/docs) — one client for X, Instagram, LinkedIn, TikTok, YouTube, Facebook, Threads, Pinterest, and Bluesky.
|
|
28
|
+
|
|
29
|
+
Python 3.9+. The only runtime dependency is `httpx`.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
pip install onepostly
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
import os
|
|
41
|
+
from onepostly import Onepostly
|
|
42
|
+
|
|
43
|
+
client = Onepostly(api_key=os.environ["ONEPOSTLY_API_KEY"])
|
|
44
|
+
|
|
45
|
+
result = client.create_post(
|
|
46
|
+
"Hello from Onepostly",
|
|
47
|
+
destinations=[{"connectionId": "…"}],
|
|
48
|
+
)
|
|
49
|
+
print(result["post"]["id"])
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The constructor also reads `ONEPOSTLY_API_KEY` from the environment when `api_key` is omitted. Resource methods use the REST field names (camelCase); the `create_post` convenience wrapper accepts snake_case kwargs.
|
|
53
|
+
|
|
54
|
+
### Scheduling
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
client.create_post(
|
|
58
|
+
"Tomorrow morning",
|
|
59
|
+
scheduled_for="2026-09-01T09:00:00", # timezone-naive local time
|
|
60
|
+
timezone="Europe/Istanbul",
|
|
61
|
+
destinations=[{"connectionId": "…"}],
|
|
62
|
+
)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Media
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
with open("photo.jpg", "rb") as f:
|
|
69
|
+
media = client.media.upload(f, filename="photo.jpg")["media"]
|
|
70
|
+
|
|
71
|
+
client.create_post(
|
|
72
|
+
"With an image",
|
|
73
|
+
media_kind="image",
|
|
74
|
+
media_urls=[media["url"]],
|
|
75
|
+
destinations=[{"connectionId": "…"}],
|
|
76
|
+
)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Insights
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
insights = client.insights.get(post_id)["insights"]
|
|
83
|
+
timeline = client.insights.timeline(post_id, from_="2026-08-01", to="2026-08-28")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Error handling
|
|
87
|
+
|
|
88
|
+
Every non-2xx response raises `OnepostlyError` carrying the API's machine-readable `code` and HTTP `status`:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from onepostly import OnepostlyError, is_insufficient_wallet
|
|
92
|
+
|
|
93
|
+
try:
|
|
94
|
+
client.create_post("Hello", destinations=[{"connectionId": "…"}])
|
|
95
|
+
except OnepostlyError as error:
|
|
96
|
+
if is_insufficient_wallet(error):
|
|
97
|
+
... # HTTP 402 — top up the workspace wallet
|
|
98
|
+
print(error.code, error.status, error.message)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## API reference
|
|
102
|
+
|
|
103
|
+
| Resource | Methods |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `client.posts` | `create` `list` `get` `cancel` `remote_delete` |
|
|
106
|
+
| `client.media` | `upload` `list` `delete` |
|
|
107
|
+
| `client.connections` | `list` `start_oauth` |
|
|
108
|
+
| `client.insights` | `get` `timeline` |
|
|
109
|
+
| `client.comments` | `list` `create` `delete` |
|
|
110
|
+
| `client.engagement` | `list_retweeters` `retweet` `undo_retweet` `like` `unlike` `bookmark` `remove_bookmark` `quote` |
|
|
111
|
+
| `client.webhooks` | `event_types` `list` `create` `update` `delete` `rotate_secret` `deliveries` `test` |
|
|
112
|
+
|
|
113
|
+
Full request/response reference: [onepostly.com/openapi.json](https://onepostly.com/openapi.json)
|
|
114
|
+
|
|
115
|
+
Runnable scripts live in [`examples/`](./examples). See [CONTRIBUTING.md](./CONTRIBUTING.md) for development and release flow.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
onepostly/__init__.py,sha256=Ba-Pzx5F0CaVgL0ZnNcmc21C6ny6P3g7yhLt16wLSLU,3321
|
|
2
|
+
onepostly/requester.py,sha256=yCd01ANfaze-xPkUlxrsOsl-ZhdZGDgHRUoGq5dsqFw,3210
|
|
3
|
+
onepostly/types.py,sha256=GNw2hkevw_aavSbHPbBA68MXiOZiVCVBNfB6e7Y79hA,1772
|
|
4
|
+
onepostly/resources/__init__.py,sha256=RCKpysvaSWj2mzhBVPtBdwj5UhZKCiKz9njtnygr58I,517
|
|
5
|
+
onepostly/resources/comments.py,sha256=0b5RwMat4wLAEVPEp5v4sjqwNmufzslyMD3vbszincQ,1432
|
|
6
|
+
onepostly/resources/connections.py,sha256=ZZjHp6qpZBgD2U26__biub-8ceWasdz0Qzu6FbE4cxc,4140
|
|
7
|
+
onepostly/resources/engagement.py,sha256=GG7c2t_Fwc24rr3favWhp1L1mwEkKV5f26ov05niitE,2272
|
|
8
|
+
onepostly/resources/insights.py,sha256=PGDYvmaPoYSEKIyii6Y3h6MyctUIjwmbSVtBSZj-QeE,852
|
|
9
|
+
onepostly/resources/media.py,sha256=jlux-bQjbRIJUe1B7A8q8P-PcbFxCkI_u4NpABLSRsA,863
|
|
10
|
+
onepostly/resources/posts.py,sha256=igpSQwZIlDmiYxsLHn-eoqC7wbWcZYP6c24zYvBF6OI,1378
|
|
11
|
+
onepostly/resources/webhooks.py,sha256=IQtNltHujGd_W8WDqMg_JBm2sHzCEeVqD1bOcQDQxEA,1736
|
|
12
|
+
onepostly-0.1.0.dist-info/METADATA,sha256=K2ldq4JxR2cfRhr-_PNX0Xgn97QDaSXbQOdUzVEbejQ,3812
|
|
13
|
+
onepostly-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
14
|
+
onepostly-0.1.0.dist-info/licenses/LICENSE,sha256=a8c6CY6K4T70jgDZKgPGNcteBwoYOLCPDNxFwecTUnM,11339
|
|
15
|
+
onepostly-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Onepostly
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|