mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-20 14:35:07 +00:00
Generate clients (#206)
This commit is contained in:
12
examples/location/search/curl/searchForLocations.sh
Executable file
12
examples/location/search/curl/searchForLocations.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
curl "https://api.m3o.com/v1/location/Search" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"center": {
|
||||
"latitude": 51.511061,
|
||||
"longitude": -0.120022
|
||||
},
|
||||
"numEntities": 10,
|
||||
"radius": 100,
|
||||
"type": "bike"
|
||||
}'
|
||||
22
examples/location/search/go/searchForLocations.go
Executable file
22
examples/location/search/go/searchForLocations.go
Executable file
@@ -0,0 +1,22 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/location"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Search for entities in a given radius
|
||||
func SearchForLocations() {
|
||||
locationService := location.NewLocationService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := locationService.Search(&location.SearchRequest{
|
||||
Center: &location.Point{
|
||||
Latitude: 51.511061,
|
||||
Longitude: -0.120022,
|
||||
},
|
||||
NumEntities: 10,
|
||||
Radius: 100,
|
||||
Type: "bike",
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
20
examples/location/search/node/searchForLocations.js
Executable file
20
examples/location/search/node/searchForLocations.js
Executable file
@@ -0,0 +1,20 @@
|
||||
import * as location from "m3o/location";
|
||||
|
||||
// Search for entities in a given radius
|
||||
async function SearchForLocations() {
|
||||
let locationService = new location.LocationService(
|
||||
process.env.MICRO_API_TOKEN
|
||||
);
|
||||
let rsp = await locationService.search({
|
||||
center: {
|
||||
latitude: 51.511061,
|
||||
longitude: -0.120022,
|
||||
},
|
||||
numEntities: 10,
|
||||
radius: 100,
|
||||
type: "bike",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await SearchForLocations();
|
||||
Reference in New Issue
Block a user