-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import warnings | ||
|
||
from .base import ObjectBase | ||
from ..error import ClosedBetaWarning | ||
|
||
|
||
class ClientLink(ObjectBase): | ||
|
||
def __init__(self, data, client): | ||
warnings.warn( | ||
"The Client Links API is in closed beta and only available to " | ||
"selected partners. Please contact your partner manager if you " | ||
"want to implement this.", | ||
ClosedBetaWarning, | ||
) | ||
super().__init__(data, client) | ||
|
||
@classmethod | ||
def get_object_name(cls): | ||
return "client_links" | ||
|
||
# Documented properties | ||
|
||
@property | ||
def resource(self): | ||
return self._get_property("resource") | ||
|
||
@property | ||
def id(self): | ||
return self._get_property("id") | ||
|
||
# documented _links | ||
|
||
@property | ||
def link(self): | ||
return self._get_link("self") | ||
|
||
@property | ||
def client_link(self): | ||
return self._get_link("clientLink") | ||
|
||
@property | ||
def documentation_link(self): | ||
return self._get_link("documentation") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import Any, Optional, Dict | ||
|
||
from ..error import RequestSetupError | ||
from ..objects.client_link import ClientLink | ||
from .base import ResourceCreateMixin | ||
|
||
__all__ = [ | ||
"ClientLinks", | ||
] | ||
|
||
|
||
class ClientLinks(ResourceCreateMixin): | ||
"""Resource handler for the `/client-links` endpoint.""" | ||
|
||
RESOURCE_ID_PREFIX: str = "cl_" | ||
object_type = ClientLink | ||
|
||
def get_resource_path(self) -> str: | ||
return "client-links" | ||
|
||
def create(self, data: Optional[Dict[str, Any]] = None, idempotency_key: str = "", **params: Any) -> ClientLink: | ||
if not hasattr(self, "_oauth_client"): | ||
raise RequestSetupError("Creating client links requires OAuth authorization.") | ||
return super().create(data, idempotency_key, **params) |