145 lines
3.6 KiB
GraphQL
145 lines
3.6 KiB
GraphQL
extend type Query {
|
|
"""
|
|
Returns a specific stream.
|
|
"""
|
|
stream( id: String! ): Stream
|
|
@hasScope(scope: "streams:read")
|
|
|
|
"""
|
|
All the streams of the current user, pass in the `query` parameter to seach by name, description or ID.
|
|
"""
|
|
streams( query: String, limit: Int = 25, cursor: String ): StreamCollection
|
|
@hasScope(scope: "streams:read")
|
|
}
|
|
|
|
type Stream {
|
|
id: String!
|
|
name: String!
|
|
description: String
|
|
isPublic: Boolean!
|
|
createdAt: String!
|
|
updatedAt: String!
|
|
collaborators: [ StreamCollaborator ]!
|
|
}
|
|
|
|
extend type User {
|
|
"""
|
|
All the streams that a user has access to.
|
|
"""
|
|
streams( limit: Int! = 25, cursor: String ): StreamCollection
|
|
}
|
|
|
|
type StreamCollaborator {
|
|
id: String!
|
|
name: String!
|
|
role: String!
|
|
}
|
|
|
|
type StreamCollection {
|
|
totalCount: Int!
|
|
cursor: String
|
|
items: [ Stream ]
|
|
}
|
|
|
|
|
|
extend type Mutation {
|
|
"""
|
|
Creates a new stream.
|
|
"""
|
|
streamCreate( stream: StreamCreateInput! ): String
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "streams:write")
|
|
"""
|
|
Updates an existing stream.
|
|
"""
|
|
streamUpdate( stream: StreamUpdateInput! ): Boolean!
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "streams:write")
|
|
"""
|
|
Deletes an existing stream.
|
|
"""
|
|
streamDelete( id: String! ): Boolean!
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "streams:write")
|
|
"""
|
|
Grants permissions to a user on a given stream.
|
|
"""
|
|
streamGrantPermission( permissionParams: StreamGrantPermissionInput! ): Boolean
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "streams:write")
|
|
"""
|
|
Revokes the permissions of a user on a given stream.
|
|
"""
|
|
streamRevokePermission( permissionParams: StreamRevokePermissionInput! ): Boolean
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "streams:write")
|
|
}
|
|
|
|
extend type Subscription {
|
|
|
|
#
|
|
# User bound subscriptions that operate on the stream collection of an user
|
|
# Example relevant view/usecase: updating the list of streams for a user.
|
|
#
|
|
|
|
"""
|
|
Subscribes to new stream added event for your profile. Use this to display an up-to-date list of streams.
|
|
**NOTE**: If someone shares a stream with you, this subscription will be triggered with an extra value of `sharedBy` in the payload.
|
|
"""
|
|
userStreamAdded: JSONObject
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "profile:read")
|
|
|
|
"""
|
|
Subscribes to stream removed event for your profile. Use this to display an up-to-date list of streams for your profile.
|
|
**NOTE**: If someone revokes your permissions on a stream, this subscription will be triggered with an extra value of `revokedBy` in the payload.
|
|
"""
|
|
userStreamRemoved: JSONObject
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "profile:read")
|
|
|
|
#
|
|
# Stream bound subscriptions that operate on the stream itself.
|
|
# Example relevant view/usecase: a single stream connector, or view, or component in a web app
|
|
#
|
|
|
|
"""
|
|
Subscribes to stream updated event. Use this in clients/components that pertain only to this stream.
|
|
"""
|
|
streamUpdated( streamId: String ): JSONObject
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "streams:read")
|
|
|
|
"""
|
|
Subscribes to stream deleted event. Use this in clients/components that pertain only to this stream.
|
|
"""
|
|
streamDeleted( streamId: String ): JSONObject
|
|
@hasRole(role: "server:user")
|
|
@hasScope(scope: "streams:read")
|
|
|
|
}
|
|
|
|
input StreamCreateInput {
|
|
name: String
|
|
description: String
|
|
isPublic: Boolean
|
|
}
|
|
|
|
input StreamUpdateInput {
|
|
id: String!
|
|
name: String
|
|
description: String
|
|
isPublic: Boolean
|
|
}
|
|
|
|
input StreamGrantPermissionInput {
|
|
streamId: String!,
|
|
userId: String!,
|
|
role: String!
|
|
}
|
|
|
|
input StreamRevokePermissionInput {
|
|
streamId: String!,
|
|
userId: String!
|
|
}
|