1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-06 05:42:30 +03:00
Files
authentication-service/frontend/schema.graphql
Quentin Gliech f67cc0d6d0 Frontend cleanups
Mainly:

 - better handling of GraphQL errors
 - better logout state
 - dependencies update
 - a way to end browser sessions in the GraphQL API
2023-06-20 16:53:53 +02:00

986 lines
16 KiB
GraphQL

"""
The input for the `addEmail` mutation
"""
input AddEmailInput {
"""
The email address to add
"""
email: String!
"""
The ID of the user to add the email address to
"""
userId: ID!
}
"""
The payload of the `addEmail` mutation
"""
type AddEmailPayload {
"""
Status of the operation
"""
status: AddEmailStatus!
"""
The email address that was added
"""
email: UserEmail
"""
The user to whom the email address was added
"""
user: User
}
"""
The status of the `addEmail` mutation
"""
enum AddEmailStatus {
"""
The email address was added
"""
ADDED
"""
The email address already exists
"""
EXISTS
"""
The email address is invalid
"""
INVALID
}
type Anonymous implements Node {
id: ID!
}
"""
An authentication records when a user enter their credential in a browser
session.
"""
type Authentication implements Node & CreationEvent {
"""
ID of the object.
"""
id: ID!
"""
When the object was created.
"""
createdAt: DateTime!
}
"""
A browser session represents a logged in user in a browser.
"""
type BrowserSession implements Node & CreationEvent {
"""
ID of the object.
"""
id: ID!
"""
The user logged in this session.
"""
user: User!
"""
The most recent authentication of this session.
"""
lastAuthentication: Authentication
"""
When the object was created.
"""
createdAt: DateTime!
}
type BrowserSessionConnection {
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
A list of edges.
"""
edges: [BrowserSessionEdge!]!
"""
A list of nodes.
"""
nodes: [BrowserSession!]!
}
"""
An edge in a connection.
"""
type BrowserSessionEdge {
"""
The item at the end of the edge
"""
node: BrowserSession!
"""
A cursor for use in pagination
"""
cursor: String!
}
"""
A compat session represents a client session which used the legacy Matrix
login API.
"""
type CompatSession implements Node & CreationEvent {
"""
ID of the object.
"""
id: ID!
"""
The user authorized for this session.
"""
user: User!
"""
The Matrix Device ID of this session.
"""
deviceId: String!
"""
When the object was created.
"""
createdAt: DateTime!
"""
When the session ended.
"""
finishedAt: DateTime
}
"""
A compat SSO login represents a login done through the legacy Matrix login
API, via the `m.login.sso` login method.
"""
type CompatSsoLogin implements Node {
"""
ID of the object.
"""
id: ID!
"""
When the object was created.
"""
createdAt: DateTime!
"""
The redirect URI used during the login.
"""
redirectUri: Url!
"""
When the login was fulfilled, and the user was redirected back to the
client.
"""
fulfilledAt: DateTime
"""
When the client exchanged the login token sent during the redirection.
"""
exchangedAt: DateTime
"""
The compat session which was started by this login.
"""
session: CompatSession
}
type CompatSsoLoginConnection {
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
A list of edges.
"""
edges: [CompatSsoLoginEdge!]!
"""
A list of nodes.
"""
nodes: [CompatSsoLogin!]!
}
"""
An edge in a connection.
"""
type CompatSsoLoginEdge {
"""
The item at the end of the edge
"""
node: CompatSsoLogin!
"""
A cursor for use in pagination
"""
cursor: String!
}
"""
An object with a creation date.
"""
interface CreationEvent {
"""
When the object was created.
"""
createdAt: DateTime!
}
"""
Implement the DateTime<Utc> scalar
The input/output is a string in RFC3339 format.
"""
scalar DateTime
"""
The input of the `endBrowserSession` mutation.
"""
input EndBrowserSessionInput {
"""
The ID of the session to end.
"""
browserSessionId: ID!
}
type EndBrowserSessionPayload {
"""
The status of the mutation.
"""
status: EndBrowserSessionStatus!
"""
Returns the ended session.
"""
browserSession: BrowserSession
}
"""
The status of the `endBrowserSession` mutation.
"""
enum EndBrowserSessionStatus {
"""
The session was ended.
"""
ENDED
"""
The session was not found.
"""
NOT_FOUND
}
"""
The input of the `endCompatSession` mutation.
"""
input EndCompatSessionInput {
"""
The ID of the session to end.
"""
compatSessionId: ID!
}
type EndCompatSessionPayload {
"""
The status of the mutation.
"""
status: EndCompatSessionStatus!
"""
Returns the ended session.
"""
compatSession: CompatSession
}
"""
The status of the `endCompatSession` mutation.
"""
enum EndCompatSessionStatus {
"""
The session was ended.
"""
ENDED
"""
The session was not found.
"""
NOT_FOUND
}
"""
The input of the `endOauth2Session` mutation.
"""
input EndOAuth2SessionInput {
"""
The ID of the session to end.
"""
oauth2SessionId: ID!
}
type EndOAuth2SessionPayload {
"""
The status of the mutation.
"""
status: EndOAuth2SessionStatus!
"""
Returns the ended session.
"""
oauth2Session: Oauth2Session
}
"""
The status of the `endOauth2Session` mutation.
"""
enum EndOAuth2SessionStatus {
"""
The session was ended.
"""
ENDED
"""
The session was not found.
"""
NOT_FOUND
}
type MatrixUser {
"""
The Matrix ID of the user.
"""
mxid: String!
"""
The display name of the user, if any.
"""
displayName: String
"""
The avatar URL of the user, if any.
"""
avatarUrl: String
}
"""
The mutations root of the GraphQL interface.
"""
type Mutation {
"""
Add an email address to the specified user
"""
addEmail(input: AddEmailInput!): AddEmailPayload!
"""
Send a verification code for an email address
"""
sendVerificationEmail(
input: SendVerificationEmailInput!
): SendVerificationEmailPayload!
"""
Submit a verification code for an email address
"""
verifyEmail(input: VerifyEmailInput!): VerifyEmailPayload!
"""
Remove an email address
"""
removeEmail(input: RemoveEmailInput!): RemoveEmailPayload!
"""
Set an email address as primary
"""
setPrimaryEmail(input: SetPrimaryEmailInput!): SetPrimaryEmailPayload!
endOauth2Session(input: EndOAuth2SessionInput!): EndOAuth2SessionPayload!
endCompatSession(input: EndCompatSessionInput!): EndCompatSessionPayload!
endBrowserSession(input: EndBrowserSessionInput!): EndBrowserSessionPayload!
}
"""
An object with an ID.
"""
interface Node {
"""
ID of the object.
"""
id: ID!
}
"""
An OAuth 2.0 client
"""
type Oauth2Client implements Node {
"""
ID of the object.
"""
id: ID!
"""
OAuth 2.0 client ID
"""
clientId: String!
"""
Client name advertised by the client.
"""
clientName: String
"""
Client URI advertised by the client.
"""
clientUri: Url
"""
Terms of services URI advertised by the client.
"""
tosUri: Url
"""
Privacy policy URI advertised by the client.
"""
policyUri: Url
"""
List of redirect URIs used for authorization grants by the client.
"""
redirectUris: [Url!]!
}
"""
An OAuth 2.0 session represents a client session which used the OAuth APIs
to login.
"""
type Oauth2Session implements Node & CreationEvent {
"""
ID of the object.
"""
id: ID!
"""
OAuth 2.0 client used by this session.
"""
client: Oauth2Client!
"""
Scope granted for this session.
"""
scope: String!
"""
When the object was created.
"""
createdAt: DateTime!
"""
When the session ended.
"""
finishedAt: DateTime
"""
The browser session which started this OAuth 2.0 session.
"""
browserSession: BrowserSession!
"""
User authorized for this session.
"""
user: User!
}
type Oauth2SessionConnection {
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
A list of edges.
"""
edges: [Oauth2SessionEdge!]!
"""
A list of nodes.
"""
nodes: [Oauth2Session!]!
}
"""
An edge in a connection.
"""
type Oauth2SessionEdge {
"""
The item at the end of the edge
"""
node: Oauth2Session!
"""
A cursor for use in pagination
"""
cursor: String!
}
"""
Information about pagination in a connection
"""
type PageInfo {
"""
When paginating backwards, are there more items?
"""
hasPreviousPage: Boolean!
"""
When paginating forwards, are there more items?
"""
hasNextPage: Boolean!
"""
When paginating backwards, the cursor to continue.
"""
startCursor: String
"""
When paginating forwards, the cursor to continue.
"""
endCursor: String
}
"""
The query root of the GraphQL interface.
"""
type Query {
"""
Get the current logged in browser session
"""
currentBrowserSession: BrowserSession
@deprecated(reason: "Use `viewerSession` instead.")
"""
Get the current logged in user
"""
currentUser: User @deprecated(reason: "Use `viewer` instead.")
"""
Fetch an OAuth 2.0 client by its ID.
"""
oauth2Client(id: ID!): Oauth2Client
"""
Fetch a user by its ID.
"""
user(id: ID!): User
"""
Fetch a browser session by its ID.
"""
browserSession(id: ID!): BrowserSession
"""
Fetch a user email by its ID.
"""
userEmail(id: ID!): UserEmail
"""
Fetches an object given its ID.
"""
node(id: ID!): Node
"""
Fetch an upstream OAuth 2.0 link by its ID.
"""
upstreamOauth2Link(id: ID!): UpstreamOAuth2Link
"""
Fetch an upstream OAuth 2.0 provider by its ID.
"""
upstreamOauth2Provider(id: ID!): UpstreamOAuth2Provider
"""
Get a list of upstream OAuth 2.0 providers.
"""
upstreamOauth2Providers(
after: String
before: String
first: Int
last: Int
): UpstreamOAuth2ProviderConnection!
"""
Get the viewer
"""
viewer: Viewer!
"""
Get the viewer's session
"""
viewerSession: ViewerSession!
}
"""
The input for the `removeEmail` mutation
"""
input RemoveEmailInput {
"""
The ID of the email address to remove
"""
userEmailId: ID!
}
"""
The payload of the `removeEmail` mutation
"""
type RemoveEmailPayload {
"""
Status of the operation
"""
status: RemoveEmailStatus!
"""
The email address that was removed
"""
email: UserEmail
"""
The user to whom the email address belonged
"""
user: User
}
"""
The status of the `removeEmail` mutation
"""
enum RemoveEmailStatus {
"""
The email address was removed
"""
REMOVED
"""
Can't remove the primary email address
"""
PRIMARY
"""
The email address was not found
"""
NOT_FOUND
}
"""
The input for the `sendVerificationEmail` mutation
"""
input SendVerificationEmailInput {
"""
The ID of the email address to verify
"""
userEmailId: ID!
}
"""
The payload of the `sendVerificationEmail` mutation
"""
type SendVerificationEmailPayload {
"""
Status of the operation
"""
status: SendVerificationEmailStatus!
"""
The email address to which the verification email was sent
"""
email: UserEmail!
"""
The user to whom the email address belongs
"""
user: User!
}
"""
The status of the `sendVerificationEmail` mutation
"""
enum SendVerificationEmailStatus {
"""
The verification email was sent
"""
SENT
"""
The email address is already verified
"""
ALREADY_VERIFIED
}
"""
The input for the `setPrimaryEmail` mutation
"""
input SetPrimaryEmailInput {
"""
The ID of the email address to set as primary
"""
userEmailId: ID!
}
"""
The payload of the `setPrimaryEmail` mutation
"""
type SetPrimaryEmailPayload {
status: SetPrimaryEmailStatus!
"""
The user to whom the email address belongs
"""
user: User
}
"""
The status of the `setPrimaryEmail` mutation
"""
enum SetPrimaryEmailStatus {
"""
The email address was set as primary
"""
SET
"""
The email address was not found
"""
NOT_FOUND
"""
Can't make an unverified email address primary
"""
UNVERIFIED
}
type UpstreamOAuth2Link implements Node & CreationEvent {
"""
ID of the object.
"""
id: ID!
"""
When the object was created.
"""
createdAt: DateTime!
"""
Subject used for linking
"""
subject: String!
"""
The provider for which this link is.
"""
provider: UpstreamOAuth2Provider!
"""
The user to which this link is associated.
"""
user: User
}
type UpstreamOAuth2LinkConnection {
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
A list of edges.
"""
edges: [UpstreamOAuth2LinkEdge!]!
"""
A list of nodes.
"""
nodes: [UpstreamOAuth2Link!]!
}
"""
An edge in a connection.
"""
type UpstreamOAuth2LinkEdge {
"""
The item at the end of the edge
"""
node: UpstreamOAuth2Link!
"""
A cursor for use in pagination
"""
cursor: String!
}
type UpstreamOAuth2Provider implements Node & CreationEvent {
"""
ID of the object.
"""
id: ID!
"""
When the object was created.
"""
createdAt: DateTime!
"""
OpenID Connect issuer URL.
"""
issuer: String!
"""
Client ID used for this provider.
"""
clientId: String!
}
type UpstreamOAuth2ProviderConnection {
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
A list of edges.
"""
edges: [UpstreamOAuth2ProviderEdge!]!
"""
A list of nodes.
"""
nodes: [UpstreamOAuth2Provider!]!
}
"""
An edge in a connection.
"""
type UpstreamOAuth2ProviderEdge {
"""
The item at the end of the edge
"""
node: UpstreamOAuth2Provider!
"""
A cursor for use in pagination
"""
cursor: String!
}
"""
URL is a String implementing the [URL Standard](http://url.spec.whatwg.org/)
"""
scalar Url
"""
A user is an individual's account.
"""
type User implements Node {
"""
ID of the object.
"""
id: ID!
"""
Username chosen by the user.
"""
username: String!
"""
Access to the user's Matrix account information.
"""
matrix: MatrixUser!
"""
Primary email address of the user.
"""
primaryEmail: UserEmail
"""
Get the list of compatibility SSO logins, chronologically sorted
"""
compatSsoLogins(
after: String
before: String
first: Int
last: Int
): CompatSsoLoginConnection!
"""
Get the list of active browser sessions, chronologically sorted
"""
browserSessions(
after: String
before: String
first: Int
last: Int
): BrowserSessionConnection!
"""
Get the list of emails, chronologically sorted
"""
emails(
after: String
before: String
first: Int
last: Int
): UserEmailConnection!
"""
Get the list of OAuth 2.0 sessions, chronologically sorted
"""
oauth2Sessions(
after: String
before: String
first: Int
last: Int
): Oauth2SessionConnection!
"""
Get the list of upstream OAuth 2.0 links
"""
upstreamOauth2Links(
after: String
before: String
first: Int
last: Int
): UpstreamOAuth2LinkConnection!
}
"""
A user email address
"""
type UserEmail implements Node & CreationEvent {
"""
ID of the object.
"""
id: ID!
"""
Email address
"""
email: String!
"""
When the object was created.
"""
createdAt: DateTime!
"""
When the email address was confirmed. Is `null` if the email was never
verified by the user.
"""
confirmedAt: DateTime
}
type UserEmailConnection {
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
A list of edges.
"""
edges: [UserEmailEdge!]!
"""
A list of nodes.
"""
nodes: [UserEmail!]!
"""
Identifies the total count of items in the connection.
"""
totalCount: Int!
}
"""
An edge in a connection.
"""
type UserEmailEdge {
"""
The item at the end of the edge
"""
node: UserEmail!
"""
A cursor for use in pagination
"""
cursor: String!
}
"""
The input for the `verifyEmail` mutation
"""
input VerifyEmailInput {
"""
The ID of the email address to verify
"""
userEmailId: ID!
"""
The verification code
"""
code: String!
}
"""
The payload of the `verifyEmail` mutation
"""
type VerifyEmailPayload {
"""
Status of the operation
"""
status: VerifyEmailStatus!
"""
The email address that was verified
"""
email: UserEmail
"""
The user to whom the email address belongs
"""
user: User
}
"""
The status of the `verifyEmail` mutation
"""
enum VerifyEmailStatus {
"""
The email address was just verified
"""
VERIFIED
"""
The email address was already verified before
"""
ALREADY_VERIFIED
"""
The verification code is invalid
"""
INVALID_CODE
}
"""
Represents the current viewer
"""
union Viewer = User | Anonymous
"""
Represents the current viewer's session
"""
union ViewerSession = BrowserSession | Anonymous
schema {
query: Query
mutation: Mutation
}