Adding a New Command to Akinon
In the Akinon folder within the application, processes that communicate with the services required by Akinon’s Omnitron product are coded. If there is a need for improvement in the Omnitron services or processes for the sales channel being developed, the prepared structure here can be used.
If the existing processes and services do not meet the needs, you can add the new commands you have written to the channel_app_template.akinon.integration.OmnitronIntegration
section by following the steps below.
Creating a Command
To create a command, the
class
you create must inherit fromOmnitronCommandInterface
.You need to create a
class
that inherits fromOmnitronApiEndpoint
for the endpoint to which the command will send requests and assign it to theendpoint
property of the created command.Optionally, if you want to send multiple requests through the
OmnitronApiEndpoint
you created, you can input thepath
property into the created command and make the necessary customizations.Optionally, to specify the number of data items the command will process at one time, you can define a property named
BATCH_SIZE
and make the necessary customizations.The
content_type
property is used to hold the data type that the command will process and to create more detailed logs in case of an error. You can check the assignablecontent_type
inchannel_app.omnitron.constants.ContentType
.
The created command should be added with a key (name) to the
new_actions
property withinOmnitronIntegration
.To invoke the command, refer to
channel_app.channel.integration.ChannelIntegration.do_action
example.