1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// Generated by tools/service-contracts/rust.py. Do not edit.
#![doc = "Transport-independent service interface for local and remote calls."]
use async_trait::async_trait;
use spiral_contract::auth::AuthHeader;
use spiral_contract::call::CallError;
use crate::api::organization::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait OrganizationApi: Send + Sync + 'static {
/// Create an Organization for the authenticated user. Existing Organization membership prevents
/// creating another.
async fn create_organization(
&self,
auth_header: AuthHeader,
request: CreateOrganizationRequest,
) -> Result<CreateOrganizationResponse, CallError<OrganizationError>>;
/// Open an account administration setting with Organization configure permission.
async fn create_portal_link(
&self,
auth_header: AuthHeader,
request: PortalLinkRequest,
) -> Result<PortalLink, CallError<OrganizationError>>;
/// Deactivate a membership with manage-users permission. The last owner cannot be deactivated.
async fn deactivate_member(
&self,
auth_header: AuthHeader,
user_id: String,
) -> Result<(), CallError<OrganizationError>>;
/// Deactivate an Organization with platform administer permission.
async fn deactivate_organization(
&self,
auth_header: AuthHeader,
organization_id: String,
) -> Result<(), CallError<OrganizationError>>;
/// Invite a user to the active Organization with invite permission.
async fn invite_member(
&self,
auth_header: AuthHeader,
request: InviteMemberRequest,
) -> Result<InvitationResponse, CallError<OrganizationError>>;
/// List the active Organization invitations with invite permission. Page size defaults to 10
/// and must be 1..=100.
async fn list_invitations(
&self,
auth_header: AuthHeader,
request: ListMembersRequest,
) -> Result<InvitationPage, CallError<OrganizationError>>;
/// List the active Organization members with list-users permission. Each page reauthorizes the
/// caller.
async fn list_members(
&self,
auth_header: AuthHeader,
request: ListMembersRequest,
) -> Result<MemberPage, CallError<OrganizationError>>;
/// List the authenticated user memberships in ascending Organization ID order. Requires a
/// first-party user credential.
async fn list_memberships(
&self,
auth_header: AuthHeader,
request: ListMembershipsRequest,
) -> Result<MembershipPage, CallError<OrganizationError>>;
/// List Organization records in ascending ID order with platform administer permission.
async fn list_organizations(
&self,
auth_header: AuthHeader,
request: ListOrganizationsRequest,
) -> Result<OrganizationPage, CallError<OrganizationError>>;
/// Reactivate an Organization with platform administer permission.
async fn reactivate_organization(
&self,
auth_header: AuthHeader,
organization_id: String,
) -> Result<(), CallError<OrganizationError>>;
/// Read the active Organization storage default with Organization configure permission.
async fn read_config(
&self,
auth_header: AuthHeader,
) -> Result<OrganizationConfig, CallError<OrganizationError>>;
/// Read the authenticated user identity and active Organization. Workload, service and
/// delegated credentials are refused.
async fn read_identity(
&self,
auth_header: AuthHeader,
) -> Result<Identity, CallError<OrganizationError>>;
/// Resend an invitation owned by the active Organization with invite permission.
async fn resend_invitation(
&self,
auth_header: AuthHeader,
invitation_id: String,
) -> Result<InvitationResponse, CallError<OrganizationError>>;
/// Revoke an invitation owned by the active Organization with invite permission.
async fn revoke_invitation(
&self,
auth_header: AuthHeader,
invitation_id: String,
) -> Result<(), CallError<OrganizationError>>;
/// Set a member role with manage-users permission. The last owner cannot be demoted.
async fn set_member_role(
&self,
auth_header: AuthHeader,
user_id: String,
request: SetMemberRoleRequest,
) -> Result<(), CallError<OrganizationError>>;
/// Synchronize one provider page of memberships for the specified Organization with platform
/// administer permission. Only active memberships are stored; an empty result can still have a
/// continuation. Page size defaults to 10 and must be 1..=100.
async fn sync_memberships(
&self,
auth_header: AuthHeader,
organization_id: String,
request: ListMembersRequest,
) -> Result<MembershipPage, CallError<OrganizationError>>;
/// Synchronize one live provider page with platform administer permission. Page size defaults
/// to 10 and must be 1..=100. Repeat with the continuation until absent.
async fn sync_organizations(
&self,
auth_header: AuthHeader,
request: ListMembersRequest,
) -> Result<OrganizationIdPage, CallError<OrganizationError>>;
/// Set the active Organization storage default with Organization configure permission.
/// Plaintext storage keys are vaulted before persistence.
async fn write_config(
&self,
auth_header: AuthHeader,
request: OrganizationConfig,
) -> Result<OrganizationConfig, CallError<OrganizationError>>;
}