foomo-docs/assets/js/dc1592f9.37f115f0.js
2023-04-21 20:13:23 +00:00

1 line
6.3 KiB
JavaScript

"use strict";(self.webpackChunkfoomo=self.webpackChunkfoomo||[]).push([[1937],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>g});var o=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),c=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(s.Provider,{value:t},e.children)},u="mdxType",f={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=c(n),m=r,g=u["".concat(s,".").concat(m)]||u[m]||f[m]||a;return n?o.createElement(g,l(l({ref:t},p),{},{components:n})):o.createElement(g,l({ref:t},p))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i[u]="string"==typeof e?e:r,l[1]=i;for(var c=2;c<a;c++)l[c]=n[c];return o.createElement.apply(null,l)}return o.createElement.apply(null,n)}m.displayName="MDXCreateElement"},8873:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>f,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var o=n(7462),r=(n(7294),n(3905));const a={},l="Getting started",i={unversionedId:"projects/cms/gocontentful/getting-started",id:"projects/cms/gocontentful/getting-started",title:"Getting started",description:"Installation",source:"@site/docs/projects/cms/gocontentful/02-getting-started.md",sourceDirName:"projects/cms/gocontentful",slug:"/projects/cms/gocontentful/getting-started",permalink:"/docs/projects/cms/gocontentful/getting-started",draft:!1,editUrl:"https://github.com/foomo/foomo-docs/tree/main/foomo/docs/projects/cms/gocontentful/02-getting-started.md",tags:[],version:"current",sidebarPosition:2,frontMatter:{},sidebar:"projectsSidebar",previous:{title:"Gocontentful",permalink:"/docs/projects/cms/gocontentful/"},next:{title:"Play with the test API",permalink:"/docs/projects/cms/gocontentful/test-api"}},s={},c=[{value:"Installation",id:"installation",level:2},{value:"Optional tools",id:"optional-tools",level:2}],p={toc:c},u="wrapper";function f(e){let{components:t,...n}=e;return(0,r.kt)(u,(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"getting-started"},"Getting started"),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Prerequisite: you need Go 1.16+. Upgrade if you still haven't, then run:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"go get github.com/foomo/gocontentful\n")),(0,r.kt)("p",null,"If you trust us there are ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/foomo/gocontentful/releases"},"precompiled versions on Github")),(0,r.kt)("p",null,"On the mac:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"brew install foomo/gocontentful/gocontentful\n")),(0,r.kt)("p",null,"Test the installation (make sure $GOPATH/bin is in your $PATH):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ gocontentful -version\nv1.0.13\n")),(0,r.kt)("h2",{id:"optional-tools"},"Optional tools"),(0,r.kt)("p",null,"Gocontentful requires a CMA API key to scan the Contentful space and generate the model.\nThis can be passed as a CLI parameter but that's tedious and your management key will remain in your shell history.\nA better approach is to log in to Contentful using the official ",(0,r.kt)("em",{parentName:"p"},"Contentful CLI"),". Gocontentful will get the key automatically.\nTo install the CLI refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://www.contentful.com/developers/docs/tutorials/cli/installation/"},"official documentation at Contentful.com"),"."),(0,r.kt)("p",null,"After installing the CLI log in inside your terminal with:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ contentful login\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ gocontentful\n\nERROR: Please specify either a Contentful Space ID and CMA access token or an export file name\n\nSYNOPSIS\n gocontentful -spaceid SpaceID -cmakey CMAKey [-contenttypes firsttype,secondtype...lasttype] path/to/target/package\n\n -cmakey string\n [Optional] Contentful CMA key\n -contenttypes string\n [Optional] Content type IDs to parse, comma separated\n -environment string\n [Optional] Contentful space environment\n -exportfile string\n Space export file to generate the API from\n -help\n Print version and exit\n -spaceid string\n Contentful space ID\n -version\n Print version and exit\n\nNotes:\n- The last segment of the path/to/target/package will be used as package name\n- The -cmakey parameter can be omitted if you logged in with the Contentful CLI\n")),(0,r.kt)("p",null,"Notes:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"The last segment of the path/to/target/package will be used as package name"),(0,r.kt)("li",{parentName:"ul"},"You need to pass gocontentful either cmakey/spaceid (and optional environment) to generate\nthe API from a live space or exportfile to generate it from a local space export file. The cmakey\ncan be omitted if you are logged in through the Contentful CLI.")))}f.isMDXComponent=!0}}]);