Skip to content

Commit

Permalink
Generated clients
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilunwired committed Mar 7, 2019
1 parent bf1b11f commit a982866
Show file tree
Hide file tree
Showing 1,133 changed files with 89,167 additions and 12 deletions.
14 changes: 2 additions & 12 deletions README.md
Expand Up @@ -21,7 +21,7 @@ r | no |
ruby | no |
rust | no |
scala | no |
swift4 | yes |
swift4 | no |

## Supported APIs

Expand All @@ -34,15 +34,5 @@ Currently the following APIs are supported


## Specification file:
The `ul_api_spec_openapi3_v2_0_0` contains the specifiation of our LocationAPI. It is written in OpenAPI 3.0.
The `ul_api_spec_openapi3_v2_0_0` contains the specifiation of LocationAPI. It is written in OpenAPI 3.0.

## Generate libraries:
The script `create.sh` is used generate libraries in various languages.

### Update all clients

./create.sh

### Update one client of your choice

./create.sh [yourlanguage]
12 changes: 12 additions & 0 deletions clients/clojure/.gitignore
@@ -0,0 +1,12 @@
pom.xml
pom.xml.asc
*jar
/lib/
/classes/
/target/
/checkouts/
.lein-deps-sum
.lein-repl-history
.lein-plugins/
.lein-failures
.nrepl-port
23 changes: 23 additions & 0 deletions clients/clojure/.openapi-generator-ignore
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
1 change: 1 addition & 0 deletions clients/clojure/.openapi-generator/VERSION
@@ -0,0 +1 @@
3.3.4
52 changes: 52 additions & 0 deletions clients/clojure/git_push.sh
@@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"

git_user_id=$1
git_repo_id=$2
release_note=$3

if [ "$git_user_id" = "" ]; then
git_user_id="unwiredlabs"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi

if [ "$git_repo_id" = "" ]; then
git_repo_id="unwired-clojure-client"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi

if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi

# Initialize the local directory as a Git repository
git init

# Adds the files in the local repository and stages them for commit.
git add .

# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"

# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined

if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi

fi

git pull origin master

# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

5 changes: 5 additions & 0 deletions clients/clojure/project.clj
@@ -0,0 +1,5 @@
(defproject location-api "2.0.0"
:description "Geolocation, Geocoding and Maps"
:dependencies [[org.clojure/clojure "1.7.0"]
[clj-http "3.6.0"]
[cheshire "5.5.0"]])
23 changes: 23 additions & 0 deletions clients/clojure/src/location_api/api/balance.clj
@@ -0,0 +1,23 @@
(ns location-api.api.balance
(:require [location-api.core :refer [call-api check-required-params with-collection-format]])
(:import (java.io File)))

(defn balance-with-http-info
"balance
The Balance API provides a count of request credits left in the user's account for the day. Balance is reset at midnight UTC everyday (00:00 UTC)."
[]
(call-api "/balance.php" :get
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:content-types []
:accepts ["application/json"]
:auth-names ["token"]}))

(defn balance
"balance
The Balance API provides a count of request credits left in the user's account for the day. Balance is reset at midnight UTC everyday (00:00 UTC)."
[]
(:data (balance-with-http-info)))

25 changes: 25 additions & 0 deletions clients/clojure/src/location_api/api/geolocation.clj
@@ -0,0 +1,25 @@
(ns location-api.api.geolocation
(:require [location-api.core :refer [call-api check-required-params with-collection-format]])
(:import (java.io File)))

(defn geolocation-with-http-info
"Geolocation
The Geolocation API helps developers locate IoT, M2M and other connected devices anywhere in the world without GPS. The device first sends the API data about which Cellular networks and WiFi networks it can see nearby. The API then uses Unwired Labs’ large datasets of Cell towers, WiFi networks backed by numerous algorithms to calculate and return the device’s location"
[geolocation-schema ]
(check-required-params geolocation-schema)
(call-api "/process.php" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param geolocation-schema
:content-types ["application/json"]
:accepts ["application/json"]
:auth-names []}))

(defn geolocation
"Geolocation
The Geolocation API helps developers locate IoT, M2M and other connected devices anywhere in the world without GPS. The device first sends the API data about which Cellular networks and WiFi networks it can see nearby. The API then uses Unwired Labs’ large datasets of Cell towers, WiFi networks backed by numerous algorithms to calculate and return the device’s location"
[geolocation-schema ]
(:data (geolocation-with-http-info geolocation-schema)))

26 changes: 26 additions & 0 deletions clients/clojure/src/location_api/api/reverse.clj
@@ -0,0 +1,26 @@
(ns location-api.api.reverse
(:require [location-api.core :refer [call-api check-required-params with-collection-format]])
(:import (java.io File)))

(defn reverse-with-http-info
"Reverse Geocoding
Reverse geocoding is the process of converting a coordinate or location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places, and/or area subdivisions such as a neighborhood, county, state, or country."
([lat lon ] (reverse-with-http-info lat lon nil))
([lat lon {:keys [zoom accept-language ]}]
(check-required-params lat lon)
(call-api "/reverse.php" :get
{:path-params {}
:header-params {}
:query-params {"lat" lat "lon" lon "zoom" zoom "accept-language" accept-language }
:form-params {}
:content-types []
:accepts ["application/json"]
:auth-names ["token"]})))

(defn reverse
"Reverse Geocoding
Reverse geocoding is the process of converting a coordinate or location (latitude, longitude) to a readable address or place name. This permits the identification of nearby street addresses, places, and/or area subdivisions such as a neighborhood, county, state, or country."
([lat lon ] (reverse lat lon nil))
([lat lon optional-params]
(:data (reverse-with-http-info lat lon optional-params))))

26 changes: 26 additions & 0 deletions clients/clojure/src/location_api/api/search.clj
@@ -0,0 +1,26 @@
(ns location-api.api.search
(:require [location-api.core :refer [call-api check-required-params with-collection-format]])
(:import (java.io File)))

(defn search-with-http-info
"Forward Geocoding
The Search API allows converting addresses, such as a street address, into geographic coordinates (latitude and longitude). These coordinates can serve various use-cases, from placing markers on a map to helping algorithms determine nearby bus stops. This process is also known as Forward Geocoding."
([q ] (search-with-http-info q nil))
([q {:keys [viewbox limit accept-language countrycodes ]}]
(check-required-params q)
(call-api "/search.php" :get
{:path-params {}
:header-params {}
:query-params {"q" q "viewbox" viewbox "limit" limit "accept-language" accept-language "countrycodes" countrycodes }
:form-params {}
:content-types []
:accepts ["application/json"]
:auth-names ["token"]})))

(defn search
"Forward Geocoding
The Search API allows converting addresses, such as a street address, into geographic coordinates (latitude and longitude). These coordinates can serve various use-cases, from placing markers on a map to helping algorithms determine nearby bus stops. This process is also known as Forward Geocoding."
([q ] (search q nil))
([q optional-params]
(:data (search-with-http-info q optional-params))))

24 changes: 24 additions & 0 deletions clients/clojure/src/location_api/api/timezone.clj
@@ -0,0 +1,24 @@
(ns location-api.api.timezone
(:require [location-api.core :refer [call-api check-required-params with-collection-format]])
(:import (java.io File)))

(defn timezone-with-http-info
"timezone
The Unwired Labs TimeZone API provides time offset data for locations on the surface of the earth."
[lat lon ]
(check-required-params lat lon)
(call-api "/timezone.php" :get
{:path-params {}
:header-params {}
:query-params {"lat" lat "lon" lon }
:form-params {}
:content-types []
:accepts ["application/json"]
:auth-names ["token"]}))

(defn timezone
"timezone
The Unwired Labs TimeZone API provides time offset data for locations on the surface of the earth."
[lat lon ]
(:data (timezone-with-http-info lat lon)))

0 comments on commit a982866

Please sign in to comment.