All Release Notes

Added Review GraphQL query and mutation schema

9 March 2020
Composable Commerce
HTTP API
Enhancement
GraphQLProduct catalogSearch

Reviews can now be queried, created, updated, and deleted using the GraphQL API.

  • [GraphQL API] Added the following types to the GraphQL schema: Review, ReviewQueryResult, ReviewTarget, ReviewDraft, ReviewUpdateAction, SetReviewAuthorName, SetReviewCustomField, SetReviewCustomType, SetReviewCustomer, SetReviewKey, SetReviewLocale, SetReviewRating, SetReviewTarget, SetReviewText, SetReviewTitle, TargetReferenceInput, TransitionReviewState.
  • [GraphQL API] Changed the Channel type:
    • Channel object type now implements ReviewTarget interface
  • [GraphQL API] Changed the Product type:
    • Product object type now implements ReviewTarget interface
  • [GraphQL API] Changed the Query type:
    • Added the reviews field to the Query type.
    • Added the review field to the Query type.
  • [GraphQL API] Changed the Mutation type:
    • Added the updateReview field to the Mutation type.
    • Added the deleteReview field to the Mutation type.
    • Added the createReview field to the Mutation type.

Introduced the following changes to the GraphQL schema (in SDL format):

extend type Query {
review(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): Review
reviews(where: String, sort: [String!], limit: Int, offset: Int): ReviewQueryResult!
}
type Review implements Versioned {
key: String
uniquenessValue: String
locale: Locale
authorName: String
title: String
text: String
targetRef: Reference
target: ReviewTarget
rating: Int
stateRef: Reference
state: State
includedInStatistics: Boolean!
customerRef: Reference
customer: Customer
custom: CustomFieldsType
id: String!
version: Long!
createdAt: DateTime!
lastModifiedAt: DateTime!
createdBy: Initiator
lastModifiedBy: Initiator
}
type ReviewQueryResult {
offset: Int!
count: Int!
total: Long!
results: [Review!]!
}
interface ReviewTarget {
id: String!
}
extend type Mutation {
createReview(draft: ReviewDraft!): Review
deleteReview(version: Long!,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): Review
updateReview(version: Long!, actions: [ReviewUpdateAction!]!,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): Review
}
input ReviewDraft {
key: String
uniquenessValue: String
locale: Locale
authorName: String
title: String
text: String
target: TargetReferenceInput
state: ResourceIdentifierInput
rating: Int
customer: ResourceIdentifierInput
custom: CustomFieldsDraft
}
input ReviewUpdateAction {
setAuthorName: SetReviewAuthorName
setCustomField: SetReviewCustomField
setCustomType: SetReviewCustomType
setCustomer: SetReviewCustomer
setKey: SetReviewKey
setLocale: SetReviewLocale
setRating: SetReviewRating
setTarget: SetReviewTarget
setText: SetReviewText
setTitle: SetReviewTitle
transitionState: TransitionReviewState
}
input SetReviewAuthorName {
authorName: String
}
input SetReviewCustomField {
name: String!
value: String
}
input SetReviewCustomType {
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}
input SetReviewCustomer {
customer: ResourceIdentifierInput
}
input SetReviewKey {
key: String
}
input SetReviewLocale {
locale: Locale
}
input SetReviewRating {
rating: Int
}
input SetReviewTarget {
target: TargetReferenceInput
}
input SetReviewText {
text: String
}
input SetReviewTitle {
title: String
}
input TargetReferenceInput {
typeId: String!
id: String
key: String
}
input TransitionReviewState {
state: ResourceIdentifierInput!
force: Boolean = false
}