Skip to content

matchbook-technology/matchbook-sdk

Repository files navigation

MBSDK_onlight

Matchbook SDK

This library is under development and no stable version has been released yet. The API can change at any moment.

CircleCI Codacy Badge Codacy Badge

Gitter chat GitHub license Open Source Love svg2

Features

  • High performance: we take efficiency very seriously
  • Full support to Matchbook REST API: all Matchbook powerful REST API is implemented in the SDK
  • Session management: user sessions are managed automatically
  • Configurable: we provide a number of configuration options to control the SDK behaviour at runtime
  • Multi-platform: all Java 8+ versions are supported

Getting started

event-animation

Maven dependency

You should update your pom.xml to pull SNAPSHOT version from Sonatype Release Repository (OSSRH).

    <repositories>
        <repository>
            <id>oss.sonatype.org-snapshot</id>
            <url>http://oss.sonatype.org/content/repositories/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

Examples

Configure ConnectionManager

    ClientConfig clientConfig = new ClientConfig.Builder("my-username".toCharArray(), "my-password".toCharArray()).build();
    ConnectionManager connectionManager = new ConnectionManager.Builder(clientConfig).build();

Get events

    new EventsClientRest(connectionManager).getEvents(new EventsRequest.Builder().build(),
            new StreamObserver<Event>() {
                    @Override
                    public void onNext(Event event) {
                        // add your business logic here
                    }
                    @Override
                    public void onCompleted() {
                        // all messages successfully processed
                    }
                    @Override
                    public <E extends MatchbookSDKException> void onError(E error) {
                        // handle error
                    }
            });

Submit multiple offers

    OfferPostRequest offerPostRequest = new OfferPostRequest.Builder(
            1295512601550017L,
            Side.BACK,
            new BigDecimal("2.5"),
            new BigDecimal("100")
    ).build();
    List<OfferPostRequest> offers = new ArrayList();
    offers.add(offerPostRequest);
    OffersPostRequest offersPostRequest = new OffersPostRequest.Builder(
            OddsType.DECIMAL,
            ExchangeType.BACK_LAY,
            offers
    ).build();

    new OffersClientRest(connectionManager).submitOffers(offersPostRequest,
            new StreamObserver<Offer>() {
                    @Override
                    public void onNext(Offer offer) {
                        // add your business logic here
                    }
                    @Override
                    public void onCompleted() {
                        // all messages successfully processed
                    }
                    @Override
                    public <E extends MatchbookSDKException> void onError(E error) {
                        // handle error
                    }
            });

Cancel offer

    new OffersClientRest(connectionManager).cancelOffer(new OfferDeleteRequest.Builder(1000L).build(),
            new StreamObserver<Offer>() {
                    @Override
                    public void onNext(Offer offer) {
                        // add your business logic here
                    }
                    @Override
                    public void onCompleted() {
                        // all messages successfully processed
                    }
                    @Override
                    public <E extends MatchbookSDKException> void onError(E error) {
                        // handle error
                    }
            });

Core modules

Built with

  • okhttp - An efficient HTTP client
  • jackson - JSON serialisation/deserialisation
  • slf4j - Logging facade for Java
  • maven - Dependency management system

How to contribute

Please, read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests to us.

Code style

Please, use our custom Code Style when contribute to the MB-SDK project.

Pull requests are welcome

Spotted an error? Something doesn't make sense? Send a pull request! Please avoid making stylistic changes, though. They are unlikely to be accepted. Thanks!

License

    MIT License

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.

Releases

No releases published

Packages

No packages published

Languages