Files
speckle-server/modules/core/graph/schemas/objects.graphql
T
2020-04-22 14:49:55 +01:00

180 lines
3.8 KiB
GraphQL

extend type Stream {
commits(offset: Int! = 0, limit: Int = 20): CommitCollection
tags(offset: Int = 0, limit: Int = 20): TagCollection
tag( id: String! ): Tag
branches(offset: Int = 0, limit: Int = 20): BranchCollection
branch( id: String! ): Branch
}
type CommitCollection {
totalCount: Int
commits: [Object]
}
type TagCollection {
totalCount: Int
tags: [Tag]
}
type BranchCollection {
totalCount: Int
branches: [Branch]
}
type Object {
id: String!
speckleType: String!
applicationId: String!
createdAt: DateTime
"""
The object's description. Valid only in the case of commit objects.
"""
description: String
"""
The object's creator. Valid only in the case of commit objects.
"""
author: User
"""
Any tags that this object belongs to. Valid only in the case of commit objects.
"""
tag: [Tag]
"""
Any branches that this object belongs to. Valid only in the case of commit objects.
"""
branch: [Branch]
"""
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: JSON
"""
Any objects that this object references.
`offset`: TODO
`limit`: TODO
`depth`: TODO
`query`: TODO
"""
children(offset: Int! = 0, limit: Int! = 100, depth: Int! = 1, query: String): [Object]
}
enum REFERENCE_TYPE {
BRANCH,
TAG
}
interface Reference {
id: String!
name: String!
type: REFERENCE_TYPE!
description: String!
author: User!
createdAt: String
updatedAt: String
}
type Branch implements Reference {
id: String!
type: REFERENCE_TYPE!
name: String!
author: User!
description: String!
createdAt: String
updatedAt: String
commits( offset: Int! = 0, limit: Int! = 20 ): CommitCollection
}
type Tag implements Reference {
id: String!
type: REFERENCE_TYPE!
name: String!
author: User!
description: String!
createdAt: String
updatedAt: String
commit: Object
}
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!
tagCreate(streamId: String!, tag: TagCreateInput ): String!
tagUpdate(streamId: String!, tag: TagUpdateInput ): String
tagDelete( streamId: String!, tagId: String! ): String
}
input TagCreateInput {
name: String!
description: String
commitId: String!
}
input TagUpdateInput {
id: String!
name: String
description: String
commitId: String
}
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 objects 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]!
}