-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '8.0-en-configuration_docs-OXDEV-7354' into 8.0-en
- Loading branch information
Showing
9 changed files
with
189 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
Read and update configurations | ||
============================== | ||
|
||
.. important:: | ||
To read and update configurations you need the `GraphQL Configuration Access module | ||
<https://github.com/OXID-eSales/graphql-configuration-access/>`_ installed and activated. | ||
|
||
List configurations | ||
------------------- | ||
|
||
To read or update configurations it's important to know which type the configuration has, you want to modify | ||
or read to. | ||
Three list queries are available to figure that out. One for module- (``moduleSettings``), one for theme- (``themeSettings``) | ||
and one for shop-configurations (``shopSettings``). | ||
|
||
Here is one example how to use it: | ||
|
||
.. code-block:: graphql | ||
:caption: call to ``moduleSettings`` query | ||
query settings { | ||
moduleSettings( | ||
moduleId: "awesomeModule" | ||
) | ||
} | ||
.. code-block:: json | ||
:caption: ``moduleSettings`` query response | ||
{ | ||
"data": { | ||
"moduleSettings": [ | ||
{ | ||
"name": "intSetting", | ||
"type": "num", | ||
"supported": true | ||
}, | ||
{ | ||
"name": "floatSetting", | ||
"type": "num", | ||
"supported": true | ||
}, | ||
{ | ||
"name": "boolSetting", | ||
"type": "bool", | ||
"supported": true | ||
}, | ||
{ | ||
"name": "stringSetting", | ||
"type": "str", | ||
"supported": true | ||
}, | ||
{ | ||
"name": "arraySetting", | ||
"type": "arr", | ||
"supported": true | ||
} | ||
] | ||
} | ||
} | ||
The returned data is showing the ``name`` of the setting, the ``type``, to know how to fetch or change the | ||
setting and whether the type is ``supported`` by the module queries and mutations at all. | ||
|
||
Read configurations | ||
------------------- | ||
|
||
If the type is known, you can read the setting by using one of the type separated queries. | ||
The ``name`` of the setting and in our case the corresponding ``module`` is necessary to explicitly | ||
select the configuration. | ||
|
||
.. code-block:: graphql | ||
:caption: call to ``moduleSettingBoolean`` query | ||
query booleanSetting { | ||
moduleSettingBoolean( | ||
name: "booleanSetting", | ||
moduleId: "awesomeModule" | ||
) { | ||
name | ||
value | ||
} | ||
} | ||
.. code-block:: json | ||
:caption: ``moduleSettingBoolean`` query response | ||
{ | ||
"data": { | ||
"moduleSettingBoolean": { | ||
"name": "booleanSetting", | ||
"value": false, | ||
} | ||
} | ||
} | ||
Update configurations | ||
--------------------- | ||
|
||
To update a setting, the ``name``, the new ``value`` and in our case the ``module`` is necessary. | ||
|
||
.. code-block:: graphql | ||
:caption: call to ``moduleSettingBooleanChange`` query | ||
mutation changeBooleanSetting { | ||
moduleSettingBooleanChange( | ||
name: "booleanSetting", | ||
value: true | ||
moduleId: "awesomeModule" | ||
) { | ||
name | ||
value | ||
} | ||
} | ||
.. code-block:: json | ||
:caption: ``moduleSettingBooleanChange`` query response | ||
{ | ||
"data": { | ||
"moduleSettingsBooleanChange": { | ||
"name": "booleanSetting", | ||
"value": true, | ||
} | ||
} | ||
} | ||
.. important:: | ||
Pay attention that the types for module/theme/shop-queries or mutations can be different. | ||
Also the handling of the values depends on the implementation in the shop. | ||
Only the handling of Theme-configurations are currently implemented by the module itself. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ Consuming the API | |
BrowseStorefront | ||
AdministrateCustomer | ||
PlaceOrder | ||
Configurations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters