@simpleview/sv-certs-client

Client for communicating with sv-certs. This npm package contains classes for communicating with the sv-certs GraphQL system.

Usage no npm install needed!

<script type="module">
  import simpleviewSvCertsClient from 'https://cdn.skypack.dev/@simpleview/sv-certs-client';
</script>

README

sv-certs-client

Client for communicating with sv-certs. This npm package contains classes for communicating with the sv-certs GraphQL system.

Installation

npm install @simpleview/sv-certs-client

GraphQL Endpoints

This section is provided to provide additional information about the GraphQL endpoints. To see the input parameters and output of each endpoint, please view the Schema in the GraphQL Explorer at https://graphql.simpleviewinc.com/.

All calls can only be made via an SV users. Bearer token must be provided in Authorization header per most sv-graphql projects.

certificates_query

list

  • Returns all certificates for an account.
  • See schema browser for filters/options.
query {
  certificates(acct_id: "test-certificates") {
    list {
      count
      docs {
        acct_id
        name
        domains
        challenge_type
        active
      }
    }
  }
}

certificates_mutation

upsert

  • Provided an acct_id and an array of certificate data, updates each associated certificate or inserts one if it does not exist.
  • See sv-certs to choose the right challenge.
  • Password is only necessary if retrieving certs via https such as when using curl.
  • See schema browser for all keys.
mutation {
  certificates(acct_id: "0") {
    upsert(
      input: [
        {
          name: "your_name1"
          domains: ["your_url1.com", "*.your_url1.com"]
          challenge_type: dns01
          active: true
          password: "yourpassword1"
        }
        {
          name: "your_name2"
          domains: ["your_url1.com"]
          challenge_type: http01
          active: true
          password: "yourpassword2"
        }
      ]
    ) {
      success
      message
      results {
        success
        message
        doc {
          acct_id
          name
          domains
          challenge_type
          active
        }
      }
      errors {
        success
        message
        doc {
          acct_id
          name
          domains
          challenge_type
          active
        }
      }
    }
  }
}

remove

  • Provided an acct_id and name, deletes the associated certificate from the system.
  • Take care not to call this endpoint without any filters as this will hard delete all certificates on the account, unless that is your intent.
mutation {
  certificates(acct_id: "0") {
    remove(input: { name: "your_name1" })  {
      success
      message
    }
  }
}