@opengigdb/ogdb-api-lib
TypeScript icon, indicating that this package has built-in type declarations

0.0.13 • Public • Published

openGIGdb API Angular/Typescript Lib

Angular/Typescript library to access the openGIGdb.com API.

Getting Started

You'll need an API Key to access the openGIGdb services.
Create an account, then go to the Developers portal to register an application. This will generate an appKey that you'll use to authorize service calls.

https://opengigdb.com/developers

Be sure to setup a CORS origin for your application. Separate origins with a semicolon. For example:

http://localhost:4200; https://your-amazing-domain.com

Intialization

In your Angular application's startup code, intialize the library. You only need to do this once. The API endpoint listed in apiUri below must be entered exactly as shown. You'll probably want to include these values in environment.ts.

export class AppComponent {

  constructor(protected ogdbService:OgdbService) {
    
    ogdbService.ogdbEnvironment = {
        appPublicKey: "YOUR_APP_KEY",
        apiUri: "https://api.opengigdb.com/v1"
    };
  }
}

Making a Service Call

Here's an example of searching for gigs near you.

export class MyAmazingComponent {

    gigs:Gig[] = [];

    constructor(protected gigService:GigService) {
    }

    public onRefreshGigsNearMe() {

        const myLocation:Coordinate = {
          latitude: pos.coords.latitude,
          longitude: pos.coords.longitude
        };

        const searchGigsRequest:SearchGigsRequest = new SearchGigsRequestBuilder()
                .withCenterPoint( myLocation )
                .withLimt(30)
                .build();

        this.gigService.searchGigs( searchGigsRequest )
            .subscribe({
                next: (gigs) => {
                    this.gigs = gigs;
                },
                error: (err) => {
                    console.log( err.error.message );
                }
            });
    }

}

/@opengigdb/ogdb-api-lib/

    Package Sidebar

    Install

    npm i @opengigdb/ogdb-api-lib

    Weekly Downloads

    0

    Version

    0.0.13

    License

    MIT

    Unpacked Size

    431 kB

    Total Files

    110

    Last publish

    Collaborators

    • opengigdb