-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dominic Wong
authored
Mar 14, 2022
1 parent
1003b3c
commit 69569e1
Showing
4 changed files
with
56 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import type { NextPage } from 'next' | ||
import type { ServiceExamples } from '@/types' | ||
import type {NextPage} from 'next' | ||
import type {ServiceExamples} from '@/types' | ||
import Link from 'next/link' | ||
import { NextSeo } from 'next-seo' | ||
import { SchemaObject } from 'openapi3-ts' | ||
import { MainLayout } from '@/components/layouts' | ||
import { Example, Section } from '@/components/pages/GettingStarted' | ||
import { Routes } from '@/lib/constants' | ||
import { withAuth, WithAuthProps } from '@/lib/api/m3o/withAuth' | ||
import { fetchSingleService } from '@/lib/api/m3o/services/explore' | ||
import {NextSeo} from 'next-seo' | ||
import {SchemaObject} from 'openapi3-ts' | ||
import {MainLayout} from '@/components/layouts' | ||
import {Example, Section} from '@/components/pages/GettingStarted' | ||
import {Routes} from '@/lib/constants' | ||
import {withAuth, WithAuthProps} from '@/lib/api/m3o/withAuth' | ||
import {fetchSingleService} from '@/lib/api/m3o/services/explore' | ||
import seo from '@/lib/seo.json' | ||
import { PageHeader } from '@/components/ui' | ||
import {PageHeader} from '@/components/ui' | ||
|
||
interface Props extends WithAuthProps { | ||
examples: ServiceExamples | ||
requestSchema: SchemaObject | ||
} | ||
|
||
export const getServerSideProps = withAuth(async context => { | ||
const { examples, schemas } = await fetchSingleService('helloworld') | ||
const {examples, schemas} = await fetchSingleService('helloworld') | ||
|
||
return { | ||
props: { | ||
|
@@ -28,7 +28,7 @@ export const getServerSideProps = withAuth(async context => { | |
} | ||
}) | ||
|
||
const GettingStarted: NextPage<Props> = ({ user, examples, requestSchema }) => { | ||
const GettingStarted: NextPage<Props> = ({user, examples, requestSchema}) => { | ||
return ( | ||
<MainLayout> | ||
<NextSeo | ||
|
@@ -63,7 +63,7 @@ const GettingStarted: NextPage<Props> = ({ user, examples, requestSchema }) => { | |
Here's a simple example to call the helloworld API: | ||
</p> | ||
<div className="max-w-3xl"> | ||
<Example examples={examples} requestSchema={requestSchema} /> | ||
<Example examples={examples} requestSchema={requestSchema}/> | ||
</div> | ||
</Section> | ||
<Section title="Discover APIs"> | ||
|
@@ -86,13 +86,25 @@ const GettingStarted: NextPage<Props> = ({ user, examples, requestSchema }) => { | |
</p> | ||
</Section> | ||
<Section title="Using an API"> | ||
<p> | ||
<p className="mt-4 mb-4"> | ||
M3O APIs can be accessed via the url | ||
"https://api.m3o.com/v1/[service]/[endpoint] ". All API | ||
calls require an API token provided via the "Authorization: | ||
Bearer" header. Our APIs provide a JSON based request/response | ||
format and also require a `Content-Type: application/json` header | ||
for each request. | ||
calls require an API token to be provided. You can specify the token in one of three ways: | ||
<ul className="list-disc mt-2"> | ||
<li>via the "Authorization" header. Prepend your API token with the string "Bearer" | ||
i.e. the header will look like "Authorization: Bearer <YOUR API TOKEN>"</li> | ||
<li>via HTTP basic authentication. Use the string "user" as the username and use your API token as | ||
the password | ||
</li> | ||
<li>via the "Sec-Websocket-Protocol" header for websocket calls. Pass your API token as the | ||
protocol name | ||
</li> | ||
</ul> | ||
</p> | ||
|
||
<p className="mt-4"> | ||
Our APIs provide a JSON based request/response format and also require a `Content-Type: application/json` | ||
header for each request. | ||
</p> | ||
|
||
<p className="mt-4"> | ||
|
@@ -118,8 +130,8 @@ const GettingStarted: NextPage<Props> = ({ user, examples, requestSchema }) => { | |
</Section> | ||
<Section title="Account Billing"> | ||
<p> | ||
The majority of our APIs are free, with a 1 million request per | ||
month quota. Third party APIs or calls that perform specific | ||
The majority of our APIs are free, with a 10,000 request per | ||
month quota on the free tier. Third party APIs or calls that perform specific | ||
functions such as SMS or email are charged for and billed per | ||
request. Each account has a credit based balance. Any request made | ||
to a paid API will be debited from the balance in real time. When | ||
|
@@ -147,7 +159,8 @@ const GettingStarted: NextPage<Props> = ({ user, examples, requestSchema }) => { | |
</Section> | ||
<Section title="Feedback or Support"> | ||
<p> | ||
Join the community and ask questions on <a className="dark:text-blue-300" href="https://discord.gg/TBR9bRjd6Z">Discord</a>. | ||
Join the community and ask questions on <a className="dark:text-blue-300" | ||
href="https://discord.gg/TBR9bRjd6Z">Discord</a>. | ||
If you're subscribed to the Pro tier email{' '} | ||
<a className="dark:text-blue-300" href="mailto:[email protected]">[email protected]</a> for help. Otherwise you | ||
can provide feedback at <a className="dark:text-blue-300" href="mailto:[email protected]">[email protected]</a>. | ||
|
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