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 16, 2023
1 parent d5cd18e commit e29eee3
Show file tree
Hide file tree
Showing 27 changed files with 1,151 additions and 1,151 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:

## Complete

Make a request to the AI


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

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

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

// Make a request to the AI
async function completeTheText() {
const rsp = await aiService.complete({
"text": "who is leonardo davinci"
})
console.log(rsp)

}

completeTheText()
```
## Edit

Edit or edit prompt/code


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

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

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

// Edit or edit prompt/code
async function editText() {
const rsp = await aiService.edit({
"text": "What day of the wek is it?"
})
console.log(rsp)

}

editText()
```
## Generate

Generate an image from prompt
Expand Down Expand Up @@ -84,49 +130,3 @@ async function chatWithChatGpt() {

chatWithChatGpt()
```
## Complete

Make a request to the AI


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

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

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

// Make a request to the AI
async function completeTheText() {
const rsp = await aiService.complete({
"text": "who is leonardo davinci"
})
console.log(rsp)

}

completeTheText()
```
## Edit

Edit or edit prompt/code


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

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

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

// Edit or edit prompt/code
async function editText() {
const rsp = await aiService.edit({
"text": "What day of the wek is it?"
})
console.log(rsp)

}

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

Endpoints:

## Regions

Return the support regions


[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)

// Return the support regions
async function listRegions() {
const rsp = await appService.regions({})
console.log(rsp)

}

listRegions()
```
## Logs
## Get

Get the logs for an app
Get an app by name


[https://m3o.com/app/api#Logs](https://m3o.com/app/api#Logs)
[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 logs for an app
async function retrieveBuildLogsForAnApp() {
const rsp = await appService.logs({
"logs_type": "build",
// Get an app by name
async function getAnApp() {
const rsp = await appService.get({
"name": "helloworld"
})
console.log(rsp)

}

retrieveBuildLogsForAnApp()
getAnApp()
```
## Reserve
## Run

Reserve app names
Run an app from source


[https://m3o.com/app/api#Reserve](https://m3o.com/app/api#Reserve)
[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)

// Reserve app names
async function reserveAppName() {
const rsp = await appService.reserve({
"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)

}

reserveAppName()
runAnApp()
```
## Get
## Status

Get an app by name
Get the status of an app


[https://m3o.com/app/api#Get](https://m3o.com/app/api#Get)
[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)

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

}

getAnApp()
getTheStatusOfAnApp()
```
## List
## Resolve

List all the apps
Resolve an app by id to its raw backend endpoint


[https://m3o.com/app/api#List](https://m3o.com/app/api#List)
[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)

// List all the apps
async function listTheApps() {
const rsp = await appService.list({})
// Resolve an app by id to its raw backend endpoint
async function resolveAppById() {
const rsp = await appService.resolve({
"id": "helloworld"
})
console.log(rsp)

}

listTheApps()
resolveAppById()
```
## Update

Expand Down Expand Up @@ -162,76 +146,92 @@ async function deleteAnApp() {

deleteAnApp()
```
## Run
## Logs

Run an app from source
Get the logs for an app


[https://m3o.com/app/api#Run](https://m3o.com/app/api#Run)
[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)

// 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"
// Get the logs for an app
async function retrieveBuildLogsForAnApp() {
const rsp = await appService.logs({
"logs_type": "build",
"name": "helloworld"
})
console.log(rsp)

}

runAnApp()
retrieveBuildLogsForAnApp()
```
## Status
## Reserve

Get the status of an app
Reserve app names


[https://m3o.com/app/api#Status](https://m3o.com/app/api#Status)
[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)

// Get the status of an app
async function getTheStatusOfAnApp() {
const rsp = await appService.status({
// Reserve app names
async function reserveAppName() {
const rsp = await appService.reserve({
"name": "helloworld"
})
console.log(rsp)

}

getTheStatusOfAnApp()
reserveAppName()
```
## Resolve
## List

Resolve an app by id to its raw backend endpoint
List all the apps


[https://m3o.com/app/api#Resolve](https://m3o.com/app/api#Resolve)
[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)

// Resolve an app by id to its raw backend endpoint
async function resolveAppById() {
const rsp = await appService.resolve({
"id": "helloworld"
})
// List all the apps
async function listTheApps() {
const rsp = await appService.list({})
console.log(rsp)

}

resolveAppById()
listTheApps()
```
## Regions

Return the support regions


[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)

// Return the support regions
async function listRegions() {
const rsp = await appService.regions({})
console.log(rsp)

}

listRegions()
```
Loading

0 comments on commit e29eee3

Please sign in to comment.