Files
speckle-server/modules/core/graph/schemas/objects.graphql
T
2020-07-17 20:39:23 +01:00

118 lines
3.0 KiB
GraphQL

extend type Stream {
commits(offset: Int! = 0, limit: Int = 20): CommitCollection
commit(id: String!): Object!
branches(offset: Int = 0, limit: Int = 20): BranchCollection
branch( id: String! ): Branch
}
type CommitCollection {
totalCount: Int!
commits: [Object]
cursor: String
}
type BranchCollection {
totalCount: Int!
branches: [Branch]
cursor: String
}
type Object {
id: String!
speckleType: String!
applicationId: String
createdAt: DateTime
totalChildrenCount: Int
"""
The full object, with all its props & other things. **NOTE:** If you're requesting objects for the purpose of recreating & displaying, you probably only want to request this specific field.
"""
data: JSONObject
"""
Get any objects that this object references. In the case of commits, this will give you a commit's constituent objects.
**NOTE**: Providing any of the two last arguments ( `query`, `orderBy` ) will trigger a different code branch that executes a much more expensive SQL query. It is not recommended to do so for basic clients that are interested in purely getting all the objects of a given commit.
"""
children(
limit: Int! = 100,
depth: Int! = 50,
select: [String],
cursor: String,
query: [JSONObject!],
orderBy: JSONObject ): ObjectCollection!
}
type ObjectCollection {
totalCount: Int!
cursor: String
objects: [Object]!
}
type Branch {
id: String!
name: String!
author: User!
description: String!
createdAt: String
updatedAt: String
commits( offset: Int! = 0, limit: Int! = 20 ): CommitCollection
}
extend type Mutation {
"""
Creates a special type of object, namely a commit. A commit is describes the particular shape of a data stream at one point in time. It's a collection of objects.
Returns the hash of the commit.
"""
commitCreate( streamId: String!, commit:JSONObject! ): String!
"""
Creates a bunch of objects and returns their hashes. Note: data duplication is respected.
Returns the hashes of the stored objects.
"""
objectCreate( streamId: String!, objects:[JSONObject]! ): [String]!
"""
Creates a branch.
"""
branchCreate( streamId: String!, branch: BranchCreateInput ): String
"""
Updates a branch. If a commit id array is present, the two get merged.
"""
branchUpdate( streamId: String!, branch: BranchUpdateInput ): Boolean!
"""
Deletes a branch.
"""
branchDelete( streamId: String!, branchId: String! ): Boolean!
}
input BranchCreateInput {
name: String!
description: String
commits: [String]
}
input BranchUpdateInput {
id: String!
name: String
description: String
commits: [String]
}
input CommitCreateInput {
"""
The stream against which these objects will be created.
"""
streamId: String!
"""
The commit you want to create.
"""
commit: JSONObject!
}
input ObjectCreateInput {
"""
The stream against which these objects will be created.
"""
streamId: String!
"""
The objects you want to create.
"""
objects: [JSONObject]!
}