getMutationKey(...)
The method provides a standardized way to generate MutationKey
for Mutations.
It could be used to check mutation status, or to cancel a mutation.
qraft.<service>.<operation>.getMutationKey(parameters)
Argumentsโ
-
parameters: { path, query, header } | undefined
- Optional, OpenAPI request parameters for the mutation, strictly-typed โจ
parameters
will be used to generate theMutationKey
- If not specified, returns a
MutationKey
with{}
as a Mutation parameters
Returnsโ
MutationKey
- a mutation key for the operation parameters
Exampleโ
- With
parameters
- Without
parameters
expect(
qraft.entities.postEntitiesIdDocuments.getMutationKey({
header: {
'x-monite-version': '1.0.0',
},
path: {
entity_id: '1',
},
query: {
referer: 'https://example.com',
},
})
).toEqual([
{
url: qraft.entities.postEntitiesIdDocuments.schema.url,
method: qraft.entities.postEntitiesIdDocuments.schema.method,
},
{
header: {
'x-monite-version': '1.0.0',
},
path: {
entity_id: '1',
},
query: {
referer: 'https://example.com',
},
},
]);
expect(
qraft.entities.postEntitiesIdDocuments.getMutationKey()
).toEqual([
{
url: qraft.entities.postEntitiesIdDocuments.schema.url,
method: qraft.entities.postEntitiesIdDocuments.schema.method,
},
{},
]);