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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// 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::apps::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait AppsApi: Send + Sync + 'static {
/// Approve the latest request of an installation. Only an Organization owner can approve. The
/// Application must have a background identity.
async fn approve_installation(
&self,
auth_header: AuthHeader,
installation_id: String,
) -> Result<Installation, CallError<AppsError>>;
/// Create an active Application in a Project. The service generates the client ID of the
/// Application. Only a Project administrator can create an Application.
async fn create_application(
&self,
auth_header: AuthHeader,
project_id: String,
request: ApplicationConfiguration,
) -> Result<Application, CallError<AppsError>>;
/// Decide this user authorization. Required installation access must be active before approval.
/// Return the browser to redirectTo to complete OAuth.
async fn decide_consent(
&self,
auth_header: AuthHeader,
challenge: String,
request: ConsentDecision,
) -> Result<ConsentRedirect, CallError<AppsError>>;
/// Permanently delete an Application and uninstall it from every Organization. Only a Project
/// administrator can delete an Application. When the response is `RegistrationUnavailable`,
/// send the same request again. Access tokens that were issued before the deletion stay valid
/// until they expire.
async fn delete_application(
&self,
auth_header: AuthHeader,
application_id: String,
) -> Result<Application, CallError<AppsError>>;
/// Read an Application. A viewer of the Application's Project can read it.
async fn get_application(
&self,
auth_header: AuthHeader,
application_id: String,
) -> Result<Application, CallError<AppsError>>;
/// Read the authorization bound to the authenticated first-party user and Organization.
async fn get_consent_request(
&self,
auth_header: AuthHeader,
challenge: String,
) -> Result<ConsentRequest, CallError<AppsError>>;
/// Requires an installation token. Returns current metadata even when suspended; this does not
/// grant project access.
async fn get_current_installation(
&self,
auth_header: AuthHeader,
) -> Result<InstallationDetails, CallError<AppsError>>;
/// Requires an Organization member. Shows a public Application, an Application owned by the
/// Organization, or one already installed there. Does not grant access or permit viewing the
/// developer's credentials or callbacks.
async fn get_installable_application(
&self,
auth_header: AuthHeader,
application_id: String,
) -> Result<InstallableApplication, CallError<AppsError>>;
/// Read an installation in your Organization. Any member of the Organization can read it.
async fn get_installation(
&self,
auth_header: AuthHeader,
installation_id: String,
) -> Result<Installation, CallError<AppsError>>;
/// Read which Applications and MCP clients the users of your Organization can sign in to. Only
/// an Organization owner can read it.
async fn get_organization_app_access(
&self,
auth_header: AuthHeader,
) -> Result<OrganizationAppAccess, CallError<AppsError>>;
/// Requires an app token obtained with private-key client authentication or a trusted issuer
/// JWT-bearer exchange. It grants no customer data access.
async fn get_self(&self, auth_header: AuthHeader) -> Result<Application, CallError<AppsError>>;
/// Requires an app token. Installations belonging to another app return NotFound.
async fn get_self_installation(
&self,
auth_header: AuthHeader,
installation_id: String,
) -> Result<InstallationDetails, CallError<AppsError>>;
/// Requires a delegated user token with projects:read and current Organization membership. The
/// app and Organization come from the credential.
async fn get_user_installation(
&self,
auth_header: AuthHeader,
) -> Result<UserInstallation, CallError<AppsError>>;
/// List the Organizations where your Application is installed. A viewer of the Application's
/// Project can list them.
async fn list_application_installations(
&self,
auth_header: AuthHeader,
application_id: String,
request: ListApplicationsRequest,
) -> Result<InstallationPage, CallError<AppsError>>;
/// List the Applications of a Project. The list includes suspended and deleted Applications. A
/// Project viewer can list them.
async fn list_applications(
&self,
auth_header: AuthHeader,
project_id: String,
request: ListApplicationsRequest,
) -> Result<ApplicationPage, CallError<AppsError>>;
/// Requires an installation token and approved projects:read. Returns only currently authorized
/// live projects. Pending or inactive grants return no projects.
async fn list_installation_projects(
&self,
auth_header: AuthHeader,
request: ListApplicationsRequest,
) -> Result<InstallationProjectPage, CallError<AppsError>>;
/// List the installations in your Organization. Any member of the Organization can list them.
async fn list_installations(
&self,
auth_header: AuthHeader,
request: ListApplicationsRequest,
) -> Result<InstallationPage, CallError<AppsError>>;
/// List the resource scopes that an Application can request. Each scope has a description that
/// you can show to users.
async fn list_scopes(
&self,
auth_header: AuthHeader,
) -> Result<ApplicationScopes, CallError<AppsError>>;
/// Requires an app token. Includes only this app's requested, active and suspended
/// installations.
async fn list_self_installations(
&self,
auth_header: AuthHeader,
request: ListApplicationsRequest,
) -> Result<InstallationPage, CallError<AppsError>>;
/// Requires a delegated user token with projects:read. The installation must belong to its app
/// and Organization. Returns the intersection of current user and approved installation project
/// access.
async fn list_user_installation_projects(
&self,
auth_header: AuthHeader,
installation_id: String,
request: ListApplicationsRequest,
) -> Result<InstallationProjectPage, CallError<AppsError>>;
/// Replace the configuration of an Application. The Application stays in its Project. Only a
/// Project administrator can update an Application. When the response is
/// `RegistrationUnavailable`, the Application does not change; send the same request again.
async fn put_application(
&self,
auth_header: AuthHeader,
application_id: String,
request: ApplicationConfiguration,
) -> Result<Application, CallError<AppsError>>;
/// Replace which Applications and MCP clients the users of your Organization can sign in to.
/// Only an Organization owner can set it. Sign-in and refresh apply the new setting from their
/// next request.
async fn put_organization_app_access(
&self,
auth_header: AuthHeader,
request: OrganizationAppAccess,
) -> Result<OrganizationAppAccess, CallError<AppsError>>;
/// Request that an Application be installed in your Organization, or request more scopes or
/// Projects for an existing installation. Any member of the Organization can send a request.
/// The scopes must be registered on the Application. Until an owner approves the request, the
/// installation keeps its earlier approval.
async fn request_installation(
&self,
auth_header: AuthHeader,
request: InstallationRequest,
) -> Result<Installation, CallError<AppsError>>;
/// Only an Organization owner can approve or decline the displayed request. Returns Conflict if
/// it changed. Declining an update preserves current access; declining a new installation
/// removes it. The response describes the reviewed installation.
async fn review_installation(
&self,
auth_header: AuthHeader,
installation_id: String,
request: InstallationReview,
) -> Result<Installation, CallError<AppsError>>;
/// Suspend or resume an approved installation. Only an Organization owner can change it. A
/// suspended installation stops at its next request, even with an unexpired token.
async fn set_installation_status(
&self,
auth_header: AuthHeader,
installation_id: String,
request: InstallationStatusChange,
) -> Result<Installation, CallError<AppsError>>;
/// Remove an installation and all of its access. Only an Organization owner can uninstall.
/// Tokens that were already issued stop working at their next request.
async fn uninstall(
&self,
auth_header: AuthHeader,
installation_id: String,
) -> Result<Installation, CallError<AppsError>>;
}