Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FGA-73] Add FGA support #324

Merged
merged 9 commits into from
Aug 9, 2024
Merged

[FGA-73] Add FGA support #324

merged 9 commits into from
Aug 9, 2024

Conversation

atainter
Copy link
Contributor

@atainter atainter commented Aug 7, 2024

Description

Adding support for FGA APIs

Adds the following methods to an FGA submodule in the SDK:

    def get_resource(self, resource_type: str, resource_id: str) -> Resource: ...

    def list_resources(
        self,
        resource_type: Optional[str] = None,
        search: Optional[str] = None,
        limit: int = DEFAULT_RESPONSE_LIMIT,
        order: PaginationOrder = Order.Desc.value,
        before: Optional[str] = None,
        after: Optional[str] = None,
    ) -> ResourceListResource: ...

    def create_resource(
        self,
        resource_type: str,
        resource_id: str,
        meta: Dict[str, Any],
    ) -> Resource: ...

    def update_resource(
        self,
        resource_type: str,
        resource_id: str,
        meta: Dict[str, Any],
    ) -> Resource: ...

    def delete_resource(self, resource_type: str, resource_id: str) -> None: ...

    def list_resource_types(
        self,
        limit: int = DEFAULT_RESPONSE_LIMIT,
        order: PaginationOrder = Order.Desc.value,
        before: Optional[str] = None,
        after: Optional[str] = None,
    ) -> WorkOsListResource[ResourceType, ListArgs, ListMetadata]: ...

    def list_warrants(
        self,
        resource_type: Optional[str] = None,
        resource_id: Optional[str] = None,
        relation: Optional[str] = None,
        subject_type: Optional[str] = None,
        subject_id: Optional[str] = None,
        subject_relation: Optional[str] = None,
        limit: int = DEFAULT_RESPONSE_LIMIT,
        order: PaginationOrder = Order.Desc.value,
        before: Optional[str] = None,
        after: Optional[str] = None,
        warrant_token: Optional[str] = None,
    ) -> WorkOsListResource[Warrant, WarrantListFilters, ListMetadata]: ...

    def write_warrant(
        self,
        op: WarrantWriteOperation,
        resource_type: str,
        resource_id: str,
        relation: str,
        subject_type: str,
        subject_id: str,
        subject_relation: Optional[str] = None,
        policy: Optional[str] = None,
    ) -> WriteWarrantResponse: ...

    def batch_write_warrants(
        self, batch: List[WarrantWrite]
    ) -> WriteWarrantResponse: ...

    def check(
        self,
        checks: List[WarrantCheck],
        op: Optional[CheckOperation] = None,
        debug: bool = False,
        warrant_token: Optional[str] = None,
    ) -> CheckResponse: ...

Remaining endpoints will be added in a future PR.

@atainter atainter added enhancement New feature or request in progress labels Aug 7, 2024
Copy link

linear bot commented Aug 7, 2024

FGA-73 Python FGA SDK

@atainter atainter marked this pull request as ready for review August 8, 2024 18:27
@atainter atainter requested a review from a team as a code owner August 8, 2024 18:27
@atainter atainter requested review from cadef and removed request for a team August 8, 2024 18:27
Copy link
Contributor

@mattgd mattgd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a few minor comments, but looks good!

workos/types/fga/resource_types.py Show resolved Hide resolved
workos/fga.py Outdated Show resolved Hide resolved
workos/fga.py Outdated Show resolved Hide resolved
tests/test_fga.py Outdated Show resolved Hide resolved
@atainter atainter merged commit 68ccae5 into beta-5.0 Aug 9, 2024
5 checks passed
@atainter atainter deleted the feature/fga-73-fga-support branch August 9, 2024 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants