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B,oCAD/B,mIAKA,uCACA,2FAEE,qBAAGa,KAAK,4BAAR,gBAFF,4CAKA,qCACA,oFACA,uCACA,iJAIA,uCACA,qHAIA,0CACA,qHAIA,mCACA,sCACW,oCADX,yEAIA,0CACA,sCACW,mCADX,SACiC,mCADjC,yTASF,gDACA,gBAAC,IAAD,CACEX,QAASA,EACTY,mBAAoB,GACpBC,mBAAoB,CAClBC,IAAK,8CAEPC,aAAa,EACbC,QAAQ,YACRC,MAAM,iBAER,gBAAC,IAAD,CAAQjB,QAASA","sources":["webpack://badge-frontend/./pages/endpoint.tsx"],"sourcesContent":["import React from 'react'\nimport styled, { css } from 'styled-components'\nimport { staticBadgeUrl } from '../../core/badge-urls/make-badge-url'\nimport { getBaseUrl } from '../constants'\nimport Meta from '../components/meta'\nimport Header from '../components/header'\nimport Footer from '../components/footer'\nimport { BaseFont, GlobalStyle, H3, Badge } from '../components/common'\nimport { Snippet } from '../components/snippet'\nimport Customizer from '../components/customizer/customizer'\n\nconst MainContainer = styled(BaseFont)`\n text-align: center;\n`\n\nconst Explanation = styled.div`\n display: block;\n max-width: 800px;\n margin: 0 auto;\n text-align: left;\n`\n\ninterface JsonExampleBlockProps {\n fontSize?: string\n}\n\nconst JsonExampleBlock = styled.code`\n display: inline-block;\n\n text-align: left;\n line-height: 1.2em;\n padding: 16px 18px;\n\n border-radius: 4px;\n background: #eef;\n\n font-family: Lekton;\n ${({ fontSize }) =>\n css`\n font-size: ${fontSize};\n `};\n\n white-space: pre;\n`\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, react/prop-types\nfunction JsonExample({ data }: { [k: string]: any }): JSX.Element {\n return (\n {JSON.stringify(data, undefined, 2)}\n )\n}\n\nconst Schema = styled.dl`\n display: inline-block;\n max-width: 800px;\n\n margin: 0;\n padding: 10px;\n text-align: left;\n\n background: #efefef;\n\n clear: both;\n overflow: hidden;\n\n dt,\n dd {\n padding: 0 1%;\n margin-top: 8px;\n margin-bottom: 8px;\n float: left;\n }\n\n dt {\n width: 100px;\n clear: both;\n }\n\n dd {\n margin-left: 20px;\n width: 75%;\n }\n\n @media (max-width: 600px) {\n .data_table {\n text-align: center;\n }\n }\n`\n\nexport default function EndpointPage(): JSX.Element {\n const baseUrl = getBaseUrl()\n return (\n \n \n \n
\n

Endpoint

\n \n

Endpoint response:

\n \n

Shields response:

\n \n \n

\n Developers rely on Shields for visual consistency and powerful\n customization options. As a service provider or data provider, you can\n use the endpoint badge to provide content while giving users the full\n power of Shields' badge customization.\n

\n

\n Using the endpoint badge, you can provide content for a badge through\n a JSON endpoint. The content can be prerendered, or generated on the\n fly. To strike a balance between responsiveness and bandwidth\n utilization on one hand, and freshness on the other, cache behavior is\n configurable, subject to the Shields minimum. The endpoint URL is\n provided to Shields through the query string. Shields fetches it and\n formats the badge.\n

\n

\n The endpoint badge is a better alternative than redirecting to the\n static badge enpoint or generating SVG on your server:\n

\n
    \n
  1. \n \n Content and presentation are separate.\n {' '}\n The service provider authors the badge, and Shields takes input from\n the user to format it. As a service provider you author the badge\n but don't have to concern yourself with styling. You don't even have\n to pass the formatting options through to Shields.\n
  2. \n
  3. \n Badge formatting is always 100% up to date. There's no need to track\n updates to the npm package, badge templates, or options.\n
  4. \n
  5. \n A JSON response is easy to implement; easier than an HTTP redirect.\n It is trivial in almost any framework, and is more compatible with\n hosting environments such as{' '}\n RunKit endpoints.\n
  6. \n
  7. \n As a service provider you can rely on the Shields CDN. There's no\n need to study the HTTP headers. Adjusting cache behavior is as\n simple as setting a property in the JSON response.\n
  8. \n
\n
\n

Schema

\n \n

\n Breaking changes to the schema will trigger an increment to the\n `schemaVersion`.\n

\n
\n \n
schemaVersion
\n
\n Required. Always the number 1.\n
\n
label
\n
\n Required. The left text, or the empty string to omit the left side of\n the badge. This can be overridden by the query string.\n
\n
message
\n
Required. Can't be empty. The right text.
\n
color
\n
\n Default: lightgrey. The right color. Supports the eight\n named colors above, as well as hex, rgb, rgba, hsl, hsla and css named\n colors. This can be overridden by the query string.\n
\n
labelColor
\n
\n Default: grey. The left color. This can be overridden by\n the query string.\n
\n
isError
\n
\n Default: false. true to treat this as an\n error badge. This prevents the user from overriding the color. In the\n future it may affect cache behavior.\n
\n
namedLogo
\n
\n Default: none. One of the named logos supported by Shields or {}\n simple-icons. Can be overridden\n by the query string.\n
\n
logoSvg
\n
Default: none. An SVG string containing a custom logo.
\n
logoColor
\n
\n Default: none. Same meaning as the query string. Can be overridden by\n the query string. Only works for named logos.\n
\n
logoWidth
\n
\n Default: none. Same meaning as the query string. Can be overridden by\n the query string.\n
\n
logoPosition
\n
\n Default: none. Same meaning as the query string. Can be overridden by\n the query string.\n
\n
style
\n
\n Default: flat. The default template to use. Can be\n overridden by the query string.\n
\n
cacheSeconds
\n
\n Default: 300, min 300. Set the HTTP cache\n lifetime in seconds, which should be respected by the Shields' CDN and\n downstream users. Values below 300 will be ignored. This lets you tune\n performance and traffic vs. responsiveness. The value you specify can\n be overridden by the user via the query string, but only to a longer\n value.\n
\n
\n

Customize and test

\n \n