1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-08-09 04:22:45 +03:00

Expose a unified session list in the GraphQL API

This commit is contained in:
Quentin Gliech
2023-09-20 20:18:02 +02:00
parent f1d420f381
commit d91b0e20e4
13 changed files with 459 additions and 177 deletions

View File

@@ -110,6 +110,44 @@ type Anonymous implements Node {
id: ID!
}
"""
A session in an application, either a compatibility or an OAuth 2.0 one
"""
union AppSession = CompatSession | Oauth2Session
type AppSessionConnection {
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
A list of edges.
"""
edges: [AppSessionEdge!]!
"""
A list of nodes.
"""
nodes: [AppSession!]!
"""
Identifies the total count of items in the connection.
"""
totalCount: Int!
}
"""
An edge in a connection.
"""
type AppSessionEdge {
"""
The item at the end of the edge
"""
node: AppSession!
"""
A cursor for use in pagination
"""
cursor: String!
}
"""
An authentication records when a user enter their credential in a browser
session.
@@ -152,7 +190,7 @@ type BrowserSession implements Node & CreationEvent {
"""
The state of the session.
"""
state: BrowserSessionState!
state: SessionState!
"""
The user-agent string with which the session was created.
"""
@@ -200,20 +238,6 @@ type BrowserSessionEdge {
cursor: String!
}
"""
The state of a browser session.
"""
enum BrowserSessionState {
"""
The session is active.
"""
ACTIVE
"""
The session is no longer active.
"""
FINISHED
}
"""
A compat session represents a client session which used the legacy Matrix
login API.
@@ -246,7 +270,7 @@ type CompatSession implements Node & CreationEvent {
"""
The state of the session.
"""
state: CompatSessionState!
state: SessionState!
"""
The last IP address used by the session.
"""
@@ -290,20 +314,6 @@ type CompatSessionEdge {
cursor: String!
}
"""
The state of a compatibility session.
"""
enum CompatSessionState {
"""
The session is active.
"""
ACTIVE
"""
The session is no longer active.
"""
FINISHED
}
"""
The type of a compatibility session.
"""
@@ -747,7 +757,7 @@ type Oauth2Session implements Node & CreationEvent {
"""
The state of the session.
"""
state: Oauth2SessionState!
state: SessionState!
"""
The browser session which started this OAuth 2.0 session.
"""
@@ -799,20 +809,6 @@ type Oauth2SessionEdge {
cursor: String!
}
"""
The state of an OAuth 2.0 session.
"""
enum Oauth2SessionState {
"""
The session is active.
"""
ACTIVE
"""
The session is no longer active.
"""
FINISHED
}
"""
Information about pagination in a connection
"""
@@ -1008,6 +1004,20 @@ A client session, either compat or OAuth 2.0
"""
union Session = CompatSession | Oauth2Session
"""
The state of a session
"""
enum SessionState {
"""
The session is active.
"""
ACTIVE
"""
The session is no longer active.
"""
FINISHED
}
"""
The input for the `addEmail` mutation
"""
@@ -1258,7 +1268,7 @@ type User implements Node {
"""
List only sessions with the given state.
"""
state: CompatSessionState
state: SessionState
"""
List only sessions with the given type.
"""
@@ -1287,7 +1297,7 @@ type User implements Node {
"""
List only sessions in the given state.
"""
state: BrowserSessionState
state: SessionState
"""
Returns the elements in the list that come after the cursor.
"""
@@ -1337,7 +1347,7 @@ type User implements Node {
"""
List only sessions in the given state.
"""
state: Oauth2SessionState
state: SessionState
"""
List only sessions for the given client.
"""
@@ -1380,6 +1390,32 @@ type User implements Node {
"""
last: Int
): UpstreamOAuth2LinkConnection!
"""
Get the list of both compat and OAuth 2.0 sessions, chronologically
sorted
"""
appSessions(
"""
List only sessions in the given state.
"""
state: SessionState
"""
Returns the elements in the list that come after the cursor.
"""
after: String
"""
Returns the elements in the list that come before the cursor.
"""
before: String
"""
Returns the first *n* elements from the list.
"""
first: Int
"""
Returns the last *n* elements from the list.
"""
last: Int
): AppSessionConnection!
}
"""