mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-21 15:05:01 +00:00
Generate clients (#206)
This commit is contained in:
8
examples/rss/add/curl/addANewFeed.sh
Executable file
8
examples/rss/add/curl/addANewFeed.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
curl "https://api.m3o.com/v1/rss/Add" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"category": "news",
|
||||
"name": "bbc",
|
||||
"url": "http://feeds.bbci.co.uk/news/rss.xml"
|
||||
}'
|
||||
18
examples/rss/add/go/addANewFeed.go
Executable file
18
examples/rss/add/go/addANewFeed.go
Executable file
@@ -0,0 +1,18 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/rss"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Add a new RSS feed with a name, url, and category
|
||||
func AddAnewFeed() {
|
||||
rssService := rss.NewRssService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := rssService.Add(&rss.AddRequest{
|
||||
Category: "news",
|
||||
Name: "bbc",
|
||||
Url: "http://feeds.bbci.co.uk/news/rss.xml",
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
14
examples/rss/add/node/addANewFeed.js
Executable file
14
examples/rss/add/node/addANewFeed.js
Executable file
@@ -0,0 +1,14 @@
|
||||
import * as rss from "m3o/rss";
|
||||
|
||||
// Add a new RSS feed with a name, url, and category
|
||||
async function AddAnewFeed() {
|
||||
let rssService = new rss.RssService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await rssService.add({
|
||||
category: "news",
|
||||
name: "bbc",
|
||||
url: "http://feeds.bbci.co.uk/news/rss.xml",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await AddAnewFeed();
|
||||
Reference in New Issue
Block a user