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 6, 2023
1 parent ec105d6 commit 8c5ea72
Show file tree
Hide file tree
Showing 27 changed files with 1,121 additions and 1,100 deletions.
12 changes: 11 additions & 1 deletion examples/ai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ const aiService = new AiService(process.env.M3O_API_TOKEN)
// Make a request to ChatGPT
async function chatWithChatGpt() {
const rsp = await aiService.chat({
"context": [
{
"prompt": "who is leonardo davinci",
"reply": "Leonardo da Vinci was an Italian polymath during the Renaissance period. He was born in 1452 in Vinci, Italy, and is renowned for his contributions to various fields such as science, engineering, art, and anatomy. Da Vinci's most famous works include the Mona Lisa and The Last Supper. He is often considered one of the greatest artists and thinkers of all time."
},
{
"prompt": "where is he from?",
"reply": "Leonardo da Vinci was from Vinci, a town in Tuscany, Italy."
}
],
"model": "gpt-3.5-turbo",
"prompt": "who is leonardo davinci"
"prompt": "when did he die?"
})
console.log(rsp)

Expand Down
13 changes: 12 additions & 1 deletion examples/ai/chat/chatWithChatGpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@ const m3o = require('m3o').default(process.env.M3O_API_TOKEN)

async function main() {
let rsp = await m3o.ai.chat({
context: [
{
prompt: 'who is leonardo davinci',
reply:
"Leonardo da Vinci was an Italian polymath during the Renaissance period. He was born in 1452 in Vinci, Italy, and is renowned for his contributions to various fields such as science, engineering, art, and anatomy. Da Vinci's most famous works include the Mona Lisa and The Last Supper. He is often considered one of the greatest artists and thinkers of all time."
},
{
prompt: 'where is he from?',
reply: 'Leonardo da Vinci was from Vinci, a town in Tuscany, Italy.'
}
],
model: 'gpt-3.5-turbo',
prompt: 'who is leonardo davinci'
prompt: 'when did he die?'
})
console.log(rsp)
}
Expand Down
94 changes: 47 additions & 47 deletions examples/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,95 +4,98 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/App/api](https

Endpoints:

## Reserve
## Logs

Reserve app names
Get the logs for an app


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

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

}

reserveAppName()
retrieveBuildLogsForAnApp()
```
## List
## Reserve

List all the apps
Reserve app names


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

// List all the apps
async function listTheApps() {
const rsp = await appService.list({})
// Reserve app names
async function reserveAppName() {
const rsp = await appService.reserve({
"name": "helloworld"
})
console.log(rsp)

}

listTheApps()
reserveAppName()
```
## 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()
```
## Resolve
## Status

Resolve an app by id to its raw backend endpoint
Get the status of an app


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

// Resolve an app by id to its raw backend endpoint
async function resolveAppById() {
const rsp = await appService.resolve({
"id": "helloworld"
// Get the status of an app
async function getTheStatusOfAnApp() {
const rsp = await appService.status({
"name": "helloworld"
})
console.log(rsp)

}

resolveAppById()
getTheStatusOfAnApp()
```
## Update

Expand Down Expand Up @@ -140,28 +143,26 @@ async function deleteAnApp() {

deleteAnApp()
```
## Get
## List

Get an app by name
List all the apps


[https://m3o.com/app/api#Get](https://m3o.com/app/api#Get)
[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 an app by name
async function getAnApp() {
const rsp = await appService.get({
"name": "helloworld"
})
// List all the apps
async function listTheApps() {
const rsp = await appService.list({})
console.log(rsp)

}

getAnApp()
listTheApps()
```
## Run

Expand Down Expand Up @@ -211,27 +212,26 @@ async function listRegions() {

listRegions()
```
## Logs
## Resolve

Get the logs for an app
Resolve an app by id to its raw backend endpoint


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

// Get the logs for an app
async function retrieveBuildLogsForAnApp() {
const rsp = await appService.logs({
"logs_type": "build",
"name": "helloworld"
// Resolve an app by id to its raw backend endpoint
async function resolveAppById() {
const rsp = await appService.resolve({
"id": "helloworld"
})
console.log(rsp)

}

retrieveBuildLogsForAnApp()
resolveAppById()
```
46 changes: 23 additions & 23 deletions examples/bitcoin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Bitcoin/api](h

Endpoints:

## Price

Get the price of bitcoin


[https://m3o.com/bitcoin/api#Price](https://m3o.com/bitcoin/api#Price)

```js
const { BitcoinService } = require('m3o/bitcoin');

const bitcoinService = new BitcoinService(process.env.M3O_API_TOKEN)

// Get the price of bitcoin
async function getBitcoinPrice() {
const rsp = await bitcoinService.price({
"symbol": "USD"
})
console.log(rsp)

}

getBitcoinPrice()
```
## Balance

Get the BTC balance of an address
Expand Down Expand Up @@ -73,26 +96,3 @@ async function getAbitcoinTransaction() {

getAbitcoinTransaction()
```
## Price

Get the price of bitcoin


[https://m3o.com/bitcoin/api#Price](https://m3o.com/bitcoin/api#Price)

```js
const { BitcoinService } = require('m3o/bitcoin');

const bitcoinService = new BitcoinService(process.env.M3O_API_TOKEN)

// Get the price of bitcoin
async function getBitcoinPrice() {
const rsp = await bitcoinService.price({
"symbol": "USD"
})
console.log(rsp)

}

getBitcoinPrice()
```

0 comments on commit 8c5ea72

Please sign in to comment.