-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
1f65393
commit 0cb8c39
Showing
3 changed files
with
104 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
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,100 @@ | ||
# This file was auto-generated by Fern from our API Definition. | ||
|
||
import enum | ||
import typing | ||
|
||
T_Result = typing.TypeVar("T_Result") | ||
|
||
|
||
class OauthScope(str, enum.Enum): | ||
AUTHORIZED_USER_READ = "authorized_user:read" | ||
""" | ||
read details about the authorized user | ||
""" | ||
|
||
READ_PAGES = "read:pages" | ||
""" | ||
read pages on the site | ||
""" | ||
|
||
SITES_READ = "sites:read" | ||
""" | ||
read sites on the site | ||
""" | ||
|
||
SITES_WRITE = "sites:write" | ||
""" | ||
modify pages on the site | ||
""" | ||
|
||
CUSTOM_CODE_READ = "custom_code:read" | ||
""" | ||
read custom code on the site | ||
""" | ||
|
||
CUSTOM_CODE_WRITE = "custom_code:write" | ||
""" | ||
modify custom code on the site | ||
""" | ||
|
||
CUSTOM_CODE_DELETE = "custom_code:delete" | ||
""" | ||
delete custom code on the site | ||
""" | ||
|
||
USERS_READ = "users:read" | ||
""" | ||
read users on the site | ||
""" | ||
|
||
USERS_WRITE = "users:write" | ||
""" | ||
modify users on the site | ||
""" | ||
|
||
ECOMMERCE_READ = "ecommerce:read" | ||
""" | ||
read ecommerce data | ||
""" | ||
|
||
ECOMMERCE_WRITE = "ecommerce:write" | ||
""" | ||
edit ecommerce data | ||
""" | ||
|
||
def visit( | ||
self, | ||
authorized_user_read: typing.Callable[[], T_Result], | ||
read_pages: typing.Callable[[], T_Result], | ||
sites_read: typing.Callable[[], T_Result], | ||
sites_write: typing.Callable[[], T_Result], | ||
custom_code_read: typing.Callable[[], T_Result], | ||
custom_code_write: typing.Callable[[], T_Result], | ||
custom_code_delete: typing.Callable[[], T_Result], | ||
users_read: typing.Callable[[], T_Result], | ||
users_write: typing.Callable[[], T_Result], | ||
ecommerce_read: typing.Callable[[], T_Result], | ||
ecommerce_write: typing.Callable[[], T_Result], | ||
) -> T_Result: | ||
if self is OauthScope.AUTHORIZED_USER_READ: | ||
return authorized_user_read() | ||
if self is OauthScope.READ_PAGES: | ||
return read_pages() | ||
if self is OauthScope.SITES_READ: | ||
return sites_read() | ||
if self is OauthScope.SITES_WRITE: | ||
return sites_write() | ||
if self is OauthScope.CUSTOM_CODE_READ: | ||
return custom_code_read() | ||
if self is OauthScope.CUSTOM_CODE_WRITE: | ||
return custom_code_write() | ||
if self is OauthScope.CUSTOM_CODE_DELETE: | ||
return custom_code_delete() | ||
if self is OauthScope.USERS_READ: | ||
return users_read() | ||
if self is OauthScope.USERS_WRITE: | ||
return users_write() | ||
if self is OauthScope.ECOMMERCE_READ: | ||
return ecommerce_read() | ||
if self is OauthScope.ECOMMERCE_WRITE: | ||
return ecommerce_write() |