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