text: "use strict";(self.webpackChunkmy_website=self.webpackChunkmy_website||[]).push([[1966],{3905:function(e,t,n){n.d(t,{Zo:function(){return c},kt:function(){return h}});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),l=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),h=a,m=d["".concat(p,".").concat(h)]||d[h]||u[h]||o;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var l=2;l<o;l++)i[l]=n[l];return r.createElement.apply(null,i)}return r.createElement.apply(null,n)}d.displayName="MDXCreateElement"},2676:function(e,t,n){n.r(t),n.d(t,{frontMatter:function(){return s},contentTitle:function(){return p},metadata:function(){return l},assets:function(){return c},toc:function(){return u},default:function(){return h}});var r=n(7462),a=n(3366),o=(n(7294),n(3905)),i=["components"],s={},p="Adapter",l={unversionedId:"concepts/adapter",id:"concepts/adapter",title:"Adapter",description:"An adapter is a composer package which provides classes to extend the functionality of Fusio. Through an adapter it is",source:"@site/docs/concepts/adapter.md",sourceDirName:"concepts",slug:"/concepts/adapter",permalink:"/docs/concepts/adapter",editUrl:"https://github.com/apioo/fusio-docs/edit/main/docs/concepts/adapter.md",tags:[],version:"current",frontMatter:{},sidebar:"tutorialSidebar",previous:{title:"Concepts",permalink:"/docs/concepts/"},next:{title:"Authorization",permalink:"/docs/concepts/authorization"}},c={},u=[{value:"Provider",id:"provider",level:2},{value:"Action",id:"action",level:3},{value:"Connection",id:"connection",level:3},{value:"Payment",id:"payment",level:3},{value:"User",id:"user",level:3},{value:"Routes",id:"routes",level:3}],d={toc:u};function h(e){var t=e.components,n=(0,a.Z)(e,i);return(0,o.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"adapter"},"Adapter"),(0,o.kt)("p",null,"An adapter is a composer package which provides classes to extend the functionality of Fusio. Through an adapter it is\ni.e. possible to provide custom action/connection classes or to install predefined routes for an existing system. Our\nwebsite lists every available composer package which has the ",(0,o.kt)("inlineCode",{parentName:"p"},"fusio-adapter")," keyword defined in the composer.json file."),(0,o.kt)("p",null,"The adapter needs to require the ",(0,o.kt)("inlineCode",{parentName:"p"},"fusio/engine")," package and must have an adapter class which implements the\n",(0,o.kt)("inlineCode",{parentName:"p"},"Fusio\\Engine\\AdapterInterface")," interface. This interface has a method getDefinition which returns an absolute path to a\n",(0,o.kt)("inlineCode",{parentName:"p"},"adapter.json")," definition file. This definition contains all information for Fusio how to extend the system. The adapter\ncan be installed through the register command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'php bin/fusio system:register "Acme\\System\\Adapter"\n')),(0,o.kt)("h2",{id:"provider"},"Provider"),(0,o.kt)("h3",{id:"action"},"Action"),(0,o.kt)("p",null,"Interface: ",(0,o.kt)("inlineCode",{parentName:"p"},"Fusio\\Engine\\ActionInterface")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n  "actionClass": ["Acme\\System\\Payment\\Provider"]\n}\n')),(0,o.kt)("h3",{id:"connection"},"Connection"),(0,o.kt)("p",null,"Interface: ",(0,o.kt)("inlineCode",{parentName:"p"},"Fusio\\Engine\\ConnectionInterface")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n  "connectionClass": ["Acme\\System\\Payment\\Provider"]\n}\n')),(0,o.kt)("h3",{id:"payment"},"Payment"),(0,o.kt)("p",null,"Interface: ",(0,o.kt)("inlineCode",{parentName:"p"},"Fusio\\Engine\\Payment\\ProviderInterface")),(0,o.kt)("p",null,"Describes a payment provider which can be used to execute payments. Through the developer app the user has the\npossibility to buy points which can be used to call specific routes which cost points. To buy those points Fusio uses\nthese payment providers to execute a payment. Usually the flow is:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"App calls the API endpoint to prepare a specific product, it provides an plan and a return url. The call returns an\napproval url"),(0,o.kt)("li",{parentName:"ul"},"App redirects the user to the approval url. The user has to approve the payment at the payment provider"),(0,o.kt)("li",{parentName:"ul"},"User returns to the App, the url contains the id of the transaction so the app can call the API endpoint to get\ndetails about the transaction"),(0,o.kt)("li",{parentName:"ul"},"If everything is ok Fusio will credit the points to the user so that he can start calling specific endpoints")),(0,o.kt)("p",null,"Please take a look at the Paypal provider for an example implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n  "paymentClass": ["Acme\\System\\Payment\\Provider"]\n}\n')),(0,o.kt)("h3",{id:"user"},"User"),(0,o.kt)("p",null,"Interface: ",(0,o.kt)("inlineCode",{parentName:"p"},"Fusio\\Engine\\User\\ProviderInterface")),(0,o.kt)("p",null,"Describes a remote identity provider which can be used to authorize an user through a remote system so that the\ndeveloper dont need to create an account. Usually this is done through OAuth2, which has the following flow:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"The App redirects the user to the authorization endpoint of the remote provider (i.e. Google)"),(0,o.kt)("li",{parentName:"ul"},"The user authenticates and returns via redirect to the App"),(0,o.kt)("li",{parentName:"ul"},"The App calls the API endpoint and provides the fitting data to Fusio"),(0,o.kt)("li",{parentName:"ul"},"If everything is ok Fusio will get additional information and create a new account")),(0,o.kt)("p",null,"Please take a look at the Github provider for an example implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n  "userClass": ["Acme\\System\\User\\Provider"]\n}\n')),(0,o.kt)("h3",{id:"routes"},"Routes"),(0,o.kt)("p",null,"Interface: ",(0,o.kt)("inlineCode",{parentName:"p"},"Fusio\\Engine\\Routes\\ProviderInterface")),(0,o.kt)("p",null,"Preconfigured route provider which helps to create automatically schemas, actions and routes for the user. This can be\nused to create complete applications."),(0,o.kt)("p",null,"Please take a look at the SQL-Table provider for an example implementation."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n  "routesClass": ["Acme\\System\\Routes\\Provider"]\n}\n')))}h.isMDXComponent=!0}}]);