2. Resource schema - nuvoleweb/integration GitHub Wiki
A Resource Schema describe which type of content can be exchanged between Producers and Consumers by defining a list of fields that compose that specific type of content. Each backend will support only a discrete numbers of Resource Schemas: Producers and Consumers can only produce and consume data choosing among the supported Resource Schemas for that particular Backend.
Create a Resource Schema programmatically
To create a Resource Schema programmatically you can use the ResourceSchemaFactory
static class as follow:
use Drupal\integration\ResourceSchema\ResourceSchemaFactory;
$resource_schema = ResourceSchemaFactory::create('article')
->setField('title', 'Title')
->setField('image', 'Image')
->setField('body', 'Body');
Note that, at this point, Resource Schema configuration is only stored in the class static cache. To persist the configuration object in the database use the following:
$resource_schema->getConfiguration()->save();