Giter Site home page Giter Site logo

lithium's Introduction

Wire™

Wire logo

Lithium

Build Status

  • Lithium is Wire Services SDK written in Java

How to use it to build your bots?

  • In your pom.xml:
<repositories>
    <repository>
        <id>lithium</id>
        <url>https://packagecloud.io/dkovacevic/lithium/maven2</url>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.wire</groupId>
        <artifactId>lithium</artifactId>
        <version>3.0.3</version>
    </dependency>
<dependencies>

If you want to use Version resource (API endpoint), you must create version file during the build. For example, during the Docker build, one can put following code inside Dockerfile:

# create version file
ARG release_version=development
ENV RELEASE_FILE_PATH=/path/to/release.txt
RUN echo $release_version > $RELEASE_FILE_PATH

And than add build argument ie. in the build pipeline like that.

Tutorial:

Bot API Documentation

How to build the project

Requirements:

To build the library, run:

mvn install

How to register your service with Wire

The manage.sh script helps you register as a service provider, create a certificate, and register your service instance.

Script requirements

How to use the script

In order to register a service, you need to generate a certificate (or bring your own), register as a provider and then register the service.

Using the manage.sh script:

  • Register as a provider with manage.sh new-provider. If everything goes well, the response will contain a password and provider ID, and you should get an email. Open the email and follow the link in the email to confirm your identity. You need to do this only once, even when developing multiple services. This will save the credentials in the local folder, for further authentication.
  • If you don't have a certificate already, create a new certificate with manage.sh new-cert and follow the instructions. This needs to match the certificate that is used for the SSL termination on your service.
  • Deploy your service and make it accessible by public IP, using HTTPS and the certificate you created at step one.
  • Obtain an authentication token with manage.sh auth-provider. This is a temporary token to perform authenticated requests, and will need to be refreshed periodically if you don't use the script for more than 10 minutes.
  • Register a new service with manage.sh new-service and enter the required information. Make sure the base URL is an https URL. You will receive an service auth token.
  • Once a server is created, you can update it with manage.sh update-service.
  • Edit the YAML configuration file of your service and add the service token you received at the previous step.
  • (Re)-start the service with the new configuration file.
  • Activate the service with manage.sh update-service-conn to make it enabled

Use Hello World sample service as your first service

Environment variables used:

  • WIRE_API_HOST: Wire Backend. https://prod-nginz-https.wire.com by default
  • SERVICE_TOKEN: Your service authentication token. All requests sent by the BE will have this token as Bearer Authorization HTTP header

Logging to JSON

Wire uses JSON logging in the production. To enable JSON logging one must specify json-console appender in the Dropwizard yaml.

logging:
  appenders:
    - type: json-console

Other examples of Wire Services

Other implementations of Bot API

lithium's People

Contributors

dkovacevic avatar marcoconti83 avatar lukasforst avatar mythsunwind avatar m3nix avatar siimteller avatar dependabot[bot] avatar ech0-de avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.