Skip to content

Commit

Permalink
Commit from m3o/m3o action
Browse files Browse the repository at this point in the history
  • Loading branch information
m3o-actions committed Jul 10, 2023
1 parent 140a443 commit ec9c73f
Show file tree
Hide file tree
Showing 30 changed files with 1,300 additions and 1,300 deletions.
92 changes: 46 additions & 46 deletions examples/ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,52 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Ai/api](https:

Endpoints:

## Generate

Generate an image from prompt


[https://m3o.com/ai/api#Generate](https://m3o.com/ai/api#Generate)

```js
const { AiService } = require('m3o/ai');

const aiService = new AiService(process.env.M3O_API_TOKEN)

// Generate an image from prompt
async function generateImage() {
const rsp = await aiService.generate({
"text": "a cat on a ball"
})
console.log(rsp)

}

generateImage()
```
## Moderate

Moderate hate speech


[https://m3o.com/ai/api#Moderate](https://m3o.com/ai/api#Moderate)

```js
const { AiService } = require('m3o/ai');

const aiService = new AiService(process.env.M3O_API_TOKEN)

// Moderate hate speech
async function moderateHateSpeech() {
const rsp = await aiService.moderate({
"text": "I want to kill him"
})
console.log(rsp)

}

moderateHateSpeech()
```
## Chat

Make a request to ChatGPT
Expand Down Expand Up @@ -84,49 +130,3 @@ async function editText() {

editText()
```
## Generate

Generate an image from prompt


[https://m3o.com/ai/api#Generate](https://m3o.com/ai/api#Generate)

```js
const { AiService } = require('m3o/ai');

const aiService = new AiService(process.env.M3O_API_TOKEN)

// Generate an image from prompt
async function generateImage() {
const rsp = await aiService.generate({
"text": "a cat on a ball"
})
console.log(rsp)

}

generateImage()
```
## Moderate

Moderate hate speech


[https://m3o.com/ai/api#Moderate](https://m3o.com/ai/api#Moderate)

```js
const { AiService } = require('m3o/ai');

const aiService = new AiService(process.env.M3O_API_TOKEN)

// Moderate hate speech
async function moderateHateSpeech() {
const rsp = await aiService.moderate({
"text": "I want to kill him"
})
console.log(rsp)

}

moderateHateSpeech()
```
150 changes: 75 additions & 75 deletions examples/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/App/api](https

Endpoints:

## Status
## Get

Get the status of an app
Get an app by name


[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status)
[https://m3o.com/app/api#Get](https://m3o.com/app/api#Get)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Get the status of an app
async function getTheStatusOfAnApp() {
const rsp = await appService.status({
// Get an app by name
async function getAnApp() {
const rsp = await appService.get({
"name": "helloworld"
})
console.log(rsp)

}

getTheStatusOfAnApp()
getAnApp()
```
## Update

Expand All @@ -50,188 +50,188 @@ async function updateAnApp() {

updateAnApp()
```
## Delete
## Logs

Delete an app
Get the logs for an app


[https://m3o.com/app/api#Delete](https://m3o.com/app/api#Delete)
[https://m3o.com/app/api#Logs](https://m3o.com/app/api#Logs)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Delete an app
async function deleteAnApp() {
const rsp = await appService.delete({
// Get the logs for an app
async function retrieveBuildLogsForAnApp() {
const rsp = await appService.logs({
"logs_type": "build",
"name": "helloworld"
})
console.log(rsp)

}

deleteAnApp()
retrieveBuildLogsForAnApp()
```
## Reserve
## Regions

Reserve app names
Return the support regions


[https://m3o.com/app/api#Reserve](https://m3o.com/app/api#Reserve)
[https://m3o.com/app/api#Regions](https://m3o.com/app/api#Regions)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Reserve app names
async function reserveAppName() {
const rsp = await appService.reserve({
"name": "helloworld"
})
// Return the support regions
async function listRegions() {
const rsp = await appService.regions({})
console.log(rsp)

}

reserveAppName()
listRegions()
```
## List
## Status

List all the apps
Get the status of an app


[https://m3o.com/app/api#List](https://m3o.com/app/api#List)
[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// List all the apps
async function listTheApps() {
const rsp = await appService.list({})
// Get the status of an app
async function getTheStatusOfAnApp() {
const rsp = await appService.status({
"name": "helloworld"
})
console.log(rsp)

}

listTheApps()
getTheStatusOfAnApp()
```
## Run
## Resolve

Run an app from source
Resolve an app by id to its raw backend endpoint


[https://m3o.com/app/api#Run](https://m3o.com/app/api#Run)
[https://m3o.com/app/api#Resolve](https://m3o.com/app/api#Resolve)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Run an app from source
async function runAnApp() {
const rsp = await appService.run({
"branch": "master",
"name": "helloworld",
"port": 8080,
"region": "europe-west1",
"repo": "github.com/asim/helloworld"
// Resolve an app by id to its raw backend endpoint
async function resolveAppById() {
const rsp = await appService.resolve({
"id": "helloworld"
})
console.log(rsp)

}

runAnApp()
resolveAppById()
```
## Regions
## Delete

Return the support regions
Delete an app


[https://m3o.com/app/api#Regions](https://m3o.com/app/api#Regions)
[https://m3o.com/app/api#Delete](https://m3o.com/app/api#Delete)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Return the support regions
async function listRegions() {
const rsp = await appService.regions({})
// Delete an app
async function deleteAnApp() {
const rsp = await appService.delete({
"name": "helloworld"
})
console.log(rsp)

}

listRegions()
deleteAnApp()
```
## Resolve
## Reserve

Resolve an app by id to its raw backend endpoint
Reserve app names


[https://m3o.com/app/api#Resolve](https://m3o.com/app/api#Resolve)
[https://m3o.com/app/api#Reserve](https://m3o.com/app/api#Reserve)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Resolve an app by id to its raw backend endpoint
async function resolveAppById() {
const rsp = await appService.resolve({
"id": "helloworld"
// Reserve app names
async function reserveAppName() {
const rsp = await appService.reserve({
"name": "helloworld"
})
console.log(rsp)

}

resolveAppById()
reserveAppName()
```
## Logs
## List

Get the logs for an app
List all the apps


[https://m3o.com/app/api#Logs](https://m3o.com/app/api#Logs)
[https://m3o.com/app/api#List](https://m3o.com/app/api#List)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Get the logs for an app
async function retrieveBuildLogsForAnApp() {
const rsp = await appService.logs({
"logs_type": "build",
"name": "helloworld"
})
// List all the apps
async function listTheApps() {
const rsp = await appService.list({})
console.log(rsp)

}

retrieveBuildLogsForAnApp()
listTheApps()
```
## Get
## Run

Get an app by name
Run an app from source


[https://m3o.com/app/api#Get](https://m3o.com/app/api#Get)
[https://m3o.com/app/api#Run](https://m3o.com/app/api#Run)

```js
const { AppService } = require('m3o/app');

const appService = new AppService(process.env.M3O_API_TOKEN)

// Get an app by name
async function getAnApp() {
const rsp = await appService.get({
"name": "helloworld"
// Run an app from source
async function runAnApp() {
const rsp = await appService.run({
"branch": "master",
"name": "helloworld",
"port": 8080,
"region": "europe-west1",
"repo": "github.com/asim/helloworld"
})
console.log(rsp)

}

getAnApp()
runAnApp()
```

0 comments on commit ec9c73f

Please sign in to comment.