GithubHelp home page GithubHelp logo

angeloedades / covidcertificate-api-cli Goto Github PK

View Code? Open in Web Editor NEW

This project forked from admin-ch/covidcertificate-api-cli

0.0 1.0 0.0 1004 KB

JavaScript 1.06% Batchfile 0.08% TypeScript 98.86%

covidcertificate-api-cli's Introduction

CLI to use the Swiss Covid Certificate API

oclif Version Downloads/week License

About

cc-cli interacts with the Swiss Covid Certificate API. It was created for testing and demo purposes only.

OpenAPI Model Generation

The model where created from the API specification using openapi-typescript-codegen.

They can be regenerated with npm run generate-api. The implementation is in generate-api.js and the API Spec located at api-doc.json.

Debugging

cc-cli uses debug.

Enable API interaction tracing with DEBUG=cc-cli:api or use the --debug flag.

Usage

$ npm install -g swiss-admin-covid-certificate-api-cli
$ cc-cli COMMAND
running command...
$ cc-cli (-v|--version|version)
swiss-admin-covid-certificate-api-cli/1.3.0 darwin-x64 node-v14.17.0
$ cc-cli --help [COMMAND]
USAGE
  $ cc-cli COMMAND
...

Commands

cc-cli create-recovery

create a recovery certificate

USAGE
  $ cc-cli create-recovery

OPTIONS
  -d, --debug                                            enable debug output.
  --baseUrl=https://ws.covidcertificate-a.bag.admin.ch/  (required) the url of the REST API
  --certificateFile=~/a0000-cc-cli-TEST.cer              (required) path to PEM encoded certificate

  --countryOfTest=CH                                     (required) the country in which the covid certificate owner has
                                                         been tested. Format: string (2 chars according to ISO 3166
                                                         Country Codes).

  --dateOfBirth=1981-08-08                               (required) birthdate of the covid certificate owner. Format:
                                                         ISO 8601 date without time. Range: can be between 1900-01-01
                                                         and 2099-12-31

  --dateOfFirstPositiveTestResult=2020-01-01             (required) date when the sample for the test was collected.
                                                         Format: ISO 8601 date without time. Range: can be between
                                                         1900-01-01 and 2099-12-31

  --familyName=Federer                                   (required) family name of the covid certificate owner

  --givenName=Roger                                      (required) given name of the covid certificate owner

  --keyFile=~/a0000-cc-cli-TEST.encrypted.key            (required) path to PEM encoded private key

  --keyPassphrase=abcdefghijklmnopqrstuvwxyz             passphrase to decrypt the private key

  --language=fr                                          [default: de] Accepted languages are: de, it, fr, rm

  --local                                                adds additional headers required to mock the WSG

  --otp=a.b.c                                            (required) the otp secret

  --outDir=out                                           (required) [default:
                                                         /var/folders/hv/73dvbzz14ms96bgl5xlyxgww0000gn/T] output
                                                         directory

EXAMPLE

       export CC_CLI_OTP="a.b.c"
       export CC_CLI_KEY_PASSPHRASE="secret"
       export CC_CLI_BASE_URL="https://ws.covidcertificate-a.bag.admin.ch/"
       export CC_CLI_CERTIFICATE_FILE="ZH-spital-A-t.bit.admin.ch.cer"
       export CC_CLI_KEY_FILE="ZH-spital-A-t.bit.admin.ch.encrypted.key"
       export CC_CLI_OUT_DIR="out"
       cc-cli create-recovery \
         --language="de" \
         --familyName="Federer" \
         --givenName="Roger" \
         --dateOfBirth="1981-08-08" \
         --dateOfFirstPositiveTestResult="2020-01-01" \
         --countryOfTest="CH"

See code: src/commands/create-recovery.ts

cc-cli create-test

create a test certificate

USAGE
  $ cc-cli create-test

OPTIONS
  -d, --debug                                            enable debug output.
  --baseUrl=https://ws.covidcertificate-a.bag.admin.ch/  (required) the url of the REST API
  --certificateFile=~/a0000-cc-cli-TEST.cer              (required) path to PEM encoded certificate

  --dateOfBirth=1981-08-08                               (required) birthdate of the covid certificate owner. Format:
                                                         ISO 8601 date without time. Range: can be between 1900-01-01
                                                         and 2099-12-31

  --familyName=Federer                                   (required) family name of the covid certificate owner

  --givenName=Roger                                      (required) given name of the covid certificate owner

  --keyFile=~/a0000-cc-cli-TEST.encrypted.key            (required) path to PEM encoded private key

  --keyPassphrase=abcdefghijklmnopqrstuvwxyz             passphrase to decrypt the private key

  --language=fr                                          [default: de] Accepted languages are: de, it, fr, rm

  --local                                                adds additional headers required to mock the WSG

  --manufacturerCode=1304                                test manufacturer code. This should only be sent when it is not
                                                         a PCR test

  --memberStateOfTest=CH                                 (required) the country in which the covid certificate owner has
                                                         been tested. Format: string (2 chars according to ISO 3166
                                                         Country Codes).

  --otp=a.b.c                                            (required) the otp secret

  --outDir=out                                           (required) [default:
                                                         /var/folders/hv/73dvbzz14ms96bgl5xlyxgww0000gn/T] output
                                                         directory

  --resultDateTime=2021-05-22T11:12:85Z                  date and time of the test result production (optional for rapid
                                                         antigen test). Format: ISO 8601 date incl. time.

  --sampleDateTime=2021-05-22T11:12:85Z                  (required) date and time of the test sample collection. Format:
                                                         ISO 8601 date incl. time.

  --testingCentreOrFacility=Test Center                  (required) name of centre or facility.

  --typeCode=LP217198-3                                  type of test. This field is only mandatory when it is a PCR
                                                         test.

EXAMPLE

       export CC_CLI_OTP="a.b.c"
       export CC_CLI_KEY_PASSPHRASE="secret"
       export CC_CLI_BASE_URL="https://ws.covidcertificate-a.bag.admin.ch/"
       export CC_CLI_CERTIFICATE_FILE="ZH-spital-A-t.bit.admin.ch.cer"
       export CC_CLI_KEY_FILE="ZH-spital-A-t.bit.admin.ch.encrypted.key"
       export CC_CLI_OUT_DIR="out"
       cc-cli create-test \
         --language="de" \
         --familyName="Federer" \
         --givenName="Roger" \
         --dateOfBirth="1981-08-08" \
         --typeCode="LP6464-4" \
         --sampleDateTime="2020-01-01T17:29:41.063Z" \
         --resultDateTime="2020-01-02T17:29:41.063Z" \
         --testingCentreOrFacility="Centre de test de Payerne" \
         --memberStateOfTest="CH"

See code: src/commands/create-test.ts

cc-cli create-vaccination

create a vaccination certificate

USAGE
  $ cc-cli create-vaccination

OPTIONS
  -d, --debug                                            enable debug output.
  --baseUrl=https://ws.covidcertificate-a.bag.admin.ch/  (required) the url of the REST API
  --certificateFile=~/a0000-cc-cli-TEST.cer              (required) path to PEM encoded certificate

  --countryOfVaccination=CH                              (required) the country in which the covid certificate owner has
                                                         been vaccinated. Format: string (2 chars according to ISO 3166
                                                         Country Codes).

  --dateOfBirth=1981-08-08                               (required) birthdate of the covid certificate owner. Format:
                                                         ISO 8601 date without time. Range: can be between 1900-01-01
                                                         and 2099-12-31

  --familyName=Federer                                   (required) family name of the covid certificate owner

  --givenName=Roger                                      (required) given name of the covid certificate owner

  --keyFile=~/a0000-cc-cli-TEST.encrypted.key            (required) path to PEM encoded private key

  --keyPassphrase=abcdefghijklmnopqrstuvwxyz             passphrase to decrypt the private key

  --language=fr                                          [default: de] Accepted languages are: de, it, fr, rm

  --local                                                adds additional headers required to mock the WSG

  --medicinalProductCode=EU/1/20/1507                    (required) name of the medicinal product as registered in the
                                                         country.

  --numberOfDoses=2                                      (required) number in a series of doses

  --otp=a.b.c                                            (required) the otp secret

  --outDir=out                                           (required) [default:
                                                         /var/folders/hv/73dvbzz14ms96bgl5xlyxgww0000gn/T] output
                                                         directory

  --totalNumberOfDoses=2                                 (required) number in a series of doses

  --vaccinationDate=2020-01-01                           (required) date of vaccination. Format: ISO 8601 date without
                                                         time. Range: can be between 1900-01-01 and 2099-12-31

EXAMPLE

       export CC_CLI_OTP="a.b.c"
       export CC_CLI_KEY_PASSPHRASE="secret"
       export CC_CLI_BASE_URL="https://ws.covidcertificate-a.bag.admin.ch/"
       export CC_CLI_CERTIFICATE_FILE="ZH-spital-A-t.bit.admin.ch.cer"
       export CC_CLI_KEY_FILE="ZH-spital-A-t.bit.admin.ch.encrypted.key"
       export CC_CLI_OUT_DIR="out"
       cc-cli create-vaccination \
         --language="de" \
         --familyName="Federer" \
         --givenName="Roger" \
         --dateOfBirth="1981-08-08" \
         --medicinalProductCode="EU/1/20/1507" \
         --numberOfDoses="2" \
         --totalNumberOfDoses="2" \
         --vaccinationDate="2020-01-01" \
         --countryOfVaccination="CH"

See code: src/commands/create-vaccination.ts

cc-cli help [COMMAND]

display help for cc-cli

USAGE
  $ cc-cli help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

cc-cli pm-update FILE

updates otp values and signatures in a Postman collection

USAGE
  $ cc-cli pm-update FILE

ARGUMENTS
  FILE  path to Postman collection

OPTIONS
  -h, --help                                   show CLI help
  --keyFile=~/a0000-cc-cli-TEST.encrypted.key  (required) path to PEM encoded private key
  --keyPassphrase=abcdefghijklmnopqrstuvwxyz   passphrase to decrypt the private key
  --otp=a.b.c                                  (required) the otp secret

See code: src/commands/pm-update.ts

cc-cli sign FILE

reads a utf8 encoded text file, signs the text and writes the base64 encoded signature to stdout

USAGE
  $ cc-cli sign FILE

ARGUMENTS
  FILE  input file, should be JSON

OPTIONS
  -h, --help                                   show CLI help
  --keyFile=~/a0000-cc-cli-TEST.encrypted.key  (required) path to PEM encoded private key
  --keyPassphrase=abcdefghijklmnopqrstuvwxyz   passphrase to decrypt the private key

See code: src/commands/sign.ts

covidcertificate-api-cli's People

Contributors

cedricmoullet avatar delixfe avatar

Watchers

 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.