Skip to content
forked from depscloud/api

Repository containing proto api definitions and generated code.

Notifications You must be signed in to change notification settings

MadhuvanthG/api

 
 

Repository files navigation

api

All deps-cloud API definitions consolidated into a single repostory. This repository currenlty produces 2 libraries:

Getting Started with NodeJS

To install:

npm install --save @deps-cloud/api

Usage:

const grpc = require('grpc');

const { DependencyExtractor } = require('@deps-cloud/api/v1alpha/extractor');
const {
    SourceService,
    ModuleService,
    DependencyService,
} = require('@deps-cloud/api/v1alpha/tracker');

const credentials = grpc.credentials.createInsecure();

const dependencyExtractor = new DependencyExtractor('address', credentials);
const sourceService = new SourceService('address', credentials);
const moduleService = new ModuleService('address', credentials);
const dependencyService = new DependencyService('address', credentials);

Getting Started with Go

To install:

go get -u github.com/deps-cloud/api

Usage:

package main

import (
    "github.com/deps-cloud/api/v1alpha/extractor"
    "github.com/deps-cloud/api/v1alpha/tracker"

    "google.golang.org/grpc"
    "google.golang.org/grpc/credentials"
)

func dial(target string) *grpc.ClientConn {
    cc, _ := grpc.Dial(target, grpc.WithBlock(), grpc.WithInsecure())
    return cc
}

func main() {
    dependencyExtractor := extractor.NewDependencyExtractorClient(dial("address"))
    sourceService := tracker.NewSourceServiceClient(dial("address"))
    moduleService := tracker.NewModuleServiceClient(dial("address"))
    dependencyService := tracker.NewDependencyServiceClient(dial("address"))
}

Recompiling Protocol Buffer Files

I've provided a docker container that encapsulates the dependencies for regenerating the different language files.

docker run --rm -it \
    -v $(pwd)/swagger:/go/src/github.com/deps-cloud/api/swagger \
    -v $(pwd)/v1alpha:/go/src/github.com/deps-cloud/api/v1alpha \
    depscloud/api-builder

You can quickly invoke this command using the make compile-docker target.

NOTE: Changes to *.js and *.d.ts are done manually. Currently evaluating code generation options.

About

Repository containing proto api definitions and generated code.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 27.8%
  • Go 22.3%
  • JavaScript 17.9%
  • Dockerfile 14.9%
  • TypeScript 14.5%
  • Makefile 2.6%