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 27, 2023
1 parent 185dd92 commit 5582cba
Show file tree
Hide file tree
Showing 29 changed files with 1,215 additions and 1,195 deletions.
148 changes: 74 additions & 74 deletions examples/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,211 +27,211 @@ async function getAnApp() {

getAnApp()
```
## List
## Regions

List all the apps
Return the support regions


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

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

}

listTheApps()
listRegions()
```
## Run
## Status

Run an app from source
Get the status of an app


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

// 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 status of an app
async function getTheStatusOfAnApp() {
const rsp = await appService.status({
"name": "helloworld"
})
console.log(rsp)

}

runAnApp()
getTheStatusOfAnApp()
```
## Regions
## Update

Return the support regions
Update the app. The latest source code will be downloaded, built and deployed.


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

```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({})
// Update the app. The latest source code will be downloaded, built and deployed.
async function updateAnApp() {
const rsp = await appService.update({
"name": "helloworld"
})
console.log(rsp)

}

listRegions()
updateAnApp()
```
## Update
## Reserve

Update the app. The latest source code will be downloaded, built and deployed.
Reserve app names


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

// Update the app. The latest source code will be downloaded, built and deployed.
async function updateAnApp() {
const rsp = await appService.update({
// Reserve app names
async function reserveAppName() {
const rsp = await appService.reserve({
"name": "helloworld"
})
console.log(rsp)

}

updateAnApp()
reserveAppName()
```
## Delete
## List

Delete an app
List all the apps


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

// Delete an app
async function deleteAnApp() {
const rsp = await appService.delete({
"name": "helloworld"
})
// List all the apps
async function listTheApps() {
const rsp = await appService.list({})
console.log(rsp)

}

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

Get the logs for an app
Run an app from source


[https://m3o.com/app/api#Logs](https://m3o.com/app/api#Logs)
[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 the logs for an app
async function retrieveBuildLogsForAnApp() {
const rsp = await appService.logs({
"logs_type": "build",
"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)

}

retrieveBuildLogsForAnApp()
runAnApp()
```
## Reserve
## Resolve

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


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

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

}

reserveAppName()
resolveAppById()
```
## Status
## Delete

Get the status of an app
Delete an app


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

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

}

getTheStatusOfAnApp()
deleteAnApp()
```
## Resolve
## Logs

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


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

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

}

resolveAppById()
retrieveBuildLogsForAnApp()
```
46 changes: 23 additions & 23 deletions examples/cache/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/Cache/api](htt

Endpoints:

## Get

Get an item from the cache by key. If key is not found, an empty response is returned.


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

```js
const { CacheService } = require('m3o/cache');

const cacheService = new CacheService(process.env.M3O_API_TOKEN)

// Get an item from the cache by key. If key is not found, an empty response is returned.
async function getAvalue() {
const rsp = await cacheService.get({
"key": "foo"
})
console.log(rsp)

}

getAvalue()
```
## Delete

Delete a value from the cache. If key not found a success response is returned.
Expand Down Expand Up @@ -120,26 +143,3 @@ async function setAvalue() {

setAvalue()
```
## Get

Get an item from the cache by key. If key is not found, an empty response is returned.


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

```js
const { CacheService } = require('m3o/cache');

const cacheService = new CacheService(process.env.M3O_API_TOKEN)

// Get an item from the cache by key. If key is not found, an empty response is returned.
async function getAvalue() {
const rsp = await cacheService.get({
"key": "foo"
})
console.log(rsp)

}

getAvalue()
```

0 comments on commit 5582cba

Please sign in to comment.