geogig

Client library for geogig server

Usage no npm install needed!

<script type="module">
  import geogig from 'https://cdn.skypack.dev/geogig';
</script>

README

geogig

Geogig - JavaScript client for geogig GeoGig Web API. You can find out more about GeoGig at http://geogig.org This SDK is automatically generated by the Swagger Codegen project:

  • API version: 0.1.0
  • Package version: 0.1-SNAPSHOT
  • Build date: 2018-03-08T17:05:29.376-08:00
  • Build package: io.swagger.codegen.languages.JavascriptClientCodegen

Installation

For Node.js

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install geogig --save
Local development

To use the library locally without publishing to a remote npm registry, first install the dependencies by changing into the directory containing package.json (and this README). Let's call this JAVASCRIPT_CLIENT_DIR. Then run:

npm install

Next, link it globally in npm with the following, also from JAVASCRIPT_CLIENT_DIR:

npm link

Finally, switch to the directory you want to use your geogig from, and run:

npm link /path/to/<JAVASCRIPT_CLIENT_DIR>

You should now be able to require('geogig') in javascript files from the directory you ran the last command above from.

git

If the library is hosted at a git repository, e.g. https://github.com/GIT_USER_ID/GIT_REPO_ID then install it via:

    npm install GIT_USER_ID/GIT_REPO_ID --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file, that's to say your javascript file where you actually use this library):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Webpack Configuration

Using Webpack you may encounter the following error: "Module not found: Error: Cannot resolve module", most certainly you should disable AMD loader. Add/merge the following section to your webpack config:

module: {
  rules: [
    {
      parser: {
        amd: false
      }
    }
  ]
}

Getting Started

Please follow the installation instruction and execute the following JS code:

var Geogig = require('geogig');

var defaultClient = Geogig.ApiClient.instance;

// Configure API key authorization: ApiKeyAuth
var ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = "YOUR API KEY"
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix['X-GeoGig-API-Key'] = "Token"

// Configure HTTP basic authorization: BasicAuth
var BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME'
BasicAuth.password = 'YOUR PASSWORD'

// Configure OAuth2 access token for authorization: OAuth2
var OAuth2 = defaultClient.authentications['OAuth2'];
OAuth2.accessToken = "YOUR ACCESS TOKEN"

var api = new Geogig.AsyncApi()

var taskId = "taskId_example"; // {String} Async task identifier

api.abortTask(taskId).then(function(data) {
  console.log('API called successfully. Returned data: ' + data);
}, function(error) {
  console.error(error);
});


Documentation for API Endpoints

All URIs are relative to http://virtserver.swaggerhub.com/groldan/geogig-web/1.0.0

Class Method HTTP request Description
Geogig.AsyncApi abortTask POST /tasks/{taskId}/abort Abort a running or scheduled task
Geogig.AsyncApi commitTransaction POST /transactions/{user}/{repo}/{transactionId}/commit Commit transaction. Async operation.
Geogig.AsyncApi forkRepository POST /repos/{user}/{repo}/forks Fork this repository. Async operation.
Geogig.AsyncApi getTaskInfo GET /tasks/{taskId} Access status info for a given task
Geogig.AsyncApi getTaskProgress GET /tasks/{taskId}/progress Get task progress info
Geogig.AsyncApi listTasks GET /tasks List summary information for current asynchronous tasks
Geogig.AsyncApi pruneTask DELETE /tasks/{taskId} Prune a task if finished
Geogig.CollaborationApi checkout POST /repos/{user}/{repo}/branches/{branch}/checkout Checkout this branch
Geogig.CollaborationApi createBranch POST /repos/{user}/{repo}/branches/{branch} Create a new branch by name
Geogig.CollaborationApi createPullRequest POST /repos/{user}/{repo}/pulls Create a pull request
Geogig.CollaborationApi deleteBranch DELETE /repos/{user}/{repo}/branches/{branch} Delete a branch by name
Geogig.CollaborationApi getBranch GET /repos/{user}/{repo}/branches/{branch} Get a branch by name
Geogig.CollaborationApi getCurrentBranch GET /repos/{user}/{repo}/branch Get the currently checked out branch, optionally indicating a transaction
Geogig.CollaborationApi getPullRequest GET /repos/{user}/{repo}/pulls/{pr} Get a specific pull request of this repo by id
Geogig.CollaborationApi listBranches GET /repos/{user}/{repo}/branches List all branches in the current repository
Geogig.CollaborationApi listPullRequests GET /repos/{user}/{repo}/pulls List pull requests issued to this repo
Geogig.FeatureServiceApi addFeatures POST /layers/{user}/{repo}/{layer}/features Iserts features to this collection in the WORK_HEAD. Parameter features can be either a Feature or a FeatureCollection.
Geogig.FeatureServiceApi createLayer POST /layers/{user}/{repo} Create a new layer
Geogig.FeatureServiceApi deleteFeature DELETE /layers/{user}/{repo}/{layer}/features/{featureId} Delete a single feature at the current transaction's branch
Geogig.FeatureServiceApi deleteFeatures POST /layers/{user}/{repo}/{layer}/rpc/delete Delete features matching the given query
Geogig.FeatureServiceApi deleteLayer DELETE /layers/{user}/{repo}/{layer} Delete a Layer from a repository at the current transaction's branch
Geogig.FeatureServiceApi getBounds GET /layers/{user}/{repo}/{layer}/bounds Get layer bounds at the specified transaction/head. If no head is specified, defaults to WORK_HEAD
Geogig.FeatureServiceApi getFeature GET /layers/{user}/{repo}/{layer}/features/{featureId} Get a single feature from a layer given its feature id, at the specified transaction/head
Geogig.FeatureServiceApi getFeatures GET /layers/{user}/{repo}/{layer}/features Get Features from a geogig Layer
Geogig.FeatureServiceApi getLayerHash HEAD /layers/{user}/{repo}/{layer} Get a unique identifier for the current state of the layer.
Geogig.FeatureServiceApi getLayerInfo GET /layers/{user}/{repo}/{layer} Get layer metadata at the specified transaction/head
Geogig.FeatureServiceApi getLayersSummaries GET /layers return a summary of layers per user
Geogig.FeatureServiceApi getSchema GET /layers/{user}/{repo}/{layer}/schema Get Layer schema
Geogig.FeatureServiceApi getSize GET /layers/{user}/{repo}/{layer}/size Get layer's number of features at the specified transaction/head. If no head is specified, defaults to WORK_HEAD
Geogig.FeatureServiceApi getUserLayersSummaries GET /layers/{user} return a summary of this user's layers
Geogig.FeatureServiceApi listLayers GET /layers/{user}/{repo} List layers in a repo
Geogig.FeatureServiceApi modifyFeature PUT /layers/{user}/{repo}/{layer}/features/{featureId} Replace a single feature at the current transaction's branch
Geogig.FeatureServiceApi modifyFeatures POST /layers/{user}/{repo}/{layer}/rpc/update Modifies features matching the given query with the given values, in the WORK_HEAD of the currently checked out branch for the indicated transaction
Geogig.FeatureServiceApi queryFeatures POST /layers/{user}/{repo}/{layer}/rpc/query Query and return features of this layer tha match the specified FeatureQuery
Geogig.FeatureServiceApi truncate DELETE /layers/{user}/{repo}/{layer}/features Deletes all features in the layer
Geogig.FeatureServiceApi updateSchema PUT /layers/{user}/{repo}/{layer}/schema Change Layer schema. Must be called inside a transaction.
Geogig.RawRepositoryAccessApi countConflicts GET /repos/{user}/{repo}/geogig/conflicts/count Get number of conflicts in the repository
Geogig.RawRepositoryAccessApi getAllConfig GET /repos/{user}/{repo}/geogig/config List all config settings in the current repository
Geogig.RawRepositoryAccessApi getCommitGraph GET /repos/{user}/{repo}/geogig/graph
Geogig.RawRepositoryAccessApi getConflicts GET /repos/{user}/{repo}/geogig/conflicts List merge conflicts
Geogig.RawRepositoryAccessApi getObject GET /repos/{user}/{repo}/geogig/objects/{objectId} Download a single revision object from a repository
Geogig.RawRepositoryAccessApi listIndexes GET /repos/{user}/{repo}/geogig/index
Geogig.RawRepositoryAccessApi listRefs GET /repos/{user}/{repo}/geogig/refs List all refs in the current repository
Geogig.RepositoryManagementApi countWatchers GET /repos/{user}/{repo}/watchers/count Number of users watching this repository
Geogig.RepositoryManagementApi createRepository POST /repos/{user}/{repo} Create a new repository
Geogig.RepositoryManagementApi deleteRepository DELETE /repos/{user}/{repo} Delete repository
Geogig.RepositoryManagementApi forkRepository POST /repos/{user}/{repo}/forks Fork this repository. Async operation.
Geogig.RepositoryManagementApi getRepository GET /repos/{user}/{repo} Get full repository information
Geogig.RepositoryManagementApi listForks GET /repos/{user}/{repo}/forks List repositories that are forks of this one
Geogig.RepositoryManagementApi listRepositories GET /repos List repositories summary information
Geogig.RepositoryManagementApi listUserRepositories GET /repos/{user} List of available repositories summary information
Geogig.RepositoryManagementApi listWatchers GET /repos/{user}/{repo}/watchers List users watching this repository
Geogig.RepositoryManagementApi modifyRepository PUT /repos/{user}/{repo} Modify repository
Geogig.RepositoryManagementApi unwatchRepository DELETE /repos/{user}/{repo}/watchers Stop watching this repo.
Geogig.RepositoryManagementApi watchRepository POST /repos/{user}/{repo}/watchers Start watching this repo.
Geogig.RepositoryStoresApi countStoreRepos GET /stores/{store}/repos/count Return the number of repositories held on this store
Geogig.RepositoryStoresApi createStore POST /stores Creates a new repository store
Geogig.RepositoryStoresApi getStore GET /stores/{store} Get repository store info by name
Geogig.RepositoryStoresApi getStores GET /stores List summary information for available collections of repositories. Only stores visible to the current user are listed.
Geogig.RepositoryStoresApi listStoreRepos GET /stores/{store}/repos List summary information for all repositories on this repository store
Geogig.RepositoryStoresApi modifyStore PUT /stores Update repository info
Geogig.RepositoryStoresApi removeStore DELETE /stores/{store} Remove the repository store configuration (disables all repositories on it)
Geogig.ServiceInfoApi getVersion GET /info/version Obtain service version information
Geogig.TransactionManagementApi abortTransaction POST /transactions/{user}/{repo}/{transactionId}/abort Abort transaction. Returns immediately.
Geogig.TransactionManagementApi commitTransaction POST /transactions/{user}/{repo}/{transactionId}/commit Commit transaction. Async operation.
Geogig.TransactionManagementApi deleteTransactionInfo DELETE /transactions/{user}/{repo}/{transactionId} Delete a transaction information that's finished but not yet expired.
Geogig.TransactionManagementApi getTransactionInfo GET /transactions/{user}/{repo}/{transactionId} Obtain the current status of the given transaction
Geogig.TransactionManagementApi listAllTransactions GET /transactions List all non expired transactions open an all the repositories visible to the authenticated user
Geogig.TransactionManagementApi listRepositoryTransactions GET /transactions/{user}/{repo} List all non expired transactions on the given repository
Geogig.TransactionManagementApi listUserTransactions GET /transactions/{user} List all non expired transactions on all the repositories visible to the given user
Geogig.TransactionManagementApi startTransaction POST /transactions/{user}/{repo} Start a new transaction on the given repository
Geogig.UsersApi createUser POST /users Creates a new user
Geogig.UsersApi deleteUser DELETE /users/{user} Delete user
Geogig.UsersApi follow PUT /users/{user}/following/{followee} Follow a user
Geogig.UsersApi follows GET /users/{user}/following/{followee} Test whether :user is a follower of :followee
Geogig.UsersApi getSelf GET /user Get the request's authenticated user info
Geogig.UsersApi getUser GET /users/{user} Obtain either public or public + private user information depending on auth credentials
Geogig.UsersApi getUserRepositories GET /users/{user}/repos List the repositories owned by the given user
Geogig.UsersApi getUsers GET /users List summary information for available collections of repositories. Only stores visible to the current user are listed.
Geogig.UsersApi listFollowers GET /users/{user}/followers List users following the given user
Geogig.UsersApi listFollowing GET /users/{user}/following List of users the given user follows
Geogig.UsersApi modifyUser PUT /users Updates a user info
Geogig.UsersApi resetPassword PUT /users/{user}/password Resets the HTTP Basic password for the user. The request issuer must be either a site admin or the user itself. Note this is a temporary meassure until more advanced auth services are used
Geogig.UsersApi unfollow DELETE /users/{user}/following/{followee} Unfollow a user

Documentation for Models

Documentation for Authorization

ApiKeyAuth

  • Type: API key
  • API key parameter name: X-GeoGig-API-Key
  • Location: HTTP header

BasicAuth

  • Type: HTTP basic authentication

OAuth2

  • Type: OAuth
  • Flow: accessCode
  • Authorization URL: https://example.com/oauth/authorize
  • Scopes:
    • read: Grants read access
    • write: Grants write access
    • admin: Grants read and write access to administrative information